dsh-ppt-canvas: Modifying Real .pptx Files Using Natural Language in DSH

Introduction

When handling presentation-related tasks in DeepSeek Harness (DSH), the common practice is to have the model “describe how to change” or generate replacement content, which humans then manually implement in PowerPoint. As selections, font sizes, alignment, and hierarchy increase, it becomes difficult to clarify context in conversation, and the modifications do not affect the actual file on disk.

dsh-ppt-canvas turns “Select / Box-select → Issue command → Modify only the selection” into a DSH client plugin: The canvas renders according to .pptx geometry and styles. AI reads the selection via Host-side tools and sends OOXML patches to write directly back to the .pptx you have open, with support for undo and redo. Inspired by the PPT capabilities in Tencent WorkBuddy’s “Human-Machine Dual Write,” this plugin emphasizes modifying the real .pptx rather than just intermediate artifacts on the interface.

What is this

  • Name: dsh-ppt-canvas (Repository hg1048596-pixel/dsh-ppt-canvas)
  • Maintainer: hg1048596-pixel
  • Category: Client (DSH sidebar canvas + Host read/write engine)
  • License: MIT (see repository package.json)
  • Positioning: A PowerPoint canvas for DeepSeek Harness—select shapes or entire pages, describe changes in natural language, and AI writes to the .pptx with byte-fidelity OOXML patches, featuring undo/redo and complete error handling.

Community Directory Page: SkillHub Plugin Entry. The directory is an independent ecosystem site and has no official affiliation with DeepSeek or HiLink (Huanfang).

Core Features

Canvas and Selection

  • Renders based on real .pptx geometry/styles: Text boxes, color blocks (rounded/outline/gradient), images (including cropping), lines, tables, and groups.
  • Click to Select: 2px primary color outline and four corner handles; dashed preview on hover.
  • Marquee Selection: Drag on empty space to select all elements intersecting with the selection box.
  • Multi-select: Shift / Ctrl + Click to add/remove; the properties panel supports batch alignment (left/right/center/top/bottom/horizontal spacing, etc.).
  • Select Whole Page: Click “Whole Page” at the top-left of the thumbnail to select all elements on that slide at once.
  • Open File: Drag a .pptx to the panel, use system file selection, or use the built-in demo presentation (copied to ~/.dsh/ppt-canvas/). The plugin reads and writes the file at this path directly and automatically backs it up before modification.

The interface is a draggable, resizable floating window. Position and size are stored in localStorage; it is minimized by default on startup, retaining only the “PPT Canvas” entry at the bottom right to avoid obstructing the main interface.

AI Collaboration and Sync

  • Bottom command box: Enter to send, Shift+Enter for new line; “Add to Outbox” allows merging multiple entries before sending.
  • Selection context (position, size, style, z-order, text) is sent to AI with the command; no need for screenshots or repeating the full text.
  • Model-side tools: ppt_canvas_open, ppt_canvas_context, ppt_canvas_apply, ppt_canvas_history.
  • Process Overview: The client first POSTs the selection to the Host to get a requestId. AI retrieves it using ppt_canvas_context(requestId); after generating ops, ppt_canvas_apply writes them to disk; complex schemes can use dryRun first.
  • After a successful write, the canvas refreshes based on the new rev; recently modified elements are highlighted for about 3 seconds; the panel polls rev approximately every 4 seconds.
  • Undo / Redo: The Host creates a byte-level snapshot before every disk write; Ctrl+Z / Ctrl+Shift+Z, up to 50 steps.
  • Right-side “Conversation Broadcast” displays the current session (You / AI), with reasoning minimized as annotations.
  • If PPT-related expressions appear in the conversation and the canvas is not open, a “Open Canvas” prompt may pop up (commands sent by the plugin itself do not trigger this).

Patch Capabilities (AI-available ops)

op Function
setText Replace full text (preserving run styles)
setTextStyle Color, font size, bold, italic, underline, alignment, font
setFill / setLine Fill color or clear; outline color, line width, line style
setGeometry / move / resize Absolute or relative position and size, rotation
align Alignment and distribution
setZ / bringToFront / sendToBack Z-order / Hierarchy
duplicate / remove Copy / Delete

The unit convention is px (96 DPI), 1px = 9525 EMU; for the complete contract, see docs/CONTRACT.md in the repository.

Architecture Highlights

  • Host is the Sole Authority: The disk .pptx and rev are determined by the Host; if validation fails, the whole package is rejected, and the file remains untouched.
  • Edits are patched onto the original OOXML tree; untouched pages are kept byte-identical as much as possible; undo stores full bytes rather than diffs.
  • HTTP: Prefers independent loopback 127.0.0.1:19488 (increments if occupied), falls back to host route /dsh ppt/api on failure.
  • The engine has zero npm dependencies; ZIP / XML / PPTX reading and writing are self-developed, using only node: built-in modules.
  • Precise canvas rendering depends on local LibreOffice (some rendering-related tests will be skipped if not installed).

The current version does not include a standalone Electron desktop window; related code is archived in archive/standalone-window/.

Installation and Activation

The plugin is installed into the profile via link. The README recommends using the script in the repository (to avoid conflicts between dsh plugin add and pnpm store paths in some environments):

node tools/install-profile.mjs   profile desktop

The script creates a junction pointing to this repository under ~/.dsh/profiles/<profile>/node_modules and writes the package name into the profile package.json’s dsh.profile.bundles.

Uninstall:

node tools/install-profile.mjs   profile desktop   uninstall

Restart DSH after installation (new loader lines require a reboot). Expected effects:

  • ▦ PPT Canvas appears at the bottom of the sidebar;
  • AI can use the four ppt_canvas_* tools mentioned above in conversations.

Verification (Host routes may return 404 if not restarted):

curl.exe -s http://127.0.0.1:19387/dsh ppt/api/selftest
curl.exe -s -o NUL -w "%{http_code}" http://127.0.0.1:19387/plugins/dsh-ppt-canvas/client.js
node tests/host-load.test.mjs

During development, after modifying source code related to plugin/client.js, you can sync the build artifacts:

node tools/sync-plugin.mjs

Security & Permissions: The plugin reads and writes the .pptx paths you specify under the DSH process permissions; please read the source code and MIT license before installation, and back up important presentations yourself first.

Typical Usage

  1. Click the sidebar ▦ PPT Canvas (or the bottom-right “PPT Canvas” launcher) to open the panel.
  2. Drag and drop or “Open” to select a .pptx (the plugin modifies this file directly).
  3. Click, marquee select, or use “Whole Page” to determine the selection.
  4. Enter requirements in the command box and press Enter, for example:
    - Change the title to red and right-align it
    - Unify these three color blocks to brand blue #1A73E8 with 8px rounded corners
    - Reduce this line of text to 14px and center it
    - Move this image 40px to the right and bring to front
    - Left-align and horizontally distribute the two selected text boxes
  5. Observe canvas refresh and highlighting; press Ctrl+Z if unsatisfied.

You can also say “Open D:\work\deck.pptx” in the conversation, and AI will call ppt_canvas_open.

Use Cases and Notes

Suitable for: Users already using DSH for agents or long conversations who need local AI modifications (copy, styles, layout, hierarchy) on real slides and want to visualize selections and undo within the same window.

Notes:

  • Modifications act on the file path you opened. Although there are undo and pre-write backups, backing up important decks first is still recommended.
  • Restarting DSH is required to complete Host-side loading; the loopback channel can improve availability in restricted hosts.
  • Rendering and some tests depend on LibreOffice; core read/write and APIs remain available without LibreOffice, but precise preview may be limited.
  • The standalone desktop window feature has been removed; do not rely on window entries in historical documentation.

Repository test entry: node tools/test-all.mjs (README records a total of 137 test cases across current suites).

Conclusion

dsh-ppt-canvas connects “Visual Selection + Natural Language + Byte-Fidelity Disk Writing” to the DSH client: The Host manages the authoritative .pptx and history, the model writes to disk via ppt_canvas_context / ppt_canvas_apply, and the human stays on the canvas to review and undo.

  • Directory Page: https://www.skillhub.cn/plugins/hg1048596-pixel/dsh-ppt-canvas
  • Source Code & Docs: https://github.com/hg1048596-pixel/dsh-ppt-canvas
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye