import type { AgentContext } from '../../protocol.js'; /** * Snapshot of the most recent `send_message` outcome — what the agent * just did and whether it landed cleanly. Tracked by the WS RPC layer * after every dispatch, surfaced through `describe_context` so apps * don't have to roll their own `lastDispatchError` field in state. * * `status: 'dispatched'` means the reducer ran and state advanced; * `errors` here describes downstream effects that failed during the * drain window (Phase-5 catch-and-report). `status: 'rejected'` * means the validator caught a structural issue before the reducer. * `status: 'reducer-threw'` means the reducer itself threw — state * may be partially advanced, but the dispatch should be treated as * a failure for retry purposes. */ export type LastDispatchOutcome = { variant: string; status: 'dispatched' | 'rejected' | 'reducer-threw'; errors?: ReadonlyArray<{ message: string; }>; warnings?: ReadonlyArray<{ path: string; message: string; }>; at: number; }; export type DescribeContextHost = { getState(): unknown; getAgentContext(): ((state: unknown) => AgentContext) | null; /** * Optional accessor for the most recent dispatch outcome. When the * outcome had errors or warnings, `describe_context` prepends a * synthetic hint so the agent reads "Last dispatch X failed/landed * with caveats" without the app having to maintain a parallel state * field. Lenient: undefined / null accessor disables the feature. */ getLastDispatchOutcome?: () => LastDispatchOutcome | null; }; export type DescribeContextResult = { context: AgentContext; }; export declare function handleDescribeContext(host: DescribeContextHost): DescribeContextResult; //# sourceMappingURL=describe-context.d.ts.map