@exaudeus/workrail 0.11.0 → 0.12.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 (57) hide show
  1. package/dist/config/feature-flags.js +1 -1
  2. package/dist/di/container.js +72 -0
  3. package/dist/di/tokens.d.ts +13 -0
  4. package/dist/di/tokens.js +13 -0
  5. package/dist/manifest.json +109 -93
  6. package/dist/mcp/error-mapper.d.ts +3 -8
  7. package/dist/mcp/error-mapper.js +41 -19
  8. package/dist/mcp/handlers/session.js +25 -11
  9. package/dist/mcp/handlers/v2-execution-helpers.d.ts +99 -0
  10. package/dist/mcp/handlers/v2-execution-helpers.js +249 -0
  11. package/dist/mcp/handlers/v2-execution.d.ts +4 -0
  12. package/dist/mcp/handlers/v2-execution.js +1061 -0
  13. package/dist/mcp/handlers/v2-workflow.js +7 -7
  14. package/dist/mcp/handlers/workflow.js +21 -12
  15. package/dist/mcp/index.d.ts +1 -1
  16. package/dist/mcp/index.js +4 -1
  17. package/dist/mcp/output-schemas.d.ts +411 -4
  18. package/dist/mcp/output-schemas.js +57 -1
  19. package/dist/mcp/server.d.ts +1 -1
  20. package/dist/mcp/server.js +57 -31
  21. package/dist/mcp/tool-descriptions.js +17 -0
  22. package/dist/mcp/tools.js +12 -0
  23. package/dist/mcp/types/tool-description-types.d.ts +1 -1
  24. package/dist/mcp/types/tool-description-types.js +2 -0
  25. package/dist/mcp/types.d.ts +38 -3
  26. package/dist/mcp/types.js +32 -3
  27. package/dist/mcp/v2/tool-registry.js +16 -1
  28. package/dist/mcp/v2/tools.d.ts +45 -0
  29. package/dist/mcp/v2/tools.js +21 -1
  30. package/dist/mcp/validation/workflow-next-prevalidate.d.ts +2 -3
  31. package/dist/mcp/validation/workflow-next-prevalidate.js +38 -27
  32. package/dist/v2/durable-core/ids/index.d.ts +2 -0
  33. package/dist/v2/durable-core/ids/index.js +4 -0
  34. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +100 -6
  35. package/dist/v2/durable-core/schemas/compiled-workflow/index.js +18 -3
  36. package/dist/v2/durable-core/schemas/session/events.d.ts +80 -50
  37. package/dist/v2/durable-core/schemas/session/events.js +27 -9
  38. package/dist/v2/durable-core/schemas/session/manifest.d.ts +2 -2
  39. package/dist/v2/durable-core/tokens/index.d.ts +2 -0
  40. package/dist/v2/durable-core/tokens/index.js +4 -1
  41. package/dist/v2/durable-core/tokens/payloads.d.ts +4 -4
  42. package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +3 -3
  43. package/dist/v2/infra/local/pinned-workflow-store/index.js +1 -1
  44. package/dist/v2/infra/local/session-lock/index.js +1 -1
  45. package/dist/v2/infra/local/session-store/index.d.ts +0 -1
  46. package/dist/v2/infra/local/session-store/index.js +348 -280
  47. package/dist/v2/ports/pinned-workflow-store.port.d.ts +3 -3
  48. package/dist/v2/ports/session-event-log-store.port.d.ts +1 -1
  49. package/dist/v2/ports/session-lock.port.d.ts +1 -1
  50. package/dist/v2/read-only/v1-to-v2-shim.d.ts +6 -1
  51. package/dist/v2/read-only/v1-to-v2-shim.js +16 -4
  52. package/dist/v2/usecases/execution-session-gate.d.ts +3 -2
  53. package/dist/v2/usecases/execution-session-gate.js +98 -101
  54. package/package.json +2 -1
  55. package/workflows/coding-task-workflow-agentic.json +326 -69
  56. package/workflows/design-thinking-workflow-autonomous.agentic.json +1 -1
  57. package/workflows/design-thinking-workflow.json +1 -1
@@ -57,7 +57,7 @@ exports.FEATURE_FLAG_DEFINITIONS = [
57
57
  key: 'v2Tools',
58
58
  envVar: 'WORKRAIL_ENABLE_V2_TOOLS',
59
59
  defaultValue: false,
60
- description: 'Enable WorkRail v2 MCP tools (Slice 1: list_workflows, inspect_workflow) behind an explicit opt-in flag',
60
+ description: 'Enable WorkRail v2 MCP tools (Slices 1–3: list/inspect/start/continue) behind an explicit opt-in flag',
61
61
  since: '0.9.0',
62
62
  stable: false,
63
63
  },
@@ -172,6 +172,77 @@ async function registerServices() {
172
172
  tsyringe_1.container.registerSingleton(tokens_js_1.DI.Mcp.DescriptionProvider, ToolDescriptionProvider);
173
173
  }
174
174
  }
