import type { ObjectSchema, Static } from "toolcraft-schema"; import type { Command, Group, HandlerContext } from "../index.js"; import { UserError } from "../user-error.js"; export interface HumanInLoopConfig> { mode: "sync" | "async"; message: (ctx: { params: Static; commandPath: string; }) => string; plan?: (ctx: { params: Static; commandPath: string; }) => unknown | Promise; declineInputPrompt?: string; } /** * The wired human-in-loop runtime. Core entrypoints only know this interface; * the implementation ships behind the `toolcraft/human-in-loop` export and is * created with `createHumanInLoop({ provider, ... })`. */ export interface HumanInLoopRuntime { invoke(node: Command, ctx: HandlerContext, commandPath: string): Promise; mergeApprovalsGroup(root: Group): Group; } export interface HumanInLoopPending { status: "pending-approval"; approvalId: string; message: string; enqueuedAt: string; planHash?: string; } export declare class ApprovalDeclinedError extends UserError { readonly reason?: string; readonly approvalId?: string; readonly commandPath: string; constructor(options: { commandPath: string; reason?: string; approvalId?: string; }); }