import type { ExtensionContext, ToolDefinition } from "../extensions/types.ts"; import type { LaneWorkerRefusal } from "../model-capability.ts"; /** * Dependencies for {@link dispatchTmuxWorker}, injected from the construction site * (`RuntimeBuilder`) so the adapter itself stays a small, unit-testable, faux-tool-driven module * with no direct dependency on `AgentSession`/`ExtensionRunner`/`BackgroundLaneController`. */ export interface TmuxDispatchDeps { /** Runtime platform seam. Native Windows has no supported tmux backend; WSL reports `linux`. */ platform?: NodeJS.Platform; /** Look up a registered tool by name -- the SAME seam the model's own tool calls resolve * through (`AgentSession.getToolDefinition` -> `RuntimeBuilder.getToolDefinition`). `undefined` * when the tmux extension is not loaded in this session -- an honest, non-fatal skip, not a * crash and not a silent no-op. */ getToolDefinition: (name: string) => ToolDefinition | undefined; /** Build a fresh, non-turn-bound `ExtensionContext` for this call * (`ExtensionRunner.createContext()`) -- safe to invoke from the goal/idle path, outside any * live model turn. */ createExtensionContext: () => ExtensionContext; /** * Confirm that the tmux extension's caller-chosen lane id (reconstructed below from the * `fire_task` result's `details.job`) was durably registered by the host. The returned id is * identity-preserving and is the same value `Requirement.boundLaneId` uses. */ resolveManagedLaneId: (callerLaneId: string) => string | undefined; /** Active goal id, threaded onto the `fire_task` call so the dispatched lane is goal-tagged * (`ManagedLaneEvent.goalId`) -- `undefined` when no goal is active (dispatch still proceeds; * the resulting lane is simply untagged). */ getGoalId: () => string | undefined; /** * Worktree-sync lane-first dispatch (opt-in -- wired ONLY inside `runtime-builder.ts`'s * `worktreeSync.enabled` block, via the engine's `createLane`): when present, `dispatchTmuxWorker` * creates a fresh worktree-sync lane for this requirement BEFORE issuing any `fire_task` call, so * a creation refusal aborts cleanly before any tmux/pane side effect ever runs -- never a * half-made lane, never a fabricated worktree. On success the dispatched agent's `cwd` is the new * lane worktree and it carries `worktreeLane` (threaded to the tmux extension's launch profile -- * see `launch-profile.ts`'s `buildLaunchProfileFlags`). Absent dep -> existing byte-identical * `params.agents` (no `cwd`/`worktreeLane`), exactly as before this field existed. */ createLaneWorktree?: (args: { goalId?: string; requirementId: string; }) => Promise<{ laneKey: string; worktreePath: string; } | { skipReason: string; }>; /** * Lane-worker capability eligibility (opt-in -- wired only from `runtime-builder.ts`, backed by * `AgentSession.getLaneWorkerRefusal`): checked FIRST, before `createLaneWorktree`, so an * ineligible model's dispatch is refused before any lane/pane side effect ever runs. This is the * parent's best-effort check only -- the dispatched child session refuses authoritatively at its * own startup (main.ts) regardless of what the parent decides here. Absent dep -> no capability * check runs, byte-identical to before this field existed. */ evaluateWorkerLaneRefusal?: () => LaneWorkerRefusal | undefined; } /** * Structurally dispatch ONE persistent tmux worker agent for a single goal requirement, by * invoking the SAME `tmux_agent_manager` `fire_task` tool call the model itself would make. Core * -- not model discretion -- decides WHEN this fires (the goal tool's `dispatchTarget:"tmux"` * routing gates the call). The extension derives an immutable child profile from the parent's * admitted worker surface and reserves it durably before launch; no separate approval handshake is * involved. Any launch failure is surfaced through the existing `dispatchSkipReason` contract. */ export declare function dispatchTmuxWorker(deps: TmuxDispatchDeps, args: { requirementId: string; instructions: string; }): Promise<{ laneId?: string; skipReason?: string; }>; //# sourceMappingURL=tmux-dispatch.d.ts.map