refactor(coding-agent): restructured tool rendering to merge call and result displays

- Changed tool result rendering to merge call and result displays with tool arguments in headers across 13 tools.
- Added args parameter to render methods enabling display of contextual metadata like patterns, paths, and commands.
- Changed Read tool title to display line range when offset or limit arguments provided.
- Changed worker instantiation to use direct URL import instead of pre-bundled worker files.
- Removed streaming preview rendering logic from write tool.
This commit is contained in:
can1357
2026-01-23 13:46:06 +01:00
parent 763faa1615
commit e3eeb1bafd
15 changed files with 105 additions and 83 deletions
+1 -18
View File
@@ -4,7 +4,6 @@
* Runs each subagent in a Bun Worker and forwards AgentEvents for progress tracking.
*/
import { homedir } from "node:os";
import path from "node:path";
import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
import type { ModelRegistry } from "$c/config/model-registry";
@@ -39,21 +38,6 @@ import type {
SubagentWorkerResponse,
} from "./worker-protocol";
const workerBundlePromise: Promise<string> = (async () => {
const workerSrc = path.join(import.meta.dir, "worker.ts");
const bundlePath = path.join(homedir(), ".omp", "worker-bundle.js");
const result = await Bun.build({
entrypoints: [workerSrc],
target: "bun",
format: "esm",
});
if (!result.success) {
throw new Error(`Failed to bundle worker: ${result.logs.map((l) => l.message).join("\n")}`);
}
await Bun.write(bundlePath, await result.outputs[0].text());
return bundlePath;
})();
/** Options for worker execution */
export interface ExecutorOptions {
cwd: string;
@@ -327,8 +311,7 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
let worker: Worker;
try {
const workerPath = await workerBundlePromise;
worker = new Worker(workerPath, { type: "module" });
worker = new Worker(new URL("./worker.ts", import.meta.url), { type: "module" });
} catch (err) {
return {
index,