import type { AgentHarness, AgentHarnessFailure } from "./types.js"; import type { AgentResponder, AgentStreamEvent } from "@mono-agent/agent-contracts"; export declare class AgentHarnessFailureError extends Error { readonly failure: AgentHarnessFailure; constructor(failure: AgentHarnessFailure); } export type SessionRollover = "none" | "daily"; export declare function createAgentResponder(options: { readonly harness: AgentHarness; /** * Session rollover policy applied centrally to EVERY channel (cron, telegram, * slack, whatsapp, …) that routes through this responder. "daily" appends a * local-date bucket to the conversationId so a new calendar day starts a fresh * session (queue/warm-session/durable transcript/history all key off * conversationId), bounding unbounded growth. Default "none" = unchanged. */ readonly rollover?: SessionRollover; readonly rolloverTimezone?: string; readonly rolloverNotice?: boolean; /** Injectable clock for the rollover date; defaults to the system clock. */ readonly now?: () => Date; }): AgentResponder & { dispose(): Promise; cancel(conversationId: string, reason?: unknown): void; startNewSession(conversationId: string): Promise; }; export declare function assistantTextFromRuntimeEvent(event: unknown): string; /** * Per-turn state threaded through the mapper. `toolTimings` collects * tool_timing events (tool_use_id → execution_ms) so the duration can be * stamped onto the matching tool_call_completed instead of surfacing as a * separate event; entries are consumed on use. * * `toolNames` does the same for the tool's name, which the raw `tool_result` * block does not carry. Without it a consumer cannot tell WHICH tool finished — * and a subagent launch that failed before the runtime ever spawned a child has * no lifecycle bookend either, so its activity header would never settle and a * rejected `Agent` call would read as one still running. */ export interface StreamEventContext { readonly toolTimings?: Map; readonly toolNames?: Map; } export declare function streamEventFromRuntimeEvent(event: unknown, context?: StreamEventContext): AgentStreamEvent | undefined; /** * Commentary-phase text out of an assistant runtime event: tool-preamble * narration that belongs in neither the thinking stream nor the answer text * ({@link assistantTextFromRuntimeEvent} already excludes it there). Routed * to the stream's ephemeral `status` callback so the operator still sees the * progress transiently. */ export declare function commentaryTextFromRuntimeEvent(event: unknown): string; /** * Append a local-date bucket (`#YYYY-MM-DD`) to a conversationId under the * "daily" rollover policy. Idempotent — re-bucketing within the same day is a * no-op — and a passthrough when rollover is off. Exported for unit testing. */ export declare function bucketConversationId(conversationId: string, rollover: SessionRollover | undefined, timezone: string | undefined, now: () => Date): string; //# sourceMappingURL=responder.d.ts.map