/** * delegateTask -- orchestrates the full task-delegation flow. * * 1. Validates required env vars (WORKSPACE_API_URL, WORKSPACE_API_KEY) * 2. Resolves execution limits (per-call options tighten but cannot loosen agent-level limits) * 3. Creates a SandboxBridge and prepares the session * 4. Executes the agent task with keepalive and timeout * 5. Reads output files and returns the result */ import type { DelegateTaskOptions, DelegateTaskResult, DelegateTaskStream, ExecutionLimits } from './types'; export { SandboxBridge } from './sandbox-bridge'; export { StreamParser } from './stream-parser'; export { filterEnvVars, generateSessionId, parseDurationToMs, buildSessionClaudeMd, buildWorkspaceClaudeMd, buildMcpSettingsJson, buildPrepareSessionRequest, buildCleanupCommands, } from './session-manager'; export { delegateTaskToolSchema, RESERVED_ENV_VARS } from './types'; export type { DelegateTaskOptions, DelegateTaskResult, DelegateTaskStream, DelegateTaskStreamEvent, DelegateTaskStreamTextEvent, DelegateTaskStreamToolUseEvent, DelegateTaskStreamToolResultEvent, DelegateTaskStreamErrorEvent, DelegateTaskStreamStatusEvent, DelegateTaskUsage, DelegateTaskInputFile, DelegateTaskOutputFile, ExecutionLimits, ExecutionStreamLog, DelegateWorkspaceContext, PrepareSessionRequest, PrepareSessionResponse, ExecuteAgentRequest, ExecuteAgentResponse, ReadOutputsRequest, ReadOutputsResponse, } from './types'; /** * Contextual information provided by the calling agent/framework * to configure the delegated task execution environment. */ export interface DelegateTaskContext { env: { WORKSPACE_API_URL?: string; WORKSPACE_API_KEY?: string; WORKSPACE_ID?: string; APP_ID?: string; APP_NAME?: string; RUNWORK_AI_PROXY_URL?: string; RUNWORK_PROXY_TOKEN?: string; [key: string]: string | undefined; }; /** Name of the agent initiating the task; used for logging and session paths */ agentName?: string; /** Agent-level execution limits; per-call options can tighten but not loosen these */ executionLimits?: ExecutionLimits; } /** * Delegate a task to a subordinate agent process running in a sandboxed * environment. The process has access to tools, can read/write files, and * returns structured output when complete. * * Non-streaming overload: awaits the full result. */ export declare function delegateTask(options: DelegateTaskOptions, context: DelegateTaskContext): Promise; /** * Streaming overload: returns a DelegateTaskStream that yields events as the * task progresses. The final result is available via `stream.result`. */ export declare function delegateTask(options: DelegateTaskOptions & { stream: true; }, context: DelegateTaskContext): DelegateTaskStream;