Skip to content

Class: FsJsonlLessonStore ​

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:66

Crash-safe hybrid filesystem LessonStore implementation (fs.jsonlLessonStore, SPEC.md §4.3).

Resolves definitionsDir, statsPath, and lockFile against the immutable host repository root (Invariant 5), writes immutable <definitionsDir>/<lessonId>.json definition files on admit(), and updates mutable telemetry counters in statsPath under a PQueue({ concurrency: 1 }) queue combined with @paraharness/lockfile and write-file-atomic.

Implements ​

Constructors ​

Constructor ​

ts
new FsJsonlLessonStore(node, hostRoot?): FsJsonlLessonStore;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:84

Initializes an FsJsonlLessonStore bound to the host repository root (SPEC.md Invariant 5).

Resolves all configured store paths relative to hostRoot (defaulting to process.cwd()).

Parameters ​

ParameterTypeDescription
nodeFsJsonlLessonStoreNodePassive lesson store AST node.
hostRoot?stringOptional explicit host repository root directory.

Returns ​

FsJsonlLessonStore

Methods ​

admit() ​

ts
admit(lesson): Promise<string>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:135

Admits a distilled lesson by writing an immutable <definitionsDir>/<lessonId>.json file.

Deduplicates identical (partition, directive) pairs and initializes telemetry counters in statsPath.

Parameters ​

ParameterTypeDescription
lessonFsAdmitLessonParamsLesson definition to admit.

Returns ​

Promise<string>

Assigned content-addressed lessonId.

Implementation of ​

LessonStore.admit


markSignalEmitted() ​

ts
markSignalEmitted(
   lessonId, 
   signalId, 
   emittedAt
): Promise<void>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:202

Persists the ISO-8601 emission timestamp for signalId on lessonId in statsPath.

Enforces .emitSignalWhen() cooldowns across process restarts (SPEC.md §3.4.3).

Parameters ​

ParameterTypeDescription
lessonIdstringLesson identifier.
signalIdstringSignal identifier.
emittedAtstringISO-8601 emission timestamp.

Returns ​

Promise<void>

Resolves when statsPath is atomically updated.

Implementation of ​

LessonStore.markSignalEmitted


queryCandidates() ​

ts
queryCandidates(req): Promise<readonly LessonRecord[]>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:115

Queries non-retired candidate lessons and populates relevanceScore in [0, 1] via MiniSearch.

Orders returned candidate lessons deterministically by descending relevanceScore and id.

Parameters ​

ParameterTypeDescription
reqFsQueryCandidatesParamsQuery text and active partitions.

Returns ​

Promise<readonly LessonRecord[]>

Frozen array of candidate lesson records.

Implementation of ​

LessonStore.queryCandidates


recordOutcomes() ​

ts
recordOutcomes(outcomes): Promise<readonly LessonRecord[]>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:157

Appends deduplicated step execution outcomes to statsPath and returns the updated lesson records.

Increments totalCleanPasses and totalViolated counters without touching <definitionsDir>/<lessonId>.json.

Parameters ​

ParameterTypeDescription
outcomesreadonly FsRecordOutcomeParams[]Batch of lesson outcomes.

Returns ​

Promise<readonly LessonRecord[]>

Updated lesson records for the affected lessons.

Implementation of ​

LessonStore.recordOutcomes


retire() ​

ts
retire(lessonIds): Promise<void>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:222

Permanently retires lessonIds in statsPath so subsequent queryCandidates() calls exclude them.

Preserves historical <definitionsDir>/<lessonId>.json audit files while marking retired: true.

Parameters ​

ParameterTypeDescription
lessonIdsreadonly string[]Lesson identifiers to retire.

Returns ​

Promise<void>

Resolves when statsPath is atomically updated.

Implementation of ​

LessonStore.retire


syncCreationEpochsForRuns() ​

ts
syncCreationEpochsForRuns(runIds, updatedEpochs): Promise<void>;

Defined in: fs/src/stores/fs-jsonl-lesson-store.ts:177

Aligns epochAtCreation overrides in statsPath for lessons created by runIds.

Keeps <definitionsDir>/<lessonId>.json 100% immutable while updating statsPath (SPEC.md §4.3).

Parameters ​

ParameterTypeDescription
runIdsreadonly string[]Run IDs whose topology overlays committed.
updatedEpochsReadonlyMap<string, number>Map of partitionId to committed base epoch.

Returns ​

Promise<void>

Resolves when statsPath is atomically updated.

Implementation of ​

LessonStore.syncCreationEpochsForRuns

Released under the MIT License.