YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Fix OpenCode detection and MCP setup (#7618)
Louis Beaumont3692d533f532
diff --git a/apps/screenpipe-app-tauri/components/settings/__tests__/ai-tools-card.test.tsx b/apps/screenpipe-app-tauri/components/settings/__tests__/ai-tools-card.test.tsxindex 9f8301ce1..eddb5e16f 100644--- a/apps/screenpipe-app-tauri/components/settings/__tests__/ai-tools-card.test.tsx+++ b/apps/screenpipe-app-tauri/components/settings/__tests__/ai-tools-card.test.tsx@@ -22,6 +22,7 @@ const libMocks = vi.hoisted(() => ({isGeminiMcpInstalled: vi.fn(async () => false),isRunnerMcpInstalled: vi.fn(async () => false),isWindsurfMcpInstalled: vi.fn(async () => false),+ isOpencodeMcpInstalled: vi.fn(async () => false),isVscodeMcpInstalled: vi.fn(async () => false),}));@@ -56,6 +57,7 @@ vi.mock("@/lib/ai-tools-mcp", () => ({runner: "Runner",windsurf: "Windsurf (Devin Desktop)",vscode: "VS Code",+ opencode: "OpenCode",},SKILLS_TARGET: {claude: "claude",@@ -85,6 +87,7 @@ describe("AiToolsCard", () => {failed: [],}));libMocks.isClaudeCodeMcpInstalled.mockResolvedValue(false);+ libMocks.isOpencodeMcpInstalled.mockResolvedValue(false);hookMocks.getInstalledMcpVersion.mockResolvedValue(null);hookMocks.isCodexMcpInstalled.mockResolvedValue(false);skillsMocks.areExternalAgentSkillsInstalled.mockResolvedValue(false);@@ -92,6 +95,22 @@ describe("AiToolsCard", () => {afterEach(() => cleanup());+ it("connects OpenCode without skills and can remove the confirmed connection", async () => {+ libMocks.detectAiTools.mockResolvedValue(["opencode"]);+ libMocks.connectAiToolTargets.mockImplementationOnce(async (targets: string[]) => {+ libMocks.isOpencodeMcpInstalled.mockResolvedValue(true);+ return { succeeded: targets, failed: [] };+ });+ render(<AiToolsCard />);+ fireEvent.click(await screen.findByRole("button", { name: /connect all/i }));+ await waitFor(() => expect(libMocks.connectAiToolTargets).toHaveBeenCalledWith(["opencode"]));+ expect(await screen.findByText("All 1 connected")).toBeVisible();+ expect(await screen.findByText("OpenCode")).toBeVisible();+ fireEvent.click(screen.getByRole("button", { name: /remove/i }));+ await waitFor(() => expect(libMocks.disconnectAiToolTargets).toHaveBeenCalledWith(["opencode"]));+ expect(skillsMocks.areExternalAgentSkillsInstalled).not.toHaveBeenCalled();+ });+it("shows VS Code as connected and allows removing its MCP connection", async () => {libMocks.detectAiTools.mockResolvedValue(["vscode"]);libMocks.isVscodeMcpInstalled.mockResolvedValue(true);diff --git a/apps/screenpipe-app-tauri/components/settings/ai-tools-card.tsx b/apps/screenpipe-app-tauri/components/settings/ai-tools-card.tsxindex 487f25a7f..ff8ea61c0 100644--- a/apps/screenpipe-app-tauri/components/settings/ai-tools-card.tsx+++ b/apps/screenpipe-app-tauri/components/settings/ai-tools-card.tsx@@ -32,6 +32,7 @@ import {isRunnerMcpInstalled,isWindsurfMcpInstalled,isVscodeMcpInstalled,+ isOpencodeMcpInstalled,} from "@/lib/ai-tools-mcp";import { areExternalAgentSkillsInstalled } from "@/lib/external-agent-skills";import {@@ -115,6 +116,8 @@ async function isToolConnected(id: ConnectAllToolId): Promise<boolean> {return isWindsurfMcpInstalled();case "vscode":return isVscodeMcpInstalled();+ case "opencode":+ return isOpencodeMcpInstalled();}}@@ -137,6 +140,8 @@ function ToolIcon({ id }: { id: ConnectAllToolId }) {return <img src="/images/openclaw.png" alt="" className={`${img} rounded`} />;case "hermes":return <img src="/images/hermes.png" alt="" className={`${img} rounded`} />;+ case "opencode":+ return <img src="/images/opencode.svg" alt="" className={`${img} dark:invert`} />;case "vscode":return <img src="/images/vscode.svg" alt="" className={img} />;case "grokbot":diff --git a/apps/screenpipe-app-tauri/lib/__tests__/ai-tools-mcp.test.ts b/apps/screenpipe-app-tauri/lib/__tests__/ai-tools-mcp.test.tsindex beeb1bf60..531882e2e 100644--- a/apps/screenpipe-app-tauri/lib/__tests__/ai-tools-mcp.test.ts+++ b/apps/screenpipe-app-tauri/lib/__tests__/ai-tools-mcp.test.ts@@ -8,6 +8,7 @@// fails, and disconnect stays idempotent.import { beforeEach, describe, expect, it, vi } from "vitest";+import { parse as parseJsonc } from "jsonc-parser";import { parse as parseYaml } from "yaml";const fsMock = vi.hoisted(() => ({@@ -104,6 +105,9 @@ vi.mock("@/lib/hooks/use-hardcoded-tiles", () => ({vi.mock("@/lib/external-agent-skills", () => skillsMock);import {+ installOpencodeMcp,+ uninstallOpencodeMcp,+ isOpencodeMcpInstalled,installVscodeMcp,uninstallVscodeMcp,isVscodeMcpInstalled,@@ -728,3 +732,90 @@ describe("explicit cloud MCP setup without a CLI", () => {expect(fsMock.files.size).toBe(0);});});+++describe("OpenCode MCP", () => {+ const dir = "/Users/test/.config/opencode";+ const path = `${dir}/opencode.jsonc`;++ it("detects OpenCode's global config directory and installer binary", async () => {+ expect(await detectAiTools()).not.toContain("opencode");+ fsMock.files.set(dir, "");+ expect(await detectAiTools()).toContain("opencode");+ fsMock.files.clear();+ fsMock.files.set("/Users/test/.opencode/bin/opencode", "");+ expect(await detectAiTools()).toContain("opencode");+ });++ it("connects using native command/environment fields and preserves JSONC and other servers", async () => {+ const original = `{+ // Keep my model and server settings.+ "model": "provider/model",+ "mcp": {+ "other": { "type": "remote", "url": "https://example.com/mcp" },+ "Screenpipe": { "type": "local", "command": ["old"], "enabled": false, "timeout": 12000 },+ },+ }`;+ fsMock.files.set(path, original);+ await connectAiTool("opencode");+ const text = fsMock.files.get(path)!;+ const config = parseJsonc(text);+ expect(text).toContain("// Keep my model and server settings.");+ expect(config.model).toBe("provider/model");+ expect(config.mcp.other.url).toBe("https://example.com/mcp");+ expect(config.mcp.Screenpipe).toEqual({+ type: "local", command: ["/app/bun", "x", "screenpipe-mcp@latest"],+ environment: { SCREENPIPE_MCP_CLIENT: "opencode", SCREENPIPE_LOCAL_API_KEY: "sp-test", SCREENPIPE_API_URL: "http://localhost:3030" },+ enabled: true, timeout: 12000,+ });+ expect(await isOpencodeMcpInstalled()).toBe(true);+ expect(tauriMock.setAiToolAutoConnectOptOut).toHaveBeenCalledWith("opencode", false);+ expect(skillsMock.installExternalAgentSkills).not.toHaveBeenCalled();+ expect(Array.from(fsMock.files.values())).toContain(original);+ await installOpencodeMcp();+ expect(fsMock.files.get(path)).toBe(text);+ await disconnectAiTool("opencode");+ expect(tauriMock.setAiToolAutoConnectOptOut).toHaveBeenCalledWith("opencode", true);+ expect(parseJsonc(fsMock.files.get(path)!).mcp).toEqual({ other: config.mcp.other });+ expect(await isOpencodeMcpInstalled()).toBe(false);+ });++ it("prefers JSONC and removes Screenpipe from all global layers on disconnect", async () => {+ const entry = { type: "local", command: ["old"] };+ for (const file of ["config.json", "opencode.json", "opencode.jsonc"]) {+ fsMock.files.set(`${dir}/${file}`, JSON.stringify({ mcp: { screenpipe: entry, other: entry } }));+ }+ await installOpencodeMcp();+ expect(parseJsonc(fsMock.files.get(path)!).mcp.screenpipe.command[0]).toBe("/app/bun");+ expect(JSON.parse(fsMock.files.get(`${dir}/opencode.json`)!).mcp.screenpipe.command).toEqual(["old"]);+ await uninstallOpencodeMcp();+ for (const file of ["config.json", "opencode.json", "opencode.jsonc"]) {+ expect(parseJsonc(fsMock.files.get(`${dir}/${file}`)!).mcp).toEqual({ other: entry });+ }+ });++ it("honors XDG_CONFIG_HOME instead of macOS Application Support", async () => {+ tauriMock.getEnv.mockImplementation(async (name?: string) => name === "XDG_CONFIG_HOME" ? "/custom/config" : "");+ fsMock.files.set("/custom/config/opencode", "");+ fsMock.files.set("/custom/config/opencode/opencode.json", "{}");+ expect(await detectAiTools()).toContain("opencode");+ await installOpencodeMcp();+ expect(parseJsonc(fsMock.files.get("/custom/config/opencode/opencode.json")!).mcp.screenpipe.enabled).toBe(true);+ expect(fsMock.files.has(path)).toBe(false);+ });++ it.each(["{broken", '{"mcp": []}', '{"mcp": null}', '[]'])("refuses invalid config %s without writing", async (text) => {+ fsMock.files.set(path, text);+ await expect(installOpencodeMcp()).rejects.toThrow();+ expect(fsMock.files.get(path)).toBe(text);+ expect(fsMock.files.size).toBe(1);+ expect(await isToolConfigHealthy("opencode")).toBe(false);+ });++ it("does not report a disabled or remote entry as connected", async () => {+ fsMock.files.set(path, '{"mcp":{"screenpipe":{"type":"local","command":["bun"],"enabled":false}}}');+ expect(await isOpencodeMcpInstalled()).toBe(false);+ fsMock.files.set(path, '{"mcp":{"screenpipe":{"type":"remote","url":"https://example.com"}}}');+ expect(await isOpencodeMcpInstalled()).toBe(false);+ });+});diff --git a/apps/screenpipe-app-tauri/lib/ai-tools-mcp.ts b/apps/screenpipe-app-tauri/lib/ai-tools-mcp.tsindex 1c542d47e..b07c16e63 100644--- a/apps/screenpipe-app-tauri/lib/ai-tools-mcp.ts+++ b/apps/screenpipe-app-tauri/lib/ai-tools-mcp.ts@@ -52,6 +52,7 @@ const CONNECT_ALL_TOOL_IDS = ["runner","windsurf","vscode",+ "opencode","grokbot",] as const;export type ConnectAllToolId = (typeof CONNECT_ALL_TOOL_IDS)[number];@@ -71,6 +72,7 @@ export const CONNECT_ALL_TOOL_NAMES: Record<ConnectAllToolId, string> = {// side of the OTA update recognize it.windsurf: "Windsurf (Devin Desktop)",vscode: "VS Code",+ opencode: "OpenCode",};// Skills support per tool lives in the disconnect-all component's@@ -101,6 +103,10 @@ export async function detectAiTools(): Promise<ConnectAllToolId[]> {["runner", async () => exists(await join(home, ".runner"))],["windsurf", async () => exists(await join(home, ".codeium", "windsurf"))],["vscode", async () => exists(await dirname(await getVscodeMcpConfigPath()))],+ ["opencode", async () =>+ (await exists(await getOpencodeConfigDir())) ||+ (await exists(await join(home, ".opencode", "bin", "opencode"))) ||+ (await exists(await join(home, ".opencode", "bin", "opencode.exe")))],// Connect all finishes the local integrations before a cloud request.["grokbot", isGrokBotDetected],];@@ -672,15 +678,15 @@ export async function getVscodeMcpConfigPath(): Promise<string> {return join(await configDir(), "Code", "User", "mcp.json");}-function parseVscodeConfig(text: string, path: string): Record<string, unknown> {+function parseJsoncMcpConfig(text: string, path: string, serverKey: string): Record<string, unknown> {const errors: ParseError[] = [];const parsed = parse(text, errors, { allowTrailingComma: true, allowEmptyContent: true });const root = parsed === undefined ? {} : parsed;if (errors.length || !root || typeof root !== "object" || Array.isArray(root)) {throw new Error(`${path} is not valid JSON — fix or remove it; screenpipe won't overwrite it`);}- if ("servers" in root && (!root.servers || typeof root.servers !== "object" || Array.isArray(root.servers))) {- throw new Error(`${path}: servers is present but not an object`);+ if (serverKey in root && (!root[serverKey] || typeof root[serverKey] !== "object" || Array.isArray(root[serverKey]))) {+ throw new Error(`${path}: ${serverKey} is present but not an object`);}return root;}@@ -688,7 +694,7 @@ function parseVscodeConfig(text: string, path: string): Record<string, unknown>export async function isVscodeMcpInstalled(): Promise<boolean> {try {const path = await getVscodeMcpConfigPath();- const root = parseVscodeConfig(await readTextFile(path), path);+ const root = parseJsoncMcpConfig(await readTextFile(path), path, "servers");const servers = root.servers as Record<string, { type?: string }> | undefined;return Object.entries(servers ?? {}).some(([key, value]) =>key.toLowerCase() === "screenpipe" && value?.type === "stdio");@@ -698,7 +704,7 @@ export async function isVscodeMcpInstalled(): Promise<boolean> {async function updateVscodeMcp(mcp?: McpCommand): Promise<void> {const path = await getVscodeMcpConfigPath();let text = (await readConfigText(path)) ?? "";- const root = parseVscodeConfig(text, path);+ const root = parseJsoncMcpConfig(text, path, "servers");const servers = root.servers as Record<string, unknown> | undefined;const keys = Object.keys(servers ?? {}).filter((key) => key.toLowerCase() === "screenpipe");if (!mcp && !keys.length) return;@@ -734,6 +740,87 @@ export async function uninstallVscodeMcp(): Promise<void> {await updateVscodeMcp();}+// OpenCode uses XDG paths on every OS (including macOS), not configDir().+// https://opencode.ai/docs/config/ and https://opencode.ai/docs/mcp-servers/+async function getOpencodeConfigDir(): Promise<string> {+ const xdg = await commands.getEnv("XDG_CONFIG_HOME");+ return join(xdg || await join(await homeDir(), ".config"), "opencode");+}++async function getOpencodeConfigPaths(): Promise<string[]> {+ const dir = await getOpencodeConfigDir();+ // Match OpenCode's global writer priority. Lower layers are also removed on+ // disconnect so an older entry cannot become active again.+ return Promise.all(["opencode.jsonc", "opencode.json", "config.json"].map(file => join(dir, file)));+}++export async function getOpencodeMcpConfigPath(): Promise<string> {+ const paths = await getOpencodeConfigPaths();+ for (const path of paths) if (await exists(path)) return path;+ return paths[0];+}++export async function isOpencodeMcpInstalled(): Promise<boolean> {+ try {+ const servers: Record<string, { type?: string; command?: unknown; enabled?: boolean }> = {};+ for (const path of (await getOpencodeConfigPaths()).reverse()) {+ const text = await readConfigText(path);+ if (text === null) continue;+ const root = parseJsoncMcpConfig(text, path, "mcp");+ for (const [key, value] of Object.entries(root.mcp ?? {})) {+ servers[key] = { ...servers[key], ...(value as object) };+ }+ }+ return Object.entries(servers).some(([key, value]) =>+ key.toLowerCase() === "screenpipe" && value.type === "local" &&+ Array.isArray(value.command) && value.command.length > 0 && value.enabled !== false);+ } catch { return false; }+}++async function updateOpencodeMcp(path: string, mcp?: McpCommand): Promise<void> {+ let text = (await readConfigText(path)) ?? "";+ const root = parseJsoncMcpConfig(text, path, "mcp");+ const servers = root.mcp as Record<string, unknown> | undefined;+ const keys = Object.keys(servers ?? {}).filter(key => key.toLowerCase() === "screenpipe");+ if (!mcp && !keys.length) return;+ const options = { formattingOptions: { insertSpaces: true, tabSize: 2 } };+ const primary = keys[0] ?? "screenpipe";+ for (const key of mcp ? keys.slice(1) : keys) {+ text = applyEdits(text, modify(text, ["mcp", key], undefined, options));+ }+ if (mcp) {+ const previous = servers?.[primary];+ if (!previous || typeof previous !== "object" || Array.isArray(previous)) {+ text = applyEdits(text, modify(text, ["mcp", primary], {}, options));+ }+ // Remove fields from a previous remote/standard MCP entry that OpenCode's+ // strict local schema rejects. Keep local user options such as timeout/cwd.+ for (const key of ["url", "headers", "oauth", "args", "env", "transport"]) {+ text = applyEdits(text, modify(text, ["mcp", primary, key], undefined, options));+ }+ for (const [key, value] of Object.entries({+ type: "local", command: [mcp.command, ...mcp.args],+ environment: mcp.env ?? {}, enabled: true,+ })) {+ text = applyEdits(text, modify(text, ["mcp", primary, key], value, options));+ }+ }+ await replaceConfig(path, text);+}++export async function installOpencodeMcp(): Promise<McpCommand> {+ const path = await getOpencodeMcpConfigPath();+ const mcp = await buildMcpConfig({ client: "opencode" });+ const config = await commands.getLocalApiConfig() as { port?: number };+ if (config?.port) mcp.env = { ...mcp.env, SCREENPIPE_API_URL: `http://localhost:${config.port}` };+ await updateOpencodeMcp(path, mcp);+ return mcp;+}++export async function uninstallOpencodeMcp(): Promise<void> {+ for (const path of await getOpencodeConfigPaths()) await updateOpencodeMcp(path);+}+// ─── Windsurf ────────────────────────────────────────────────────────────────// MCP-only (no skills dir), standard mcpServers JSON at// ~/.codeium/windsurf/mcp_config.json.@@ -849,6 +936,7 @@ const INSTALL_MCP: Record<Exclude<ConnectAllToolId, "grokbot">, () => Promise<Mcrunner: installRunnerMcp,windsurf: installWindsurfMcp,vscode: installVscodeMcp,+ opencode: installOpencodeMcp,};const UNINSTALL_MCP: Record<Exclude<ConnectAllToolId, "grokbot">, () => Promise<void>> = {@@ -862,6 +950,7 @@ const UNINSTALL_MCP: Record<Exclude<ConnectAllToolId, "grokbot">, () => Promise<runner: uninstallRunnerMcp,windsurf: uninstallWindsurfMcp,vscode: uninstallVscodeMcp,+ opencode: uninstallOpencodeMcp,};async function setAutoConnectOptOut(id: ConnectAllToolId, optOut: boolean): Promise<void> {@@ -1073,9 +1162,15 @@ export async function isToolConfigHealthy(id: ConnectAllToolId): Promise<booleancase "openclaw":await readOpenclawConfig();return true;+ case "opencode": {+ for (const path of await getOpencodeConfigPaths()) {+ parseJsoncMcpConfig((await readConfigText(path)) ?? "", path, "mcp");+ }+ return true;+ }case "vscode": {const path = await getVscodeMcpConfigPath();- parseVscodeConfig((await readConfigText(path)) ?? "", path);+ parseJsoncMcpConfig((await readConfigText(path)) ?? "", path, "servers");return true;}case "windsurf":diff --git a/apps/screenpipe-app-tauri/src-tauri/src/skills.rs b/apps/screenpipe-app-tauri/src-tauri/src/skills.rsindex 511083309..5f0ccfb5d 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/skills.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/skills.rs@@ -27,7 +27,7 @@ use tracing::{info, warn};pub(crate) const AI_TOOL_CHECK_INTERVAL: Duration = Duration::from_secs(60);-const AI_TOOL_AUTO_CONNECT_TARGETS: [&str; 11] = [+const AI_TOOL_AUTO_CONNECT_TARGETS: [&str; 12] = ["claude","claude-code","codex",@@ -38,6 +38,7 @@ const AI_TOOL_AUTO_CONNECT_TARGETS: [&str; 11] = ["runner","windsurf","vscode",+ "opencode","grokbot",];@@ -1841,6 +1842,10 @@ mod tests {assert!(ai_tool_auto_connect_opt_outs_in(&root).contains("vscode"));set_ai_tool_auto_connect_opt_out_in(&root, "vscode", false).unwrap();assert!(!ai_tool_auto_connect_opt_outs_in(&root).contains("vscode"));+ set_ai_tool_auto_connect_opt_out_in(&root, "opencode", true).unwrap();+ assert!(ai_tool_auto_connect_opt_outs_in(&root).contains("opencode"));+ set_ai_tool_auto_connect_opt_out_in(&root, "opencode", false).unwrap();+ assert!(!ai_tool_auto_connect_opt_outs_in(&root).contains("opencode"));assert!(set_ai_tool_auto_connect_opt_out_in(&root, "../escape", true).is_err());let _ = std::fs::remove_dir_all(root);}diff --git a/crates/screenpipe-engine/src/cli/agent.rs b/crates/screenpipe-engine/src/cli/agent.rsindex e7e685a0b..74c6d2f12 100644--- a/crates/screenpipe-engine/src/cli/agent.rs+++ b/crates/screenpipe-engine/src/cli/agent.rs@@ -55,7 +55,7 @@ pub enum AgentCommand {Setup {/// Which agent to wire up. Omit when using --all.#[arg(- value_parser = ["openclaw", "hermes", "claude-code", "claude-desktop", "codex", "cursor", "gemini", "runner", "windsurf", "vscode"],+ value_parser = ["openclaw", "hermes", "claude-code", "claude-desktop", "codex", "cursor", "gemini", "runner", "windsurf", "vscode", "opencode"],required_unless_present = "all",conflicts_with = "all")]@@ -75,7 +75,7 @@ pub enum AgentCommand {/// agent's own config or other skills.Remove {/// Which agent to unwire.- #[arg(value_parser = ["openclaw", "hermes", "claude-code", "claude-desktop", "codex", "cursor", "gemini", "runner", "windsurf", "vscode"])]+ #[arg(value_parser = ["openclaw", "hermes", "claude-code", "claude-desktop", "codex", "cursor", "gemini", "runner", "windsurf", "vscode", "opencode"])]target: String,},}@@ -251,6 +251,12 @@ fn detected_agents_in(home: &Path) -> Vec<DetectedAgent> {detected.push(DetectedAgent { target, name });}}+ if opencode_detected(home) {+ detected.push(DetectedAgent {+ target: "opencode",+ name: "OpenCode",+ });+ }if vscode_config(home).parent().is_some_and(Path::is_dir) {detected.push(DetectedAgent {target: "vscode",@@ -303,19 +309,27 @@ fn has_screenpipe_mcp(layout: &AgentLayout) -> bool {return false;};match layout.mcp_format {- McpFormat::Json | McpFormat::OpenclawJson | McpFormat::VscodeJson => {- read_mcp_json(&existing, &layout.mcp_format)- .ok()- .and_then(|root| {- let servers = mcp_json_servers(&root, &layout.mcp_format)?;- servers.get(screenpipe_json_key(servers)?).cloned()- })- .is_some_and(|entry| {- !entry.is_null()- && (!matches!(layout.name, "Runner" | "VS Code")- || entry.get("type").and_then(|value| value.as_str()) == Some("stdio"))- })- }+ McpFormat::Json+ | McpFormat::OpenclawJson+ | McpFormat::VscodeJson+ | McpFormat::OpencodeJson => read_mcp_json(&existing, &layout.mcp_format)+ .ok()+ .and_then(|root| {+ let servers = mcp_json_servers(&root, &layout.mcp_format)?;+ servers.get(screenpipe_json_key(servers)?).cloned()+ })+ .is_some_and(|entry| {+ !entry.is_null()+ && (layout.mcp_format != McpFormat::OpencodeJson+ || (entry.get("type").and_then(|v| v.as_str()) == Some("local")+ && entry+ .get("command")+ .and_then(|v| v.as_array())+ .is_some_and(|v| !v.is_empty())+ && entry.get("enabled").and_then(|v| v.as_bool()) != Some(false)))+ && (!matches!(layout.name, "Runner" | "VS Code")+ || entry.get("type").and_then(|value| value.as_str()) == Some("stdio"))+ }),McpFormat::Toml => existing.lines().any(is_screenpipe_toml_table),McpFormat::Yaml => existing.lines().any(|line| {let line = line.trim_start();@@ -407,6 +421,7 @@ enum McpFormat {Json,OpenclawJson,VscodeJson,+ OpencodeJson,Yaml,Toml,}@@ -469,6 +484,14 @@ fn detected_desktop_agents_in(home: &Path) -> Vec<DesktopDetectedAgent> {});}}+ if opencode_detected(home) {+ detected.push(DesktopDetectedAgent {+ id: "opencode",+ name: "OpenCode",+ mcp_target: "opencode",+ skills_target: None,+ });+ }if vscode_config(home).parent().is_some_and(Path::is_dir) {detected.push(DesktopDetectedAgent {id: "vscode",@@ -547,37 +570,42 @@ fn desktop_mcp_ready(layout: &AgentLayout, launch: &McpLaunchConfig) -> bool {return false;};match layout.mcp_format {- McpFormat::Json | McpFormat::OpenclawJson | McpFormat::VscodeJson => {- read_mcp_json(&existing, &layout.mcp_format)- .ok()- .and_then(|root| {- let servers = mcp_json_servers(&root, &layout.mcp_format)?;- servers.get(screenpipe_json_key(servers)?).cloned()- })- .is_some_and(|entry| {- entry.get("command").and_then(|value| value.as_str())- == Some(launch.command.as_str())- && entry- .get("args")- .and_then(|value| {- serde_json::from_value::<Vec<String>>(value.clone()).ok()- })- .as_ref()- == Some(&launch.args)- && entry- .get("env")- .and_then(|value| {- serde_json::from_value::<BTreeMap<String, String>>(value.clone())- .ok()- })- .as_ref()- == Some(&launch.env)- && entry.get("transport").and_then(|value| value.as_str())- == launch.transport.as_deref()- && entry.get("type").and_then(|value| value.as_str())- == launch.server_type.as_deref()- })- }+ McpFormat::Json+ | McpFormat::OpenclawJson+ | McpFormat::VscodeJson+ | McpFormat::OpencodeJson => read_mcp_json(&existing, &layout.mcp_format)+ .ok()+ .and_then(|root| {+ let servers = mcp_json_servers(&root, &layout.mcp_format)?;+ servers.get(screenpipe_json_key(servers)?).cloned()+ })+ .is_some_and(|entry| {+ if layout.mcp_format == McpFormat::OpencodeJson {+ return entry.get("type").and_then(|v| v.as_str()) == Some("local")+ && entry.get("enabled").and_then(|v| v.as_bool()) == Some(true)+ && entry.get("command")+ == Some(&serde_json::json!(opencode_command(launch)))+ && entry.get("environment") == Some(&serde_json::json!(launch.env));+ }+ entry.get("command").and_then(|value| value.as_str())+ == Some(launch.command.as_str())+ && entry+ .get("args")+ .and_then(|value| serde_json::from_value::<Vec<String>>(value.clone()).ok())+ .as_ref()+ == Some(&launch.args)+ && entry+ .get("env")+ .and_then(|value| {+ serde_json::from_value::<BTreeMap<String, String>>(value.clone()).ok()+ })+ .as_ref()+ == Some(&launch.env)+ && entry.get("transport").and_then(|value| value.as_str())+ == launch.transport.as_deref()+ && entry.get("type").and_then(|value| value.as_str())+ == launch.server_type.as_deref()+ }),McpFormat::Toml => render_mcp_toml_block(launch).ok().is_some_and(|block| existing.contains(&block)),@@ -835,6 +863,13 @@ fn layout_in(target: &str, h: &Path) -> Result<AgentLayout> {mcp_path: h.join(".runner/mcp.json"),mcp_format: McpFormat::Json,},+ "opencode" => AgentLayout {+ client,+ name: "OpenCode",+ skills_dir: None,+ mcp_path: opencode_config(h),+ mcp_format: McpFormat::OpencodeJson,+ },"vscode" => AgentLayout {client,name: "VS Code",@@ -850,11 +885,50 @@ fn layout_in(target: &str, h: &Path) -> Result<AgentLayout> {mcp_format: McpFormat::Json,},other => anyhow::bail!(- "unknown agent target '{other}' (use: openclaw, hermes, claude-code, claude-desktop, codex, cursor, gemini, runner, windsurf, vscode)"+ "unknown agent target '{other}' (use: openclaw, hermes, claude-code, claude-desktop, codex, cursor, gemini, runner, windsurf, vscode, opencode)"),})}+// OpenCode follows XDG on every OS, including macOS. Use the real process+// override only for the real home, keeping fixture/test homes isolated.+fn opencode_config_dir(home: &Path) -> PathBuf {+ let xdg = (dirs::home_dir().as_deref() == Some(home))+ .then(|| std::env::var_os("XDG_CONFIG_HOME"))+ .flatten()+ .filter(|value| !value.is_empty())+ .map(PathBuf::from);+ xdg.unwrap_or_else(|| home.join(".config")).join("opencode")+}++fn opencode_config_paths(home: &Path) -> Vec<PathBuf> {+ ["opencode.jsonc", "opencode.json", "config.json"]+ .iter()+ .map(|file| opencode_config_dir(home).join(file))+ .collect()+}++fn opencode_config(home: &Path) -> PathBuf {+ let paths = opencode_config_paths(home);+ paths+ .iter()+ .find(|path| path.exists())+ .cloned()+ .unwrap_or_else(|| paths[0].clone())+}++fn opencode_detected(home: &Path) -> bool {+ opencode_config_dir(home).is_dir()+ || home.join(".opencode/bin/opencode").is_file()+ || home.join(".opencode/bin/opencode.exe").is_file()+}++fn opencode_command(launch: &McpLaunchConfig) -> Vec<String> {+ std::iter::once(launch.command.clone())+ .chain(launch.args.clone())+ .collect()+}+/// Default VS Code user profile; never create workspace configs or infer an/// install from ~/.vscode (which can contain extensions alone).fn vscode_config(home: &Path) -> PathBuf {@@ -875,7 +949,7 @@ fn vscode_config(home: &Path) -> PathBuf {config_dir.join("Code/User/mcp.json")}-fn parse_vscode_config(text: &str) -> Result<jsonc_parser::cst::CstRootNode> {+fn parse_jsonc_config(text: &str) -> Result<jsonc_parser::cst::CstRootNode> {let root = jsonc_parser::cst::CstRootNode::parse(text,&jsonc_parser::ParseOptions {@@ -905,6 +979,7 @@ fn mcp_json_servers<'a>(McpFormat::OpenclawJson if root.get("mcpServers").is_some() => None,McpFormat::OpenclawJson => root.get("mcp")?.get("servers")?.as_object(),McpFormat::VscodeJson => root.get("servers")?.as_object(),+ McpFormat::OpencodeJson => root.get("mcp")?.as_object(),_ => root.get("mcpServers")?.as_object(),}}@@ -974,8 +1049,8 @@ fn read_mcp_json(text: &str, format: &McpFormat) -> Result<serde_json::Value> {if *format == McpFormat::OpenclawJson {return json5::from_str(text).context("OpenClaw config is not valid JSON5");}- if *format == McpFormat::VscodeJson {- Ok(parse_vscode_config(text)?+ if matches!(format, McpFormat::VscodeJson | McpFormat::OpencodeJson) {+ Ok(parse_jsonc_config(text)?.to_serde_value().unwrap_or(serde_json::json!({})))} else {@@ -986,19 +1061,28 @@ fn read_mcp_json(text: &str, format: &McpFormat) -> Result<serde_json::Value> {/// VS Code uses `servers`, not `mcpServers`, and accepts JSONC. Edit only the/// owned entry so comments, inputs, sandbox rules and other servers survive.fn update_vscode_mcp(path: &Path, launch: Option<&McpLaunchConfig>) -> Result<()> {+ update_jsonc_mcp(path, launch, false)+}++fn update_opencode_mcp(path: &Path, launch: Option<&McpLaunchConfig>) -> Result<()> {+ update_jsonc_mcp(path, launch, true)+}++fn update_jsonc_mcp(path: &Path, launch: Option<&McpLaunchConfig>, opencode: bool) -> Result<()> {use jsonc_parser::cst::CstInputValue as Input;let existing = read_config_text(path)?;if existing.is_none() && launch.is_none() {return Ok(());}- let root = parse_vscode_config(existing.as_deref().unwrap_or("{}"))+ let root = parse_jsonc_config(existing.as_deref().unwrap_or("{}")).with_context(|| format!("{} is not valid JSON; fix or remove it", path.display()))?;let obj = root.object_value_or_create().context("config is not a JSON object")?;+ let server_key = if opencode { "mcp" } else { "servers" };let servers = obj- .object_value_or_create("servers")- .context("servers is present but not an object")?;+ .object_value_or_create(server_key)+ .with_context(|| format!("{server_key} is present but not an object"))?;let matching: Vec<_> = servers.properties().into_iter()@@ -1018,21 +1102,35 @@ fn update_vscode_mcp(path: &Path, launch: Option<&McpLaunchConfig>) -> Result<()for duplicate in matching.into_iter().skip(1) {duplicate.remove();}- for (key, value) in [- ("type", Input::from("stdio")),- ("command", launch.command.clone().into()),- ("args", launch.args.clone().into()),- (- "env",- Input::Object(- launch- .env- .iter()- .map(|(key, value)| (key.clone(), value.clone().into()))- .collect(),- ),- ),- ] {+ let environment = Input::Object(+ launch+ .env+ .iter()+ .map(|(key, value)| (key.clone(), value.clone().into()))+ .collect(),+ );+ let fields = if opencode {+ // OpenCode rejects remote/standard MCP fields on local entries.+ for key in ["url", "headers", "oauth", "args", "env", "transport"] {+ if let Some(prop) = entry.get(key) {+ prop.remove();+ }+ }+ vec![+ ("type", Input::from("local")),+ ("command", opencode_command(launch).into()),+ ("environment", environment),+ ("enabled", Input::from(true)),+ ]+ } else {+ vec![+ ("type", Input::from("stdio")),+ ("command", launch.command.clone().into()),+ ("args", launch.args.clone().into()),+ ("env", environment),+ ]+ };+ for (key, value) in fields {if let Some(prop) = entry.get(key) {prop.set_value(value);} else {@@ -1217,6 +1315,9 @@ fn setup(target: &str, api_url: &str) -> Result<()> {McpFormat::OpenclawJson => {update_openclaw_mcp(&l.mcp_path, Some(&cli_launch_config(remote, api_url)))?;}+ McpFormat::OpencodeJson => {+ update_opencode_mcp(&l.mcp_path, Some(&cli_launch_config(remote, api_url)))?;+ }McpFormat::VscodeJson => {let mut launch = cli_launch_config(remote, api_url);launch.server_type = Some("stdio".to_string());@@ -1320,6 +1421,12 @@ fn remove(target: &str) -> Result<()> {match l.mcp_format {McpFormat::OpenclawJson => update_openclaw_mcp(&l.mcp_path, None)?,McpFormat::VscodeJson => update_vscode_mcp(&l.mcp_path, None)?,+ McpFormat::OpencodeJson => {+ let home = dirs::home_dir().context("could not resolve home dir")?;+ for path in opencode_config_paths(&home) {+ update_opencode_mcp(&path, None)?;+ }+ }McpFormat::Json => remove_mcp_json(&l.mcp_path)?,McpFormat::Toml => remove_mcp_toml(&l.mcp_path)?,McpFormat::Yaml => remove_mcp_yaml(&l.mcp_path)?,@@ -1534,6 +1641,7 @@ fn merge_mcp_launch(layout: &AgentLayout, launch: &McpLaunchConfig) -> Result<()match layout.mcp_format {McpFormat::OpenclawJson => update_openclaw_mcp(&layout.mcp_path, Some(launch)),McpFormat::VscodeJson => update_vscode_mcp(&layout.mcp_path, Some(launch)),+ McpFormat::OpencodeJson => update_opencode_mcp(&layout.mcp_path, Some(launch)),McpFormat::Json => merge_mcp_json_launch(&layout.mcp_path, launch),McpFormat::Yaml => merge_mcp_yaml_launch(&layout.mcp_path, launch),McpFormat::Toml => merge_mcp_toml_launch(&layout.mcp_path, launch),@@ -1837,6 +1945,135 @@ mod tests {}}+ #[test]+ fn test_opencode_installer_detection_and_config_priority() {+ let dir = tempfile::tempdir().unwrap();+ let home = dir.path();+ assert!(!opencode_detected(home));+ let binary = home.join(".opencode/bin/opencode");+ std::fs::create_dir_all(binary.parent().unwrap()).unwrap();+ std::fs::write(binary, "fixture").unwrap();+ assert!(detected_agents_in(home)+ .iter()+ .any(|agent| agent.target == "opencode"));+ let json = home.join(".config/opencode/opencode.json");+ std::fs::create_dir_all(json.parent().unwrap()).unwrap();+ std::fs::write(&json, "{}").unwrap();+ assert_eq!(opencode_config(home), json);+ let jsonc = json.with_extension("jsonc");+ std::fs::write(&jsonc, "{} // keep comment").unwrap();+ assert_eq!(opencode_config(home), jsonc);+ let layout = layout_in("opencode", home).unwrap();+ merge_mcp_launch(&layout, &cli_launch_config(false, "http://localhost:3030")).unwrap();+ assert!(is_agent_setup_in("opencode", home));+ assert_eq!(std::fs::read_to_string(json).unwrap(), "{}");+ update_opencode_mcp(&jsonc, None).unwrap();+ assert!(!is_agent_setup_in("opencode", home));+ }++ #[test]+ fn test_opencode_background_jsonc_lifecycle() {+ let dir = tempfile::tempdir().unwrap();+ let home = dir.path();+ let config = opencode_config(home);+ let bun = home.join("bundled bun");+ let mut reconciler = DesktopAgentReconciler::default();+ let opts = BTreeSet::new();+ assert_eq!(+ reconciler+ .reconcile(home, &bun, Some("test-key"), "http://localhost:3039", &opts)+ .detected,+ 0+ );+ std::fs::create_dir_all(config.parent().unwrap()).unwrap();+ std::fs::write(+ &config,+ r#"{+ // keep my servers+ "mcp": { "existing": { "type": "remote", "url": "https://example.com" }, },+ "model": "provider/model",+ "permission": { "edit": "ask" },+}"#,+ )+ .unwrap();+ let report =+ reconciler.reconcile(home, &bun, Some("test-key"), "http://localhost:3039", &opts);+ assert_eq!(report.connected, 1, "{:?}", report.failures);+ let written = std::fs::read_to_string(&config).unwrap();+ assert!(written.contains("// keep my servers"));+ let root = read_mcp_json(&written, &McpFormat::OpencodeJson).unwrap();+ assert!(root.get("mcpServers").is_none());+ assert_eq!(root["mcp"]["existing"]["url"], "https://example.com");+ assert_eq!(root["model"], "provider/model");+ assert_eq!(root["permission"]["edit"], "ask");+ let entry = &root["mcp"]["screenpipe"];+ assert_eq!(entry["type"], "local");+ assert_eq!(entry["enabled"], true);+ assert_eq!(+ entry["command"],+ serde_json::json!([bun.to_string_lossy(), "x", "screenpipe-mcp@latest"])+ );+ assert_eq!(entry["environment"]["SCREENPIPE_LOCAL_API_KEY"], "test-key");+ assert_eq!(+ entry["environment"]["SCREENPIPE_API_URL"],+ "http://localhost:3039"+ );+ assert_eq!(entry["environment"]["SCREENPIPE_MCP_CLIENT"], "opencode");+ let report =+ reconciler.reconcile(home, &bun, Some("test-key"), "http://localhost:3039", &opts);+ assert_eq!(report.already_connected, 1);+ assert_eq!(std::fs::read_to_string(&config).unwrap(), written);+ let restarted = DesktopAgentReconciler::default().reconcile(+ home,+ &bun,+ Some("test-key"),+ "http://localhost:3039",+ &opts,+ );+ assert_eq!(restarted.already_connected, 1);+ assert_eq!(std::fs::read_to_string(&config).unwrap(), written);+ update_opencode_mcp(&config, None).unwrap();+ let opts = BTreeSet::from(["opencode".to_string()]);+ assert_eq!(+ reconciler+ .reconcile(home, &bun, None, "http://localhost:3030", &opts)+ .opted_out,+ 1+ );+ let disconnected = std::fs::read_to_string(&config).unwrap();+ assert!(!disconnected.contains("screenpipe"));+ assert!(disconnected.contains("// keep my servers"));+ assert_eq!(+ reconciler+ .reconcile(home, &bun, None, "http://localhost:3030", &BTreeSet::new())+ .connected,+ 1+ );+ }++ #[test]+ fn test_opencode_refuses_invalid_configs_without_modifying_them() {+ let dir = tempfile::tempdir().unwrap();+ let config = opencode_config(dir.path());+ std::fs::create_dir_all(config.parent().unwrap()).unwrap();+ let launch = cli_launch_config(false, "http://localhost:3030");+ for original in [+ "[]",+ "null",+ r#"{"mcp": []}"#,+ r#"{"mcp": null}"#,+ r#"{"mcp": { broken }}"#,+ r#"{"mcp": {} "inputs": []}"#,+ ] {+ std::fs::write(&config, original).unwrap();+ assert!(+ update_opencode_mcp(&config, Some(&launch)).is_err(),+ "{original}"+ );+ assert_eq!(std::fs::read_to_string(&config).unwrap(), original);+ }+ }+#[test]fn test_vscode_background_jsonc_lifecycle() {let dir = tempfile::tempdir().unwrap();diff --git a/crates/screenpipe-engine/src/qualified_value.rs b/crates/screenpipe-engine/src/qualified_value.rsindex c113f18d1..4aead504d 100644--- a/crates/screenpipe-engine/src/qualified_value.rs+++ b/crates/screenpipe-engine/src/qualified_value.rs@@ -19,6 +19,7 @@ pub(crate) enum AgentClient {Runner,Windsurf,Vscode,+ Opencode,Grok,Grokbot,#[default]@@ -44,6 +45,7 @@ impl AgentClient {Self::Runner => "runner",Self::Windsurf => "windsurf",Self::Vscode => "vscode",+ Self::Opencode => "opencode",Self::Grok => "grok",Self::Grokbot => "grokbot",Self::Unknown => "unknown",@@ -183,7 +185,7 @@ mod tests {fn api_and_mcp_share_fixed_app_identifiers() {for name in ["claude", "chatgpt", "codex", "cursor", "gemini", "openclaw", "hermes", "runner",- "windsurf", "vscode", "grok", "grokbot",+ "windsurf", "vscode", "opencode", "grok", "grokbot",] {let client = AgentClient::from_name(name);let api = api_outcome_properties(ApiOutcomeKind::SearchResult, client);diff --git a/docs/COVERAGE.md b/docs/COVERAGE.mdindex 3b82998df..819dc151b 100644--- a/docs/COVERAGE.md+++ b/docs/COVERAGE.md@@ -38,15 +38,15 @@ results and `cargo llvm-cov` data on top when judging release confidence.- Mapped suites: 36- Mapped Rust files: 391-- Active test blocks: 3842+- Active test blocks: 3850- Ignored/manual test blocks: 181-- Weighted coverage points: 3173.8+- Weighted coverage points: 3180.9| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 32 | 3694 | 166 | 3106.7 | 21 | 11 | 100% |-| macos | 31 | 3722 | 142 | 3096.0 | 22 | 11 | 100% |-| linux | 28 | 3277 | 141 | 2730.1 | 20 | 11 | 100% |+| windows | 32 | 3702 | 166 | 3113.8 | 21 | 11 | 100% |+| macos | 31 | 3730 | 142 | 3103.1 | 22 | 11 | 100% |+| linux | 28 | 3280 | 141 | 2732.2 | 20 | 11 | 100% |## Refreshdiff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.mdindex 027f572a0..e31478311 100644--- a/docs/coverage/CORE.md+++ b/docs/coverage/CORE.md@@ -9,10 +9,10 @@ confidence, and criticality.- Tracked crates: screenpipe-engine, screenpipe-db, screenpipe-sqlite-coordinator, screenpipe-audio, screenpipe-screen, screenpipe-a11y, screenpipe-fs- Mapped suites: 36- Mapped Rust files: 391-- Active test blocks: 3842+- Active test blocks: 3850- Ignored/manual test blocks: 181-- Declared test blocks: 4023-- Weighted coverage points: 3173.8+- Declared test blocks: 4031+- Weighted coverage points: 3180.9Confidence weights: strong=1.0, partial=0.7, conditional=0.4, smoke=0.3.Criticality weights: high=1.0, medium=0.7, low=0.4.@@ -23,15 +23,15 @@ are explicitly enabled in a runtime lane.| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 32 | 3694 | 166 | 3106.7 | 21 | 11 | 100% |-| macos | 31 | 3722 | 142 | 3096.0 | 22 | 11 | 100% |-| linux | 28 | 3277 | 141 | 2730.1 | 20 | 11 | 100% |+| windows | 32 | 3702 | 166 | 3113.8 | 21 | 11 | 100% |+| macos | 31 | 3730 | 142 | 3103.1 | 22 | 11 | 100% |+| linux | 28 | 3280 | 141 | 2732.2 | 20 | 11 | 100% |## Crate Summary| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows || --- | --- | --- | --- | --- | --- | --- | --- |-| screenpipe-engine | 12 | 22 | 128 | 1840 | 53 | 1416.9 | 10 |+| screenpipe-engine | 12 | 22 | 128 | 1848 | 53 | 1424.0 | 10 || screenpipe-db | 5 | 68 | 27 | 624 | 31 | 594.7 | 9 || screenpipe-sqlite-coordinator | 1 | 0 | 3 | 27 | 0 | 27.0 | 2 || screenpipe-audio | 7 | 28 | 53 | 686 | 53 | 601.3 | 5 |@@ -70,19 +70,19 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| db-search | 2 suites / 118 active / 9 ignored / 118.0 pts | 2 suites / 118 active / 9 ignored / 118.0 pts | 2 suites / 118 active / 9 ignored / 118.0 pts || engine-lifecycle | 6 suites / 265 active / 1 ignored / 238.5 pts | 6 suites / 265 active / 1 ignored / 238.5 pts | 6 suites / 261 active / 9 ignored / 237.6 pts || local-api | 3 suites / 478 active / 12 ignored / 338.2 pts | 3 suites / 478 active / 12 ignored / 338.2 pts | 3 suites / 478 active / 12 ignored / 338.2 pts |-| meeting | 6 suites / 1740 active / 32 ignored / 1423.5 pts | 6 suites / 1740 active / 32 ignored / 1423.5 pts | 4 suites / 1391 active / 28 ignored / 1098.2 pts |+| meeting | 6 suites / 1748 active / 32 ignored / 1430.6 pts | 6 suites / 1748 active / 32 ignored / 1430.6 pts | 4 suites / 1394 active / 28 ignored / 1100.3 pts || ocr | 4 suites / 140 active / 7 ignored / 129.8 pts | 4 suites / 133 active / 7 ignored / 127.6 pts | 3 suites / 124 active / 6 ignored / 118.6 pts || os-integration | 1 suites / 6 active / 0 ignored / 1.7 pts | 1 suites / 6 active / 0 ignored / 1.7 pts | - || performance | 13 suites / 1668 active / 82 ignored / 1475.7 pts | 14 suites / 1778 active / 87 ignored / 1519.7 pts | 13 suites / 1668 active / 82 ignored / 1475.7 pts |-| pipes | 1 suites / 546 active / 3 ignored / 382.2 pts | 1 suites / 546 active / 3 ignored / 382.2 pts | 1 suites / 546 active / 3 ignored / 382.2 pts |-| privacy | 5 suites / 1008 active / 42 ignored / 813.3 pts | 5 suites / 1049 active / 18 ignored / 809.0 pts | 5 suites / 966 active / 14 ignored / 778.2 pts |+| pipes | 1 suites / 549 active / 3 ignored / 384.3 pts | 1 suites / 549 active / 3 ignored / 384.3 pts | 1 suites / 549 active / 3 ignored / 384.3 pts |+| privacy | 5 suites / 1011 active / 42 ignored / 815.4 pts | 5 suites / 1052 active / 18 ignored / 811.1 pts | 5 suites / 969 active / 14 ignored / 780.3 pts || real-app | - | 1 suites / 110 active / 5 ignored / 44.0 pts | - || speaker | 2 suites / 415 active / 18 ignored / 415.0 pts | 2 suites / 415 active / 18 ignored / 415.0 pts | 2 suites / 415 active / 18 ignored / 415.0 pts || storage | 4 suites / 686 active / 41 ignored / 571.7 pts | 4 suites / 686 active / 41 ignored / 571.7 pts | 4 suites / 686 active / 41 ignored / 571.7 pts |-| sync | 1 suites / 546 active / 3 ignored / 382.2 pts | 1 suites / 546 active / 3 ignored / 382.2 pts | 1 suites / 546 active / 3 ignored / 382.2 pts |+| sync | 1 suites / 549 active / 3 ignored / 384.3 pts | 1 suites / 549 active / 3 ignored / 384.3 pts | 1 suites / 549 active / 3 ignored / 384.3 pts || timeline | 4 suites / 1234 active / 48 ignored / 1013.2 pts | 4 suites / 1234 active / 48 ignored / 1013.2 pts | 4 suites / 1234 active / 48 ignored / 1013.2 pts || transcription | 6 suites / 882 active / 53 ignored / 691.9 pts | 5 suites / 876 active / 53 ignored / 687.8 pts | 5 suites / 876 active / 53 ignored / 687.8 pts |-| ui-events | 4 suites / 823 active / 34 ignored / 624.2 pts | 3 suites / 754 active / 5 ignored / 575.9 pts | 3 suites / 754 active / 5 ignored / 575.9 pts |+| ui-events | 4 suites / 826 active / 34 ignored / 626.3 pts | 3 suites / 757 active / 5 ignored / 578.0 pts | 3 suites / 757 active / 5 ignored / 578.0 pts || vision-capture | 6 suites / 576 active / 32 ignored / 453.6 pts | 6 suites / 569 active / 32 ignored / 451.4 pts | 5 suites / 560 active / 31 ignored / 442.4 pts |## Critical Flow Matrix@@ -142,8 +142,8 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-focus-os | screenpipe-engine | windows, macos | engine-lifecycle, os-integration | engine-health-lifecycle, performance-liveness | medium | conditional | unit | 3 | 6 | 0 | Platform focus-tracker parsing/helpers. These files are cfg-gated and only execute on their target OS. || engine-linux-keep-awake | screenpipe-engine | linux | engine-lifecycle | engine-health-lifecycle | high | conditional | mixed | 1 | 2 | 8 | Existing isolated-process missing/stalled bus regressions plus ignored live logind inhibitor tests. Live tests require logind and explicit execution. || engine-local-api-search-integration | screenpipe-engine | windows, macos, linux | local-api, db-search | local-api-search | high | strong | integration | 1 | 12 | 5 | Active /search route test builds an audio-disabled router, seeds captured-screen-shaped OCR data into an in-memory DB, and asserts the HTTP response and pagination. |-| engine-meeting-privacy-sync | screenpipe-engine | windows, macos, linux | meeting, privacy, ui-events, pipes, sync | meeting-live-notes, privacy-and-redaction, accessibility-ui-events, performance-liveness | medium | strong | unit | 33 | 546 | 3 | Unit-heavy coverage for privacy filter policy, capture exclusions, UI recorder safety, pipes/live-view/structured-output helpers, sync helpers, and CLI parsing. Meeting detection moved to the engine-meeting-watcher suite. |-| engine-meeting-watcher | screenpipe-engine | windows, macos | meeting | meeting-live-notes | high | strong | mixed | 10 | 270 | 3 | Successor of src/meeting_detector.rs and src/meeting_telemetry.rs. Audio-process and UI-scan backend state machines, candidate resolution, shared telemetry, and a scored trajectory eval. ui_scan/macos.rs and ui_scan/windows.rs are cfg-gated and only execute on their target OS; both backends are null on Linux. |+| engine-meeting-privacy-sync | screenpipe-engine | windows, macos, linux | meeting, privacy, ui-events, pipes, sync | meeting-live-notes, privacy-and-redaction, accessibility-ui-events, performance-liveness | medium | strong | unit | 33 | 549 | 3 | Unit-heavy coverage for privacy filter policy, capture exclusions, UI recorder safety, pipes/live-view/structured-output helpers, sync helpers, and CLI parsing. Meeting detection moved to the engine-meeting-watcher suite. |+| engine-meeting-watcher | screenpipe-engine | windows, macos | meeting | meeting-live-notes | high | strong | mixed | 10 | 275 | 3 | Successor of src/meeting_detector.rs and src/meeting_telemetry.rs. Audio-process and UI-scan backend state machines, candidate resolution, shared telemetry, and a scored trajectory eval. ui_scan/macos.rs and ui_scan/windows.rs are cfg-gated and only execute on their target OS; both backends are null on Linux. || engine-retention-storage | screenpipe-engine | windows, macos, linux | storage, engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | mixed | 5 | 39 | 0 | Local retention deletion (including lean-mode heavy-text stripping), cloud archive watermarking, atomic state-file replacement, and the low-disk capture monitor. || engine-telemetry-observability | screenpipe-engine | windows, macos, linux | engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | unit | 6 | 35 | 0 | PostHog capture gating, telemetry context shaping, piggyback telemetry forwarding, crash-log helpers, resource monitoring, and the recording-coverage reliability metric. || engine-workflows | screenpipe-engine | windows, macos, linux | local-api, storage | local-api-search | high | partial | mixed | 7 | 36 | 0 | Catalog identity and persistence, revision-scoped feedback, workflow evidence and pipeline contracts, and denial of agent-granted rollout access. Does not assert live cloud discovery quality. Workflow publication orchestration deadlines and nested query backpressure are covered with virtual-time router tests. |@@ -379,7 +379,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-config-lifecycle | screenpipe-engine | src/bin/screenpipe-engine.rs | source | 4 | 0 | 4 || engine-meeting-privacy-sync | screenpipe-engine | src/calendar_speaker_id.rs | source | 41 | 0 | 41 || engine-meeting-privacy-sync | screenpipe-engine | src/capture_exclusions.rs | source | 7 | 0 | 7 |-| engine-meeting-privacy-sync | screenpipe-engine | src/cli/agent.rs | source | 44 | 0 | 44 |+| engine-meeting-privacy-sync | screenpipe-engine | src/cli/agent.rs | source | 47 | 0 | 47 || engine-db-recovery-cli | screenpipe-engine | src/cli/db.rs | source | 33 | 0 | 33 || engine-meeting-privacy-sync | screenpipe-engine | src/cli/install.rs | source | 4 | 0 | 4 || engine-meeting-privacy-sync | screenpipe-engine | src/cli/login.rs | source | 1 | 0 | 1 |@@ -423,7 +423,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-api-routes | screenpipe-engine | src/meeting_summary/notes.rs | source | 6 | 0 | 6 || engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/audio_process/resolve.rs | source | 6 | 0 | 6 || engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/audio_process/state.rs | source | 2 | 0 | 2 |-| engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/audio_process/tests.rs | source | 110 | 0 | 110 |+| engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/audio_process/tests.rs | source | 115 | 0 | 115 || engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/mod.rs | source | 2 | 0 | 2 || engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/shared/events.rs | source | 2 | 0 | 2 || engine-meeting-watcher | screenpipe-engine | src/meeting_watcher/shared/telemetry.rs | source | 7 | 0 | 7 |diff --git a/docs/pr-assets/opencode-ai-apps/after.png b/docs/pr-assets/opencode-ai-apps/after.pngnew file mode 100644index 000000000..0dc3f2e39Binary files /dev/null and b/docs/pr-assets/opencode-ai-apps/after.png differdiff --git a/docs/pr-assets/opencode-ai-apps/before.png b/docs/pr-assets/opencode-ai-apps/before.pngnew file mode 100644index 000000000..0e115c2f3Binary files /dev/null and b/docs/pr-assets/opencode-ai-apps/before.png differdiff --git a/docs/pr-assets/opencode-ai-apps/connected.png b/docs/pr-assets/opencode-ai-apps/connected.pngnew file mode 100644index 000000000..8ddf293a2Binary files /dev/null and b/docs/pr-assets/opencode-ai-apps/connected.png differdiff --git a/packages/screenpipe-mcp/src/qualified-value.test.ts b/packages/screenpipe-mcp/src/qualified-value.test.tsindex bf62281df..f43145037 100644--- a/packages/screenpipe-mcp/src/qualified-value.test.ts+++ b/packages/screenpipe-mcp/src/qualified-value.test.ts@@ -56,6 +56,7 @@ describe("createMcpQualifiedValueReporter", () => {["gemini", "gemini-cli", "gemini"],["runner", "Runner", "runner"],["vscode", "vscode", "vscode"],+ ["opencode", "OpenCode", "opencode"],["grokbot", "Grok Bot", "grokbot"],])("recognizes configured %s and its handshake name", (configured, protocol, expected) => {expect(resolveMcpClient(configured, "unrecognized-client")).toBe(expected);diff --git a/packages/screenpipe-mcp/src/qualified-value.ts b/packages/screenpipe-mcp/src/qualified-value.tsindex c2dcf2096..bdbf6ee51 100644--- a/packages/screenpipe-mcp/src/qualified-value.ts+++ b/packages/screenpipe-mcp/src/qualified-value.ts@@ -4,7 +4,7 @@const CLIENTS = ["claude", "chatgpt", "codex", "cursor", "gemini", "openclaw",- "hermes", "runner", "windsurf", "vscode", "grok", "grokbot",+ "hermes", "runner", "windsurf", "vscode", "opencode", "grok", "grokbot",] as const;export type McpClient = (typeof CLIENTS)[number] | "unknown";