UNPKG

histoire

Version:

A fast story book powered by Vite

46 lines • 2.29 kB
import type { CreateElicitationRequest, CreateElicitationResponse } from '@agentclientprotocol/sdk'; import type { UiAgentElicitation, UiAgentElicitationReply, UiAgentElicitationResolved } from '@histoire/shared'; /** * Mediates agent requests for user input (forms and links) for in-thread cards. * Entered values are only forwarded to the agent; they are never emitted or stored. */ export declare function createElicitationBroker(options: { /** Redacts known secrets from agent text. */ sanitize: (text: string) => string; /** Emits one safe card. */ emit: (value: UiAgentElicitation) => void; /** Notifies browsers that a card is gone. */ resolved: (value: UiAgentElicitationResolved) => void; /** Thread whose active prompt owns an agent session. */ threadOf: (agentId: string, sessionId: string) => string | undefined; /** Unanswered request lifetime. */ timeoutMs?: number; }): { /** * Shows one agent request in its thread and waits for the user. * @param agentId Agent preset id. * @param request Agent elicitation request. * @param signal Agent-side cancellation. */ request(agentId: string, request: CreateElicitationRequest, signal?: AbortSignal): Promise<CreateElicitationResponse>; /** * Applies one browser answer; returns false when form content is invalid and the card stays open. * An accepted link stays listed until the agent completes it or the turn ends. * @param requestId Broker-owned identity. * @param action Submit, skip, or dismiss. * @param content Submitted form values, validated against the card's fields. */ reply(requestId: UiAgentElicitationReply['requestId'], action: UiAgentElicitationReply['action'], content?: unknown): boolean; /** * Agent finished a link flow out of band. * @param agentId Agent preset id. * @param elicitationId Agent link identity. */ complete(agentId: string, elicitationId: string): void; cancel: (agentId?: string, sessionId?: string) => void; /** Ends a prompt: its unanswered cards are cancelled. */ settle(agentId: string, sessionId: string): void; /** Cancels everything before the runtime retires. */ close(): void; }; //# sourceMappingURL=elicitations.d.ts.map