Introduction¶
In the DeepSeek Harness (DSH) chat interface, AI-generated long documents can easily flood the screen. Modifying a single paragraph often requires resending the entire text, and version tracking within the dialogue history is difficult. collab-canvas offers a solution: it decouples long-form content from the conversation and hosts it on an independent Markdown document canvas. You edit directly within the browser, while the AI reads and writes via 9 specialized tools. Both user and AI operations are recorded in the undo history and support conflict detection.
Core Features¶
- In-Browser Editing: The canvas renders and edits within the DSH interface, with changes auto-saved.
- AI Read/Write Capability: The AI operates the canvas directly via the
canvas_*tool series, rather than pasting content into the conversation. - Undo History: Every write operation is pushed to the stack, allowing both human and AI changes to be rolled back.
- Conflict Detection:
canvas_writesupportsbaseVersionstrong consistency checks and returnsE_CONFLICTif content is overwritten. - File Persistence: The canvas is stored as a standard Markdown file, with metadata recorded in
.canvases.json. - Text Selection Quoting: Selecting text on the canvas pops up a reference bar, allowing the paragraph to be brought into the conversation.
- Document Linking/Drag-and-Drop: Supports dragging documents into the canvas or generating links.
- Configurable Storage Root: The canvas root directory can be pinned to any location via
canvas_configure. - Theme Following: The interface uses
var(--dsw-*)design tokens, automatically adapting to theme skinning.
Installation and Activation¶
The installation command is as follows:
dsh plugin --profile web add collab-canvas
Once installation is complete, two configuration steps are required to enable the plugin:
- In the profile’s
package.json, add"collab-canvas"to thedsh.profile.bundlesarray. - Ensure the
dependenciesfield also includes the package.
Note: Adding only to dependencies without adding to bundles will result in cordis.patch.yml not taking effect, manifesting as “installed but functionality missing.” Using npm installation is recommended to avoid build authorization issues triggered by git dependencies and to enable market download statistics.
AI Tools¶
The plugin provides 9 tools for managing the canvas:
canvas_list: Lists all canvases and the current active canvas.canvas_create: Creates a new canvas.canvas_read: Reads canvas content (theheadparameter can truncate the first N characters).canvas_write: Writes or modifies the canvas (supportsreplace/append/prependandbaseVersion).canvas_save: Saves the canvas to a specified file path.canvas_load: Loads an existing Markdown file as a canvas.canvas_locate: Precisely locates a segment of original text within a document (handles duplicate text).canvas_delete: Deletes a canvas record.canvas_configure: Pins the canvas storage root directory.
Data Storage and Architecture¶
Canvas files and metadata are stored in the specified Storage Root directory:
<Storage Root>/
├── .canvases.json # Canvas metadata (id, title, associated file, version)
├── <title>.md # Canvas body text
├── .sessions/ # Session-level manifest
└── attachments/ # Pasted/dragged images
The default storage root is the current session workspace. The architecture consists of two parts:
- Host (DSH Node process): Runs at
dist/host.js, responsible for registering tools, HTTP endpoints, state persistence, and the editor script. - Client (Browser page): Runs at
lib/client.js, responsible for injecting UI, the text selection bar, and RPC communication with the Host.
Development and Deployment¶
Development involves building and transferring files to the DSH deployment directory:
npm run build # Compile src/host/*.js → dist/host.js
npm run deploy # Transfer to deployment directory
npm run verify # Pre-launch comprehensive check
The deployment directory is derived from DSH_HOME by default and can be overridden via the environment variable CCV_DEPLOY_DIR.
Activation Rules:
- Modified src/host/*.js → After transferring, a full restart of dsh web is required (refreshing the page is insufficient).
- Modified only the client → After transferring, simply refresh the page.
Use Cases¶
Suitable for scenarios where AI collaborative content needs to be沉淀 (accumulated/sunk) into documents, versioned, or collaboratively edited by multiple parties (human + AI). Please review the source code and license before use.
Summary¶
collab-canvas solves the problem of managing long documents within DSH, allowing the AI to safely read and write Markdown documents through a tool-based interface. Mastering its installation, configuration, and deployment rules is a prerequisite for efficiently utilizing this plugin.