@threadplane/ag-uiTypeAliasv0.3.4

FakeAgentScript

Deterministic event branches for FakeAgent, reachable through the constructor and through provideFakeAgent({ script }).

Each branch supplies a raw AG-UI event sequence — tool calls, state snapshots, custom events, anything the protocol defines. when: 'initial' matches a turn whose history carries no tool result; { toolMessageFor: id } matches the follow-up turn whose history carries a tool result for that tool call id. The first matching branch wins, and its events are wrapped in RUN_STARTED / RUN_FINISHED. When no branch matches, the canned token reply is streamed instead.

import type { FakeAgentScript } from '@threadplane/ag-ui';

Declaration

export type FakeAgentScript = readonly {
    when: 'initial' | {
        toolMessageFor: string;
    };
    events: readonly BaseEvent[];
}[];