deepseek-harness/docs
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
..
cookbook Merge origin/master into xjt/proofreading-active-docs-2-apply 2026-08-05 10:57:53 +08:00
cordis-catalog refactor(token-meter): fold the surface once for the meter and the projection 2026-08-05 16:29:51 +08:00
cordis-tutorial docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
core-data-structures Merge remote-tracking branch 'origin/master' into feat/add-session-data-preview 2026-08-05 15:51:34 +08:00
i18n docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
postmortem Merge remote-tracking branch 'origin/master' into fix/landlock-runner-failure-classification 2026-08-05 13:17:38 +08:00
user docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
agent-lifecycle.md refactor(agent): return request retry action 2026-07-27 21:17:49 +08:00
AGENTS.md docs(notes): archive low-value decision records 2026-07-26 23:06:00 +08:00
architecture.i18n.yaml cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
architecture.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
architecture.zh.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
capability-seams.md Merge remote-tracking branch 'origin/master' into feat/pwsh-tool 2026-08-04 17:54:45 +08:00
config-catalog.md Merge pull request #1050 from deepseek-harness/worktree/custom-deepseek-models 2026-08-05 14:04:18 +08:00
cordis-paper.pdf docs: add cordis paper 2026-07-31 15:54:36 +08:00
cordis-primer.i18n.yaml docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
cordis-primer.md Merge remote-tracking branch 'origin/master' into worktree/pr343-retarget-latest-master 2026-07-23 13:40:29 +08:00
cordis-primer.zh.md docs(i18n): proofread active Chinese documentation 2026-08-04 17:36:14 +08:00
defensive-patterns.i18n.yaml docs(i18n): restore first-occurrence terminology 2026-08-04 20:54:42 +08:00
defensive-patterns.md docs(security): include password names in scrub rule 2026-07-28 09:40:33 -07:00
defensive-patterns.zh.md docs(i18n): restore first-occurrence terminology 2026-08-04 20:54:42 +08:00
development.i18n.yaml cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
development.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
development.zh.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
event-producer-consumer.md docs(session): document creation ownership boundaries 2026-08-05 11:57:17 +08:00
glossary.i18n.yaml docs(i18n): address proofreading review findings 2026-08-04 18:42:13 +08:00
glossary.md docs: align Goal Round step cardinality 2026-07-24 12:10:40 +08:00
glossary.zh.md docs(i18n): address proofreading review findings 2026-08-04 18:42:13 +08:00
graph-atlas.md cleanup: remove TUI package and legacy dsh entrypoints 2026-08-04 13:20:28 +08:00
module-graph.md Merge remote-tracking branch 'origin/master' into feat/pwsh-tool 2026-08-04 17:54:45 +08:00
persistence-catalog.md chore(docs): refresh the descriptor catalog pointer 2026-08-02 20:34:43 +08:00
testing.i18n.yaml Merge remote-tracking branch 'origin/master' into feat/pwsh-tool 2026-08-04 17:54:45 +08:00
testing.md Merge remote-tracking branch 'origin/master' into feat/pwsh-tool 2026-08-04 17:54:45 +08:00
testing.zh.md Merge remote-tracking branch 'origin/master' into feat/pwsh-tool 2026-08-04 17:54:45 +08:00
tool-catalog.md docs(pwsh): scope the encoding claim, document the PATH probe and preamble limitation, and fix catalog requires lists 2026-08-02 19:37:45 +08:00
tool-execution-pipeline.md Merge remote-tracking branch 'origin/master' into feat/send-unify 2026-07-23 22:41:45 +08:00
typert-catalog-integration-design.i18n.yaml refactor(cordis): generate catalogs from Typert models 2026-07-29 23:55:12 +08:00
typert-catalog-integration-design.md refactor(cordis): generate catalogs from Typert models 2026-07-29 23:55:12 +08:00
typert-catalog-integration-design.zh.md refactor(cordis): generate catalogs from Typert models 2026-07-29 23:55:12 +08:00
web-styling.i18n.yaml fix(web): quiesce websocket teardown 2026-08-04 16:42:50 +08:00
web-styling.md fix(web): quiesce websocket teardown 2026-08-04 16:42:50 +08:00
web-styling.zh.md fix(web): quiesce websocket teardown 2026-08-04 16:42:50 +08:00