deepseek-harness/packages
Yichen Jiang e62cbe12e4 refactor(token-meter): fold the surface once for the meter and the projection
`contextBreakdown.messageTokens` and `measure().surfaceTokens` answer the same
question in the same heuristic vocabulary, and the panel's composition rows are
only honest while they agree. Each owner carried its own copy of the positional
fold — same pricing, same `{seq, tokens}` node list, same replace-range lookup
and guard, differing only in mutable versus immutable application — so an edit
to either one would have moved the panel away from `measure()` with both sides
still green. The duplication gate caught the shared 62 tokens.

`src/surface-fold.ts` now owns `foldSurfaceTokens`: total, allocation-fresh,
returning the event's price, the next surface, and the signed total delta. The
service assigns that result where it used to prepare a commit closure, which
keeps its validate-before-mutate replay transaction intact — the fold throws
before any state is touched, so a malformed event still fails identically on
every retry. `_prepareSurfaceMutation` and `_estimateSurfaceEvent` go away with
it, and the projection's apply drops to one call.

Covers the identity with a session that appends and then compacts, asserting
the projection figure equals the service surface at each boundary; the test
fails when either side of the fold is perturbed.
2026-08-05 16:29:51 +08:00
..
acp Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
bash Merge remote-tracking branch 'origin/master' into fix/landlock-runner-failure-classification 2026-08-05 13:17:38 +08:00
client fix(web): localize the context panel headline order and drop empty bar parts 2026-08-05 15:59:24 +08:00
code-runtime Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
compact refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
context refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
cordis Merge remote-tracking branch 'origin/master' into feat/add-session-data-preview 2026-08-05 15:51:34 +08:00
core Merge remote-tracking branch 'origin/master' into feat/add-session-data-preview 2026-08-05 15:51:34 +08:00
credentials Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
examples Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
experimental docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
fs refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
goal refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
guard Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
hooks refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
host Merge remote-tracking branch 'origin/master' into worktree/custom-deepseek-models 2026-08-05 12:50:58 +08:00
llm refactor(token-meter): fold the surface once for the meter and the projection 2026-08-05 16:29:51 +08:00
lsp Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
mcp Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
plan refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
pty Merge pull request #1362 from deepseek-harness/fix/landlock-runner-failure-classification 2026-08-05 13:59:47 +08:00
sandbox Merge pull request #1362 from deepseek-harness/fix/landlock-runner-failure-classification 2026-08-05 13:59:47 +08:00
sdk Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
session-persistence refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
session-projection Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
session-query refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
session-title refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
settings fix(packages): omit source publication payloads 2026-08-05 01:15:19 +08:00
skill refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
spill Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
storage Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
subagent refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
subprocess Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
support Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
tasks refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
telemetry Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
timeout Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
todo refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
typert Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
ui refactor(session): route construction through Session.create 2026-08-05 11:56:14 +08:00
util Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
web Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
workflow Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
workspace Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
AGENTS.md refactor(tools): shapeDispatchLog off the public registry surface 2026-07-26 22:52:15 +08:00
CLAUDE.md Document the codebase thoroughly and tighten type safety 2026-06-11 13:01:00 +08:00
README.i18n.yaml cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
README.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
README.zh.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00

Packages

English | 中文

Packages use the @deepseek-ai/dsh-* scope. Each is a Cordis Service subclass or function plugin; contributions use ctx.effect(), ctx.on(), or ctx.waterfall(). Authoring rules: package and root.

Hierarchy

Packages live at packages/<group>/<pkg>/; groups are containers, while names remain @deepseek-ai/dsh-<pkg>. Each group README is the canonical package/ctx-key map.

