import { type HostToolSet, type HostToolTraceAttributes, type Tool, type TraceHostToolsOptions } from "../../tool/index.js"; import type { AgentResponse, Message as AgentMessage } from "../schemas/index.js"; import type { RuntimeReasoningOption } from "../types.js"; import type { AgentSystem } from "../types.js"; import type { ForkPart, ForkRuntimeStep, ForkRuntimeStreamLogger } from "./fork-runtime-types.js"; import { type SourceIntegrationPolicyManifest } from "../../integrations/source-policy.js"; export type { ForkPart, ForkRuntimeStep, ForkRuntimeStreamLogger } from "./fork-runtime-types.js"; export { buildRecoveredStepParts, createForkRuntimeStreamMappingState, createFrameworkStreamState, mapAgUiRuntimeEventToForkParts, mapFrameworkEventToForkParts, } from "./fork-runtime-part-mapper.js"; export { applyPartToStreamedStepState, createStreamedStepState, resolveForkStepResponse, } from "./fork-runtime-step-state.js"; export type { ForkRecoveredPartsState, ForkRuntimeStreamMappingState, FrameworkStreamState, RecoveredToolObservation, } from "./fork-runtime-part-mapper.js"; export type { StreamedStepState } from "./fork-runtime-step-state.js"; export { buildForkRuntimeStepFromResponse, shouldContinueForkRuntimeStep, } from "./fork-runtime-step-progress.js"; /** Result returned from fork runtime stream. */ export interface ForkRuntimeStreamResult { fullStream: AsyncIterable; steps: PromiseLike; totalUsage: PromiseLike<{ inputTokens?: number; outputTokens?: number; } | undefined>; } /** Default value for fork response promise timeout ms. */ export declare const DEFAULT_FORK_RESPONSE_PROMISE_TIMEOUT_MS = 1000; type ForkRuntimeStepPreparationInput = { messages: AgentMessage[]; buildInstructions: () => AgentSystem; forkToolNames: readonly string[]; }; type ForkRuntimeStepPreparation = { messages: AgentMessage[]; system: AgentSystem; /** * When present (returned by a step preparer that reads from the live * activated-tool context), this overrides `input.forkToolNames` for the * current step so newly activated remote tool schemas are exposed to the * provider without mutating the run-level fixed array. */ forkToolNames?: readonly string[]; }; /** Public API contract for fork runtime step preparer. */ export type ForkRuntimeStepPreparer = (input: ForkRuntimeStepPreparationInput) => ForkRuntimeStepPreparation | Promise; /** Public API contract for agent runtime fork step runner. */ export type AgentRuntimeForkStepRunner = (input: RunAgentRuntimeForkStepInput) => Promise<{ stream: ReadableStream; responsePromise: Promise; }>; /** Input payload for start agent runtime fork. */ export type StartAgentRuntimeForkInput = { apiUrl: string; authToken: string; projectId: string | null; model: string; temperature?: number; maxSteps: number; prompt?: string; maxContinuationSteps?: number; abortSignal?: AbortSignal; forkToolNames: string[]; providerToolNames?: string[]; runtimeTools: Record; sourceIntegrationPolicy?: SourceIntegrationPolicyManifest; providerOptions?: Record; reasoning?: RuntimeReasoningOption; buildInstructions: () => AgentSystem; onBeforeStop?: ForkRuntimeContinuationPromptResolver; initialMessages?: readonly AgentMessage[]; responseTimeoutMs?: number; logger?: ForkRuntimeStreamLogger; prepareStep?: ForkRuntimeStepPreparer; runStep?: AgentRuntimeForkStepRunner; }; /** Input payload for start agent runtime fork with host tools. */ export type StartAgentRuntimeForkWithHostToolsInput = Omit & { provider: string; forkModel: string; forkTools: HostToolSet; forkToolNames?: readonly string[]; traceTools?: TraceHostToolsOptions; }; /** Starts agent runtime fork with host tools. */ export declare function startAgentRuntimeForkWithHostTools(input: StartAgentRuntimeForkWithHostToolsInput): { streamResult: ForkRuntimeStreamResult; forkToolNames: string[]; }; /** Input payload for run agent runtime fork step. */ export type RunAgentRuntimeForkStepInput = { apiUrl: string; authToken: string; projectId: string | null; model: string; temperature?: number; messages: AgentMessage[]; system: AgentSystem; abortSignal?: AbortSignal; forkToolNames: string[]; providerToolNames?: string[]; runtimeTools: Record; sourceIntegrationPolicy?: SourceIntegrationPolicyManifest; providerOptions?: Record; reasoning?: RuntimeReasoningOption; }; /** Input payload for run framework fork step. */ export type RunFrameworkForkStepInput = Omit & { frameworkTools: Record; }; /** Run agent runtime fork step. */ export declare function runAgentRuntimeForkStep(input: RunAgentRuntimeForkStepInput): Promise<{ stream: ReadableStream; responsePromise: Promise; }>; /** Handles run framework fork step. * @deprecated Use runAgentRuntimeForkStep with runtimeTools. */ export declare function runFrameworkForkStep(input: RunFrameworkForkStepInput): Promise<{ stream: ReadableStream; responsePromise: Promise; }>; /** Public API contract for fork runtime continuation prompt resolver. */ export type ForkRuntimeContinuationPromptResolver = (input: { step: ForkRuntimeStep; stepIndex: number; }) => Promise | string | null; /** Message shape for create fork runtime user. */ export declare function createForkRuntimeUserMessage(input: { text: string; id?: string; timestamp?: number; }): AgentMessage; /** Create initial fork runtime messages. */ export declare function createInitialForkRuntimeMessages(input: { initialMessages?: readonly AgentMessage[]; prompt?: string; }): AgentMessage[]; /** Return max fork runtime step count. */ export declare function getMaxForkRuntimeStepCount(input: { maxSteps: number; maxContinuationSteps?: number; }): number; /** State for resolve fork runtime continuation. */ export declare function resolveForkRuntimeContinuationState(input: { continuationStepsRemaining: number; onBeforeStop?: ForkRuntimeContinuationPromptResolver; step: ForkRuntimeStep; currentMessages: AgentMessage[]; stepIndex: number; }): Promise<{ continuationStepsRemaining: number; currentMessages: AgentMessage[]; } | null>; /** Starts agent runtime fork. */ export declare function startAgentRuntimeFork(input: StartAgentRuntimeForkInput): ForkRuntimeStreamResult; //# sourceMappingURL=fork-runtime-stream.d.ts.map