chat: unify HITL approval UX behind a single paginated card and harden timeline supersede.

This commit is contained in:
CREDO23 2026-05-09 21:44:54 +02:00
parent 89e4953800
commit 2e132513be
25 changed files with 604 additions and 1157 deletions

View file

@ -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);
}