The core DSH workflow is determined by the context visible to the model. When a user input or assistant reply contains an error, it is usually necessary to create a new session or correct it through prompt adjustments. The dsh-message-edit plugin provides an “Edit” button on message bubbles, allowing developers to directly edit any message and rewrite the model’s view of the context through DSH’s core surface replace mechanism while preserving append-only logs for auditing.

Core Features

  • Bidirectional editing support: Edit buttons are provided on both user message and assistant reply bubbles.
  • Direct body replacement: The edited text is displayed directly in the bubble and supports Markdown formatting (bold, tables, code blocks, and lists).
  • True context rewriting: The model-visible context is modified using the surfaceOp: { op: "replace" } mechanism, rather than only replacing the display layer.
  • Fork inheritance and repeated editing: When forking a new conversation, the child session automatically inherits the modified context; edited messages have blue buttons and support secondary editing.

Installation

dsh plugin --profile web add github:TwilightSpirit/dsh-message-edit

Usage

  1. Open any session and find the pencil-icon button on a user message or assistant reply bubble.
  2. Click it to open the editor, modify the text, and click “Save Changes”.
  3. The bubble content is replaced directly with the new text; the context the model sees subsequently is also the modified version.
  4. Edited messages show a blue button (indicating “edited”); click it again to continue editing.

Implementation

  • Host side (RPC and surface operations)
    The plugin registers the /message-edit RPC channel. It appends replace events via session.append(type, data, { surfaceOp: { op: "replace", ... } }), locates the target message by messageId or seq, and rewrites the model-visible surface.

  • Client side (render overrides and storage)
    Assistant messages override the official slot conversation.chat.assistant-actions, and user messages override keyed user / steering renderers. The edited new text is stored in a localStorage overlay (dsh-msg-edit:{sessionId}:{seq}); rendering prioritizes the new text (local override with host query fallback, and it can still be found in forked child sessions).

  • Fork inheritance mechanism
    Listens to the session/created event. If a child session (where header.parentSession exists) has a seed prefix that includes the replaced message, it replays the corresponding replace event and performs an idempotency check to avoid duplicates.

Dependencies and Configuration

  • Dependencies:
    • @deepseek-ai/dsh-session (^0.1.0-rc7)
    • @deepseek-ai/dsh-client-ui-conversation
    • @deepseek-ai/dsh-client-connection
  • Configuration: No additional configuration is required; the plugin works out of the box.

Notes

The plugin modifies the “context visible to the model”. According to DSH’s append-only safety design, old content is physically retained in log files and cannot be erased, but both the model’s view and the bubble display show the new text.

The plugin is open source under the MIT license and maintained by TwilightSpirit. For more details, see the GitHub repository or the DSH ecosystem catalog.