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(chat): make inline visualizations an opt-in setting
vastsa87fee11864cb
diff --git a/apps/desktop/electron/main/builtin-skills.ts b/apps/desktop/electron/main/builtin-skills.tsindex 3ad35c7ba..11e3fb22b 100644--- a/apps/desktop/electron/main/builtin-skills.ts+++ b/apps/desktop/electron/main/builtin-skills.ts@@ -131,6 +131,22 @@ export function builtinSkills(input: BuiltinSkillInput): PluginSkillDef[] {);}+/**+ * Built-in ids this process must withhold: the host-owned activation state plus+ * the inline-visualization switch, which owns the `visualize` skill.+ *+ * The switch is opt-in, so an absent or unreadable setting withholds the skill.+ * Keeping this in one place means a launch, the `/` menu, and the on-demand+ * `Skill` tool cannot disagree about whether the feature exists.+ */+export function effectiveDisabledBuiltinSkills(+ disabled: readonly string[],+ visualizations: boolean,+): string[] {+ if (visualizations || disabled.includes(VISUALIZE_SKILL_ID)) return [...disabled];+ return [...disabled, VISUALIZE_SKILL_ID];+}+/** Refuse a stale on-demand load after a bundled skill has been switched off. */export async function assertBuiltinSkillEnabled(id: string,diff --git a/apps/desktop/electron/main/index.ts b/apps/desktop/electron/main/index.tsindex 4e372edcd..11bc73512 100644--- a/apps/desktop/electron/main/index.ts+++ b/apps/desktop/electron/main/index.ts@@ -396,6 +396,7 @@ const {activeUserSubagentDocuments,disabledBuiltinSubagents,disabledBuiltinSkills,+ runtimeDisabledBuiltinSkills,loadUserSkillBody,resolveEffectiveCommandShell,resolveAgentRuntimeLaunch,@@ -779,7 +780,9 @@ const sidecarRuntime = createSidecarRuntime({sessionProjects,loadUserSkillBody,activeUserSkills,- disabledBuiltinSkills,+ // Runtime consumers honor the inline-visualization switch; the Skills page+ // keeps reading the raw host state above.+ disabledBuiltinSkills: runtimeDisabledBuiltinSkills,pluginActiveInProject,currentNetworkProxy,});@@ -973,6 +976,7 @@ function registerIpc() {refreshUserMcp,describeError,activeUserSubagentDocuments,+ runtimeDisabledBuiltinSkills,disabledBuiltinSubagents,disabledBuiltinSkills,pluginViews,diff --git a/apps/desktop/electron/main/ipc/register.ts b/apps/desktop/electron/main/ipc/register.tsindex c163a2bc8..a382f0a41 100644--- a/apps/desktop/electron/main/ipc/register.ts+++ b/apps/desktop/electron/main/ipc/register.ts@@ -70,6 +70,8 @@ export type RegisterIpcDependencies = {activeUserSubagentDocuments: (...args: any[]) => Promise<any>;disabledBuiltinSubagents: () => Promise<string[]>;disabledBuiltinSkills: () => Promise<string[]>;+ /** Host activation plus the inline-visualization switch, for runtime consumers. */+ runtimeDisabledBuiltinSkills: () => Promise<string[]>;completionNoticeTurns: Set<string>;liveCallService?: LiveCallService;liveVoiceWidget?: LiveVoiceWidget;@@ -145,6 +147,7 @@ export function registerIpcHandlers(dependencies: RegisterIpcDependencies) {activeUserSubagentDocuments,disabledBuiltinSubagents,disabledBuiltinSkills,+ runtimeDisabledBuiltinSkills,pluginActiveInProject,getWorkPanelReservationWidth,setWorkPanelReservationWidth,@@ -345,7 +348,7 @@ export function registerIpcHandlers(dependencies: RegisterIpcDependencies) {agentExtensions,optionalWorkspaceRoot,activeUserSkills,- disabledBuiltinSkills,+ disabledBuiltinSkills: runtimeDisabledBuiltinSkills,pluginActiveInProject,loadComposerTemplatesCached,});diff --git a/apps/desktop/electron/main/runtime/session-launch.ts b/apps/desktop/electron/main/runtime/session-launch.tsindex e96990cad..b76b4e349 100644--- a/apps/desktop/electron/main/runtime/session-launch.ts+++ b/apps/desktop/electron/main/runtime/session-launch.ts@@ -30,7 +30,7 @@ import {visionFromModelConfig,type UserSubagentDocument,} from "@pi-desktop/agent-runtime";-import { builtinSkills, VISUALIZE_SKILL_ID } from "../builtin-skills";+import { builtinSkills, effectiveDisabledBuiltinSkills, VISUALIZE_SKILL_ID } from "../builtin-skills";import { OAUTH_AUTH_KIND, type VendorOAuth } from "../oauth";import {catalogModelConfigFor,@@ -232,6 +232,33 @@ export function createSessionLaunchRuntime({}}+ /**+ * Built-in ids this process treats as off for runtime consumers: the host's+ * activation state plus the inline-visualization switch. The `/` menu and the+ * on-demand `Skill` tool read this, so neither offers the `visualize` skill+ * while the feature is off — and a switch takes effect without a relaunch.+ */+ async function runtimeDisabledBuiltinSkills(): Promise<string[]> {+ const disabled = await disabledBuiltinSkills();+ let visualizations = false;+ if (runtimeState.host?.isAvailable()) {+ try {+ const settings = await runtimeState.host.call<{ inlineVisualizations?: boolean }>(+ "settings.get",+ );+ visualizations = settings.inlineVisualizations === true;+ } catch (error) {+ // An unreadable switch keeps the feature off; it never turns it on.+ if (!isHostUnavailable(error)) {+ logger.app("plugin", "warn", "visualization switch failed", {+ data: String(error),+ });+ }+ }+ }+ return effectiveDisabledBuiltinSkills(disabled, visualizations);+ }+/*** Load one of the user's own skill documents by id, or `null` if there is no* such skill — so the caller can fall through to the plugin catalog.@@ -509,7 +536,12 @@ export function createSessionLaunchRuntime({// skills come first so a plugin's entry reads as a refinement of them, and// the user's own skills come last so they win a name clash in the model's// reading order.- const disabledSkillIds = await disabledBuiltinSkills();+ // The inline-visualization switch owns the `visualize` skill: with the+ // feature off it is withheld here, which also drops the directory below.+ const disabledSkillIds = effectiveDisabledBuiltinSkills(+ await disabledBuiltinSkills(),+ settings.inlineVisualizations === true,+ );const pluginSkills = [...builtinSkills({workspacePath: projectPath,@@ -713,8 +745,9 @@ export function createSessionLaunchRuntime({commandShell,scratchDir: join(dataDir, "scratch", sessionId),// Remote-host tools write on that host; Main can only serve local files.- // A disabled visualize skill also withholds the directory, so the- // prompt never points the model at a skill it cannot load.+ // The feature switch and a disabled visualize skill both withhold the+ // directory, so the prompt never points the model at a skill it cannot+ // load or at a card this build will not render....(remoteWorkspace || disabledSkillIds.includes(VISUALIZE_SKILL_ID)? {}: { visualizationsDir: join(dataDir, GEN_UI_DIRECTORY_NAME, sessionId) }),@@ -793,6 +826,7 @@ export function createSessionLaunchRuntime({activeUserSubagentDocuments,disabledBuiltinSubagents,disabledBuiltinSkills,+ runtimeDisabledBuiltinSkills,loadUserSkillBody,resolveEffectiveCommandShell,resolveAgentRuntimeLaunch,diff --git a/apps/desktop/src/features/chat/gen-ui/gen-ui-split.ts b/apps/desktop/src/features/chat/gen-ui/gen-ui-split.tsindex 699bff8e6..946808794 100644--- a/apps/desktop/src/features/chat/gen-ui/gen-ui-split.ts+++ b/apps/desktop/src/features/chat/gen-ui/gen-ui-split.ts@@ -27,12 +27,17 @@ export function hideStreamingGenUiReference(content: string): string {* streaming reply may still be writing the line (or its file), and a card that* appears mid-stream would flash an "unavailable" state. Until then a trailing* reference line is hidden.+ *+ * With inline visualizations switched off, the reference lines are still+ * stripped — a historical reply must not leak its absolute path as text — but+ * no card is produced, so nothing is loaded from disk.*/-export function genUiSplitFor(content: string, streaming: boolean): GenUiSplit {+export function genUiSplitFor(content: string, streaming: boolean, enabled = true): GenUiSplit {if (streaming) return { content: hideStreamingGenUiReference(content), references: EMPTY };- return splitGenUiReferences(content);+ const split = splitGenUiReferences(content);+ return enabled ? split : { content: split.content, references: EMPTY };}-export function useGenUiSplit(content: string, streaming: boolean): GenUiSplit {- return useMemo(() => genUiSplitFor(content, streaming), [content, streaming]);+export function useGenUiSplit(content: string, streaming: boolean, enabled = true): GenUiSplit {+ return useMemo(() => genUiSplitFor(content, streaming, enabled), [content, streaming, enabled]);}diff --git a/apps/desktop/src/features/chat/transcript/AssistantTurnParts.tsx b/apps/desktop/src/features/chat/transcript/AssistantTurnParts.tsxindex 02e57046b..9561ac226 100644--- a/apps/desktop/src/features/chat/transcript/AssistantTurnParts.tsx+++ b/apps/desktop/src/features/chat/transcript/AssistantTurnParts.tsx@@ -19,12 +19,14 @@ const SmoothMessageBubble = memo(function SmoothMessageBubble({ message, streamistreaming: boolean;}) {const smoothStreaming = useAppStore((s) => s.settings?.smoothStreaming !== false);+ // Opt-in feature: an absent setting keeps cards out of the transcript.+ const inlineVisualizations = useAppStore((s) => s.settings?.inlineVisualizations === true);const prefersReducedMotion = typeof window !== "undefined" &&window.matchMedia("(prefers-reduced-motion: reduce)").matches;const enabled = smoothStreaming && !prefersReducedMotion;const displayContent = useSmoothText(message.content || "", streaming, enabled);const showCursor = streaming && enabled && Boolean(displayContent);- const genUi = useGenUiSplit(displayContent, streaming);+ const genUi = useGenUiSplit(displayContent, streaming, inlineVisualizations);// Cards load the pane session's own copy, never the session a path names.const sessionId = useSlotSessionId();const remote = useAppStore((s) =>diff --git a/apps/desktop/src/features/settings/SettingsPage.tsx b/apps/desktop/src/features/settings/SettingsPage.tsxindex a2f8f3d94..3c1cf4948 100644--- a/apps/desktop/src/features/settings/SettingsPage.tsx+++ b/apps/desktop/src/features/settings/SettingsPage.tsx@@ -582,6 +582,20 @@ export function SettingsPage() {onChange={() => void saveSettings({ smoothStreaming: !(settings.smoothStreaming !== false) })}/></SettingsRow>+ <SettingsRow+ title={t("settings.inlineVisualizations")}+ description={t("settings.inlineVisualizationsDesc")}+ >+ <SettingsToggle+ checked={settings.inlineVisualizations === true}+ label={t("settings.inlineVisualizations")}+ onChange={() =>+ void saveSettings({+ inlineVisualizations: settings.inlineVisualizations !== true,+ })+ }+ />+ </SettingsRow><LargePasteThresholdRowsettings={settings}saveSettings={saveSettings}diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 47b45ea4e..5465a95ab 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -557,6 +557,14 @@ export function validateSettingsWrite(settings: AppSettings): AppSettings {errorCode: "INVALID_PARAMS",});}+ if (+ Object.prototype.hasOwnProperty.call(value, "inlineVisualizations") &&+ typeof value.inlineVisualizations !== "boolean"+ ) {+ throw Object.assign(new Error("inlineVisualizations is invalid"), {+ errorCode: "INVALID_PARAMS",+ });+ }for (const key of ["sidebarRunningIndicators","sidebarRunningBadge",diff --git a/apps/desktop/src/lib/settings-search.ts b/apps/desktop/src/lib/settings-search.tsindex 7a1ea4531..7c4c1cf00 100644--- a/apps/desktop/src/lib/settings-search.ts+++ b/apps/desktop/src/lib/settings-search.ts@@ -117,6 +117,8 @@ export const SETTINGS_NAV: SettingsNavEntry[] = ["settings.infiniteProviderRetry","settings.infiniteProviderRetryDesc","settings.smoothStreaming",+ "settings.inlineVisualizations",+ "settings.inlineVisualizationsDesc","settings.smoothStreamingDesc","settings.showThinking","settings.showThinkingDesc",diff --git a/apps/desktop/test/gen-ui-card.test.mjs b/apps/desktop/test/gen-ui-card.test.mjsindex c460ae883..3a9f2a55c 100644--- a/apps/desktop/test/gen-ui-card.test.mjs+++ b/apps/desktop/test/gen-ui-card.test.mjs@@ -29,7 +29,9 @@ test("references are split out only once the message is no longer streaming", astest("the assistant bubble renders split content and cards; Markdown stays gen-ui free", async () => {const bubble = await read("../src/features/chat/transcript/AssistantTurnParts.tsx");- assert.match(bubble, /const genUi = useGenUiSplit\(displayContent, streaming\);/);+ // The feature is opt-in, so the bubble passes the setting into the split.+ assert.match(bubble, /s\.settings\?\.inlineVisualizations === true/);+ assert.match(bubble, /const genUi = useGenUiSplit\(displayContent, streaming, inlineVisualizations\);/);assert.match(bubble, /<Markdown source=\{genUi\.content\} streaming=\{streaming\} \/>/);assert.match(bubble, /<GenUiCards references=\{genUi\.references\} sessionId=\{sessionId\} remote=\{remote\} \/>/);assert.match(bubble, /const sessionId = useSlotSessionId\(\);/);@@ -37,6 +39,21 @@ test("the assistant bubble renders split content and cards; Markdown stays gen-uassert.doesNotMatch(markdown, /gen-ui|genUi|GenUi/);});+test("a switched-off feature strips reference lines without producing a card", async (t) => {+ const ssr = await slotSsr(t);+ const { genUiSplitFor } = await ssr.load("/src/features/chat/gen-ui/gen-ui-split.ts");++ const off = genUiSplitFor(MESSAGE, false, false);+ // No card is produced, so nothing is read from disk or framed.+ assert.deepEqual(off.references, []);+ // The absolute path must not leak into the transcript as text.+ assert.equal(off.content, "Here is the chart.");+ assert.doesNotMatch(off.content, /visualizations|chart\.html/);++ // Streaming behaves the same way in either state.+ assert.equal(genUiSplitFor(MESSAGE, true, false).content, "Here is the chart.");+});+test("the guest frame is sandboxed to scripts only with an opaque origin", async (t) => {const ssr = await slotSsr(t);const { GenUiFrame } = await ssr.load("/src/features/chat/gen-ui/GenUiFrame.tsx");diff --git a/apps/desktop/test/jev-session-launch.test.mjs b/apps/desktop/test/jev-session-launch.test.mjsindex a7e3b7251..941ff9794 100644--- a/apps/desktop/test/jev-session-launch.test.mjs+++ b/apps/desktop/test/jev-session-launch.test.mjs@@ -96,7 +96,7 @@ test("session launch resolves Jev credentials only for opted-in Agent mode", asynormalizeThinkingLevel: () => "off",};const launchRuntime = createSessionLaunchRuntime(dependencies);- const launch = async (mode, jevEnabled) =>+ const launch = async (mode, jevEnabled, extra = {}) =>launchRuntime.resolveAgentRuntimeLaunch("session-fixture",{ providerId: provider.id, modelId: provider.defaultModelId },@@ -105,19 +105,30 @@ test("session launch resolves Jev credentials only for opted-in Agent mode", asydefaultModelId: provider.defaultModelId,defaultMode: mode,jevEnabled,+ ...extra,},);+ // Inline visualizations are opt-in: an absent setting withholds the+ // directory, so the prompt never points the model at a card this build+ // would not render. The catalog side is covered in visualize-skill.test.mjs+ // — this bundle cannot resolve the packaged skill files.+ const defaultOff = await launch("agent", false);+ assert.equal("visualizationsDir" in defaultOff.sidecarParams, false);+// The visualization directory follows the visualize skill (D671): a// disabled skill must not leave the prompt pointing at it.- const withSkill = await launch("agent", false);+ const withSkill = await launch("agent", false, { inlineVisualizations: true });assert.equal(withSkill.sidecarParams.visualizationsDir,join(temp, "visualizations", "session-fixture"),);disabledSkills = ["pi-desktop/visualize"];- const withoutSkill = await launch("agent", false);+ const withoutSkill = await launch("agent", false, { inlineVisualizations: true });assert.equal("visualizationsDir" in withoutSkill.sidecarParams, false);+ // The switch stays authoritative even when the skill is stored as enabled.+ const switchedOff = await launch("agent", false, { inlineVisualizations: false });+ assert.equal("visualizationsDir" in switchedOff.sidecarParams, false);disabledSkills = [];keyReads.length = 0;diff --git a/apps/desktop/test/visualize-skill.test.mjs b/apps/desktop/test/visualize-skill.test.mjsindex 202b477bd..25d04bb36 100644--- a/apps/desktop/test/visualize-skill.test.mjs+++ b/apps/desktop/test/visualize-skill.test.mjs@@ -10,6 +10,7 @@ const {assertBuiltinSkillEnabled,builtinSkillCatalog,builtinSkills,+ effectiveDisabledBuiltinSkills,loadBuiltinSkillBody,} = await import("../electron/main/builtin-skills.ts");@@ -71,6 +72,23 @@ test("users can disable the visualize skill like other built-ins", async () => {await assertBuiltinSkillEnabled(VISUALIZE, async () => []);});+test("the inline-visualization switch withholds the skill unless it is on", () => {+ // The feature is opt-in: absent, false, or an unreadable setting all mean off.+ assert.deepEqual(effectiveDisabledBuiltinSkills([], false), [VISUALIZE]);+ assert.deepEqual(effectiveDisabledBuiltinSkills([], true), []);+ // A stored toggle stays visible in the list, and either source wins.+ assert.deepEqual(+ effectiveDisabledBuiltinSkills(["pi-desktop/imagegen"], true),+ ["pi-desktop/imagegen"],+ );+ assert.deepEqual(effectiveDisabledBuiltinSkills([VISUALIZE], true), [VISUALIZE]);+ assert.deepEqual(effectiveDisabledBuiltinSkills([VISUALIZE], false), [VISUALIZE]);+ // Withholding the skill is what keeps it out of the catalog.+ const off = builtinSkills({ disabledIds: effectiveDisabledBuiltinSkills([], false) });+ assert.ok(!off.some((skill) => skill.id === VISUALIZE));+ assert.ok(off.some((skill) => skill.id === "pi-desktop/imagegen"));+});+test("the visualize skill file has well-formed front matter and stays compact", () => {const raw = readFileSync(join(desktopRoot, "resources/skills/visualize.md"), "utf8");const parsed = parseSkillFrontmatter(raw);diff --git a/docs/adr/gen-ui-inline-visualization.md b/docs/adr/gen-ui-inline-visualization.mdindex 0b8b2f56d..4138ad452 100644--- a/docs/adr/gen-ui-inline-visualization.md+++ b/docs/adr/gen-ui-inline-visualization.md@@ -77,14 +77,18 @@ export, and CDN guidance are removed from the adapted ZCode skill.### Model guidance (agent runtime and Electron Main)-The absolute directory path is advertised in the system prompt beside the-scratch directory, and the `pi-desktop/visualize` skill is active by default-(users can disable it like other built-in skills; a disabled skill also-withholds the directory from the prompt). Remote-host sessions get-neither the directory nor the skill (neither in the runtime nor in the `/`-menu or a send-time `/skill:` mention): their tools write on the remote-machine, which Electron Main cannot read. The card's "unavailable" state is only a-fallback for older messages.+Inline visualizations are opt-in: `AppSettings.inlineVisualizations` is absent+and `false` by default, and only `true` enables them. While the switch is off+the absolute directory path is not advertised in the system prompt, the+`pi-desktop/visualize` skill is withheld from the catalog, the `/` menu, and the+on-demand `Skill` tool, and the renderer hides existing reference lines without+loading a card. With the switch on, the directory is advertised beside the+scratch directory and the skill is active unless the user disables it like other+built-in skills; a disabled skill also withholds the directory from the prompt.+Remote-host sessions get neither the directory nor the skill (neither in the+runtime nor in the `/` menu or a send-time `/skill:` mention): their tools write+on the remote machine, which Electron Main cannot read. The card's "unavailable"+state is only a fallback for older messages.### Serving (Electron Main)@@ -152,8 +156,11 @@ visualization cannot replace itself with a remote page outside its own CSP.### Rendering (renderer)1. The assistant message bubble splits references out of the message content- before Markdown rendering and renders one card per reference. The shared- Markdown component is unchanged, so plugin READMEs, file previews, and tool+ before Markdown rendering and renders one card per reference. With+ `AppSettings.inlineVisualizations` off it still strips the reference lines —+ a historical reply must not show its absolute path as text — but produces no+ card, so nothing is read from disk or framed. The shared Markdown component+ is unchanged, so plugin READMEs, file previews, and toolrows never show cards.2. The card is `<iframe sandbox="allow-scripts" loading="lazy">` without`allow-same-origin`; the guest has an opaque origin and cannot reach thediff --git a/docs/project/unreleased.md b/docs/project/unreleased.mdindex f42d16428..6fb917215 100644--- a/docs/project/unreleased.md+++ b/docs/project/unreleased.md@@ -8,9 +8,14 @@get a builtin `visualize` skill; the model writes an HTML fragment to thesession's visualization directory and references it with a `::visualize`line, which the transcript shows as a sandboxed, theme-aware card with an- expanded view. Visualization writes and cleanup reject redirected roots;- document responses enforce an opaque sandbox, inline and expanded frames- share a bounded pool, and forks retain their cards after data relocation.+ expanded view. The feature is opt-in behind Settings → AI → Inline+ visualizations (`AppSettings.inlineVisualizations`, off by default): while it+ is off the prompt advertises no directory, the skill is withheld from the+ catalog, `/` menu, and `Skill` tool, and existing reference lines are hidden+ without loading a card. Visualization writes and cleanup reject redirected+ roots; document responses enforce an opaque sandbox, inline and expanded+ frames share a bounded pool, and forks retain their cards after data+ relocation.- Keep each session's side-panel browser available while the panel is collapsed,another conversation or Settings is visible, or the renderer reloads. Browseractions stay on their connected page without stealing focus. Hidden pages usediff --git a/docs/spec/03-runtime/03-tools-and-permissions.md b/docs/spec/03-runtime/03-tools-and-permissions.mdindex 7c33922f9..9eeafbec2 100644--- a/docs/spec/03-runtime/03-tools-and-permissions.md+++ b/docs/spec/03-runtime/03-tools-and-permissions.md@@ -298,8 +298,12 @@ visualization lives as long as its session:<data_dir>/visualizations/<sessionId>/```-- **Availability.** Local sessions only. A remote-workspace session gets no- directory, no prompt line, and no `pi-desktop/visualize` skill.+- **Availability.** Local sessions only, and opt-in through+ `AppSettings.inlineVisualizations` (absent and `false` mean off). While it is+ off there is no directory, no prompt line, no `pi-desktop/visualize` skill in+ the catalog, `/` menu, or `Skill` tool, and the renderer strips reference+ lines without loading a card. A remote-workspace session gets none of it+ either.- **Addressing.** Absolute paths only; the path is advertised in the systemprompt next to the scratch directory. Relative paths never resolve here.- **Containment.** Scratch and visualization roots are checked before thediff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 79d47e03f..d7cbfb81c 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -18658,10 +18658,13 @@ host-created files. The full app's file-preview viewer is covered separately.### E2E-GENUI-inline-visualization-card: a visualization renders inline and stays sandboxed-- **Preconditions**: The app is running with a local Agent session and the- builtin `pi-desktop/visualize` skill enabled. A second session uses a remote+- **Preconditions**: The app is running with a local Agent session, Settings →+ AI → Inline visualizations switched on, and the builtin+ `pi-desktop/visualize` skill enabled. A second session uses a remoteworkspace.-- **Steps**: 1) Ask for an interactive chart (for example "show a slider that+- **Steps**: 0) With the switch off (the default), ask for a chart and confirm+ no directory, skill, or card appears; then switch it on. 1) Ask for an+ interactive chart (for example "show a slider thatchanges a sine wave's frequency"). 2) Wait for the turn to finish, then dragthe slider. 3) Switch the app theme between light and dark. 4) Press thecard's expand button, then Esc. 5) Ask the model to write a non-`.html` filediff --git a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.mdindex 131cea39c..ab5b12b3c 100644--- a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md+++ b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md@@ -229,8 +229,10 @@ Electron 主要低于 `<data_dir>/scratch/<sessionId>/pasted/` 之前的<data_dir>/visualizations/<sessionId>/```-- **可用范围。** 仅本地会话。远程工作区会话没有该目录、没有提示行,也没有- `pi-desktop/visualize` skill。+- **可用范围。** 仅本地会话,且默认关闭:需要用户开启设置项+ `AppSettings.inlineVisualizations`(缺省与 `false` 都表示关闭)。关闭时没有该目录、+ 没有提示行,技能目录、`/` 菜单和 `Skill` 工具都不提供 `pi-desktop/visualize`,+ 渲染层只隐藏引用行、不加载卡片。远程工作区会话同样没有这些内容。- **寻址。** 只接受绝对路径;路径在系统提示中与 scratch 目录一起给出。相对路径永远不会解析到这里。- **包含校验。** `resolve_tool_path` 依次检查工作区、scratch、可视化三个根目录,diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex c1844caf9..e85aa2dc5 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -1458,6 +1458,8 @@ sklm: {"infiniteProviderRetryDesc": "Netzwerk- und vorübergehende Anbieterfehler werden bis zum Erfolg wiederholt. Du kannst den Lauf weiterhin stoppen; der API-Verbrauch kann fortlaufen.","smoothStreaming": "Sanftes Streaming","smoothStreamingDesc": "Gibt gestreamten Text zeichenweise aus, um einen Schreibmaschineneffekt zu erzeugen. Wird automatisch deaktiviert, wenn das System reduzierte Bewegung bevorzugt.",+ "inlineVisualizations": "Inline-Visualisierungen",+ "inlineVisualizationsDesc": "Zeigt die interaktiven HTML-Karten, die der Agent in das Visualisierungsverzeichnis der Sitzung schreibt. Standardmäßig aus: Der Prompt nennt kein Visualisierungsverzeichnis, der visualize-Skill wird zurückgehalten und vorhandene Referenzzeilen bleiben ausgeblendet.","preventScreenSleep": "Bildschirmsperre verhindern","preventScreenSleepDesc": "Hält das Display wach, solange die App läuft. Nutzt plattformübergreifend die System-Energieverwaltung.","windowTranslucency": "Transparentes Fenster",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex 3ecab7a64..7c4dac53b 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -1472,6 +1472,8 @@ sklm: {infiniteProviderRetryDesc: "Keep retrying network and transient provider failures until the request succeeds. You can still stop the turn; API usage may continue while enabled.",smoothStreaming: "Smooth streaming",smoothStreamingDesc: "Release streamed text character by character for a typewriter effect. Automatically disabled when the system prefers reduced motion.",+ inlineVisualizations: "Inline visualizations",+ inlineVisualizationsDesc: "Show the interactive HTML cards the agent writes into the session's visualization directory. Off by default: the prompt advertises no visualization directory, the visualize skill is withheld, and existing reference lines stay hidden.",preventScreenSleep: "Prevent screen sleep",preventScreenSleepDesc: "Keep the display awake while the app is running. Uses system power management APIs on all platforms.",windowTranslucency: "Translucent window",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 388a60a12..93504ab9f 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -1458,6 +1458,8 @@ sklm: {"infiniteProviderRetryDesc": "Reintenta los errores de red y temporales hasta que la solicitud tenga éxito. Puedes detener el turno; el uso de la API puede continuar.","smoothStreaming": "Transmisión suave","smoothStreamingDesc": "Libera el texto transmitido carácter por carácter para un efecto de máquina de escribir. Se desactiva automáticamente cuando el sistema prefiere movimiento reducido.",+ "inlineVisualizations": "Visualizaciones en línea",+ "inlineVisualizationsDesc": "Muestra las tarjetas HTML interactivas que el agente escribe en el directorio de visualizaciones de la sesión. Desactivado por defecto: el prompt no anuncia ningún directorio de visualizaciones, la habilidad visualize no se ofrece y las líneas de referencia existentes quedan ocultas.","preventScreenSleep": "Evitar suspensión de pantalla","preventScreenSleepDesc": "Mantiene la pantalla encendida mientras la aplicación está en ejecución. Usa las API de gestión de energía del sistema en todas las plataformas.","windowTranslucency": "Ventana translúcida",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex dacb6a77c..1fd1a173c 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -1458,6 +1458,8 @@ sklm: {"infiniteProviderRetryDesc": "Réessaie les erreurs réseau et temporaires jusqu’à la réussite. Vous pouvez toujours arrêter le tour ; la consommation d’API peut continuer.","smoothStreaming": "Streaming fluide","smoothStreamingDesc": "Libère le texte diffusé caractère par caractère pour un effet machine à écrire. Automatiquement désactivé lorsque le système préfère un mouvement réduit.",+ "inlineVisualizations": "Visualisations intégrées",+ "inlineVisualizationsDesc": "Affiche les cartes HTML interactives que l'agent écrit dans le répertoire de visualisations de la session. Désactivé par défaut : le prompt n'annonce aucun répertoire de visualisations, la compétence visualize est retirée et les lignes de référence existantes restent masquées.","preventScreenSleep": "Empêcher la mise en veille","preventScreenSleepDesc": "Garde l'écran allumé tant que l'application est ouverte. Utilise les API de gestion d'énergie du système sur toutes les plateformes.","windowTranslucency": "Fenêtre translucide",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex f64466b61..941d06a72 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -1468,6 +1468,8 @@ sklm: {infiniteProviderRetryDesc: "네트워크 및 일시적인 제공자 오류가 성공할 때까지 계속 재시도됩니다. 언제든 중지할 수 있지만 API 사용량이 계속 발생할 수 있습니다.",smoothStreaming: "부드러운 스트리밍",smoothStreamingDesc: "스트리밍 텍스트를 한 글자씩 타자기 효과로 표시합니다. 시스템에서 동작 줄이기를 선호하면 자동으로 비활성화됩니다.",+ inlineVisualizations: "인라인 시각화",+ inlineVisualizationsDesc: "에이전트가 세션 시각화 디렉터리에 작성한 대화형 HTML 카드를 대화에 표시합니다. 기본적으로 꺼져 있습니다: 프롬프트에 시각화 디렉터리를 제공하지 않고 visualize 스킬을 숨기며 기존 참조 줄도 표시하지 않습니다.",preventScreenSleep: "화면 절전 방지",preventScreenSleepDesc: "앱이 실행되는 동안 화면이 꺼지지 않도록 합니다. 모든 플랫폼에서 시스템 전원 관리 API를 사용합니다.",windowTranslucency: "반투명 창",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex 86fa6fa98..e08eb747b 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -1431,6 +1431,8 @@ export const ptBR = {infiniteProviderRetryDesc: "Continua tentando indefinidamente em caso de falhas temporárias de rede ou do provedor. Ainda é possível interromper a rodada; enquanto esta opção estiver ativada, o consumo e os custos da API podem continuar.",smoothStreaming: "Exibição gradual",smoothStreamingDesc: "Exibe o texto recebido caractere por caractere, criando um efeito de máquina de escrever. É desativada automaticamente quando o sistema está configurado para reduzir animações.",+ inlineVisualizations: "Visualizações embutidas",+ inlineVisualizationsDesc: "Mostra os cartões HTML interativos que o agente escreve no diretório de visualizações da sessão. Desativado por padrão: o prompt não anuncia diretório de visualizações, a habilidade visualize fica oculta e as linhas de referência existentes permanecem escondidas.",preventScreenSleep: "Impedir suspensão da tela",preventScreenSleepDesc: "Mantém a tela ligada enquanto o app está em execução. Usa as APIs de gerenciamento de energia do sistema em todas as plataformas.",windowTranslucency: "Janela translúcida",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex fe3ec06c5..974628e3a 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -1462,6 +1462,8 @@ sklm: {infiniteProviderRetryDesc: "Ağ ve geçici sağlayıcı hataları istek başarılı olana kadar yeniden denenir. Çalışmayı yine durdurabilirsiniz; açıkken API kullanımı sürebilir.",smoothStreaming: "Düzgün akış",smoothStreamingDesc: "Akan metni daktilo efekti için karakter karakter gösterir. Sistem hareket azaltmayı tercih ettiğinde otomatik devre dışı kalır.",+ inlineVisualizations: "Satır içi görselleştirmeler",+ inlineVisualizationsDesc: "Aracının oturumun görselleştirme dizinine yazdığı etkileşimli HTML kartlarını gösterir. Varsayılan olarak kapalı: istem görselleştirme dizinini bildirmez, visualize becerisi gizlenir ve mevcut referans satırları gösterilmez.",preventScreenSleep: "Ekran uykusunu engelle",preventScreenSleepDesc: "Uygulama çalışırken ekranı açık tutar. Tüm platformlarda sistem güç yönetimi API'lerini kullanır.",windowTranslucency: "Saydam pencere",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex ae859edb4..051fa1d4b 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -1452,6 +1452,8 @@ sklm: {infiniteProviderRetryDesc: "网络或临时服务故障会一直重试直到成功。仍可随时停止,但开启后可能持续消耗 API 用量。",smoothStreaming: "平滑流式显示",smoothStreamingDesc: "将流式文本逐字释放,产生打字机效果。系统开启“减少动态效果”时自动禁用。",+ inlineVisualizations: "聊天内嵌可视化",+ inlineVisualizationsDesc: "在对话中显示智能体写入会话可视化目录的交互式 HTML 卡片。默认关闭:不向模型提供可视化目录,同时隐藏 visualize 技能,历史引用行也不再显示。",preventScreenSleep: "阻止屏幕休眠",preventScreenSleepDesc: "应用运行时保持屏幕常亮,跨平台使用系统电源管理接口。",windowTranslucency: "窗口透明效果",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex 9bef326f9..0fb614546 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -1452,6 +1452,8 @@ sklm: {infiniteProviderRetryDesc: "網路或暫時性服務故障會持續重試直到成功。仍可隨時停止,但開啟後可能持續消耗 API 用量。",smoothStreaming: "平滑串流顯示",smoothStreamingDesc: "將串流文字逐字釋放,產生打字機效果。系統開啟「減少動態效果」時自動停用。",+ inlineVisualizations: "聊天內嵌視覺化",+ inlineVisualizationsDesc: "在對話中顯示智慧代理寫入工作階段視覺化目錄的互動式 HTML 卡片。預設停用:不向模型提供視覺化目錄,同時隱藏 visualize 技能,歷史引用行也不再顯示。",preventScreenSleep: "防止螢幕休眠",preventScreenSleepDesc: "應用程式執行時保持螢幕常亮,跨平台使用系統電源管理介面。",windowTranslucency: "視窗透明效果",diff --git a/packages/shared/src/types/settings.ts b/packages/shared/src/types/settings.tsindex fbb7c1b27..be644eee2 100644--- a/packages/shared/src/types/settings.ts+++ b/packages/shared/src/types/settings.ts@@ -192,6 +192,16 @@ export type AppSettings = {* disabled when the system prefers reduced motion.*/smoothStreaming?: boolean;+ /**+ * Render inline interactive visualizations in the transcript (ADR+ * `gen-ui-inline-visualization`). Absent and false keep the feature off: the+ * system prompt carries no visualization directory, the+ * `pi-desktop/visualize` skill is withheld from the catalog and the `/` menu,+ * and an existing `::visualize` reference line is hidden without loading a+ * card. `true` opts in for local sessions; remote-host sessions stay without+ * it because their tools write on the remote machine.+ */+ inlineVisualizations?: boolean;/*** Prevent the display from sleeping while the app is running. Uses* Electron's `powerSaveBlocker` with `prevent-display-sleep` on all