Files
Codeman/src/web/ports/infra-port.ts
T
arkonandClaude Opus 4.6 e05d507254 refactor: extract server.ts routes into domain modules (phase 3)
Split 6,710-line server.ts into focused route modules using port
interfaces for dependency injection. 107/109 routes extracted into
12 domain files with auth middleware, 5 port interfaces, and shared
helpers. Server.ts retains orchestration (SSE, lifecycle, state).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 19:12:45 +01:00

39 lines
1.4 KiB
TypeScript

/**
* @fileoverview Infra port — capabilities for infrastructure services.
* Route modules that interact with mux, push, teams, tunnel, etc. depend on this port.
*/
import type { TerminalMultiplexer } from '../../mux-interface.js';
import type { RunSummaryTracker } from '../../run-summary.js';
import type { PlanOrchestrator } from '../../plan-orchestrator.js';
import type { TeamWatcher } from '../../team-watcher.js';
import type { TunnelManager } from '../../tunnel-manager.js';
import type { PushSubscriptionStore } from '../../push-store.js';
/** A scheduled autonomous run with session lifecycle management */
export interface ScheduledRun {
id: string;
prompt: string;
workingDir: string;
durationMinutes: number;
startedAt: number;
endAt: number;
status: 'running' | 'completed' | 'failed' | 'stopped';
sessionId: string | null;
completedTasks: number;
totalCost: number;
logs: string[];
}
export interface InfraPort {
readonly mux: TerminalMultiplexer;
readonly runSummaryTrackers: Map<string, RunSummaryTracker>;
readonly activePlanOrchestrators: Map<string, PlanOrchestrator>;
readonly scheduledRuns: Map<string, ScheduledRun>;
readonly teamWatcher: TeamWatcher;
readonly tunnelManager: TunnelManager;
readonly pushStore: PushSubscriptionStore;
startScheduledRun(prompt: string, workingDir: string, durationMinutes: number): Promise<ScheduledRun>;
stopScheduledRun(id: string): Promise<void>;
}