import type { CancelTurnResult, SessionAuthContext } from "#channel/types.js"; import type { HarnessSession } from "#harness/types.js"; import type { RuntimeRemoteAgentCallActionRequest } from "#runtime/actions/types.js"; import type { RuntimeSubagentRegistry } from "#runtime/subagents/registry.js"; import type { DynamicRemoteAgentConfig } from "#runtime/subagents/dynamic-remote-agent-config.js"; import type { ResolvedRuntimeRemoteAgentNode } from "#runtime/types.js"; import type { JsonObject } from "#shared/json.js"; type RemoteAgentSessionCoordinates = { readonly sessionId: string; }; export declare function startRemoteAgentSession(input: { readonly action: RuntimeRemoteAgentCallActionRequest; /** The dispatching turn's session principal, forwarded when `remote.forwardPrincipal` is set. */ readonly auth?: SessionAuthContext | null; readonly callbackBaseUrl: string | undefined; readonly callbackToken?: string; /** The root initiator's principal, forwarded alongside {@link auth}. */ readonly initiatorAuth?: SessionAuthContext | null; /** * Whether the dispatching agent opted into * `experimental.subagentPersistentSessions`. Persistent remote children run * in conversation mode so their sessions accept follow-up messages. */ readonly persistentSessions?: boolean; readonly remote: ResolvedRuntimeRemoteAgentNode; readonly session: HarnessSession; }): Promise; /** Continues one remote-agent session by its immutable session ID. */ export declare function continueRemoteAgentSession(input: { readonly callback: { readonly callId: string; readonly subagentName: string; readonly token: string; readonly url: string; }; readonly message: string; readonly outputSchema?: JsonObject; readonly remote: ResolvedRuntimeRemoteAgentNode; readonly sessionId: string; }): Promise; /** * Failure of a continue-session request, classified at the HTTP boundary. * Exported so tests can exercise {@link isRetryableRemoteAgentContinueError} * with real instances instead of re-encoding the classification. */ export declare class RemoteAgentContinueRequestError extends Error { readonly retryable: boolean; constructor(message: string, options: { readonly retryable: boolean; }); } /** * Returns true when a failed continue request may be retried. Only a * session that no longer exists (404 / SESSION_NOT_RESUMABLE) is permanent; * transient HTTP and network failures stay retryable so the dispatch step * keeps the agent handle and surfaces a retryable error instead of * discarding it — the model decides whether to try the same agentId again * (the step itself never re-sends: the callee may have accepted a delivery * whose response was lost). */ export declare function isRetryableRemoteAgentContinueError(error: unknown): boolean; export declare function cancelRemoteAgentTurn(input: { readonly remote: ResolvedRuntimeRemoteAgentNode; readonly sessionId: string; }): Promise; export declare function isRetryableRemoteAgentCancelError(error: unknown): boolean; export declare function resolveRemoteAgentForAction(input: { readonly dynamicRemoteAgent?: DynamicRemoteAgentConfig; readonly nodeId: string; readonly registry: RuntimeSubagentRegistry["subagentsByNodeId"]; readonly remoteAgentName: string; }): ResolvedRuntimeRemoteAgentNode; export {};