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) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 13:37:57 -04:00
parent 6fbff4eb76
commit 78d5274a53
+45
View File
@@ -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<void> {
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' });
}
}