Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(agent-runtime): preserve canonical tool markers
yg2224cd3af1c9e800
diff --git a/packages/agent-runtime/src/delegation-history.test.ts b/packages/agent-runtime/src/delegation-history.test.tsindex edffe38d2..273940c66 100644--- a/packages/agent-runtime/src/delegation-history.test.ts+++ b/packages/agent-runtime/src/delegation-history.test.ts@@ -329,8 +329,12 @@ describe("seedDelegateMessages", () => {{ query: "BrowserPreview" },{content: [{ type: "text", text: "Activated on-demand tools: BrowserPreview." }],- addedToolNames: ["BrowserPreview", "BrowserPreview"],- details: { query: "BrowserPreview", activated: ["BrowserPreview"] },+ addedToolNames: ["BrowserPreview"],+ details: {+ query: "BrowserPreview",+ activated: ["BrowserPreview"],+ addedToolNames: ["Glob"],+ },},"call-1",),@@ -347,7 +351,7 @@ describe("seedDelegateMessages", () => {details: {query: "BrowserPreview",activated: ["BrowserPreview"],- addedToolNames: ["BrowserPreview"],+ addedToolNames: ["Glob"],},});});diff --git a/packages/agent-runtime/src/delegation-history.ts b/packages/agent-runtime/src/delegation-history.tsindex 7ad607a99..588d9028c 100644--- a/packages/agent-runtime/src/delegation-history.ts+++ b/packages/agent-runtime/src/delegation-history.ts@@ -465,8 +465,15 @@ function toolResultFromUi(m: UiMessage, timestamp: number): ToolResultMessage {typeof name === "string" && name.length > 0,): [];+ const canonicalAddedToolNames =+ isRecord(rawDetails) && Array.isArray(rawDetails.addedToolNames)+ ? rawDetails.addedToolNames.filter(+ (name: unknown): name is string =>+ typeof name === "string" && name.length > 0,+ )+ : [];const details =- legacyAddedToolNames.length > 0+ legacyAddedToolNames.length > 0 && canonicalAddedToolNames.length === 0? {...(isRecord(rawDetails) ? rawDetails : {}),addedToolNames: [...new Set(legacyAddedToolNames)],