feat(progress): humanize subagent updates

This commit is contained in:
pi
2026-04-12 10:17:48 +01:00
parent a4e627084d
commit 86335c2971
8 changed files with 515 additions and 25 deletions

View File

@@ -9,6 +9,7 @@ import {
type SubagentRunResult,
type SubagentToolDetails,
} from "./schema.ts";
import { createProgressFormatter } from "./progress.mjs";
const MAX_PARALLEL_TASKS = 8;
const MAX_CONCURRENCY = 4;
@@ -141,11 +142,15 @@ export function createSubagentTool(deps: {
topLevelModel: params.model,
});
const progressFormatter = createProgressFormatter();
return deps.runSingleTask?.({
cwd: input.cwd ?? ctx.cwd,
onEvent(event) {
const text = progressFormatter.format(event);
if (!text) return;
onUpdate?.({
content: [{ type: "text", text: `Running subagent: ${event.type}` }],
content: [{ type: "text", text }],
details: makeDetails(input.mode, []),
});
},