Time Weaver: Controlling DSH Session Flows on Immutable Logs

Preface

When running agents in DSH (DeepSeek Harness), sessions often follow an append-only journal: the user sends a message, the model replies, and if you later need to modify an earlier entry, you must either touch the underlying records or face inconsistency between the context and the screen. Common workarounds involve starting a new session or manually deleting messages, which often leaves “orphan” results in the tool call chain.

dsh-time-weaver is a community-maintained workflow plugin for DSH, published on GitHub by YumenoSayuri (YumenoSayuri/dsh-time-weaver). Without rewriting underlying log entries, it appends to disk via hook/invoked events to provide full support for rewinding user messages, editing AI replies, semantic retraction, and regeneration. The weaving state persists even after closing the client or switching to a historical session, and it is equally effective for older sessions created before the plugin was installed.

What is this

Package name @local/dsh-time-weaver, current version 1.0.9 (2026-10-21), MIT licensed. The implementation was jointly completed by Nova and Huibao Zhuren, inspired by @xsj/dsh-rewind, and rewritten according to the current DSH API.

The plugin consists of two halves: Host (host.v8.js) and Client (client.js). The Host handles event replay, rewriting the session.deriveMessages() projection, and the HTTP API. The Client injects buttons and pop-ups via slots to hide and rewrite already rendered lines. The context read by the model is determined by the projection; the screen display is secondary processing on top of the host rendering, and the two are aligned via DOM conventions such as the turn anchor data-chat-turn.

Core Features

The README organizes the entry points and behaviors into the table below, which is summarized below based on the same facts.

Capability UI Entry Effect
Rewind User message action row: “↺ Rewind Here” Interrupts the running turn; hides the message and all subsequent tail messages; refills the original text and image attachments into the input box for re-editing and sending.
Cancel “✕” to the left of the Send button Revokes a pending rewind, restores all lines, and clears the auto-refilled draft.
Edit AI reply action bar: “✏️ Edit Reply” Pop-up to correct text; after saving, the model context and screen bubble sync update, preserving segmented line breaks.
Retract / Delete AI reply action bar: “🗑️” The reply is completely hidden from the conversation row; the model side sees a configurable placeholder (default .).
Regenerate AI reply action bar: “🔄” The old reply is hidden and removed from context, proactively waking up a new generation turn; the trigger message is collapsed into a one-line notice.
Settings “⚙” on the right of the input area Select or customize the retraction placeholder.

All AI-side operations preserve the preceding tool call chain (tool calls / tool results) and do not produce orphan tool results.

If driven by scripts or external tools, the HTTP interface is mounted under /api/time-weaver, including POST /mark, /cancel, /edit, /retract, /regenerate, as well as GET /state, /message, /config, etc.; see the repository README for the full list.

Environment Requirements

Before installation, ensure the host and runtime meet the conditions in the README:

  • DSH Next (depends on host webServer / sessions / agents and client slots)
  • Since DSH 0.2.1-rc.2, user bubble body is rendered by the conversation.chat.user.content Factory; the plugin prioritizes this path and falls back to plain text if missing.
  • Node.js >= 20
  • No runtime third-party dependencies

Installation and Activation

The plugin is mounted as a standard DSH plugin package and requires declaring dsh.bundle and dsh.client in package.json. An excerpt from the official instructions follows:

// package.json (excerpt)
"main": "host.v8.js",
"exports": { ".": "./host.v8.js", "./client": "./client.js" },
"dsh": {
  "bundle": { "patch": "./cordis.patch.yml" },   // Mounts the host side
  "client": { "platform": "web", "immediately": true, "inject": ["@deepseek-ai/dsh-client-ui-slots"] }
}

Add this package to your DSH profile dependencies and list it in dsh.profile.bundles, then restart DSH (the host side loads at process startup). The client side takes effect upon page refresh.

The materials do not provide a standalone one-line dsh plugin add command; please reference the package according to your current profile’s dependency management method. Do not construct installation commands based on repository names that do not appear in the documentation.

Typical Usage

The following describes common flows in the order of UI operations; specific button text is subject to the Web client.

Rewind and Resend

  1. Click “↺ Rewind Here” on the user message row. If the agent is running, it will be interrupted first.
  2. The message and subsequent conversation are hidden on the screen; the body and images return to the input box, where they can be modified and resent.
  3. If you do not want to rewind, click “✕” to the left of the send area to cancel, restoring all lines and clearing the draft.
  4. The rewind interval is solidified by the host in the next turn’s agent/pre-step; newly sent messages and their replies will not be mistakenly hidden in the old tail.

Modify an AI Reply without Re-running the Whole Segment

  1. Click “✏️ Edit Reply” on the target AI reply action bar.
  2. Correct the text in the pop-up and save; subsequent model turns read the new body, and the bubble updates in place.

Semantic Retraction or Regeneration

  1. Retract: Click “🗑️”, the row is hidden from the interface, and the entry becomes a placeholder in the context (can be changed from the default . in “⚙”).
  2. Regenerate: Click “🔄”, the old reply is hidden and removed from context, and the plugin calls followup() to start a new turn; a collapsed notice line appears on the interface instead of a new user bubble.

Troubleshooting Anomalies

The client and host append JSON lines to ~/.dsh/time-weaver-diag.log (auto-truncated over 512 KiB), recording events like boot, rewind marks, state application, and regeneration. You can check the meaning of the v field in the README without opening DevTools.

Applicable Scenarios and Notes

Who it is for

  • DSH Next users who need to “go back to a specific user message and ask again” in long sessions without losing the tool chain or manually editing the journal.
  • Scenarios requiring in-place modification of model replies, semantic deletion of specific assistant messages via placeholders, or regenerating the last answer without repeating the prompt paste.

Limitations to Know Before Use

  • The screen layer is secondary processing and depends on the current DSH chat DOM (e.g., data-chat-flow-key, data-chat-turn). If the DOM undergoes major version adjustments, the plugin may need selector updates.
  • A turn may contain multiple assistant steps; edit, retract, and regenerate act on the final answer of that turn.
  • Regeneration adds an extra context message in notice form, which is the necessary input to trigger the new turn.
  • Once a rewind interval is committed, it persists; the interface cannot undo committed hidden intervals (README states direct journal modification is required).

Security and Permissions

The plugin runs with the current DSH process permissions and can read/write session state and ~/.dsh/time-weaver-diag.log. Read the source code and MIT license before installation, and only introduce profile dependencies from trusted sources.

Conclusion

The Time Weaver turns rewinding, editing, retraction, and regeneration into a persistent session flow control mechanism while preserving the immutable append-only journal; the Host modifies the projection, the Client modifies the view, and the tool chain remains intact.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye