mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Add a SQLite SessionPersistence backend (node:sqlite), a SECOND implementation built to prove the abstract seam + the shared runPersistenceContract suite are genuinely backend-agnostic. Each SessionEvent maps 1:1 onto an events row (session_id, seq, type, time, data); append is an INSERT inside a transaction asserting the contiguous-seq contract; the mutable SessionSummary lives in the sessions metadata row. It satisfies the SAME contract semantics as the JSONL backend, expressed over rows instead of file bytes: - Lazy materialization: create() records intent in memory; no row until the first append (a never-appended session is absent from has()/list() via a materialized flag set inside the first append transaction). - Crash-tail-on-load: load() returns events only through the last complete turn/end and deletes the uncommitted tail; a seq gap in the committed region makes the session unloadable. - Transactional append: a mid-batch failure (a UNIQUE seq collision from a concurrent writer) rolls back entirely, keeping the cursor truthful. Like the JSONL backend it is also the write-path plugin (session/event → buffer → session/flush drain, onCreated seed/adopt/collision handling, HMR seeding, dispose-to-quiescence). The package runs the shared runPersistenceContract suite plus SQLite-specific tests (transaction rollback, crash-tail cut, schema version, HMR adoption). Docs flip every "SQLite is future/deferred" reference (ADR 0016, architecture.md, the persistence module doc + README) to "implemented; the contract holds both backends to identical semantics".
28 lines
797 B
TypeScript
28 lines
797 B
TypeScript
import { execFileSync } from 'node:child_process'
|
|
import { resolve } from 'node:path'
|
|
|
|
// publint every publishable package (vendor/ is private upstream code and
|
|
// examples/ are not packages; both are out of scope).
|
|
const packages = [
|
|
'packages/llm',
|
|
'packages/session',
|
|
'packages/session-persistence',
|
|
'packages/session-persistence-jsonl',
|
|
'packages/session-persistence-sqlite',
|
|
'packages/system-prompt',
|
|
'packages/tools',
|
|
'packages/agent',
|
|
'packages/agent-loop',
|
|
'packages/bash',
|
|
'packages/llm-deepseek',
|
|
'packages/llm-pi-ai',
|
|
'packages/bash-local',
|
|
'packages/tool-bash',
|
|
'packages/invariants',
|
|
]
|
|
|
|
const root = resolve(import.meta.dirname, '..')
|
|
for (const path of packages) {
|
|
execFileSync('node_modules/.bin/publint', [path], { cwd: root, stdio: 'inherit' })
|
|
}
|