Preface¶
DeepSeek Harness (DSH) uses a ring buffer within the process to store log records and does not export them externally by default. If a process fails only after it is “ready”—for example, a session cannot activate, a preset mount fails, or a plugin line throws an error—the ring buffer disappears upon exit. The supervising process often only knows that “startup failed” and finds it difficult to obtain the root cause from the Harness side. More critically, the default export level filters warn from the ring buffer, meaning warnings within the startup window may already be lost before plugin loading occurs.
The Node subprocess’s stderr is retained by the parent process, making it the most reliable channel without introducing additional logging dependencies. The following introduces the community plugin dsh-plugin-log-bridge (Maintainer: desanv01, Category: admin-security): it attaches an exporter to the Harness, writing error and warn logs along with certain session errors to stderr, facilitating post-mortem investigation via terminals or process managers.
What is this¶
dsh-plugin-log-bridge is a DSH plugin with a straightforward purpose: record the Harness’s own runtime warnings and errors to stderr, allowing startup failures that occur “after startup” to reveal their causes. Repository: github.com/desanv01/dsh-plugin-log-bridge; Community Directory Page: skillhub.cn/plugins/desanv01/dsh-plugin-log-bridge. Licensed under MIT, current package version 1.0.0; the README states it has been verified under the 0.1.x combination of DeepSeek Harness targeted during writing (including desktop apps that bundled it), while verification within the official DeepSeek Harness desktop app 0.2.0-rc.2 remains pending. The plugin has no UI, no configuration schema, imports no other packages at module scope, and consists of approximately 144 lines of code on the host side.
The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent of DeepSeek / Hithink and are not official app stores.
Core Features¶
The behaviors verified in the README are as follows:
- Bridge
errorandwarn: Each record is written to stderr as a single prefixed line; if a stack trace is included, content following the first line is indented as a continuation. - Replay buffered errors from before loading: If
ctx.logger.bufferis an array, it replays the bufferederrorrecords. warn records from the pre-loading window are unrecoverable because the default level has already filtered them out of the ring buffer; the README explicitly states this without making false promises. - Session activation failure: Subscribes to
api-session/error, writing session activation failures that do not enter the logger to stderr as well. - Rate limiting: Maximum 100 entries within a 60-second window; once exceeded, it outputs a single line stating the number of discarded entries to prevent error loops from flooding the screen.
- Readiness marker: Writes a “ready” line to stdout at every startup to facilitate determining if the bridge has been loaded; the bridge body is in stderr with the prefix
[harness-log], helping the loader distinguish “bridge output” from “which plugin broke the startup.” - Don’t crash startup: Replaying, attaching the exporter, and subscribing to events within
apply(ctx)are each wrapped in independenttryblocks; attachment failures should not block the boot process.
Implementation details: apply attaches an exporter to ctx.logger with levels: { default: 2 } (Cordis: error 0, info 1, warn 2). formatMessage, bridgeLines, createLimitedWriter, etc., are exported as pure functions with injectable clocks to facilitate unit testing without a Harness environment.
Environment and Dependencies¶
- Node.js 22 and above (Harness comes with a runtime; installing Node separately is generally unnecessary).
- A DSH profile capable of loading plugin bundles, 0.1.x or 0.2.x.
- The parent process must be able to capture the child process’s stderr; running
dshdirectly in a terminal satisfies this.
Installation and Activation¶
Install from npm (Command provided in README)¶
Execute under the target profile:
dsh plugin --profile web add dsh-plugin-log-bridge
The README roadmap notes that “Publish to npm” has not yet been checked off; if installation fails, you can switch to the local path method (see below). Installation adds the corresponding line to the bundle, and the output appears alongside the Harness stderr.
Desktop Application¶
You can point the application to the plugin directory via --add-plugin <path>, or use the in-app plugin manager to install the npm package name (refer to your current client documentation).
Add local directory to profile¶
There is no build step within the package; the README example involves running the following inside the directory after cloning the repository:
dsh plugin --profile web add .
(The task requirements forbid guiding readers to git clone in the introduction process; if you already have the source tree, simply use . to point to that directory.)
After installation, check if the profile’s cordis.patch.yml contains the desktop-log-bridge line; a missing ready line usually indicates the plugin was not loaded.
Typical Usage and Self-Check¶
The plugin has no Config and does not accept options—by design, configurable diagnostics should not be relied upon when the startup is already having issues.
Bridge lines appear in stderr with the prefix [harness-log]. If you see no such lines, it may be that no error/warn has occurred yet, or the profile hasn’t attached the bundle; you can intentionally trigger it with a broken plugin or check the patch line.
The README provides a smoke test to verify formatting and line splitting logic without starting the Harness:
node --input-type=module -e "import('./index.js').then(m => {
console.log(m.formatMessage({ args: ['hello', new Error('boom')] }));
console.log(m.bridgeLines('error', 'harness', 'line one\nline two').join('|'));
})"
You should expect a formatted message and two prefixed lines (the second line indented).
Built-in Constants (Not Configuration)¶
Tuning constants are written at the top of index.js and are not exposed as configuration:
| Constant | Value | Meaning |
|---|---|---|
EXPORT_LEVEL |
2 |
Export up to warn |
WINDOW_MS |
60_000 |
Rate limit window (milliseconds) |
WINDOW_LIMIT |
100 |
Max lines within the window |
Applicable Scenarios and Notes¶
Who is it for: People who launch DSH using systemd, Docker, desktop shells, or CI, and need to see Harness’s own warn/error and session activation failures in stderr logs after the process exits; especially those concerned with scenarios where “failure occurs after ready.”
Permissions and Security: The plugin runs with the same permissions as the current dsh process; you should read the source code and the MIT license before installing. The README Security section explains that content written to stderr may include prompt fragments, paths, tool arguments, etc.—any sensitive information logged as error/warn will leave the process via stderr, so desensitization and access control should be implemented according to the environment when collecting logs.
Troubleshooting Excerpts: When supervisors buffer stderr, it may be truncated, so you should read the supervisor’s full logs; dropped N message(s) indicates rate limiting was triggered; pre-loading warnings are unrecoverable.
Slots: None. It is a pure host plugin and does not register UI slots.
Conclusion¶
dsh-plugin-log-bridge uses a minimal surface area to patch the gap in the Harness’s in-memory log ring onto stderr: error/warn, buffered error replay, session errors, rate limiting, and boot-safe wrapping, all with no configuration options. If you maintain DSH deployments or desktop bundles, it is worth adding a line to your profile’s bundle, letting “why it crashed” remain in the stderr that the parent process is already holding.
- Community Directory: https://www.skillhub.cn/plugins/desanv01/dsh-plugin-log-bridge
- Source Code & Full Documentation: https://github.com/desanv01/dsh-plugin-log-bridge