From 78d5274a531a843e913967b93023ff2f96ed992c Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Thu, 23 Apr 2026 13:37:57 -0400 Subject: [PATCH] fix(cli): add DockerOrchestrator adapter for backend abstraction The upstream refactor (581c208) changed docker.ts from a class to plain functions. Hightower's backend.ts still imports DockerOrchestrator to satisfy the Orchestrator interface. Add a thin adapter class that delegates to the plain functions. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/cli/src/docker.ts | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/apps/cli/src/docker.ts b/apps/cli/src/docker.ts index 00ecbfe..38a1de8 100644 --- a/apps/cli/src/docker.ts +++ b/apps/cli/src/docker.ts @@ -290,3 +290,48 @@ export function listRunningWorkers(): string { 'table {{.Names}}\t{{.Status}}\t{{.RunningFor}}', ]); } + +/** + * Adapter class wrapping plain functions into the Orchestrator interface + * used by the Hightower backend abstraction layer. + */ +export class DockerOrchestrator implements import('./orchestrator.js').Orchestrator { + ensureInfra(): Promise { + return ensureInfra(); + } + ensureImage(version: string): void { + return ensureImage(version); + } + spawnWorker(opts: import('./orchestrator.js').WorkerOptions): import('./orchestrator.js').WorkerHandle { + const proc = spawnWorker(opts as WorkerOptions); + return { + onError(cb: (err: Error) => void) { + proc.on('error', cb); + }, + kill() { + proc.kill(); + }, + }; + } + stopWorkers(): void { + return stopWorkers(); + } + stopInfra(clean: boolean): void { + return stopInfra(clean); + } + listRunningWorkers(): string { + return listRunningWorkers(); + } + isTemporalReady(): boolean { + return isTemporalReady(); + } + getWorkerImage(version: string): string { + return getWorkerImage(version); + } + runEphemeral(image: string, args: string[], mounts: string[]): void { + const dockerArgs = ['run', '--rm', '--network', 'shannon-net']; + for (const m of mounts) dockerArgs.push('-v', m); + dockerArgs.push(image, ...args); + execFileSync('docker', dockerArgs, { stdio: 'inherit' }); + } +}