@victframework/runtime 0.1.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 (115) hide show
  1. package/dist/agent-governance.d.ts +285 -0
  2. package/dist/agent-governance.js +438 -0
  3. package/dist/agent-governance.js.map +1 -0
  4. package/dist/agent-registry.d.ts +103 -0
  5. package/dist/agent-registry.js +758 -0
  6. package/dist/agent-registry.js.map +1 -0
  7. package/dist/agent-types.d.ts +433 -0
  8. package/dist/agent-types.js +480 -0
  9. package/dist/agent-types.js.map +1 -0
  10. package/dist/authority.d.ts +83 -0
  11. package/dist/authority.js +170 -0
  12. package/dist/authority.js.map +1 -0
  13. package/dist/boundary-conformance.d.ts +51 -0
  14. package/dist/boundary-conformance.js +364 -0
  15. package/dist/boundary-conformance.js.map +1 -0
  16. package/dist/control-conformance.d.ts +68 -0
  17. package/dist/control-conformance.js +1131 -0
  18. package/dist/control-conformance.js.map +1 -0
  19. package/dist/control-in-memory.d.ts +257 -0
  20. package/dist/control-in-memory.js +886 -0
  21. package/dist/control-in-memory.js.map +1 -0
  22. package/dist/control-types.d.ts +1017 -0
  23. package/dist/control-types.js +779 -0
  24. package/dist/control-types.js.map +1 -0
  25. package/dist/durable-run.d.ts +73 -0
  26. package/dist/durable-run.js +262 -0
  27. package/dist/durable-run.js.map +1 -0
  28. package/dist/effect-policy.d.ts +22 -0
  29. package/dist/effect-policy.js +45 -0
  30. package/dist/effect-policy.js.map +1 -0
  31. package/dist/errors.d.ts +36 -0
  32. package/dist/errors.js +71 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/in-memory-stores.d.ts +16 -0
  35. package/dist/in-memory-stores.js +522 -0
  36. package/dist/in-memory-stores.js.map +1 -0
  37. package/dist/index.d.ts +41 -0
  38. package/dist/index.js +26 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/operator-config.d.ts +141 -0
  41. package/dist/operator-config.js +289 -0
  42. package/dist/operator-config.js.map +1 -0
  43. package/dist/orchestration-activation.d.ts +116 -0
  44. package/dist/orchestration-activation.js +223 -0
  45. package/dist/orchestration-activation.js.map +1 -0
  46. package/dist/orchestration-canary-conformance.d.ts +10 -0
  47. package/dist/orchestration-canary-conformance.js +726 -0
  48. package/dist/orchestration-canary-conformance.js.map +1 -0
  49. package/dist/orchestration-commands.d.ts +47 -0
  50. package/dist/orchestration-commands.js +538 -0
  51. package/dist/orchestration-commands.js.map +1 -0
  52. package/dist/orchestration-conformance.d.ts +59 -0
  53. package/dist/orchestration-conformance.js +594 -0
  54. package/dist/orchestration-conformance.js.map +1 -0
  55. package/dist/orchestration-driver-types.d.ts +163 -0
  56. package/dist/orchestration-driver-types.js +21 -0
  57. package/dist/orchestration-driver-types.js.map +1 -0
  58. package/dist/orchestration-driver.d.ts +48 -0
  59. package/dist/orchestration-driver.js +1030 -0
  60. package/dist/orchestration-driver.js.map +1 -0
  61. package/dist/orchestration-in-memory.d.ts +18 -0
  62. package/dist/orchestration-in-memory.js +1313 -0
  63. package/dist/orchestration-in-memory.js.map +1 -0
  64. package/dist/orchestration-join-conformance.d.ts +20 -0
  65. package/dist/orchestration-join-conformance.js +542 -0
  66. package/dist/orchestration-join-conformance.js.map +1 -0
  67. package/dist/orchestration-plan.d.ts +52 -0
  68. package/dist/orchestration-plan.js +265 -0
  69. package/dist/orchestration-plan.js.map +1 -0
  70. package/dist/orchestration-race-conformance.d.ts +35 -0
  71. package/dist/orchestration-race-conformance.js +1265 -0
  72. package/dist/orchestration-race-conformance.js.map +1 -0
  73. package/dist/orchestration-remediation-conformance.d.ts +54 -0
  74. package/dist/orchestration-remediation-conformance.js +632 -0
  75. package/dist/orchestration-remediation-conformance.js.map +1 -0
  76. package/dist/orchestration-store-types.d.ts +568 -0
  77. package/dist/orchestration-store-types.js +2 -0
  78. package/dist/orchestration-store-types.js.map +1 -0
  79. package/dist/pack-conformance.d.ts +59 -0
  80. package/dist/pack-conformance.js +222 -0
  81. package/dist/pack-conformance.js.map +1 -0
  82. package/dist/pack-install.d.ts +44 -0
  83. package/dist/pack-install.js +126 -0
  84. package/dist/pack-install.js.map +1 -0
  85. package/dist/registry.d.ts +107 -0
  86. package/dist/registry.js +481 -0
  87. package/dist/registry.js.map +1 -0
  88. package/dist/runtime.d.ts +158 -0
  89. package/dist/runtime.js +1341 -0
  90. package/dist/runtime.js.map +1 -0
  91. package/dist/serialization.d.ts +26 -0
  92. package/dist/serialization.js +162 -0
  93. package/dist/serialization.js.map +1 -0
  94. package/dist/store-conformance.d.ts +45 -0
  95. package/dist/store-conformance.js +876 -0
  96. package/dist/store-conformance.js.map +1 -0
  97. package/dist/store-errors.d.ts +49 -0
  98. package/dist/store-errors.js +48 -0
  99. package/dist/store-errors.js.map +1 -0
  100. package/dist/store-types.d.ts +331 -0
  101. package/dist/store-types.js +14 -0
  102. package/dist/store-types.js.map +1 -0
  103. package/dist/store-validation.d.ts +63 -0
  104. package/dist/store-validation.js +164 -0
  105. package/dist/store-validation.js.map +1 -0
  106. package/dist/stream-hub.d.ts +151 -0
  107. package/dist/stream-hub.js +402 -0
  108. package/dist/stream-hub.js.map +1 -0
  109. package/dist/testing.d.ts +25 -0
  110. package/dist/testing.js +19 -0
  111. package/dist/testing.js.map +1 -0
  112. package/dist/types.d.ts +221 -0
  113. package/dist/types.js +2 -0
  114. package/dist/types.js.map +1 -0
  115. package/package.json +45 -0
@@ -0,0 +1,522 @@
1
+ import { ACTIVATION_MANIFEST_SCHEMA, ACTIVATION_MANIFEST_SCHEMA_V2, RUN_EVENT_SCHEMA, } from './store-types.js';
2
+ import { createInMemoryOrchestrationStore } from './orchestration-in-memory.js';
3
+ import { VictStoreError } from './store-errors.js';
4
+ import { canonicalPersistedValue, immutableSnapshot, toCanonicalJson } from './serialization.js';
5
+ import { assertActivationBelongsToGraph, assertEventMatchesRun, assertPublishableManifest, assertRunMatchesActivation, } from './store-validation.js';
6
+ export function createInMemoryStores(options = {}) {
7
+ const faults = options.faults;
8
+ const activations = new Map();
9
+ const selections = new Map();
10
+ const runs = new Map();
11
+ const requireActivation = (activationVersion, operation) => {
12
+ const found = activations.get(activationVersion);
13
+ if (!found) {
14
+ throw new VictStoreError('VICT_STORE_ACTIVATION_NOT_FOUND', 'Activation not found.', {
15
+ operation,
16
+ activationVersion,
17
+ });
18
+ }
19
+ return found;
20
+ };
21
+ const publish = (command) => {
22
+ assertManifest(command);
23
+ const existing = activations.get(command.manifest.activationVersion);
24
+ if (existing) {
25
+ // Same version + different canonical content is a collision regardless
26
+ // of content validity; equivalent content is an idempotent republish.
27
+ if (existing.canonicalManifest !== command.canonicalManifest) {
28
+ throw new VictStoreError('VICT_STORE_ACTIVATION_COLLISION', 'An activation with this version already exists with different content.', {
29
+ operation: 'catalog.publish',
30
+ activationVersion: command.manifest.activationVersion,
31
+ });
32
+ }
33
+ return { activationVersion: existing.activationVersion, created: false };
34
+ }
35
+ // Fresh creation: the canonical string must BE the manifest's canonical
36
+ // form, and every identity must recompute from that content.
37
+ assertPublishableManifest(command);
38
+ const record = {
39
+ activationVersion: command.manifest.activationVersion,
40
+ manifestSchema: command.manifest.manifestSchema,
41
+ graphId: command.manifest.graphId,
42
+ graphVersion: command.manifest.graphVersion,
43
+ capabilitySetVersion: command.manifest.capabilitySetVersion,
44
+ canonicalManifest: command.canonicalManifest,
45
+ createdAt: Date.now(),
46
+ };
47
+ activations.set(record.activationVersion, immutableSnapshot(record));
48
+ return { activationVersion: record.activationVersion, created: true };
49
+ };
50
+ const select = (command) => {
51
+ const stored = requireActivation(command.activationVersion, 'catalog.select');
52
+ // An activation may only be selected for the graph it belongs to.
53
+ assertActivationBelongsToGraph(stored, command.graphId, 'catalog.select');
54
+ const current = selections.get(command.graphId);
55
+ // Operation-identity idempotency: re-selection under the SAME operation
56
+ // identity returns the ORIGINAL selection without adding a revision.
57
+ if (command.operationId !== undefined &&
58
+ current?.operationId !== undefined &&
59
+ current.operationId === command.operationId) {
60
+ return immutableSnapshot(current);
61
+ }
62
+ if (command.expectedSelectionRevision === 'none') {
63
+ // EXPLICIT absence guard: the selection must NOT exist (undefined
64
+ // never means "expect absence").
65
+ if (current) {
66
+ throw new VictStoreError('VICT_STORE_SELECTION_CONFLICT', 'The graph already has a selection; the expected ABSENT selection does not match.', {
67
+ operation: 'catalog.select',
68
+ graphId: command.graphId,
69
+ expectedSelectionRevision: 'none',
70
+ actualSelectionRevision: current.selectionRevision,
71
+ });
72
+ }
73
+ }
74
+ else if (command.expectedSelectionRevision !== undefined) {
75
+ if (!current) {
76
+ throw new VictStoreError('VICT_STORE_SELECTION_CONFLICT', 'No current selection exists for this graph; the expected selection revision does not match.', {
77
+ operation: 'catalog.select',
78
+ graphId: command.graphId,
79
+ expectedSelectionRevision: command.expectedSelectionRevision,
80
+ actualSelectionRevision: undefined,
81
+ });
82
+ }
83
+ if (current.selectionRevision !== command.expectedSelectionRevision) {
84
+ throw new VictStoreError('VICT_STORE_SELECTION_CONFLICT', 'The selection changed since it was read; the expected selection revision is stale.', {
85
+ operation: 'catalog.select',
86
+ graphId: command.graphId,
87
+ activationVersion: command.activationVersion,
88
+ expectedSelectionRevision: command.expectedSelectionRevision,
89
+ actualSelectionRevision: current.selectionRevision,
90
+ });
91
+ }
92
+ }
93
+ const next = {
94
+ graphId: command.graphId,
95
+ activationVersion: command.activationVersion,
96
+ selectionRevision: (current?.selectionRevision ?? 0) + 1,
97
+ selectedAt: Date.now(),
98
+ ...(command.operationId !== undefined ? { operationId: command.operationId } : {}),
99
+ };
100
+ selections.set(command.graphId, next);
101
+ return immutableSnapshot(next);
102
+ };
103
+ const catalog = {
104
+ async publish(command) {
105
+ return publish(command);
106
+ },
107
+ async get(activationVersion) {
108
+ const found = activations.get(activationVersion);
109
+ return found ? immutableSnapshot(found) : undefined;
110
+ },
111
+ async list() {
112
+ return [...activations.values()].map((record) => immutableSnapshot(record));
113
+ },
114
+ async select(command) {
115
+ return select(command);
116
+ },
117
+ async getSelection(graphId) {
118
+ const found = selections.get(graphId);
119
+ return found ? immutableSnapshot(found) : undefined;
120
+ },
121
+ async getSelected(graphId) {
122
+ const selection = selections.get(graphId);
123
+ if (!selection) {
124
+ return undefined;
125
+ }
126
+ return immutableSnapshot(requireActivation(selection.activationVersion, 'catalog.getSelected'));
127
+ },
128
+ async publishAndSelect(command) {
129
+ // Atomic from the caller's perspective: every validation runs against
130
+ // the pre-call state first; the mutations are applied in one
131
+ // synchronous section afterwards. A failed selection therefore leaves
132
+ // the activation catalog and the graph selection exactly as before —
133
+ // including the case where the activation was never published before.
134
+ assertManifest(command.publish);
135
+ const existing = activations.get(command.publish.manifest.activationVersion);
136
+ if (existing && existing.canonicalManifest !== command.publish.canonicalManifest) {
137
+ throw new VictStoreError('VICT_STORE_ACTIVATION_COLLISION', 'An activation with this version already exists with different content.', {
138
+ operation: 'catalog.publishAndSelect',
139
+ activationVersion: command.publish.manifest.activationVersion,
140
+ });
141
+ }
142
+ if (!existing) {
143
+ // Fresh creation: identity must recompute from content.
144
+ assertPublishableManifest(command.publish);
145
+ }
146
+ // The selected activation must belong to the selected graph.
147
+ if (command.publish.manifest.graphId !== command.select.graphId) {
148
+ throw new VictStoreError('VICT_STORE_ACTIVATION_MISMATCH', 'The activation does not belong to the graph being selected for.', {
149
+ operation: 'catalog.publishAndSelect',
150
+ activationVersion: command.publish.manifest.activationVersion,
151
+ graphId: command.select.graphId,
152
+ });
153
+ }
154
+ const current = selections.get(command.select.graphId);
155
+ if (command.select.expectedSelectionRevision === 'none') {
156
+ if (current) {
157
+ throw new VictStoreError('VICT_STORE_SELECTION_CONFLICT', 'The graph already has a selection; the expected ABSENT selection does not match.', {
158
+ operation: 'catalog.publishAndSelect',
159
+ graphId: command.select.graphId,
160
+ expectedSelectionRevision: 'none',
161
+ actualSelectionRevision: current.selectionRevision,
162
+ });
163
+ }
164
+ }
165
+ else if (command.select.expectedSelectionRevision !== undefined) {
166
+ if (!current || current.selectionRevision !== command.select.expectedSelectionRevision) {
167
+ throw new VictStoreError('VICT_STORE_SELECTION_CONFLICT', 'The selection changed since it was read; the expected selection revision is stale.', {
168
+ operation: 'catalog.publishAndSelect',
169
+ graphId: command.select.graphId,
170
+ expectedSelectionRevision: command.select.expectedSelectionRevision,
171
+ actualSelectionRevision: current?.selectionRevision,
172
+ });
173
+ }
174
+ }
175
+ // Apply: publish (idempotent) + select, with no intervening awaits.
176
+ const published = existing
177
+ ? { activationVersion: existing.activationVersion, created: false }
178
+ : publish(command.publish);
179
+ const selection = select({
180
+ ...command.select,
181
+ activationVersion: published.activationVersion,
182
+ });
183
+ return { ...published, selection };
184
+ },
185
+ };
186
+ const createRun = (command) => {
187
+ assertCreateCommand(command);
188
+ if (runs.has(command.runId)) {
189
+ throw new VictStoreError('VICT_STORE_RUN_CONFLICT', 'A run with this id already exists.', {
190
+ operation: 'execution.createRun',
191
+ runId: command.runId,
192
+ });
193
+ }
194
+ // A run must reference a published activation (RUN-001, FK parity with
195
+ // the SQLite adapter's foreign key), and its identity columns must
196
+ // describe exactly that activation.
197
+ const activation = requireActivation(command.activationVersion, 'execution.createRun');
198
+ assertRunMatchesActivation(activation, command, 'execution.createRun');
199
+ const record = {
200
+ runId: command.runId,
201
+ graphId: command.graphId,
202
+ graphVersion: command.graphVersion,
203
+ capabilitySetVersion: command.capabilitySetVersion,
204
+ activationVersion: command.activationVersion,
205
+ status: 'running',
206
+ mode: command.mode,
207
+ retention: command.retention,
208
+ steps: command.steps ?? 0,
209
+ currentNodeId: command.currentNodeId ?? null,
210
+ recordRevision: 1,
211
+ createdAt: command.timestamp,
212
+ updatedAt: command.timestamp,
213
+ completedAt: null,
214
+ };
215
+ const stored = { run: record, events: [] };
216
+ runs.set(record.runId, stored);
217
+ try {
218
+ // CreateRun and its initial events are one atomic operation: the fault
219
+ // hook runs after the run update is staged but before events commit.
220
+ faults?.afterRunUpdate?.(command);
221
+ appendEvents(stored, command.events, 0, command.timestamp);
222
+ faults?.beforeCommit?.(command);
223
+ }
224
+ catch (cause) {
225
+ runs.delete(record.runId);
226
+ throw wrapInternal(cause, 'execution.createRun', record.runId);
227
+ }
228
+ return immutableSnapshot(record);
229
+ };
230
+ const commitTransition = (command) => {
231
+ assertTransitionCommand(command);
232
+ const stored = runs.get(command.runId);
233
+ if (!stored) {
234
+ throw new VictStoreError('VICT_STORE_RUN_NOT_FOUND', 'Run not found.', {
235
+ operation: 'execution.commitTransition',
236
+ runId: command.runId,
237
+ });
238
+ }
239
+ if (stored.run.recordRevision !== command.expectedRecordRevision) {
240
+ throw new VictStoreError('VICT_STORE_RUN_CONFLICT', 'The run record changed since it was read; the expected record revision is stale.', {
241
+ operation: 'execution.commitTransition',
242
+ runId: command.runId,
243
+ expectedRecordRevision: command.expectedRecordRevision,
244
+ actualRecordRevision: stored.run.recordRevision,
245
+ });
246
+ }
247
+ if (stored.run.status !== 'running') {
248
+ throw new VictStoreError('VICT_STORE_RUN_CONFLICT', 'The run is already terminal and cannot accept further transitions.', {
249
+ operation: 'execution.commitTransition',
250
+ runId: command.runId,
251
+ expectedRecordRevision: command.expectedRecordRevision,
252
+ actualRecordRevision: stored.run.recordRevision,
253
+ });
254
+ }
255
+ // The caller's expectation must equal the ACTUAL stored next sequence
256
+ // (dense: zero for an empty run, otherwise the preceding sequence plus
257
+ // one). A gapped stored history is reported as corrupt rather than
258
+ // extended.
259
+ const actualNextSeq = storedNextEventSeq(stored.events, command.runId);
260
+ if (command.expectedNextEventSeq !== actualNextSeq) {
261
+ throw new VictStoreError('VICT_STORE_EVENT_SEQUENCE_CONFLICT', 'The expected next event sequence does not match the stored event history.', {
262
+ operation: 'execution.commitTransition',
263
+ runId: command.runId,
264
+ expectedEventSeq: actualNextSeq,
265
+ actualEventSeq: command.expectedNextEventSeq,
266
+ });
267
+ }
268
+ const nextStatus = command.next.status ?? 'running';
269
+ if (!ALL_RUN_STATUSES.includes(nextStatus)) {
270
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'The transition requests an unknown run status.', { operation: 'execution.commitTransition', runId: command.runId });
271
+ }
272
+ // Retention boundary (DATA-004/005/006): stored rows obey the run's
273
+ // retention policy regardless of what the command carries.
274
+ if (stored.run.retention === 'none' && command.next.outputSummary !== undefined) {
275
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'Retention is none; an output summary cannot be stored.', { operation: 'execution.commitTransition', runId: command.runId });
276
+ }
277
+ if (stored.run.retention === 'none' &&
278
+ 'output' in command.next &&
279
+ command.next.output !== undefined) {
280
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'Retention is none; a complete output cannot be stored.', { operation: 'execution.commitTransition', runId: command.runId });
281
+ }
282
+ if (stored.run.retention !== 'full' &&
283
+ 'output' in command.next &&
284
+ command.next.output !== undefined) {
285
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'Complete outputs require explicit full retention.', { operation: 'execution.commitTransition', runId: command.runId });
286
+ }
287
+ // Stage the updated record without mutating the previous snapshot, then
288
+ // append events. Any failure — invalid sequence, out-of-domain persisted
289
+ // value, fault hook, or serialization — rolls the staged transition back
290
+ // so no half-state (run updated without its events) ever becomes
291
+ // visible. Persisted values are canonicalized exactly like the SQLite
292
+ // adapter stores them, so both adapters behave equivalently.
293
+ const previous = stored.run;
294
+ try {
295
+ const updated = {
296
+ ...stored.run,
297
+ ...command.next,
298
+ ...(command.next.outputSummary !== undefined
299
+ ? { outputSummary: canonicalPersistedValue(command.next.outputSummary) }
300
+ : {}),
301
+ ...(command.next.output !== undefined
302
+ ? { output: canonicalPersistedValue(command.next.output) }
303
+ : {}),
304
+ ...(command.next.error !== undefined
305
+ ? { error: canonicalPersistedValue(command.next.error) }
306
+ : {}),
307
+ status: nextStatus,
308
+ recordRevision: stored.run.recordRevision + 1,
309
+ updatedAt: command.timestamp,
310
+ completedAt: command.next.completedAt !== undefined
311
+ ? command.next.completedAt
312
+ : nextStatus === 'running'
313
+ ? stored.run.completedAt
314
+ : command.timestamp,
315
+ };
316
+ stored.run = updated;
317
+ faults?.afterRunUpdate?.(command);
318
+ appendEvents(stored, command.events, command.expectedNextEventSeq, command.timestamp);
319
+ faults?.beforeCommit?.(command);
320
+ return immutableSnapshot(stored.run);
321
+ }
322
+ catch (cause) {
323
+ stored.run = previous;
324
+ stored.events.length = command.expectedNextEventSeq;
325
+ throw wrapInternal(cause, 'execution.commitTransition', command.runId);
326
+ }
327
+ };
328
+ const execution = {
329
+ async createRun(command) {
330
+ return createRun(command);
331
+ },
332
+ async commitTransition(command) {
333
+ return commitTransition(command);
334
+ },
335
+ async getRun(runId) {
336
+ const found = runs.get(runId);
337
+ return found ? immutableSnapshot(found.run) : undefined;
338
+ },
339
+ async listRuns(query = {}) {
340
+ const all = [...runs.values()]
341
+ .map((entry) => entry.run)
342
+ .filter((run) => (query.graphId === undefined || run.graphId === query.graphId) &&
343
+ (query.activationVersion === undefined ||
344
+ run.activationVersion === query.activationVersion) &&
345
+ (query.status === undefined || run.status === query.status))
346
+ .sort((a, b) => (a.createdAt < b.createdAt ? -1 : a.createdAt > b.createdAt ? 1 : 0));
347
+ return all.map((run) => immutableSnapshot(run));
348
+ },
349
+ async listEvents(runId, afterSeq = -1) {
350
+ const stored = runs.get(runId);
351
+ if (!stored) {
352
+ throw new VictStoreError('VICT_STORE_RUN_NOT_FOUND', 'Run not found.', {
353
+ operation: 'execution.listEvents',
354
+ runId,
355
+ });
356
+ }
357
+ return stored.events
358
+ .filter((event) => event.seq > afterSeq)
359
+ .map((event) => immutableSnapshot(event));
360
+ },
361
+ async recoverInterruptedRuns(command) {
362
+ const blocked = [];
363
+ for (const stored of runs.values()) {
364
+ if (stored.run.status !== 'running') {
365
+ continue;
366
+ }
367
+ const seq = stored.events.length;
368
+ const updated = {
369
+ ...stored.run,
370
+ status: 'blocked',
371
+ recordRevision: stored.run.recordRevision + 1,
372
+ updatedAt: command.timestamp,
373
+ completedAt: command.timestamp,
374
+ };
375
+ stored.run = updated;
376
+ appendEvents(stored, [
377
+ {
378
+ seq,
379
+ runId: stored.run.runId,
380
+ graphId: stored.run.graphId,
381
+ graphVersion: stored.run.graphVersion,
382
+ capabilitySetVersion: stored.run.capabilitySetVersion,
383
+ activationVersion: stored.run.activationVersion,
384
+ timestamp: command.timestamp,
385
+ type: 'run.blocked',
386
+ code: command.code,
387
+ steps: stored.run.steps,
388
+ reason: command.reason,
389
+ remediation: command.remediation,
390
+ },
391
+ ], seq, command.timestamp);
392
+ blocked.push({
393
+ runId: stored.run.runId,
394
+ graphId: stored.run.graphId,
395
+ activationVersion: stored.run.activationVersion,
396
+ currentNodeId: stored.run.currentNodeId,
397
+ steps: stored.run.steps,
398
+ eventSeq: seq,
399
+ });
400
+ }
401
+ return { scanned: blocked.length, blocked: blocked.map((entry) => immutableSnapshot(entry)) };
402
+ },
403
+ };
404
+ const orchestration = createInMemoryOrchestrationStore({
405
+ faults: faults === undefined
406
+ ? undefined
407
+ : {
408
+ afterStateStage: (operation) => faults.afterRunUpdate?.({ runId: operation }),
409
+ beforeCommit: (operation) => faults.beforeCommit?.({ runId: operation }),
410
+ },
411
+ });
412
+ return { catalog, execution, orchestration };
413
+ }
414
+ const ALL_RUN_STATUSES = ['running', 'completed', 'failed', 'blocked'];
415
+ /** Translate any non-store failure (e.g. an injected fault) into a structured store error. */
416
+ function wrapInternal(cause, operation, runId) {
417
+ if (cause instanceof VictStoreError) {
418
+ return cause;
419
+ }
420
+ return new VictStoreError('VICT_STORE_UNAVAILABLE', 'The storage operation failed and the transition was not committed.', { operation, runId }, cause);
421
+ }
422
+ function appendEvents(stored, events, expectedNextSeq, timestamp) {
423
+ let seq = expectedNextSeq;
424
+ for (const event of events) {
425
+ assertEvent(event);
426
+ // Every appended event must carry exactly its run's identity columns.
427
+ assertEventMatchesRun(event, stored.run);
428
+ if (event.seq !== seq) {
429
+ throw new VictStoreError('VICT_STORE_EVENT_SEQUENCE_CONFLICT', 'The event batch does not start at the expected dense sequence number.', {
430
+ operation: 'execution.appendEvents',
431
+ runId: stored.run.runId,
432
+ expectedEventSeq: seq,
433
+ actualEventSeq: event.seq,
434
+ });
435
+ }
436
+ stored.events.push({
437
+ runId: stored.run.runId,
438
+ seq: event.seq,
439
+ eventSchema: RUN_EVENT_SCHEMA,
440
+ type: event.type,
441
+ graphId: event.graphId,
442
+ graphVersion: event.graphVersion,
443
+ capabilitySetVersion: event.capabilitySetVersion,
444
+ activationVersion: event.activationVersion,
445
+ nodeId: 'nodeId' in event ? event.nodeId : null,
446
+ capabilityId: 'capabilityId' in event ? event.capabilityId : null,
447
+ payload: toCanonicalJson(event),
448
+ timestamp: event.timestamp ?? timestamp,
449
+ });
450
+ seq += 1;
451
+ }
452
+ }
453
+ /**
454
+ * The actual next event sequence of stored history: zero for an empty run,
455
+ * otherwise the preceding sequence plus one. A gapped or misaligned history
456
+ * is structured corruption and is never extended.
457
+ */
458
+ function storedNextEventSeq(events, runId) {
459
+ let expected = 0;
460
+ for (const event of events) {
461
+ if (event.seq !== expected) {
462
+ throw new VictStoreError('VICT_STORE_INVALID_RECORD', 'The stored event sequence has a gap; the run history is incomplete or corrupt.', { operation: 'execution.commitTransition', runId, expectedEventSeq: expected });
463
+ }
464
+ expected += 1;
465
+ }
466
+ return expected;
467
+ }
468
+ function assertManifest(command) {
469
+ if (command.manifest.manifestSchema !== ACTIVATION_MANIFEST_SCHEMA &&
470
+ command.manifest.manifestSchema !== ACTIVATION_MANIFEST_SCHEMA_V2) {
471
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', `Unsupported activation manifest schema '${String(command.manifest.manifestSchema)}'.`, { operation: 'catalog.publish' });
472
+ }
473
+ if (!command.manifest.activationVersion || !command.manifest.graphId) {
474
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'An activation manifest requires non-empty activationVersion and graphId.', { operation: 'catalog.publish' });
475
+ }
476
+ if (typeof command.canonicalManifest !== 'string' || command.canonicalManifest.length === 0) {
477
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'A canonical manifest string is required.', { operation: 'catalog.publish' });
478
+ }
479
+ }
480
+ function assertCreateCommand(command) {
481
+ if (!command.runId || !command.graphId || !command.activationVersion) {
482
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'A run requires non-empty runId, graphId and activationVersion.', { operation: 'execution.createRun', runId: command.runId });
483
+ }
484
+ if (typeof command.timestamp !== 'number' || !Number.isFinite(command.timestamp)) {
485
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'A run creation requires a finite timestamp.', { operation: 'execution.createRun', runId: command.runId });
486
+ }
487
+ const retention = command.retention;
488
+ if (retention !== 'none' && retention !== 'summary' && retention !== 'full') {
489
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', `Unknown payload retention '${String(retention)}'.`, { operation: 'execution.createRun', runId: command.runId });
490
+ }
491
+ const mode = command.mode;
492
+ if (mode !== 'normal' && mode !== 'simulate' && mode !== 'test') {
493
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', `Unknown execution mode '${String(mode)}'.`, { operation: 'execution.createRun', runId: command.runId });
494
+ }
495
+ }
496
+ function assertTransitionCommand(command) {
497
+ if (!command.runId) {
498
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'A transition requires a runId.', {
499
+ operation: 'execution.commitTransition',
500
+ });
501
+ }
502
+ if (!Number.isInteger(command.expectedRecordRevision) ||
503
+ command.expectedRecordRevision < 1 ||
504
+ !Number.isInteger(command.expectedNextEventSeq) ||
505
+ command.expectedNextEventSeq < 0) {
506
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'A transition requires an integer record revision (>=1) and event sequence (>=0).', { operation: 'execution.commitTransition', runId: command.runId });
507
+ }
508
+ }
509
+ function assertEvent(event, runId) {
510
+ if (!event || typeof event.type !== 'string') {
511
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'An event requires a string type.', {
512
+ operation: 'execution.appendEvents',
513
+ });
514
+ }
515
+ if (!Number.isInteger(event.seq) || event.seq < 0) {
516
+ throw new VictStoreError('VICT_STORE_EVENT_SEQUENCE_CONFLICT', 'An event requires a non-negative integer sequence number.', { operation: 'execution.appendEvents', actualEventSeq: event.seq });
517
+ }
518
+ if (runId !== undefined && event.runId !== runId) {
519
+ throw new VictStoreError('VICT_STORE_INVALID_COMMAND', 'An event references a different run than the transition targets.', { operation: 'execution.appendEvents', runId });
520
+ }
521
+ }
522
+ //# sourceMappingURL=in-memory-stores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-stores.js","sourceRoot":"","sources":["../src/in-memory-stores.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAsB/B,MAAM,UAAU,oBAAoB,CAAC,UAAiC,EAAE;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE5C,MAAM,iBAAiB,GAAG,CAAC,iBAAyB,EAAE,SAAiB,EAAoB,EAAE;QAC3F,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,cAAc,CAAC,iCAAiC,EAAE,uBAAuB,EAAE;gBACnF,SAAS;gBACT,iBAAiB;aAClB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC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orationFailureCode, CapabilityContext, CapabilityDefinition, DoubleInvoke, PayloadRetention, RunNodeOptions, RunOptions, RunRecord, RunResult, VictRuntimeOptions, } from './types.js';
2
+ export type { EffectClass, ExecutionMode, KernelEvent, KernelEventType, OutputSummary, } from '@victframework/kernel';
3
+ export type { ActivationCatalog, ActivationSelection, ActivationManifest, ActivationManifestBinding, ActivationManifestContract, CommitRunTransitionCommand, CreateRunCommand, DisposableVictStores, ExecutionStore, PublishActivationCommand, PublishAndSelectCommand, PublishResult, RecoveredRun, RecoveryCommand, RecoveryResult, RunQuery, SelectActivationCommand, StoredActivation, StoredEvent, StoredRun, StoredRunStatus, RunStateUpdate, TransitionFaultHooks, VictStores, } from './store-types.js';
4
+ export { ACTIVATION_MANIFEST_SCHEMA, ACTIVATION_MANIFEST_SCHEMA_V2, RUN_EVENT_SCHEMA, } from './store-types.js';
5
+ export type { InMemoryStoresOptions } from './in-memory-stores.js';
6
+ export { createInMemoryStores } from './in-memory-stores.js';
7
+ export type { OrchestrationInMemoryOptions } from './orchestration-in-memory.js';
8
+ export { createInMemoryOrchestrationStore } from './orchestration-in-memory.js';
9
+ export type { OrchestrationStore, OrchestrationSnapshotView, StoredOrchestrationRun, OrchestrationRunQuery, ClaimReadyTokenCommand, ClaimReadyTokenResult, ClaimedAttempt, ClaimPlanner, NodeExecutionPlanEntry, CompleteAttemptCommand, CompleteAttemptResult, AttemptContinuation, AttemptOutcome, NewWaitCommand, SignalWaitCommand, SignalDeliveryResult, DueTimerRecord, ClaimDueTimersCommand, ClaimDueTimersResult, ResolveDueTimerCommand, ResolveDueTimerResult, TimerRecord, RequestCancellationCommand, CancellationResult, ApplyCancellationCommand, RecoverableClaim, RecoverAttemptCommand, RecoverOrchestrationCommand, RecoverOrchestrationResult, ResolveBlockedCommand, ResolveBlockedResult, OrchestrationEventInput, OrchestrationFaultHooks, CreateOrchestrationRunCommand, } from './orchestration-store-types.js';
10
+ export type { StoreErrorCode, StoreErrorDetails } from './store-errors.js';
11
+ export { VictStoreError } from './store-errors.js';
12
+ export type { RuntimeErrorCode } from './errors.js';
13
+ export { VictRuntime, createRuntime } from './runtime.js';
14
+ export { decideEffectAuthorization } from './effect-policy.js';
15
+ export type { EffectPolicyOverrides } from './effect-policy.js';
16
+ export { VictRuntimeError } from './errors.js';
17
+ export { installCapabilityPack, VICT_RUNTIME_COMPAT_VERSION } from './pack-install.js';
18
+ export { runCapabilityPackConformanceSuite } from './pack-conformance.js';
19
+ export type { CapabilityPackConformanceFixture, CapabilityPackConformanceOptions, } from './pack-conformance.js';
20
+ export { gateCapabilityInvoke } from './authority.js';
21
+ export type { CapabilityAuthority, ConfigurationPort, SecretResolutionPort } from './authority.js';
22
+ export { toCanonicalJson, canonicalPersistedValue } from './serialization.js';
23
+ export { assertPublishableManifest, assertRunMatchesActivation, assertActivationBelongsToGraph, assertEventMatchesRun, assertStoredActivationReadable, } from './store-validation.js';
24
+ export type { ActivationIdentity, RunIdentityColumns } from './store-validation.js';
25
+ export type { AgentActivationRecord, AgentActivationRecordValidation, AgentActivationRestoreFailureCode, AgentActivationRestoreResult, AgentArtifact, AgentArtifactBinding, AgentArtifactKind, AgentCredentialPort, AgentHelperToolArtifact, AgentHelperToolDefinition, AgentHelperToolIO, AgentInstructionsArtifact, AgentMemoryPolicyArtifact, AgentMemoryPolicyConfig, AgentProcessorArtifact, AgentGuardrailArtifact, AgentProfileActivation, AgentStructuredOutputContractArtifact, AgentTurnExecutionContext, AgentTurnOutcome, AgentTurnRequest, AgentWorkflowArtifact, PinnedAgentTurnRunner, ProductAgentPort, } from './agent-types.js';
26
+ export { AGENT_ACTIVATION_IDENTITY_SCHEMA, AGENT_ACTIVATION_RECORD_SCHEMA, pinAgentTurnRunner, validateAgentActivationRecord, } from './agent-types.js';
27
+ export { AgentProfileRegistry } from './agent-registry.js';
28
+ export type { AgentProfileRegistryOptions } from './agent-registry.js';
29
+ export { AgentCredentialError, AgentConversationExportError, ConversationDeletionCoordinator, ConversationExportService, InMemoryAgentGovernanceStore, assertCredentialName, assertDeletionIntentRecord, assertDeletionReceiptStep, assertDeletionStateTransition, assertDeletionStateTransitionWithReceipts, DELETION_RECEIPT_STEP_INVALID_MESSAGE, DELETION_STEP_DOMAIN, protectCredentialPort, requireCredential, } from './agent-governance.js';
30
+ export type { AgentConversationDomainPort, AgentConversationExport, AgentConversationExportErrorCode, AgentConversationExportMessage, AgentConversationExportResult, AgentConversationMemoryExportPort, AgentCredentialErrorCode, AgentDeletionIntentRecord, AgentDeletionIntentState, AgentDeletionOutcome, AgentDeletionStep, AgentDeletionStepReceipt, AgentGovernanceStore, AgentMemoryDeletionPort, ConversationDeletionCoordinatorOptions, } from './agent-governance.js';
31
+ export { ACTOR_SCOPES, CHANGESET_BASE_NONE } from './control-types.js';
32
+ export type { ApplicationReleaseContent, ApplicationReleaseRecord, AuthenticatedActorContext, ActorDirectory, ActorRecord, ActorRole, ActorScope, ActorStatus, AgentApprovalRecord, AgentApprovalStatus, AgentApprovalStore, AgentControlStores, AgentStreamLedgerEvent, AgentStreamLedgerStore, AgentToolInvocationRecord, AgentToolInvocationStatus, TurnToolSlotAllocation, AgentToolInvocationStore, AgentTurnCorrelation, AgentTurnRecord, AgentTurnStatus, AgentTurnStore, ChangeSetApprovalDecision, ChangeSetBase, ChangeSetOperation, ChangeSetOperationReceipt, ChangeSetRecord, ChangeSetRiskClass, ChangeSetSimulationEvidence, ChangeSetStatus, ChangeSetValidationEvidence, CommandIdempotencyReceipt, CommandIdempotencyStore, CommandIdempotencyName, CommandIdempotencyLeaseTakeover, ControlAuditAction, ControlAuditEvent, ControlPlaneStore, ControlRunDetail, ControlRunKind, ControlRunOperationOutcome, ControlRunRecord, ReleaseSelectionRecord, } from './control-types.js';
33
+ export { ACTOR_ROLES, CHANGESET_SCHEMA, CONTROL_AUDIT_ACTIONS, COMMAND_IDEMPOTENCY_KEY_PATTERN, CONTROL_ID_PATTERN, ROLE_SCOPES, AGENT_TURN_SCHEMA, assertActorScope, assertBoundedString, assertControlId, assertControlTimestamp, authenticatedActorContext, authoritativeScopes, captureClosedControlArray, captureClosedControlRecord, controlContentHash, isDurableStreamKind, streamEventPayloadOf, validateApplicationReleaseContent, validateChangeSetContent, validateChangeSetOperation, validateStreamLedgerAppend, changeSetOperationIdentity, VICT_IDEMPOTENCY_FENCE_CONFLICT, commandIdempotencyFenceToken, } from './control-types.js';
34
+ export { ActorScopeDeniedError, VictControlError } from './control-types.js';
35
+ export { createInMemoryAgentControlStores, InMemoryActorDirectory, InMemoryAgentApprovalStore, InMemoryCommandIdempotencyStore, InMemoryAgentStreamLedgerStore, InMemoryAgentToolInvocationStore, InMemoryAgentTurnStore, InMemoryControlPlaneStore, } from './control-in-memory.js';
36
+ export { AgentStreamHub } from './stream-hub.js';
37
+ export { OPERATOR_CONFIG_SCHEMA, OperatorConfigError, OperatorCredentialUnavailableError, requireOperatorCredential, resolveOperatorConfiguration, resolveProviderProfileSelection, resolveRetentionBounds, resolveStoreLocationPlan, serializeOperatorConfiguration, } from './operator-config.js';
38
+ export type { OperatorConfigErrorCode, OperatorConfiguration, OperatorConfigInput, OperatorCredentialEnvironment, OperatorProfileInput, OperatorRetentionInput, OperatorStoresInput, ProviderProfileSelection, RetentionBounds, StoreLocationPlan, } from './operator-config.js';
39
+ export type { AgentStreamHubOptions, AgentStreamReplay, AgentStreamReplayStatus, AgentStreamSubscriber, } from './stream-hub.js';
40
+ export { inMemoryAgentControlConformanceFactory, runAgentControlConformanceSuite, } from './control-conformance.js';
41
+ export type { AgentControlConformanceFactory } from './control-conformance.js';
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ export { ACTIVATION_MANIFEST_SCHEMA, ACTIVATION_MANIFEST_SCHEMA_V2, RUN_EVENT_SCHEMA, } from './store-types.js';
2
+ export { createInMemoryStores } from './in-memory-stores.js';
3
+ export { createInMemoryOrchestrationStore } from './orchestration-in-memory.js';
4
+ export { VictStoreError } from './store-errors.js';
5
+ export { VictRuntime, createRuntime } from './runtime.js';
6
+ export { decideEffectAuthorization } from './effect-policy.js';
7
+ export { VictRuntimeError } from './errors.js';
8
+ // Stage 04 capability packs.
9
+ export { installCapabilityPack, VICT_RUNTIME_COMPAT_VERSION } from './pack-install.js';
10
+ export { runCapabilityPackConformanceSuite } from './pack-conformance.js';
11
+ export { gateCapabilityInvoke } from './authority.js';
12
+ export { toCanonicalJson, canonicalPersistedValue } from './serialization.js';
13
+ export { assertPublishableManifest, assertRunMatchesActivation, assertActivationBelongsToGraph, assertEventMatchesRun, assertStoredActivationReadable, } from './store-validation.js';
14
+ export { AGENT_ACTIVATION_IDENTITY_SCHEMA, AGENT_ACTIVATION_RECORD_SCHEMA, pinAgentTurnRunner, validateAgentActivationRecord, } from './agent-types.js';
15
+ export { AgentProfileRegistry } from './agent-registry.js';
16
+ export { AgentCredentialError, AgentConversationExportError, ConversationDeletionCoordinator, ConversationExportService, InMemoryAgentGovernanceStore, assertCredentialName, assertDeletionIntentRecord, assertDeletionReceiptStep, assertDeletionStateTransition, assertDeletionStateTransitionWithReceipts, DELETION_RECEIPT_STEP_INVALID_MESSAGE, DELETION_STEP_DOMAIN, protectCredentialPort, requireCredential, } from './agent-governance.js';
17
+ // ---- Stage 06B: control plane and governed remote execution ----------------
18
+ export { ACTOR_SCOPES, CHANGESET_BASE_NONE } from './control-types.js';
19
+ export { ACTOR_ROLES, CHANGESET_SCHEMA, CONTROL_AUDIT_ACTIONS, COMMAND_IDEMPOTENCY_KEY_PATTERN, CONTROL_ID_PATTERN, ROLE_SCOPES, AGENT_TURN_SCHEMA, assertActorScope, assertBoundedString, assertControlId, assertControlTimestamp, authenticatedActorContext, authoritativeScopes, captureClosedControlArray, captureClosedControlRecord, controlContentHash, isDurableStreamKind, streamEventPayloadOf, validateApplicationReleaseContent, validateChangeSetContent, validateChangeSetOperation, validateStreamLedgerAppend, changeSetOperationIdentity, VICT_IDEMPOTENCY_FENCE_CONFLICT, commandIdempotencyFenceToken, } from './control-types.js';
20
+ export { ActorScopeDeniedError, VictControlError } from './control-types.js';
21
+ export { createInMemoryAgentControlStores, InMemoryActorDirectory, InMemoryAgentApprovalStore, InMemoryCommandIdempotencyStore, InMemoryAgentStreamLedgerStore, InMemoryAgentToolInvocationStore, InMemoryAgentTurnStore, InMemoryControlPlaneStore, } from './control-in-memory.js';
22
+ export { AgentStreamHub } from './stream-hub.js';
23
+ // ---- Stage 07A: protected operator-configuration foundation -----------------
24
+ export { OPERATOR_CONFIG_SCHEMA, OperatorConfigError, OperatorCredentialUnavailableError, requireOperatorCredential, resolveOperatorConfiguration, resolveProviderProfileSelection, resolveRetentionBounds, resolveStoreLocationPlan, serializeOperatorConfiguration, } from './operator-config.js';
25
+ export { inMemoryAgentControlConformanceFactory, runAgentControlConformanceSuite, } from './control-conformance.js';
26
+ //# sourceMappingURL=index.js.map