dsh-code-lens
by lisycotana
DeepSeek Harness 代码模式子派发的可观测性——run code program 里模型看不见的那些工具调用
Observability for DeepSeek Harness code-mode sub-dispatches — the tool calls a run code program makes that the model never sees.
安装
dsh plugin --profile web add github:lisycotana/dsh-code-lensGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
目录
Observability for DeepSeek Harness code-mode sub-dispatches — the tool calls a
run_code program makes that the model never sees.
The gap this fills
In code mode the model writes a TypeScript program that orchestrates tool calls. The program receives every result in full. The model receives none of them — only whatever the program finally returns. Both dispatch boundaries are still recorded on the session log.
That produces a three-way split with no equivalent outside code mode:
| program | model | session log | |
|---|---|---|---|
| sub-call arguments | ✅ | ❌ | ✅ |
| sub-call results | ✅ | ❌ | ✅ |
dsh is the only harness that draws this distinction, because it is the only one where a tool call can happen inside a program the model wrote. The data is recorded and nothing surfaces it. This plugin does.
What it gives you
A codeLens session projection — whole-session totals, readable from the UI
without touching the log:
{ "programs": 1, "dispatches": 2, "settled": 2, "errors": 1, "dispatchMs": 340, "hiddenBytes": 1027 }
hiddenBytes is the payload the program consumed and the log preserved while the
model saw none of it.
A code_lens tool — lets the model audit its own program after the fact:
run_code call_abc: 2 sub-calls, 1 errors, 340ms, 1027B hidden from context
call_abc:code:1 bash ok 140ms 3B
call_abc:code:2 read error 190ms 1024B
Install
dsh plugin --profile web add dsh-code-lens
dsh --profile web
Development, without packaging — note the file:// URL (a bare G:/... path is
parsed as a URL scheme on Windows):
# scratch/cordis.yml
- insert:
- id: code-lens
name: 'file:///G:/dsh-plugins/dsh-code-lens/index.js'
dsh --profile web --patch ./scratch/cordis.yml
Design notes
- Zero dependencies. The projection registry's runtime contract is
structural — it calls
schema.parse(value)and nothing else — so the view validator is hand-written rather than pinning a zod copy that could drift from the host's. - Never appends from the observer.
session/eventlisteners run inside the publication window of the append that produced the event, andSession.append()throws on reentry. This plugin only reads there. - Both registries are optional.
sessionProjectionsandtoolsare acquired throughctx.inject, so the plugin stays loadable in headless assemblies that compose neither. - Holes in sub-call numbering are normal. A sub-call queued but abandoned by
run settlement logs neither event, so a start without a settle is a valid
terminal state, not a leak.
turn/enddrops the leftovers so persisted state cannot grow forever. - Pairing is by
subCallId; timing comes from the event envelopetime— neither event carries a duration.
Verified against
@deepseek-ai/dsh@0.1.0-rc.6, Node 24, DeepSeek-V4 via the headless profile.
Real session output — one run_code program reading eight files:
run_code call_00_lMDLou1XAHEXiQYgKbUR9330: 9 sub-calls, 0 errors, 23ms, 1312B hidden from context
call_00_lMDLou1XAHEXiQYgKbUR9330:code:1 read ok 6ms 164B
...
call_00_lMDLou1XAHEXiQYgKbUR9330:code:8 read ok 2ms 164B
call_00_lMDLou1XAHEXiQYgKbUR9330:code:9 code_lens unsettled — 0B
The model reported only "24 lines" — those 1312 bytes never entered its context.
The trailing unsettled row is code_lens observing its own in-flight call,
which is the documented terminal state for a start whose settle has not landed.
To reproduce, code mode must be on. The headless bundle already wires the tools row to an environment variable, so no patch is needed:
DSH_TOOLS_MODE=code dsh --profile headless --patch ./scratch/cordis.yml "…"
Unit-level checks: verify-integration.mjs (projection fold through the real
SessionStore/SessionProjections) and verify-tool.mjs (tool registration and
execution).
Note for plugin authors
ctx.tools.register() takes the wire schema — a complete JSON Schema object.
defineTool accepts the author-facing shorthand (a bare property map) and
compiles it. Passing the shorthand straight to register() reaches the provider
as type: null and the request is rejected:
INVALID_REQUEST: Invalid schema for function 'x':
schema must be a JSON Schema of 'type: "object"', got 'type: null'.
This plugin writes the object root explicitly, and validates its own argument,
because defineTool's compiled validator is what it gives up in exchange for
staying dependency-free. (A plain-JS plugin installed outside the harness tree
cannot resolve @deepseek-ai/dsh-tools as a bare specifier.)
License
MIT
原始 README: https://github.com/lisycotana/dsh-code-lens/blob/main/README.md ↗
同类插件
查看全部 →
k8e
k8e.sh — 开源 Agentic AI 沙箱矩阵

hol-guard
开源AI代理防病毒:运行时拦截风险工具、秘密访问、提示注入、恶意软件包、MCP服务器、插件和技能。

anolisa
ANOLISA(Agentic Nexus Operating Layer & Interface System Architecture):具备运行时、安全性、可观测性和 Tokenless 响应压缩能力的 Agentic OS,可降低 Token 使用量与成本。

mobius
首个自我演进的开源 Agent OS:连接你的团队、AI agent、设备与算力

deepseek-harness-desktop
DeepSeek Harness Tauri 桌面版 | Only 5mb installer, zero environment setup. Windows / macOS / Linux.

open-managed-agents
开源Claude管理代理API实现和自托管Claude标签式代理运行时。即插即用;在Cloudflare Workers/Durable Objects或Node.js上运行。Apache 2.0。