@basou/core 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1411,12 +1411,14 @@ declare const SessionMetricsSchema: z.ZodObject<{
1411
1411
  /** Inferred runtime type for {@link SessionMetricsSchema}. */
1412
1412
  type SessionMetrics = z.infer<typeof SessionMetricsSchema>;
1413
1413
  /**
1414
- * Tamper-evidence head anchor for sessions whose `events.jsonl` was written
1415
- * with hash chaining (import / in-place re-import): `head_hash` is the hex
1416
- * sha-256 of the last written event line (excluding the trailing newline),
1417
- * `event_count` the number of chained lines. Absent on live / ad-hoc /
1418
- * pre-feature sessions. Additive optional => no schema_version bump.
1419
- * `.strict()` because the import writer fully owns the shape.
1414
+ * Tamper-evidence head anchor for a session whose `events.jsonl` is hash
1415
+ * chained: `head_hash` is the hex sha-256 of the last written event line
1416
+ * (excluding the trailing newline), `event_count` the number of chained lines.
1417
+ * Written by the import / in-place re-import writers and, for a live session
1418
+ * (`exec` / `run` / ad-hoc), by the finalize once it reaches a terminal status.
1419
+ * Absent on a still-live session (the anchor is stamped at finalize) and on a
1420
+ * pre-feature unchained session. Additive optional => no schema_version bump.
1421
+ * `.strict()` because the writers fully own the shape.
1420
1422
  */
1421
1423
  declare const SessionIntegritySchema: z.ZodObject<{
1422
1424
  head_hash: z.ZodString;
@@ -1553,6 +1555,35 @@ declare function enumerateSessionDirs(paths: BasouPaths): Promise<string[]>;
1553
1555
  * or the zod error).
1554
1556
  */
1555
1557
  declare function readSessionYaml(paths: BasouPaths, sessionId: string): Promise<Session>;
1558
+ /**
1559
+ * Apply a terminal-status mutation to a live session's `session.yaml` AND, in
1560
+ * the same locked write, stamp the tamper-evidence head anchor derived from the
1561
+ * on-disk `events.jsonl` tail. Used by the `exec` / `run` orchestrators for
1562
+ * BOTH terminal writers (the normal end-of-run finalize and the spawn-failure
1563
+ * `failed` finalize).
1564
+ *
1565
+ * Why locked + anchor-from-tail: live appends chain the LOG only and leave the
1566
+ * anchor for finalize. Reading the final tail under the session lock means a
1567
+ * foreign line appended just before finalize (e.g. a `decision record` attached
1568
+ * to a still-running session) is included in the anchor, and a foreign attach
1569
+ * that arrives after the terminal status is set is rejected by the attach gate
1570
+ * — so the anchor can never disagree with the at-rest log. The whole-document
1571
+ * read-modify-write also preserves any field a foreign locked writer set (e.g.
1572
+ * a task attach's `task_id`).
1573
+ *
1574
+ * The anchor is written only when the log is actually chained with at least one
1575
+ * line; a legacy unchained session (and an empty log) is left with no
1576
+ * `integrity` anchor, matching the import writers. The mutator receives the
1577
+ * full {@link Session} document and typically sets
1578
+ * `session.session.status` / `ended_at` / `invocation.exit_code` /
1579
+ * `related_files`.
1580
+ *
1581
+ * Throws the {@link inspectChainTail} errors (torn / mixed log), the
1582
+ * {@link readSessionYaml} errors, a zod error if the mutation produces an
1583
+ * invalid document, or `Error("Failed to overwrite YAML file")` on a disk
1584
+ * failure.
1585
+ */
1586
+ declare function finalizeSessionYaml(paths: BasouPaths, sessionId: string, mutate: (session: Session) => void): Promise<void>;
1556
1587
  /**
1557
1588
  * Classify a `running` session as suspect using one of two rules:
1558
1589
  *
@@ -1680,6 +1711,86 @@ declare function chainEvents(events: ReadonlyArray<Event>, sessionId: string): C
1680
1711
  */
1681
1712
  declare function chainRawJsonLines(rawLines: ReadonlyArray<string>, sessionId: string): ChainedEvents;
1682
1713
 
1714
+ /**
1715
+ * The chain state of an existing `events.jsonl`, as needed by the live append
1716
+ * and finalize paths.
1717
+ *
1718
+ * - `chained` — whether the NEXT line written to this log must carry a
1719
+ * `prev_hash`. True for an empty / not-yet-created log (a fresh session
1720
+ * chains from its genesis) and for a log whose FIRST complete line already
1721
+ * carries `prev_hash`. False for a legacy / pre-feature log whose first line
1722
+ * is unchained (so it stays unchained — we never half-chain a file).
1723
+ * - `head` — the `prev_hash` value the next line carries when `chained`:
1724
+ * `genesisHash(sessionId)` for an empty log, otherwise `lineHash` of the LAST
1725
+ * complete line's raw bytes. Meaningless (set to the genesis hash) when
1726
+ * `chained` is false.
1727
+ * - `count` — number of complete (newline-terminated) lines on disk; the
1728
+ * `event_count` an integrity anchor records.
1729
+ */
1730
+ type ChainTailState = {
1731
+ chained: boolean;
1732
+ head: string;
1733
+ count: number;
1734
+ };
1735
+ /**
1736
+ * Inspect `<sessions>/<sessionId>/events.jsonl` to decide how the next append
1737
+ * (or the finalize anchor) must treat the chain. READ-ONLY; the caller MUST
1738
+ * already hold the session lock so the inspected tail cannot move underneath a
1739
+ * subsequent append.
1740
+ *
1741
+ * Chained-ness is decided from the FIRST complete line (does the log claim to
1742
+ * be chained), and the head pointer is taken from the LAST complete line. If
1743
+ * the first and last lines DISAGREE — a mixed / partially-tampered file — the
1744
+ * call THROWS rather than extending a broken chain; verify is the detector, the
1745
+ * writer must not deepen a break. An unterminated final line (a torn tail from
1746
+ * a crashed prior append) also THROWS so a new line is never glued onto a
1747
+ * fragment.
1748
+ *
1749
+ * Throws `Error("Failed to read events.jsonl")` for non-ENOENT I/O,
1750
+ * `Error("Unterminated final line in events.jsonl")` for a torn tail, and
1751
+ * `Error("events.jsonl is partially chained")` for a mixed first/last line.
1752
+ */
1753
+ declare function inspectChainTail(paths: BasouPaths, sessionId: string): Promise<ChainTailState>;
1754
+ /**
1755
+ * Append one event to `<sessions>/<sessionId>/events.jsonl`, threading the
1756
+ * tamper-evidence hash chain. The caller MUST already hold the session lock
1757
+ * (`acquireLock(paths, "session", sessionId)`); this function does NOT acquire
1758
+ * it, so it composes inside a larger caller-owned critical section (the
1759
+ * convention used by `decision record`, `session note`, task attach and
1760
+ * approval resolution) without re-entrant lock deadlock.
1761
+ *
1762
+ * The event is validated against {@link EventSchema}, then — if the existing
1763
+ * log is chained (or empty) — written with a `prev_hash` back-pointer derived
1764
+ * from the real on-disk tail (see {@link inspectChainTail}); a legacy unchained
1765
+ * log keeps receiving plain unchained lines. The single serializer
1766
+ * ({@link serializeEventLine}) is shared with the bulk writers so the bytes a
1767
+ * chain hashes can never diverge from another path's bytes.
1768
+ *
1769
+ * Does NOT touch `session.yaml.integrity`: the head anchor is written once, at
1770
+ * the terminal-status finalize, by {@link finalizeSessionYaml}. A still-live
1771
+ * session therefore has a chained log but no anchor yet, which `verify` reports
1772
+ * as the benign `in_progress`.
1773
+ *
1774
+ * Throws `"Invalid Basou event payload"` on validation failure, the
1775
+ * {@link inspectChainTail} errors on a torn / mixed log, or `"Failed to append
1776
+ * event to events.jsonl"` on a disk failure. The native error is attached as
1777
+ * `cause`.
1778
+ */
1779
+ declare function appendChainedEventLocked(paths: BasouPaths, sessionId: string, event: unknown): Promise<{
1780
+ chained: boolean;
1781
+ }>;
1782
+ /**
1783
+ * Self-locking wrapper around {@link appendChainedEventLocked} for callers that
1784
+ * do NOT already hold the session lock (the `exec` / `run` orchestrators, which
1785
+ * append one event at a time to a session they own). Acquires the session lock,
1786
+ * appends, and releases. Each append is a short-lived lock hold — the lock is
1787
+ * NEVER held across a child process — so a foreign attach can interleave safely
1788
+ * and the next append chains onto the true tail.
1789
+ */
1790
+ declare function appendChainedEvent(paths: BasouPaths, sessionId: string, event: unknown): Promise<{
1791
+ chained: boolean;
1792
+ }>;
1793
+
1683
1794
  /**
1684
1795
  * Append a single Basou event to `<sessionDir>/events.jsonl`.
1685
1796
  *
@@ -1688,10 +1799,13 @@ declare function chainRawJsonLines(rawLines: ReadonlyArray<string>, sessionId: s
1688
1799
  * Validation enforces the per-variant contract (required fields, source
1689
1800
  * vocabulary, strict variants such as `adapter_output`).
1690
1801
  *
1691
- * Appended lines are NOT hash-chained: chaining is exclusive to the bulk
1692
- * import writers ({@link writeEventsBulk} with `chain: true`), and imported
1693
- * sessions reject every append path, so a chained file never receives an
1694
- * unchained appended line.
1802
+ * This LOW-LEVEL writer does NOT hash-chain it writes the validated event as
1803
+ * a plain line. Hash-chained appends go through `appendChainedEvent` /
1804
+ * `appendChainedEventLocked` (the live `exec` / `run` / attach / approval
1805
+ * paths), and the bulk import writers chain via {@link writeEventsBulk} with
1806
+ * `chain: true`. A direct caller of this raw export can still add an unchained
1807
+ * line to a chained log; that is DETECTED by `basou verify`
1808
+ * (`missing_prev_hash`), not prevented — a documented boundary.
1695
1809
  *
1696
1810
  * Atomicity: writes go through `appendFile` which uses `O_APPEND`. Lines up
1697
1811
  * to `PIPE_BUF` bytes (Linux 4096 / macOS 512) are written atomically by the
@@ -1758,10 +1872,15 @@ declare function writeEventsBulk(sessionDir: string, events: Event[], options?:
1758
1872
  * (an import crashed between the events write and the yaml write, or the
1759
1873
  * yaml was deleted out of band). Benign: a re-import / `--force` repairs it.
1760
1874
  * - `tampered` — a real integrity break (see {@link ChainBreakReason}).
1875
+ * - `in_progress` — a chained log whose session is still LIVE (a non-terminal
1876
+ * status: initialized / running / waiting_approval). The internal
1877
+ * back-pointer chain is fully verified, but the tail and head anchor are
1878
+ * forgiven because a live session's log is legitimately still growing and its
1879
+ * anchor is not written until the terminal finalize. Informational, exit 0.
1761
1880
  * - `verified` — every back-pointer, genesis, session-id and line-discipline
1762
1881
  * check passed AND the head anchor matches the on-disk log.
1763
1882
  */
1764
- type ChainVerdictStatus = "verified" | "unchained" | "empty" | "incomplete" | "tampered";
1883
+ type ChainVerdictStatus = "verified" | "unchained" | "empty" | "incomplete" | "in_progress" | "tampered";
1765
1884
  /** Machine-readable detail for a `tampered` (or `incomplete`) verdict. */
1766
1885
  type ChainBreakReason =
1767
1886
  /** The file does not end with `\n`; chained writers always terminate the last line. */
@@ -1818,6 +1937,11 @@ type ChainVerdict = {
1818
1937
  * and finally the head anchor (`incomplete` when `session.yaml` is entirely
1819
1938
  * absent; `tampered` when it is present without a matching anchor).
1820
1939
  *
1940
+ * - When the chained log belongs to a LIVE session (a non-terminal status),
1941
+ * the internal chain is verified but a torn tail / absent / mismatching
1942
+ * anchor is FORGIVEN as `in_progress`: a live session's tail is legitimately
1943
+ * still growing and its anchor is written only at the terminal finalize.
1944
+ *
1821
1945
  * NON-CRYPTOGRAPHIC: the anchor lives in `session.yaml`, which is itself
1822
1946
  * editable; an attacker rewriting BOTH files consistently is not detected.
1823
1947
  * Signing is a follow-up.
@@ -1825,6 +1949,12 @@ type ChainVerdict = {
1825
1949
  * Throws `Error("Failed to read events.jsonl")` only for non-ENOENT I/O
1826
1950
  * failures (EACCES etc.) — an unreadable file is an environment problem, not
1827
1951
  * a verdict.
1952
+ *
1953
+ * READ-ONLY and lock-free: a session being finalized concurrently can leave the
1954
+ * two files momentarily out of step (old events read before a finalize, new
1955
+ * anchor read after it). A strict `anchor_mismatch` is therefore re-snapshotted
1956
+ * ONCE before being returned — a genuine mismatch is deterministic across the
1957
+ * retry, while a finalize-in-flight resolves within it.
1828
1958
  */
1829
1959
  declare function verifyEventsChain(paths: BasouPaths, sessionId: string): Promise<ChainVerdict>;
1830
1960
 
@@ -2006,8 +2136,8 @@ declare function isValidPrefixedId(value: string): boolean;
2006
2136
  * Self-edges are rejected so the audit trail stays monotonic.
2007
2137
  */
2008
2138
  declare const TaskStatusSchema: z.ZodEnum<{
2009
- planned: "planned";
2010
2139
  in_progress: "in_progress";
2140
+ planned: "planned";
2011
2141
  done: "done";
2012
2142
  cancelled: "cancelled";
2013
2143
  }>;
@@ -2027,8 +2157,8 @@ declare const TaskSchema: z.ZodObject<{
2027
2157
  title: z.ZodString;
2028
2158
  label: z.ZodOptional<z.ZodString>;
2029
2159
  status: z.ZodEnum<{
2030
- planned: "planned";
2031
2160
  in_progress: "in_progress";
2161
+ planned: "planned";
2032
2162
  done: "done";
2033
2163
  cancelled: "cancelled";
2034
2164
  }>;
@@ -3754,4 +3884,4 @@ declare function overwriteYamlFile(filePath: string, value: unknown): Promise<vo
3754
3884
  */
3755
3885
  declare const BASOU_CORE_VERSION = "0.1.0";
3756
3886
 
3757
- export { ACTIVE_GAP_CAP_MS, type ActiveTimeBasis, type AdapterOutputEvent, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, type ArchiveTaskInput, type ArchiveTaskResult, type AttachTaskInput, type AttachUpdateTaskStatusInput, type AttachableStatus, BASOU_CORE_VERSION, type BasouPaths, type BulkChainResult, CLAUDE_IMPORT_SOURCE, CODEX_IMPORT_SOURCE, type CaptureMode, type ChainBreakReason, type ChainVerdict, type ChainVerdictStatus, type ChainedEvents, ChildProcessRunner, type ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, FailedToFinalizeError, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type MeasureAvailability, type NoteAddedEvent, type PrefixedId, type ProcessRunner, type RechainOptions, type RechainResult, type ReconcileAllResult, type ReconcileAllTasksInput, type ReconcileAllTasksOptions, type ReconcileFailure, type ReconcileResult, type ReconcileTaskInput, type RefreshLinkageInput, type RefreshLinkageResult, type ReimportOptions, type ReimportResult, type ReplayOptions, type ReplayWarning, type RiskLevel, RiskLevelSchema, type RunOptions, type RunResult, STUCK_THRESHOLD_MS, type SanitizePathOptions, type SanitizeRelatedFilesResult, SchemaVersionSchema, type Session, type SessionEndedEvent, type SessionEntry, SessionIdSchema, type SessionImportPayload, SessionImportPayloadSchema, type SessionInnerImportInput, SessionInnerImportSchema, type SessionIntegrity, SessionIntegritySchema, type SessionMetrics, SessionMetricsSchema, SessionSchema, type SessionSkipReason, type SessionSourceKind, SessionSourceKindSchema, type SessionStartedEvent, type SessionStatus, type SessionStatusChangedEvent, SessionStatusSchema, type SessionWorkStats, type SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type SuspectReason, type Task, type TaskArchivedEvent, type TaskCreatedEvent, type TaskDeletedEvent, type TaskDocument, TaskIdSchema, type TaskLinkageRefreshedEvent, type TaskReconciledEvent, TaskSchema, type TaskSkipReason, type TaskStatus, type TaskStatusChangedEvent, TaskStatusSchema, TaskWriteAfterEventError, type TaskWriteAfterEventPhase, type TokenTotals, type UpdateAdHocTaskStatusInput, type UpdateTaskStatusInput, type UpdateTaskStatusResult, type WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildStatusSnapshot, chainEvents, chainRawJsonLines, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, findErrorCode, genesisHash, getDiff, getSnapshot, importSessionFromJson, isImportDerivedSource, isLazyExpired, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadSessionEntries, loadTaskEntries, overwriteYamlFile, parseDuration, parseMarkers, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, renderDecisions, renderHandoff, renderWithMarkers, replayEvents, resolveClaudeCodeCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, tryRemoteUrl, ulid, updateTaskStatusWithEvent, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };
3887
+ export { ACTIVE_GAP_CAP_MS, type ActiveTimeBasis, type AdapterOutputEvent, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, type ArchiveTaskInput, type ArchiveTaskResult, type AttachTaskInput, type AttachUpdateTaskStatusInput, type AttachableStatus, BASOU_CORE_VERSION, type BasouPaths, type BulkChainResult, CLAUDE_IMPORT_SOURCE, CODEX_IMPORT_SOURCE, type CaptureMode, type ChainBreakReason, type ChainTailState, type ChainVerdict, type ChainVerdictStatus, type ChainedEvents, ChildProcessRunner, type ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, FailedToFinalizeError, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type MeasureAvailability, type NoteAddedEvent, type PrefixedId, type ProcessRunner, type RechainOptions, type RechainResult, type ReconcileAllResult, type ReconcileAllTasksInput, type ReconcileAllTasksOptions, type ReconcileFailure, type ReconcileResult, type ReconcileTaskInput, type RefreshLinkageInput, type RefreshLinkageResult, type ReimportOptions, type ReimportResult, type ReplayOptions, type ReplayWarning, type RiskLevel, RiskLevelSchema, type RunOptions, type RunResult, STUCK_THRESHOLD_MS, type SanitizePathOptions, type SanitizeRelatedFilesResult, SchemaVersionSchema, type Session, type SessionEndedEvent, type SessionEntry, SessionIdSchema, type SessionImportPayload, SessionImportPayloadSchema, type SessionInnerImportInput, SessionInnerImportSchema, type SessionIntegrity, SessionIntegritySchema, type SessionMetrics, SessionMetricsSchema, SessionSchema, type SessionSkipReason, type SessionSourceKind, SessionSourceKindSchema, type SessionStartedEvent, type SessionStatus, type SessionStatusChangedEvent, SessionStatusSchema, type SessionWorkStats, type SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type SuspectReason, type Task, type TaskArchivedEvent, type TaskCreatedEvent, type TaskDeletedEvent, type TaskDocument, TaskIdSchema, type TaskLinkageRefreshedEvent, type TaskReconciledEvent, TaskSchema, type TaskSkipReason, type TaskStatus, type TaskStatusChangedEvent, TaskStatusSchema, TaskWriteAfterEventError, type TaskWriteAfterEventPhase, type TokenTotals, type UpdateAdHocTaskStatusInput, type UpdateTaskStatusInput, type UpdateTaskStatusResult, type WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendChainedEvent, appendChainedEventLocked, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildStatusSnapshot, chainEvents, chainRawJsonLines, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, finalizeSessionYaml, findErrorCode, genesisHash, getDiff, getSnapshot, importSessionFromJson, inspectChainTail, isImportDerivedSource, isLazyExpired, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadSessionEntries, loadTaskEntries, overwriteYamlFile, parseDuration, parseMarkers, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, renderDecisions, renderHandoff, renderWithMarkers, replayEvents, resolveClaudeCodeCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, tryRemoteUrl, ulid, updateTaskStatusWithEvent, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };