Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(markdown): copy and export Mermaid diagrams as SVG
o_liusheng0a381a14c99d
diff --git a/apps/desktop/src/components/Markdown.tsx b/apps/desktop/src/components/Markdown.tsxindex e34ca6550..50a21d1f7 100644--- a/apps/desktop/src/components/Markdown.tsx+++ b/apps/desktop/src/components/Markdown.tsx@@ -51,6 +51,7 @@ import {import { TooltipButton } from "./ui";import { ContextMenu, useContextMenu } from "./ContextMenu";import { MarkdownTable } from "./MarkdownTable";+import { MermaidSvgActions } from "./MermaidSvgActions";import { markdownTableData } from "../lib/markdown-table";import { PluginBlockRenderer } from "./PluginBlockRenderer";import { blockRendererCandidate } from "../lib/block-renderer";@@ -354,6 +355,7 @@ function MermaidBlock({ code, ...position }: { code: string } & SourcePositionPr<span>mermaid</span></span><div className="mermaid-block-actions">+ <MermaidSvgActions svg={!error && !loading ? svg : ""} />{svg && !error ? (<TooltipButtontype="button"diff --git a/apps/desktop/src/components/MermaidSvgActions.tsx b/apps/desktop/src/components/MermaidSvgActions.tsxnew file mode 100644index 000000000..870663ddd--- /dev/null+++ b/apps/desktop/src/components/MermaidSvgActions.tsx@@ -0,0 +1,49 @@+import { useTranslation } from "react-i18next";+import { downloadMermaidSvg, standaloneMermaidSvg } from "../lib/mermaid-export";+import { useAppStore } from "../stores/app-store";+import { IconDownload, IconImage } from "./icons";+import { TooltipButton } from "./ui";++export function MermaidSvgActions({ svg }: { svg: string }) {+ const { t } = useTranslation();+ const showToast = useAppStore((state) => state.showToast);+ const copy = async () => {+ if (!svg) return;+ try {+ await navigator.clipboard.writeText(standaloneMermaidSvg(svg));+ showToast(t("chat.diagramSvgCopied"), { variant: "success" });+ } catch {+ showToast(t("chat.copyFailed"), { variant: "error" });+ }+ };+ const download = () => {+ if (!svg) return;+ try {+ downloadMermaidSvg(standaloneMermaidSvg(svg));+ } catch {+ showToast(t("chat.diagramSvgExportFailed"), { variant: "error" });+ }+ };+ return (+ <>+ <TooltipButton+ type="button"+ className="mermaid-action-btn"+ tooltip={t("chat.copyDiagramSvg")}+ disabled={!svg}+ onClick={() => void copy()}+ >+ <IconImage size={13} />+ </TooltipButton>+ <TooltipButton+ type="button"+ className="mermaid-action-btn"+ tooltip={t("chat.exportDiagramSvg")}+ disabled={!svg}+ onClick={download}+ >+ <IconDownload size={13} />+ </TooltipButton>+ </>+ );+}diff --git a/apps/desktop/src/lib/mermaid-export.ts b/apps/desktop/src/lib/mermaid-export.tsnew file mode 100644index 000000000..1d733a7d6--- /dev/null+++ b/apps/desktop/src/lib/mermaid-export.ts@@ -0,0 +1,41 @@+/** Convert already-sanitized Mermaid output into a standalone SVG document. */+export function standaloneMermaidSvg(svg: string): string {+ const document = new DOMParser().parseFromString(svg, "image/svg+xml");+ const root = document.documentElement;+ if (root.localName !== "svg" || document.querySelector("parsererror")) {+ throw new Error("Invalid Mermaid SVG");+ }+ root.setAttribute("xmlns", "http://www.w3.org/2000/svg");+ // The preview inherits this app token; external viewers do not have it.+ const font = getComputedStyle(window.document.documentElement).getPropertyValue("--font-sans").trim() || "sans-serif";+ for (const style of root.querySelectorAll("style")) {+ style.textContent = style.textContent?.replaceAll("var(--font-sans)", () => font) ?? "";+ }+ for (const element of [root, ...root.querySelectorAll("[style]")]) {+ const style = element.getAttribute("style");+ if (style) element.setAttribute("style", style.replaceAll("var(--font-sans)", () => font));+ }+ // Mermaid uses a responsive percentage width in-app. Preserve its natural+ // dimensions when the SVG is opened as a file or imported into an editor.+ const viewBox = root.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number);+ if (viewBox?.length === 4 && viewBox.every(Number.isFinite) && viewBox[2] > 0 && viewBox[3] > 0) {+ root.setAttribute("width", String(viewBox[2]));+ root.setAttribute("height", String(viewBox[3]));+ }+ return new XMLSerializer().serializeToString(root);+}++export function downloadMermaidSvg(svg: string): void {+ const url = URL.createObjectURL(new Blob([svg], { type: "image/svg+xml;charset=utf-8" }));+ const link = document.createElement("a");+ try {+ link.href = url;+ link.download = "diagram.svg";+ document.body.append(link);+ link.click();+ } finally {+ link.remove();+ // Chromium consumes the URL after the click returns.+ window.setTimeout(() => URL.revokeObjectURL(url), 1000);+ }+}diff --git a/apps/desktop/test/fixtures/mermaid-export-runner.cjs b/apps/desktop/test/fixtures/mermaid-export-runner.cjsnew file mode 100644index 000000000..656319208--- /dev/null+++ b/apps/desktop/test/fixtures/mermaid-export-runner.cjs@@ -0,0 +1,93 @@+const { app, BrowserWindow, clipboard } = require("electron");+const assert = require("node:assert/strict");+const { readFileSync } = require("node:fs");+const { join } = require("node:path");+const dir = process.env.PI_MERMAID_TEST_DIR;+app.setPath("userData", join(dir, "profile"));+const watchdog = setTimeout(() => app.exit(1), 45_000);+app.whenReady().then(async () => {+ const win = new BrowserWindow({ show: true, width: 900, height: 700,+ webPreferences: { sandbox: true, contextIsolation: true, backgroundThrottling: false } });+ win.webContents.on("will-navigate", (event) => event.preventDefault());+ win.webContents.setWindowOpenHandler(() => ({ action: "deny" }));+ const evaluate = (source) => win.webContents.executeJavaScript(source, true);+ const wait = async (source) => {+ const deadline = Date.now() + 10_000;+ while (!await evaluate(source)) {+ if (Date.now() > deadline) throw Error(`Timed out: ${source}`);+ await new Promise((resolve) => setTimeout(resolve, 20));+ }+ };+ const click = async (label) => {+ win.focus(); win.webContents.focus();+ await wait("document.hasFocus()");+ const point = await evaluate(`(() => {+ const el = document.querySelector('button[aria-label=' + CSS.escape(${JSON.stringify(label)}) + ']');+ if (!el || el.disabled) throw Error('Control unavailable: ' + ${JSON.stringify(label)});+ const r = el.getBoundingClientRect(); return {x:Math.round(r.x+r.width/2),y:Math.round(r.y+r.height/2)};+ })()`);+ win.webContents.sendInputEvent({ type: "mouseDown", button: "left", clickCount: 1, ...point });+ win.webContents.sendInputEvent({ type: "mouseUp", button: "left", clickCount: 1, ...point });+ };+ await win.loadFile(join(dir, "index.html"));+ await wait("Boolean(window.mermaidFixture)");+ const source = "```mermaid\nflowchart LR\n A[开始] --> B[完成]\n```";+ await evaluate(`window.mermaidFixture.openReadme(${JSON.stringify(source)})`);+ await wait('Boolean(document.querySelector(".mermaid-svg svg"))');+ assert.equal(await evaluate('document.querySelector(".file-viewer-path").textContent'), "README.md");+ assert.equal(await evaluate('Boolean(document.querySelector(".file-viewer-markdown .mermaid-svg svg"))'), true);+ await click("Copy diagram source");+ await wait('document.querySelector(".code-copy-btn.copied, .mermaid-action-btn.copied")');+ assert.equal(clipboard.readText().replaceAll("\r\n", "\n"), "flowchart LR\n A[开始] --> B[完成]");+ await click("Copy diagram as SVG");+ await wait('window.mermaidFixture.toast()?.message === "SVG copied"');+ const svg = clipboard.readText().replaceAll("\r\n", "\n");+ assert.match(svg, /^<svg\b/);+ assert.match(svg, /xmlns="http:\/\/www.w3.org\/2000\/svg"/);+ assert.match(svg, /开始/);+ assert.match(svg, /完成/);+ assert.doesNotMatch(svg, /var\(--font-sans\)/);+ assert.match(svg, /Arial/);+ assert.equal(await evaluate(`(() => {+ const root = new DOMParser().parseFromString(${JSON.stringify(svg)}, 'image/svg+xml').documentElement;+ return root.localName === 'svg' && Number(root.getAttribute('width')) > 0 && Number(root.getAttribute('height')) > 0;+ })()`), true);+ const downloaded = new Promise((resolve, reject) => {+ win.webContents.session.once("will-download", (_event, item) => {+ assert.equal(item.getFilename(), "diagram.svg");+ item.setSavePath(join(dir, "diagram.svg"));+ item.once("done", (_event, state) => state === "completed" ? resolve() : reject(Error(state)));+ });+ });+ await click("Export diagram as SVG");+ await downloaded;+ assert.equal(readFileSync(join(dir, "diagram.svg"), "utf8"), svg);+ await click("Show diagram source");+ await wait('Boolean(document.querySelector(".mermaid-source"))');+ assert.equal(await evaluate('document.querySelector(\'button[aria-label="Copy diagram as SVG"]\').disabled'), false);+ // Source/theme changes must export the newly rendered SVG, even in source view.+ await evaluate(`window.mermaidFixture.render(${JSON.stringify(source.replace("完成", "新版"))}, "zh-CN", "dark")`);+ await wait('document.querySelector(".mermaid-svg svg")?.textContent.includes("新版")');+ await click("复制图表为 SVG");+ await wait('window.mermaidFixture.toast()?.message === "SVG 已复制"');+ assert.match(clipboard.readText(), /新版/);+ assert.doesNotMatch(clipboard.readText(), /完成/);+ // Only the external clipboard/download boundaries are replaced for failures.+ await evaluate('Object.defineProperty(navigator, "clipboard", {configurable:true,value:{writeText:async()=>{throw Error("denied")}}})');+ await click("复制图表为 SVG");+ await wait('window.mermaidFixture.toast()?.message === "复制到剪贴板失败"');+ assert.equal(await evaluate('window.mermaidFixture.toast()?.variant'), "error");+ await evaluate('URL.createObjectURL = () => { throw Error("unavailable") }; void 0');+ await click("导出图表为 SVG");+ await wait('window.mermaidFixture.toast()?.message === "无法导出 SVG 图表"');+ assert.equal(await evaluate('window.mermaidFixture.toast()?.variant'), "error");+ await evaluate('window.mermaidFixture.render("```mermaid\\nthis is invalid\\n```", "zh-CN")');+ await wait('Boolean(document.querySelector(".mermaid-block-error"))');+ assert.equal(await evaluate('[...document.querySelectorAll(".mermaid-block-actions button")].slice(0,2).every(el => el.disabled)'), true);+ await evaluate('window.mermaidFixture.render("```mermaid\\nflowchart LR\\n A --> B")');+ await wait('!document.querySelector(".mermaid-block")');+ assert.equal(await evaluate('Boolean(document.querySelector(".code-block"))'), true);+ assert.equal(await evaluate(`(() => { try { window.mermaidFixture.standaloneMermaidSvg('<svg>'); return false; } catch { return true; } })()`), true);+ console.log("Mermaid SVG user path passed: source, clipboard SVG, real download, locale/theme refresh, failure recovery, invalid/partial fences");+ clearTimeout(watchdog); win.destroy(); app.exit(0);+}).catch((error) => { clearTimeout(watchdog); console.error(error); app.exit(1); });diff --git a/apps/desktop/test/fixtures/mermaid-export.jsx b/apps/desktop/test/fixtures/mermaid-export.jsxnew file mode 100644index 000000000..24354dbab--- /dev/null+++ b/apps/desktop/test/fixtures/mermaid-export.jsx@@ -0,0 +1,41 @@+import { createRoot } from "react-dom/client";+import { flushSync } from "react-dom";+import { createInstance } from "i18next";+import { I18nextProvider } from "react-i18next";+import { catalogs } from "@pi-desktop/i18n";+import { IPC } from "@pi-desktop/shared";+import { FilesTab } from "../../src/components/workpanel/FilesTab";+import { Markdown } from "../../src/components/Markdown";+import { useAppStore } from "../../src/stores/app-store";+import { standaloneMermaidSvg } from "../../src/lib/mermaid-export";++const i18n = createInstance();+await i18n.init({ lng: "en", resources: Object.fromEntries(+ ["en", "zh-CN"].map((locale) => [locale, { translation: catalogs[locale] }]),+), interpolation: { escapeValue: false } });+const root = createRoot(document.getElementById("root"));+window.mermaidFixture = {+ standaloneMermaidSvg,+ async openReadme(source) {+ window.piDesktop = {+ platform: "darwin",+ on() { return () => {}; },+ async invoke(channel) {+ if (channel === IPC.invoke.fsList) return { ok: true, data: { entries: [] } };+ if (channel === IPC.invoke.fsRead) return { ok: true, data: { kind: "text", content: source, size: source.length } };+ throw Error("Unexpected fixture IPC: " + channel);+ },+ };+ document.documentElement.dataset.theme = "light";+ document.documentElement.style.setProperty("--font-sans", '\"Arial\", sans-serif');+ useAppStore.setState({ workspace: { path: "/fixture", name: "fixture" }, workPanelFileRequest: { seq: 1, path: "README.md" } });+ flushSync(() => root.render(<I18nextProvider i18n={i18n}><FilesTab /></I18nextProvider>));+ },+ async render(source, locale = "en", theme = "light") {+ document.documentElement.dataset.theme = theme;+ document.documentElement.style.setProperty("--font-sans", '"Arial", sans-serif');+ await i18n.changeLanguage(locale);+ flushSync(() => root.render(<I18nextProvider i18n={i18n}><Markdown source={source} /></I18nextProvider>));+ },+ toast: () => useAppStore.getState().toasts.at(-1),+};diff --git a/apps/desktop/test/mermaid-export-user-path.test.mjs b/apps/desktop/test/mermaid-export-user-path.test.mjsnew file mode 100644index 000000000..06f1996f9--- /dev/null+++ b/apps/desktop/test/mermaid-export-user-path.test.mjs@@ -0,0 +1,38 @@+import assert from "node:assert/strict";+import { spawn } from "node:child_process";+import { createRequire } from "node:module";+import { mkdtemp, rm, writeFile } from "node:fs/promises";+import { join } from "node:path";+import test from "node:test";+import { repositoryRoot, resolveElectronBinary } from "../../../scripts/e2e/boot.mjs";++const root = repositoryRoot();+const { build } = createRequire(join(root, "packages/agent-runtime/package.json"))("esbuild");++test("Mermaid preview copies standalone SVG and downloads the same diagram", {+ timeout: 90_000,+ skip: process.platform === "linux" && !process.env.DISPLAY ? "Electron requires a display" : false,+}, async () => {+ const temp = await mkdtemp(join(root, "apps/desktop/.mermaid-export-"));+ try {+ await build({+ entryPoints: [join(root, "apps/desktop/test/fixtures/mermaid-export.jsx")],+ outfile: join(temp, "renderer.js"), bundle: true, format: "esm", platform: "browser", jsx: "automatic",+ define: { "import.meta.env.DEV": "false", "process.env.NODE_ENV": '"production"' },+ loader: { ".woff2": "file", ".woff": "file", ".ttf": "file" },+ });+ await writeFile(join(temp, "index.html"), '<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src \'self\'; style-src \'self\' \'unsafe-inline\'"><link rel="stylesheet" href="renderer.css"><div id="root"></div><script type="module" src="renderer.js"></script>');+ const env = { ...process.env, PI_MERMAID_TEST_DIR: temp };+ delete env.ELECTRON_RUN_AS_NODE;+ const child = spawn(resolveElectronBinary(root).electronBinary,+ [join(root, "apps/desktop/test/fixtures/mermaid-export-runner.cjs")], { env, stdio: ["ignore", "pipe", "pipe"] });+ let output = "";+ child.stdout.on("data", (chunk) => { output += chunk; });+ child.stderr.on("data", (chunk) => { output += chunk; });+ const code = await new Promise((resolve, reject) => { child.once("error", reject); child.once("exit", resolve); });+ assert.equal(code, 0, output);+ assert.match(output, /Mermaid SVG user path passed/);+ } finally {+ await rm(temp, { recursive: true, force: true });+ }+});diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 5115e5630..3530437e4 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -2141,8 +2141,14 @@ Renderer: `apps/desktop/src/components/Markdown.tsx` + `apps/desktop/src/lib/shiDOMPurify SVG-profile pass precede insertion. Unsafe external/media elements,`foreignObject`, event-capable links, and URL attributes are removed. Invalidor oversized input falls back to a readable source view. The toolbar toggles- diagram/source and copies the original source; light/dark theme changes- re-render the SVG. Thinking prose deliberately keeps `mermaid` fences as+ diagram/source and copies the original source. Once rendering succeeds,+ **Copy diagram as SVG** writes a standalone SVG document as clipboard text,+ and **Export diagram as SVG** downloads `diagram.svg` with the same bytes.+ Both actions are disabled while rendering or when no valid SVG is available;+ failures show localized feedback. Export preserves the sanitized SVG,+ viewBox dimensions, and resolved UI font without rerunning Mermaid or+ requiring new host permissions. These actions also appear in host Markdown+ file previews, including README files. Light/dark theme changes re-render the SVG. Thinking prose deliberately keeps `mermaid` fences assource code so a collapsed reasoning trace cannot start diagram layout.- **Syntax highlighting**: Shiki singleton with the JavaScript regex engine(no wasm), themes `one-light`/`one-dark-pro` following `data-theme`.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex a3ffd74f7..b8a5d6267 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -7162,18 +7162,26 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.closing fence arrives.2. Scroll the completed diagram into view, toggle source, copy the source,and switch between light and dark themes.- 3. Scroll upward so transcript follow is paused, then bring another completed+ 3. Copy SVG and export SVG; parse the clipboard text and downloaded file+ as standalone SVG, verify the diagram labels, explicit dimensions and+ resolved UI font, then repeat in a README preview. Deny clipboard access+ and force download setup failure; verify localized error feedback.+ Repeat while rendering and with invalid input: SVG actions stay disabled.+ Switch diagrams/themes and confirm subsequent exports use the new SVG.+ 4. Scroll upward so transcript follow is paused, then bring another completeddiagram near the viewport.- 4. Render invalid and over-20,000-character Mermaid sources plus a payload+ 5. Render invalid and over-20,000-character Mermaid sources plus a payloadattempting an HTML label, external image, link, or Mermaid config override.- 5. Expand thinking content containing a `mermaid` fence.+ 6. Expand thinking content containing a `mermaid` fence.- **Expected**:- The partial stream remains a normal source code block; only the completeanswer fence starts rendering, and only near the viewport. Ordinary codefences and thinking Mermaid fences retain their source presentation.- The diagram uses bounded card chrome, remains within the transcript width,switches theme without stale colors, and exposes keyboard-accessible- diagram/source and copy controls. Copy returns the original fence source.+ diagram/source and copy controls. Source copy returns the original fence+ source; SVG copy returns XML text and SVG export downloads `diagram.svg`.+ Exported content retains the sanitization applied to the preview.- Diagram height changes keep a pinned transcript at the bottom but neverresume follow after the user scrolls upward.- Invalid, oversized, or unsafe input cannot fail the assistant turn, execute@@ -7183,7 +7191,9 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.`04-ux/09-interaction-patterns.md` §2, `05-security/01-security.md` §2, D165- **Acceptance**: C (chat & stream), Security, Quality- **Milestone**: M5-- **Status**: Unit-covered (`mermaid-rendering.test.mjs`); rendered security and+- **Status**: Unit-covered (`mermaid-rendering.test.mjs`); README SVG copy/export,+ theme/source updates, and error recovery covered in isolated Electron+ (`mermaid-export-user-path.test.mjs`). Remaining rendered security andvisual scenario Draft#### E2E-092: Packaged runtime is self-contained without duplicate dependenciesdiff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex a65c32271..d859ae510 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -419,6 +419,10 @@ export const de = {"speakerYou": "Du","speakerAssistant": "Assistent","copyDiagramSource": "Diagrammquelle kopieren",+ "copyDiagramSvg": "Diagramm als SVG kopieren",+ "exportDiagramSvg": "Diagramm als SVG exportieren",+ "diagramSvgCopied": "SVG kopiert",+ "diagramSvgExportFailed": "Diagramm konnte nicht als SVG exportiert werden","showDiagram": "Diagramm anzeigen","showDiagramSource": "Diagrammquelle anzeigen","mermaidDiagram": "Meerjungfrau-Diagramm",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex c909a95c2..ae48b2ea1 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -431,6 +431,10 @@ export const en = {speakerYou: "You",speakerAssistant: "Assistant",copyDiagramSource: "Copy diagram source",+ copyDiagramSvg: "Copy diagram as SVG",+ exportDiagramSvg: "Export diagram as SVG",+ diagramSvgCopied: "SVG copied",+ diagramSvgExportFailed: "Couldn't export diagram as SVG",showDiagram: "Show diagram",showDiagramSource: "Show diagram source",mermaidDiagram: "Mermaid diagram",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 7d64be7d7..7c3af06a8 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -419,6 +419,10 @@ export const es = {"speakerYou": "Tú","speakerAssistant": "Asistente","copyDiagramSource": "Copiar fuente del diagrama",+ "copyDiagramSvg": "Copiar diagrama como SVG",+ "exportDiagramSvg": "Exportar diagrama como SVG",+ "diagramSvgCopied": "SVG copiado",+ "diagramSvgExportFailed": "No se pudo exportar el diagrama como SVG","showDiagram": "Mostrar diagrama","showDiagramSource": "Mostrar fuente del diagrama","mermaidDiagram": "Diagrama de sirena",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex 2b6e2056f..19321c01a 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -419,6 +419,10 @@ export const fr = {"speakerYou": "Vous","speakerAssistant": "Assistant","copyDiagramSource": "Copier la source du diagramme",+ "copyDiagramSvg": "Copier le diagramme en SVG",+ "exportDiagramSvg": "Exporter le diagramme en SVG",+ "diagramSvgCopied": "SVG copié",+ "diagramSvgExportFailed": "Impossible d’exporter le diagramme en SVG","showDiagram": "Afficher le diagramme","showDiagramSource": "Afficher la source du diagramme","mermaidDiagram": "Diagramme de sirène",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex 6c9edfcb8..8d49f3301 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -431,6 +431,10 @@ export const ko = {speakerYou: "나",speakerAssistant: "어시스턴트",copyDiagramSource: "다이어그램 소스 복사",+ copyDiagramSvg: "다이어그램을 SVG로 복사",+ exportDiagramSvg: "다이어그램을 SVG로 내보내기",+ diagramSvgCopied: "SVG 복사됨",+ diagramSvgExportFailed: "다이어그램을 SVG로 내보낼 수 없습니다",showDiagram: "다이어그램 표시",showDiagramSource: "다이어그램 소스 표시",mermaidDiagram: "Mermaid 다이어그램",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex e02ec85b1..28c436c5c 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -418,6 +418,10 @@ export const ptBR = {speakerYou: "Você",speakerAssistant: "Assistente",copyDiagramSource: "Copiar código-fonte do diagrama",+ copyDiagramSvg: "Copiar diagrama como SVG",+ exportDiagramSvg: "Exportar diagrama como SVG",+ diagramSvgCopied: "SVG copiado",+ diagramSvgExportFailed: "Não foi possível exportar o diagrama como SVG",showDiagram: "Exibir diagrama",showDiagramSource: "Exibir código-fonte do diagrama",mermaidDiagram: "Diagrama Mermaid",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex 8b2d02e32..46b3ef0bf 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -431,6 +431,10 @@ export const tr = {speakerYou: "Sen",speakerAssistant: "Asistan",copyDiagramSource: "Diyagram kaynağını kopyala",+ copyDiagramSvg: "Diyagramı SVG olarak kopyala",+ exportDiagramSvg: "Diyagramı SVG olarak dışa aktar",+ diagramSvgCopied: "SVG kopyalandı",+ diagramSvgExportFailed: "Diyagram SVG olarak dışa aktarılamadı",showDiagram: "Diyagramı göster",showDiagramSource: "Diyagram kaynağını göster",mermaidDiagram: "Mermaid diyagramı",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex cf25670f7..4603d67e8 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -424,6 +424,10 @@ export const zhCN = {speakerYou: "你",speakerAssistant: "助手",copyDiagramSource: "复制图表源码",+ copyDiagramSvg: "复制图表为 SVG",+ exportDiagramSvg: "导出图表为 SVG",+ diagramSvgCopied: "SVG 已复制",+ diagramSvgExportFailed: "无法导出 SVG 图表",showDiagram: "显示图表",showDiagramSource: "显示图表源码",mermaidDiagram: "Mermaid 图表",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex bd3286669..1432863c9 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -424,6 +424,10 @@ export const zhTW = {speakerYou: "你",speakerAssistant: "助手",copyDiagramSource: "複製圖表原始碼",+ copyDiagramSvg: "複製圖表為 SVG",+ exportDiagramSvg: "匯出圖表為 SVG",+ diagramSvgCopied: "SVG 已複製",+ diagramSvgExportFailed: "無法匯出 SVG 圖表",showDiagram: "顯示圖表",showDiagramSource: "顯示圖表原始碼",mermaidDiagram: "Mermaid 圖表",diff --git a/packages/shared/src/changelog-de.ts b/packages/shared/src/changelog-de.tsindex 7168a33a9..d1ebf54bd 100644--- a/packages/shared/src/changelog-de.ts+++ b/packages/shared/src/changelog-de.ts@@ -5,6 +5,7 @@ export const deEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "Gerenderte Mermaid-Diagramme als SVG-Text kopieren oder als eigenständige SVG-Dateien exportieren, auch in README-Vorschauen.","Installierte Plugins erscheinen als Karten in einem selbst füllenden Raster, jede mit einer klaren Aktion und sichtbarem Vertrauens-, Update- und Geltungsstatus.","Öffentliche Bewertungen und Rezensionen für Marketplace-Plugins lesen und im Plugin-Center eine schreiben — die Desktop-App meldet sich nie an.","Lange Bash-Befehle laufen nach dem Agenten-Turn als Hintergrundaufgaben weiter; ihre Ausgabe lässt sich später prüfen.",diff --git a/packages/shared/src/changelog-en.ts b/packages/shared/src/changelog-en.tsindex 88069b4a2..df2bac465 100644--- a/packages/shared/src/changelog-en.ts+++ b/packages/shared/src/changelog-en.ts@@ -5,6 +5,7 @@ export const enEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "Copy rendered Mermaid diagrams as SVG text or export them as standalone SVG files, including from README previews.","Browse installed plugins as cards in an auto-filling grid, each with one clear action and its trust, update, and scope state at a glance.","Read public ratings and reviews for marketplace plugins, and open the plugin center to write one — the desktop never signs in.","Keep long-running Bash commands going after a turn ends, then review their output as background tasks.",diff --git a/packages/shared/src/changelog-es.ts b/packages/shared/src/changelog-es.tsindex 5eaa2b87d..52f92f745 100644--- a/packages/shared/src/changelog-es.ts+++ b/packages/shared/src/changelog-es.ts@@ -5,6 +5,7 @@ export const esEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "Copia diagramas Mermaid como texto SVG o expórtalos como archivos SVG independientes, también desde las vistas previas de README.","Los plugins instalados aparecen como tarjetas en una cuadrícula autoajustable, cada una con una acción clara y su estado de confianza, actualización y alcance a la vista.","Lee valoraciones y reseñas públicas de los plugins del mercado y abre el centro de plugins para escribir una: la aplicación de escritorio nunca inicia sesión.","Los comandos Bash largos continúan como tareas en segundo plano cuando termina el turno, y puedes consultar su salida después.",diff --git a/packages/shared/src/changelog-fr.ts b/packages/shared/src/changelog-fr.tsindex 69eac6537..053969de4 100644--- a/packages/shared/src/changelog-fr.ts+++ b/packages/shared/src/changelog-fr.ts@@ -5,6 +5,7 @@ export const frEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "Copiez les diagrammes Mermaid en texte SVG ou exportez-les en fichiers SVG autonomes, y compris depuis les aperçus README.","Les plugins installés s'affichent en cartes dans une grille auto-adaptative, chacune avec une action claire et son état de confiance, de mise à jour et de portée visible.","Consultez les notes et avis publics des plugins du marché et ouvrez le centre de plugins pour en écrire un — l'application de bureau ne se connecte jamais.","Les longues commandes Bash continuent en tâche de fond à la fin du tour, et leur sortie reste consultable.",diff --git a/packages/shared/src/changelog-ko.ts b/packages/shared/src/changelog-ko.tsindex 9f1f3395e..325ba10f3 100644--- a/packages/shared/src/changelog-ko.ts+++ b/packages/shared/src/changelog-ko.ts@@ -5,6 +5,7 @@ export const koEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "README 미리보기와 채팅에서 Mermaid 다이어그램을 SVG 텍스트로 복사하거나 독립 SVG 파일로 내보냅니다.","설치된 플러그인이 자동 채움 카드 그리드로 표시되고, 각 카드에 명확한 동작과 신뢰·업데이트·적용 범위 상태가 함께 보입니다.","마켓플레이스 플러그인의 공개 평점과 리뷰를 읽고, 플러그인 센터에서 리뷰를 작성할 수 있습니다. 데스크톱은 로그인하지 않습니다.","긴 Bash 명령은 턴이 끝난 뒤에도 백그라운드 작업으로 계속 실행되며, 나중에 출력을 확인할 수 있습니다.",diff --git a/packages/shared/src/changelog-pt-BR.ts b/packages/shared/src/changelog-pt-BR.tsindex 25d618a3c..dcd173a2f 100644--- a/packages/shared/src/changelog-pt-BR.ts+++ b/packages/shared/src/changelog-pt-BR.ts@@ -5,6 +5,7 @@ export const ptBREntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "Copie diagramas Mermaid como texto SVG ou exporte arquivos SVG independentes, inclusive nas prévias de README.","Os plugins instalados aparecem como cartões em uma grade de preenchimento automático, cada um com uma ação clara e o estado de confiança, atualização e escopo à vista.","Leia notas e avaliações públicas dos plugins do mercado e abra o centro de plugins para escrever uma — o aplicativo de desktop nunca faz login.","Comandos Bash longos continuam em tarefas em segundo plano após o turno, e você pode consultar a saída depois.",diff --git a/packages/shared/src/changelog-tr.ts b/packages/shared/src/changelog-tr.tsindex c1c5ef706..00e02d714 100644--- a/packages/shared/src/changelog-tr.ts+++ b/packages/shared/src/changelog-tr.ts@@ -5,6 +5,7 @@ export const trEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "README önizlemeleri dahil Mermaid diyagramlarını SVG metni olarak kopyalayın veya bağımsız SVG dosyaları olarak dışa aktarın.","Yüklü eklentiler kendiliğinden dolan bir kart ızgarasında görünür; her kartta net bir eylem ile güven, güncelleme ve kapsam durumu yer alır.","Mağaza eklentilerinin herkese açık puanlarını ve değerlendirmelerini okuyun, yazmak için eklenti merkezini açın — masaüstü uygulaması hiçbir zaman oturum açmaz.","Uzun Bash komutları tur bittikten sonra arka plan görevleri olarak çalışmaya devam eder; çıktıları daha sonra inceleyebilirsiniz.",diff --git a/packages/shared/src/changelog-zh-CN.ts b/packages/shared/src/changelog-zh-CN.tsindex 224d77997..b621990a0 100644--- a/packages/shared/src/changelog-zh-CN.ts+++ b/packages/shared/src/changelog-zh-CN.ts@@ -5,6 +5,7 @@ export const zhCNEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "在 README 预览和聊天中,将 Mermaid 图表复制为 SVG 文本或导出为独立的 SVG 文件。","已安装插件改为自适应卡片网格,每张卡片都有明确的主操作,信任、更新与作用范围一目了然。","可查看插件市场的公开评分与评论,并可前往插件中心发表评论——桌面端无需登录。","长时间运行的 Bash 命令可转为后台任务,在本轮结束后继续执行,并可随时查看输出。",diff --git a/packages/shared/src/changelog-zh-TW.ts b/packages/shared/src/changelog-zh-TW.tsindex 53e5c04ba..0d6675efe 100644--- a/packages/shared/src/changelog-zh-TW.ts+++ b/packages/shared/src/changelog-zh-TW.ts@@ -5,6 +5,7 @@ export const zhTWEntries: ChangelogEntry[] = [version: "0.21.0",date: "2026-10-16",highlights: [+ "在 README 預覽和聊天中,將 Mermaid 圖表複製為 SVG 文字或匯出為獨立的 SVG 檔案。","已安裝外掛改為自適應卡片網格,每張卡片都有明確的主要操作,信任、更新與作用範圍一目了然。","可查看外掛市場的公開評分與評論,並可前往外掛中心發表評論——桌面端無需登入。","長時間執行的 Bash 命令可轉為背景工作,在本輪結束後繼續執行,並可隨時查看輸出。",