/** * Fleet spawn admission and bookkeeping for the Director. * * Owns spawn caps, model-matrix routing, nickname assignment, bridge * creation, and manifest/checkpoint registration. Task identity and waiter * semantics belong to DirectorTaskRegistry; termination remains a Director * lifecycle concern. */ import type { DirectorStateCheckpoint } from '../storage/director-state.js'; import type { SubagentConfig } from '../types/multi-agent.js'; import { InMemoryAgentBridge } from './agent-bridge.js'; import type { FleetBus, FleetUsageAggregator } from './fleet-bus.js'; import type { FleetManager } from './fleet-manager.js'; import type { InMemoryBridgeTransport } from './in-memory-transport.js'; import { type ModelMatrixSource } from './model-matrix.js'; import type { DefaultMultiAgentCoordinator } from './multi-agent-coordinator.js'; import type { WorktreeTaskStateUpdate } from './worktree-task-runner.js'; /** * Shape stored in the Director's manifestEntries map for each spawned subagent. * Keyed by subagentId. */ export interface ManifestEntry { subagentId: string; name: string; role?: string | undefined; provider?: string | undefined; model?: string | undefined; taskIds: string[]; /** Per-task worktree state updates, keyed by taskId. The entire record * is replaced each time (see `Director._asManifestEntry`), so external * references to a previous `worktrees` object become stale. */ worktrees?: Record | undefined; } /** * Narrow interface the helpers in this file need from the Director. * Kept here (instead of importing the full Director class) to avoid a * circular import: director.ts re-exports the helpers. */ export interface DirectorFleetHost { readonly id: string; readonly coordinator: DefaultMultiAgentCoordinator; readonly fleet: FleetBus; readonly transport: InMemoryBridgeTransport; readonly stateCheckpoint: DirectorStateCheckpoint | null; workCompleteFlag: boolean; spawnCount: number; readonly maxSpawns: number; readonly maxSpawnDepth: number; readonly spawnDepth: number; readonly maxFleetCostUsd: number; readonly maxFleetTokens?: number | undefined; readonly maxLeaderContextLoad: number; leaderContextPressure: number; readonly modelMatrix?: ModelMatrixSource | undefined; readonly usage: FleetUsageAggregator; readonly fleetManager: FleetManager | undefined; readonly manifestEntries: Map; readonly subagentBridges: Map; readonly subagentMeta: Map; readonly priceLookups: Map; readonly usedNicknames: Set; appendSessionEvent(event: unknown): Promise; scheduleManifest(): void; resolveMaxContext(): number; } /** * Spawn a subagent. See `Director.spawn` for the full contract. */ export declare function spawn(host: DirectorFleetHost, config: SubagentConfig, priceLookup?: { input?: number | undefined; output?: number | undefined; cacheRead?: number | undefined; cacheWrite?: number | undefined; }): Promise; //# sourceMappingURL=fleet-spawn.d.ts.map