gordonlu/dsh-context-lens1

dsh-context-lens

DeepSeek Harness 的请求上下文分析器,用于查看模型请求间的变化及缓存复用情况

AI 分析

核心用途是分析和优化模型请求的上下文。适合需要深入排查缓存复用效率、对比请求差异的开发者,开发时需注意其依赖的特定包版本存根。

包名
dsh-context-lens
版本
0.1.0
许可证
MIT
最近更新
2026年8月13日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:gordonlu/dsh-context-lens

Install & build

The published npm snapshot of the harness packages is incomplete: @deepseek-ai/dsh-compact and @deepseek-ai/dsh-type-meta are referenced by peers/dependencies but have never been published, and pnpm ≥ 10/11 auto-installs peers — so a plain registry install fails. This repo vendors type-only copies of the eight @deepseek-ai/dsh-* packages under vendor-stubs/ (dev-time, lib/types snapshots with sanitized package.json; only dsh-llm carries a 3-line runtime for its brand constructors). @deepseek-ai/cordis installs for real. See IMPLEMENTATION_NOTES.md → "npm snapshot gaps" for the full story.

pnpm install
pnpm typecheck   # tsc --noEmit
pnpm test        # vitest — 53 tests: fingerprint, cache math, diffing, projection lifecycle, replay consistency, determinism
pnpm build       # tsc declarations → lib/types, tsdown → lib/index.js + lib/invariant.js + lib/client.js (browser, closure-factory ABI)

The browser bundle replicates the harness client-bundle ABI: window.__ModuleLoader__.load({ id: "dsh-context-lens", factory: (require) => … }), resolving react / react-dom / platform module-table entries through the loader-injected require and inlining everything else.