mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-15 18:25:18 +02:00
chat: unify HITL approval UX behind a single paginated card and harden timeline supersede.
This commit is contained in:
parent
89e4953800
commit
2e132513be
25 changed files with 604 additions and 1157 deletions
|
|
@ -0,0 +1,28 @@
|
|||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
import type { HitlDecision } from "../types";
|
||||
|
||||
/**
|
||||
* Decisions are keyed by step index (not toolCallId) because the
|
||||
* resume protocol is positional — backend pairs ``decisions[i]`` with
|
||||
* ``action_requests[i]``. ``stage`` always targets the active step,
|
||||
* so per-tool bodies stay tcId-agnostic.
|
||||
*/
|
||||
export interface HitlApprovalAPI {
|
||||
total: number;
|
||||
currentStep: number;
|
||||
decisions: ReadonlyArray<HitlDecision | undefined>;
|
||||
stage: (decision: HitlDecision) => void;
|
||||
next: () => void;
|
||||
prev: () => void;
|
||||
goToStep: (i: number) => void;
|
||||
canAdvance: boolean;
|
||||
canSubmit: boolean;
|
||||
}
|
||||
|
||||
export const HitlApprovalContext = createContext<HitlApprovalAPI | null>(null);
|
||||
|
||||
export function useHitlApproval(): HitlApprovalAPI | null {
|
||||
return useContext(HitlApprovalContext);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue