@namzu/sdk 20.0.0 → 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/contracts/a2a.d.ts +2 -2
  3. package/dist/manager/run/persistence.d.ts.map +1 -1
  4. package/dist/manager/run/persistence.js +11 -0
  5. package/dist/manager/run/persistence.js.map +1 -1
  6. package/dist/public-runtime.d.ts +3 -1
  7. package/dist/public-runtime.d.ts.map +1 -1
  8. package/dist/public-runtime.js +7 -1
  9. package/dist/public-runtime.js.map +1 -1
  10. package/dist/runtime/query/checkpoint.d.ts +20 -0
  11. package/dist/runtime/query/checkpoint.d.ts.map +1 -1
  12. package/dist/runtime/query/checkpoint.js +47 -0
  13. package/dist/runtime/query/checkpoint.js.map +1 -1
  14. package/dist/store/index.d.ts +3 -0
  15. package/dist/store/index.d.ts.map +1 -1
  16. package/dist/store/index.js +12 -0
  17. package/dist/store/index.js.map +1 -1
  18. package/dist/store/run/checkpoint-disk.d.ts +56 -2
  19. package/dist/store/run/checkpoint-disk.d.ts.map +1 -1
  20. package/dist/store/run/checkpoint-disk.js +83 -2
  21. package/dist/store/run/checkpoint-disk.js.map +1 -1
  22. package/dist/store/run/checkpoint-memory.d.ts +31 -0
  23. package/dist/store/run/checkpoint-memory.d.ts.map +1 -0
  24. package/dist/store/run/checkpoint-memory.js +83 -0
  25. package/dist/store/run/checkpoint-memory.js.map +1 -0
  26. package/dist/store/run/disk.d.ts +53 -0
  27. package/dist/store/run/disk.d.ts.map +1 -1
  28. package/dist/store/run/disk.js +73 -30
  29. package/dist/store/run/disk.js.map +1 -1
  30. package/dist/store/run/listing.d.ts +75 -0
  31. package/dist/store/run/listing.d.ts.map +1 -0
  32. package/dist/store/run/listing.js +242 -0
  33. package/dist/store/run/listing.js.map +1 -0
  34. package/dist/types/hitl/index.d.ts +27 -0
  35. package/dist/types/hitl/index.d.ts.map +1 -1
  36. package/dist/types/hitl/index.js.map +1 -1
  37. package/dist/types/run/checkpoint-store.d.ts +260 -1
  38. package/dist/types/run/checkpoint-store.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/manager/run/persistence.ts +18 -4
  41. package/src/public-runtime.ts +13 -0
  42. package/src/runtime/query/checkpoint.ts +51 -0
  43. package/src/store/index.ts +18 -0
  44. package/src/store/run/checkpoint-disk.ts +128 -4
  45. package/src/store/run/checkpoint-memory.ts +101 -0
  46. package/src/store/run/disk.ts +72 -27
  47. package/src/store/run/listing.ts +307 -0
  48. package/src/types/hitl/index.ts +28 -0
  49. package/src/types/run/checkpoint-store.ts +274 -1
