import type { SpawnCapability, SpawnRequest, SpawnResult, WorkflowPhase, WorkflowSizingLabel } from '../types/index.js'; import { type DelegationPacket } from './workflow-delegation.js'; import type { SupportedRuntime } from './workflow-executor.js'; export type RuntimeAdapter = { id: string; runtime: SupportedRuntime | 'generic'; capability: SpawnCapability; execute(request: SpawnRequest, cwd: string): Promise; }; export type SpawnGuardrails = { maxConcurrent: number; maxPerTask: number; maxDelegationDepth: number; contextBudgetTokens: number; }; export type ActiveSession = { taskId: string; startedAt: number; spawnId: string; }; export declare const STALE_SESSION_TTL_MS = 300000; export declare function cleanStaleSessions(): void; export declare function getActiveSessions(): ReadonlyMap; export declare function registerAdapter(adapter: RuntimeAdapter): void; export declare function getAdapter(id: string): RuntimeAdapter | undefined; export declare function getAdapterForRuntime(runtime: SupportedRuntime | 'generic'): RuntimeAdapter | undefined; export declare function listAdapters(): RuntimeAdapter[]; export type BuildSpawnRequestInput = { taskId: string; runId: string; phase: WorkflowPhase; role: string; adapterId: string; packet: DelegationPacket; guardrails?: Partial; delegationDepth?: number; sizing?: WorkflowSizingLabel; }; export declare function buildSpawnRequest(input: BuildSpawnRequestInput): SpawnRequest; export type GuardrailViolation = { code: 'max-concurrent' | 'max-per-task' | 'max-depth' | 'unsupported-runtime' | 'no-adapter'; message: string; }; export declare function validateGuardrails(request: SpawnRequest, adapter: RuntimeAdapter | undefined): GuardrailViolation | null; export type SpawnExecutionMode = 'strict' | 'auto'; export type SpawnBridgeResult = { request: SpawnRequest; result?: SpawnResult; violation?: GuardrailViolation; fallback?: SpawnFallback; }; export type SpawnFallback = { type: 'request-artifact'; artifact: SpawnRequest; reason: string; }; export declare function executeSpawn(request: SpawnRequest, cwd: string, mode?: SpawnExecutionMode): Promise;