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(ci): realign stale store and adapter contracts
v_wyxgwang5b0f15c923f7
diff --git a/apps/desktop/electron/main/live-voice/gemini-adapter.ts b/apps/desktop/electron/main/live-voice/gemini-adapter.tsindex 96dad572c..6696503c3 100644--- a/apps/desktop/electron/main/live-voice/gemini-adapter.ts+++ b/apps/desktop/electron/main/live-voice/gemini-adapter.ts@@ -80,9 +80,12 @@ export function createGeminiAdapter(context: LiveAdapterContext): LiveAdapter {context.onEvent({ kind: "error", code, reason });}- function onSocketClose(code: number, reason: Buffer): void {+ function onSocketClose(code: number, reason: Buffer | undefined): void {const errorCode = [1002, 1003, 1007, 1008, 1009].includes(code) ? "LIVE_PROTOCOL_ERROR" : "LIVE_NETWORK_ERROR";- onSocketFailure(errorCode, `Gemini Live socket closed (${code}): ${reason.toString("utf8")}`);+ // A close event may omit its reason; it must not turn socket teardown into+ // a TypeError that escapes the adapter.+ const detail = reason ? reason.toString("utf8") : "";+ onSocketFailure(errorCode, `Gemini Live socket closed (${code}): ${detail}`);}function onSocketError(error: Error): void {diff --git a/apps/desktop/test/auto-update.test.mjs b/apps/desktop/test/auto-update.test.mjsindex 5462c2add..b2a4a36ca 100644--- a/apps/desktop/test/auto-update.test.mjs+++ b/apps/desktop/test/auto-update.test.mjs@@ -209,7 +209,7 @@ test("renderer exposes the updates API, banner and settings row", () => {assert.match(releaseNotesDialogSource, /event\.key === "Escape"/);assert.match(appSource,- /<section className="main-pane">[\s\S]*?<UpdateBanner \/>/,+ /<section[^>]*className="main-pane"[\s\S]*?<UpdateBanner \/>/,"chat update notice is anchored inside the main pane",);assert.match(diff --git a/apps/desktop/test/background-tasks.test.mjs b/apps/desktop/test/background-tasks.test.mjsindex 9ed9f75fd..7fdea5981 100644--- a/apps/desktop/test/background-tasks.test.mjs+++ b/apps/desktop/test/background-tasks.test.mjs@@ -78,7 +78,7 @@ test("a background Bash call returns a backgroundTaskId and never a blocking stdtest("turn cancellation and timeout cannot reach a background task: it never registers a bash cancellation", () => {assert.match(rpcSources.replace(/\r/g, ""),- /cancellation_receiver = if remote_workspace\.is_some\(\)[\s\S]*?&& !p\.run_in_background\)/,+ /let cancellation_receiver = if matches!\(p\.tool_name\.as_str\(\), "Bash" \| "GenerateImages"\)[\s\S]*?if remote_workspace\.is_none\(\) && p\.tool_name == "Bash" && p\.run_in_background \{\s*None/,);assert.match(rpcSources.replace(/\r/g, ""), /"Bash" \| "GenerateImages"/);});diff --git a/apps/desktop/test/chat-error-message.test.mjs b/apps/desktop/test/chat-error-message.test.mjsindex 956f80f9b..c937844d0 100644--- a/apps/desktop/test/chat-error-message.test.mjs+++ b/apps/desktop/test/chat-error-message.test.mjs@@ -1,4 +1,4 @@-import { readStoreSource, readTranscriptSource, readMainSource } from "./helpers/source-contracts.mjs";+import { readStoreSource, readTranscriptSource } from "./helpers/source-contracts.mjs";import assert from "node:assert/strict";import { readFile } from "node:fs/promises";import test from "node:test";@@ -13,18 +13,16 @@ const readRoot = (path) =>const readSessionTranscript = () => read("src/lib/session-transcript.ts");test("provider failures stay in the transcript as structured assistant messages", async () => {- const [runtime, store, main, sessionTranscript] = await Promise.all([+ const [runtime, store, sessionTranscript] = await Promise.all([readRoot("packages/agent-runtime/src/runtime.ts"),readStoreSource(),- readMainSource(),readSessionTranscript(),]);assert.match(runtime, /error:\s*classifiedError,\s*isError:\s*true/);assert.match(runtime, /m\.status === "error" \|\| m\.isError \|\| m\.error/);- assert.match(sessionTranscript, /!event\.message\.error/);+ assert.match(sessionTranscript, /failed && empty && !event\.message\.error/);assert.match(store, /assistantErrorMessage\(event\.error\)/);- assert.match(main, /failed && empty && !event\.message\.error/);});test("assistant error messages expose readable provider details and one Continue action", async () => {diff --git a/apps/desktop/test/pending-interactive-restore.test.mjs b/apps/desktop/test/pending-interactive-restore.test.mjsindex 82e77fb66..a2cce8844 100644--- a/apps/desktop/test/pending-interactive-restore.test.mjs+++ b/apps/desktop/test/pending-interactive-restore.test.mjs@@ -41,6 +41,7 @@ function harness({ sessions = DEFAULT_SESSIONS, pendingAsks = {}, pendingPermisssessions,pendingAsks,pendingPermissions,+ askDrafts: {},planningStates: {},planCheckpoints: {},pendingPlans: {},diff --git a/apps/desktop/test/session-turn-ended.test.mjs b/apps/desktop/test/session-turn-ended.test.mjsindex 47e09343d..99f7e73d7 100644--- a/apps/desktop/test/session-turn-ended.test.mjs+++ b/apps/desktop/test/session-turn-ended.test.mjs@@ -32,6 +32,8 @@ function fixture() {const persistence = createEventPersistence({runtimeState: { host: null },+ steeringReplies: new Set(),+ completionNoticeTurns: new Set(),activeTurns,activeToolCalls: new Map(),activeToolCallKey: coordination.activeToolCallKey,diff --git a/apps/desktop/test/shutdown-regenerate-persistence.test.mjs b/apps/desktop/test/shutdown-regenerate-persistence.test.mjsindex a0d630373..64e7c1bd5 100644--- a/apps/desktop/test/shutdown-regenerate-persistence.test.mjs+++ b/apps/desktop/test/shutdown-regenerate-persistence.test.mjs@@ -71,7 +71,7 @@ test(`quit settles a regenerated branch when the host is ${outcome}`, async (t)settleIf() {}, dispose() {},};const persistence = createEventPersistence({- runtimeState: { host }, steeringReplies: new Set(), activeTurns,+ runtimeState: { host }, steeringReplies: new Set(), completionNoticeTurns: new Set(), activeTurns,activeToolCalls: new Map(), activeToolCallKey: (s, c) => `${s}:${c}`,approvedExecutionIdsBySession: new Map(), approvedExecutionTurns: new Map(),pendingExecutionFinishes: new Map(), planSubmissionTurnIds: new Set(),