@namzu/sdk 20.4.0 → 21.0.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/CHANGELOG.md +179 -0
- package/dist/bridge/sse/mapper.d.ts +19 -0
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +9 -1
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/contracts/schemas.d.ts +10 -10
- package/dist/manager/run/persistence.d.ts +26 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +40 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/public-runtime.d.ts +4 -0
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +16 -0
- package/dist/public-runtime.js.map +1 -1
- package/dist/run/drain.d.ts +194 -0
- package/dist/run/drain.d.ts.map +1 -0
- package/dist/run/drain.js +228 -0
- package/dist/run/drain.js.map +1 -0
- package/dist/run/index.d.ts +2 -0
- package/dist/run/index.d.ts.map +1 -1
- package/dist/run/index.js +1 -0
- package/dist/run/index.js.map +1 -1
- package/dist/runtime/query/events.d.ts +12 -0
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +61 -3
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/index.d.ts +36 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +32 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/resume-run.d.ts +25 -0
- package/dist/runtime/query/resume-run.d.ts.map +1 -1
- package/dist/runtime/query/resume-run.js +15 -3
- package/dist/runtime/query/resume-run.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/run/conformance.d.ts +159 -0
- package/dist/store/run/conformance.d.ts.map +1 -0
- package/dist/store/run/conformance.js +451 -0
- package/dist/store/run/conformance.js.map +1 -0
- package/dist/store/run/disk.d.ts +30 -2
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +101 -0
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/memory.d.ts +5 -4
- package/dist/store/run/memory.d.ts.map +1 -1
- package/dist/store/run/memory.js +30 -1
- package/dist/store/run/memory.js.map +1 -1
- package/dist/types/doctor/check.d.ts +28 -2
- package/dist/types/doctor/check.d.ts.map +1 -1
- package/dist/types/run/event-cursor.d.ts +90 -0
- package/dist/types/run/event-cursor.d.ts.map +1 -0
- package/dist/types/run/event-cursor.js +47 -0
- package/dist/types/run/event-cursor.js.map +1 -0
- package/dist/types/run/events.d.ts +71 -1
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/index.d.ts +1 -0
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +1 -0
- package/dist/types/run/index.js.map +1 -1
- package/dist/types/run/store.d.ts +41 -1
- package/dist/types/run/store.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/bridge/sse/mapper.ts +28 -1
- package/src/manager/run/persistence.ts +43 -0
- package/src/public-runtime.ts +22 -0
- package/src/run/drain.ts +393 -0
- package/src/run/index.ts +3 -0
- package/src/runtime/query/events.ts +68 -4
- package/src/runtime/query/index.ts +87 -0
- package/src/runtime/query/resume-run.ts +67 -12
- package/src/store/index.ts +1 -1
- package/src/store/run/conformance.ts +705 -0
- package/src/store/run/disk.ts +106 -2
- package/src/store/run/memory.ts +35 -5
- package/src/types/doctor/check.ts +28 -2
- package/src/types/run/event-cursor.ts +118 -0
- package/src/types/run/events.ts +80 -3
- package/src/types/run/index.ts +1 -0
- package/src/types/run/store.ts +43 -1
package/dist/store/run/disk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CheckpointId, IterationCheckpoint } from '../../types/hitl/index.js';
|
|
2
|
-
import type { Run, RunEvent, RunStoreConfig } from '../../types/run/index.js';
|
|
3
|
-
import type { CompletedToolRecord, RunStore } from '../../types/run/store.js';
|
|
2
|
+
import type { PersistedRunEvent, Run, RunEvent, RunStoreConfig } from '../../types/run/index.js';
|
|
3
|
+
import type { CompletedToolRecord, ReadRunEventsOptions, RunStore } from '../../types/run/store.js';
|
|
4
4
|
/**
|
|
5
5
|
* One finished tool call, recovered from the transcript.
|
|
6
6
|
*
|
|
@@ -18,6 +18,7 @@ export declare class RunDiskStore implements RunStore {
|
|
|
18
18
|
private requireInit;
|
|
19
19
|
initRun(runId: string, parentRunId?: string): Promise<string>;
|
|
20
20
|
appendEvent(event: RunEvent): Promise<void>;
|
|
21
|
+
readEvents(options?: ReadRunEventsOptions): Promise<readonly PersistedRunEvent[]>;
|
|
21
22
|
/**
|
|
22
23
|
* Every tool call this run has already finished, keyed by `toolUseId`.
|
|
23
24
|
*
|
|
@@ -74,6 +75,33 @@ export declare class RunDiskStore implements RunStore {
|
|
|
74
75
|
}>>;
|
|
75
76
|
addToIndex(run: Run): Promise<void>;
|
|
76
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Every durable event under one run directory, oldest first.
|
|
80
|
+
*
|
|
81
|
+
* A free function for the same reason {@link readCheckpointsIn} is one: a
|
|
82
|
+
* caller catching up on a run this process never started would otherwise have
|
|
83
|
+
* to bind a {@link RunDiskStore} to read it, and binding one CREATES the
|
|
84
|
+
* directory. A read that mints an empty run directory then answers "no events"
|
|
85
|
+
* is indistinguishable from a run that genuinely has none.
|
|
86
|
+
*
|
|
87
|
+
* ## Unsequenced lines take their position
|
|
88
|
+
*
|
|
89
|
+
* A transcript written before events were numbered carries no `seq` at all.
|
|
90
|
+
* Numbering those lines by their 1-based position is what keeps their evidence
|
|
91
|
+
* reachable: a legacy run of five lines reads back as 1..5, seeds the emitter
|
|
92
|
+
* at 5, and its next event is 6 — continuous, and stable on every later read.
|
|
93
|
+
* Skipping them instead would erase a run's whole history from a catch-up, and
|
|
94
|
+
* synthesising nothing at all would put the emitter back at 1 on top of a log
|
|
95
|
+
* that already has five entries.
|
|
96
|
+
*
|
|
97
|
+
* A damaged line is skipped rather than refused, which is the one place this
|
|
98
|
+
* differs from the checkpoint reader next door, and deliberately: a checkpoint
|
|
99
|
+
* is read to RESUME from, so a damaged one must stop the resume, while the
|
|
100
|
+
* transcript is read to REPORT from, and dropping every event after a torn line
|
|
101
|
+
* would be a larger loss than the torn line itself. The position count still
|
|
102
|
+
* advances over it, so the numbering of the events after it is unchanged.
|
|
103
|
+
*/
|
|
104
|
+
export declare function readRunEventsIn(runDir: string, options?: ReadRunEventsOptions): Promise<readonly PersistedRunEvent[]>;
|
|
77
105
|
/**
|
|
78
106
|
* Every checkpoint stored under one run directory, ascending by `createdAt`.
|
|
79
107
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk.d.ts","sourceRoot":"","sources":["../../../src/store/run/disk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"disk.d.ts","sourceRoot":"","sources":["../../../src/store/run/disk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAenG;;;;;;GAMG;AACH,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAEnC,qBAAa,YAAa,YAAW,QAAQ;IAC5C,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,MAAM,CAAsB;I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MAAM,CAAA;KAChB,CAAC,CACF;IAWK,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CA8CzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAwCvC;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiBtF"}
|
package/dist/store/run/disk.js
CHANGED
|
@@ -35,6 +35,7 @@ export class RunDiskStore {
|
|
|
35
35
|
this.runDir = join(this.baseDir, runId);
|
|
36
36
|
}
|
|
37
37
|
await mkdir(this.runDir, { recursive: true });
|
|
38
|
+
await healTornTranscript(this.runDir);
|
|
38
39
|
this.log.info(`Run directory created: ${this.runDir}`);
|
|
39
40
|
return this.runDir;
|
|
40
41
|
}
|
|
@@ -46,6 +47,9 @@ export class RunDiskStore {
|
|
|
46
47
|
})}\n`;
|
|
47
48
|
await appendFile(join(dir, 'transcript.jsonl'), line, 'utf-8');
|
|
48
49
|
}
|
|
50
|
+
async readEvents(options) {
|
|
51
|
+
return readRunEventsIn(this.requireInit(), options);
|
|
52
|
+
}
|
|
49
53
|
/**
|
|
50
54
|
* Every tool call this run has already finished, keyed by `toolUseId`.
|
|
51
55
|
*
|
|
@@ -261,6 +265,103 @@ export class RunDiskStore {
|
|
|
261
265
|
}
|
|
262
266
|
}
|
|
263
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Every durable event under one run directory, oldest first.
|
|
270
|
+
*
|
|
271
|
+
* A free function for the same reason {@link readCheckpointsIn} is one: a
|
|
272
|
+
* caller catching up on a run this process never started would otherwise have
|
|
273
|
+
* to bind a {@link RunDiskStore} to read it, and binding one CREATES the
|
|
274
|
+
* directory. A read that mints an empty run directory then answers "no events"
|
|
275
|
+
* is indistinguishable from a run that genuinely has none.
|
|
276
|
+
*
|
|
277
|
+
* ## Unsequenced lines take their position
|
|
278
|
+
*
|
|
279
|
+
* A transcript written before events were numbered carries no `seq` at all.
|
|
280
|
+
* Numbering those lines by their 1-based position is what keeps their evidence
|
|
281
|
+
* reachable: a legacy run of five lines reads back as 1..5, seeds the emitter
|
|
282
|
+
* at 5, and its next event is 6 — continuous, and stable on every later read.
|
|
283
|
+
* Skipping them instead would erase a run's whole history from a catch-up, and
|
|
284
|
+
* synthesising nothing at all would put the emitter back at 1 on top of a log
|
|
285
|
+
* that already has five entries.
|
|
286
|
+
*
|
|
287
|
+
* A damaged line is skipped rather than refused, which is the one place this
|
|
288
|
+
* differs from the checkpoint reader next door, and deliberately: a checkpoint
|
|
289
|
+
* is read to RESUME from, so a damaged one must stop the resume, while the
|
|
290
|
+
* transcript is read to REPORT from, and dropping every event after a torn line
|
|
291
|
+
* would be a larger loss than the torn line itself. The position count still
|
|
292
|
+
* advances over it, so the numbering of the events after it is unchanged.
|
|
293
|
+
*/
|
|
294
|
+
export async function readRunEventsIn(runDir, options) {
|
|
295
|
+
let raw;
|
|
296
|
+
try {
|
|
297
|
+
raw = await readFile(join(runDir, 'transcript.jsonl'), 'utf-8');
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
if (isFileNotFound(err))
|
|
301
|
+
return [];
|
|
302
|
+
throw err;
|
|
303
|
+
}
|
|
304
|
+
const sinceSeq = options?.sinceSeq ?? 0;
|
|
305
|
+
const events = [];
|
|
306
|
+
let position = 0;
|
|
307
|
+
for (const line of raw.split('\n')) {
|
|
308
|
+
if (line.length === 0)
|
|
309
|
+
continue;
|
|
310
|
+
position += 1;
|
|
311
|
+
let parsed;
|
|
312
|
+
try {
|
|
313
|
+
parsed = JSON.parse(line);
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (parsed === null || typeof parsed !== 'object' || typeof parsed.type !== 'string')
|
|
319
|
+
continue;
|
|
320
|
+
const seq = typeof parsed.seq === 'number' ? parsed.seq : position;
|
|
321
|
+
if (seq <= sinceSeq)
|
|
322
|
+
continue;
|
|
323
|
+
events.push({
|
|
324
|
+
...parsed,
|
|
325
|
+
seq,
|
|
326
|
+
// Stamped by `appendEvent` since long before it was declared. A line
|
|
327
|
+
// that predates even that gets the only honest answer available:
|
|
328
|
+
// zero, which sorts before every real moment and cannot be mistaken
|
|
329
|
+
// for one.
|
|
330
|
+
timestamp: typeof parsed.timestamp === 'number' ? parsed.timestamp : 0,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return events;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Terminate a transcript whose last line was cut off mid-write.
|
|
337
|
+
*
|
|
338
|
+
* A process killed during `appendFile` leaves a fragment with no newline. The
|
|
339
|
+
* next append lands on the same line, so the fragment and a WHOLE, correct
|
|
340
|
+
* event merge into one unparsable line — and the reader skips it. The event was
|
|
341
|
+
* written, the emitter counted it as durable, and it is gone.
|
|
342
|
+
*
|
|
343
|
+
* Ending the fragment is enough. It stays unreadable and is skipped as it
|
|
344
|
+
* always was; everything appended after it survives, which is the difference
|
|
345
|
+
* between losing one event and losing one event plus the next.
|
|
346
|
+
*
|
|
347
|
+
* Called from `initRun`, which is the only moment the store knows nothing is
|
|
348
|
+
* mid-write.
|
|
349
|
+
*/
|
|
350
|
+
async function healTornTranscript(runDir) {
|
|
351
|
+
const path = join(runDir, 'transcript.jsonl');
|
|
352
|
+
let raw;
|
|
353
|
+
try {
|
|
354
|
+
raw = await readFile(path, 'utf-8');
|
|
355
|
+
}
|
|
356
|
+
catch (err) {
|
|
357
|
+
if (isFileNotFound(err))
|
|
358
|
+
return;
|
|
359
|
+
throw err;
|
|
360
|
+
}
|
|
361
|
+
if (raw.length === 0 || raw.endsWith('\n'))
|
|
362
|
+
return;
|
|
363
|
+
await appendFile(path, '\n', 'utf-8');
|
|
364
|
+
}
|
|
264
365
|
/**
|
|
265
366
|
* Every checkpoint stored under one run directory, ascending by `createdAt`.
|
|
266
367
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk.js","sourceRoot":"","sources":["../../../src/store/run/disk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAIhC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAe,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAA;AAW9E,MAAM,OAAO,YAAY;IAChB,OAAO,CAAQ;IACf,MAAM,GAAkB,IAAI,CAAA;IAC5B,GAAG,CAAQ;IACX,SAAS,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAA;IAEpD,YAAY,MAAsB;QACjC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAA;IACnF,CAAC;IAEO,WAAW;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAA;IACnB,CAAC;IAED,KAAK,CA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KAAK,CAAC,cAAc,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CACxB,CAAA;AACF,CAAC;AAED,SAAS,eAAe,CAAC,OAAe,EAAE,IAAY;IACrD,MAAM,MAAM,GAAG,OAAO,CAAU,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,MAA6C,CAAA;IAE5D,IACC,MAAM,KAAK,IAAI;QACf,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ;QAC7B,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QACpC,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QACpC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC9B,CAAC;QACF,MAAM,IAAI,KAAK,CACd,oBAAoB,IAAI,uKAAuK,CAC/L,CAAA;IACF,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACd,oBAAoB,IAAI,+QAA+Q,CACvS,CAAA;IACF,CAAC;IAED,OAAO,MAA6B,CAAA;AACrC,CAAC;AAED,SAAS,cAAc,CAAC,GAAY;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,CAAA;AACnG,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Run } from '../../types/run/entity.js';
|
|
2
|
-
import type { RunEvent } from '../../types/run/events.js';
|
|
3
|
-
import type { CompletedToolRecord, RunStore } from '../../types/run/store.js';
|
|
2
|
+
import type { PersistedRunEvent, RunEvent } from '../../types/run/events.js';
|
|
3
|
+
import type { CompletedToolRecord, ReadRunEventsOptions, RunStore } from '../../types/run/store.js';
|
|
4
4
|
/**
|
|
5
5
|
* Process-local {@link RunStore}: a run's evidence with no filesystem.
|
|
6
6
|
*
|
|
@@ -21,7 +21,7 @@ export declare class InMemoryRunStore implements RunStore {
|
|
|
21
21
|
private meta;
|
|
22
22
|
private messages;
|
|
23
23
|
private report;
|
|
24
|
-
private
|
|
24
|
+
private events;
|
|
25
25
|
initRun(runId: string, parentRunId?: string): Promise<string | null>;
|
|
26
26
|
private requireInit;
|
|
27
27
|
/** The run this store is bound to, and its parent when it has one. */
|
|
@@ -32,6 +32,7 @@ export declare class InMemoryRunStore implements RunStore {
|
|
|
32
32
|
writeRunMeta(run: Run): Promise<void>;
|
|
33
33
|
writeMessages(run: Run): Promise<void>;
|
|
34
34
|
appendEvent(event: RunEvent): Promise<void>;
|
|
35
|
+
readEvents(options?: ReadRunEventsOptions): Promise<readonly PersistedRunEvent[]>;
|
|
35
36
|
writeReport(content: string): Promise<string | null>;
|
|
36
37
|
readCompletedTools(): Promise<Map<string, CompletedToolRecord>>;
|
|
37
38
|
getRunDir(): string | null;
|
|
@@ -40,7 +41,7 @@ export declare class InMemoryRunStore implements RunStore {
|
|
|
40
41
|
meta: Run | null;
|
|
41
42
|
messages: Run['messages'];
|
|
42
43
|
report: string | null;
|
|
43
|
-
events: readonly
|
|
44
|
+
events: readonly PersistedRunEvent[];
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/store/run/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/store/run/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,KAAK,EAAE,iBA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,GAAG,CAAC,UAAU,CAAC,CAAA;QACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAA;KACpC;CAGD"}
|
package/dist/store/run/memory.js
CHANGED
|
@@ -20,6 +20,18 @@ export class InMemoryRunStore {
|
|
|
20
20
|
report = null;
|
|
21
21
|
events = [];
|
|
22
22
|
async initRun(runId, parentRunId) {
|
|
23
|
+
// Rebinding to a DIFFERENT run starts that run's evidence empty. The disk
|
|
24
|
+
// store gets this for free — a different id is a different directory —
|
|
25
|
+
// and this one has to say it, because one instance reused for a replay
|
|
26
|
+
// fork otherwise reports the origin run's events, its messages and its
|
|
27
|
+
// report as the new run's own. Evidence attributed to the wrong run is
|
|
28
|
+
// worse than none: it is wrong and it looks right.
|
|
29
|
+
if (this.runId !== null && this.runId !== runId) {
|
|
30
|
+
this.meta = null;
|
|
31
|
+
this.messages = [];
|
|
32
|
+
this.report = null;
|
|
33
|
+
this.events = [];
|
|
34
|
+
}
|
|
23
35
|
this.runId = runId;
|
|
24
36
|
this.parentRunId = parentRunId;
|
|
25
37
|
// No location, and that is the honest answer rather than a defect.
|
|
@@ -58,7 +70,24 @@ export class InMemoryRunStore {
|
|
|
58
70
|
// line — a parity test compares the two read-backs, and a timestamp
|
|
59
71
|
// present in one medium and absent in the other would make identical
|
|
60
72
|
// runs look different depending on where they were recorded.
|
|
61
|
-
|
|
73
|
+
//
|
|
74
|
+
// An unsequenced event takes its position in the log, which is the same
|
|
75
|
+
// rule the disk reader applies to a line written before events were
|
|
76
|
+
// numbered. Nothing in the kernel appends unsequenced today; the rule is
|
|
77
|
+
// here so the two backends cannot answer differently if something does.
|
|
78
|
+
this.events.push({
|
|
79
|
+
...event,
|
|
80
|
+
seq: event.seq ?? this.events.length + 1,
|
|
81
|
+
timestamp: Date.now(),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async readEvents(options) {
|
|
85
|
+
this.requireInit();
|
|
86
|
+
const sinceSeq = options?.sinceSeq ?? 0;
|
|
87
|
+
// Copied, not sliced by reference, for the same reason `writeRunMeta`
|
|
88
|
+
// clones: a caller holding the array must not be able to reach into the
|
|
89
|
+
// log through it.
|
|
90
|
+
return this.events.filter((event) => event.seq > sinceSeq).map((event) => ({ ...event }));
|
|
62
91
|
}
|
|
63
92
|
async writeReport(content) {
|
|
64
93
|
this.requireInit();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/store/run/memory.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,gBAAgB;IACpB,KAAK,GAAkB,IAAI,CAAA;IAC3B,WAAW,CAAoB;IAC/B,IAAI,GAAe,IAAI,CAAA;IACvB,QAAQ,GAAoB,EAAE,CAAA;IAC9B,MAAM,GAAkB,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/store/run/memory.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,gBAAgB;IACpB,KAAK,GAAkB,IAAI,CAAA;IAC3B,WAAW,CAAoB;IAC/B,IAAI,GAAe,IAAI,CAAA;IACvB,QAAQ,GAAoB,EAAE,CAAA;IAC9B,MAAM,GAAkB,IAAI,CAAA;IAC5B,MAAM,GAAwB,EAAE,CAAA;IAExC,KAAK,CAAC,OAAO,CAAC,KAAa,EAAE,WAAoB;QAChD,0EAA0E;QAC1E,uEAAuE;QACvE,uEAAuE;QACvE,uEAAuE;QACvE,uEAAuE;QACvE,mDAAmD;QACnD,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;YAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;YAClB,IAAI,CAAC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AE,SAAQ;YAC3E,kEAAkE;YAClE,kEAAkE;YAClE,iEAAiE;YACjE,6DAA6D;YAC7D,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE;gBACxB,SAAS;gBACT,QAAQ;gBACR,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;gBACpD,OAAO,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI;aAC3B,CAAC,CAAA;QACH,CAAC;QACD,OAAO,SAAS,CAAA;IACjB,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,yEAAyE;IACzE,uEAAuE;IACvE,0EAA0E;IAC1E,0EAA0E;IAE1E,0EAA0E;IAC1E,QAAQ;QAMP,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;IAC9F,CAAC;CACD"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* What a check concluded.
|
|
3
|
+
*
|
|
4
|
+
* `skipped` and `inconclusive` are the two ways a check produces no verdict,
|
|
5
|
+
* and they are separate because a caller acts on them differently.
|
|
6
|
+
*
|
|
7
|
+
* - `skipped` — the check LOOKED and there was nothing here to check: an
|
|
8
|
+
* optional package is not installed, a registry the check reads has no
|
|
9
|
+
* auto-discovery to read, nothing is configured yet. A permanent or
|
|
10
|
+
* by-design absence, and an ordinary state of a healthy machine.
|
|
11
|
+
* - `inconclusive` — the check DID NOT ANSWER: it timed out, it was aborted,
|
|
12
|
+
* the thing it reads threw. Nothing is known either way, and that is itself
|
|
13
|
+
* a gap in the report worth acting on.
|
|
14
|
+
*
|
|
15
|
+
* The word used to cover both, so `namzu doctor` could not tell "healthy" from
|
|
16
|
+
* "did not manage to look", and neither could anything reading its exit code.
|
|
17
|
+
*/
|
|
18
|
+
export type DoctorStatus = 'pass' | 'fail' | 'inconclusive' | 'warn' | 'skipped';
|
|
2
19
|
export type DoctorCategory = 'sandbox' | 'providers' | 'vault' | 'telemetry' | 'runtime' | 'plugins' | 'custom';
|
|
3
20
|
export interface DoctorCheckContext {
|
|
4
21
|
readonly cwd: string;
|
|
@@ -34,8 +51,17 @@ export interface DoctorReport {
|
|
|
34
51
|
readonly fail: number;
|
|
35
52
|
readonly inconclusive: number;
|
|
36
53
|
readonly warn: number;
|
|
54
|
+
readonly skipped: number;
|
|
55
|
+
/** Every other count sums to this. A reader may rely on that. */
|
|
37
56
|
readonly total: number;
|
|
38
57
|
};
|
|
39
|
-
|
|
58
|
+
/**
|
|
59
|
+
* `69` is sysexits `EX_UNAVAILABLE`, whose own definition ends "a catchall
|
|
60
|
+
* when something you wanted to do doesn't work, but you don't know why".
|
|
61
|
+
* That is `inconclusive`. It is not `2`, which this report already spends on
|
|
62
|
+
* "nothing was registered", and not `70`, which says the CLI is broken and
|
|
63
|
+
* is worth a bug report.
|
|
64
|
+
*/
|
|
65
|
+
readonly exit: 0 | 1 | 2 | 69 | 70;
|
|
40
66
|
}
|
|
41
67
|
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/types/doctor/check.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/types/doctor/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CAAA;AAEhF,MAAM,MAAM,cAAc,GACvB,SAAS,GACT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AQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;QAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,iEAAiE;QACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACtB,CAAA;IACD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;CAClC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a reconnecting consumer left off, and whether the kernel can honour it.
|
|
3
|
+
*
|
|
4
|
+
* The shortfall is a VALUE here, not a sentence in a document. A consumer that
|
|
5
|
+
* asks for everything after sequence 400 and silently receives a splice from a
|
|
6
|
+
* different generation of the run is wrong and has no way to find out; a
|
|
7
|
+
* consumer handed `{ status: 'unavailable', reason: 'cursor_ahead' }` re-derives
|
|
8
|
+
* from the transcript and is right. That is refuse-do-not-degrade applied to a
|
|
9
|
+
* subscription rather than to a capability.
|
|
10
|
+
*/
|
|
11
|
+
import type { ClaimFence } from './checkpoint-store.js';
|
|
12
|
+
import type { PersistedRunEvent } from './events.js';
|
|
13
|
+
/** What a consumer holds when it comes back. */
|
|
14
|
+
export interface RunEventCursor {
|
|
15
|
+
/**
|
|
16
|
+
* The last `seq` the consumer actually received, from the envelope. Zero —
|
|
17
|
+
* or the field absent — means "from the beginning".
|
|
18
|
+
*/
|
|
19
|
+
readonly sinceSeq: number;
|
|
20
|
+
/**
|
|
21
|
+
* The `generation` carried on the events the consumer received, when they
|
|
22
|
+
* carried one.
|
|
23
|
+
*
|
|
24
|
+
* Compared for equality only. Absent on both sides is not a match and not a
|
|
25
|
+
* mismatch: it is an unfenced run, where the sequence is the only evidence
|
|
26
|
+
* available and the log persisting is the assumption.
|
|
27
|
+
*/
|
|
28
|
+
readonly generation?: ClaimFence;
|
|
29
|
+
}
|
|
30
|
+
/** Why a cursor could not be honoured. */
|
|
31
|
+
export type RunEventReplayRefusal =
|
|
32
|
+
/**
|
|
33
|
+
* The consumer claims to have seen more than the log holds.
|
|
34
|
+
*
|
|
35
|
+
* The ordinary cause is not a lying client: it is a log that did not
|
|
36
|
+
* survive. An in-memory run store on a restarted process seeds at zero
|
|
37
|
+
* while the consumer still holds 400, and this is the verdict that says so
|
|
38
|
+
* instead of reporting a serene "you are up to date".
|
|
39
|
+
*/
|
|
40
|
+
'cursor_ahead'
|
|
41
|
+
/**
|
|
42
|
+
* The run has been taken over since. The consumer's sequence numbers were
|
|
43
|
+
* minted under an older claim and address a different sequence space, so
|
|
44
|
+
* they are not comparable — not merely stale.
|
|
45
|
+
*/
|
|
46
|
+
| 'generation_changed'
|
|
47
|
+
/**
|
|
48
|
+
* The store answered, and its oldest available event is above the one after
|
|
49
|
+
* the cursor. A pruning or windowed backend, caught at the boundary rather
|
|
50
|
+
* than delivered as a continuous stream with a hole in it.
|
|
51
|
+
*/
|
|
52
|
+
| 'gap';
|
|
53
|
+
/** What came of a cursor. */
|
|
54
|
+
export type RunEventReplay =
|
|
55
|
+
/** The cursor is already at the log's head. Nothing was missed. */
|
|
56
|
+
{
|
|
57
|
+
readonly status: 'complete';
|
|
58
|
+
}
|
|
59
|
+
/** Contiguous from `sinceSeq + 1`, oldest first. */
|
|
60
|
+
| {
|
|
61
|
+
readonly status: 'replayed';
|
|
62
|
+
readonly events: readonly PersistedRunEvent[];
|
|
63
|
+
}
|
|
64
|
+
/** Nothing is delivered. The consumer re-derives from the transcript. */
|
|
65
|
+
| {
|
|
66
|
+
readonly status: 'unavailable';
|
|
67
|
+
readonly reason: RunEventReplayRefusal;
|
|
68
|
+
};
|
|
69
|
+
/** The log's present state, as the store reports it. */
|
|
70
|
+
export interface RunEventLogHead {
|
|
71
|
+
/** Highest sequence in the log; zero when it is empty. */
|
|
72
|
+
readonly lastSeq: number;
|
|
73
|
+
/** The fence the run is being written under, when it holds a claim. */
|
|
74
|
+
readonly generation?: ClaimFence;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Decide what a cursor is owed, given what the log holds.
|
|
78
|
+
*
|
|
79
|
+
* Pure, and ordered deliberately: a takeover invalidates the sequence space, so
|
|
80
|
+
* comparing sequences across generations would be arithmetic on two different
|
|
81
|
+
* scales. The generation check therefore runs FIRST, before the numbers are
|
|
82
|
+
* allowed to mean anything.
|
|
83
|
+
*
|
|
84
|
+
* `events` is what the store returned for `{ sinceSeq: cursor.sinceSeq }`. It is
|
|
85
|
+
* passed in rather than fetched here so this stays a function of its arguments
|
|
86
|
+
* — the property "no gap, no duplicate" is decidable from the three inputs, and
|
|
87
|
+
* a test can drive every branch without a store.
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveRunEventReplay(cursor: RunEventCursor, head: RunEventLogHead, events: readonly PersistedRunEvent[]): RunEventReplay;
|
|
90
|
+
//# sourceMappingURL=event-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-cursor.d.ts","sourceRoot":"","sources":["../../../src/types/run/event-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;CAChC;AAED,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB;AAChC;;;;;;;GAOG;AACD,cAAc;AAChB;;;;GAIG;GACD,oBAAoB;AACtB;;;;GAIG;GACD,KAAK,CAAA;AAER,6BAA6B;AAC7B,MAAM,MAAM,cAAc;AACzB,mEAAmE;AACjE;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE;AACjC,oDAAoD;GAClD;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAA;CAAE;AAChF,yEAAyE;GACvE;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAA;AAE7E,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,SAAS,iBAAiB,EAAE,GAClC,cAAc,CA2BhB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a reconnecting consumer left off, and whether the kernel can honour it.
|
|
3
|
+
*
|
|
4
|
+
* The shortfall is a VALUE here, not a sentence in a document. A consumer that
|
|
5
|
+
* asks for everything after sequence 400 and silently receives a splice from a
|
|
6
|
+
* different generation of the run is wrong and has no way to find out; a
|
|
7
|
+
* consumer handed `{ status: 'unavailable', reason: 'cursor_ahead' }` re-derives
|
|
8
|
+
* from the transcript and is right. That is refuse-do-not-degrade applied to a
|
|
9
|
+
* subscription rather than to a capability.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Decide what a cursor is owed, given what the log holds.
|
|
13
|
+
*
|
|
14
|
+
* Pure, and ordered deliberately: a takeover invalidates the sequence space, so
|
|
15
|
+
* comparing sequences across generations would be arithmetic on two different
|
|
16
|
+
* scales. The generation check therefore runs FIRST, before the numbers are
|
|
17
|
+
* allowed to mean anything.
|
|
18
|
+
*
|
|
19
|
+
* `events` is what the store returned for `{ sinceSeq: cursor.sinceSeq }`. It is
|
|
20
|
+
* passed in rather than fetched here so this stays a function of its arguments
|
|
21
|
+
* — the property "no gap, no duplicate" is decidable from the three inputs, and
|
|
22
|
+
* a test can drive every branch without a store.
|
|
23
|
+
*/
|
|
24
|
+
export function resolveRunEventReplay(cursor, head, events) {
|
|
25
|
+
// Both sides must carry one for a mismatch to mean anything. An unfenced run
|
|
26
|
+
// has no generation to disagree with, and treating "absent" as a distinct
|
|
27
|
+
// value would refuse every run that never took a claim — which is most of
|
|
28
|
+
// them.
|
|
29
|
+
if (cursor.generation !== undefined &&
|
|
30
|
+
head.generation !== undefined &&
|
|
31
|
+
cursor.generation !== head.generation) {
|
|
32
|
+
return { status: 'unavailable', reason: 'generation_changed' };
|
|
33
|
+
}
|
|
34
|
+
if (cursor.sinceSeq > head.lastSeq) {
|
|
35
|
+
return { status: 'unavailable', reason: 'cursor_ahead' };
|
|
36
|
+
}
|
|
37
|
+
if (cursor.sinceSeq === head.lastSeq)
|
|
38
|
+
return { status: 'complete' };
|
|
39
|
+
// The log says there is something above the cursor, so an empty answer is
|
|
40
|
+
// the store contradicting its own head rather than "nothing to send".
|
|
41
|
+
const first = events[0];
|
|
42
|
+
if (!first || first.seq !== cursor.sinceSeq + 1) {
|
|
43
|
+
return { status: 'unavailable', reason: 'gap' };
|
|
44
|
+
}
|
|
45
|
+
return { status: 'replayed', events };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=event-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-cursor.js","sourceRoot":"","sources":["../../../src/types/run/event-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACpC,MAAsB,EACtB,IAAqB,EACrB,MAAoC;IAEpC,6EAA6E;IAC7E,0EAA0E;IAC1E,0EAA0E;IAC1E,QAAQ;IACR,IACC,MAAM,CAAC,UAAU,KAAK,SAAS;QAC/B,IAAI,CAAC,UAAU,KAAK,SAAS;QAC7B,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,EACpC,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAA;IAC/D,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;IACzD,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;IAEnE,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,KAAK,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IAChD,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;AACtC,CAAC"}
|
|
@@ -6,6 +6,7 @@ import type { ActivityId, MessageId, PlanId, PluginId, RunId, SandboxId, TaskId,
|
|
|
6
6
|
import type { PlanStep } from '../plan/index.js';
|
|
7
7
|
import type { PluginHookEvent, PluginHookResult } from '../plugin/index.js';
|
|
8
8
|
import type { TaskStatus } from '../task/index.js';
|
|
9
|
+
import type { ClaimFence } from './checkpoint-store.js';
|
|
9
10
|
import type { Lineage } from './lineage.js';
|
|
10
11
|
import type { MessageStopReason, StopReason } from './stop-reason.js';
|
|
11
12
|
import type { SubsessionIdledEvent, SubsessionMessagedEvent, SubsessionSpawnedEvent } from './subsession-events.js';
|
|
@@ -28,6 +29,57 @@ interface RunEventEnvelope {
|
|
|
28
29
|
*/
|
|
29
30
|
schemaVersion?: 3;
|
|
30
31
|
lineage?: Lineage;
|
|
32
|
+
/**
|
|
33
|
+
* This event's position in its OWN run's durable event log, from 1.
|
|
34
|
+
*
|
|
35
|
+
* **Present means recorded.** The emitter takes a candidate number, appends
|
|
36
|
+
* the event stamped with it, and only then advances the counter and hands
|
|
37
|
+
* the event to the live stream — so a `seq` a consumer can see is a `seq`
|
|
38
|
+
* the log contains. That is what makes it usable as a cursor: reconnect,
|
|
39
|
+
* ask for everything above it, and nothing is missed and nothing arrives
|
|
40
|
+
* twice.
|
|
41
|
+
*
|
|
42
|
+
* **Absent means not recoverable**, and three different things arrive that
|
|
43
|
+
* way:
|
|
44
|
+
*
|
|
45
|
+
* - the high-frequency events {@link isEphemeralEvent} names, which are
|
|
46
|
+
* deliberately never persisted;
|
|
47
|
+
* - an event whose durable write FAILED — it still reaches the live
|
|
48
|
+
* stream, unstamped, because losing the news of a failure is worse than
|
|
49
|
+
* delivering it without a cursor;
|
|
50
|
+
* - the delegation lifecycle events (`agent_pending`, `agent_completed`,
|
|
51
|
+
* `agent_failed`, `agent_canceled` and the three sub-session variants),
|
|
52
|
+
* which the agent manager hands straight to a host's listener without
|
|
53
|
+
* passing through the run's event translator at all. They are not in any
|
|
54
|
+
* run's log, and the missing `seq` is how a consumer learns that rather
|
|
55
|
+
* than discovering it after a reconnect.
|
|
56
|
+
*
|
|
57
|
+
* **Per run, not per stream.** A parent's listener also receives its
|
|
58
|
+
* children's events, each numbered in its own run's log, so a consumer
|
|
59
|
+
* keeps one cursor per `runId`. The SSE mapper carries the pair as
|
|
60
|
+
* `<runId>:<seq>` for exactly this reason.
|
|
61
|
+
*
|
|
62
|
+
* Monotonic under a single writer. The run store takes no claim fence
|
|
63
|
+
* today (see `QueryParams.claimFence`), so two workers that both took one
|
|
64
|
+
* run can both append — `generation` is what makes that detectable.
|
|
65
|
+
*/
|
|
66
|
+
seq?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The claim fence the run was being written under, when it holds a claim.
|
|
69
|
+
*
|
|
70
|
+
* A sequence alone lies across a takeover: a client at seq 400 reconnects
|
|
71
|
+
* to a run whose store lost its log, the new writer starts at 1, and the
|
|
72
|
+
* client's cursor silently addresses a different sequence space. The fence
|
|
73
|
+
* is already the arbiter of who may write and it only increases, so
|
|
74
|
+
* carrying it here makes a takeover ORDERED rather than merely
|
|
75
|
+
* distinguishable.
|
|
76
|
+
*
|
|
77
|
+
* Absent when the run was written unfenced, which is every run that took no
|
|
78
|
+
* claim. A cursor then relies on the log persisting — the disk store's
|
|
79
|
+
* does, an in-memory store's does not, and `cursor_ahead` is the verdict
|
|
80
|
+
* that catches the difference.
|
|
81
|
+
*/
|
|
82
|
+
generation?: ClaimFence;
|
|
31
83
|
}
|
|
32
84
|
type CoreRunEvent = {
|
|
33
85
|
type: 'run_started';
|
|
@@ -648,7 +700,25 @@ type CoreRunEvent = {
|
|
|
648
700
|
* (`subsession_spawned`, `subsession_messaged`, `subsession_idled`) carry a
|
|
649
701
|
* required `lineage` — see session-hierarchy.md §10.4.
|
|
650
702
|
*/
|
|
651
|
-
export type RunEvent = (CoreRunEvent & RunEventEnvelope) | SubsessionSpawnedEvent | SubsessionMessagedEvent | SubsessionIdledEvent;
|
|
703
|
+
export type RunEvent = (CoreRunEvent & RunEventEnvelope) | (SubsessionSpawnedEvent & RunEventEnvelope) | (SubsessionMessagedEvent & RunEventEnvelope) | (SubsessionIdledEvent & RunEventEnvelope);
|
|
652
704
|
export type RunEventListener = (event: RunEvent) => void | Promise<void>;
|
|
705
|
+
/**
|
|
706
|
+
* A run event as the durable log gives it back.
|
|
707
|
+
*
|
|
708
|
+
* `seq` and `timestamp` are REQUIRED here and optional on the live envelope,
|
|
709
|
+
* which is the whole difference between the two types: a recorded event has a
|
|
710
|
+
* position and a moment, and a live one may be neither recorded nor
|
|
711
|
+
* recoverable.
|
|
712
|
+
*
|
|
713
|
+
* `timestamp` is not new — both store implementations have always stamped it
|
|
714
|
+
* on write. It was simply never declared anywhere, so the field was persisted
|
|
715
|
+
* by two writers, typed by neither, and read by nobody. Declaring it is what
|
|
716
|
+
* lets the read-back stop casting.
|
|
717
|
+
*/
|
|
718
|
+
export type PersistedRunEvent = RunEvent & {
|
|
719
|
+
readonly seq: number;
|
|
720
|
+
/** Epoch ms at which the store recorded the event. */
|
|
721
|
+
readonly timestamp: number;
|
|
722
|
+
};
|
|
653
723
|
export declare function isEphemeralEvent(event: RunEvent): boolean;
|
|
654
724
|
//# sourceMappingURL=events.d.ts.map
|