dsh-runtime-log
Discovered★ 101A lightweight DSH plugin for persistent local WARN/ERROR logs in rotating JSONL files. Features bounded buffering, best-effort secret redaction, and automatic log retention. Zero runtime dependencies.
dsh-runtime-log
为 DeepSeek Harness(DSH)提供本地 Cordis WARN / ERROR 日志留存,便于在重启后排查运行问题。日志以 JSONL 写入本机,并用有界队列、文件轮转及旧运行清理限制资源占用。
GitHub Release · npm · 变更记录 · 问题反馈 · MIT 许可证
当前修复版本为 0.1.1。这是第三方 DSH 插件,不是 DeepSeek 官方产品。它只在下列支持环境中发布和验证;部署前请阅读隐私及限制说明。
功能
- 通过 Cordis logger exporter 接收 WARN 和 ERROR,异步写入本地 JSONL 文件;INFO / DEBUG 不保存。
- 限制队列记录数、队列字节数及单条编码大小,到达单段文件上限时轮转。
- 按运行实例区分文件,并在启动时尝试清理可确认已关闭的旧运行日志。
- 对常见凭据文本格式进行尽力脱敏;不遍历或序列化任意参数对象。
- 只使用 Node.js 内置模块,无第三方运行时依赖;插件本身不发起网络请求或上传日志。
兼容性
以下为 0.1.1 的支持声明,并非对其它版本或平台的兼容承诺。
| 组件 | 支持范围 | 已验证环境 |
|---|---|---|
| DSH | 仅 0.2.2-rc.1 | 0.1.1 隔离宿主验收;0.1.0 曾通过真实桌面完整重启 |
| Cordis | 4.1.0 | 由上述 DSH 版本提供 |
| Node.js | >=24.16.0 <25 | 24.16.0、DSH 自带的 24.21.0 |
| 操作系统与架构 | Windows x64 | Windows 桌面宿主 |
Node.js 区间对应 Node 24 发行线,区间内并非每个补丁版本都逐一测试。其它 DSH / Cordis 版本、Node.js 20–23 或 25+、macOS、Linux 和 Windows ARM64 均不在支持范围内。
宿主门禁信息位于 package.json:engines.node、engines.dsh、dsh.bundle.platforms、os 与 cpu。 cordis.patch.yml 只负责将插件 bundle 插入 profile,不承载版本门禁。升级 DSH 前应重新核对兼容性。
安装
需要能管理目标 DSH profile 及其依赖的环境。开始前确认 profile,并备份其依赖清单、锁文件和用户 patch。
-
在目标 profile 目录安装指定版本:
pnpm add dsh-runtime-log@0.1.1 --ignore-scripts -
在该 profile 的
dsh.profile.bundles中添加dsh-runtime-log,保留原有 bundle:{ "dsh": { "profile": { "bundles": ["existing-bundle", "dsh-runtime-log"] } } } -
在 profile 目录安装依赖并完整退出、重新启动 DSH:
pnpm install --ignore-scripts -
确认目标 profile 加载了该 bundle,再检查日志目录是否生成运行文件。插件包声明了 DSH 版本和 Windows x64 限制,宿主可能拒绝不兼容环境。
插件运行时不会修改 profile。安装和 profile 组合属于宿主管理操作;本插件不会自动启用或更改其它 bundle。
配置
不提供配置时使用下表默认值。默认日志目录为 $DSH_HOME/runtime-log;未设置有效的 DSH_HOME 时为 ~/.dsh/runtime-log,Windows 上通常位于 %USERPROFILE%/.dsh/runtime-log。
| 字段 | 默认值 | 范围与含义 |
|---|---|---|
directory | 默认日志目录 | 绝对路径,支持 ~、~/ 和 ~\;相对路径回退默认目录 |
maxFileBytes | 5242880(5 MiB) | 单段文件上限,64 KiB–100 MiB |
maxFiles | 4 | 每次运行保留段数,2–32,包含当前段 |
maxQueueRecords | 2000 | 待写及在写记录合计上限,1–50000 |
maxQueueBytes | 1048576(1 MiB) | 待写及在写编码字节合计上限,4 KiB–16 MiB |
maxEntryBytes | 16384(16 KiB) | 单条记录编码上限,256 B–min(256 KiB, maxQueueBytes) |
flushIntervalMs | 200 | 批量写入周期,25–60000 ms |
drainTimeoutMs | 1000 | 卸载时等待排空的期限,25–10000 ms |
数值配置要求安全整数;超出范围会被限制到允许边界,类型无效时使用默认值。单条记录的实际大小还受队列和文件上限约束。
可在用户 patch 中按 bundle 的 id 覆盖设置:
- id: dsh-runtime-log
config:
directory: "D:/dsh-logs"
maxFileBytes: 5242880
maxFiles: 4
maxQueueRecords: 2000
maxQueueBytes: 1048576
maxEntryBytes: 16384
flushIntervalMs: 200
drainTimeoutMs: 1000
路径仅为示例,目录必须允许 DSH 宿主写入。用户 patch 中的 config 整体替换较早层配置;未填写字段由插件补默认值。同一进程内,相同日志目录共享写入器,首次创建时的参数生效。建议同一目录只配置一套参数。
日志与保留
文件名为 host-<pid>-<uuid>.jsonl,轮转段使用 .1、.2 等后缀。默认每次运行最多保留 4 段,每段最多 5 MiB。
每行是一条 UTF-8 JSON 记录:
{"time":"2026-01-01T00:00:00.000Z","level":"warn","name":"example-plugin","message":"Example warning"}
| 字段 | 含义 |
|---|---|
time | UTC ISO 8601 接收时间 |
level | warn 或 error |
name | logger 名称;超长名称会截断并标记记录 |
message | 有界格式化并尽力脱敏后的消息 |
stack | 可选堆栈;不可安全读取时写入 [Stack unavailable] |
truncated | 内容被截断时为 true |
普通对象不展开为完整结构,通常用 [Object] 等标记表示。为避免执行用户自定义的 getter 或 Error.prepareStackTrace,插件只读取可安全取得的数据属性。**在支持范围内的 Node 24 中,标准原生 Error 的 stack 是 accessor,通常会记录为 [Stack unavailable],而不保存真实堆栈。**这是有意的安全与可诊断性取舍,不表示日志中必定包含错误堆栈。
启动和停止时,插件尝试写入 dsh-runtime-log WARN marker,消息分别以 [plugin-event:start] 和 [plugin-event:stop] 开头。Marker 与业务日志共用队列,队列压力下也可能丢失;停止 marker 中的计数是关闭前快照,不是最终排空结果。插件卸载可等待启动时的日志清理,但写入排空和清理共用 drainTimeoutMs 截止时间;期限内未完成则卸载返回,关闭中的 run 继续受保护,直到清理最终结算。
启动时的旧运行清理以 16 个可识别日志文件 为尽力目标:不同 PID 的旧运行需要确认进程已退出;同一 PID 的旧运行需要由当前 isolate 确认已完全关闭。只处理严格匹配命名规则的常规文件,并按旧运行组的时间由早到晚清理。当前、关闭中及状态未知的运行均受保护;来自其它 worker isolate、无法确认关闭状态的同 PID run 会保守保留。当前首段尚未出现在扫描中时,只为它预留一个文件位置,不预留未来轮转段。16 个文件是尽力目标而非硬磁盘配额;并发活动进程、慢扫描、worker isolate 或后续轮转都可能使目录暂时超过目标,单纯增大 maxFiles 不会再让旧运行预算归零。
隐私与限制
- 覆盖范围有限。 仅保存插件加载后经过 Cordis logger 的 WARN / ERROR;不会收集全部
console、stdout / stderr、工具结果或会话历史,也不追补加载前的记录。 - 脱敏并非秘密清除保证。 插件会处理已知凭据格式,但任意自由文本、未知编码、截断边界或尚未识别的格式仍可能含秘密。显式
Authorization/Proxy-Authorization字段从 scheme 到该行末尾整体遮盖,同一行后续的无关诊断文本也可能被隐藏;Cookie 与 Set-Cookie 字段整体遮盖。为减少英文诊断误报,scheme 规则保留Basic authentication failed和Bearer authentication required两类已识别文案。插件不会主动读取会话或凭据,其他组件传给 logger 的文本仍可能包含敏感信息。 - 日志可能丢失。 队列满时会丢弃记录,超长内容会截断;强制结束、断电、关闭超时或 I/O 错误都可能使末尾记录缺失。异步写入不提供崩溃持久性保证。
- 写入错误会停用对应写入器。 文件创建、写入或轮转失败后不会无限重试,会尝试向 stderr 输出限频提示。需修复目录或磁盘问题后重载插件或重启宿主。
- 日志按敏感诊断材料保管。 文件为本地文本,插件不加密。分享前应人工检查并删除令牌、Cookie、个人信息及其它敏感内容;使用合适的目录权限。
- 不是安全审计或恢复系统。 请勿将其作为审计完整性、故障恢复或安全隔离的唯一依据。
卸载
从目标 profile 的 bundle 列表和依赖清单移除本包,按 profile 流程更新依赖后完整退出并重启 DSH。卸载不会自动删除现有日志;确认宿主已不再写入后,可自行归档或清理。
问题反馈
请在 GitHub Issues 提交插件、DSH、Cordis 与 Node.js 版本、系统架构、复现步骤及经过人工检查的最小日志片段。请勿上传完整 profile、会话存档或凭据。兼容范围以实测和发布说明为准。
许可证
本项目采用 MIT License。软件按现状(AS IS)提供,不附带明示或默示担保;具体授权、免责和责任限制以许可证全文为准。
Comments
Loading…
Similar plugins
by ccr-wer
DSH (DeepSeek Harness) plugin: auto-write a first-person dev log at agent/turn-stopping. Turns context + memory into a narrative log for the developer's own review.
★ 0
MIT
JavaScript
Oct 19, 2026
dsh plugin --profile web add dsh-devlog-autoby lanbaolu
⛔ 已停止更新(2026-09-12):坏插件隔离等保底能力已内置于 DSH Desktop → 请直接使用 https://github.com/dataelement/dsh-desktop
★ 7
↓ 187/wk
JavaScript
Sep 12, 2026
dsh plugin --profile web add @lanbaolu/dsh-fail-softby dsh-plugin-lab
DSH Plugin: Auto-continues turns that stall on leaked DSML tool-call markup, wherever the route puts it — the reasoning or the visible text. | 当 DSML 工具调用标记泄漏在消息末尾(推理或正文皆可)导致回合停滞时,自动续跑。
★ 0
MIT
JavaScript
Nov 14, 2026
dsh plugin --profile web add dsh-dsml-rescueby iuuuuuuuu
DSH plugin: keep a session's parsed event log resident so a local append extends the resident parse instead of invalidating it - a long session is parsed once per host process, not once per read.
★ 4
MIT
JavaScript
Oct 14, 2026
dsh plugin --profile web add dsh-coldread-cacheby DIV7NE
DSH web plugin: a Run button on every chat code block that pastes into an integrated terminal, plus "Attach selection as context" from terminal output.
★ 0
MIT
JavaScript
Sep 13, 2026
dsh plugin --profile web add dsh-run-in-terminalby wly8691-jpg
Windows-native real-Office automation plugin (DSH). Contract, task-level, fault-injection and process-leak regressions covered; real-Office tests must be run on the target machine.
★ 6
↓ 466/wk
MIT
JavaScript
Oct 25, 2026
dsh plugin --profile web add @eqman00003/dsh-office-com