@sensigo/realm 0.26.0 → 0.28.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/engine/claim-liveness.d.ts +59 -11
- package/dist/engine/claim-liveness.d.ts.map +1 -1
- package/dist/engine/claim-liveness.js +83 -19
- package/dist/engine/claim-liveness.js.map +1 -1
- package/dist/engine/eligibility.d.ts +13 -0
- package/dist/engine/eligibility.d.ts.map +1 -1
- package/dist/engine/eligibility.js +20 -8
- package/dist/engine/eligibility.js.map +1 -1
- package/dist/engine/execution-loop.d.ts +13 -0
- package/dist/engine/execution-loop.d.ts.map +1 -1
- package/dist/engine/execution-loop.js +496 -58
- package/dist/engine/execution-loop.js.map +1 -1
- package/dist/engine/reclaim-step.d.ts.map +1 -1
- package/dist/engine/reclaim-step.js +187 -12
- package/dist/engine/reclaim-step.js.map +1 -1
- package/dist/engine/trace-adoption.d.ts +53 -0
- package/dist/engine/trace-adoption.d.ts.map +1 -0
- package/dist/engine/trace-adoption.js +49 -0
- package/dist/engine/trace-adoption.js.map +1 -0
- package/dist/evidence/snapshot.d.ts +11 -1
- package/dist/evidence/snapshot.d.ts.map +1 -1
- package/dist/evidence/snapshot.js +1 -0
- package/dist/evidence/snapshot.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/store/fs-io.d.ts +26 -0
- package/dist/store/fs-io.d.ts.map +1 -1
- package/dist/store/fs-io.js +37 -2
- package/dist/store/fs-io.js.map +1 -1
- package/dist/store/json-file-store.d.ts.map +1 -1
- package/dist/store/json-file-store.js +2 -5
- package/dist/store/json-file-store.js.map +1 -1
- package/dist/store/trace-buffer-store.d.ts +419 -7
- package/dist/store/trace-buffer-store.d.ts.map +1 -1
- package/dist/store/trace-buffer-store.js +401 -30
- package/dist/store/trace-buffer-store.js.map +1 -1
- package/dist/types/response-envelope.d.ts +20 -0
- package/dist/types/response-envelope.d.ts.map +1 -1
- package/dist/types/run-record.d.ts +60 -15
- package/dist/types/run-record.d.ts.map +1 -1
- package/dist/types/workflow-definition.d.ts +52 -7
- package/dist/types/workflow-definition.d.ts.map +1 -1
- package/dist/types/workflow-definition.js +15 -0
- package/dist/types/workflow-definition.js.map +1 -1
- package/dist/types/workflow-error.d.ts +1 -1
- package/dist/types/workflow-error.d.ts.map +1 -1
- package/dist/types/workflow-error.js.map +1 -1
- package/dist/workflow/diagnostics.d.ts +15 -6
- package/dist/workflow/diagnostics.d.ts.map +1 -1
- package/dist/workflow/diagnostics.js +16 -8
- package/dist/workflow/diagnostics.js.map +1 -1
- package/dist/workflow/yaml-loader.d.ts.map +1 -1
- package/dist/workflow/yaml-loader.js +108 -6
- package/dist/workflow/yaml-loader.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { WorkflowError } from '../types/workflow-error.js';
|
|
2
|
+
/** PER-WRITER budget (issue #197 PR-1 re-documentation — value unchanged): the ceiling for ONE
|
|
3
|
+
* writer's own share of a (runId, stepId) buffer — the nonce that made the call, or ⊥ (the
|
|
4
|
+
* bare/anonymous writer class) for a call with no nonce. An all-bare WAL has exactly one writer
|
|
5
|
+
* (⊥), so this is the ONLY ceiling that can ever bind there — byte-identity with pre-#197
|
|
6
|
+
* behavior is emergent from that fact, not a special case. */
|
|
2
7
|
export const BUFFER_LIMIT_COUNT = 200;
|
|
8
|
+
/** See `BUFFER_LIMIT_COUNT` — the per-writer BYTE ceiling. */
|
|
3
9
|
export const BUFFER_LIMIT_BYTES = 100 * 1024; // 100 KB
|
|
4
10
|
export const FINAL_LIMIT_ENTRIES = 100;
|
|
5
11
|
export const FINAL_LIMIT_BYTES = 50 * 1024; // 50 KB (must match MAX_BYTES in trace-normalizer.ts)
|
|
12
|
+
/** Whole-FILE backstop (issue #197 PR-1, additive, design §5): the ceiling across EVERY writer
|
|
13
|
+
* sharing a (runId, stepId) key combined, regardless of nonce — 2× the per-writer ceiling.
|
|
14
|
+
* Unconditional: enforced even on a store that hasn't seen a single nonced append, though it is
|
|
15
|
+
* UNREACHABLE in the all-bare case (the lone writer ⊥ already refuses at the per-writer ceiling,
|
|
16
|
+
* which is half the backstop — the backstop only ever binds when at least one OTHER writer's
|
|
17
|
+
* residue is sharing the file). */
|
|
18
|
+
export const BUFFER_BACKSTOP_COUNT = 2 * BUFFER_LIMIT_COUNT;
|
|
19
|
+
/** See `BUFFER_BACKSTOP_COUNT` — the whole-file BYTE backstop. */
|
|
20
|
+
export const BUFFER_BACKSTOP_BYTES = 2 * BUFFER_LIMIT_BYTES;
|
|
21
|
+
/** Per-(runId, stepId) seal budget (issue #197 PR-1, the `seal` rung, design §4): the maximum
|
|
22
|
+
* number of sealed artifacts one key may accumulate. On reaching the cap, `sealFenced` returns
|
|
23
|
+
* `{sealed: false, reason: 'capped'}` — the caller falls back to the existing destructive drain
|
|
24
|
+
* (`deleteFenced`), bounded and loud, rather than silently evicting an existing sealed artifact
|
|
25
|
+
* to make room. */
|
|
26
|
+
export const SEALED_ARTIFACTS_LIMIT_PER_STEP = 8;
|
|
6
27
|
const MAX_EVENT_LENGTH = 100;
|
|
7
28
|
const RESERVED_PREFIX = 'trace.';
|
|
8
29
|
const MAX_DATA_KEYS = 20;
|
|
@@ -45,27 +66,272 @@ export function normalizeEntryForBuffer(entry) {
|
|
|
45
66
|
...(data !== undefined ? { data } : {}),
|
|
46
67
|
};
|
|
47
68
|
}
|
|
69
|
+
// ---------------------------------------------------------------------------------------------
|
|
70
|
+
// Capability-ladder predicates (issue #197 PR-1, design §3) — the ONLY authoritative way to check
|
|
71
|
+
// a rung. TCK, tools, and engine (PR-2) must all use these; no ad-hoc `typeof` checks for the new
|
|
72
|
+
// rungs anywhere else. Each predicate = declared in `traceCapabilities` AND every method that
|
|
73
|
+
// rung (and every rung beneath it) requires is actually present — declaration alone, or method
|
|
74
|
+
// presence alone, is never sufficient.
|
|
75
|
+
// ---------------------------------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* True iff `store` both DECLARES the `seal` rung (in `traceCapabilities`) AND actually implements
|
|
78
|
+
* every method that rung requires: the full fenced trio (`appendFenced`/`deleteFenced`/
|
|
79
|
+
* `deleteAllForRunFenced`, issue #207) PLUS `sealFenced` PLUS `listSealedForRun` (the ladder: seal
|
|
80
|
+
* requires the trio). This is the ONLY authoritative `seal` predicate.
|
|
81
|
+
*/
|
|
82
|
+
export function storeDeclaresSeal(store) {
|
|
83
|
+
const declared = store.traceCapabilities?.has('seal') ?? false;
|
|
84
|
+
const methodsPresent = typeof store.appendFenced === 'function' &&
|
|
85
|
+
typeof store.deleteFenced === 'function' &&
|
|
86
|
+
typeof store.deleteAllForRunFenced === 'function' &&
|
|
87
|
+
typeof store.sealFenced === 'function' &&
|
|
88
|
+
typeof store.listSealedForRun === 'function';
|
|
89
|
+
return declared && methodsPresent;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* True iff `store` both DECLARES `writer_nonce_carriage` (in `traceCapabilities`) AND satisfies
|
|
93
|
+
* `storeDeclaresSeal` (the ladder: carriage requires seal requires the trio). Carriage itself
|
|
94
|
+
* adds no NEW required method — the `options` bag on `append`/`appendFenced` is declaration-only
|
|
95
|
+
* (there is no way to detect "does this implementation actually read the options bag" other than
|
|
96
|
+
* declared capability + behavior), so this predicate is exactly "declared AND seal holds". This
|
|
97
|
+
* is the ONLY authoritative `writer_nonce_carriage` predicate.
|
|
98
|
+
*/
|
|
99
|
+
export function storeDeclaresNonceCarriage(store) {
|
|
100
|
+
const declared = store.traceCapabilities?.has('writer_nonce_carriage') ?? false;
|
|
101
|
+
return declared && storeDeclaresSeal(store);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Wiring-time validation MECHANISM (issue #197 PR-1, design §3/§12 — INVOKING this at the
|
|
105
|
+
* injection seams, e.g. `server.ts`/CLI executors, is deliberately PR-2's job, not this one's).
|
|
106
|
+
* Typed fail-loud (a `TRACE_CAPABILITY_INCONSISTENT` `WorkflowError`) when a rung is DECLARED but
|
|
107
|
+
* its predicate does not hold (declared-but-inconsistent — a construction-time wiring defect,
|
|
108
|
+
* never a runtime condition worth retrying). Silent success when a rung is simply undeclared —
|
|
109
|
+
* the honest floor: trio-alone, or no capabilities at all, are both fully legal and never an
|
|
110
|
+
* error.
|
|
111
|
+
*/
|
|
112
|
+
export function validateTraceCapabilities(store) {
|
|
113
|
+
const caps = store.traceCapabilities;
|
|
114
|
+
if (caps === undefined)
|
|
115
|
+
return;
|
|
116
|
+
if (caps.has('seal') && !storeDeclaresSeal(store)) {
|
|
117
|
+
throw new WorkflowError("TraceBufferStore declares the 'seal' capability but does not implement all of its " +
|
|
118
|
+
'required methods (the fenced trio + sealFenced + listSealedForRun) — declared but ' +
|
|
119
|
+
'inconsistent.', {
|
|
120
|
+
code: 'TRACE_CAPABILITY_INCONSISTENT',
|
|
121
|
+
category: 'ENGINE',
|
|
122
|
+
agentAction: 'stop',
|
|
123
|
+
retryable: false,
|
|
124
|
+
details: { capability: 'seal' },
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (caps.has('writer_nonce_carriage') && !storeDeclaresNonceCarriage(store)) {
|
|
128
|
+
throw new WorkflowError("TraceBufferStore declares the 'writer_nonce_carriage' capability but its 'seal' " +
|
|
129
|
+
'predicate does not hold (carriage requires seal requires the fenced trio) — declared ' +
|
|
130
|
+
'but inconsistent.', {
|
|
131
|
+
code: 'TRACE_CAPABILITY_INCONSISTENT',
|
|
132
|
+
category: 'ENGINE',
|
|
133
|
+
agentAction: 'stop',
|
|
134
|
+
retryable: false,
|
|
135
|
+
details: { capability: 'writer_nonce_carriage' },
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Pure per-writer + whole-file budget decision (issue #197 PR-1, design §5) — shared by every
|
|
141
|
+
* `TraceBufferStore` implementation enforcing this pair, so the decision logic and the
|
|
142
|
+
* `BufferFullDetails` shape live in exactly ONE place rather than being independently
|
|
143
|
+
* (and riskily divergently) reimplemented per store. Deliberately takes BEFORE-and-AFTER pairs
|
|
144
|
+
* (rather than a "delta" this call would add) because the two shipped stores compute "after"
|
|
145
|
+
* differently and both must stay exact: the fs store's JSONL format is genuinely additive (byte
|
|
146
|
+
* delta = the one new line's own serialized size), but the in-memory store's byte-identity
|
|
147
|
+
* constraint requires re-serializing the WHOLE flattened array exactly as its pre-#197 formula
|
|
148
|
+
* always did — forcing a shared "delta" abstraction on top of that would risk being byte-inexact
|
|
149
|
+
* for one of the two stores. Returns `undefined` when neither ceiling would be exceeded.
|
|
150
|
+
*
|
|
151
|
+
* Writer scope is checked FIRST: if the appender's own share alone would exceed the per-writer
|
|
152
|
+
* ceiling, that is what gets reported — a caller whose own share already exceeds the (smaller)
|
|
153
|
+
* per-writer ceiling should be told that specifically, not the (less actionable, and in that
|
|
154
|
+
* case also necessarily true) whole-file ceiling. This ordering is also what makes the compat
|
|
155
|
+
* law hold: an all-bare file's lone writer (⊥) hits `scope:'writer'` at exactly today's legacy
|
|
156
|
+
* limits — the file backstop (2×) is arithmetically unreachable for a single writer alone.
|
|
157
|
+
*/
|
|
158
|
+
export function checkBufferBudget(params) {
|
|
159
|
+
const writerCountOver = params.writerCountAfter > BUFFER_LIMIT_COUNT;
|
|
160
|
+
const writerBytesOver = params.writerBytesAfter > BUFFER_LIMIT_BYTES;
|
|
161
|
+
if (writerCountOver || writerBytesOver) {
|
|
162
|
+
return {
|
|
163
|
+
scope: 'writer',
|
|
164
|
+
binding_dimension: writerCountOver ? 'count' : 'bytes',
|
|
165
|
+
count: {
|
|
166
|
+
requested: params.writerCountAfter,
|
|
167
|
+
used: params.writerCountBefore,
|
|
168
|
+
limit: BUFFER_LIMIT_COUNT,
|
|
169
|
+
},
|
|
170
|
+
bytes: {
|
|
171
|
+
requested: params.writerBytesAfter,
|
|
172
|
+
used: params.writerBytesBefore,
|
|
173
|
+
limit: BUFFER_LIMIT_BYTES,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const fileCountOver = params.fileCountAfter > BUFFER_BACKSTOP_COUNT;
|
|
178
|
+
const fileBytesOver = params.fileBytesAfter > BUFFER_BACKSTOP_BYTES;
|
|
179
|
+
if (fileCountOver || fileBytesOver) {
|
|
180
|
+
return {
|
|
181
|
+
scope: 'file',
|
|
182
|
+
binding_dimension: fileCountOver ? 'count' : 'bytes',
|
|
183
|
+
count: {
|
|
184
|
+
requested: params.fileCountAfter,
|
|
185
|
+
used: params.fileCountBefore,
|
|
186
|
+
limit: BUFFER_BACKSTOP_COUNT,
|
|
187
|
+
},
|
|
188
|
+
bytes: {
|
|
189
|
+
requested: params.fileBytesAfter,
|
|
190
|
+
used: params.fileBytesBefore,
|
|
191
|
+
limit: BUFFER_BACKSTOP_BYTES,
|
|
192
|
+
},
|
|
193
|
+
your_count: params.writerCountAfter,
|
|
194
|
+
your_bytes: params.writerBytesAfter,
|
|
195
|
+
total_count: params.fileCountAfter,
|
|
196
|
+
total_bytes: params.fileBytesAfter,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Builds the `BUFFER_FULL` `WorkflowError` from a `BufferFullDetails` (issue #197 PR-1, design
|
|
203
|
+
* §5) — the SAME message wording, error code, category, and `agentAction` every store uses, so
|
|
204
|
+
* the only thing that ever varies between stores is which concrete numbers went into `details`.
|
|
205
|
+
* Guidance wording is deliberate: foreign share (file scope's `your_*`/`total_*`) is stated as an
|
|
206
|
+
* observable FACT; crash causation for that foreign residue is NEVER asserted (design §5's
|
|
207
|
+
* corrected framing — foreign residue might be a live concurrent writer, not a crash). Code stays
|
|
208
|
+
* `BUFFER_FULL`, category `ENGINE`, `agentAction: 'provide_input'` — unchanged from before this
|
|
209
|
+
* capability existed.
|
|
210
|
+
*/
|
|
211
|
+
export function bufferFullError(details) {
|
|
212
|
+
const scopeClause = details.scope === 'writer'
|
|
213
|
+
? `this writer's own share of the buffer (${details.binding_dimension} ceiling reached)`
|
|
214
|
+
: `the whole-file ${details.binding_dimension} ceiling (${details.total_count ?? 0} ` +
|
|
215
|
+
`entries / ${details.total_bytes ?? 0} bytes combined across every writer sharing this ` +
|
|
216
|
+
`step; this writer's own share is ${details.your_count ?? 0} entries / ` +
|
|
217
|
+
`${details.your_bytes ?? 0} bytes)`;
|
|
218
|
+
return new WorkflowError(`Trace buffer full for step: ${scopeClause} reached. Settle the step to drain residue — ` +
|
|
219
|
+
'it is preserved (sealed) where the store supports it, and your options.trace always ' +
|
|
220
|
+
'survives.', {
|
|
221
|
+
code: 'BUFFER_FULL',
|
|
222
|
+
category: 'ENGINE',
|
|
223
|
+
agentAction: 'provide_input',
|
|
224
|
+
retryable: false,
|
|
225
|
+
details: { ...details },
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Flattens WAL batches (`{ts, entries, nonce?}`, issue #197 PR-1's internal batch shape — see
|
|
230
|
+
* `SealedWalLine`) into the read-back `BufferedEntry[]` shape, in batch order: `_internalTs` from
|
|
231
|
+
* the batch's `ts`; `_nonce` re-attached ONLY when the batch actually carried one (never
|
|
232
|
+
* fabricated for a bare batch — the key byte-identity property: a flattened all-bare batch list
|
|
233
|
+
* produces EXACTLY the same shape/bytes as the pre-#197 flat representation always did).
|
|
234
|
+
*/
|
|
235
|
+
export function flattenWalBatches(batches) {
|
|
236
|
+
return batches.flatMap((batch) => batch.entries.map((entry) => ({
|
|
237
|
+
...entry,
|
|
238
|
+
_internalTs: batch.ts,
|
|
239
|
+
...(batch.nonce !== undefined ? { _nonce: batch.nonce } : {}),
|
|
240
|
+
})));
|
|
241
|
+
}
|
|
48
242
|
/**
|
|
49
243
|
* In-memory TraceBufferStore for use in tests and non-persistent environments.
|
|
50
244
|
* Entries are lost on process restart (no file I/O).
|
|
245
|
+
*
|
|
246
|
+
* Declares the fenced trio (issue #207): `append`, `read`, `delete`, and `deleteAllForRun` all
|
|
247
|
+
* serialize on the SAME per-(runId, stepId) critical section `appendFenced`/`deleteFenced` use,
|
|
248
|
+
* via a per-key async mutex (a promise-chain map) — every one of the operations for a given key
|
|
249
|
+
* runs strictly after the previous operation on THAT SAME key has settled (success or failure).
|
|
250
|
+
* Liveness posture: a hung guard hangs only that key's chain — a different key's chain is
|
|
251
|
+
* untouched and proceeds normally (this per-key granularity is load-bearing; see the TCK's
|
|
252
|
+
* PER_KEY_INDEPENDENCE law). The chain map's entry for a key is deleted once its own tail
|
|
253
|
+
* settles and no newer call has chained after it, so an idle key holds no Map entry (no leak).
|
|
254
|
+
*
|
|
255
|
+
* Issue #197 PR-1 additionally declares BOTH capability-ladder rungs (`seal` and
|
|
256
|
+
* `writer_nonce_carriage`, `traceCapabilities`). The live-WAL internal representation is
|
|
257
|
+
* BATCH-preserving (`Map<string, SealedWalLine[]>`, one entry per `append`/`appendFenced` call) —
|
|
258
|
+
* NOT flattened — because `sealFenced` must be able to retire a key's exact batch history as one
|
|
259
|
+
* unit, and each batch's own (possibly absent) writer nonce must survive independently for
|
|
260
|
+
* carriage/budget partitioning. Every flattening surface (`read`, `readAllForRun`, `deleteFenced`'s
|
|
261
|
+
* count, the byte-budget arithmetic) derives its answer from this representation via
|
|
262
|
+
* `flattenWalBatches` (or direct batch arithmetic over it), reproducing the exact pre-#197
|
|
263
|
+
* observable shape and byte formula for all-bare traffic — see `appendUnlocked`.
|
|
51
264
|
*/
|
|
52
265
|
export class InMemoryTraceBufferStore {
|
|
266
|
+
traceCapabilities = new Set([
|
|
267
|
+
'seal',
|
|
268
|
+
'writer_nonce_carriage',
|
|
269
|
+
]);
|
|
270
|
+
// Live WAL per key, in append order — see the class doc for why this stays batch-shaped.
|
|
53
271
|
buffers = new Map();
|
|
272
|
+
// Sealed artifacts per key, in ascending `seq` order (issue #197 PR-1, the `seal` rung).
|
|
273
|
+
sealed = new Map();
|
|
274
|
+
chains = new Map();
|
|
54
275
|
key(runId, stepId) {
|
|
55
276
|
return `${runId}:${stepId}`;
|
|
56
277
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Runs `fn` strictly after the current tail of the per-key chain for `k` has settled (whether
|
|
280
|
+
* that prior link resolved or rejected), and installs `fn`'s own settlement as the new tail.
|
|
281
|
+
* Returns/throws `fn`'s real result — chain-tracking never swallows or reshapes it. Removes the
|
|
282
|
+
* map entry for `k` once this call's tail settles, but only if no NEWER call has since replaced
|
|
283
|
+
* it (an identity check against the exact promise reference this call stored).
|
|
284
|
+
*/
|
|
285
|
+
async withKeyLock(k, fn) {
|
|
286
|
+
const prior = this.chains.get(k) ?? Promise.resolve();
|
|
287
|
+
// Neutralize prior's rejection for CHAINING purposes only — a failed operation on this key
|
|
288
|
+
// must not permanently wedge every future operation on the same key.
|
|
289
|
+
const settledPrior = prior.then(() => undefined, () => undefined);
|
|
290
|
+
const result = settledPrior.then(fn);
|
|
291
|
+
const tail = result.then(() => undefined, () => undefined);
|
|
292
|
+
this.chains.set(k, tail);
|
|
293
|
+
void tail.then(() => {
|
|
294
|
+
if (this.chains.get(k) === tail) {
|
|
295
|
+
this.chains.delete(k);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Count + bytes for exactly the batches belonging to `writerNonce` (`undefined` = ⊥, the bare
|
|
302
|
+
* writer class) — computed by flattening JUST that writer's own batches and re-stringifying,
|
|
303
|
+
* so the byte number for a single-writer (all-bare) file is bit-for-bit the old whole-array
|
|
304
|
+
* formula. Equality is plain `===` over `batch.nonce ?? undefined`, which implements the
|
|
305
|
+
* design's `adopted(line) ⇔ line.nonce ≡ claimant.nonce, with absent ≡ absent` rule with no
|
|
306
|
+
* special-casing (`undefined === undefined` is `true`).
|
|
307
|
+
*/
|
|
308
|
+
partitionStats(batches, writerNonce) {
|
|
309
|
+
const own = batches.filter((b) => (b.nonce ?? undefined) === writerNonce);
|
|
310
|
+
const flattened = flattenWalBatches(own);
|
|
311
|
+
return { count: flattened.length, bytes: Buffer.byteLength(JSON.stringify(flattened)) };
|
|
312
|
+
}
|
|
313
|
+
/** Whole-file count + bytes across every writer combined — the pre-#197 formula, applied to
|
|
314
|
+
* the full batch list regardless of how many distinct writers contributed to it. */
|
|
315
|
+
fileStats(batches) {
|
|
316
|
+
const flattened = flattenWalBatches(batches);
|
|
317
|
+
return { count: flattened.length, bytes: Buffer.byteLength(JSON.stringify(flattened)) };
|
|
318
|
+
}
|
|
319
|
+
appendUnlocked(k, entries, writerNonce) {
|
|
320
|
+
const existingBatches = this.buffers.get(k) ?? [];
|
|
321
|
+
const writerBefore = this.partitionStats(existingBatches, writerNonce);
|
|
322
|
+
const fileBefore = this.fileStats(existingBatches);
|
|
60
323
|
if (entries.length === 0) {
|
|
61
|
-
const bytes = Buffer.byteLength(JSON.stringify(existing));
|
|
62
324
|
return {
|
|
63
|
-
buffer_count:
|
|
64
|
-
buffer_bytes: bytes,
|
|
325
|
+
buffer_count: writerBefore.count,
|
|
326
|
+
buffer_bytes: writerBefore.bytes,
|
|
65
327
|
limit_count: BUFFER_LIMIT_COUNT,
|
|
66
328
|
limit_bytes: BUFFER_LIMIT_BYTES,
|
|
67
329
|
final_limit_entries: FINAL_LIMIT_ENTRIES,
|
|
68
330
|
final_limit_bytes: FINAL_LIMIT_BYTES,
|
|
331
|
+
file_count: fileBefore.count,
|
|
332
|
+
file_bytes: fileBefore.bytes,
|
|
333
|
+
file_limit_count: BUFFER_BACKSTOP_COUNT,
|
|
334
|
+
file_limit_bytes: BUFFER_BACKSTOP_BYTES,
|
|
69
335
|
};
|
|
70
336
|
}
|
|
71
337
|
const ts = Date.now();
|
|
@@ -73,50 +339,155 @@ export class InMemoryTraceBufferStore {
|
|
|
73
339
|
.map((e) => normalizeEntryForBuffer(e))
|
|
74
340
|
.filter((e) => e !== null)
|
|
75
341
|
.map((e) => ({ ...e, _internalTs: ts }));
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
342
|
+
const newBatch = writerNonce !== undefined
|
|
343
|
+
? { ts, entries: normalized, nonce: writerNonce }
|
|
344
|
+
: { ts, entries: normalized };
|
|
345
|
+
const proposedBatches = [...existingBatches, newBatch];
|
|
346
|
+
const writerAfter = this.partitionStats(proposedBatches, writerNonce);
|
|
347
|
+
const fileAfter = this.fileStats(proposedBatches);
|
|
348
|
+
const overflow = checkBufferBudget({
|
|
349
|
+
writerCountBefore: writerBefore.count,
|
|
350
|
+
writerBytesBefore: writerBefore.bytes,
|
|
351
|
+
writerCountAfter: writerAfter.count,
|
|
352
|
+
writerBytesAfter: writerAfter.bytes,
|
|
353
|
+
fileCountBefore: fileBefore.count,
|
|
354
|
+
fileBytesBefore: fileBefore.bytes,
|
|
355
|
+
fileCountAfter: fileAfter.count,
|
|
356
|
+
fileBytesAfter: fileAfter.bytes,
|
|
357
|
+
});
|
|
358
|
+
if (overflow) {
|
|
359
|
+
throw bufferFullError(overflow);
|
|
87
360
|
}
|
|
88
|
-
this.buffers.set(k,
|
|
89
|
-
const bytes = Buffer.byteLength(JSON.stringify(proposed));
|
|
361
|
+
this.buffers.set(k, proposedBatches);
|
|
90
362
|
return {
|
|
91
|
-
buffer_count:
|
|
92
|
-
buffer_bytes: bytes,
|
|
363
|
+
buffer_count: writerAfter.count,
|
|
364
|
+
buffer_bytes: writerAfter.bytes,
|
|
93
365
|
limit_count: BUFFER_LIMIT_COUNT,
|
|
94
366
|
limit_bytes: BUFFER_LIMIT_BYTES,
|
|
95
367
|
final_limit_entries: FINAL_LIMIT_ENTRIES,
|
|
96
368
|
final_limit_bytes: FINAL_LIMIT_BYTES,
|
|
369
|
+
file_count: fileAfter.count,
|
|
370
|
+
file_bytes: fileAfter.bytes,
|
|
371
|
+
file_limit_count: BUFFER_BACKSTOP_COUNT,
|
|
372
|
+
file_limit_bytes: BUFFER_BACKSTOP_BYTES,
|
|
97
373
|
};
|
|
98
374
|
}
|
|
375
|
+
async append(runId, stepId, entries, options) {
|
|
376
|
+
const k = this.key(runId, stepId);
|
|
377
|
+
return this.withKeyLock(k, async () => this.appendUnlocked(k, entries, options?.writerNonce));
|
|
378
|
+
}
|
|
379
|
+
/** guard runs INSIDE the per-key critical section, immediately before the write — see the
|
|
380
|
+
* interface doc for the full guard contract. */
|
|
381
|
+
async appendFenced(runId, stepId, entries, guard, options) {
|
|
382
|
+
const k = this.key(runId, stepId);
|
|
383
|
+
return this.withKeyLock(k, async () => {
|
|
384
|
+
await guard();
|
|
385
|
+
return this.appendUnlocked(k, entries, options?.writerNonce);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
99
388
|
async read(runId, stepId) {
|
|
100
|
-
|
|
389
|
+
const k = this.key(runId, stepId);
|
|
390
|
+
return this.withKeyLock(k, async () => flattenWalBatches(this.buffers.get(k) ?? []));
|
|
101
391
|
}
|
|
102
392
|
async delete(runId, stepId) {
|
|
103
|
-
this.
|
|
393
|
+
const k = this.key(runId, stepId);
|
|
394
|
+
await this.withKeyLock(k, async () => {
|
|
395
|
+
this.buffers.delete(k);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/** guard runs INSIDE the same per-key critical section `appendFenced` uses, immediately before
|
|
399
|
+
* the delete — see the interface doc for the full guard contract. Returns the number of
|
|
400
|
+
* entries actually deleted, summed across every live batch (0 = buffer already absent; the
|
|
401
|
+
* guard still ran first). Sealed artifacts for this key are NOT touched — sealing exists
|
|
402
|
+
* precisely to move content out of this destructive drain's reach; only `deleteAllForRun*`
|
|
403
|
+
* (run-level bulk delete) also retires sealed artifacts. */
|
|
404
|
+
async deleteFenced(runId, stepId, guard) {
|
|
405
|
+
const k = this.key(runId, stepId);
|
|
406
|
+
return this.withKeyLock(k, async () => {
|
|
407
|
+
await guard();
|
|
408
|
+
const existing = this.buffers.get(k);
|
|
409
|
+
this.buffers.delete(k);
|
|
410
|
+
return existing !== undefined ? flattenWalBatches(existing).length : 0;
|
|
411
|
+
});
|
|
104
412
|
}
|
|
105
413
|
async deleteAllForRun(runId, _dirEntries) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
414
|
+
const prefix = `${runId}:`;
|
|
415
|
+
const keys = new Set([...this.buffers.keys(), ...this.sealed.keys()].filter((k) => k.startsWith(prefix)));
|
|
416
|
+
for (const k of keys) {
|
|
417
|
+
await this.withKeyLock(k, async () => {
|
|
418
|
+
this.buffers.delete(k);
|
|
419
|
+
this.sealed.delete(k);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/** guard is RE-INVOKED inside EACH per-(runId, stepId) critical section, immediately before
|
|
424
|
+
* that key's delete — see the interface doc for the full guard contract, including the
|
|
425
|
+
* zero-match-sweep invocation requirement (handled below: the guard still runs at least once
|
|
426
|
+
* even when this run has no buffers at all). Sealed artifacts join this run-level bulk delete
|
|
427
|
+
* (design §4 — a sealed artifact is retained ONLY until its owning run itself is purged). */
|
|
428
|
+
async deleteAllForRunFenced(runId, guard, _dirEntries) {
|
|
429
|
+
const prefix = `${runId}:`;
|
|
430
|
+
const keys = new Set([...this.buffers.keys(), ...this.sealed.keys()].filter((k) => k.startsWith(prefix)));
|
|
431
|
+
if (keys.size === 0) {
|
|
432
|
+
await guard();
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
for (const k of keys) {
|
|
436
|
+
await this.withKeyLock(k, async () => {
|
|
437
|
+
await guard();
|
|
438
|
+
this.buffers.delete(k);
|
|
439
|
+
this.sealed.delete(k);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/** guard runs INSIDE the per-key critical section, immediately before the seal-move — see the
|
|
444
|
+
* interface doc for the full contract. Atomically retires the ENTIRE live batch history for
|
|
445
|
+
* (runId, stepId) into a new sealed artifact (ascending `seq`), clearing the live buffer in
|
|
446
|
+
* the same step — the in-memory analogue of the fs store's no-clobber rename-based seal
|
|
447
|
+
* (there is no filesystem race to guard against here; the per-key mutex already serializes
|
|
448
|
+
* every operation on this key, so `seq` can simply be the next array index). */
|
|
449
|
+
async sealFenced(runId, stepId, guard) {
|
|
450
|
+
const k = this.key(runId, stepId);
|
|
451
|
+
return this.withKeyLock(k, async () => {
|
|
452
|
+
await guard();
|
|
453
|
+
const live = this.buffers.get(k);
|
|
454
|
+
if (live === undefined || live.length === 0) {
|
|
455
|
+
return { sealed: false, reason: 'absent' };
|
|
456
|
+
}
|
|
457
|
+
const existingSealed = this.sealed.get(k) ?? [];
|
|
458
|
+
if (existingSealed.length >= SEALED_ARTIFACTS_LIMIT_PER_STEP) {
|
|
459
|
+
return { sealed: false, reason: 'capped' };
|
|
460
|
+
}
|
|
461
|
+
const artifact = { step_id: stepId, seq: existingSealed.length, lines: live };
|
|
462
|
+
this.sealed.set(k, [...existingSealed, artifact]);
|
|
463
|
+
this.buffers.delete(k);
|
|
464
|
+
return { sealed: true };
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
/** Lock-free point-in-time snapshot of every sealed artifact for a run, across all its steps —
|
|
468
|
+
* matches `readAllForRun`'s deliberately-unlocked posture (see D3 residual 9). */
|
|
469
|
+
async listSealedForRun(runId) {
|
|
470
|
+
const prefix = `${runId}:`;
|
|
471
|
+
const result = [];
|
|
472
|
+
for (const [k, artifacts] of this.sealed.entries()) {
|
|
473
|
+
if (k.startsWith(prefix)) {
|
|
474
|
+
result.push(...artifacts);
|
|
109
475
|
}
|
|
110
476
|
}
|
|
477
|
+
return result;
|
|
111
478
|
}
|
|
112
|
-
/** Returns each in-memory buffer for the run, keyed by stepId,
|
|
113
|
-
* (
|
|
479
|
+
/** Returns each in-memory LIVE buffer for the run, keyed by stepId, flattened to
|
|
480
|
+
* `BufferedEntry[]` (this store's own natural read shape; see `read`). Lock-free
|
|
481
|
+
* point-in-time diagnostic, matching #159's shipped `export`/`readAllForRun` posture —
|
|
482
|
+
* deliberately NOT serialized through the per-key mutex (see D3 residual 9). Sealed artifacts
|
|
483
|
+
* are NOT included (see `listSealedForRun`) — unchanged scope from before this capability
|
|
484
|
+
* existed; PR-2 decides how/whether call sites merge the two. */
|
|
114
485
|
async readAllForRun(runId) {
|
|
115
486
|
const result = {};
|
|
116
487
|
const prefix = `${runId}:`;
|
|
117
|
-
for (const [key,
|
|
488
|
+
for (const [key, batches] of this.buffers.entries()) {
|
|
118
489
|
if (key.startsWith(prefix)) {
|
|
119
|
-
result[key.slice(prefix.length)] =
|
|
490
|
+
result[key.slice(prefix.length)] = flattenWalBatches(batches);
|
|
120
491
|
}
|
|
121
492
|
}
|
|
122
493
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-buffer-store.js","sourceRoot":"","sources":["../../src/store/trace-buffer-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAsD3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,SAAS;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,sDAAsD;AAElG,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,eAAe,GAAG,QAAQ,CAAC;AACjC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAsB;IAC5D,sFAAsF;IACtF,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,GAAG,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Per-partition adoption counts (issue #197 PR-2, design §6) — mirrors the settled step's own
|
|
110
|
+
* `trace_summary.attributed_lines_adopted` / `buffered_lines_adopted` / `foreign_lines_preserved`
|
|
111
|
+
* (see run-record.ts) at the moment the adoption partition actually ran. SET BY THE ENGINE at
|
|
112
|
+
* envelope build (the MCP tool layer strips `data`/`evidence` before returning and never itself
|
|
113
|
+
* sees per-line nonces). Present ONLY when the adoption partition ran for the step this envelope
|
|
114
|
+
* settles — absent for a bare-floor store (no `writer_nonce_carriage`), a non-agent step, or an
|
|
115
|
+
* error/blocked envelope. **Chain-replacement disposition (issue #197 PR-2):** when a settled
|
|
116
|
+
* agent step's `executeChain` call continues into a subsequently-eligible auto step, the
|
|
117
|
+
* RETURNED envelope is that deeper step's own — these three counts may be ABSENT there (they
|
|
118
|
+
* persist authoritatively in the settled step's own `trace_summary` regardless of what this
|
|
119
|
+
* envelope reports); the accompanying warnings (seal outcome / half-minted advisory / missing
|
|
120
|
+
* carriage leg) are re-surfaced into the returned envelope's `warnings` via the existing
|
|
121
|
+
* chain-wide warning re-accumulation even when these counts are not.
|
|
122
|
+
*/
|
|
123
|
+
adopted_own?: number;
|
|
124
|
+
/** @see adopted_own — the ⊥ (bare) counterpart; mirrors `trace_summary.buffered_lines_adopted`. */
|
|
125
|
+
adopted_anonymous?: number;
|
|
126
|
+
/** @see adopted_own — mirrors `trace_summary.foreign_lines_preserved`. */
|
|
127
|
+
preserved_foreign?: number;
|
|
108
128
|
}
|
|
109
129
|
//# sourceMappingURL=response-envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-envelope.d.ts","sourceRoot":"","sources":["../../src/types/response-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,E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