import type { AgentCapabilities, AgentObjectReference, AgentTransport, AgentTransportThreadOperations, TextPart } from "@agent-native/agentkit/protocol"; import { type RunOutcomeReport } from "./run-outcome.js"; import type { AgentChatRuntime } from "./runtime.js"; export interface CreateAgentKitProtocolAdapterOptions { /** Stable clock used for event timestamps and thread fallbacks. */ readonly now?: () => string; /** Allows a host to use its own stable IDs when the runtime omits one. */ readonly createId?: (prefix: string) => string; /** Optional capability overrides for host-owned protocol features. */ readonly capabilities?: AgentCapabilities; /** Format for assistant text when the runtime omits an explicit format. */ readonly textFormat?: TextPart["format"]; /** Host-owned operations layered onto Core's run and thread runtime. */ readonly operations?: Partial>; /** * Called once when a run reaches its terminal event, with how it ended and * how that was established. Telemetry only: a throwing callback never * changes the run. */ readonly onRunOutcome?: (report: RunOutcomeReport) => void; /** Maximum replay events retained for each process-local run. */ readonly maxRetainedEvents?: number; /** * Maximum completed runs retained for process-local replay. Active runs are * never evicted. Least-recently-accessed completed runs are removed first. */ readonly maxRetainedRuns?: number; /** * Milliseconds a completed run remains eligible for process-local replay. * The count bound may evict it sooner when newer completed runs arrive. */ readonly retainedRunTtlMs?: number; readonly metadata?: Record; /** * Localized label of the status shown while a turn the server stopped at its * time limit is being continued. Read each time it is shown. */ readonly autoContinueLabel?: string; } export interface AgentKitProtocolAdapter extends AgentTransport { dispose(): Promise; } export declare const AGENT_NATIVE_PROTOCOL_METADATA_KEY = "x-agent-native"; /** * Structured Agent-Native references carried through the protocol's metadata * extension point. Values remain references and identifiers; credential or * large content bodies do not belong here. These fields describe the context * used by an authorized runtime; receiving them never replaces server-side * authentication, row scoping, or action authorization. */ export interface AgentNativeProtocolMetadata { context?: { route?: AgentObjectReference; screen?: AgentObjectReference; focusedObjects?: AgentObjectReference[]; browserTabId?: string; [key: string]: unknown; }; identity?: { actor?: AgentObjectReference; workspace?: AgentObjectReference; organization?: AgentObjectReference; [key: string]: unknown; }; access?: Record; audit?: Record; trace?: Record; delegation?: Record; action?: { name: string; invocationId?: string; description?: string; inputSchema?: Record; outputSchema?: Record; readOnly?: boolean; destructive?: boolean; resultLinks?: AgentObjectReference[]; [key: string]: unknown; }; activity?: Record; smartObjects?: AgentObjectReference[]; observability?: Record; [key: string]: unknown; } /** * Adapts Core's session/turn runtime into the standalone AgentKit transport. * The event log is intentionally owned here: Core turns are one-shot streams, * while protocol subscribers may reconnect with an `afterSequence` cursor. */ export declare function createAgentKitProtocolAdapter(runtime: AgentChatRuntime, options?: CreateAgentKitProtocolAdapterOptions): AgentKitProtocolAdapter;