175
+ async function registerV2Services() {
176
+ const { LocalDataDirV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/data-dir/index.js')));
177
+ const { NodeFileSystemV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/fs/index.js')));
178
+ const { NodeSha256V2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/sha256/index.js')));
179
+ const { NodeCryptoV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/crypto/index.js')));
180
+ const { NodeHmacSha256V2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/hmac-sha256/index.js')));
181
+ tsyringe_1.container.register(tokens_js_1.DI.V2.DataDir, {
182
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => new LocalDataDirV2(process.env)),
183
+ });
184
+ tsyringe_1.container.register(tokens_js_1.DI.V2.FileSystem, {
185
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => new NodeFileSystemV2()),
186
+ });
187
+ tsyringe_1.container.register(tokens_js_1.DI.V2.Sha256, {
188
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => new NodeSha256V2()),
189
+ });
190
+ tsyringe_1.container.register(tokens_js_1.DI.V2.Crypto, {
191
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => new NodeCryptoV2()),
192
+ });
193
+ tsyringe_1.container.register(tokens_js_1.DI.V2.HmacSha256, {
194
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => new NodeHmacSha256V2()),
195
+ });
196
+ const { LocalKeyringV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/keyring/index.js')));
197
+ const { LocalSessionEventLogStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/session-store/index.js')));
198
+ const { LocalSnapshotStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/snapshot-store/index.js')));
199
+ const { LocalPinnedWorkflowStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/pinned-workflow-store/index.js')));
200
+ const { LocalSessionLockV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/session-lock/index.js')));
201
+ tsyringe_1.container.register(tokens_js_1.DI.V2.Keyring, {
202
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
203
+ const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
204
+ const fs = c.resolve(tokens_js_1.DI.V2.FileSystem);
205
+ return new LocalKeyringV2(dataDir, fs);
206
+ }),
207
+ });
208
+ tsyringe_1.container.register(tokens_js_1.DI.V2.SessionStore, {
209
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
210
+ const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
211
+ const fs = c.resolve(tokens_js_1.DI.V2.FileSystem);
212
+ const sha256 = c.resolve(tokens_js_1.DI.V2.Sha256);
213
+ return new LocalSessionEventLogStoreV2(dataDir, fs, sha256);
214
+ }),
215
+ });
216
+ tsyringe_1.container.register(tokens_js_1.DI.V2.SnapshotStore, {
217
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
218
+ const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
219
+ const fs = c.resolve(tokens_js_1.DI.V2.FileSystem);
220
+ const crypto = c.resolve(tokens_js_1.DI.V2.Crypto);
221
+ return new LocalSnapshotStoreV2(dataDir, fs, crypto);
222
+ }),
223
+ });
224
+ tsyringe_1.container.register(tokens_js_1.DI.V2.PinnedWorkflowStore, {
225
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
226
+ const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
227
+ return new LocalPinnedWorkflowStoreV2(dataDir);
228
+ }),
229
+ });
230
+ tsyringe_1.container.register(tokens_js_1.DI.V2.SessionLock, {
231
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
232
+ const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
233
+ const fs = c.resolve(tokens_js_1.DI.V2.FileSystem);
234
+ return new LocalSessionLockV2(dataDir, fs);
235
+ }),
236
+ });
237
+ const { ExecutionSessionGateV2 } = await Promise.resolve().then(() => __importStar(require('../v2/usecases/execution-session-gate.js')));
238
+ tsyringe_1.container.register(tokens_js_1.DI.V2.ExecutionGate, {
239
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
240
+ const lock = c.resolve(tokens_js_1.DI.V2.SessionLock);
241
+ const store = c.resolve(tokens_js_1.DI.V2.SessionStore);
242
+ return new ExecutionSessionGateV2(lock, store);
243
+ }),
244
+ });
245
+ }
175
246
  async function initializeContainer(options = {}) {
176
247
  if (initialized)
177
248
  return;
@@ -196,6 +267,7 @@ async function initializeContainer(options = {}) {
196
267
  registerRuntime(options);
197
268
  await registerConfig();
198
269
  await registerStorageChain();
270
+ await registerV2Services();
199
271
  await registerServices();
200
272
  initialized = true;
201
273
  console.error('[DI] Container initialized');
@@ -21,6 +21,19 @@ export declare const DI: {
21
21
  readonly Mcp: {
22
22
  readonly DescriptionProvider: symbol;
23
23
  };
24
+ readonly V2: {
25
+ readonly DataDir: symbol;
26
+ readonly FileSystem: symbol;
27
+ readonly Sha256: symbol;
28
+ readonly Crypto: symbol;
29
+ readonly HmacSha256: symbol;
30
+ readonly Keyring: symbol;
31
+ readonly SessionStore: symbol;
32
+ readonly SnapshotStore: symbol;
33
+ readonly PinnedWorkflowStore: symbol;
34
+ readonly SessionLock: symbol;
35
+ readonly ExecutionGate: symbol;
36
+ };
24
37
  readonly Runtime: {
25
38
  readonly Mode: symbol;
26
39
  readonly ProcessLifecyclePolicy: symbol;
package/dist/di/tokens.js CHANGED
@@ -24,6 +24,19 @@ exports.DI = {
24
24
  Mcp: {
25
25
  DescriptionProvider: Symbol('Mcp.DescriptionProvider'),
26
26
  },
27
+ V2: {
28
+ DataDir: Symbol('V2.DataDir'),
29
+ FileSystem: Symbol('V2.FileSystem'),
30
+ Sha256: Symbol('V2.Sha256'),
31
+ Crypto: Symbol('V2.Crypto'),
32
+ HmacSha256: Symbol('V2.HmacSha256'),
33
+ Keyring: Symbol('V2.Keyring'),
34
+ SessionStore: Symbol('V2.SessionStore'),
35
+ SnapshotStore: Symbol('V2.SnapshotStore'),
36
+ PinnedWorkflowStore: Symbol('V2.PinnedWorkflowStore'),
37
+ SessionLock: Symbol('V2.SessionLock'),
38
+ ExecutionGate: Symbol('V2.ExecutionGate'),
39
+ },
27
40
  Runtime: {
28
41
  Mode: Symbol('Runtime.Mode'),
29
42
  ProcessLifecyclePolicy: Symbol('Runtime.ProcessLifecyclePolicy'),
@@ -230,7 +230,7 @@
230
230
  "bytes": 1512
231
231
  },
232
232
  "config/feature-flags.js": {
233
- "sha256": "b0567cb3c14351b319c40a6d9625a10d3da47c98dab40ac4160e827470707b30",
233
+ "sha256": "2881b750bbaeb9af57ae2acfa476ed94f7da2a95781478b9713d978f30700356",
234
234
  "bytes": 6920
235
235
  },
236
236
  "core/error-handler.d.ts": {
@@ -246,16 +246,16 @@
246
246
  "bytes": 565
247
247
  },
248
248
  "di/container.js": {
249
- "sha256": "437317c12e0d0f9bca14fa53033c2ff57919519c18020ffb4194ec52691df78d",
250
- "bytes": 12763
249
+ "sha256": "e218c6ffb6df78297b0773c62668488ef40597c503feed1dd596a245a34a63a9",
250
+ "bytes": 17292
251
251
  },
252
252
  "di/tokens.d.ts": {
253
- "sha256": "85ea4f03949b62bb548788374a58242dd7b6317a29ac53b2b5d7b0972c3fadfd",
254
- "bytes": 1297
253
+ "sha256": "cca34f8375516d26213b50c156378ad3d535798a04229dbddf9f2c7da3639eca",
254
+ "bytes": 1734
255
255
  },
256
256
  "di/tokens.js": {
257
- "sha256": "f3e93991a387440b0b136e4b26b0c56f1fc77ab169a67bd3f77928a65f9f08f3",
258
- "bytes": 1627
257
+ "sha256": "973c597f2ef8de75678731a120eccaa4b31f75e14744ee1936f23a6b36b3a3b0",
258
+ "bytes": 2147
259
259
  },
260
260
  "domain/execution/error.d.ts": {
261
261
  "sha256": "2eac85c42ec399a23724f868641eeadd0d196b4d324ee4caaff82a6b46155bd9",
@@ -490,60 +490,76 @@
490
490
  "bytes": 476
491
491
  },
492
492
  "mcp/error-mapper.d.ts": {
493
- "sha256": "7c74ccf6299b381a3cf89a57bb20cf34b21a821fd24e147cc13132ee81d322b0",
494
- "bytes": 413
493
+ "sha256": "9ed8afa42fd432ab9bdf781c90ec157eb51ef03e2b17afbb74ad54b91e5bae8a",
494
+ "bytes": 267
495
495
  },
496
496
  "mcp/error-mapper.js": {
497
- "sha256": "6fc84cd9ffc6b9a8557efe4d99441cfc0bf5d38ad6353c0caa952578e194f20c",
498
- "bytes": 2774
497
+ "sha256": "1437bf9380090920512565c0d685a268af29d8b7e747eff62904e1090e69c854",
498
+ "bytes": 3735
499
499
  },
500
500
  "mcp/handlers/session.d.ts": {
501
501
  "sha256": "38926e69a0e4935d1dbcdc53848be9fff0e4d8f96827883da3216f217918fa82",
502
502
  "bytes": 1394
503
503
  },
504
504
  "mcp/handlers/session.js": {
505
- "sha256": "b4f26eadf8a2aa404e33d7299926f772aa64b400e7011d365ddd27b8608c614f",
506
- "bytes": 6364
505
+ "sha256": "4955f0b09766426318f5d21ab3bd8967b11666830000504e44ef3b94beb526ee",
506
+ "bytes": 6622
507
+ },
508
+ "mcp/handlers/v2-execution-helpers.d.ts": {
509
+ "sha256": "67f1faa4f650e33dd567c3ae1d8a5077df1141a0496a2f07ac55eaa122c08704",
510
+ "bytes": 4383
511
+ },
512
+ "mcp/handlers/v2-execution-helpers.js": {
513
+ "sha256": "1e512e54f2b90630d47148fed604b8f302fe72cfca19fa91592b9fd2115d517f",
514
+ "bytes": 12773
515
+ },
516
+ "mcp/handlers/v2-execution.d.ts": {
517
+ "sha256": "0d96c77d37702b43645399044ceb3f7a772388be7020c2ed4f99e99b21c5dc73",
518
+ "bytes": 399
519
+ },
520
+ "mcp/handlers/v2-execution.js": {
521
+ "sha256": "38f4a3090340b93f263032a7affe4639c590db862781083ae70576b0b373c0d5",
522
+ "bytes": 53062
507
523
  },
508
524
  "mcp/handlers/v2-workflow.d.ts": {
509
525
  "sha256": "9fbd4d44854e2060c54982b21e72c608970bb2bd107bb15a8388b26c6b492e55",
510
526
  "bytes": 397
511
527
  },
512
528
  "mcp/handlers/v2-workflow.js": {
513
- "sha256": "5613b4d4d4b5128cc60dd9c486ee8764760a64aa693363d1060646388b04e919",
514
- "bytes": 5393
529
+ "sha256": "2185cf808fa0aeb164f72a3f596b32b4b4e6b87c3b2925efd71251c2c7d1f968",
530
+ "bytes": 5291
515
531
  },
516
532
  "mcp/handlers/workflow.d.ts": {
517
533
  "sha256": "050565039a20af3f7fc8311337ff4547438ecc59433e5744aacce8f203326774",
518
534
  "bytes": 1748
519
535
  },
520
536
  "mcp/handlers/workflow.js": {
521
- "sha256": "47f962d0228eefca3e2b7ac1c2c4d103080e9cd74296f027e0de012a67c335f0",
522
- "bytes": 8364
537
+ "sha256": "99ff7aac9705ef540cc5681515cf2aa9650d886761f7ae69f829ff87ac772756",
538
+ "bytes": 8246
523
539
  },
524
540
  "mcp/index.d.ts": {
525
- "sha256": "ba84a08a8f42927695a562d464c0a8ac5ea38c25717f260a4c0ac192cf627dc8",
526
- "bytes": 1911
541
+ "sha256": "525b4247cf90ba3af66769462bcfaab5dbf38ee8c49d2a9ceec1e4b38e33511b",
542
+ "bytes": 1964
527
543
  },
528
544
  "mcp/index.js": {
529
- "sha256": "264c1acd118d1613e3a14d662d02bdbff3904354d5ed01dc6b92668f111624ae",
530
- "bytes": 7061
545
+ "sha256": "6895e8416b29418900d039a7acb3d486be844d36582d6117f22c0e7d03fa212e",
546
+ "bytes": 7535
531
547
  },
532
548
  "mcp/output-schemas.d.ts": {
533
- "sha256": "85d72c1ccbb6e6e41b39138294ee2c3587345dd9510e0347a2aa5c63c109b065",
534
- "bytes": 9054
549
+ "sha256": "5a79d1dad82e2a2cf57dde65aafc8aa20fee1513784ee6eb1aba9ae2e71d95a3",
550
+ "bytes": 22948
535
551
  },
536
552
  "mcp/output-schemas.js": {
537
- "sha256": "e8165c2304ae91acfee112357d68d34bf10aa534e3ad59e5c8d3d1a4e55bf776",
538
- "bytes": 3902
553
+ "sha256": "efe70158aa94df76b17d0200c193fb867c254a5d62ec12d960aaa6f8d8b9f5bb",
554
+ "bytes": 6367
539
555
  },
540
556
  "mcp/server.d.ts": {
541
- "sha256": "db95f54ed5b34ca483aecf5d9547fa2c776202bfd039b5a45e4a6ed49c3b8e2c",
542
- "bytes": 159
557
+ "sha256": "bec49b8d07e189a53db7100d2f0e1e84ffe03150f04e1b06908ee3282982b4a2",
558
+ "bytes": 168
543
559
  },
544
560
  "mcp/server.js": {
545
- "sha256": "5f79269248619c1007c630b3c738fcb2e8583aa07cd071ae8ad7a7e08e1a2134",
546
- "bytes": 11878
561
+ "sha256": "1354714d71946272737a8844c1c3878c72893b48f67ee22bc91eef699f1d12a2",
562
+ "bytes": 13315
547
563
  },
548
564
  "mcp/tool-description-provider.d.ts": {
549
565
  "sha256": "1d46abc3112e11b68e57197e846f5708293ec9b2281fa71a9124ee2aad71e41b",
@@ -558,8 +574,8 @@
558
574
  "bytes": 132
559
575
  },
560
576
  "mcp/tool-descriptions.js": {
561
- "sha256": "ea695dd970d23b1eb4379743766e7a1606e28ed134d8d4d44e4281332fef8942",
562
- "bytes": 6651
577
+ "sha256": "e0612a2bcef42904c1415b92c4c155f55989f81a0e75145c83e411ea4a7a2c6e",
578
+ "bytes": 7762
563
579
  },
564
580
  "mcp/tool-factory.d.ts": {
565
581
  "sha256": "0fe3c6b863b2d7aef0c3d659ff54f3a9ee8a0a3c2005b6565d2f8ad517bc7211",
@@ -574,40 +590,40 @@
574
590
  "bytes": 5952
575
591
  },
576
592
  "mcp/tools.js": {
577
- "sha256": "12db49888fa743d5983772ebfa8908a134c76d6ae68796a2d5d7a71a8b7b1767",
578
- "bytes": 7366
593
+ "sha256": "5464baad21a5b5cb25ba46a6b326c0fd4e46ebbd0c125fc41079a1d7530b9ba5",
594
+ "bytes": 7702
579
595
  },
580
596
  "mcp/types.d.ts": {
581
- "sha256": "66318a86d260580d0f2e34b21a67e39499886a9856ac98b660e0a5829de059f1",
582
- "bytes": 1226
597
+ "sha256": "77bb938f717b095d93514c7d5b57c9685ec704adc602e7614c0dc182ab8adb7d",
598
+ "bytes": 3362
583
599
  },
584
600
  "mcp/types.js": {
585
- "sha256": "85a9779b9c83cbfe27d2d6c656191506fb4face96a43ff7961c17267f32ac173",
586
- "bytes": 343
601
+ "sha256": "0c12576fd0053115ff096fe26b38f77f1e830b7ec4781aaf94564827c4c9e81a",
602
+ "bytes": 1253
587
603
  },
588
604
  "mcp/types/tool-description-types.d.ts": {
589
- "sha256": "7485acdd94725fb6f5c81ece0668fb537168440b167e62a56b039b30c4fa5f12",
590
- "bytes": 736
605
+ "sha256": "772592838382804a09e83235dd2fdee038681cb2af5ab3ec967de60fa0109c36",
606
+ "bytes": 775
591
607
  },
592
608
  "mcp/types/tool-description-types.js": {
593
- "sha256": "69594cfa3a1ba5b82674ceb8e79b9b6c6c80e6524c0d94d233c6d318434a815b",
594
- "bytes": 696
609
+ "sha256": "f3f459da53c1677533fdaedbe4b98e0ea5af0d29fd20d62111c7eea7039ed02a",
610
+ "bytes": 743
595
611
  },
596
612
  "mcp/v2/tool-registry.d.ts": {
597
613
  "sha256": "e97ae56ce8bc994fb33d130e4dfec6fb65d34dc15b6f828fc36010197da6bdbe",
598
614
  "bytes": 479
599
615
  },
600
616
  "mcp/v2/tool-registry.js": {
601
- "sha256": "c58abd201091f5195e54992cc562ff529f4b54588f7ecb02ce2b865a563366a9",
602
- "bytes": 1134
617
+ "sha256": "33bf91363777bbb14d985978e0b056c67a6f7574dd3e8b572603a1b1db457237",
618
+ "bytes": 2001
603
619
  },
604
620
  "mcp/v2/tools.d.ts": {
605
- "sha256": "0fc14830ecb5970206643adf60630e663b4f16ff5c2224ef1c3377ebef2f1178",
606
- "bytes": 895
621
+ "sha256": "0ef14d1e8e375a17ff7f1edc26ded4a636207c6f9f998136d5910f7f86537602",
622
+ "bytes": 2579
607
623
  },
608
624
  "mcp/v2/tools.js": {
609
- "sha256": "f8f7d1d0ec66d249959673e69fcb7a85479e11a15e964df2bb5427a8c55bebcf",
610
- "bytes": 849
625
+ "sha256": "9e934ea8a5f83bffc68d343970292267b207f67d72a5aa824348967e53777820",
626
+ "bytes": 2333
611
627
  },
612
628
  "mcp/validation/bounded-json.d.ts": {
613
629
  "sha256": "82203ac6123d5c6989606c3b5405aaea99ab829c8958835f9ae3ba45b8bc8fd5",
@@ -618,12 +634,12 @@
618
634
  "bytes": 834
619
635
  },
620
636
  "mcp/validation/workflow-next-prevalidate.d.ts": {
621
- "sha256": "804076770d02a7d28301473db4b0833d1abc99f20ed3e67809a3753445f99672",
622
- "bytes": 310
637
+ "sha256": "179058225dfb17f4be02d6105bbacdaa99f1441cfc25062b38d8283f0bf35b5a",
638
+ "bytes": 254
623
639
  },
624
640
  "mcp/validation/workflow-next-prevalidate.js": {
625
- "sha256": "4bcc524de6925d0d6b99ed5606bb4d3d280744b2cd7129b6ee152cb83be6c501",
626
- "bytes": 3153
641
+ "sha256": "537c7fd9068f45d5aee4a90e834a27e8bb1ee7fe2c6df860964c125e2979d86e",
642
+ "bytes": 3670
627
643
  },
628
644
  "mcp/zod-to-json-schema.d.ts": {
629
645
  "sha256": "c80cfa6980a88c823ac47d04706b2223a351de3f4c76ee778f81ad3dda2c766b",
@@ -874,12 +890,12 @@
874
890
  "bytes": 447
875
891
  },
876
892
  "v2/durable-core/ids/index.d.ts": {
877
- "sha256": "47f0922ce721516b60c38cc827e3dbeea83074093c62e62cbbfa7e4ce0ea959c",
878
- "bytes": 1678
893
+ "sha256": "5525efc423ad30635996907f7560f53559e49e33a64411a684370ebd1ae56410",
894
+ "bytes": 1792
879
895
  },
880
896
  "v2/durable-core/ids/index.js": {
881
- "sha256": "8b348436b2ae504f6e57cc4332746fb2c8d639520071b373bdd0e7da409a59bb",
882
- "bytes": 1224
897
+ "sha256": "a6499471fb67d7a43923c898ef79193390f18912090f27886b52678d13805f11",
898
+ "bytes": 1306
883
899
  },
884
900
  "v2/durable-core/ids/with-healthy-session-lock.d.ts": {
885
901
  "sha256": "dc1812850b9ce69c0135d575b0994ac4fa7b874bf9db7a1838b6a3390ef31ae2",
@@ -898,12 +914,12 @@
898
914
  "bytes": 428
899
915
  },
900
916
  "v2/durable-core/schemas/compiled-workflow/index.d.ts": {
901
- "sha256": "caab753a39b7abc1e3c52bfd2fca93402a8a1b11c2ef13aaf5c2c0a86f7ba135",
902
- "bytes": 1171
917
+ "sha256": "5146bd86e5785117e260276775a3783871c141425a03f4643bf421a00e5b9bf2",
918
+ "bytes": 3645
903
919
  },
904
920
  "v2/durable-core/schemas/compiled-workflow/index.js": {
905
- "sha256": "49e3b2f36fe18e75f864b402db0d58f8e1d66e6116fe381af9fc0c76e6f00f8f",
906
- "bytes": 621
921
+ "sha256": "a1b6befdee89a853f22c7077e3470b17bcee8ce0dabd6d5f2dafe270b3820977",
922
+ "bytes": 1350
907
923
  },
908
924
  "v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts": {
909
925
  "sha256": "96ad2f741274a55ecfeb3cd4c385938db6d4f4f25fee7ea460158b09e4422988",
@@ -930,12 +946,12 @@
930
946
  "bytes": 2983
931
947
  },
932
948
  "v2/durable-core/schemas/session/events.d.ts": {
933
- "sha256": "8de8d8904b67ca93d985c1e215f216d929612fb14357888f88ff270f6ac3c40f",
934
- "bytes": 61834
949
+ "sha256": "9a50360562cf5bb2d544c9b39fb9451bdbacf6f15e85c69a4faa86a1959fa6f9",
950
+ "bytes": 63045
935
951
  },
936
952
  "v2/durable-core/schemas/session/events.js": {
937
- "sha256": "411228cda7ef149d25413c668e858d5691810cff8e6ce64913bf8e0cb1cfda2a",
938
- "bytes": 15007
953
+ "sha256": "a709131e5b89f70e67170b2491ece5887bc8443167857a736f92fde5881ebc41",
954
+ "bytes": 15655
939
955
  },
940
956
  "v2/durable-core/schemas/session/index.d.ts": {
941
957
  "sha256": "f4f500d33d212760f480d91fafd4474f7b12f9239a6c5e9c2d80d0fe96207b65",
@@ -946,7 +962,7 @@
946
962
  "bytes": 715
947
963
  },
948
964
  "v2/durable-core/schemas/session/manifest.d.ts": {
949
- "sha256": "183a7260b72f87388e96f212f0fa2669450c3c6ed943608ebd0d0014a1d2ddaa",
965
+ "sha256": "e70c4e1f52ee00057e0ad6d8b7fff0f0a4a6f85cf4228ab72bc3e704245f0a31",
950
966
  "bytes": 1534
951
967
  },
952
968
  "v2/durable-core/schemas/session/manifest.js": {
@@ -970,15 +986,15 @@
970
986
  "bytes": 558
971
987
  },
972
988
  "v2/durable-core/tokens/index.d.ts": {
973
- "sha256": "4409ca6cf0245ad850f61652884d9121c8442797e0602a41d2e32a63d04d9d35",
974
- "bytes": 686
989
+ "sha256": "29ad2efe0f8c6905693ffd57428ed3186cd103c0b112a8280a97abc5ea83af79",
990
+ "bytes": 805
975
991
  },
976
992
  "v2/durable-core/tokens/index.js": {
977
- "sha256": "7b4fe787fea9f215b42902ae08a5c94daa4941fb5283de9524feb0b4ef603bf7",
978
- "bytes": 2594
993
+ "sha256": "774e2fe4d30a2731e53a111953a4e5fcc1e668977f054270e5fbbfc351a321c9",
994
+ "bytes": 2924
979
995
  },
980
996
  "v2/durable-core/tokens/payloads.d.ts": {
981
- "sha256": "2889ce061b4734cc3ccdc1df315bc58170a421de1661a5bb7cf08710a7e43d53",
997
+ "sha256": "568d7ba9f83ea7584b1c815f79b920f8e548e71a244a6dc5709dc981fc5286d4",
982
998
  "bytes": 6756
983
999
  },
984
1000
  "v2/durable-core/tokens/payloads.js": {
@@ -1042,28 +1058,28 @@
1042
1058
  "bytes": 3839
1043
1059
  },
1044
1060
  "v2/infra/local/pinned-workflow-store/index.d.ts": {
1045
- "sha256": "d2342ebedf9ce061615a85c1fd4c64de117ea943232da08beef7916c8ecd0a96",
1046
- "bytes": 809
1061
+ "sha256": "61670e576d288f9f98b6314f71a652ca7a20eaf402ecad263e94563cb9cd5ac7",
1062
+ "bytes": 803
1047
1063
  },
1048
1064
  "v2/infra/local/pinned-workflow-store/index.js": {
1049
- "sha256": "46f2876d4d925b6956cefda1d6c5d3a5364b6cff280ffccd687fd1d0da61cc69",
1050
- "bytes": 3733
1065
+ "sha256": "6a0edfda32ae0e10021702deda75f9cc1c891e1cc02d9e4ad947517f0bde740a",
1066
+ "bytes": 3731
1051
1067
  },
1052
1068
  "v2/infra/local/session-lock/index.d.ts": {
1053
1069
  "sha256": "e6c6d39259037c4aaaf4465f68d27e24512252b5547b726ec1e86857e1eac046",
1054
1070
  "bytes": 727
1055
1071
  },
1056
1072
  "v2/infra/local/session-lock/index.js": {
1057
- "sha256": "27cc61babea8e5dc0b6077c3298149bb02c0db6f7ed6e3e76fdb6248162c400d",
1058
- "bytes": 1640
1073
+ "sha256": "06be71237bdf98431e39b97d7ded7737d4bf5efab440f81f541b5ce43768e720",
1074
+ "bytes": 1649
1059
1075
  },
1060
1076
  "v2/infra/local/session-store/index.d.ts": {
1061
- "sha256": "bd6a47ede5fc58a72b18031d57bd7357d4657f11d06aee2c2d08391be51b213d",
1062
- "bytes": 1467
1077
+ "sha256": "9f2a4bd619722ff114100a51468aab6a3e4123f9454ce31cfce32aea63e57a2c",
1078
+ "bytes": 1447
1063
1079
  },
1064
1080
  "v2/infra/local/session-store/index.js": {
1065
- "sha256": "3b844370c4cff55b53dd18401eec7e14fb5e5c34d7b851650eb6dfb81fc97b77",
1066
- "bytes": 21855
1081
+ "sha256": "19a652715895943c3fa453406a43c91aaf4260f582c943fde5fc5fdc34dbdb28",
1082
+ "bytes": 26913
1067
1083
  },
1068
1084
  "v2/infra/local/sha256/index.d.ts": {
1069
1085
  "sha256": "8a727b7e54a38275ca6f9f1b8730f97cfc0a212df035df1bdc58e716e6824230",
@@ -1114,24 +1130,24 @@
1114
1130
  "bytes": 77
1115
1131
  },
1116
1132
  "v2/ports/pinned-workflow-store.port.d.ts": {
1117
- "sha256": "1803a47bad9777e37f1fef0fa51e67c0d0c39e0e2b5871f16c03546d3d1096b7",
1118
- "bytes": 614
1133
+ "sha256": "5105f42539f6ad813d468fc5c7f3c17648855731bb1b5f088354afae1856dac1",
1134
+ "bytes": 608
1119
1135
  },
1120
1136
  "v2/ports/pinned-workflow-store.port.js": {
1121
1137
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1122
1138
  "bytes": 77
1123
1139
  },
1124
1140
  "v2/ports/session-event-log-store.port.d.ts": {
1125
- "sha256": "ffd5706ab752e9264c394b4960ea821fc96838b4111a38c9fb223972f568f45a",
1126
- "bytes": 1991
1141
+ "sha256": "80743c9f579d6aad94c47eaae80617c7ab82d192148e6734dcea70ac902d1b86",
1142
+ "bytes": 2000
1127
1143
  },
1128
1144
  "v2/ports/session-event-log-store.port.js": {
1129
1145
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1130
1146
  "bytes": 77
1131
1147
  },
1132
1148
  "v2/ports/session-lock.port.d.ts": {
1133
- "sha256": "fe33f712f99168a15fbce20f770b9440f81fa8412d279867c3f90481735cb534",
1134
- "bytes": 783
1149
+ "sha256": "5554f057bd087a8e00fd9b4a14004b6c5a1bee2d596f99ff8c3dce8e94de9f01",
1150
+ "bytes": 792
1135
1151
  },
1136
1152
  "v2/ports/session-lock.port.js": {
1137
1153
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
@@ -1218,20 +1234,20 @@
1218
1234
  "bytes": 550
1219
1235
  },
1220
1236
  "v2/read-only/v1-to-v2-shim.d.ts": {
1221
- "sha256": "bc778fe2034ce1691eb089ed9415fcd162dcddfc4a9f95106200b7822d15a22c",
1222
- "bytes": 272
1237
+ "sha256": "c420c5473b8b804e3e44a9e91a073bce20787abb3fd5c56b47ecab0293dc9171",
1238
+ "bytes": 463
1223
1239
  },
1224
1240
  "v2/read-only/v1-to-v2-shim.js": {
1225
- "sha256": "e88caca3921758d1ed3806c9cb7d4ea35cc3f32689fbead2f2c96101fbbfc6e9",
1226
- "bytes": 1498
1241
+ "sha256": "6ea788b80605db6d2057b3d5e520be48ace8afe6d8f37bf55cef00ba1471a6b7",
1242
+ "bytes": 1935
1227
1243
  },
1228
1244
  "v2/usecases/execution-session-gate.d.ts": {
1229
- "sha256": "30ea073d1728abf3b71ae8c501c3fa6ecd26fde16074719349f875342ac29fdd",
1230
- "bytes": 2038
1245
+ "sha256": "339c4a8e02a77416e725e063a57d39a20788244498ae2c7a31dc48d111af6280",
1246
+ "bytes": 2084
1231
1247
  },
1232
1248
  "v2/usecases/execution-session-gate.js": {
1233
- "sha256": "d7d6430b622e45d31d38bd71c6f7c914d2c3b4f6ebf68a0368d6d372867031e9",
1234
- "bytes": 7606
1249
+ "sha256": "8b9e23c784c018e58bae73a7dd3a0a154fba4da91e76ae346b5d6682c18ec10b",
1250
+ "bytes": 7581
1235
1251
  }
1236
1252
  }
1237
1253
  }
@@ -1,9 +1,4 @@
1
1
  import type { DomainError } from '../domain/execution/error.js';
2
- import type { ErrorCode } from './types.js';
3
- export interface ToolErrorMapping {
4
- readonly code: ErrorCode;
5
- readonly message: string;
6
- readonly suggestion?: string;
7
- }
8
- export declare function mapDomainErrorToToolError(err: DomainError): ToolErrorMapping;
9
- export declare function mapUnknownErrorToToolError(err: unknown): ToolErrorMapping;
2
+ import type { ToolError } from './types.js';
3
+ export declare function mapDomainErrorToToolError(err: DomainError): ToolError;
4
+ export declare function mapUnknownErrorToToolError(err: unknown): ToolError;
@@ -4,55 +4,77 @@ exports.mapDomainErrorToToolError = mapDomainErrorToToolError;
4
4
  exports.mapUnknownErrorToToolError = mapUnknownErrorToToolError;
5
5
  const bounded_json_js_1 = require("./validation/bounded-json.js");
6
6
  function assertNever(x) {
7
- throw new Error(`Unhandled DomainError variant: ${JSON.stringify(x)}`);
7
+ return {
8
+ type: 'error',
9
+ code: 'INTERNAL_ERROR',
10
+ message: `Unhandled DomainError variant: ${JSON.stringify(x)}`,
11
+ retry: { kind: 'not_retryable' },
12
+ details: { invariantViolation: 'exhaustiveness_check_failed' },
13
+ };
8
14
  }
9
15
  function mapDomainErrorToToolError(err) {
10
16
  switch (err._tag) {
11
17
  case 'WorkflowNotFound':
12
18
  return {
19
+ type: 'error',
13
20
  code: 'NOT_FOUND',
14
21
  message: err.message,
15
- suggestion: `Check available workflows with workflow_list`,
22
+ retry: { kind: 'not_retryable' },
23
+ details: { suggestion: `Check available workflows with workflow_list` },
16
24
  };
17
25
  case 'InvalidState':
18
26
  return {
27
+ type: 'error',
19
28
  code: 'VALIDATION_ERROR',
20
29
  message: err.message,
21
- suggestion: `Use the "state" returned by the last workflow_next call.\n` +
22
- `If you are completing a step, send an event like:\n` +
23
- (0, bounded_json_js_1.toBoundedJsonString)({
24
- kind: 'step_completed',
25
- stepInstanceId: {
26
- stepId: '<previous next.stepInstanceId.stepId>',
27
- loopPath: [],
28
- },
29
- }, 512),
30
+ retry: { kind: 'not_retryable' },
31
+ details: {
32
+ suggestion: `Use the "state" returned by the last workflow_next call.\n` +
33
+ `If you are completing a step, send an event like:\n` +
34
+ (0, bounded_json_js_1.toBoundedJsonString)({
35
+ kind: 'step_completed',
36
+ stepInstanceId: {
37
+ stepId: '<previous next.stepInstanceId.stepId>',
38
+ loopPath: [],
39
+ },
40
+ }, 512),
41
+ },
30
42
  };
31
43
  case 'InvalidLoop':
32
44
  return {
45
+ type: 'error',
33
46
  code: 'VALIDATION_ERROR',
34
47
  message: err.message,
35
- suggestion: 'Validate the workflow definition and ensure loop/body step IDs are consistent',
48
+ retry: { kind: 'not_retryable' },
49
+ details: { suggestion: 'Validate the workflow definition and ensure loop/body step IDs are consistent' },
36
50
  };
37
51
  case 'MissingContext':
38
52
  return {
53
+ type: 'error',
39
54
  code: 'PRECONDITION_FAILED',
40
55
  message: err.message,
41
- suggestion: 'Provide the required keys in the `context` object for condition evaluation and loop inputs.\n' +
42
- 'Example:\n' +
43
- (0, bounded_json_js_1.toBoundedJsonString)({ context: { '<requiredKey>': '<value>' } }, 256),
56
+ retry: { kind: 'not_retryable' },
57
+ details: {
58
+ suggestion: 'Provide the required keys in the `context` object for condition evaluation and loop inputs.\n' +
59
+ 'Example:\n' +
60
+ (0, bounded_json_js_1.toBoundedJsonString)({ context: { '<requiredKey>': '<value>' } }, 256),
61
+ },
44
62
  };
45
63
  case 'ConditionEvalFailed':
46
64
  return {
65
+ type: 'error',
47
66
  code: 'INTERNAL_ERROR',
48
67
  message: err.message,
49
- suggestion: 'Validate workflow JSON and condition expressions with workflow_validate_json',
68
+ retry: { kind: 'not_retryable' },
69
+ details: { suggestion: 'Validate workflow JSON and condition expressions with workflow_validate_json' },
50
70
  };
51
71
  case 'MaxIterationsExceeded':
52
72
  return {
73
+ type: 'error',
53
74
  code: 'PRECONDITION_FAILED',
54
75
  message: err.message,
55
- suggestion: `Increase maxIterations for loop '${err.loopId}' or adjust its condition/body`,
76
+ retry: { kind: 'not_retryable' },
77
+ details: { suggestion: `Increase maxIterations for loop '${err.loopId}' or adjust its condition/body` },
56
78
  };
57
79
  default:
58
80
  return assertNever(err);
@@ -60,7 +82,7 @@ function mapDomainErrorToToolError(err) {
60
82
  }
61
83
  function mapUnknownErrorToToolError(err) {
62
84
  if (err instanceof Error) {
63
- return { code: 'INTERNAL_ERROR', message: err.message };
85
+ return { type: 'error', code: 'INTERNAL_ERROR', message: err.message, retry: { kind: 'not_retryable' } };
64
86
  }
65
- return { code: 'INTERNAL_ERROR', message: String(err) };
87
+ return { type: 'error', code: 'INTERNAL_ERROR', message: String(err), retry: { kind: 'not_retryable' } };
66
88
  }