@namzu/sdk 20.2.0 → 20.4.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 +185 -0
- package/dist/manager/run/persistence.d.ts +2 -2
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +14 -5
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/public-runtime.d.ts +2 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +6 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts +27 -1
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +34 -4
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/context.d.ts +2 -0
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +1 -0
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/index.d.ts +32 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +5 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/resume-run.d.ts +9 -1
- package/dist/runtime/query/resume-run.d.ts.map +1 -1
- package/dist/runtime/query/resume-run.js +2 -1
- package/dist/runtime/query/resume-run.js.map +1 -1
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +2 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/run/checkpoint-disk.d.ts +18 -2
- package/dist/store/run/checkpoint-disk.d.ts.map +1 -1
- package/dist/store/run/checkpoint-disk.js +50 -5
- package/dist/store/run/checkpoint-disk.js.map +1 -1
- package/dist/store/run/checkpoint-memory.d.ts +22 -2
- package/dist/store/run/checkpoint-memory.d.ts.map +1 -1
- package/dist/store/run/checkpoint-memory.js +99 -4
- package/dist/store/run/checkpoint-memory.js.map +1 -1
- package/dist/store/run/claim-disk.d.ts +130 -0
- package/dist/store/run/claim-disk.d.ts.map +1 -0
- package/dist/store/run/claim-disk.js +550 -0
- package/dist/store/run/claim-disk.js.map +1 -0
- package/dist/store/run/disk.d.ts +10 -8
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/listing.d.ts +44 -1
- package/dist/store/run/listing.d.ts.map +1 -1
- package/dist/store/run/listing.js +92 -1
- package/dist/store/run/listing.js.map +1 -1
- package/dist/store/run/memory.d.ts +46 -0
- package/dist/store/run/memory.d.ts.map +1 -0
- package/dist/store/run/memory.js +104 -0
- package/dist/store/run/memory.js.map +1 -0
- package/dist/types/run/checkpoint-store.d.ts +178 -2
- package/dist/types/run/checkpoint-store.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +12 -0
- package/dist/types/run/config.d.ts.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 +103 -0
- package/dist/types/run/store.d.ts.map +1 -0
- package/dist/types/run/store.js +30 -0
- package/dist/types/run/store.js.map +1 -0
- package/package.json +1 -1
- package/src/manager/run/persistence.ts +17 -7
- package/src/public-runtime.ts +6 -0
- package/src/runtime/query/checkpoint.ts +42 -5
- package/src/runtime/query/context.ts +3 -0
- package/src/runtime/query/index.ts +39 -1
- package/src/runtime/query/resume-run.ts +12 -2
- package/src/store/index.ts +5 -0
- package/src/store/run/checkpoint-disk.ts +70 -5
- package/src/store/run/checkpoint-memory.ts +118 -3
- package/src/store/run/claim-disk.ts +593 -0
- package/src/store/run/disk.ts +10 -8
- package/src/store/run/listing.ts +116 -1
- package/src/store/run/memory.ts +121 -0
- package/src/types/run/checkpoint-store.ts +189 -2
- package/src/types/run/config.ts +13 -0
- package/src/types/run/index.ts +1 -0
- package/src/types/run/store.ts +112 -0
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* one store and not the other, and the whole point of a store contract is
|
|
8
8
|
* that a host can swap the backend without swapping the semantics.
|
|
9
9
|
*/
|
|
10
|
+
import { NamzuError } from '../../types/errors/index.js';
|
|
10
11
|
import type { IterationCheckpoint } from '../../types/hitl/index.js';
|
|
11
|
-
import type { CheckpointListingScope, CheckpointRunScope, CheckpointStore, DurableRunEntry, DurableRunPage, ListDurableRunsOptions, ParkSummary } from '../../types/run/checkpoint-store.js';
|
|
12
|
+
import type { CheckpointListingScope, CheckpointRunScope, CheckpointStore, ClaimFence, ClaimRunOptions, ClaimSummary, DurableRunEntry, DurableRunPage, ListDurableRunsOptions, ParkSummary, RunClaim } from '../../types/run/checkpoint-store.js';
|
|
12
13
|
/** Page size when the caller names none. */
|
|
13
14
|
export declare const DEFAULT_DURABLE_RUN_LIMIT = 100;
|
|
14
15
|
/**
|
|
@@ -72,4 +73,46 @@ export declare function paginateDurableRuns(entries: readonly DurableRunEntry[],
|
|
|
72
73
|
* silently never fires.
|
|
73
74
|
*/
|
|
74
75
|
export declare function listDurableRuns(store: CheckpointStore, scope: CheckpointListingScope, options?: ListDurableRunsOptions): Promise<DurableRunPage>;
|
|
76
|
+
/**
|
|
77
|
+
* Take working possession of a run, refusing when the store cannot arbitrate.
|
|
78
|
+
*
|
|
79
|
+
* The refusal is the entire safety property. `claimRun` is optional on the
|
|
80
|
+
* contract, and the natural way to reach an absent optional method is to skip
|
|
81
|
+
* it — which here means every worker proceeds, believing it holds a run
|
|
82
|
+
* nobody arbitrated. Two workers then restore the same checkpoint, both run
|
|
83
|
+
* the tools, and both write under one run id; half the work vanishes with no
|
|
84
|
+
* error anywhere.
|
|
85
|
+
*
|
|
86
|
+
* So a store with no claim support does not get "claimed by default". It gets
|
|
87
|
+
* an error naming the deployment shape it cannot support. A single-writer
|
|
88
|
+
* host never calls this and is unaffected.
|
|
89
|
+
*
|
|
90
|
+
* Returns `null` — not an error — when another holder has the run. That is
|
|
91
|
+
* the ordinary outcome of two readers on one queue, and a caller loops to the
|
|
92
|
+
* next run rather than handling a fault.
|
|
93
|
+
*/
|
|
94
|
+
export declare function claimRun(store: CheckpointStore, scope: CheckpointRunScope, options: ClaimRunOptions): Promise<RunClaim | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Give a claim up early, refusing when the store cannot arbitrate.
|
|
97
|
+
*
|
|
98
|
+
* Refuses for the same reason as {@link claimRun}: a host that believes it is
|
|
99
|
+
* releasing a claim on a store that has none is a host that believes the
|
|
100
|
+
* whole mechanism is running.
|
|
101
|
+
*/
|
|
102
|
+
export declare function releaseRun(store: CheckpointStore, scope: CheckpointRunScope, fence: ClaimFence): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* The refusal a store raises when a write presents a superseded fence.
|
|
105
|
+
*
|
|
106
|
+
* Shared so both shipped stores say the same thing, and so a host writing its
|
|
107
|
+
* own backend raises something a caller can branch on rather than a message
|
|
108
|
+
* string. This is the moment a stalled worker learns it lost the run — the
|
|
109
|
+
* only moment it CAN learn, since from the inside a pause and a partition
|
|
110
|
+
* both look like time not passing.
|
|
111
|
+
*/
|
|
112
|
+
export declare function fencedOut(scope: CheckpointRunScope, presented: number, current: number): NamzuError;
|
|
113
|
+
/**
|
|
114
|
+
* Whether a recorded claim still holds at `now`, and the summary a listing
|
|
115
|
+
* reports for it.
|
|
116
|
+
*/
|
|
117
|
+
export declare function toClaimSummary(claim: RunClaim, now: number): ClaimSummary;
|
|
75
118
|
//# sourceMappingURL=listing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../../src/store/run/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../../src/store/run/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,2BAA2B,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B,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACxB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACb,UAAU,CAOZ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAUzE"}
|
|
@@ -147,9 +147,16 @@ export function toDurableRunEntry(scope, checkpoints, now) {
|
|
|
147
147
|
*/
|
|
148
148
|
export function paginateDurableRuns(entries, options) {
|
|
149
149
|
const wanted = options?.park;
|
|
150
|
-
const
|
|
150
|
+
const byPark = wanted && wanted.length > 0
|
|
151
151
|
? entries.filter((e) => e.park !== undefined && wanted.includes(e.park.state))
|
|
152
152
|
: entries;
|
|
153
|
+
// An expired claim counts as unheld. That is what expiry means, and a
|
|
154
|
+
// queue reader that treated an expired claim as held would leave a dead
|
|
155
|
+
// worker's runs invisible forever — the exact failure a lease exists to
|
|
156
|
+
// prevent, reintroduced by the filter that reads it.
|
|
157
|
+
const filtered = options?.claimed === undefined
|
|
158
|
+
? byPark
|
|
159
|
+
: byPark.filter((e) => (e.claim !== undefined && !e.claim.expired) === options.claimed);
|
|
153
160
|
// Both orders sort on a key that cannot move under a paging caller — see
|
|
154
161
|
// the contract comment on `listDurableRuns`.
|
|
155
162
|
const orderBy = options?.orderBy ?? 'runId';
|
|
@@ -239,4 +246,88 @@ export async function listDurableRuns(store, scope, options) {
|
|
|
239
246
|
assertContiguousListingScope(scope, 'listDurableRuns');
|
|
240
247
|
return store.listDurableRuns(scope, options);
|
|
241
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Take working possession of a run, refusing when the store cannot arbitrate.
|
|
251
|
+
*
|
|
252
|
+
* The refusal is the entire safety property. `claimRun` is optional on the
|
|
253
|
+
* contract, and the natural way to reach an absent optional method is to skip
|
|
254
|
+
* it — which here means every worker proceeds, believing it holds a run
|
|
255
|
+
* nobody arbitrated. Two workers then restore the same checkpoint, both run
|
|
256
|
+
* the tools, and both write under one run id; half the work vanishes with no
|
|
257
|
+
* error anywhere.
|
|
258
|
+
*
|
|
259
|
+
* So a store with no claim support does not get "claimed by default". It gets
|
|
260
|
+
* an error naming the deployment shape it cannot support. A single-writer
|
|
261
|
+
* host never calls this and is unaffected.
|
|
262
|
+
*
|
|
263
|
+
* Returns `null` — not an error — when another holder has the run. That is
|
|
264
|
+
* the ordinary outcome of two readers on one queue, and a caller loops to the
|
|
265
|
+
* next run rather than handling a fault.
|
|
266
|
+
*/
|
|
267
|
+
export async function claimRun(store, scope, options) {
|
|
268
|
+
if (typeof store.claimRun !== 'function') {
|
|
269
|
+
throw new NamzuError({
|
|
270
|
+
code: 'capability_unavailable',
|
|
271
|
+
message: 'claimRun: the injected checkpoint store does not implement `claimRun`, so it cannot arbitrate between two workers taking the same run. Refusing rather than proceeding unclaimed — proceeding would let two workers restore one checkpoint, both execute its tools, and both write under one run id, which loses half the work and reports nothing. Supply a store that implements it, or run a single writer per run.',
|
|
272
|
+
details: { runId: scope.runId },
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (!Number.isFinite(options.ttlMs) || options.ttlMs <= 0) {
|
|
276
|
+
throw new NamzuError({
|
|
277
|
+
code: 'invalid_config',
|
|
278
|
+
message: `claimRun: ttlMs must be a positive number of milliseconds, got ${String(options.ttlMs)}. A lease that expires immediately is a lease every worker can take at once, which is the condition this call exists to prevent.`,
|
|
279
|
+
details: { runId: scope.runId, ttlMs: options.ttlMs },
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return store.claimRun(scope, options);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Give a claim up early, refusing when the store cannot arbitrate.
|
|
286
|
+
*
|
|
287
|
+
* Refuses for the same reason as {@link claimRun}: a host that believes it is
|
|
288
|
+
* releasing a claim on a store that has none is a host that believes the
|
|
289
|
+
* whole mechanism is running.
|
|
290
|
+
*/
|
|
291
|
+
export async function releaseRun(store, scope, fence) {
|
|
292
|
+
if (typeof store.releaseRun !== 'function') {
|
|
293
|
+
throw new NamzuError({
|
|
294
|
+
code: 'capability_unavailable',
|
|
295
|
+
message: 'releaseRun: the injected checkpoint store does not implement `releaseRun`. A release that silently does nothing would leave the run held until its lease expires while the caller believes it is back on the queue.',
|
|
296
|
+
details: { runId: scope.runId },
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
return store.releaseRun(scope, fence);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The refusal a store raises when a write presents a superseded fence.
|
|
303
|
+
*
|
|
304
|
+
* Shared so both shipped stores say the same thing, and so a host writing its
|
|
305
|
+
* own backend raises something a caller can branch on rather than a message
|
|
306
|
+
* string. This is the moment a stalled worker learns it lost the run — the
|
|
307
|
+
* only moment it CAN learn, since from the inside a pause and a partition
|
|
308
|
+
* both look like time not passing.
|
|
309
|
+
*/
|
|
310
|
+
export function fencedOut(scope, presented, current) {
|
|
311
|
+
return new NamzuError({
|
|
312
|
+
code: 'storage_error',
|
|
313
|
+
message: `writeCheckpoint: refusing a write for run ${scope.runId} fenced at ${presented} — the run is now claimed at ${current}. Another worker took this run over, so this process no longer holds it and its work is not the record. Stop the run rather than retrying: the claim is gone, not busy.`,
|
|
314
|
+
details: { runId: scope.runId, presentedFence: presented, currentFence: current },
|
|
315
|
+
retryable: false,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Whether a recorded claim still holds at `now`, and the summary a listing
|
|
320
|
+
* reports for it.
|
|
321
|
+
*/
|
|
322
|
+
export function toClaimSummary(claim, now) {
|
|
323
|
+
return {
|
|
324
|
+
holder: claim.holder,
|
|
325
|
+
fence: claim.fence,
|
|
326
|
+
expiresAt: claim.expiresAt,
|
|
327
|
+
// Judged here, once, against the store's clock. Left to the caller it
|
|
328
|
+
// would be judged against a different one, and a single page could
|
|
329
|
+
// then disagree with itself about which rows are available.
|
|
330
|
+
expired: now >= claim.expiresAt,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
242
333
|
//# sourceMappingURL=listing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listing.js","sourceRoot":"","sources":["../../../src/store/run/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"listing.js","sourceRoot":"","sources":["../../../src/store/run/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAkBxD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AAE5C;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAA6B,EAAE,MAAc;IACzF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACpE,MAAM,IAAI,UAAU,CAAC;YACpB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,GAAG,MAAM,mMAAmM;YACrN,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE;SACjE,CAAC,CAAA;IACH,CAAC;AACF,CAAC;AAED,gFAAgF;AAChF,SAAS,cAAc,CAAC,OAAwB,EAAE,GAAW;IAC5D,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,GAAG,IAAI,OAAO,CAAC,UAAU,CAAA;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,OAAwB,EAAE,GAAW;IACzD,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,UAAU,CAAA;IACvD,OAAO,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAA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AAK,EAAE,KAAK,CAAC,KAAK,EAAE;SAC/B,CAAC,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACxB,KAAyB,EACzB,SAAiB,EACjB,OAAe;IAEf,OAAO,IAAI,UAAU,CAAC;QACrB,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,6CAA6C,KAAK,CAAC,KAAK,cAAc,SAAS,gCAAgC,OAAO,yKAAyK;QACxS,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE;QACjF,SAAS,EAAE,KAAK;KAChB,CAAC,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe,EAAE,GAAW;IAC1D,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,sEAAsE;QACtE,mEAAmE;QACnE,4DAA4D;QAC5D,OAAO,EAAE,GAAG,IAAI,KAAK,CAAC,SAAS;KAC/B,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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';
|
|
4
|
+
/**
|
|
5
|
+
* Process-local {@link RunStore}: a run's evidence with no filesystem.
|
|
6
|
+
*
|
|
7
|
+
* The reason it ships rather than living in a test file is that it is the
|
|
8
|
+
* only way to demonstrate the seam actually is one. A contract with a single
|
|
9
|
+
* implementation is a refactor; the second implementation is what proves a
|
|
10
|
+
* host could supply a third. It is also the parity partner for the disk
|
|
11
|
+
* store — a memory store that answers differently from disk is worse than
|
|
12
|
+
* none, because a host tests against one and ships the other.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately not durable. It is for tests, for a single-process host that
|
|
15
|
+
* genuinely wants a run's evidence to die with the process, and for
|
|
16
|
+
* environments with no writable filesystem at all.
|
|
17
|
+
*/
|
|
18
|
+
export declare class InMemoryRunStore implements RunStore {
|
|
19
|
+
private runId;
|
|
20
|
+
private parentRunId;
|
|
21
|
+
private meta;
|
|
22
|
+
private messages;
|
|
23
|
+
private report;
|
|
24
|
+
private readonly events;
|
|
25
|
+
initRun(runId: string, parentRunId?: string): Promise<string | null>;
|
|
26
|
+
private requireInit;
|
|
27
|
+
/** The run this store is bound to, and its parent when it has one. */
|
|
28
|
+
get boundTo(): {
|
|
29
|
+
runId: string;
|
|
30
|
+
parentRunId?: string;
|
|
31
|
+
} | null;
|
|
32
|
+
writeRunMeta(run: Run): Promise<void>;
|
|
33
|
+
writeMessages(run: Run): Promise<void>;
|
|
34
|
+
appendEvent(event: RunEvent): Promise<void>;
|
|
35
|
+
writeReport(content: string): Promise<string | null>;
|
|
36
|
+
readCompletedTools(): Promise<Map<string, CompletedToolRecord>>;
|
|
37
|
+
getRunDir(): string | null;
|
|
38
|
+
/** Everything recorded for the bound run, for tests and parity checks. */
|
|
39
|
+
snapshot(): {
|
|
40
|
+
meta: Run | null;
|
|
41
|
+
messages: Run['messages'];
|
|
42
|
+
report: string | null;
|
|
43
|
+
events: readonly RunEvent[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +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;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,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-local {@link RunStore}: a run's evidence with no filesystem.
|
|
3
|
+
*
|
|
4
|
+
* The reason it ships rather than living in a test file is that it is the
|
|
5
|
+
* only way to demonstrate the seam actually is one. A contract with a single
|
|
6
|
+
* implementation is a refactor; the second implementation is what proves a
|
|
7
|
+
* host could supply a third. It is also the parity partner for the disk
|
|
8
|
+
* store — a memory store that answers differently from disk is worse than
|
|
9
|
+
* none, because a host tests against one and ships the other.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately not durable. It is for tests, for a single-process host that
|
|
12
|
+
* genuinely wants a run's evidence to die with the process, and for
|
|
13
|
+
* environments with no writable filesystem at all.
|
|
14
|
+
*/
|
|
15
|
+
export class InMemoryRunStore {
|
|
16
|
+
runId = null;
|
|
17
|
+
parentRunId;
|
|
18
|
+
meta = null;
|
|
19
|
+
messages = [];
|
|
20
|
+
report = null;
|
|
21
|
+
events = [];
|
|
22
|
+
async initRun(runId, parentRunId) {
|
|
23
|
+
this.runId = runId;
|
|
24
|
+
this.parentRunId = parentRunId;
|
|
25
|
+
// No location, and that is the honest answer rather than a defect.
|
|
26
|
+
// Callers render `null` as "this run is not on a filesystem"; a
|
|
27
|
+
// synthesized path would put a directory that does not exist in front
|
|
28
|
+
// of an operator.
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
requireInit() {
|
|
32
|
+
if (this.runId === null) {
|
|
33
|
+
throw new Error('InMemoryRunStore not initialized — call initRun() first');
|
|
34
|
+
}
|
|
35
|
+
return this.runId;
|
|
36
|
+
}
|
|
37
|
+
/** The run this store is bound to, and its parent when it has one. */
|
|
38
|
+
get boundTo() {
|
|
39
|
+
return this.runId === null
|
|
40
|
+
? null
|
|
41
|
+
: { runId: this.runId, ...(this.parentRunId ? { parentRunId: this.parentRunId } : {}) };
|
|
42
|
+
}
|
|
43
|
+
async writeRunMeta(run) {
|
|
44
|
+
this.requireInit();
|
|
45
|
+
// Copied, not referenced. The caller keeps mutating this object for
|
|
46
|
+
// the rest of the run, so storing it by reference would make every
|
|
47
|
+
// historical read return the run's present state — a transcript that
|
|
48
|
+
// silently rewrites itself is worse than no transcript.
|
|
49
|
+
this.meta = structuredClone(run);
|
|
50
|
+
}
|
|
51
|
+
async writeMessages(run) {
|
|
52
|
+
this.requireInit();
|
|
53
|
+
this.messages = structuredClone(run.messages);
|
|
54
|
+
}
|
|
55
|
+
async appendEvent(event) {
|
|
56
|
+
this.requireInit();
|
|
57
|
+
// Stamped on write, exactly as the disk store stamps its transcript
|
|
58
|
+
// line — a parity test compares the two read-backs, and a timestamp
|
|
59
|
+
// present in one medium and absent in the other would make identical
|
|
60
|
+
// runs look different depending on where they were recorded.
|
|
61
|
+
this.events.push({ ...event, timestamp: Date.now() });
|
|
62
|
+
}
|
|
63
|
+
async writeReport(content) {
|
|
64
|
+
this.requireInit();
|
|
65
|
+
this.report = content;
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
async readCompletedTools() {
|
|
69
|
+
this.requireInit();
|
|
70
|
+
const completed = new Map();
|
|
71
|
+
for (const event of this.events) {
|
|
72
|
+
const e = event;
|
|
73
|
+
if (e.type !== 'tool_completed')
|
|
74
|
+
continue;
|
|
75
|
+
const toolUseId = e.toolUseId;
|
|
76
|
+
const toolName = e.toolName;
|
|
77
|
+
if (typeof toolUseId !== 'string' || typeof toolName !== 'string')
|
|
78
|
+
continue;
|
|
79
|
+
// Last write wins: a retried tool emits one event per attempt and
|
|
80
|
+
// the final one is what actually answered the call. Same rule the
|
|
81
|
+
// disk store applies, and it has to be the same rule — a resumed
|
|
82
|
+
// run must not depend on which backend it was recorded with.
|
|
83
|
+
completed.set(toolUseId, {
|
|
84
|
+
toolUseId,
|
|
85
|
+
toolName,
|
|
86
|
+
result: typeof e.result === 'string' ? e.result : '',
|
|
87
|
+
isError: e.isError === true,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return completed;
|
|
91
|
+
}
|
|
92
|
+
getRunDir() {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
// `addToIndex` is deliberately not implemented. It maintains a browsable
|
|
96
|
+
// catalogue for a human reading a directory, and there is no directory
|
|
97
|
+
// here. The optional method exists on the contract precisely so a backend
|
|
98
|
+
// can decline it rather than implement a no-op that looks like a listing.
|
|
99
|
+
/** Everything recorded for the bound run, for tests and parity checks. */
|
|
100
|
+
snapshot() {
|
|
101
|
+
return { meta: this.meta, messages: this.messages, report: this.report, events: this.events };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +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;IACnB,MAAM,GAAe,EAAE,CAAA;IAExC,KAAK,CAAC,OAAO,CAAC,KAAa,EAAE,WAAoB;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,mEAAmE;QACnE,gEAAgE;QAChE,sEAAsE;QACtE,kBAAkB;QAClB,OAAO,IAAI,CAAA;IACZ,CAAC;IAEO,WAAW;QAClB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;QAC3E,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAA;IAClB,CAAC;IAED,sEAAsE;IACtE,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI;YACzB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,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,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAA;YAC3B,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;gBAAE,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"}
|
|
@@ -167,6 +167,16 @@ export interface DurableRunEntry extends CheckpointRunScope {
|
|
|
167
167
|
readonly latestCheckpointAt: number;
|
|
168
168
|
/** Absent when the run has never parked. */
|
|
169
169
|
readonly park?: ParkSummary;
|
|
170
|
+
/**
|
|
171
|
+
* Absent when no process has ever claimed the run.
|
|
172
|
+
*
|
|
173
|
+
* A SIBLING of {@link DurableRunEntry.park}, not a member of
|
|
174
|
+
* {@link ParkState} — see the note on that union. A park is a question put
|
|
175
|
+
* to a human; a claim is a lease held by a process. A run can have both,
|
|
176
|
+
* neither, or either, and the state a queue worker needs most is parked
|
|
177
|
+
* AND unclaimed, which one union cannot say.
|
|
178
|
+
*/
|
|
179
|
+
readonly claim?: ClaimSummary;
|
|
170
180
|
}
|
|
171
181
|
/**
|
|
172
182
|
* Which order a listing comes back in.
|
|
@@ -198,6 +208,61 @@ export type DurableRunOrder =
|
|
|
198
208
|
* instead of a date nobody recorded.
|
|
199
209
|
*/
|
|
200
210
|
| 'createdAt';
|
|
211
|
+
/**
|
|
212
|
+
* A monotonically increasing number identifying one holding of a run's claim.
|
|
213
|
+
*
|
|
214
|
+
* The load-bearing word is *fencing*. A mutex answers "may I proceed", and a
|
|
215
|
+
* holder that stalls past its lease — a long GC pause, a suspended container,
|
|
216
|
+
* a partitioned network — answers it "yes" and then writes, long after
|
|
217
|
+
* somebody else legitimately took over. A fence answers a different question
|
|
218
|
+
* at the moment of the WRITE: "is the holding I belong to still the current
|
|
219
|
+
* one". Every claim of a run mints a number strictly greater than the last,
|
|
220
|
+
* so a store can reject a write from a superseded holder without knowing
|
|
221
|
+
* anything about processes, clocks or liveness.
|
|
222
|
+
*
|
|
223
|
+
* Not a random token, deliberately: randomness proves identity and cannot
|
|
224
|
+
* establish *order*, and order is the entire mechanism.
|
|
225
|
+
*/
|
|
226
|
+
export type ClaimFence = number;
|
|
227
|
+
/** A holding of a run's claim, as issued to the process that took it. */
|
|
228
|
+
export interface RunClaim {
|
|
229
|
+
/** Opaque caller-supplied identity — a worker id, a pod name. Evidence, not authority. */
|
|
230
|
+
readonly holder: string;
|
|
231
|
+
/** See {@link ClaimFence}. Present it on every durable write. */
|
|
232
|
+
readonly fence: ClaimFence;
|
|
233
|
+
/**
|
|
234
|
+
* Absolute epoch ms after which the claim may be taken by somebody else.
|
|
235
|
+
*
|
|
236
|
+
* Absolute rather than a duration for the same reason a park's deadline
|
|
237
|
+
* is: it has to survive the process that set it. A duration plus an
|
|
238
|
+
* in-process timer cannot — the holder is the thing that dies.
|
|
239
|
+
*/
|
|
240
|
+
readonly expiresAt: number;
|
|
241
|
+
}
|
|
242
|
+
/** A run's claim as a listing reports it. */
|
|
243
|
+
export interface ClaimSummary {
|
|
244
|
+
readonly holder: string;
|
|
245
|
+
readonly fence: ClaimFence;
|
|
246
|
+
readonly expiresAt: number;
|
|
247
|
+
/**
|
|
248
|
+
* Whether the claim had expired at the instant the listing was taken.
|
|
249
|
+
*
|
|
250
|
+
* A separate field rather than something the caller derives from
|
|
251
|
+
* `expiresAt`, because the caller would derive it against a DIFFERENT
|
|
252
|
+
* clock than the store used, and one page would then disagree with
|
|
253
|
+
* itself about which rows are available.
|
|
254
|
+
*/
|
|
255
|
+
readonly expired: boolean;
|
|
256
|
+
}
|
|
257
|
+
/** What a caller asks for when taking a run. */
|
|
258
|
+
export interface ClaimRunOptions {
|
|
259
|
+
/** Who is taking it. Recorded so an operator can see what holds a stuck run. */
|
|
260
|
+
readonly holder: string;
|
|
261
|
+
/** How long the holding is good for, in ms. */
|
|
262
|
+
readonly ttlMs: number;
|
|
263
|
+
/** Clock, for tests and so one operation judges every expiry against one instant. */
|
|
264
|
+
readonly now?: number;
|
|
265
|
+
}
|
|
201
266
|
/** Filters and paging for {@link CheckpointStore.listDurableRuns}. */
|
|
202
267
|
export interface ListDurableRunsOptions {
|
|
203
268
|
/**
|
|
@@ -212,6 +277,16 @@ export interface ListDurableRunsOptions {
|
|
|
212
277
|
* to include it.
|
|
213
278
|
*/
|
|
214
279
|
readonly park?: readonly ParkState[];
|
|
280
|
+
/**
|
|
281
|
+
* Keep only runs that are, or are not, currently held by a worker.
|
|
282
|
+
*
|
|
283
|
+
* `false` is the queue-reader's filter: give me the work nobody has. A
|
|
284
|
+
* claim that has expired counts as NOT held, because that is what expiry
|
|
285
|
+
* means and a reader that skipped expired claims would leave a dead
|
|
286
|
+
* worker's runs invisible forever — the exact failure the lease exists to
|
|
287
|
+
* prevent.
|
|
288
|
+
*/
|
|
289
|
+
readonly claimed?: boolean;
|
|
215
290
|
/** Page size. Defaults to 100, clamped to at least 1. */
|
|
216
291
|
readonly limit?: number;
|
|
217
292
|
/** Resume token from the previous page's {@link DurableRunPage.cursor}. */
|
|
@@ -266,8 +341,23 @@ export interface DurableRunPage {
|
|
|
266
341
|
* proceed.
|
|
267
342
|
*/
|
|
268
343
|
export interface CheckpointStore {
|
|
269
|
-
/**
|
|
270
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Persist one checkpoint. Overwrites an existing checkpoint with the same id.
|
|
346
|
+
*
|
|
347
|
+
* @param fence the {@link ClaimFence} of the holding this write belongs
|
|
348
|
+
* to, when the run is claimed. A store that supports claims REFUSES a
|
|
349
|
+
* write whose fence is below the run's current one — that refusal is
|
|
350
|
+
* what makes a claim a lease rather than a suggestion, because a holder
|
|
351
|
+
* stalled past its expiry believes it still holds and is wrong only at
|
|
352
|
+
* the moment it writes.
|
|
353
|
+
*
|
|
354
|
+
* Omit it and the write is unfenced, which is exactly today's behaviour
|
|
355
|
+
* and correct for a single-writer deployment. A store MUST NOT start
|
|
356
|
+
* refusing unfenced writes because some other write carried a fence:
|
|
357
|
+
* that would make adding a claim to one worker break every worker that
|
|
358
|
+
* has not adopted it yet.
|
|
359
|
+
*/
|
|
360
|
+
writeCheckpoint(scope: CheckpointRunScope, checkpoint: IterationCheckpoint, fence?: ClaimFence): Promise<void>;
|
|
271
361
|
/** Load a single checkpoint by id. Returns `null` when it does not exist. */
|
|
272
362
|
readCheckpoint(scope: CheckpointRunScope, checkpointId: CheckpointId): Promise<IterationCheckpoint | null>;
|
|
273
363
|
/**
|
|
@@ -319,5 +409,91 @@ export interface CheckpointStore {
|
|
|
319
409
|
* @param options filters and paging. See {@link ListDurableRunsOptions}.
|
|
320
410
|
*/
|
|
321
411
|
listDurableRuns?(scope: CheckpointListingScope, options?: ListDurableRunsOptions): Promise<DurableRunPage>;
|
|
412
|
+
/**
|
|
413
|
+
* Take exclusive working possession of a run, or report that somebody
|
|
414
|
+
* else has it. OPTIONAL — see the optional-capability rule on this
|
|
415
|
+
* interface.
|
|
416
|
+
*
|
|
417
|
+
* Returns the holding on success and `null` when the run is currently
|
|
418
|
+
* held by somebody else. `null` is not an error: "another worker got
|
|
419
|
+
* there first" is the ordinary outcome of a queue with more than one
|
|
420
|
+
* reader, and a thrown exception would make the normal case look like a
|
|
421
|
+
* fault.
|
|
422
|
+
*
|
|
423
|
+
* ### What it is for
|
|
424
|
+
*
|
|
425
|
+
* Putting parked runs on a queue and letting more than one worker drain
|
|
426
|
+
* it. Without this, two workers restore the same checkpoint, both execute
|
|
427
|
+
* the run's tools, and both write checkpoints under one run id — each
|
|
428
|
+
* write minting a fresh checkpoint id, so two divergent chains land in
|
|
429
|
+
* one list and the pending lookup returns whichever wrote last. Half the
|
|
430
|
+
* work vanishes and nothing reports an error.
|
|
431
|
+
*
|
|
432
|
+
* ### The lease, and why it expires
|
|
433
|
+
*
|
|
434
|
+
* A claim is a LEASE, not a lock. A lock held by a process that dies is
|
|
435
|
+
* held forever, and the runs behind it are unreachable by anything except
|
|
436
|
+
* a human with a shell. The expiry is what makes a dead holder's work
|
|
437
|
+
* recoverable without one.
|
|
438
|
+
*
|
|
439
|
+
* The expiry is also why a fence exists. A holder does not know it has
|
|
440
|
+
* expired — a long pause, a suspended container and a partition all look
|
|
441
|
+
* from the inside like time not passing — so it wakes and writes as
|
|
442
|
+
* though it still holds. Liveness cannot be checked from here. What CAN
|
|
443
|
+
* be checked, at the write, is whether the holding that write belongs to
|
|
444
|
+
* is still the current one, and that is a comparison of two numbers.
|
|
445
|
+
*
|
|
446
|
+
* ### Reclaiming
|
|
447
|
+
*
|
|
448
|
+
* Calling this on a run whose claim has expired SUCCEEDS and mints a
|
|
449
|
+
* fence strictly greater than the expired holding's. The previous holder
|
|
450
|
+
* is not notified — it cannot be, that is the premise — it simply stops
|
|
451
|
+
* being able to write.
|
|
452
|
+
*
|
|
453
|
+
* Calling it again as the CURRENT holder also succeeds and extends the
|
|
454
|
+
* lease, minting a new fence. Renewal and reclamation are the same
|
|
455
|
+
* operation from the store's side, which is why there is no separate
|
|
456
|
+
* `renew`: two code paths that must agree about who holds a run is one
|
|
457
|
+
* more than can be kept correct.
|
|
458
|
+
*
|
|
459
|
+
* ### What a backend implementing this MUST guarantee
|
|
460
|
+
*
|
|
461
|
+
* These are the properties the fence comparison depends on. None of them
|
|
462
|
+
* is checkable from here, and every one of them was violated by the first
|
|
463
|
+
* built-in implementation, so they are written down rather than assumed:
|
|
464
|
+
*
|
|
465
|
+
* 1. **A fence exceeds every fence ever issued for the run** — including
|
|
466
|
+
* across a release, and across deletion of whatever recorded it. A
|
|
467
|
+
* counter that rewinds re-issues a number a stalled worker still
|
|
468
|
+
* believes it holds, and that worker's writes become legal again.
|
|
469
|
+
* 2. **Fences are unique.** The write check is `fence < current`, so two
|
|
470
|
+
* holders at one number are both admitted. Equality is permissive
|
|
471
|
+
* here, which makes a duplicate worse than a gap.
|
|
472
|
+
* 3. **The fence check is atomic with the write.** Reading the current
|
|
473
|
+
* fence and then writing is check-then-act, and the gap is a race. A
|
|
474
|
+
* database gets this free (`UPDATE … WHERE fence >= ?`); a filesystem
|
|
475
|
+
* does not, and the built-in disk store narrows rather than closes it.
|
|
476
|
+
* 4. **`holder` is unique per process.** It is evidence rather than
|
|
477
|
+
* authority, but it is the only thing distinguishing a RENEWAL from a
|
|
478
|
+
* theft — two workers sharing a holder string take a live, unexpired
|
|
479
|
+
* claim from each other instantly. Use something per-process, not a
|
|
480
|
+
* per-deployment name.
|
|
481
|
+
*/
|
|
482
|
+
claimRun?(scope: CheckpointRunScope, options: ClaimRunOptions): Promise<RunClaim | null>;
|
|
483
|
+
/**
|
|
484
|
+
* Give a claim up early. Idempotent: releasing a claim that already
|
|
485
|
+
* expired, was superseded, or never existed succeeds as a no-op.
|
|
486
|
+
*
|
|
487
|
+
* Presenting a stale fence releases NOTHING — a worker that stalled past
|
|
488
|
+
* its lease must not be able to hand away a run somebody else is now
|
|
489
|
+
* holding, and that is the same fencing comparison the write path makes.
|
|
490
|
+
*
|
|
491
|
+
* Optional to call, not optional to matter: a worker that finishes and
|
|
492
|
+
* releases returns the run to the queue immediately, where one that just
|
|
493
|
+
* exits leaves it stuck until the lease expires. That is a latency
|
|
494
|
+
* difference, never a correctness one, which is the property that lets a
|
|
495
|
+
* crashed worker be indistinguishable from a slow one.
|
|
496
|
+
*/
|
|
497
|
+
releaseRun?(scope: CheckpointRunScope, fence: ClaimFence): Promise<void>;
|
|
322
498
|
}
|
|
323
499
|
//# sourceMappingURL=checkpoint-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-store.d.ts","sourceRoot":"","sources":["../../../src/types/run/checkpoint-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAClC,2CAA2C;IAC3C,QAAQ,EAAE,QAAQ,CAAA;IAClB,gDAAgD;IAChD,SAAS,EAAE,SAAS,CAAA;IACpB,wCAAwC;IACxC,SAAS,EAAE,SAAS,CAAA;IACpB,2CAA2C;IAC3C,KAAK,EAAE,KAAK,CAAA;IACZ;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,sBAAsB;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS;AACpB,mFAAmF;AACjF,aAAa;AACf,8EAA8E;G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;;;;;;;;;;;;;;;;OAuCG;IACH,eAAe,CAAC,CACf,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC,CAAA;IAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqEG;IACH,QAAQ,CAAC,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAExF;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxE"}
|
|
@@ -125,6 +125,18 @@ export interface RunPersistenceConfig {
|
|
|
125
125
|
* hosts inject a scope-keyed backend (e.g. Postgres) here.
|
|
126
126
|
*/
|
|
127
127
|
checkpointStore?: CheckpointStore;
|
|
128
|
+
/**
|
|
129
|
+
* Optional run-evidence persistence override. Defaults to the disk layout
|
|
130
|
+
* under `outputDir` (a
|
|
131
|
+
* {@link import('../../store/run/disk.js').RunDiskStore}); hosts inject
|
|
132
|
+
* their own backend here.
|
|
133
|
+
*
|
|
134
|
+
* The sibling of `checkpointStore`, and it should have been one from the
|
|
135
|
+
* start: checkpoints got an injectable seam while the run record, its
|
|
136
|
+
* messages, its transcript and its report did not, so the evidence was
|
|
137
|
+
* the one part of a run that could not leave the local filesystem.
|
|
138
|
+
*/
|
|
139
|
+
runStore?: import('./store.js').RunStore;
|
|
128
140
|
}
|
|
129
141
|
export interface RunStoreConfig {
|
|
130
142
|
baseDir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/run/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OA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