Files
deepseek-harness/packages/session/session-format-catalog
Turtle e7def469e1 feat(i18n): key translation pairing records by heading section (#5036)
* feat(i18n): key translation pairing records by heading section

Replace the whole-file blob hashes in *.i18n.yaml with one entry per
heading section that still holds language-specific content, keyed by the
English heading-slug path. Blocks identical across the pair (generated
table rows, code blocks, shared regions) stay out of the hash, so edits to
different sections and identical regenerations merge with Git's default
text merge, including on GitHub.

Remove the dsh-translation-pairing merge driver, its resolver command and
installer wiring; gen-translation-brief recovers last-confirmed text from
commit history. Migrate all active records, archive the superseded Agent
Note, and record the replayed conflict reduction in the new one.

* test(i18n): refresh translation prompt snapshot for the terminology note

* feat(i18n): exclude only code blocks and generated regions from pairing records

Replace byte-equality masking with an explicit rule: a record hash skips
fenced code blocks and BEGIN/END GENERATED regions, the two kinds of
content the pairing gate already requires to be identical on both sides.

Move generated data into regions written into both pages:
gen-config-catalog renders both languages and the record with per-package
regions labelled by code identifiers; gen-module-graph keeps its table in a
region; gen-doc-graphs splices the event matrix regions into the Chinese
page. Add a generic region splice beside the region grammar.
2026-09-23 22:32:06 +08:00
..
2026-09-23 20:47:45 +08:00

description, kind
description kind
Build-static first-party Session format codec and adjacent migration assembly for persistence readers. package-library

@deepseek-ai/dsh-session-format-catalog

English | 中文

Summary

dsh-session-format-catalog gives persistence one deterministic Session format reader without consulting mounted plugins. It assembles codecs and adjacent edges from the earliest supported format through the current writer format, checks the complete gap-free chain at module initialization, and exposes physical dispatch, header-only classification, single-pass row restoration, and current record encoding through sessionFormatCatalog.

Table of Contents


Use this package

When to use it

Import this library from persistence and test-support readers that need the complete first-party released-format inventory before any feature plugin mounts. Feature compositions do not register or reorder its entries. No runtime invariant companion is published because construction rejects an invalid static inventory and each completed restore validates its result; mutable row-decoder state belongs to one caller-owned streaming restore.

Entry point

const descriptor = sessionFormatCatalog.readHeader(physicalHeader)
const catalog = createSessionFormatCatalogWithChildren(childFacts)
const restore = catalog.createRestore(physicalHeader, { recovery: 'recoverable', validation: 'transformed' })
for (const row of physicalRows) restore.decodeRow(row)
const current = restore.finish()
const headerRecord = sessionFormatCatalog.encodeCurrentHeader(current.header, current.inheritedEventCount)
const eventRecords = current.events.map(sessionFormatCatalog.encodeCurrentEvent)

Import sessionFormatCatalog from the package root. JSONL and fixture readers create one restore, push each parsed physical row through decodeRow(), and call finish() once. Writers serialize the returned current artifact through encodeCurrentHeader() and encodeCurrentEvent(). Listing calls readHeader() and never opens event bodies.

Production historical reads select { recovery: 'recoverable', validation: 'transformed' }. Worker and fixture verification select { recovery: 'strict', validation: 'current' }. Transformed validation runs the released-current rules after migration but deliberately skips installed semantic validation for input that is already current.

The catalog contains all supported historical readers directly. A profile cannot add, remove, or reorder an edge by mounting a feature plugin. Its peer dependency on dsh-session supplies the installed current event vocabulary and current restoration rules, while historical edge validators remain frozen. The browser-safe ./message-projections export assembles current plugin-owned interpreters for detached constructors and surface folds; it does not mount recovery listeners.

createSessionFormatCatalogWithChildren(childFacts) binds explicit child evidence to V3→V4 during assembly; see the catalog-completion specification. historicalSessionFormatCatalog restores V0–V3 using the fixed released-V3 event vocabulary to collect child prerequisites without recursively completing their catalogs. An ignorable V3 extension remains opaque even when the installed writer knows its name. Isolated transcript replay explicitly supplies an empty array; persistence must collect the complete available direct-child set. Keep the supplied evidence unchanged for the catalog’s lifetime. Each restore owns independent stage state. The static sessionFormatCatalog supports header and native current-format reads; historical body reads require the child-bound catalog.


Understand the implementation

Implementation internals — click to expand

src/generated.ts is the static owner of codec and edge ordering. src/current.ts delegates final header, envelope, message, surface, seed, and current request-header validation to the installed Session semantics. The low-level constructor rejects duplicate codecs, duplicate edges, gaps, and entries beyond the current version before any Session read can begin.


Further Exploration


Model Experience

Catalog dispatch

What the model sees

Nothing directly. The catalog only restores the SessionEvent history consumed by request reconstruction.

Token effect

Zero direct tokens.

KV Cache effect

No direct effect; restored history determines cache identity in its consumer.

Known Limitations and Deferred Work

  • First-party build inventory only — external migration ownership and distribution are not supported.
  • Generated ordering is closed — runtime plugin registration cannot supply a missing historical edge.

Dev Note

Working context for maintainers — click to expand

None.