export { AgentMemoryConfig } from '@ziro-agent/memory'; export { RepairToolCall, RepairToolCallContext } from '@ziro-agent/tools'; import { A as Agent, a as AgentRunResult, b as AgentRunOptions } from './agent-recording-B5G6zanV.js'; export { c as AGENT_RECORDING_VERSION, d as AgentBudgetExceededInfo, e as AgentFinishReason, f as AgentRecordingStepLine, g as AgentResumeOptions, h as AgentSnapshot, i as AgentStep, j as AgentSuspendedError, C as CURRENT_SNAPSHOT_VERSION, k as CheckpointId, l as CheckpointMeta, m as Checkpointer, n as CreateAgentOptions, H as Handoff, o as HandoffLoopError, p as HandoffSpec, P as PrepareStep, q as PrepareStepContext, r as PrepareStepResult, R as ReplayAgentFromRecordingAgentOptions, s as ReplayMismatchError, t as ReplayRunBundle, u as ResumeFromCheckpointOptions, v as ResumeSummary, S as SnapshotVersion, w as StepEvent, x as StopWhen, y as StopWhenContext, z as createAgent, B as createReplayAgentFromRecording, D as createReplayModelFromAgentRecording, E as createReplayRunBundleFromRecording, F as createReplayToolsFromAgentRecording, G as handoffToolName, I as isAgentSuspendedError, J as migrateSnapshot, K as parseAgentRecordingJsonl, L as recordAgentRun, M as replayAgentFromRecording, N as replayAgentFromRecordingJsonl, O as runWithAgentRecording } from './agent-recording-B5G6zanV.js'; import { ChatMessage, ContinueUpstreamMidToolCallError, ModelStreamPart } from '@ziro-agent/core'; export { ContinueUpstreamMidToolCallError, tailBlocksContinueUpstream } from '@ziro-agent/core'; /** * `createNetwork` — multi-agent coordination via a deterministic, * function-form router (RFC 0007). * * Each step the router is consulted with the current conversation * state and decides which `Agent` (or `Agent[]` for parallel fan-out) * runs next. Returning `undefined` halts the network and emits the * final result. * * Explicitly NOT shipped (rejected in RFC 0007 §"Explicitly NOT * shipping"): * - LLM-as-router: opaque per-step LLM cost, non-auditable control * flow. Use a function-form router and embed an LLM call in your * own `router` body if you need it. * - Graph engine with conditional edges: `@ziro-agent/workflow` * covers the small graph case. */ interface AgentRouterContext { /** Conversation state visible at this routing decision. */ messages: ChatMessage[]; /** * Free-form, mutable state the router can read AND write across * steps. `createNetwork` never reads from `state`; it's purely the * router's scratchpad. Persist it yourself (snapshot, durable * storage) if you need cross-process resumability. */ state: Record; /** 0-indexed step counter — `0` on the first router invocation. */ stepIndex: number; /** * The agent that produced `lastResult`. `undefined` on the first * router invocation. */ lastAgent?: Agent; /** The result produced by the previous step. `undefined` on step 0. */ lastResult?: AgentRunResult; } /** * Pure routing function: given the current network context, return * the next agent (or array of agents to run in parallel), or * `undefined` to halt the network. * * Determinism is the contract: `router` MUST NOT call an LLM directly * — that's a separate primitive we explicitly chose not to build. * Embed branching logic on `state` / `stepIndex` / `lastResult` * instead. */ type AgentRouter = (ctx: AgentRouterContext) => Agent | Agent[] | undefined; interface CreateNetworkOptions { agents: readonly Agent[]; router: AgentRouter; /** Hard cap on router iterations. Default `25`. */ maxSteps?: number; } interface NetworkRunOptions extends Omit { /** * Pre-populated state passed to the router on step 0. Subsequent * routers see whatever the previous router returned via mutation. */ initialState?: Record; } interface NetworkStepRecord { stepIndex: number; /** Agents that ran this step — array because parallel fan-out is supported. */ agents: readonly Agent[]; /** * Results in the same order as `agents`. Single-agent steps still * use a length-1 array so consumers don't have to discriminate. */ results: readonly AgentRunResult[]; } interface NetworkRunResult { /** The final assistant text — taken from the LAST step's first result. */ text: string; steps: readonly NetworkStepRecord[]; /** The final state object after the router halted. */ state: Record; /** * Reason the network stopped: * - `'router-halt'`: router returned `undefined`. * - `'maxSteps'`: hit `maxSteps` cap (router would have continued). */ finishReason: 'router-halt' | 'maxSteps'; } interface Network { readonly agents: readonly Agent[]; run(options: NetworkRunOptions): Promise; } declare function createNetwork(options: CreateNetworkOptions): Network; /** * Narrow `ContinueUpstreamMidToolCallError` after a failed * `streamText({ continueUpstream: true })` call (RFC 0018). */ declare function isContinueUpstreamMidToolCallError(err: unknown): err is ContinueUpstreamMidToolCallError; /** * Operator-facing hint when {@link ContinueUpstreamMidToolCallError} is thrown: * do not retry bare continue-upstream; use the agent loop / checkpoint resume * ([RFC 0002](https://github.com/ziroagent/sdk-typescript/blob/main/rfcs/0002-human-in-the-loop.md)). */ declare const MID_TOOL_CALL_CONTINUE_UPSTREAM_HINT = "Do not retry streamText({ continueUpstream: true }). Resume via agent.resume(...) / resumeFromCheckpoint(threadId), or execute pending tools and issue a new model call with tool results in messages (RFC 0018)."; /** * Same predicate as {@link tailBlocksContinueUpstream}, exposed on the agent * package so hosts can branch before calling continue-upstream. */ declare function streamTailNeedsAgentRecovery(parts: readonly ModelStreamPart[]): boolean; export { Agent, type AgentRouter, type AgentRouterContext, AgentRunOptions, AgentRunResult, type CreateNetworkOptions, MID_TOOL_CALL_CONTINUE_UPSTREAM_HINT, type Network, type NetworkRunOptions, type NetworkRunResult, type NetworkStepRecord, createNetwork, isContinueUpstreamMidToolCallError, streamTailNeedsAgentRecovery };