Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

2.3 KB
Raw Blame
diff --git a/dist/agent-loop.js b/dist/agent-loop.js
index 48f56a252dacdc19f55df9d97bc034932dce21a4..c833c36ffa4f43a48c41ee13277680af44bcd9b6 100644
--- a/dist/agent-loop.js
+++ b/dist/agent-loop.js
@@ -300,6 +300,12 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
             case "toolcall_start":
             case "toolcall_delta":
             case "toolcall_end":
+            // Hosted web search (PI-Desktop): the pi-ai adapters push
+            // `hosted_search_update` when a provider-side search block starts
+            // or completes. Forward it like any other progress event so the
+            // application renders each search round as it happens instead of
+            // only learning about searches from the final message.
+            case "hosted_search_update":
                 if (partialMessage) {
                     partialMessage = event.partial;
                     context.messages[context.messages.length - 1] = partialMessage;
diff --git a/dist/agent.js b/dist/agent.js
index e34d91afe7aa539ffff9f886352b02f23a1a51ea..ca4de6b800ea7f1b69a20f72ac852bffbdb32600 100644
--- a/dist/agent.js
+++ b/dist/agent.js
@@ -1,3 +1,4 @@
+import { localRequestErrorDetails } from "@earendil-works/pi-ai";
 import { createInitialSystemMessage, getCurrentSystemMessage, getCurrentSystemPrompt, toToolDeclaration, } from "@earendil-works/pi-ai";
 import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.js";
 import { getDefaultStreamFn } from "./stream-fn.js";
@@ -366,6 +367,7 @@ export class Agent {
         }
     }
     async handleRunFailure(error, aborted) {
+        const errorDetails = aborted ? undefined : localRequestErrorDetails(error);
         const failureMessage = {
             role: "assistant",
             content: [{ type: "text", text: "" }],
@@ -374,7 +376,8 @@ export class Agent {
             model: this._state.model.id,
             usage: EMPTY_USAGE,
             stopReason: aborted ? "aborted" : "error",
-            errorMessage: error instanceof Error ? error.message : String(error),
+            errorMessage: errorDetails?.message ?? (error instanceof Error ? error.message : String(error)),
+            ...(errorDetails ? { errorDetails } : {}),
             timestamp: Date.now(),
         };
         await this.processEvents({ type: "message_start", message: failureMessage });