README.md 4.9 KB


description: "Build-static first-party Session format codec and adjacent migration assembly for persistence readers."

kind: "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 released v0 through current v3, 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 restore = sessionFormatCatalog.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.


Understand the implementation

Implementation internals — click to expand [`src/generated.ts`](src/generated.ts) is the static owner of codec and edge ordering. [`src/current.ts`](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.