* refactor(session): move Session log validation into a module Move header, seed-event envelope, and inherited-cut validation out of the Session constructor into validation.ts without changing check order or error text. Export needsInheritedSeedMarker for the fork marker rule the constructor applies. * feat(session): validate a Session log without constructing a Session validateSessionLog composes the header, seed-event, surface, and inherited-cut checks of Session construction in the same order. Omitting eventState matches Session.create; an event state matches Session.fromRestore. * refactor: validate stored Session logs with validateSessionLog The chat importer, session-query readSession, the format catalog, and JSONL generation verification constructed a discarded Session only to validate a log. They now call validateSessionLog with the same mode, inherited count, and message interpreters. * refactor(session): extract buildSessionHeader Move new-Session header construction out of SessionStore.prepare into the exported buildSessionHeader and name its input SessionHeaderMeta. Automatic ids and duplicate checks stay in prepare. * refactor(session): move header and fork error helpers out of the session index Move buildSessionHeader into validation.ts and SessionForkError with SessionForkErrorCode into fork.ts so later modules can import them without importing index.ts. index.ts re-exports both under the same names. Complete the JSDoc of the exported validation helpers. * refactor(session): extract checkSessionLog from the Session constructor Move header validation, seed acceptance with surface admission, and the inherited-cut check into checkSessionLog in validation.ts, keeping the constructor's order and errors. The Session constructor and validateSessionLog call it. * test(session): cover Session log validation and construction helpers Cover validateSessionLog against Session.create and Session.fromRestore in every event state, buildSessionHeader, needsInheritedSeedMarker, Session.readEvents range semantics, and the fork subpath export of SessionForkError. * docs(session): document Session log validation Document validateSessionLog, buildSessionHeader, needsInheritedSeedMarker, Session.readEvents, and the SessionForkError subpath export in the package README. Align the Session and CreateSessionOptions type blocks, add SessionHeaderMeta, regenerate the Cordis, event graph, and persistence catalogs, and update the plugin entry, unknown-cast, and package dependency registries. --------- Co-authored-by: imccyu <[email protected]>
description, kind
| description | kind |
|---|---|
| Package map for the session retrieval capability family: searching, tracing, and reading live and durable session history, plus the Web session-log export. | package-group |
session-query/ — session retrieval capability family
English | 中文
Summary
The session-query/ group provides retrieval over live and durable session history, independent of compaction: programmatic callers query one unified service for exact logs, filtered lists, relationship traces, and full-text search; a SQLite backend powers the search; the Web UI gets an /export command that downloads a session ZIP. Search results agree with the conversation history the model sees. This page maps the group; each package README owns its per-package contract.
Table of Contents
Packages
Each package README describes what you can do with its part of the family.
| Package | Role | ctx key |
|---|---|---|
session-query/ |
Unified session-history query service: exact reads, relationship traces, and filters | ctx.sessionQuery |
session-query-sqlite/ |
Full-text search across session history backed by a SQLite FTS5 index | registers on ctx.sessionQuery |
tool-session-list/ |
Optional read-only Workspace and Session metadata tools | — |
session-log-export/ |
Web /export command and browser download of a session ZIP |
ctx.sessionLogDownload (browser) |
Related documentation
Start with the subsystem reference for the shared query vocabulary, then the design records behind tracing and search.
The default Web and Desktop use this shared query, index, and export infrastructure. The experimental model-facing tools are a separate optional consumer.
- Session Query subsystem reference — logical records, filters, search pages, lineage, bounded reads, and event relationships.
- Session query relationship tracing — trace semantics and the validation boundary.
- SQLite FTS5 session search — search semantics, reconciliation, and the tokenizer decision.
Dev Note
None.