@sensigo/realm 0.25.0 → 0.27.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.
Files changed (45) hide show
  1. package/dist/engine/eligibility.d.ts +13 -0
  2. package/dist/engine/eligibility.d.ts.map +1 -1
  3. package/dist/engine/eligibility.js +20 -8
  4. package/dist/engine/eligibility.js.map +1 -1
  5. package/dist/engine/execution-loop.d.ts +13 -0
  6. package/dist/engine/execution-loop.d.ts.map +1 -1
  7. package/dist/engine/execution-loop.js +376 -45
  8. package/dist/engine/execution-loop.js.map +1 -1
  9. package/dist/engine/reclaim-step.d.ts.map +1 -1
  10. package/dist/engine/reclaim-step.js +198 -4
  11. package/dist/engine/reclaim-step.js.map +1 -1
  12. package/dist/engine/trace-adoption.d.ts +53 -0
  13. package/dist/engine/trace-adoption.d.ts.map +1 -0
  14. package/dist/engine/trace-adoption.js +49 -0
  15. package/dist/engine/trace-adoption.js.map +1 -0
  16. package/dist/index.d.ts +8 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +8 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/store/fs-io.d.ts +26 -0
  21. package/dist/store/fs-io.d.ts.map +1 -1
  22. package/dist/store/fs-io.js +37 -2
  23. package/dist/store/fs-io.js.map +1 -1
  24. package/dist/store/json-file-store.d.ts +7 -1
  25. package/dist/store/json-file-store.d.ts.map +1 -1
  26. package/dist/store/json-file-store.js +12 -5
  27. package/dist/store/json-file-store.js.map +1 -1
  28. package/dist/store/store-fidelity.d.ts +9 -0
  29. package/dist/store/store-fidelity.d.ts.map +1 -0
  30. package/dist/store/store-fidelity.js +10 -0
  31. package/dist/store/store-fidelity.js.map +1 -0
  32. package/dist/store/store-interface.d.ts +43 -0
  33. package/dist/store/store-interface.d.ts.map +1 -1
  34. package/dist/store/trace-buffer-store.d.ts +419 -7
  35. package/dist/store/trace-buffer-store.d.ts.map +1 -1
  36. package/dist/store/trace-buffer-store.js +401 -30
  37. package/dist/store/trace-buffer-store.js.map +1 -1
  38. package/dist/types/response-envelope.d.ts +20 -0
  39. package/dist/types/response-envelope.d.ts.map +1 -1
  40. package/dist/types/run-record.d.ts +33 -10
  41. package/dist/types/run-record.d.ts.map +1 -1
  42. package/dist/types/workflow-error.d.ts +1 -1
  43. package/dist/types/workflow-error.d.ts.map +1 -1
  44. package/dist/types/workflow-error.js.map +1 -1
  45. package/package.json +1 -1
@@ -1,5 +1,22 @@
1
1
  import type { RunRecord } from '../types/run-record.js';
2
2
  import type { WorkflowDefinition } from '../types/workflow-definition.js';
