Introduction¶
The DSH philosophy is “Everything is a plugin.” When dealing with spatial layouts, layout design, or data segmentation, models sometimes cannot describe boundaries solely based on text. An interactive canvas popping up in the browser is needed to allow users to participate directly in drawing, while standardizing the results to transmit back to the model.
Plugin Overview¶
- Name:
dsh-partition-board - Owner: gst20060726
- Positioning: A DSH plugin autonomously invoked by the AI when it determines the need to confirm “how to partition” with a human. It pops up a canvas in the browser.
- Core Value: Through color palettes, drawing tools, and constraint annotations, it transforms vague layout requirements into precise vector partitions and feeds them back to the AI for subsequent interpretation.
Installation and Activation¶
To install this plugin in a local environment, you need to perform a directory junction and declare dependencies in the configuration file.
# 1) Directory Junction (Equivalent to the link created by `dsh plugin --profile web add link:<dir>`)
New-Item -ItemType Junction `
-Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-partition-board" `
-Target "$env:USERPROFILE\.dsh\plugins\dsh-partition-board"
# 2) Add two entries in ~/.dsh/profiles/web/package.json:
# dependencies: "dsh-partition-board": "link:C:/Users/<you>/.dsh/plugins/dsh-partition-board"
# dsh.profile.bundles: Append "dsh-partition-board"
# 3) Verify installation (Optional)
cd "$env:USERPROFILE\.dsh\plugins\dsh-partition-board"
npm test # 72 items: 35 pure functions + 37 headless rendering
npm run verify # 8 installation-time contract self-checks
Core Functionality¶
The canvas provides the following interactive capabilities:
- Color Palette and Annotation: Provides color palette controls to annotate “Color ↔ Meaning” (e.g., Red = Main Area, Blue = Sidebar). The colors themselves are meaningless; the legend carries the semantics.
- Drawing Tools: Supports four drawing modes: Rectangle, Lasso, Soft Brush, and Eraser. The boundary feathering (blurred partitions) for each partition can be adjusted.
- Draw and Annotate: Constraints that cannot be expressed clearly with graphics (e.g., “this area needs to view two cards side-by-side”) can be written directly in the right panel and sent back to the AI along with the message.
- Zoom and Pan:
Ctrl/⌘+ Wheel: Zoom with the cursor as the anchor point (1–8x). The normal scroll wheel still scrolls the page.- Hand Tool Drag: Pan the canvas.
0Key: Reset view.- Decorative line widths, font sizes, and label thresholds are all counteracted by zoom, ensuring they do not become blurry when zoomed in.
- AI-Assisted Completion: Unannotated and small partitions are completed by the AI. The proposal is overlaid with dashed lines, and the user can confirm or rework it.
- Result Transmission: The complete confirmed plan (Legend + Geometry + Feathering Degree + Grid Matrix) is sent back to the AI, which interprets it according to
purposeand advances the project.
Collaboration Flow¶
The plugin adopts message-based communication, and tool calls are non-blocking.
- Tool Invocation: The model calls
partition_board({purpose, legend, ...}), and the canvas pops up immediately. - User Operation: The user annotates, draws, adjusts feathering, or writes descriptions on the canvas.
- Message Transmission: User operations are sent to the host via
conversation.send("[partition-board] {...}"). - Model Processing:
- Receives
kind = plan-requestorrework: Uses the sameboardId,revision+1,mode="review", and calls the tool again to display the proposal. - Receives
kind = confirmed: Obtains theplan, interprets it according topurpose, and advances the project.
- Receives
Technical Details & Boundaries¶
- Storage Mechanism: Canvas state is stored in
localStorage(keydsh.partitionBoard.v1:<sessionId>:<boardId>). It will be lost if switching browsers or clearing cache; the canvas is available in private mode but does not persist across refreshes. - Stateless Host: There is no host-side canvas storage; this is intentional (for security/authentication reasons). The source of truth for the plan is the conversation itself.
- Grid Encoding: The grid has 32 columns, and
grid.cellsuses base36 single-character encoding. - Payload Budget: The total number of vector points is capped at 600; partitions will not be dropped due to exceeding the budget.
- Accessibility Support: The canvas is
role="application", supportingaria-labelandaria-describedby(status bar). - Bilingual Interface: Interface text switches based on
navigator.language(Has signal but not Chinese → English; No signal at all → Chinese). - Known Missing Features: Touch screen pinch-to-zoom/rotate, partition boolean operations, partition sorting, and layer adjustment.
Conclusion¶
The plugin solves the problem of AI being unable to precisely define boundaries when handling spatial layouts by utilizing a canvas popping up in the browser. Users can directly participate in drawing and constraint annotation. Combined with the AI’s auto-completion feature, a consensus can be reached quickly. The confirmed plan is transmitted back to the model as a standardized payload, driving the project forward.