Group Role Release expectation
core/ Product API spine: sessions, prompts, tools, agent services, and the concrete loop Product — stable surface
typert/ Type graph generation, artifact loading, and runtime registry Product — stable surface
goal/ Persisted same-session goal state and lifecycle Product — stable surface
llm/ LLM capability family: the abstract service + provider adapters Product — stable surface
subprocess/ Subprocess capability family: spawn seam + local process-tree implementation Product — stable surface
bash/ Bash capability family: executor seam, local impl, model-facing tool Product — stable surface
pty/ Persistent PTY capability family: owner-scoped sessions, local implementation, and model-facing tools Product — stable surface
code-runtime/ Code-execution capability family: the runtime seam for model-written programs + a worker-thread backend Product — stable surface
sandbox/ Process-confinement seam; bwrap/Landlock/Seatbelt backends Product — stable surface
fs/ Filesystem capability family: seam, local impl, model-facing file tools, bash-backed discovery tools Product — stable surface
lsp/ LSP capability family: seam, generic stdio provider, and the lsp tool Product — stable surface
skill/ Skill capability family: the provider registry, local provider, and model-facing catalog/loader Product — stable surface
compact/ Compaction capability family: the abstract seam + a basic backend (tool deferred) Product — stable surface
context/ Model-visible request context, including workspace instructions and time context Product — stable surface
subagent/ Subagent capability family: the provider-registry seam and the model-facing delegation tool Product — stable surface
tasks/ Generic background-task runtime and model-facing task_* control tools Product — stable surface
workflow/ Workflow capability family: the script-engine seam, worker-thread engine, and model-facing workflow and fresh-agent ralph tools Product — stable surface
web/ Web capability family: seam, search/fetch provider impls, and the model-facing web tools Product — stable surface
spill/ Spill capability family: storage seam, local impl, tool-result spill policy Product — stable surface
todo/ The model-facing todo_write tool Product — stable surface
plan/ Plan collaboration state with a direct entry command and reviewed exit Product — stable surface
timeout/ Tool-call timeout policy: the tools/execute deadline enforcer Product — stable surface
guard/ Loop-hygiene guards: advisory repeat-call reminders Product — stable surface
cordis/ Cordis runtime integration: self-inspection/model-written temporary Plugins and restricted repository Plugin loading Product — stable surface
hooks/ Hook bridges + the shared Claude Code / Codex wire-protocol library Product — stable surface
session-persistence/ Persistence seam + JSONL/SQLite backends Product — stable surface
session-projection/ Projection seam: domain fold units serve whole values Product — stable surface
session-query/ Session retrieval family: logical corpus, bounded reads, lineage, event relationships, semantic filtering, and SQLite full-text search Product — stable surface
session-title/ Log-backed session titles: fallback service and opt-in LLM providers Product — stable surface
settings/ User-settings seam + file-backed provider Product — stable surface
credentials/ Credential-reference seam + env-over-.env provider Product — stable surface
telemetry/ Session reporting: capture/redact seam, OTel backend Product — stable surface
storage/ Non-session storage hub + backends + domain form Product — stable surface
workspace/ Workspace entity Product — stable surface
sdk/ Project SDK tooling Product — stable surface
acp/ Automation-only Agent Client Protocol server Product — stable surface
ui/ JSON-RPC integration, approval/interaction seams, ask-user tool Product — stable surface
host/ Web-GUI host half: API gateway + HTTP route server Product — stable surface
client/ Web-GUI browser half: shell, wire, object services, slots, ui-* plugins Product — stable surface
experimental/ Prototypes and internal plugins Unreleased
examples/ Demo bundles (agent-spine + CLI/ACP/JSON-RPC bins) leaves load Support — example infra
support/ Support infrastructure (testkits, invariants, replay, Loader smokes) Support — lower compatibility expectations
util/ Low-level zero-dependency utilities shared across groups (Branded<B>, Harness home/path helpers, timeout, retention) Support — small, stable, harness-dep-free

New packages join existing groups; new groups update their README and this table.

Dependencies

The dependency graph is generated: docs/module-graph.md (pnpm run gen-module-graph, freshness-gated in CI).

Extension plugins depend on interfaces, never the concrete loop. dsh-agent-loop is swappable; UI, hook, and tool plugins use dsh-agent. Composition bundles, including dsh-agent-spine-demo, may depend on spine plugins. Capabilities split into interface / implementation / consumer packages; see capability seams.

Package READMEs cover purpose, APIs, extension points, and Model Experience unless on the model-agnostic omission allowlist. They also carry ## Known Limitations and Deferred Work or use its allowlist.