The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): desktop-only repos cannot pose as a package; media paragraphs nest cleanly
Teknium7c4e7e55178b
diff --git a/apps/desktop/electron/desktop-plugin-install.ts b/apps/desktop/electron/desktop-plugin-install.tsindex defdb3ec679..e4adc58dfc8 100644--- a/apps/desktop/electron/desktop-plugin-install.ts+++ b/apps/desktop/electron/desktop-plugin-install.ts@@ -10,7 +10,12 @@ import fsp from 'node:fs/promises'import os from 'node:os'import path from 'node:path'-import { PACKAGE_MARKER, publishDesktopTree, withDesktopPluginsRoot, writeDesktopHalfMarker } from './desktop-plugins-root'+import {+ PACKAGE_MARKER,+ publishDesktopTree,+ withDesktopPluginsRoot,+ writeDesktopHalfMarker+} from './desktop-plugins-root'import { execGit, hiddenGitSpawnSpec } from './no-console-git'const GITHUB_BROWSER_SEGMENTS = new Set(['tree', 'blob', 'commit'])diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.tsxindex fec68d220b7..307f29ab4e6 100644--- a/apps/desktop/src/components/assistant-ui/markdown-text.tsx+++ b/apps/desktop/src/components/assistant-ui/markdown-text.tsx@@ -620,7 +620,7 @@ function MarkdownParagraph({if (blockMedia) {return (- <div className={paragraphClass} data-tool-media-paragraph="">+ <div className={paragraphClass} data-tool-media-paragraph="" {...(props as ComponentProps<'div'>)}>{children}</div>)@@ -633,11 +633,21 @@ function MarkdownParagraph({)}+// Every link `MarkdownLink` may hand to a `ToolMediaSlot` (a `MEDIA:` href or a+// bare file path), at any depth (`**[model](/out/a.glb)**`).function holdsMediaLink(children: ReactNode): boolean {- return Children.toArray(children).some(- child =>- isValidElement<{ href?: unknown }>(child) && mediaPathFromMarkdownHref(String(child.props.href ?? '')) !== null- )+ return Children.toArray(children).some(child => {+ if (!isValidElement<{ children?: ReactNode; href?: unknown }>(child)) {+ return false+ }++ const href = typeof child.props.href === 'string' ? child.props.href : ''++ return (+ (href !== '' && (mediaPathFromMarkdownHref(href) !== null || (!href.startsWith('#') && isFileMediaPath(href)))) ||+ holdsMediaLink(child.props.children)+ )+ })}function MarkdownTextSurface({diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.cssindex 60168c47c86..c7cba78cea9 100644--- a/apps/desktop/src/styles.css+++ b/apps/desktop/src/styles.css@@ -1802,7 +1802,7 @@ body.guest-pointer-lock :is(webview, iframe) {text-left. direction is never set, so chrome/layout/list-indent stay LTR (theissue asks not to flip the whole UI). Covers assistant prose, user lines, andboth composers (main + edit share composer-rich-input). */-[data-slot='aui_assistant-message-content'] .aui-md :where(p, h1, h2, h3, h4, h5, h6, li, blockquote),+[data-slot='aui_assistant-message-content'] .aui-md :where(p, [data-tool-media-paragraph], h1, h2, h3, h4, h5, h6, li, blockquote),[data-slot='aui_user-inline-text'],[data-slot='composer-rich-input'] {unicode-bidi: plaintext;@@ -1830,7 +1830,7 @@ body.guest-pointer-lock :is(webview, iframe) {every block takes the chosen direction (every line of a multi-line draftincluded). Auto stamps no dir, so nothing here matches. Code and KaTeX keeptheir isolated-LTR rules below. */-[data-slot='aui_assistant-message-content'] .aui-md[dir] :where(p, h1, h2, h3, h4, h5, h6, li, blockquote),+[data-slot='aui_assistant-message-content'] .aui-md[dir] :where(p, [data-tool-media-paragraph], h1, h2, h3, h4, h5, h6, li, blockquote),[data-slot='aui_user-inline-text'][dir],[data-slot='composer-rich-input'][dir] {unicode-bidi: normal;diff --git a/website/docs/developer-guide/desktop-plugin-sdk.md b/website/docs/developer-guide/desktop-plugin-sdk.mdindex 54f853808fe..42ce5c71bad 100644--- a/website/docs/developer-guide/desktop-plugin-sdk.md+++ b/website/docs/developer-guide/desktop-plugin-sdk.md@@ -1165,8 +1165,8 @@ widget as saved.A unified package (agent tools + a desktop half) can decide how Desktop showsthe media **its own tools** produce. When an assistant reply delivers a file-with a `MEDIA:` line, Desktop looks for the tool call in that turn whose result-produced the path. If the plugin that owns that tool registered a renderer for+with a `MEDIA:` line, Desktop looks for the tool call whose result first named+the path, earlier in the transcript. If the plugin that owns that tool registered a renderer forthe tool's name, your component replaces the built-in player:```javascript@@ -1213,11 +1213,11 @@ function SoundCard({ file, args, result, sessionId, fallback }) {| Prop | What it is ||------|------------|-| `file` | `{ path, name, kind, mime, resolveUrl() }`. `path` is the path on the **backend's** machine exactly as the `MEDIA:` line wrote it; never open it yourself. `resolveUrl()` returns a URL this window can load with a local or a remote backend: a range-streaming route for audio and video, a data URL for anything else (capped by the host's file reader). A large file (a 3D model) is better served by your own `plugin_api.py` route, called with `ctx.rest` and the `path`. |+| `file` | `{ path, name, kind, mime, resolveUrl() }`. `path` is the path on the **backend's** machine exactly as the `MEDIA:` line wrote it; never open it yourself. `resolveUrl()` returns a URL this window can load with a local or a remote backend: a range-streaming route for audio and video, a data URL for anything else (capped by the host's file reader), read from the backend that owns the chat. A large file (a 3D model) is better served by your own `plugin_api.py` route, called with `ctx.rest` and the `path`. || `toolName`, `toolCallId` | The producing call. |-| `args`, `result` | The call's arguments and result payload (the result as the tool returned it: an object, or a string). |+| `args`, `result` | The call's arguments and result payload (the result as the tool returned it: an object, or a string). A reopened chat rebuilds them from history, so read fields defensively: `args` can carry display keys (`context`, labels) and `result` can arrive parsed where it was a JSON string live. || `sessionId` | The chat whose transcript shows the file (same meaning as a directive's `sessionId`), or `null`. |-| `fallback` | The built-in player for this file. Return it for anything you don't draw. |+| `fallback` | The built-in player for this file. Return it (or `null`) for anything you don't draw. |What the host guarantees:@@ -1231,12 +1231,22 @@ What the host guarantees:(`text_to_speech`), another plugin's tool, or from a standalone desktopplugin with no agent half is refused with a console warning.- **Everything else keeps the built-in player:** core voice replies, files- from other tools, user uploads, and any path no tool in that turn produced.- The earliest call whose result names the path is the producer, so a later- `ls` that merely prints it does not count.-- **Fail-safe:** a renderer that throws, a plugin that is disabled, a backend- too old to report ownership, or a tool whose agent half is not loaded all- fall back to the built-in player.+ from other tools, user uploads, and any path no tool produced. The earliest+ successful call whose result names the whole path is the producer, so a+ later `ls`, a read, or a plugin tool that takes the file as input does not+ count, and rewriting a file in place does not move it to another tool. A+ path the user named first (an upload, or an output path typed in the+ prompt) has no producer. A failed call (live, or a stored result carrying+ `error` / `success: false`) never produces anything.+- **Fail-safe:** a renderer that throws or returns `null`, a plugin that is+ disabled, a backend too old to report ownership, or a tool whose agent half+ is not loaded all fall back to the built-in player. An MCP server that has+ not connected yet owns nothing; Desktop re-reads ownership on a bounded+ backoff while a claimed tool has no owner, and after `reload.mcp` or a+ plugin-list change, so the card appears once the server is up.+- **Only this app pairs a desktop half with a package.** The+ `.hermes-package.json` marker is written by the installer and the reconcile+ pass; one shipped inside a desktop-only repository is dropped on install.- **Other surfaces are unchanged.** Tools keep emitting plain `MEDIA:` lines;the CLI, the TUI and messaging platforms deliver the file as before.