Files
deepseek-harness/packages/storage/storage-sqlite
imccyu ec601ca13d build(vendor): rescope the vendored Cordis packages into @deepseek-ai
Machine-produced by `pnpm run rescope-vendor --apply` plus the regeneration it
prints: `pnpm install` for the lockfile, `pnpm run gen-third-party-notices`,
`verify-translation-pairing --write` for the touched bilingual pairs,
`gen-doc-graphs`, and one typert snapshot whose ids embed character offsets.
`pnpm run rescope-vendor --check` verifies the result.

Renames nine vendored packages (cordis, cosmokit, schemastery and the six
@cordisjs plugins) and every reference that resolves them: manifest names and
dependency keys, module specifiers including declare-module merges, cordis.yml
plugin names, tsconfig paths, every Markdown fence, and `docs/` prose.
Directory names, upstream versions, and dependency ranges are unchanged, so
vendor/README.md still reads as an upstream snapshot; its manifest table gains
an upstream-name column so THIRD_PARTY_NOTICES keeps MIT attribution pointed
at each fork's origin.

The tutorial tier follows the rename end to end: its yaml fences named plugins
the Loader can no longer resolve, its `ts ignore-check` fences disagreed with
the compiled fences beside them, and its prose quoted both. The contracts that
told readers to keep upstream names — the root convention and the vendoring
cookbook's tree comment and manifest invariant — now say to rescope instead.

Two rules read `@deepseek-ai/` as "another workspace plugin": the client bundle
purity gate now names the vendored libraries a browser bundle inlines, and the
files where a bare `cordis` is an agent-preset id keep that product data.
2026-08-10 22:04:13 +08:00
..

@deepseek-ai/dsh-storage-sqlite

English | 中文

SQLite backend for the storage hub: registers as backend sqlite, serving the kv facet over one node:sqlite database file (or :memory:). Design and trade-offs: domain KV storage Agent Note.

Storage model

Document-per-row: each unit table becomes a physical "u_<unit>_<table>" (key TEXT PRIMARY KEY, value TEXT) STRICT table whose value is the record's JSON text, so one key updates one row (the reason to route a high-churn domain here instead of the JSON backend). Unit identity lives in two metadata tables — units stamps each unit's format version at first open and rejects a differing descriptor with version-mismatch; unit_globals holds each unit's global singleton row. The physical layout version lives in PRAGMA user_version; any other stamped value rejects (unreleased format, no migrations). Unit and table names are validated against the hub's UNIT_NAME_RE before they reach DDL, so no external input is ever interpolated into SQL identifiers.

Every write primitive is a single prepared statement — SQLite's per-statement atomicity satisfies the KV contract without explicit transactions, and write ordering stays the caller's responsibility (the domain layer's write chain). Missing directories and database files are created owner-only (0o700/0o600), matching the session-persistence SQLite backend.

Configuration (schemastery)

interface Config {
  path: string   // SQLite database file path, or ':memory:' for an in-process DB
  journalMode?: 'wal' | 'delete' | 'truncate' | 'persist'   // journal_mode pragma; default 'wal'
}

Model Experience

Stored domain records

What the model sees

Nothing. This backend contributes no prompt, tool, or schema; it persists non-session domain data (workspace records, future session sidecar metadata) behind ctx.storage for host-side consumers only.

Token effect

Zero live-request tokens.

KV Cache effect

None — the backend never touches live request prefixes.

Known Limitations and Deferred Work

  • DatabaseSync is synchronous — each write blocks the event loop for its (single-statement) duration; acceptable at domain-data scale.
  • No busy-wait or retry policy — another connection holding a write transaction rejects the operation immediately; there is no multi-process write protection.
  • Only the current STORAGE_SQLITE_SCHEMA_VERSION opens — any other stamped version is rejected rather than migrated (pre-release stance).
  • openDatabase duplicates the session-persistence SQLite open sequence — extraction into a shared media layer is deferred to the planned session-backend migration (see the Agent Note's reuse audit).