AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(desktop): defer local AI probes until selector opens
tianma-if3c77c67155dc
diff --git a/apps/desktop/src/main/acp-host.mjs b/apps/desktop/src/main/acp-host.mjsindex e86e95da..ebe22a09 100644--- a/apps/desktop/src/main/acp-host.mjs+++ b/apps/desktop/src/main/acp-host.mjs@@ -757,6 +757,13 @@ export function createAcpHostRuntime(options = {}) {try {if (signal?.aborted) throw Object.assign(new Error("connection_timeout"), { code: "TIMEOUT" });child = await spawnAcpChild(spawnImpl, command, cwd);+ // Correlate transient Windows consoles with adapter connections without+ // logging command arguments, environment variables or credential paths.+ const processDiagnostic = (event, details = {}) => {+ try { options.onProcessDiagnostic?.({ event, requestId, pid: child.pid, ...details }); } catch { /* diagnostics are optional */ }+ };+ processDiagnostic("spawned");+ child.once("exit", (code, signal) => processDiagnostic("exited", { code, signal }));if (signal?.aborted) throw Object.assign(new Error("connection_timeout"), { code: "TIMEOUT" });// Drain stderr even when no logger is configured. Bound each connection's// diagnostic output and sanitize before crossing into the log callback.diff --git a/apps/desktop/src/main/acp-host.test.mjs b/apps/desktop/src/main/acp-host.test.mjsindex 930b03f8..34439124 100644--- a/apps/desktop/src/main/acp-host.test.mjs+++ b/apps/desktop/src/main/acp-host.test.mjs@@ -677,9 +677,11 @@ describe("ACP stdio session", () => {await chmod(wrapper, 0o755);const { spawn } = await import("node:child_process");const spawned = [];+ const processDiagnostics = [];const runtime = createAcpHostRuntime({platform: "darwin",env: {},+ onProcessDiagnostic: (event) => processDiagnostics.push(event),readProxy: () => "HTTPEnable : 1\nHTTPProxy : 127.0.0.1\nHTTPPort : 10808\nHTTPSEnable : 1\nHTTPSProxy : 127.0.0.1\nHTTPSPort : 10809\nSOCKSEnable : 1",spawnImpl(command, args, options) {spawned.push({ command, args, cwd: options.cwd, shell: options.shell, httpProxy: options.env?.HTTP_PROXY, httpsProxy: options.env?.HTTPS_PROXY });@@ -704,6 +706,10 @@ describe("ACP stdio session", () => {expect(report.newSession.mcpServers).toEqual([]);const pid = Number(await readFile(`${reportPath}.pid`, "utf8"));await waitUntilExited(pid);+ expect(processDiagnostics).toEqual([+ { event: "spawned", requestId: "probe-antigravity", pid },+ { event: "exited", requestId: "probe-antigravity", pid, code: null, signal: "SIGTERM" },+ ]);} finally {await rm(directory, { recursive: true, force: true });}diff --git a/apps/desktop/src/main/index.mjs b/apps/desktop/src/main/index.mjsindex 8d242ee4..ae39a237 100644--- a/apps/desktop/src/main/index.mjs+++ b/apps/desktop/src/main/index.mjs@@ -1833,6 +1833,7 @@ const startApplication = async () => {const acpRuntime = registerAcpIpc(ipcMain, createAcpHostRuntime({adapterStore: join(app.getPath("userData"), "acp-adapters"),onDiagnostic: (details) => { void writeDiagnostic("acp.adapter-stderr", details); },+ onProcessDiagnostic: ({ event, ...details }) => { void writeDiagnostic(`acp.adapter-${event}`, details); },mcpScriptPath: app.isPackaged? join(process.resourcesPath, "mcp-bridge", "edgeever-mcp-stdio.mjs"): join(projectRoot, "scripts", "edgeever-mcp-stdio.mjs"),diff --git a/apps/web/src/components/ai-sidebar/AiAgentSelector.tsx b/apps/web/src/components/ai-sidebar/AiAgentSelector.tsxindex a3dd1224..3a98ea8e 100644--- a/apps/web/src/components/ai-sidebar/AiAgentSelector.tsx+++ b/apps/web/src/components/ai-sidebar/AiAgentSelector.tsx@@ -46,7 +46,10 @@ export function AiAgentSelector({ source, adapterId, disabled, onPendingChange }queries: listedAgents.map((agent, index) => ({queryKey: ["ai-sidebar-adapter-probe", agent.id, agent.version ?? "", probeInputs[index]?.path ?? ""],queryFn: () => probeDesktopAcpAdapter(probeInputs[index]!),- enabled: desktop && probeInputs[index] !== null,+ // Listing connectors must not launch third-party processes at startup.+ // Their handshake (and any subprocesses they create) belongs to opening+ // the selector; sending a prompt also establishes its own connection.+ enabled: desktop && open && probeInputs[index] !== null,staleTime: 30_000,retry: false,refetchOnWindowFocus: false,