Trim tool paths in new tasks once the worktree path arrives

This commit is contained in:
Ian Gulliver
2026-10-15 12:05:29 -07:00
parent f896408310
commit 37bf1b60a7
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -160,7 +160,7 @@ export function mountChat(root, src, makeHead) {
keepTurnStart: false, keepTurnStart: false,
quiet: false, quiet: false,
handoff: undefined, handoff: undefined,
root: src.root(), root: src.root,
taskId: src.taskId(), taskId: src.taskId(),
watchReport: (el, itemId) => { watchReport: (el, itemId) => {
el.dataset["inboxItem"] = itemId; el.dataset["inboxItem"] = itemId;
@@ -367,7 +367,7 @@ export function mountChat(root, src, makeHead) {
continue; continue;
} }
if (ev.kind === "agent.tool_call") { if (ev.kind === "agent.tool_call") {
addToRun(renderToolCall(p, ctx), { name: String(p["name"]), target: toolTarget(p["input"], ctx.root) }, parent); addToRun(renderToolCall(p, ctx), { name: String(p["name"]), target: toolTarget(p["input"], ctx.root()) }, parent);
continue; continue;
} }
const el = renderEvent(ev, ctx); const el = renderEvent(ev, ctx);
@@ -679,7 +679,7 @@ function subagentTag(parent, ctx) {
function renderToolCall(p, ctx) { function renderToolCall(p, ctx) {
const result = h("div", { class: "tool-result pending" }, "running…"); const result = h("div", { class: "tool-result pending" }, "running…");
ctx.tools.set(String(p["id"]), result); ctx.tools.set(String(p["id"]), result);
return h("details", { class: "tool" }, h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, String(p["name"])), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root))), h("pre", { class: "tool-input" }, JSON.stringify(p["input"], null, 2)), result); return h("details", { class: "tool" }, h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, String(p["name"])), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root()))), h("pre", { class: "tool-input" }, JSON.stringify(p["input"], null, 2)), result);
} }
function isSubagentCall(p) { function isSubagentCall(p) {
return p["name"] === "Agent" || p["name"] === "Task"; return p["name"] === "Agent" || p["name"] === "Task";
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -51,7 +51,7 @@ type Ctx = {
tools: Map<string, HTMLElement>; tools: Map<string, HTMLElement>;
subagents: Map<string, Subagent>; subagents: Map<string, Subagent>;
run: Run | undefined; run: Run | undefined;
root: string; root: () => string;
taskId: string | undefined; taskId: string | undefined;
lastMessage: HTMLElement | undefined; lastMessage: HTMLElement | undefined;
turnStart: HTMLElement | undefined; turnStart: HTMLElement | undefined;
@@ -227,7 +227,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
keepTurnStart: false, keepTurnStart: false,
quiet: false, quiet: false,
handoff: undefined, handoff: undefined,
root: src.root(), root: src.root,
taskId: src.taskId(), taskId: src.taskId(),
watchReport: (el, itemId) => { watchReport: (el, itemId) => {
el.dataset["inboxItem"] = itemId; el.dataset["inboxItem"] = itemId;
@@ -445,7 +445,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
continue; continue;
} }
if (ev.kind === "agent.tool_call") { if (ev.kind === "agent.tool_call") {
addToRun(renderToolCall(p, ctx), { name: String(p["name"]), target: toolTarget(p["input"], ctx.root) }, parent); addToRun(renderToolCall(p, ctx), { name: String(p["name"]), target: toolTarget(p["input"], ctx.root()) }, parent);
continue; continue;
} }
const el = renderEvent(ev, ctx); const el = renderEvent(ev, ctx);
@@ -796,7 +796,7 @@ function renderToolCall(p: Record<string, unknown>, ctx: Ctx): HTMLElement {
return h( return h(
"details", "details",
{ class: "tool" }, { class: "tool" },
h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, String(p["name"])), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root))), h("summary", {}, subagentTag(parentOf(p), ctx), h("span", { class: "tool-name" }, String(p["name"])), " ", h("span", { class: "tool-brief" }, toolBrief(p["input"], ctx.root()))),
h("pre", { class: "tool-input" }, JSON.stringify(p["input"], null, 2)), h("pre", { class: "tool-input" }, JSON.stringify(p["input"], null, 2)),
result, result,
); );