feat: select subagent runner from config

This commit is contained in:
pi
2026-04-10 23:57:53 +01:00
parent e864c3fe52
commit cf9312c8d7
4 changed files with 158 additions and 61 deletions

View File

@@ -1,3 +1,4 @@
import type { RunnerMode } from "./config.ts";
import type { SubagentRunResult } from "./schema.ts";
export interface RunSingleTaskInput {
@@ -7,3 +8,14 @@ export interface RunSingleTaskInput {
}
export type RunSingleTask = (input: RunSingleTaskInput) => Promise<SubagentRunResult>;
export function createConfiguredRunSingleTask(deps: {
loadConfig: (cwd: string) => { runner: RunnerMode };
processRunner: RunSingleTask;
tmuxRunner: RunSingleTask;
}): RunSingleTask {
return (input) => {
const config = deps.loadConfig(input.cwd);
return (config.runner === "tmux" ? deps.tmuxRunner : deps.processRunner)(input);
};
}