dsh-show-picture ๐ผ๏ธ
August 19, 2026 ยท View on GitHub
A DeepSeek Harness (DSH) Cordis plugin that lets the agent display images directly inside the conversation. ไธไธช่ฎฉ Agent ็ดๆฅๅจๅฏน่ฏไธญๅฑ็คบๅพ็็ DSH๏ผDeepSeek Harness๏ผCordis ๆไปถใ
โจ What it does / ๅ่ฝ
Give the agent one new model tool, show_picture, and render its result as an image card right in the chat:
show_picture({ path: "/workspace/chart.png" }) โ ๐ผ๏ธ chart.png appears in the conversation
show_picture({ url: "https://example.com/photo.webp", alt: "a photo" }) โ ๐ผ๏ธ photo appears
- Local files โ read through the Host
fsservice, delivered to the browser as a base64 data URL (no separate file server needed). - Remote URLs โ passed straight through to an
<img>tag. - No downloads, no "see the file at โฆ" โ the user sees the picture inside the chat flow.
๐งฉ How it works / ๅทฅไฝๅ็
| Half | Role |
|---|---|
Host (plugin/host.js) | Registers the show_picture tool via harness.defineTool + harness.registerTool, and a package-private RPC show-picture.read that resolves the file (fs.resolve), checks it is a regular file (fs.stat), reads up to 10 MiB (fs.readBytes), maps the extension to a MIME type, and base64-encodes the bytes (plain-JS encoder โ the sandbox btoa is UTF-8 only). |
Client (plugin/client.js) | Registers the tool.call.toolview card keyed show_picture. The card parses the tool-call arguments and renders <img src="data:โฆ"> (path) or <img src="url"> (url), plus an optional caption from alt. |
โโโโโโโโโโโโโโโโ Host (Node) โโโโโโโโโโโโโโโโ โโโโโโโโโโโ Client (browser) โโโโโโโโโโโ
โ show_picture tool (global, every session) โ โ tool.call.toolview [show_picture] โ
โ fs.resolve / stat โ โ โโ path โ <img src="/dsh-show- โ
โ result: {ok, kind, path, size, mime} โ โ โ picture/<encoded path>"> โ
โ โ โ โโ url โ <img src={url}> โ
โ webServer route /dsh-show-picture/* โโโโโโโผโโโโโโโผโโ browser fetches the route โ
โ fs.readBytes โ bytes + content-type โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฆ Install / ๅฎ่ฃ
A. Global static plugin (recommended โ every session, survives restarts)
Install into the web profile as a bundle so every session (including non-creation mode) gets the tool automatically, even after restarting DSH:
cd "$DSH_HOME/profiles/web" # DSH_HOME defaults to ~/.dsh
pnpm add file:/path/to/dsh-show-picture
# then add "dsh-show-picture" to the "dsh.profile.bundles" array in package.json
dsh --profile web # restart the app
That is exactly how dsh-at-file / dsh-better-status are installed in this deployment. The Host half (lib/index.js) registers the global show_picture tool and a /dsh-show-picture/<encoded-path> HTTP route; the Client half (lib/client.js) is served to the browser as a web module and renders the card.
B. Dynamic Cordis plugin (session-local)
The plugin can also be created in a single session with cordis_define (kind new):
code.hostโ paste the content ofplugin/host.jscode.clientโ paste the content ofplugin/client.js
then activate with cordis_run (mode run). First activation of the Client half asks for user approval in the UI. Dynamic plugins are process-local: they do not survive a DSH restart and belong to the session that created them.
Full step-by-step (including upgrades and rollback) is in docs/INSTALL.md.
๐ Usage / ็จๆณ
The agent calls the tool whenever the user asks to see an image:
| Argument | Type | Required | Meaning |
|---|---|---|---|
path | string | one of | Local image file (absolute or workspace-relative). Extensions: png, jpg/jpeg, gif, webp, svg, bmp, ico, avif, tif/tiff. Max 10 MiB. |
url | string | one of | http(s) URL of the image. |
alt | string | no | Short caption shown under the image. |
Result (canonical JSON): { ok: true, kind: 'path'|'url', path|url, size?, mime?, alt } or { ok: false, error }.
A ready-to-use agent skill is included at skill/dsh-show-picture/SKILL.md โ drop it into a DSH agent preset's skills/ directory (or follow its instructions manually).
โ ๏ธ Limitations / ้ๅถ
- Local files > 10 MiB fail with
FS_TOO_LARGE(compress/resize first, or serve via URL). - Extension-based MIME detection only; unsupported types are rejected, not sniffed.
urlimages must be loadable by the browser (CSP, availability, auth).- The card renders only while the Client half is active and the call goes through the model's tool loop.
๐ Repository layout / ็ฎๅฝ็ปๆ
dsh-show-picture/
โโโ lib/
โ โโโ index.js # Host half (global tool + image HTTP route) โ static install
โ โโโ client.js # Client half (tool card) โ served as a web module
โโโ plugin/
โ โโโ host.js # Host half (tool + RPC) โ paste as code.host (dynamic)
โ โโโ client.js # Client half (tool card) โ paste as code.client (dynamic)
โโโ skill/
โ โโโ dsh-show-picture/
โ โโโ SKILL.md # Agent skill: install, usage, limitations
โโโ docs/
โ โโโ INSTALL.md # Step-by-step install / update / rollback
โโโ cordis.patch.yml # Bundle patch: inserts the dsh-show-picture row
โโโ dsh.plugin.json # Plugin metadata (entry + client platform)
โโโ package.json
โโโ LICENSE
๐ License / ่ฎธๅฏ่ฏ
MIT ยฉ 2026 dsh-show-picture contributors