3
+ /**
4
+ * The load-bearing `RunRecord` fields whose ABSENCE the engine interprets (control flow / the
5
+ * drift-detection pillar) — a store that drops one silently corrupts behavior, so it must
6
+ * DECLARE which it round-trips (issue #188). This is a CLOSED set — only fields with a real,
7
+ * verified read-site consumer (see `RunStore.persistedRunRecordFields`'s own doc for the
8
+ * consumer list), not an open-ended "everything RunRecord might ever carry":
9
+ * - `capability_blocks` — read by `findCapabilityBlockedSteps` (capability.ts), which returns
10
+ * `[]` on `undefined`; a store that drops it makes a genuinely-blocked step silently look
11
+ * unblocked to `get_run_state` / `list` / `run-agent`.
12
+ * - `workflow_context_snapshots` — read by the execution loop's `=== undefined` branch, which
13
+ * re-snapshots when absent; a store that drops it loses snapshot HISTORY (current context
14
+ * self-heals via re-snapshot, but prior snapshots are gone).
15
+ * - `extension_identity` — read by the execution loop's drift-evidence append (issue #119) and
16
+ * `realm inspect --check-drift`; a store that drops it resets the drift baseline every
17
+ * execution, so drift can never accumulate or be detected.
18
+ */
19
+ export type LoadBearingRunRecordField = 'capability_blocks' | 'workflow_context_snapshots' | 'extension_identity';
3
20
  export interface CreateRunOptions {
4
21
  workflowId: string;
5
22
  workflowVersion: number;
@@ -34,6 +51,23 @@ export interface RunStore {
34
51
  * `claim_unknown_age` claim on a claims-persisting store.
35
52
  */
36
53
  persistsClaims: boolean;
54
+ /**
55
+ * Which {@link LoadBearingRunRecordField}s this store guarantees to round-trip through
56
+ * `create`/`update`/`get` (issue #188). OPTIONAL and FAIL-CLOSED: `undefined` (or a field
57
+ * absent from the declared set) means the engine must NOT assume the field's absence on a
58
+ * read is authoritative — it surfaces the gap honestly instead (see the runtime gates in
59
+ * `execution-loop.ts` and `get-run-state.ts`). A store that persists every `RunRecord` field
60
+ * it's given (the common case — `JsonFileStore` and the `@sensigo/realm-testing` in-memory
61
+ * store both do, by generic serialize/deserialize or by never dropping anything on write)
62
+ * declares the FULL set, which makes every gate dormant: zero behavior change.
63
+ *
64
+ * This is intentionally the inverse of a REQUIRED capability: the default (absent) is the
65
+ * CONSERVATIVE reading (assume nothing is persisted, warn accordingly), so adding this field
66
+ * cannot retroactively break an external implementer that predates it (cf. issue #169's
67
+ * "never make a capability required" precedent) — it only makes such a store's pre-existing
68
+ * silent field-drop finally visible.
69
+ */
70
+ readonly persistedRunRecordFields?: ReadonlySet<LoadBearingRunRecordField>;
37
71
  /**
38
72
  * Create a new run record, or — when an `idempotencyKey` is supplied and a run with the
39
73
  * same `(workflowId, idempotencyKey)` already exists — return that existing run instead.
@@ -69,6 +103,15 @@ export interface RunStore {
69
103
  * throws STATE_STEP_NOT_ELIGIBLE.
70
104
  * 4. Adds step to in_progress_steps, increments version, writes.
71
105
  * Returns the updated record.
106
+ *
107
+ * **Cross-cutting single-owner obligation (issue #188):** MUST be atomic and single-owner
108
+ * across ALL processes/hosts sharing this store: two concurrent `claimStep` calls for the
109
+ * same `(runId, step)` MUST NOT both succeed. A store that cannot guarantee this (e.g.
110
+ * without a row-lock/CAS) breaks both the resurrect-race protection (#184) and the
111
+ * trace-buffer epoch minting (#185). This obligation is stated here for any external store
112
+ * implementer; a store's own conformance suite must verify it holds across its actual
113
+ * concurrency model (the in-repo TCK's `claimStep` test only verifies the same-host case —
114
+ * see its own doc for why cross-host cannot be verified generically).
72
115
  */
73
116
  claimStep(runId: string, stepName: string, definition: WorkflowDefinition): Promise<RunRecord>;
74
117
  }
@@ -1 +1 @@
1
- {"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CAAC;IAE9C,+DAA+D;IAC/D,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEhD;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAChG"}
@@ -1,24 +1,156 @@
1
1
  import type { AgentTraceEntry } from '../types/run-record.js';
2
+ import { WorkflowError } from '../types/workflow-error.js';
3
+ /**
4
+ * The store-layer capability ladder (issue #197 PR-1, design record `plans/issue-197-design.md`
5
+ * §3). Implication runs **upward-requires-downward ONLY**: `writer_nonce_carriage` requires
6
+ * `seal`; `seal` requires the fenced trio (issue #207). **The fenced trio ALONE stays fully
7
+ * legal** — a store declaring neither rung is still a fully conforming implementation (the
8
+ * shipped realm-cloud Postgres state; non-seal trio stores keep the #207 destructive-drain
9
+ * posture forever, not a transitional gap). `TraceBufferStore.traceCapabilities` below is the
10
+ * declaration; `storeDeclaresSeal`/`storeDeclaresNonceCarriage`/`validateTraceCapabilities`
11
+ * (this file) are the ONLY authoritative way to check a rung — no ad-hoc `typeof` checks for
12
+ * these two rungs anywhere else in the codebase (TCK, tools, or engine).
13
+ */
14
+ export type TraceCapability = 'seal' | 'writer_nonce_carriage';
15
+ /** Outcome of `sealFenced` (issue #197 PR-1, the `seal` rung — see `TraceBufferStore.sealFenced`
16
+ * for the full contract). */
17
+ export type SealResult = {
18
+ sealed: true;
19
+ } | {
20
+ sealed: false;
21
+ /** `'absent'`: no live WAL existed for (runId, stepId) at all — #183 absence-is-success,
22
+ * not a failure. `'capped'`: this key already holds `SEALED_ARTIFACTS_LIMIT_PER_STEP`
23
+ * sealed artifacts — the caller must fall back to the existing destructive drain (bounded,
24
+ * loud, never silent eviction of a sealed artifact to make room). */
25
+ reason: 'absent' | 'capped';
26
+ };
27
+ /**
28
+ * One line of a WAL, as read back — live or sealed (issue #197 PR-1). Defined in CORE, not
29
+ * mcp-server (where the fs store's own file-local `WalLine` type lives), because
30
+ * `listSealedForRun`'s return type must be usable without any core-adjacent caller importing an
31
+ * mcp-server-local type. The fs store's `WalLine` gains the identical optional `nonce` field and
32
+ * stays structurally assignable to this type (never a separate, divergent shape).
33
+ */
34
+ export interface SealedWalLine {
35
+ ts: number;
36
+ entries: AgentTraceEntry[];
37
+ /** The writer nonce active when this line was appended, if any (issue #197 PR-1) — absent for
38
+ * a bare/anonymous append. NEVER fabricated for a line that was genuinely bare. */
39
+ nonce?: string;
40
+ }
41
+ /** One sealed artifact for a single (runId, stepId) key — issue #197 PR-1, part of the `seal`
42
+ * rung. A key may accumulate several sealed artifacts (repeated reclaim/settle-time seals),
43
+ * distinguished by ascending `seq`. */
44
+ export interface SealedArtifact {
45
+ step_id: string;
46
+ /** Ascending, per-key sequence number (0-based) — distinguishes repeated seals of the same
47
+ * (runId, stepId) key from one another. */
48
+ seq: number;
49
+ lines: SealedWalLine[];
50
+ }
51
+ /**
52
+ * Structured `BUFFER_FULL` refusal detail shape (issue #197 PR-1, design §5) — every
53
+ * `TraceBufferStore.append`/`appendFenced` implementation populates this as the thrown
54
+ * `WorkflowError`'s `details`. `scope` names which budget bound the refusal: `'writer'` (this
55
+ * call's own writer — the nonce that made it, or ⊥ for a bare call — exceeded its per-writer
56
+ * `BUFFER_LIMIT_COUNT`/`BUFFER_LIMIT_BYTES` share) or `'file'` (the whole-file, all-writers-combined
57
+ * `BUFFER_BACKSTOP_COUNT`/`BUFFER_BACKSTOP_BYTES` ceiling). `binding_dimension` names which of the
58
+ * two triples actually caused the refusal — `count`/`bytes` are ALWAYS both populated (a caller
59
+ * can see the whole picture, not just the half that bound). `your_*`/`total_*` (file scope only)
60
+ * are the occupancy evidence: this writer's own share vs. the whole file's combined share —
61
+ * foreign share is stated as an observable FACT; crash causation for that foreign residue is
62
+ * NEVER asserted (design §5's corrected message framing — a foreign writer's residue might be a
63
+ * live concurrent step, not a crash).
64
+ */
65
+ export interface BufferFullDetails {
66
+ scope: 'writer' | 'file';
67
+ binding_dimension: 'count' | 'bytes';
68
+ count: {
69
+ requested: number;
70
+ used: number;
71
+ limit: number;
72
+ };
73
+ bytes: {
74
+ requested: number;
75
+ used: number;
76
+ limit: number;
77
+ };
78
+ your_count?: number;
79
+ your_bytes?: number;
80
+ total_count?: number;
81
+ total_bytes?: number;
82
+ }
2
83
  export interface AppendResult {
84
+ /**
85
+ * WRITER-scope numbers (issue #197 PR-1 re-documentation — values and meaning UNCHANGED for
86
+ * bare-only traffic, the compat law, design §5): this call's own writer (the nonce that made
87
+ * it, or ⊥ for a bare call) against the per-writer `BUFFER_LIMIT_COUNT`/`BUFFER_LIMIT_BYTES`
88
+ * ceiling. An all-bare WAL has exactly one writer (⊥), so writer-scope and file-scope coincide
89
+ * there and these fields are numerically IDENTICAL to before this capability existed.
90
+ */
3
91
  buffer_count: number;
4
92
  buffer_bytes: number;
5
93
  limit_count: number;
6
94
  limit_bytes: number;
7
95
  final_limit_entries: number;
8
96
  final_limit_bytes: number;
97
+ /**
98
+ * Whole-FILE scope numbers (issue #197 PR-1, additive) — populated ONLY by a store that
99
+ * declares `writer_nonce_carriage` (a non-declaring store never sets these; they stay
100
+ * `undefined`, never fabricated as `0`). Ride the new `BUFFER_BACKSTOP_COUNT`/
101
+ * `BUFFER_BACKSTOP_BYTES` ceiling — combined usage across every writer sharing this key.
102
+ */
103
+ file_count?: number;
104
+ file_limit_count?: number;
105
+ file_bytes?: number;
106
+ file_limit_bytes?: number;
107
+ }
108
+ /**
109
+ * Optional trailing options bag for `append`/`appendFenced` (issue #197 PR-1, the
110
+ * `writer_nonce_carriage` rung). Declaration-only: adding this parameter is NOT a separate
111
+ * method-presence check in `storeDeclaresNonceCarriage` (there is no way to detect "did this
112
+ * store implementation read the options bag" other than declared capability + behavior) — a
113
+ * non-declaring implementation is contractually required to IGNORE it, never throw or otherwise
114
+ * error on receiving one; the tool layer (PR-2) is responsible for never passing a nonce to a
115
+ * non-declaring store.
116
+ */
117
+ export interface AppendOptions {
118
+ /** Client-minted, opaque per-step-attempt writer identity. Absent ⇒ the bare/anonymous writer
119
+ * class (⊥) — today's behavior, byte-identical. NEVER validated/shaped by the store itself
120
+ * (opaque string, store-agnostic) — protocol-level shape validation is a PR-2/tool-layer
121
+ * concern (design §6). */
122
+ writerNonce?: string;
9
123
  }
10
124
  export interface TraceBufferStore {
125
+ /**
126
+ * Declares which of the two optional capability-ladder rungs (issue #197 PR-1) this store
127
+ * implements: `'seal'` and/or `'writer_nonce_carriage'`. See `TraceCapability`'s own doc for
128
+ * the ladder rule (carriage requires seal requires the fenced trio; trio alone stays legal).
129
+ *
130
+ * **Immutability**: this set MUST NOT change after construction — a reader may read it once and
131
+ * cache the result forever (the TCK's STRUCTURAL law asserts two reads are content-identical).
132
+ *
133
+ * **Authoritative only in conjunction with method presence**: a declared rung whose required
134
+ * methods are NOT actually present (or vice versa) is a construction-time defect, not a runtime
135
+ * condition — see `validateTraceCapabilities`. Absent entirely (`undefined`) is equivalent to
136
+ * declaring neither rung (the honest floor — trio-alone, or no fenced trio at all, both legal).
137
+ */
138
+ readonly traceCapabilities?: ReadonlySet<TraceCapability>;
11
139
  /**
12
140
  * Appends normalized entries to the buffer for (runId, stepId).
13
141
  * Each entry is per-entry normalized at append time (reserved prefix drop, field caps).
14
142
  * Batch timestamp (_internalTs) is assigned at write time.
15
- * Throws BUFFER_FULL WorkflowError if the WAL limit would be exceeded.
143
+ * Throws BUFFER_FULL WorkflowError if the WAL limit would be exceeded (issue #197 PR-1: see
144
+ * `BufferFullDetails` for the refusal's structured `details` shape).
145
+ *
146
+ * @param options Optional trailing options bag (issue #197 PR-1) — see `AppendOptions`.
16
147
  */
17
- append(runId: string, stepId: string, entries: AgentTraceEntry[]): Promise<AppendResult>;
148
+ append(runId: string, stepId: string, entries: AgentTraceEntry[], options?: AppendOptions): Promise<AppendResult>;
18
149
  /**
19
150
  * Reads all buffered entries for (runId, stepId) with their batch timestamps attached.
20
151
  * Returns empty array if no buffer exists.
21
- * Entries carry _internalTs for ordering at finalization.
152
+ * Entries carry _internalTs for ordering at finalization, and (issue #197 PR-1) an optional
153
+ * `_nonce` re-attached from the line that carried them — see `BufferedEntry._nonce`.
22
154
  */
23
155
  read(runId: string, stepId: string): Promise<BufferedEntry[]>;
24
156
  /** Deletes the buffer for (runId, stepId). No-op if absent. */
@@ -39,34 +171,314 @@ export interface TraceBufferStore {
39
171
  * Never mutates; never throws on a missing run (an absent run/store location is just `{}`).
40
172
  */
41
173
  readAllForRun(runId: string): Promise<Record<string, unknown[]>>;
174
+ /**
175
+ * **The fenced trio (issue #207).** `appendFenced`, `deleteFenced`, and `deleteAllForRunFenced`
176
+ * are an ALL-OR-NOTHING optional capability: declaring ANY of the three requires declaring ALL
177
+ * THREE (the TCK's STRUCTURAL law enforces this deterministically). Declaring the trio is also
178
+ * a commitment that `read()`, `delete()`, and `deleteAllForRun()` serialize on the SAME
179
+ * per-(runId, stepId) critical sections the fenced methods use — a store that declares the trio
180
+ * but lets a legacy `read()`/`delete()`/`deleteAllForRun()` call bypass those critical sections
181
+ * has not actually implemented the capability.
182
+ *
183
+ * Guard contract, shared by all three methods:
184
+ * - `guard` is invoked at least once per call. Implementations MAY retry internally — every TCK
185
+ * assertion about guard invocation is count-TOLERANT ("at least one"), never an exact count.
186
+ * - ALL guard invocations complete BEFORE the method's destructive/mutating effect (the write
187
+ * for `appendFenced`; the delete for `deleteFenced`/`deleteAllForRunFenced`).
188
+ * - `guard` performs exactly one lock-free `runStore.get` read (the #132 atomic-rename-safe
189
+ * read) — never more than one, and never a locked read.
190
+ * - `guard` never acquires a lock of its own. Global lock-ordering rule: a WAL critical-section
191
+ * holder must never acquire the run-file lock, and a run-file-lock holder must never acquire a
192
+ * WAL lock — callers that touch both (e.g. purge) always delete artifacts strictly BEFORE
193
+ * their run-locked anchor delete, never the other way around.
194
+ * - A guard rejection propagates to the caller UNWRAPPED — the method performs no write/delete,
195
+ * and the store's own error-wrapping (e.g. `toArtifactDeleteFailedError`) never touches it.
196
+ *
197
+ * Two-obligation form for a transaction-scoped store that enforces the race via a native SQL
198
+ * predicate instead of an in-process critical section (`fenceForm: 'native-predicate'` in the
199
+ * TCK): (1) `guard` is still invoked at least once per call, but MAY run outside the store's
200
+ * atomic section — it must never `await` foreign code while holding a transaction/row lock, and
201
+ * must never open a second pooled connection while the first is held. (2) The actual racing
202
+ * predicate must be enforced by a CONFLICT-INDUCING read in the SAME transaction as the
203
+ * buffer write (e.g. `SELECT ... FOR SHARE` at minimum — a plain same-transaction `WHERE` under
204
+ * READ COMMITTED is insufficient; it is vulnerable to statement-snapshot staleness). **A
205
+ * native-predicate store's race closure is NOT verified by a green TCK run** — the latch-based
206
+ * laws (`CS_OCCUPANCY`, `PER_KEY_INDEPENDENCE`, `NO_SILENT_LOSS`) produce an explicit, visible
207
+ * documented skip for such a store, never a silent pass; that store's OWN in-transaction fencing
208
+ * suite is what must verify race closure (the same posture `RunStore.claimStep`'s cross-host
209
+ * obligation already states for `CLAIM_SINGLE_OWNER`, issue #188).
210
+ *
211
+ * Legacy `append`/`delete`/`deleteAllForRun` remain on the interface, byte-frozen, for any store
212
+ * that does not declare the fenced trio.
213
+ */
214
+ appendFenced?(runId: string, stepId: string, entries: AgentTraceEntry[], guard: () => Promise<void>, options?: AppendOptions): Promise<AppendResult>;
215
+ /**
216
+ * See `appendFenced`'s doc (above) for the shared guard contract and the all-or-nothing
217
+ * declaration rule. Runs `guard` inside the SAME per-(runId, stepId) critical section
218
+ * `appendFenced` uses, immediately before deleting the buffer. Returns the number of entries
219
+ * actually deleted — `0` means the buffer was already absent (absence is success; the guard
220
+ * still runs first, and still gates the no-op). This same-critical-section count is what lets a
221
+ * caller (e.g. reclaim) report how many entries a destructive drain actually destroyed without a
222
+ * separate, lock-re-entrant `read()` call — a store's own critical section must never be
223
+ * re-entered from within itself.
224
+ */
225
+ deleteFenced?(runId: string, stepId: string, guard: () => Promise<void>): Promise<number>;
226
+ /**
227
+ * See `appendFenced`'s doc (above) for the shared guard contract and the all-or-nothing
228
+ * declaration rule. Deletes every buffer for `runId` across all steps. `guard` is RE-INVOKED
229
+ * inside EACH per-file (per-(runId, stepId)) critical section, immediately before that file's
230
+ * delete — a refusal on any one file aborts the whole sweep with that file's error
231
+ * (stop-on-first-error, matching the legacy `deleteAllForRun`'s own semantics). When zero files
232
+ * match `runId` at all, `guard` is still consulted at least once — the scan (resolving which
233
+ * files match) necessarily runs first, then the guard is invoked at least once even for that
234
+ * empty result. If it throws, the sweep rejects with that error exactly as it would for a
235
+ * non-empty sweep — propagation is UNIFORM across the zero-match and non-empty cases (the TCK
236
+ * asserts rejection here, not merely invocation count: a refusing guard makes even a zero-match
237
+ * sweep reject). A guard rejection (e.g. a
238
+ * typed `STATE_RUN_BUSY`) propagates to the caller UNWRAPPED, past the store's own
239
+ * `toArtifactDeleteFailedError` wrapping — which still wraps genuine unlink/I-O failures,
240
+ * preserving the #183 absence/unreachable/corrupt trichotomy: a guard refusal is neither
241
+ * "absent" nor a genuine I/O failure, it is a third, distinct outcome that must reach the caller
242
+ * exactly as the guard threw it.
243
+ *
244
+ * @param dirEntries Optional pre-scanned directory listing (see the legacy method's own doc) —
245
+ * ignored by non-fs implementations.
246
+ */
247
+ deleteAllForRunFenced?(runId: string, guard: () => Promise<void>, dirEntries?: readonly string[]): Promise<void>;
248
+ /**
249
+ * **`sealFenced` (issue #197 PR-1, the `seal` rung — design §4).** Atomically retires the
250
+ * ENTIRE live WAL for (runId, stepId) to a sealed artifact, under the SAME per-key critical
251
+ * section the fenced trio uses. `guard` runs IN-CS, immediately BEFORE the move (same guard
252
+ * contract as the trio: at-least-once invocation, completes before the mutating effect, exactly
253
+ * one lock-free `runStore.get`, never acquires its own lock, a rejection propagates UNWRAPPED —
254
+ * nothing is moved).
255
+ *
256
+ * Semantics:
257
+ * - Absent live WAL ⇒ `{sealed: false, reason: 'absent'}` — #183 absence-is-success, not an
258
+ * error.
259
+ * - This key already at the per-key seal-budget cap (`SEALED_ARTIFACTS_LIMIT_PER_STEP`) ⇒
260
+ * `{sealed: false, reason: 'capped'}` — the caller falls back to the existing destructive
261
+ * drain (`deleteFenced`); bounded, loud, never a silent eviction of an existing sealed
262
+ * artifact to make room.
263
+ * - Otherwise ⇒ raw bytes move VERBATIM to the sealed artifact — no parse, no copy, no
264
+ * truncation, no dedup. A torn/corrupt trailing line moves as bytes too (readers of the
265
+ * sealed artifact skip + warn on it, mirroring the live WAL reader's own #183 corruption
266
+ * posture) ⇒ `{sealed: true}`.
267
+ * - Any OTHER I/O errno (not absence) ⇒ a typed throw (#183) — the caller warns; this is
268
+ * residue-not-loss (the live WAL is left exactly as it was; nothing moved).
269
+ *
270
+ * A store implements this ONLY as part of declaring the `seal` rung (`storeDeclaresSeal`) —
271
+ * requires the full fenced trio to already be declared (the ladder).
272
+ */
273
+ sealFenced?(runId: string, stepId: string, guard: () => Promise<void>): Promise<SealResult>;
274
+ /**
275
+ * **`listSealedForRun` (issue #197 PR-1, part of the `seal` rung — design §4).** Returns every
276
+ * sealed artifact for `runId`, across all steps — descriptors plus their parsed lines
277
+ * (torn-tolerant: a corrupt line inside a sealed artifact is skipped + a loud warning emitted,
278
+ * mirroring the live WAL reader's own discipline; the corrupt bytes stay on disk untouched).
279
+ * Absence of any sealed artifacts for this run ⇒ `[]`, never a throw. Lock-free, point-in-time
280
+ * (mirrors `readAllForRun`'s own posture, issue #159) — never mutates.
281
+ */
282
+ listSealedForRun?(runId: string): Promise<SealedArtifact[]>;
42
283
  }
43
- /** An AgentTraceEntry extended with engine-assigned ordering timestamp (milliseconds). */
284
+ /** An AgentTraceEntry extended with engine-assigned ordering timestamp (milliseconds), and
285
+ * (issue #197 PR-1) the writer nonce that carried it, if any — re-attached from the line the
286
+ * entry was originally appended in. NEVER fabricated for a genuinely bare line. */
44
287
  export interface BufferedEntry extends AgentTraceEntry {
45
288
  _internalTs: number;
289
+ _nonce?: string;
46
290
  }
291
+ /** PER-WRITER budget (issue #197 PR-1 re-documentation — value unchanged): the ceiling for ONE
292
+ * writer's own share of a (runId, stepId) buffer — the nonce that made the call, or ⊥ (the
293
+ * bare/anonymous writer class) for a call with no nonce. An all-bare WAL has exactly one writer
294
+ * (⊥), so this is the ONLY ceiling that can ever bind there — byte-identity with pre-#197
295
+ * behavior is emergent from that fact, not a special case. */
47
296
  export declare const BUFFER_LIMIT_COUNT = 200;
297
+ /** See `BUFFER_LIMIT_COUNT` — the per-writer BYTE ceiling. */
48
298
  export declare const BUFFER_LIMIT_BYTES: number;
49
299
  export declare const FINAL_LIMIT_ENTRIES = 100;
50
300
  export declare const FINAL_LIMIT_BYTES: number;
301
+ /** Whole-FILE backstop (issue #197 PR-1, additive, design §5): the ceiling across EVERY writer
302
+ * sharing a (runId, stepId) key combined, regardless of nonce — 2× the per-writer ceiling.
303
+ * Unconditional: enforced even on a store that hasn't seen a single nonced append, though it is
304
+ * UNREACHABLE in the all-bare case (the lone writer ⊥ already refuses at the per-writer ceiling,
305
+ * which is half the backstop — the backstop only ever binds when at least one OTHER writer's
306
+ * residue is sharing the file). */
307
+ export declare const BUFFER_BACKSTOP_COUNT: number;
308
+ /** See `BUFFER_BACKSTOP_COUNT` — the whole-file BYTE backstop. */
309
+ export declare const BUFFER_BACKSTOP_BYTES: number;
310
+ /** Per-(runId, stepId) seal budget (issue #197 PR-1, the `seal` rung, design §4): the maximum
311
+ * number of sealed artifacts one key may accumulate. On reaching the cap, `sealFenced` returns
312
+ * `{sealed: false, reason: 'capped'}` — the caller falls back to the existing destructive drain
313
+ * (`deleteFenced`), bounded and loud, rather than silently evicting an existing sealed artifact
314
+ * to make room. */
315
+ export declare const SEALED_ARTIFACTS_LIMIT_PER_STEP = 8;
51
316
  /**
52
317
  * Per-entry normalization run at append time (not at finalization).
53
318
  * Mirrors the normalization in normalizeTrace for the parts that don't need seq or byte-budget context.
54
319
  * Returns null if the entry should be dropped (reserved prefix).
55
320
  */
56
321
  export declare function normalizeEntryForBuffer(entry: AgentTraceEntry): AgentTraceEntry | null;
322
+ /**
323
+ * True iff `store` both DECLARES the `seal` rung (in `traceCapabilities`) AND actually implements
324
+ * every method that rung requires: the full fenced trio (`appendFenced`/`deleteFenced`/
325
+ * `deleteAllForRunFenced`, issue #207) PLUS `sealFenced` PLUS `listSealedForRun` (the ladder: seal
326
+ * requires the trio). This is the ONLY authoritative `seal` predicate.
327
+ */
328
+ export declare function storeDeclaresSeal(store: TraceBufferStore): boolean;
329
+ /**
330
+ * True iff `store` both DECLARES `writer_nonce_carriage` (in `traceCapabilities`) AND satisfies
331
+ * `storeDeclaresSeal` (the ladder: carriage requires seal requires the trio). Carriage itself
332
+ * adds no NEW required method — the `options` bag on `append`/`appendFenced` is declaration-only
333
+ * (there is no way to detect "does this implementation actually read the options bag" other than
334
+ * declared capability + behavior), so this predicate is exactly "declared AND seal holds". This
335
+ * is the ONLY authoritative `writer_nonce_carriage` predicate.
336
+ */
337
+ export declare function storeDeclaresNonceCarriage(store: TraceBufferStore): boolean;
338
+ /**
339
+ * Wiring-time validation MECHANISM (issue #197 PR-1, design §3/§12 — INVOKING this at the
340
+ * injection seams, e.g. `server.ts`/CLI executors, is deliberately PR-2's job, not this one's).
341
+ * Typed fail-loud (a `TRACE_CAPABILITY_INCONSISTENT` `WorkflowError`) when a rung is DECLARED but
342
+ * its predicate does not hold (declared-but-inconsistent — a construction-time wiring defect,
343
+ * never a runtime condition worth retrying). Silent success when a rung is simply undeclared —
344
+ * the honest floor: trio-alone, or no capabilities at all, are both fully legal and never an
345
+ * error.
346
+ */
347
+ export declare function validateTraceCapabilities(store: TraceBufferStore): void;
348
+ /**
349
+ * Pure per-writer + whole-file budget decision (issue #197 PR-1, design §5) — shared by every
350
+ * `TraceBufferStore` implementation enforcing this pair, so the decision logic and the
351
+ * `BufferFullDetails` shape live in exactly ONE place rather than being independently
352
+ * (and riskily divergently) reimplemented per store. Deliberately takes BEFORE-and-AFTER pairs
353
+ * (rather than a "delta" this call would add) because the two shipped stores compute "after"
354
+ * differently and both must stay exact: the fs store's JSONL format is genuinely additive (byte
355
+ * delta = the one new line's own serialized size), but the in-memory store's byte-identity
356
+ * constraint requires re-serializing the WHOLE flattened array exactly as its pre-#197 formula
357
+ * always did — forcing a shared "delta" abstraction on top of that would risk being byte-inexact
358
+ * for one of the two stores. Returns `undefined` when neither ceiling would be exceeded.
359
+ *
360
+ * Writer scope is checked FIRST: if the appender's own share alone would exceed the per-writer
361
+ * ceiling, that is what gets reported — a caller whose own share already exceeds the (smaller)
362
+ * per-writer ceiling should be told that specifically, not the (less actionable, and in that
363
+ * case also necessarily true) whole-file ceiling. This ordering is also what makes the compat
364
+ * law hold: an all-bare file's lone writer (⊥) hits `scope:'writer'` at exactly today's legacy
365
+ * limits — the file backstop (2×) is arithmetically unreachable for a single writer alone.
366
+ */
367
+ export declare function checkBufferBudget(params: {
368
+ writerCountBefore: number;
369
+ writerBytesBefore: number;
370
+ writerCountAfter: number;
371
+ writerBytesAfter: number;
372
+ fileCountBefore: number;
373
+ fileBytesBefore: number;
374
+ fileCountAfter: number;
375
+ fileBytesAfter: number;
376
+ }): BufferFullDetails | undefined;
377
+ /**
378
+ * Builds the `BUFFER_FULL` `WorkflowError` from a `BufferFullDetails` (issue #197 PR-1, design
379
+ * §5) — the SAME message wording, error code, category, and `agentAction` every store uses, so
380
+ * the only thing that ever varies between stores is which concrete numbers went into `details`.
381
+ * Guidance wording is deliberate: foreign share (file scope's `your_*`/`total_*`) is stated as an
382
+ * observable FACT; crash causation for that foreign residue is NEVER asserted (design §5's
383
+ * corrected framing — foreign residue might be a live concurrent writer, not a crash). Code stays
384
+ * `BUFFER_FULL`, category `ENGINE`, `agentAction: 'provide_input'` — unchanged from before this
385
+ * capability existed.
386
+ */
387
+ export declare function bufferFullError(details: BufferFullDetails): WorkflowError;
388
+ /**
389
+ * Flattens WAL batches (`{ts, entries, nonce?}`, issue #197 PR-1's internal batch shape — see
390
+ * `SealedWalLine`) into the read-back `BufferedEntry[]` shape, in batch order: `_internalTs` from
391
+ * the batch's `ts`; `_nonce` re-attached ONLY when the batch actually carried one (never
392
+ * fabricated for a bare batch — the key byte-identity property: a flattened all-bare batch list
393
+ * produces EXACTLY the same shape/bytes as the pre-#197 flat representation always did).
394
+ */
395
+ export declare function flattenWalBatches(batches: readonly SealedWalLine[]): BufferedEntry[];
57
396
  /**
58
397
  * In-memory TraceBufferStore for use in tests and non-persistent environments.
59
398
  * Entries are lost on process restart (no file I/O).
399
+ *
400
+ * Declares the fenced trio (issue #207): `append`, `read`, `delete`, and `deleteAllForRun` all
401
+ * serialize on the SAME per-(runId, stepId) critical section `appendFenced`/`deleteFenced` use,
402
+ * via a per-key async mutex (a promise-chain map) — every one of the operations for a given key
403
+ * runs strictly after the previous operation on THAT SAME key has settled (success or failure).
404
+ * Liveness posture: a hung guard hangs only that key's chain — a different key's chain is
405
+ * untouched and proceeds normally (this per-key granularity is load-bearing; see the TCK's
406
+ * PER_KEY_INDEPENDENCE law). The chain map's entry for a key is deleted once its own tail
407
+ * settles and no newer call has chained after it, so an idle key holds no Map entry (no leak).
408
+ *
409
+ * Issue #197 PR-1 additionally declares BOTH capability-ladder rungs (`seal` and
410
+ * `writer_nonce_carriage`, `traceCapabilities`). The live-WAL internal representation is
411
+ * BATCH-preserving (`Map<string, SealedWalLine[]>`, one entry per `append`/`appendFenced` call) —
412
+ * NOT flattened — because `sealFenced` must be able to retire a key's exact batch history as one
413
+ * unit, and each batch's own (possibly absent) writer nonce must survive independently for
414
+ * carriage/budget partitioning. Every flattening surface (`read`, `readAllForRun`, `deleteFenced`'s
415
+ * count, the byte-budget arithmetic) derives its answer from this representation via
416
+ * `flattenWalBatches` (or direct batch arithmetic over it), reproducing the exact pre-#197
417
+ * observable shape and byte formula for all-bare traffic — see `appendUnlocked`.
60
418
  */
61
419
  export declare class InMemoryTraceBufferStore implements TraceBufferStore {
420
+ readonly traceCapabilities: ReadonlySet<TraceCapability>;
62
421
  private buffers;
422
+ private sealed;
423
+ private chains;
63
424
  private key;
64
- append(runId: string, stepId: string, entries: AgentTraceEntry[]): Promise<AppendResult>;
425
+ /**
426
+ * Runs `fn` strictly after the current tail of the per-key chain for `k` has settled (whether
427
+ * that prior link resolved or rejected), and installs `fn`'s own settlement as the new tail.
428
+ * Returns/throws `fn`'s real result — chain-tracking never swallows or reshapes it. Removes the
429
+ * map entry for `k` once this call's tail settles, but only if no NEWER call has since replaced
430
+ * it (an identity check against the exact promise reference this call stored).
431
+ */
432
+ private withKeyLock;
433
+ /**
434
+ * Count + bytes for exactly the batches belonging to `writerNonce` (`undefined` = ⊥, the bare
435
+ * writer class) — computed by flattening JUST that writer's own batches and re-stringifying,
436
+ * so the byte number for a single-writer (all-bare) file is bit-for-bit the old whole-array
437
+ * formula. Equality is plain `===` over `batch.nonce ?? undefined`, which implements the
438
+ * design's `adopted(line) ⇔ line.nonce ≡ claimant.nonce, with absent ≡ absent` rule with no
439
+ * special-casing (`undefined === undefined` is `true`).
440
+ */
441
+ private partitionStats;
442
+ /** Whole-file count + bytes across every writer combined — the pre-#197 formula, applied to
443
+ * the full batch list regardless of how many distinct writers contributed to it. */
444
+ private fileStats;
445
+ private appendUnlocked;
446
+ append(runId: string, stepId: string, entries: AgentTraceEntry[], options?: AppendOptions): Promise<AppendResult>;
447
+ /** guard runs INSIDE the per-key critical section, immediately before the write — see the
448
+ * interface doc for the full guard contract. */
449
+ appendFenced(runId: string, stepId: string, entries: AgentTraceEntry[], guard: () => Promise<void>, options?: AppendOptions): Promise<AppendResult>;
65
450
  read(runId: string, stepId: string): Promise<BufferedEntry[]>;
66
451
  delete(runId: string, stepId: string): Promise<void>;
452
+ /** guard runs INSIDE the same per-key critical section `appendFenced` uses, immediately before
453
+ * the delete — see the interface doc for the full guard contract. Returns the number of
454
+ * entries actually deleted, summed across every live batch (0 = buffer already absent; the
455
+ * guard still ran first). Sealed artifacts for this key are NOT touched — sealing exists
456
+ * precisely to move content out of this destructive drain's reach; only `deleteAllForRun*`
457
+ * (run-level bulk delete) also retires sealed artifacts. */
458
+ deleteFenced(runId: string, stepId: string, guard: () => Promise<void>): Promise<number>;
67
459
  deleteAllForRun(runId: string, _dirEntries?: readonly string[]): Promise<void>;
68
- /** Returns each in-memory buffer for the run, keyed by stepId, as its stored `BufferedEntry[]`
69
- * (already-flattened individual entriesthis store's own natural shape; see `append`). */
460
+ /** guard is RE-INVOKED inside EACH per-(runId, stepId) critical section, immediately before
461
+ * that key's deletesee the interface doc for the full guard contract, including the
462
+ * zero-match-sweep invocation requirement (handled below: the guard still runs at least once
463
+ * even when this run has no buffers at all). Sealed artifacts join this run-level bulk delete
464
+ * (design §4 — a sealed artifact is retained ONLY until its owning run itself is purged). */
465
+ deleteAllForRunFenced(runId: string, guard: () => Promise<void>, _dirEntries?: readonly string[]): Promise<void>;
466
+ /** guard runs INSIDE the per-key critical section, immediately before the seal-move — see the
467
+ * interface doc for the full contract. Atomically retires the ENTIRE live batch history for
468
+ * (runId, stepId) into a new sealed artifact (ascending `seq`), clearing the live buffer in
469
+ * the same step — the in-memory analogue of the fs store's no-clobber rename-based seal
470
+ * (there is no filesystem race to guard against here; the per-key mutex already serializes
471
+ * every operation on this key, so `seq` can simply be the next array index). */
472
+ sealFenced(runId: string, stepId: string, guard: () => Promise<void>): Promise<SealResult>;
473
+ /** Lock-free point-in-time snapshot of every sealed artifact for a run, across all its steps —
474
+ * matches `readAllForRun`'s deliberately-unlocked posture (see D3 residual 9). */
475
+ listSealedForRun(runId: string): Promise<SealedArtifact[]>;
476
+ /** Returns each in-memory LIVE buffer for the run, keyed by stepId, flattened to
477
+ * `BufferedEntry[]` (this store's own natural read shape; see `read`). Lock-free
478
+ * point-in-time diagnostic, matching #159's shipped `export`/`readAllForRun` posture —
479
+ * deliberately NOT serialized through the per-key mutex (see D3 residual 9). Sealed artifacts
480
+ * are NOT included (see `listSealedForRun`) — unchanged scope from before this capability
481
+ * existed; PR-2 decides how/whether call sites merge the two. */
70
482
  readAllForRun(runId: string): Promise<Record<string, unknown[]>>;
71
483
  }
72
484
  //# sourceMappingURL=trace-buffer-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-buffer-store.d.ts","sourceRoot":"","sources":["../../src/store/trace-buffer-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzF;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAE9D,+DAA+D;IAC/D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9E;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;CAClE;AAED,0FAA0F;AAC1F,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,MAAM,CAAC;A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