@@ -1 +1 @@
1
- {"version":3,"file":"checkpoint-disk.d.ts","sourceRoot":"","sources":["../../../src/store/run/checkpoint-disk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG9D;;;;;;;;;;;;;GAaG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0C;gBAEpD,MAAM,EAAE,cAAc;IAIlC,OAAO,CAAC,IAAI;IAgBN,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1F,cAAc,CACnB,KAAK,EAAE,kBAAkB,EACzB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAKhC,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAK1E,gBAAgB,CAAC,KAAK,EAAE,kBAA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,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAK1E,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5F;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,eAAe,CACpB,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC;IA+C1B,sEAAsE;YACxD,WAAW;CASzB"}
@@ -1,4 +1,8 @@
1
- import { RunDiskStore } from './disk.js';
1
+ import { readdir } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { NamzuError } from '../../types/errors/index.js';
4
+ import { RunDiskStore, readCheckpointsIn } from './disk.js';
5
+ import { assertContiguousListingScope, paginateDurableRuns, toDurableRunEntry } from './listing.js';
2
6
  /**
3
7
  * Disk conformance layer for {@link CheckpointStore}: adapts the existing
4
8
  * {@link RunDiskStore} checkpoint methods (which are bound to a single run
@@ -15,9 +19,19 @@ import { RunDiskStore } from './disk.js';
15
19
  */
16
20
  export class DiskCheckpointStore {
17
21
  config;
22
+ attribution;
18
23
  bound = new Map();
19
- constructor(config) {
24
+ /**
25
+ * @param config the run-store config; `baseDir` is one session's `runs/`
26
+ * directory.
27
+ * @param attribution what tree this is, for
28
+ * {@link DiskCheckpointStore.listDurableRuns}. Optional so that adding
29
+ * the listing did not change an existing construction; a store built
30
+ * without it refuses to list rather than inventing a tenant.
31
+ */
32
+ constructor(config, attribution) {
20
33
  this.config = config;
34
+ this.attribution = attribution;
21
35
  }
22
36
  bind(scope) {
23
37
  const cached = this.bound.get(scope.runId);
@@ -51,5 +65,72 @@ export class DiskCheckpointStore {
51
65
  const store = await this.bind(scope);
52
66
  await store.deleteCheckpoint(checkpointId);
53
67
  }
68
+ /**
69
+ * Every run with checkpoints under this store's tree.
70
+ *
71
+ * Reads the directories rather than binding a {@link RunDiskStore} per
72
+ * run, because binding CREATES the run directory — a listing that
73
+ * materialized a directory for every run it looked at would grow the tree
74
+ * it is reporting on.
75
+ *
76
+ * ### Why a two-level walk reaches every depth
77
+ *
78
+ * `initRun` nests exactly one level: a run with a parent goes to
79
+ * `{baseDir}/{parentRunId}/children/{runId}`, and a grandchild goes to
80
+ * `{baseDir}/{itsOwnParentRunId}/children/{runId}` — beside the top-level
81
+ * runs, not beneath its grandparent. So the tree is flat-with-one-nesting
82
+ * at every depth, `{baseDir}/*` plus `{baseDir}/* /children/*` enumerates
83
+ * all of it, and each run's `parentRunId` is the directory it sits under.
84
+ * A deep run leaves a bare shell directory under its own id at the top
85
+ * level (`{baseDir}/{parentRunId}` created by `mkdir -p` for a child of a
86
+ * run whose own data lives elsewhere); those hold no `checkpoints/` and
87
+ * drop out as entries with no durable state.
88
+ */
89
+ async listDurableRuns(scope, options) {
90
+ assertContiguousListingScope(scope, 'DiskCheckpointStore.listDurableRuns');
91
+ const attribution = this.attribution;
92
+ if (!attribution) {
93
+ throw new NamzuError({
94
+ code: 'invalid_config',
95
+ message: 'DiskCheckpointStore.listDurableRuns: this store was constructed without attribution, so it cannot say which tenant, project or session its runs belong to — and a listing row that carries no scope is a row nothing can be resumed or swept from. Pass the second constructor argument. Refusing rather than returning rows stamped with a guessed tenant.',
96
+ details: { baseDir: this.config.baseDir },
97
+ });
98
+ }
99
+ // A listing is scoped, not addressed: a query for another tenant is a
100
+ // question this tree has no rows for, not an isolation violation. Same
101
+ // reasoning `SessionStore.listSessions` already states for sessions
102
+ // that happen to share a thread id across tenants.
103
+ if (scope.tenantId !== attribution.tenantId ||
104
+ (scope.projectId !== undefined && scope.projectId !== attribution.projectId) ||
105
+ (scope.sessionId !== undefined && scope.sessionId !== attribution.sessionId)) {
106
+ return { entries: [] };
107
+ }
108
+ const now = options?.now ?? Date.now();
109
+ const entries = [];
110
+ for (const runId of await this.readRunDirs(this.config.baseDir)) {
111
+ const runDir = join(this.config.baseDir, runId);
112
+ const own = toDurableRunEntry({ ...attribution, runId }, await readCheckpointsIn(runDir), now);
113
+ if (own)
114
+ entries.push(own);
115
+ for (const childId of await this.readRunDirs(join(runDir, 'children'))) {
116
+ const child = toDurableRunEntry({ ...attribution, runId: childId, parentRunId: runId }, await readCheckpointsIn(join(runDir, 'children', childId)), now);
117
+ if (child)
118
+ entries.push(child);
119
+ }
120
+ }
121
+ return paginateDurableRuns(entries, options);
122
+ }
123
+ /** Directory names under `dir`, or none when `dir` does not exist. */
124
+ async readRunDirs(dir) {
125
+ try {
126
+ const found = await readdir(dir, { withFileTypes: true });
127
+ return found.filter((e) => e.isDirectory()).map((e) => e.name);
128
+ }
129
+ catch (err) {
130
+ if (err.code === 'ENOENT')
131
+ return [];
132
+ throw err;
133
+ }
134
+ }
54
135
  }
55
136
  //# sourceMappingURL=checkpoint-disk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkpoint-disk.js","sourceRoot":"","sources":["../../../src/store/run/checkpoint-disk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,mBAAmB;IACd,MAAM,CAAgB;IACtB,KAAK,GAAG,IAAI,GAAG,EAAgC,CAAA;IAEhE,YAAY,MAAsB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;IAEO,IAAI,CAAC,KAAyB;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAA;QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;YAC3B,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC3C,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;YACnD,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AAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,sEAAsE;IAC9D,KAAK,CAAC,WAAW,CAAC,GAAW;QACpC,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;YACzD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAa,CAAC,CAAA;QACxE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAA;YAC/D,MAAM,GAAG,CAAA;QACV,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,31 @@
1
+ import type { CheckpointId, IterationCheckpoint } from '../../types/hitl/index.js';
2
+ import type { CheckpointListingScope, CheckpointRunScope, CheckpointStore, DurableRunPage, ListDurableRunsOptions } from '../../types/run/checkpoint-store.js';
3
+ /**
4
+ * Process-local {@link CheckpointStore}, keyed by the full five-layer scope.
5
+ *
6
+ * Shipped rather than left as a test fixture for two reasons. It is the
7
+ * reference a host reads when writing a backend of its own — the disk store
8
+ * is path-addressed and answers "what does an attribution-keyed store look
9
+ * like" with a directory layout, which is the wrong lesson. And it is the
10
+ * only implementation that can hold more than one tenant at once, because
11
+ * the disk layout has no tenant in it: a test that two tenants' listings
12
+ * stay separate is not expressible against disk, and a rule that cannot be
13
+ * tested on the store a host will actually inject is a rule on paper.
14
+ *
15
+ * Not durable, deliberately: it is for tests, for a single-process host that
16
+ * genuinely wants checkpoints to die with the process, and as the parity
17
+ * partner that proves the listing contract is not a filesystem in disguise.
18
+ */
19
+ export declare class InMemoryCheckpointStore implements CheckpointStore {
20
+ /** `tenant/project/session/run` → checkpoint id → checkpoint. */
21
+ private readonly runs;
22
+ /** Same key → the run's scope, so a listing can rebuild an addressable entry. */
23
+ private readonly scopes;
24
+ private key;
25
+ writeCheckpoint(scope: CheckpointRunScope, checkpoint: IterationCheckpoint): Promise<void>;
26
+ readCheckpoint(scope: CheckpointRunScope, checkpointId: CheckpointId): Promise<IterationCheckpoint | null>;
27
+ listCheckpoints(scope: CheckpointRunScope): Promise<IterationCheckpoint[]>;
28
+ deleteCheckpoint(scope: CheckpointRunScope, checkpointId: CheckpointId): Promise<void>;
29
+ listDurableRuns(scope: CheckpointListingScope, options?: ListDurableRunsOptions): Promise<DurableRunPage>;
30
+ }
31
+ //# sourceMappingURL=checkpoint-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-memory.d.ts","sourceRoot":"","sources":["../../../src/store/run/checkpoint-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAClF,OAAO,KAAK,EACX,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,cAAc,EACd,sBAAsB,EACtB,MAAM,qCAAqC,CAAA;AAG5C;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC9D,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4D;IACjF,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAE/D,OAAO,CAAC,GAAG;IAIL,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB1F,cAAc,CACnB,KAAK,EAAE,kBAAkB,EACzB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIhC,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAM1E,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAItF,eAAe,CACpB,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC;CAkB1B"}
@@ -0,0 +1,83 @@
1
+ import { assertContiguousListingScope, paginateDurableRuns, toDurableRunEntry } from './listing.js';
2
+ /**
3
+ * Process-local {@link CheckpointStore}, keyed by the full five-layer scope.
4
+ *
5
+ * Shipped rather than left as a test fixture for two reasons. It is the
6
+ * reference a host reads when writing a backend of its own — the disk store
7
+ * is path-addressed and answers "what does an attribution-keyed store look
8
+ * like" with a directory layout, which is the wrong lesson. And it is the
9
+ * only implementation that can hold more than one tenant at once, because
10
+ * the disk layout has no tenant in it: a test that two tenants' listings
11
+ * stay separate is not expressible against disk, and a rule that cannot be
12
+ * tested on the store a host will actually inject is a rule on paper.
13
+ *
14
+ * Not durable, deliberately: it is for tests, for a single-process host that
15
+ * genuinely wants checkpoints to die with the process, and as the parity
16
+ * partner that proves the listing contract is not a filesystem in disguise.
17
+ */
18
+ export class InMemoryCheckpointStore {
19
+ /** `tenant/project/session/run` → checkpoint id → checkpoint. */
20
+ runs = new Map();
21
+ /** Same key → the run's scope, so a listing can rebuild an addressable entry. */
22
+ scopes = new Map();
23
+ key(scope) {
24
+ return [scope.tenantId, scope.projectId, scope.sessionId, scope.runId].join('/');
25
+ }
26
+ async writeCheckpoint(scope, checkpoint) {
27
+ const key = this.key(scope);
28
+ let run = this.runs.get(key);
29
+ if (!run) {
30
+ run = new Map();
31
+ this.runs.set(key, run);
32
+ }
33
+ // The run's scope is kept beside its checkpoints because the key is a
34
+ // joined string and a listing has to hand back the parts — above all
35
+ // `parentRunId`, which is what makes a sub-run's row addressable.
36
+ //
37
+ // Written on every call rather than only the first, and that is
38
+ // simplicity, not defence: a run's scope is fixed when the run is
39
+ // constructed, so the two cannot differ, and a `has` guard here would
40
+ // be a branch no input can take.
41
+ this.scopes.set(key, {
42
+ tenantId: scope.tenantId,
43
+ projectId: scope.projectId,
44
+ sessionId: scope.sessionId,
45
+ runId: scope.runId,
46
+ ...(scope.parentRunId ? { parentRunId: scope.parentRunId } : {}),
47
+ });
48
+ run.set(checkpoint.id, checkpoint);
49
+ }
50
+ async readCheckpoint(scope, checkpointId) {
51
+ return this.runs.get(this.key(scope))?.get(checkpointId) ?? null;
52
+ }
53
+ async listCheckpoints(scope) {
54
+ const run = this.runs.get(this.key(scope));
55
+ if (!run)
56
+ return [];
57
+ return [...run.values()].sort((a, b) => a.createdAt - b.createdAt);
58
+ }
59
+ async deleteCheckpoint(scope, checkpointId) {
60
+ this.runs.get(this.key(scope))?.delete(checkpointId);
61
+ }
62
+ async listDurableRuns(scope, options) {
63
+ assertContiguousListingScope(scope, 'InMemoryCheckpointStore.listDurableRuns');
64
+ const now = options?.now ?? Date.now();
65
+ const entries = [];
66
+ for (const [key, checkpoints] of this.runs) {
67
+ const runScope = this.scopes.get(key);
68
+ if (!runScope)
69
+ continue;
70
+ if (runScope.tenantId !== scope.tenantId)
71
+ continue;
72
+ if (scope.projectId !== undefined && runScope.projectId !== scope.projectId)
73
+ continue;
74
+ if (scope.sessionId !== undefined && runScope.sessionId !== scope.sessionId)
75
+ continue;
76
+ const entry = toDurableRunEntry(runScope, [...checkpoints.values()], now);
77
+ if (entry)
78
+ entries.push(entry);
79
+ }
80
+ return paginateDurableRuns(entries, options);
81
+ }
82
+ }
83
+ //# sourceMappingURL=checkpoint-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-memory.js","sourceRoot":"","sources":["../../../src/store/run/checkpoint-memory.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEnG;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,uBAAuB;IACnC,iEAAiE;IAChD,IAAI,GAAG,IAAI,GAAG,EAAkD,CAAA;IACjF,i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AS,KAAK,KAAK,CAAC,SAAS;gBAAE,SAAQ;YACrF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,QAAQ,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;gBAAE,SAAQ;YAErF,MAAM,KAAK,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;YACzE,IAAI,KAAK;gBAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACD"}
@@ -40,6 +40,29 @@ export declare class RunDiskStore {
40
40
  readCheckpoint(checkpointId: CheckpointId): Promise<IterationCheckpoint | null>;
41
41
  listCheckpoints(): Promise<IterationCheckpoint[]>;
42
42
  deleteCheckpoint(checkpointId: CheckpointId): Promise<void>;
43
+ /**
44
+ * @deprecated Superseded by
45
+ * {@link import('../../types/run/checkpoint-store.js').CheckpointStore.listDurableRuns},
46
+ * reached through {@link import('./listing.js').listDurableRuns}.
47
+ * Removed in the next major.
48
+ *
49
+ * Three things are wrong with `index.json` as the answer to "which runs
50
+ * are there":
51
+ *
52
+ * 1. Its entries carry no tenant, project or session, so a row cannot be
53
+ * turned back into an addressable scope — nothing can be resumed or
54
+ * swept from it.
55
+ * 2. `addToIndex` skips every sub-run, so an inbox built on it drops
56
+ * every approval raised by delegated work, and the symptom looks like
57
+ * a hung specialist rather than a blind listing.
58
+ * 3. It is a catalogue of runs that STARTED, not of runs with durable
59
+ * state, so it cannot tell a run something could resume from one that
60
+ * left nothing behind.
61
+ *
62
+ * Deprecated for one minor rather than deleted outright: this is public
63
+ * surface and a consumer calling it today gets real data back, so the
64
+ * deprecate-before-you-remove rule applies.
65
+ */
43
66
  static listRuns(baseDir: string): Promise<Array<{
44
67
  id: string;
45
68
  agentName: string;
@@ -49,4 +72,34 @@ export declare class RunDiskStore {
49
72
  }>>;
50
73
  addToIndex(run: Run): Promise<void>;
51
74
  }
75
+ /**
76
+ * Every checkpoint stored under one run directory, ascending by `createdAt`.
77
+ *
78
+ * A free function rather than a method because the scope-level listing walks
79
+ * run directories it has never bound a {@link RunDiskStore} to — and binding
80
+ * one would CREATE the directory, which is not something a read should do.
81
+ * Sharing the function is what keeps the two read paths from disagreeing
82
+ * about what a damaged file means.
83
+ *
84
+ * An unreadable checkpoint used to be logged and skipped, so this returned a
85
+ * silently short list that four callers treat as complete. A missing NEWEST
86
+ * checkpoint quietly resumes from an older point and re-runs a whole
87
+ * iteration of tool calls; a missing PARKED one reports "not parked" and
88
+ * drops an approval a human already granted, because the file is the only
89
+ * durable record of a park. Pruning under-deletes too: a file the keep-count
90
+ * cannot see is immortal. The by-id read next door was already strict, and
91
+ * two read paths disagreeing about whether damage matters is how the lenient
92
+ * one gets trusted.
93
+ *
94
+ * The same reasoning carries up to the listing, which is why the throw
95
+ * propagates there rather than dropping the run: a damaged checkpoint that
96
+ * removed a run from an approval inbox is the missing-park failure again,
97
+ * one level up.
98
+ *
99
+ * A missing `checkpoints/` directory is the only absence that reads as
100
+ * empty — the run genuinely has none. A file that disappears BETWEEN the
101
+ * directory listing and its read throws, where the old shape returned the
102
+ * empty array and discarded every checkpoint it had already parsed.
103
+ */
104
+ export declare function readCheckpointsIn(runDir: string): Promise<IterationCheckpoint[]>;
52
105
  //# sourceMappingURL=disk.d.ts.map
@@ -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;AAe7E,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;I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,CAAC,IAAI,CAAC;IAKtC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASnD,SAAS,IAAI,MAAM,GAAG,IAAI;IAIpB,eAAe,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc/D,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAW/E,eAAe,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIjD,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IASjE;;;;;;;;;;;;;;;;;;;;;;OAsBG;WACU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAC9C,KAAK,CAAC;QACL,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;KAChB,CAAC,CACF;IAWK,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CA8CzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiBtF"}
@@ -169,36 +169,7 @@ export class RunDiskStore {
169
169
  }
170
170
  }
171
171
  async listCheckpoints() {
172
- const dir = this.requireInit();
173
- const cpDir = join(dir, 'checkpoints');
174
- try {
175
- const files = await readdir(cpDir);
176
- const checkpoints = [];
177
- for (const file of files) {
178
- if (!file.endsWith('.json'))
179
- continue;
180
- // An unreadable checkpoint used to be logged and skipped, so
181
- // this returned a silently short list that four callers treat
182
- // as complete. A missing NEWEST checkpoint quietly resumes
183
- // from an older point and re-runs a whole iteration of tool
184
- // calls; a missing PARKED one reports "not parked" and drops
185
- // an approval a human already granted, because the file is
186
- // the only durable record of a park. Pruning under-deletes
187
- // too: a file the keep-count cannot see is immortal.
188
- //
189
- // The by-id read next door was already strict. Two read paths
190
- // disagreeing about whether damage matters is how the lenient
191
- // one gets trusted.
192
- const content = await readFile(join(cpDir, file), 'utf-8');
193
- checkpoints.push(parseCheckpoint(content, file));
194
- }
195
- return checkpoints.sort((a, b) => a.createdAt - b.createdAt);
196
- }
197
- catch (err) {
198
- if (isFileNotFound(err))
199
- return [];
200
- throw err;
201
- }
172
+ return readCheckpointsIn(this.requireInit());
202
173
  }
203
174
  async deleteCheckpoint(checkpointId) {
204
175
  const dir = this.requireInit();
@@ -210,6 +181,29 @@ export class RunDiskStore {
210
181
  throw err;
211
182
  }
212
183
  }
184
+ /**
185
+ * @deprecated Superseded by
186
+ * {@link import('../../types/run/checkpoint-store.js').CheckpointStore.listDurableRuns},
187
+ * reached through {@link import('./listing.js').listDurableRuns}.
188
+ * Removed in the next major.
189
+ *
190
+ * Three things are wrong with `index.json` as the answer to "which runs
191
+ * are there":
192
+ *
193
+ * 1. Its entries carry no tenant, project or session, so a row cannot be
194
+ * turned back into an addressable scope — nothing can be resumed or
195
+ * swept from it.
196
+ * 2. `addToIndex` skips every sub-run, so an inbox built on it drops
197
+ * every approval raised by delegated work, and the symptom looks like
198
+ * a hung specialist rather than a blind listing.
199
+ * 3. It is a catalogue of runs that STARTED, not of runs with durable
200
+ * state, so it cannot tell a run something could resume from one that
201
+ * left nothing behind.
202
+ *
203
+ * Deprecated for one minor rather than deleted outright: this is public
204
+ * surface and a consumer calling it today gets real data back, so the
205
+ * deprecate-before-you-remove rule applies.
206
+ */
213
207
  static async listRuns(baseDir) {
214
208
  try {
215
209
  const indexPath = join(baseDir, 'index.json');
@@ -267,6 +261,55 @@ export class RunDiskStore {
267
261
  }
268
262
  }
269
263
  }
264
+ /**
265
+ * Every checkpoint stored under one run directory, ascending by `createdAt`.
266
+ *
267
+ * A free function rather than a method because the scope-level listing walks
268
+ * run directories it has never bound a {@link RunDiskStore} to — and binding
269
+ * one would CREATE the directory, which is not something a read should do.
270
+ * Sharing the function is what keeps the two read paths from disagreeing
271
+ * about what a damaged file means.
272
+ *
273
+ * An unreadable checkpoint used to be logged and skipped, so this returned a
274
+ * silently short list that four callers treat as complete. A missing NEWEST
275
+ * checkpoint quietly resumes from an older point and re-runs a whole
276
+ * iteration of tool calls; a missing PARKED one reports "not parked" and
277
+ * drops an approval a human already granted, because the file is the only
278
+ * durable record of a park. Pruning under-deletes too: a file the keep-count
279
+ * cannot see is immortal. The by-id read next door was already strict, and
280
+ * two read paths disagreeing about whether damage matters is how the lenient
281
+ * one gets trusted.
282
+ *
283
+ * The same reasoning carries up to the listing, which is why the throw
284
+ * propagates there rather than dropping the run: a damaged checkpoint that
285
+ * removed a run from an approval inbox is the missing-park failure again,
286
+ * one level up.
287
+ *
288
+ * A missing `checkpoints/` directory is the only absence that reads as
289
+ * empty — the run genuinely has none. A file that disappears BETWEEN the
290
+ * directory listing and its read throws, where the old shape returned the
291
+ * empty array and discarded every checkpoint it had already parsed.
292
+ */
293
+ export async function readCheckpointsIn(runDir) {
294
+ const cpDir = join(runDir, 'checkpoints');
295
+ let files;
296
+ try {
297
+ files = await readdir(cpDir);
298
+ }
299
+ catch (err) {
300
+ if (isFileNotFound(err))
301
+ return [];
302
+ throw err;
303
+ }
304
+ const checkpoints = [];
305
+ for (const file of files) {
306
+ if (!file.endsWith('.json'))
307
+ continue;
308
+ const content = await readFile(join(cpDir, file), 'utf-8');
309
+ checkpoints.push(parseCheckpoint(content, file));
310
+ }
311
+ return checkpoints.sort((a, b) => a.createdAt - b.createdAt);
312
+ }
270
313
  async function atomicWriteJson(filePath, value) {
271
314
  await atomicWriteFile(filePath, JSON.stringify(stamp(SCHEMA, value), null, 2));
272
315
  }
@@ -1 +1 @@
1
- {"version":3,"file":"disk.js","sourceRoot":"","sources":["../../../src/store/run/disk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,E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CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;QACvB,OAAO,CAAC,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"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Shared machinery for {@link CheckpointStore.listDurableRuns}.
3
+ *
4
+ * Every rule the listing promises — the contiguous-prefix refusal, the park
5
+ * precedence, the ordering, the paging — lives here and is used by BOTH
6
+ * shipped implementations. A rule implemented twice is a rule that holds in
7
+ * one store and not the other, and the whole point of a store contract is
8
+ * that a host can swap the backend without swapping the semantics.
9
+ */
10
+ 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
+ /** Page size when the caller names none. */
13
+ export declare const DEFAULT_DURABLE_RUN_LIMIT = 100;
14
+ /**
15
+ * Refuse a listing scope with a hole in it.
16
+ *
17
+ * `{ tenantId, sessionId }` reads as "that session under whichever project
18
+ * holds it". A flat backend can answer it; a hierarchical one cannot look up
19
+ * a session without its project. Answering differently per backend is the
20
+ * one thing the contract exists to prevent, so neither answers: the caller
21
+ * names the project it means.
22
+ */
23
+ export declare function assertContiguousListingScope(scope: CheckpointListingScope, caller: string): void;
24
+ /**
25
+ * The one park that describes what a run is doing now, out of every park it
26
+ * ever recorded.
27
+ *
28
+ * Precedence: newest `outstanding`, else newest `expired`, else newest
29
+ * `resolved`.
30
+ *
31
+ * `outstanding` wins because that is the question an inbox is asking, and
32
+ * because the answer has to be the SAME checkpoint `findPendingCheckpoint`
33
+ * returns. A run can hold several parks — it parks, a human answers, it runs
34
+ * on, it parks again — and it can hold an outstanding one that is older than
35
+ * a resolved one only in the reverse case, where an earlier park expired
36
+ * unanswered and the run was resumed past it. Ranking by recency alone would
37
+ * then hand an inbox a resolved checkpoint and report the live park as
38
+ * nothing.
39
+ *
40
+ * @param checkpoints the run's checkpoints, any order.
41
+ */
42
+ export declare function summarizePark(checkpoints: readonly IterationCheckpoint[], now: number): ParkSummary | undefined;
43
+ /**
44
+ * Project one run's checkpoints into a listing entry.
45
+ *
46
+ * Returns `null` for a run with no checkpoints: the listing is of runs with
47
+ * DURABLE state, and a run with nothing stored has nothing a sweeper could
48
+ * resume. A disk walk hits this case for real — a sub-run's directory is
49
+ * created as a bare shell under its own id before anything is written to it.
50
+ */
51
+ export declare function toDurableRunEntry(scope: CheckpointRunScope, checkpoints: readonly IterationCheckpoint[], now: number): DurableRunEntry | null;
52
+ /**
53
+ * Apply the park filter, the contract's ordering and the cursor to a set of
54
+ * entries an implementation has gathered.
55
+ *
56
+ * Both shipped stores gather differently — one walks a directory tree, one
57
+ * reads a map — and then hand the result here, so "ordered by `runId`, page
58
+ * ends where the next begins" is one implementation rather than two.
59
+ */
60
+ export declare function paginateDurableRuns(entries: readonly DurableRunEntry[], options?: ListDurableRunsOptions): DurableRunPage;
61
+ /**
62
+ * Every run with durable state under a scope, refusing when the store cannot
63
+ * answer.
64
+ *
65
+ * The refusal is the point. `listDurableRuns` is optional on the contract so
66
+ * that adding it did not break every host that had already implemented the
67
+ * interface — and an optional capability reached without a check degrades
68
+ * into a wrong answer: a store that cannot list would hand an approval inbox
69
+ * an empty page, and "nothing is waiting on a human" is not what "I cannot
70
+ * tell" means. A host that gets this error knows to supply a backend that
71
+ * implements the listing; a host that got `[]` would ship an inbox that
72
+ * silently never fires.
73
+ */
74
+ export declare function listDurableRuns(store: CheckpointStore, scope: CheckpointListingScope, options?: ListDurableRunsOptions): Promise<DurableRunPage>;
75
+ //# sourceMappingURL=listing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../../src/store/run/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,2BAA2B,CAAA;AACrF,OAAO,KAAK,EACX,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAEf,cAAc,EACd,sBAAsB,EAEtB,WAAW,EACX,MAAM,qCAAqC,CAAA;AAE5C,4CAA4C;AAC5C,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQhG;AAmCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC5B,WAAW,EAAE,SAAS,mBAAmB,EAAE,EAC3C,GAAG,EAAE,MAAM,GACT,WAAW,GAAG,SAAS,CAkBzB;AAQD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,kBAAkB,EACzB,WAAW,EAAE,SAAS,mBAAmB,EAAE,EAC3C,GAAG,EAAE,MAAM,GACT,eAAe,GAAG,IAAI,CAmCxB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,OAAO,CAAC,EAAE,sBAAsB,GAC9B,cAAc,CA+BhB;AA6DD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC,CAWzB"}