import { type SynapStreamSdkLike } from "./stream-events.js"; export interface SynapStreamHooksOptions { /** * Configured Synap SDK. Its `instance` namespace carries the stream events * (opened on the first one), and `conversation.record_message` writes the * user and assistant turns when the stream cannot carry them. Everything else * is a no-op without a stream, and an SDK without `conversation` simply * writes no turns then. */ sdk: SynapTurnSdkLike; /** * Explicit Synap user scope. Required on unauthenticated channels, where * `ctx.session.auth.current` is `null`. * * This *overrides* the eve principal — it is not a fallback. The factory is * called once per `agent/hooks/*.ts` module, so setting it on an * authenticated multi-user agent pins every session to the same scope. */ userId?: string; /** B2B instances only, where it is required. NOT accepted on a B2C * instance: the server rejects a call carrying one with HTTP 400. */ customerId?: string; /** Explicit conversation id. Defaults to the eve session id. */ conversationId?: string; /** * Whether tool results are reported. On by default, because a result is what * tells anticipation how the turn is actually going. * * ⚠ A tool result is usually your own customer's data. It is an anticipation * hint and never becomes a long-term memory, but it does leave your process. * Turn this off if that is not something you want to send. */ reportToolResults?: boolean; /** * Whether `reasoning.completed` is reported as a reasoning step. On by * default. Most providers return a summary rather than raw reasoning and * some return nothing; a turn without reasoning is an ordinary turn. */ reportThoughts?: boolean; /** * Whether `session.completed` closes the Synap session. On by default: an * eve session is the conversation, and when it ends the conversation has. * * ⚠ Turn this off if you pass an explicit `conversationId` that several eve * sessions share, where one session ending does not mean the conversation * has. */ endSessionOnComplete?: boolean; } /** * The SDK slice this module uses: the stream namespace, plus the REST * conversation write the turns fall back to. Duck-typed and optional, like * everything else here. */ type SendMessageArgs = { content: string; role?: string; event_type?: string; conversation_id?: string; user_id?: string; customer_id?: string; metadata?: Record; }; type RecordToolResultArgs = { result: unknown; conversation_id?: string; user_id?: string; customer_id?: string; tool_name?: string; tool_call_id?: string; }; type RecordThinkingArgs = { content: string; conversation_id?: string; user_id?: string; customer_id?: string; step_index?: number; thought_type?: string; }; type RecordMessageArgs = { role: string; content: string; conversation_id?: string; user_id?: string; customer_id?: string; }; type StreamInstance = NonNullable; export type SynapTurnSdkLike = { instance?: Omit & { send_message?: (options: SendMessageArgs) => Promise; record_tool_result?: (options: RecordToolResultArgs) => Promise; record_thinking?: (options: RecordThinkingArgs) => Promise; }; conversation?: { record_message?: (options: RecordMessageArgs) => Promise; context?: NonNullable["context"]; }; }; /** * Build the Synap stream hooks for `agent/hooks/`. * * Returns an eve `HookDefinition`. Export it as the default export of a file * under `agent/hooks/` and eve subscribes it to the runtime stream. */ export declare function createSynapStreamHooks(options: SynapStreamHooksOptions): import("eve/hooks").HookDefinition<"action.result" | "actions.requested" | "message.completed" | "message.received" | "reasoning.completed" | "session.completed">; export {}; //# sourceMappingURL=stream.d.ts.map