@exaudeus/workrail 2.1.0 → 3.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 (61) hide show
  1. package/dist/application/services/compiler/resolve-templates.d.ts +5 -0
  2. package/dist/application/services/compiler/resolve-templates.js +35 -0
  3. package/dist/application/services/compiler/routine-loader.d.ts +11 -0
  4. package/dist/application/services/compiler/routine-loader.js +45 -0
  5. package/dist/application/services/compiler/template-registry.d.ts +4 -2
  6. package/dist/application/services/compiler/template-registry.js +105 -4
  7. package/dist/application/services/workflow-compiler.js +34 -3
  8. package/dist/di/container.js +10 -1
  9. package/dist/di/tokens.d.ts +1 -0
  10. package/dist/di/tokens.js +1 -0
  11. package/dist/engine/engine-factory.d.ts +3 -0
  12. package/dist/engine/engine-factory.js +295 -0
  13. package/dist/engine/index.d.ts +3 -0
  14. package/dist/engine/index.js +12 -0
  15. package/dist/engine/types.d.ts +130 -0
  16. package/dist/engine/types.js +18 -0
  17. package/dist/manifest.json +146 -74
  18. package/dist/mcp/handlers/v2-checkpoint.d.ts +31 -1
  19. package/dist/mcp/handlers/v2-checkpoint.js +76 -64
  20. package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +2 -0
  21. package/dist/mcp/handlers/v2-execution/continue-advance.js +5 -5
  22. package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +2 -0
  23. package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +17 -22
  24. package/dist/mcp/handlers/v2-execution/index.d.ts +10 -17
  25. package/dist/mcp/handlers/v2-execution/index.js +44 -54
  26. package/dist/mcp/handlers/v2-execution/replay.d.ts +4 -15
  27. package/dist/mcp/handlers/v2-execution/replay.js +52 -128
  28. package/dist/mcp/handlers/v2-execution/start.d.ts +3 -2
  29. package/dist/mcp/handlers/v2-execution/start.js +18 -46
  30. package/dist/mcp/handlers/v2-token-ops.d.ts +45 -24
  31. package/dist/mcp/handlers/v2-token-ops.js +372 -32
  32. package/dist/mcp/output-schemas.d.ts +104 -283
  33. package/dist/mcp/output-schemas.js +24 -22
  34. package/dist/mcp/server.js +8 -0
  35. package/dist/mcp/types.d.ts +4 -0
  36. package/dist/mcp/v2/tools.d.ts +22 -52
  37. package/dist/mcp/v2/tools.js +18 -32
  38. package/dist/mcp/v2-response-formatter.js +12 -16
  39. package/dist/runtime/runtime-mode.d.ts +2 -0
  40. package/dist/v2/durable-core/domain/prompt-renderer.d.ts +1 -0
  41. package/dist/v2/durable-core/domain/prompt-renderer.js +5 -3
  42. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +14 -14
  43. package/dist/v2/durable-core/schemas/session/events.d.ts +4 -4
  44. package/dist/v2/durable-core/schemas/session/validation-event.d.ts +2 -2
  45. package/dist/v2/durable-core/tokens/payloads.d.ts +32 -32
  46. package/dist/v2/durable-core/tokens/short-token.d.ts +38 -0
  47. package/dist/v2/durable-core/tokens/short-token.js +126 -0
  48. package/dist/v2/durable-core/tokens/token-patterns.d.ts +4 -0
  49. package/dist/v2/durable-core/tokens/token-patterns.js +9 -0
  50. package/dist/v2/infra/in-memory/token-alias-store/index.d.ts +11 -0
  51. package/dist/v2/infra/in-memory/token-alias-store/index.js +38 -0
  52. package/dist/v2/infra/local/data-dir/index.d.ts +1 -0
  53. package/dist/v2/infra/local/data-dir/index.js +3 -0
  54. package/dist/v2/infra/local/token-alias-store/index.d.ts +16 -0
  55. package/dist/v2/infra/local/token-alias-store/index.js +117 -0
  56. package/dist/v2/ports/data-dir.port.d.ts +1 -0
  57. package/dist/v2/ports/token-alias-store.port.d.ts +33 -0
  58. package/dist/v2/ports/token-alias-store.port.js +2 -0
  59. package/package.json +8 -1
  60. package/workflows/coding-task-workflow-agentic.lean.v2.json +41 -3
  61. package/workflows/examples/routine-injection-example.json +28 -0
@@ -42,20 +42,28 @@
42
42
  "bytes": 4214
43
43
  },
44
44
  "application/services/compiler/resolve-templates.d.ts": {
45
- "sha256": "623e4b9e7b65c1cbe8a6acee232ba3fa7b11c9394f22a77c7443a02681b0a0a8",
46
- "bytes": 767
45
+ "sha256": "ccb4fbbf00f3ccbfcb9225998bcb9bfbd30a7e64dcfc2b2bc0f06701ee9a8e33",
46
+ "bytes": 905
47
47
  },
48
48
  "application/services/compiler/resolve-templates.js": {
49
- "sha256": "2d7bef8627cd933fa265d9faf9b0d6ced860bd66b39793af7ffa97956ba38a09",
50
- "bytes": 1997
49
+ "sha256": "96f152a9f8b16aa7779b17ac56b555e45ad1213b32607961f060a080c6610a1a",
50
+ "bytes": 3590
51
+ },
52
+ "application/services/compiler/routine-loader.d.ts": {
53
+ "sha256": "831ed318f498c20ef9d547f38aea22a3fa2c677cd923634129545e7bf69ad241",
54
+ "bytes": 481
55
+ },
56
+ "application/services/compiler/routine-loader.js": {
57
+ "sha256": "fa5db5a759d88e63ef65bc877311d41003813d742fbdda7d06bc8abf56007988",
58
+ "bytes": 1849
51
59
  },
52
60
  "application/services/compiler/template-registry.d.ts": {
53
- "sha256": "16221e2671a95456abfd875fc7caceb40058f351a5a371e13acf53def2f77b24",
54
- "bytes": 873
61
+ "sha256": "5c8aef7bd75fce04d56985932eb2ad37e23c8bc87a77c75ee2addf018d3e619d",
62
+ "bytes": 1168
55
63
  },
56
64
  "application/services/compiler/template-registry.js": {
57
- "sha256": "79ea2925e1d4a003a0b07a5f4c99cdc5fb8aa73e0b2be4e239435bf7bf1ffb13",
58
- "bytes": 972
65
+ "sha256": "92f824723e8d137533f8c752f2f753bb2a88e5812631de0a6428e3c6ff44543a",
66
+ "bytes": 5283
59
67
  },
60
68
  "application/services/enhanced-error-service.d.ts": {
61
69
  "sha256": "b6fe8fad92717f0962f87aa9c0f88277bf28fe2b5e3cfd7875612ee57eb8c684",
@@ -102,8 +110,8 @@
102
110
  "bytes": 1211
103
111
  },
104
112
  "application/services/workflow-compiler.js": {
105
- "sha256": "db74bfe006cf703cc0c32165e09e2c684e24fcf7b538ecbc1273daf67012dc2d",
106
- "bytes": 8182
113
+ "sha256": "1adfbce7e79f827b1be530128dd9f4fc65bf427c851d7669fd11f20d4639631f",
114
+ "bytes": 9578
107
115
  },
108
116
  "application/services/workflow-interpreter.d.ts": {
109
117
  "sha256": "56b5b5ad06d42096deba9f0abe7642c18a355a1e598749aab1730df4e9847674",
@@ -342,16 +350,16 @@
342
350
  "bytes": 565
343
351
  },
344
352
  "di/container.js": {
345
- "sha256": "d1fbf1f04bb8cb0e4da2161ef2b773e1fdd3d7e8fe09d0672610dc8f28e8901b",
346
- "bytes": 19468
353
+ "sha256": "6ba1b310aee67ac495a873d8102a5f3453592128f41735fd540022eb1032370a",
354
+ "bytes": 20016
347
355
  },
348
356
  "di/tokens.d.ts": {
349
- "sha256": "ce5a748976acc30088847dde3126e2f3f45020e8ef15e897938a76752cbb47b4",
350
- "bytes": 1949
357
+ "sha256": "15cb26fb2370ad60ff6fc39d1ccd7df133d0cd4088f7a2deceb30d4c00ca8aae",
358
+ "bytes": 1991
351
359
  },
352
360
  "di/tokens.js": {
353
- "sha256": "436804cf8904c4984e459d797e3edae02dee6d0b46e989590397bd226b4d759b",
354
- "bytes": 2403
361
+ "sha256": "d41c9cd45ab4a9aea3e39cad8d6969a4e1e1407c862eb5093ebc01580f99b672",
362
+ "bytes": 2458
355
363
  },
356
364
  "domain/execution/error.d.ts": {
357
365
  "sha256": "2eac85c42ec399a23724f868641eeadd0d196b4d324ee4caaff82a6b46155bd9",
@@ -401,6 +409,30 @@
401
409
  "sha256": "b428afbb24a64555c10086f873a85133c2826350f406ee2b51d970adf18d7cad",
402
410
  "bytes": 2332
403
411
  },
412
+ "engine/engine-factory.d.ts": {
413
+ "sha256": "ae4fad519eaeb5e5278a1e1547999152c6e39dd31a0d1458e5ff65d632fbeff6",
414
+ "bytes": 213
415
+ },
416
+ "engine/engine-factory.js": {
417
+ "sha256": "886dde45d9971372c9772412e9e1b280c80a006a0f898c4a8f75d2316364c3c7",
418
+ "bytes": 13488
419
+ },
420
+ "engine/index.d.ts": {
421
+ "sha256": "91e12882c565e96a9809fdf43a0dc0a77fdffdfd562aaf43d2e86e6590ed0b16",
422
+ "bytes": 512
423
+ },
424
+ "engine/index.js": {
425
+ "sha256": "764155f282d26439cb6db570792ecec81a3b8fbace7eb02550f4ddc057159084",
426
+ "bytes": 1230
427
+ },
428
+ "engine/types.d.ts": {
429
+ "sha256": "29a9f6ae4a05674ed454956b560021f5a408dfac9a65b417ec33520b6b0d1e0a",
430
+ "bytes": 4778
431
+ },
432
+ "engine/types.js": {
433
+ "sha256": "94eb9981e7b846a07fc53a29e7a8d8969a1a2d418dccb735d611eaadea1fa3c7",
434
+ "bytes": 571
435
+ },
404
436
  "errors/app-error.d.ts": {
405
437
  "sha256": "9be8c6cdfdc3313242ac6ccc08903dee76ff1cc9914cb10897dc410ffb9edd55",
406
438
  "bytes": 766
@@ -698,12 +730,12 @@
698
730
  "bytes": 5187
699
731
  },
700
732
  "mcp/handlers/v2-checkpoint.d.ts": {
701
- "sha256": "97e1d3ddcb5f92137312c6516b6c4ff2f18dec7a7a83657db30198aedd67e7e1",
702
- "bytes": 259
733
+ "sha256": "6e09be1bf0b7277c997553d24e97bd332a83734062346a0f67211f6836391118",
734
+ "bytes": 1475
703
735
  },
704
736
  "mcp/handlers/v2-checkpoint.js": {
705
- "sha256": "48c20ca225f9595f845c2692083d581a3e1ebdb3f423b210ef8b37c69e727954",
706
- "bytes": 9558
737
+ "sha256": "70542251d386ba3b59aed224f41abea319b54bd975056f2dbf8b0f333358ea75",
738
+ "bytes": 10893
707
739
  },
708
740
  "mcp/handlers/v2-context-budget.d.ts": {
709
741
  "sha256": "cbad1741a183d52c9cbe558be2e09f776843d1f3ec8cd28d6d0d230668e4298c",
@@ -746,44 +778,44 @@
746
778
  "bytes": 2981
747
779
  },
748
780
  "mcp/handlers/v2-execution/continue-advance.d.ts": {
749
- "sha256": "93c700c8760eb0ef8aec6c9d5cf1348d8c4b4d4ff2c876c1c67b551996f0a613",
750
- "bytes": 1830
781
+ "sha256": "27d1f41f608611ba2faa0daf400ef8601c163af5558667c175865e565e95183a",
782
+ "bytes": 2026
751
783
  },
752
784
  "mcp/handlers/v2-execution/continue-advance.js": {
753
- "sha256": "864b892e6e69afbe300dbc748d0b6f3476d299b5cbaea36b5197748f9972611b",
754
- "bytes": 8332
785
+ "sha256": "1591d4c6f31022d1ecafec841239baaa78642052fbca7a28d6b9827b654085a4",
786
+ "bytes": 8263
755
787
  },
756
788
  "mcp/handlers/v2-execution/continue-rehydrate.d.ts": {
757
- "sha256": "af7475b7effe57f18fa8379bfd128d17afb2d27fe1c058c6f2ee8f5b2632e3d0",
758
- "bytes": 1312
789
+ "sha256": "5e5fe5bdc3b8427c6661756d666494298aeb63ba0d69dee64a0294cbdd5fab6a",
790
+ "bytes": 1508
759
791
  },
760
792
  "mcp/handlers/v2-execution/continue-rehydrate.js": {
761
- "sha256": "b77850715f6d4300a5b9b7b86063a02eed0e63410bdf6b1572bdae3d40b8a32f",
762
- "bytes": 8585
793
+ "sha256": "4758cacc11ecf346aadea6070cd38c44380941029fe654890148e3b01c4bb94f",
794
+ "bytes": 8190
763
795
  },
764
796
  "mcp/handlers/v2-execution/index.d.ts": {
765
- "sha256": "481d74c4ab444964ac9c71e0348da91abd642352a6fc1c69cff70e300d76881e",
766
- "bytes": 1185
797
+ "sha256": "e60e1e0c65e51d101fb06248e882494e6df52762e1d68f5de7081c1cf1ec8bc5",
798
+ "bytes": 1226
767
799
  },
768
800
  "mcp/handlers/v2-execution/index.js": {
769
- "sha256": "bc131f6e61d85dd46cf500dab4b6a5865180186f2361205d108e57d05e29ebfe",
770
- "bytes": 4716
801
+ "sha256": "3f35cb1abc2f6b65bef43fc3f59f48e8b558a369cb714c698b9b5b3ad4c1bdae",
802
+ "bytes": 4182
771
803
  },
772
804
  "mcp/handlers/v2-execution/replay.d.ts": {
773
- "sha256": "88368784d730be895f024d370d33d1fbb96293147c3edaf65e2a29297556a586",
774
- "bytes": 2885
805
+ "sha256": "bbf97633d7e47af3574a9690a1976bb474ca49cecc08af1d5c07e90f9868036d",
806
+ "bytes": 2570
775
807
  },
776
808
  "mcp/handlers/v2-execution/replay.js": {
777
- "sha256": "d6093949107dd69571e90264617fb6159b6b8bfca7d065d3533796732e01bdb2",
778
- "bytes": 12661
809
+ "sha256": "d6b5c83d5fffc88de425c64aa6571e7a469af4ee87e0088471c1ef05ff471b5e",
810
+ "bytes": 8654
779
811
  },
780
812
  "mcp/handlers/v2-execution/start.d.ts": {
781
- "sha256": "15d5e5f4a4613df286279075640e43a130179f39b9157b50d4d9e4123bcae6b3",
782
- "bytes": 2868
813
+ "sha256": "6847beabf35eb4c8780a649c99f4f60047c34e7ce7d8295c528d72f0f7d35f2d",
814
+ "bytes": 3036
783
815
  },
784
816
  "mcp/handlers/v2-execution/start.js": {
785
- "sha256": "cb40e5ec1d1461f41ce88722110af9f11396ab1d828d6eccb0b1b29a9ca68b65",
786
- "bytes": 16769
817
+ "sha256": "5a7a811a40f70f82feb7c158dfb1dc613c138c746f37ae3bd257c010a89041e0",
818
+ "bytes": 15842
787
819
  },
788
820
  "mcp/handlers/v2-resume.d.ts": {
789
821
  "sha256": "d88f6c35bcaf946666c837b72fda3702a2ebab5e478eb90f7b4b672a0e5fa24f",
@@ -802,12 +834,12 @@
802
834
  "bytes": 4335
803
835
  },
804
836
  "mcp/handlers/v2-token-ops.d.ts": {
805
- "sha256": "0403343468cd3835fb440b457e61050f13761ea60b23e3440ad0360b4ea07982",
806
- "bytes": 1948
837
+ "sha256": "bfbc6ab9ed413838cab8ee76fcf24cb7200bb1d257c08205b0eb5a8e48657b27",
838
+ "bytes": 3797
807
839
  },
808
840
  "mcp/handlers/v2-token-ops.js": {
809
- "sha256": "c786c2a8de7240989b2368762552373a2c3d397edd47122144c51e31a22d6203",
810
- "bytes": 3817
841
+ "sha256": "eaf40746f0696a0eb79f83e1f198401f9e23ee8fd4cd026d3a90d1010fe2b9ba",
842
+ "bytes": 22297
811
843
  },
812
844
  "mcp/handlers/v2-workflow.d.ts": {
813
845
  "sha256": "5c9590f121dd3708c516be3febe41d0be47531d643462b86b99b778ef0b54498",
@@ -842,20 +874,20 @@
842
874
  "bytes": 7535
843
875
  },
844
876
  "mcp/output-schemas.d.ts": {
845
- "sha256": "2affdeec60f5554506b034dd8d8d951b60a96c9237060c28bae4e877b75c7ba0",
846
- "bytes": 51242
877
+ "sha256": "32a181b901b0779d416f30013d8e29e189a310e5f21ce7709fb056c0f3d3878d",
878
+ "bytes": 46423
847
879
  },
848
880
  "mcp/output-schemas.js": {
849
- "sha256": "fd43722d021afb0c64cfe4356fc7ba9e41e6e3e9f9506866e0be0159d1b6908b",
850
- "bytes": 12115
881
+ "sha256": "ff6c519ea3e5fbeea32e98f1fae30aa390f0ecc68902458d68ee142400b67ded",
882
+ "bytes": 11763
851
883
  },
852
884
  "mcp/server.d.ts": {
853
885
  "sha256": "782a9a50797cac9c5f30e79556f809351d7eb176a16d7c603c09a5133cc25303",
854
886
  "bytes": 882
855
887
  },
856
888
  "mcp/server.js": {
857
- "sha256": "c07f8a6e8f89f7620a063673859dcc458212b068237949acff253f15856afd5f",
858
- "bytes": 14174
889
+ "sha256": "3d736e6173b069162a8034b667717f72770203efac4b1329202fcdfe4f6b78e7",
890
+ "bytes": 14668
859
891
  },
860
892
  "mcp/tool-description-provider.d.ts": {
861
893
  "sha256": "1d46abc3112e11b68e57197e846f5708293ec9b2281fa71a9124ee2aad71e41b",
@@ -922,8 +954,8 @@
922
954
  "bytes": 747
923
955
  },
924
956
  "mcp/types.d.ts": {
925
- "sha256": "d61a7d2b9a5f389d9fbf0092f6d38c3e6bb2925f41dce0270ed0c2e54ca856c9",
926
- "bytes": 4533
957
+ "sha256": "4c53a0e1e9e34e1bc8be2f04730316f4f0623905b3d5c6dc72170b76ca51a0fa",
958
+ "bytes": 4792
927
959
  },
928
960
  "mcp/types.js": {
929
961
  "sha256": "d10c4070e4c3454d80f0fa9cdc0e978c69c53c13fd09baa8710fcd802fed8926",
@@ -958,8 +990,8 @@
958
990
  "bytes": 81
959
991
  },
960
992
  "mcp/v2-response-formatter.js": {
961
- "sha256": "a2e0b576e49bdf66272dcd56ce91f451456afc236e8957af5e574bb458b30727",
962
- "bytes": 6949
993
+ "sha256": "73ecb53715bbf47a701d33b375450a0e0c35e54cf48363caab36f8257d502caa",
994
+ "bytes": 6884
963
995
  },
964
996
  "mcp/v2/tool-registry.d.ts": {
965
997
  "sha256": "d4d4927728c3cab1c014661d499dd0119538371bc6c5e821a4cd31df7abebedf",
@@ -970,12 +1002,12 @@
970
1002
  "bytes": 3119
971
1003
  },
972
1004
  "mcp/v2/tools.d.ts": {
973
- "sha256": "9915bd42c9ab096875021a24c0c97ad112331595e5d734abdd2856f9f49f80e4",
974
- "bytes": 6884
1005
+ "sha256": "c37af21e8580767b050b0ee3193edbe0372f6062486f0ebc3d013f0ef1c87a86",
1006
+ "bytes": 6174
975
1007
  },
976
1008
  "mcp/v2/tools.js": {
977
- "sha256": "e3755649cb0fbf6332a7f330dec558bf998489533c95d7684c4668a4c566896e",
978
- "bytes": 8360
1009
+ "sha256": "e17001ab98c09796f57de4983d634b6441e7e6879e8c5a9f546a8c36295b197f",
1010
+ "bytes": 7274
979
1011
  },
980
1012
  "mcp/validation/bounded-json.d.ts": {
981
1013
  "sha256": "82203ac6123d5c6989606c3b5405aaea99ab829c8958835f9ae3ba45b8bc8fd5",
@@ -1162,8 +1194,8 @@
1162
1194
  "bytes": 931
1163
1195
  },
1164
1196
  "runtime/runtime-mode.d.ts": {
1165
- "sha256": "3b5c86c747a0313ff55b3b4688ce1060a9ec98b43b65f196af6bf4eb7e45ac14",
1166
- "bytes": 125
1197
+ "sha256": "1e16c5848884f11889cebc863251a1024cde6afb5bafb15503a091151e0550f2",
1198
+ "bytes": 152
1167
1199
  },
1168
1200
  "runtime/runtime-mode.js": {
1169
1201
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
@@ -1434,12 +1466,12 @@
1434
1466
  "bytes": 942
1435
1467
  },
1436
1468
  "v2/durable-core/domain/prompt-renderer.d.ts": {
1437
- "sha256": "dd9854d489a03ac57975dd1ecee6e73a4bcc8b78e61c5cd5b394307aab708a7b",
1438
- "bytes": 935
1469
+ "sha256": "6bbafe042ad3e6be2043f8d79ffbf4b3e800dbc862427b41e02e7986357a9df5",
1470
+ "bytes": 968
1439
1471
  },
1440
1472
  "v2/durable-core/domain/prompt-renderer.js": {
1441
- "sha256": "5021f3cc9e59db56c5aeddcc8ed6f69df7ea1b1f3011d685695021e039376e49",
1442
- "bytes": 13910
1473
+ "sha256": "43a0bce6e074755b5385723f956ce670736d216e8ab47fcbc02bfa3d162dbc3f",
1474
+ "bytes": 14004
1443
1475
  },
1444
1476
  "v2/durable-core/domain/reason-model.d.ts": {
1445
1477
  "sha256": "650fcb2d9969a4e6123cccbd4913f4d57aeab21a19bb907aa1e11f95e5a95089",
@@ -1674,7 +1706,7 @@
1674
1706
  "bytes": 2983
1675
1707
  },
1676
1708
  "v2/durable-core/schemas/export-bundle/index.d.ts": {
1677
- "sha256": "3f9c52313003c77762c13e144e8084b07d6b235d4f2867c43808e141bf269f0f",
1709
+ "sha256": "3106396993ba9d99bdb557b3b273b74a4c5efaa5c2084b2b56d5ca1824532e3f",
1678
1710
  "bytes": 479882
1679
1711
  },
1680
1712
  "v2/durable-core/schemas/export-bundle/index.js": {
@@ -1730,7 +1762,7 @@
1730
1762
  "bytes": 2138
1731
1763
  },
1732
1764
  "v2/durable-core/schemas/session/events.d.ts": {
1733
- "sha256": "9bb0857364918ef47dd379eef819b20c3d060536cf2c62aa4bf21caebabc2a25",
1765
+ "sha256": "c6cecb6de60953fc0b2c2612d501700dae5103270c8d1d8e806716e4ba1c0ecc",
1734
1766
  "bytes": 73576
1735
1767
  },
1736
1768
  "v2/durable-core/schemas/session/events.js": {
@@ -1786,7 +1818,7 @@
1786
1818
  "bytes": 77
1787
1819
  },
1788
1820
  "v2/durable-core/schemas/session/validation-event.d.ts": {
1789
- "sha256": "1321e99a03480126ce25276b3c9de56e2be3604876bca4644309469ae468a57f",
1821
+ "sha256": "a1fc1ffba0962f93b430aed289744eebac6cf970d94c6f2c55cc7dad3cfef37e",
1790
1822
  "bytes": 2206
1791
1823
  },
1792
1824
  "v2/durable-core/schemas/session/validation-event.js": {
@@ -1810,13 +1842,21 @@
1810
1842
  "bytes": 4205
1811
1843
  },
1812
1844
  "v2/durable-core/tokens/payloads.d.ts": {
1813
- "sha256": "bcde54eeb05560aa6095d890837fdb3453a14712fb6061e71e7110909a09084d",
1845
+ "sha256": "f0428631b6addaa4c842a1abb4d9e4b1f26cb647b6f42a99060114ccb64eab28",
1814
1846
  "bytes": 6921
1815
1847
  },
1816
1848
  "v2/durable-core/tokens/payloads.js": {
1817
1849
  "sha256": "151393f91330c05482344d4c73ee2b50377a5424bc461c2c07d4b59d8cf3f1e4",
1818
1850
  "bytes": 2431
1819
1851
  },
1852
+ "v2/durable-core/tokens/short-token.d.ts": {
1853
+ "sha256": "f1184bd4c85ff8e202a31a75654aa73f0055111bc05cd4147eee6dbbbf298494",
1854
+ "bytes": 1783
1855
+ },
1856
+ "v2/durable-core/tokens/short-token.js": {
1857
+ "sha256": "4534d9626acb94772377907cbcbabfda2af90a82bb218b201c1eb50d072e16de",
1858
+ "bytes": 4909
1859
+ },
1820
1860
  "v2/durable-core/tokens/token-codec-capabilities.d.ts": {
1821
1861
  "sha256": "b86e47b85a2da29565c40870aefb4d207555e3c46f9ce6f195229969bead0ecf",
1822
1862
  "bytes": 272
@@ -1841,6 +1881,14 @@
1841
1881
  "sha256": "76cfd18c7cde51e4f4ae2360c483b8b79cd1bc4af37b7ff58c4cace7a381d12f",
1842
1882
  "bytes": 4302
1843
1883
  },
1884
+ "v2/durable-core/tokens/token-patterns.d.ts": {
1885
+ "sha256": "b9d4e6f852a95e8552a9ae4bdc4303cb1aa1987a0da531cb9c501b5615731573",
1886
+ "bytes": 206
1887
+ },
1888
+ "v2/durable-core/tokens/token-patterns.js": {
1889
+ "sha256": "4d3d152bc7cbf74411323c4e05dc14813897c9c5be56a72867d8909c53b178a5",
1890
+ "bytes": 648
1891
+ },
1844
1892
  "v2/durable-core/tokens/token-signer.d.ts": {
1845
1893
  "sha256": "30b3da7d6463b8ec10ff91155fe33dd77ce8789df1159a287f0e46fdc42e1407",
1846
1894
  "bytes": 1051
@@ -1849,6 +1897,14 @@
1849
1897
  "sha256": "15a8f8b7dac5ab4449f389c75ce7c13a163f639ade481c3890a7f527d23f500d",
1850
1898
  "bytes": 3441
1851
1899
  },
1900
+ "v2/infra/in-memory/token-alias-store/index.d.ts": {
1901
+ "sha256": "8a1fcaa5fe230987df979a6653e88851c23e8376bb62e3dc306ec477cde207a7",
1902
+ "bytes": 786
1903
+ },
1904
+ "v2/infra/in-memory/token-alias-store/index.js": {
1905
+ "sha256": "771f19e9c28819a0d7c8035c4d624c17c607bfa257c72cfeefacf16d12af355a",
1906
+ "bytes": 1479
1907
+ },
1852
1908
  "v2/infra/local/base32/index.d.ts": {
1853
1909
  "sha256": "054ad32b03c22e9c797196024f2c2a43111f682ee4ab15f82ef3b9313c392723",
1854
1910
  "bytes": 300
@@ -1882,12 +1938,12 @@
1882
1938
  "bytes": 457
1883
1939
  },
1884
1940
  "v2/infra/local/data-dir/index.d.ts": {
1885
- "sha256": "71333d489f957d106c1cd81e477793f807cc8a58d6ccc240e2539448a880a856",
1886
- "bytes": 817
1941
+ "sha256": "fa6e659499c6c742be9f4182c0d705770d2086696956b02d5415b2c5a8c7a44f",
1942
+ "bytes": 847
1887
1943
  },
1888
1944
  "v2/infra/local/data-dir/index.js": {
1889
- "sha256": "a01efc77fc442dfb326c970cb31241886d832b3330255ee0360b28e5d632a78c",
1890
- "bytes": 3036
1945
+ "sha256": "29dd90a80d199cf16e79169efbc1c06a37ea63254416917cbac8f5e0a81c7f8c",
1946
+ "bytes": 3128
1891
1947
  },
1892
1948
  "v2/infra/local/directory-listing/index.d.ts": {
1893
1949
  "sha256": "3139014cb738db3b0f10beca01a3a4a35b9ab8e72c8889b3bbff204fdbcb6b6c",
@@ -1993,6 +2049,14 @@
1993
2049
  "sha256": "459fd31e84f6003ff11872000493850d5e2e450f711526c72b344b310b413b38",
1994
2050
  "bytes": 276
1995
2051
  },
2052
+ "v2/infra/local/token-alias-store/index.d.ts": {
2053
+ "sha256": "d2b8bb38ba2238170395932bafd9fb8af9adf136912e83678e9ff0d7c5858c83",
2054
+ "bytes": 1038
2055
+ },
2056
+ "v2/infra/local/token-alias-store/index.js": {
2057
+ "sha256": "2b363ed209265ab328045239a6866b577213460214778b036a6a049158d4802d",
2058
+ "bytes": 4717
2059
+ },
1996
2060
  "v2/infra/local/utf8/index.d.ts": {
1997
2061
  "sha256": "33bfc597ed162a3711e3130d48f9dabf03580861f70fc57b1da4ccb2ec723d46",
1998
2062
  "bytes": 181
@@ -2034,8 +2098,8 @@
2034
2098
  "bytes": 77
2035
2099
  },
2036
2100
  "v2/ports/data-dir.port.d.ts": {
2037
- "sha256": "bfaca40462a3334b9e8fe7e7f7136d36e85e35405cc017a403e9670a28bbe3c8",
2038
- "bytes": 580
2101
+ "sha256": "f3b73eb92fa52a657ef54eb9e3c62bdd2a6c265771fc2e23d6526f2ef558cf9c",
2102
+ "bytes": 610
2039
2103
  },
2040
2104
  "v2/ports/data-dir.port.js": {
2041
2105
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
@@ -2137,6 +2201,14 @@
2137
2201
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
2138
2202
  "bytes": 77
2139
2203
  },
2204
+ "v2/ports/token-alias-store.port.d.ts": {
2205
+ "sha256": "42f10d6fc8641c96679d7448ec073a65418f4ea32ee32cc3981000759ba205fb",
2206
+ "bytes": 1233
2207
+ },
2208
+ "v2/ports/token-alias-store.port.js": {
2209
+ "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
2210
+ "bytes": 77
2211
+ },
2140
2212
  "v2/ports/utf8.port.d.ts": {
2141
2213
  "sha256": "4c23ce010468e950c83f9111f54d143cce03a0aab36878a42ae4d06b8c58067d",
2142
2214
  "bytes": 71
@@ -1,3 +1,33 @@
1
- import type { ToolContext, ToolResult } from '../types.js';
1
+ import type { z } from 'zod';
2
+ import type { ResultAsync as RA } from 'neverthrow';
3
+ import type { ToolContext, ToolResult, V2ToolContext } from '../types.js';
2
4
  import type { V2CheckpointWorkflowInput } from '../v2/tools.js';
5
+ import { V2CheckpointWorkflowOutputSchema } from '../output-schemas.js';
6
+ import { type ToolFailure } from './v2-execution-helpers.js';
7
+ import type { ExecutionSessionGateErrorV2 } from '../../v2/usecases/execution-session-gate.js';
8
+ import type { SessionEventLogStoreError } from '../../v2/ports/session-event-log-store.port.js';
9
+ type CheckpointOutput = z.infer<typeof V2CheckpointWorkflowOutputSchema>;
10
+ export type CheckpointError = {
11
+ readonly kind: 'precondition_failed';
12
+ readonly message: string;
13
+ } | {
14
+ readonly kind: 'token_signing_failed';
15
+ readonly cause: unknown;
16
+ } | {
17
+ readonly kind: 'validation_failed';
18
+ readonly failure: ToolFailure;
19
+ } | {
20
+ readonly kind: 'missing_node_or_run';
21
+ } | {
22
+ readonly kind: 'event_schema_invalid';
23
+ readonly issues: string;
24
+ } | {
25
+ readonly kind: 'gate_failed';
26
+ readonly cause: ExecutionSessionGateErrorV2;
27
+ } | {
28
+ readonly kind: 'store_failed';
29
+ readonly cause: SessionEventLogStoreError;
30
+ };
3
31
  export declare function handleV2CheckpointWorkflow(input: V2CheckpointWorkflowInput, ctx: ToolContext): Promise<ToolResult<unknown>>;
32
+ export declare function executeCheckpoint(input: V2CheckpointWorkflowInput, ctx: V2ToolContext): RA<CheckpointOutput, CheckpointError>;
33
+ export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleV2CheckpointWorkflow = handleV2CheckpointWorkflow;
4
+ exports.executeCheckpoint = executeCheckpoint;
4
5
  const neverthrow_1 = require("neverthrow");
5
6
  const types_js_1 = require("../types.js");
6
7
  const output_schemas_js_1 = require("../output-schemas.js");
@@ -13,19 +14,23 @@ const constants_js_1 = require("../../v2/durable-core/constants.js");
13
14
  function findNodeCreated(events, nodeId) {
14
15
  return events.find((e) => e.kind === constants_js_1.EVENT_KIND.NODE_CREATED && e.scope?.nodeId === String(nodeId));
15
16
  }
16
- function mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts) {
17
+ function mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts, aliasStore, entropy) {
17
18
  const wfRefRes = (0, workflow_hash_ref_js_1.deriveWorkflowHashRef)(originalNode.data.workflowHash);
18
19
  if (wfRefRes.isErr()) {
19
- return { ok: false, error: { kind: 'precondition_failed', message: 'Cannot derive workflowHashRef for stateToken.' } };
20
+ return (0, neverthrow_1.errAsync)({ kind: 'precondition_failed', message: 'Cannot derive workflowHashRef for stateToken.' });
20
21
  }
21
- const stateTokenRes = (0, v2_token_ops_js_1.signTokenOrErr)({
22
- payload: { tokenVersion: 1, tokenKind: 'state', sessionId, runId, nodeId, workflowHashRef: wfRefRes.value },
22
+ return (0, v2_token_ops_js_1.mintSingleShortToken)({
23
+ kind: 'state',
24
+ entry: {
25
+ sessionId: String(sessionId),
26
+ runId: String(runId),
27
+ nodeId: String(nodeId),
28
+ workflowHashRef: String(wfRefRes.value),
29
+ },
23
30
  ports: tokenCodecPorts,
24
- });
25
- if (stateTokenRes.isErr()) {
26
- return { ok: false, error: { kind: 'token_signing_failed', cause: stateTokenRes.error } };
27
- }
28
- return { ok: true, value: stateTokenRes.value };
31
+ aliasStore,
32
+ entropy,
33
+ }).mapErr((failure) => ({ kind: 'token_signing_failed', cause: failure }));
29
34
  }
30
35
  function validateEvents(rawEvents) {
31
36
  const validated = [];
@@ -48,65 +53,68 @@ async function handleV2CheckpointWorkflow(input, ctx) {
48
53
  return executeCheckpoint(input, guard.ctx).match((payload) => (0, types_js_1.success)(payload), (e) => mapCheckpointErrorToToolError(e));
49
54
  }
50
55
  function executeCheckpoint(input, ctx) {
51
- const { gate, sessionStore, tokenCodecPorts, idFactory } = ctx.v2;
52
- const tokenRes = (0, v2_token_ops_js_1.parseCheckpointTokenOrFail)(input.checkpointToken, tokenCodecPorts);
53
- if (!tokenRes.ok) {
54
- return (0, neverthrow_1.errAsync)({ kind: 'validation_failed', failure: tokenRes.failure });
55
- }
56
- const token = tokenRes.token;
57
- const sessionId = (0, index_js_1.asSessionId)(String(token.payload.sessionId));
58
- const runId = (0, index_js_1.asRunId)(String(token.payload.runId));
59
- const nodeId = (0, index_js_1.asNodeId)(String(token.payload.nodeId));
60
- const attemptId = (0, index_js_1.asAttemptId)(String(token.payload.attemptId));
61
- const dedupeKey = `checkpoint:${String(sessionId)}:${String(runId)}:${String(nodeId)}:${String(attemptId)}`;
62
- return sessionStore.load(sessionId)
63
- .mapErr((cause) => ({ kind: 'store_failed', cause }))
64
- .andThen((truth) => {
65
- const originalNode = findNodeCreated(truth.events, nodeId);
66
- if (!originalNode) {
67
- return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
68
- }
69
- const alreadyRecorded = truth.events.some((e) => e.dedupeKey === dedupeKey);
70
- if (alreadyRecorded) {
71
- return replayCheckpoint(truth.events, dedupeKey, originalNode, sessionId, runId, nodeId, tokenCodecPorts);
72
- }
73
- return gate.withHealthySessionLock(sessionId, (lock) => {
74
- return sessionStore.load(sessionId)
75
- .mapErr((cause) => ({ kind: 'store_failed', cause }))
76
- .andThen((truthLocked) => {
77
- const originalNodeLocked = findNodeCreated(truthLocked.events, nodeId);
78
- if (!originalNodeLocked) {
79
- return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
80
- }
81
- const alreadyRecordedLocked = truthLocked.events.some((e) => e.dedupeKey === dedupeKey);
82
- if (alreadyRecordedLocked) {
83
- return replayCheckpoint(truthLocked.events, dedupeKey, originalNodeLocked, sessionId, runId, nodeId, tokenCodecPorts);
56
+ const { gate, sessionStore, tokenCodecPorts, idFactory, tokenAliasStore, entropy } = ctx.v2;
57
+ return (0, v2_token_ops_js_1.parseCheckpointTokenOrFail)(input.checkpointToken, tokenCodecPorts, tokenAliasStore)
58
+ .mapErr((failure) => ({ kind: 'validation_failed', failure }))
59
+ .andThen((token) => {
60
+ const sessionId = (0, index_js_1.asSessionId)(String(token.payload.sessionId));
61
+ const runId = (0, index_js_1.asRunId)(String(token.payload.runId));
62
+ const nodeId = (0, index_js_1.asNodeId)(String(token.payload.nodeId));
63
+ const attemptId = (0, index_js_1.asAttemptId)(String(token.payload.attemptId));
64
+ const dedupeKey = `checkpoint:${String(sessionId)}:${String(runId)}:${String(nodeId)}:${String(attemptId)}`;
65
+ return sessionStore.load(sessionId)
66
+ .mapErr((cause) => ({ kind: 'store_failed', cause }))
67
+ .andThen((truth) => {
68
+ const originalNode = findNodeCreated(truth.events, nodeId);
69
+ if (!originalNode) {
70
+ return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
71
+ }
72
+ const alreadyRecorded = truth.events.some((e) => e.dedupeKey === dedupeKey);
73
+ if (alreadyRecorded) {
74
+ return replayCheckpoint(truth.events, dedupeKey, originalNode, sessionId, runId, nodeId, attemptId, tokenCodecPorts, tokenAliasStore, entropy);
75
+ }
76
+ return gate.withHealthySessionLock(sessionId, (lock) => {
77
+ return sessionStore.load(sessionId)
78
+ .mapErr((cause) => ({ kind: 'store_failed', cause }))
79
+ .andThen((truthLocked) => {
80
+ const originalNodeLocked = findNodeCreated(truthLocked.events, nodeId);
81
+ if (!originalNodeLocked) {
82
+ return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
83
+ }
84
+ const alreadyRecordedLocked = truthLocked.events.some((e) => e.dedupeKey === dedupeKey);
85
+ if (alreadyRecordedLocked) {
86
+ return replayCheckpoint(truthLocked.events, dedupeKey, originalNodeLocked, sessionId, runId, nodeId, attemptId, tokenCodecPorts, tokenAliasStore, entropy);
87
+ }
88
+ return writeCheckpoint(truthLocked, dedupeKey, originalNodeLocked, sessionId, runId, nodeId, attemptId, idFactory.mintNodeId(), () => idFactory.mintEventId(), lock, sessionStore, tokenCodecPorts, tokenAliasStore, entropy);
89
+ });
90
+ }).mapErr((gateErr) => {
91
+ if (isGateError(gateErr)) {
92
+ return { kind: 'gate_failed', cause: gateErr };
84
93
  }
85
- return writeCheckpoint(truthLocked, dedupeKey, originalNodeLocked, sessionId, runId, nodeId, idFactory.mintNodeId(), () => idFactory.mintEventId(), lock, sessionStore, tokenCodecPorts);
94
+ return gateErr;
86
95
  });
87
- }).mapErr((gateErr) => {
88
- if (isGateError(gateErr)) {
89
- return { kind: 'gate_failed', cause: gateErr };
90
- }
91
- return gateErr;
92
96
  });
93
97
  });
94
98
  }
95
- function replayCheckpoint(events, dedupeKey, originalNode, sessionId, runId, nodeId, tokenCodecPorts) {
99
+ function replayCheckpoint(events, dedupeKey, originalNode, sessionId, runId, nodeId, attemptId, tokenCodecPorts, aliasStore, entropy) {
96
100
  const existingCheckpointNode = events.find((e) => e.kind === constants_js_1.EVENT_KIND.NODE_CREATED && e.dedupeKey === `checkpoint_node:${dedupeKey}`);
97
101
  const checkpointNodeId = existingCheckpointNode
98
102
  ? String(existingCheckpointNode.scope?.nodeId ?? 'unknown')
99
103
  : 'unknown';
100
- const tokenResult = mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts);
101
- if (!tokenResult.ok)
102
- return (0, neverthrow_1.errAsync)(tokenResult.error);
103
- return (0, neverthrow_1.okAsync)(output_schemas_js_1.V2CheckpointWorkflowOutputSchema.parse({
104
+ const workflowHashRefRes = (0, workflow_hash_ref_js_1.deriveWorkflowHashRef)(originalNode.data.workflowHash);
105
+ const workflowHashRef = workflowHashRefRes.isOk() ? workflowHashRefRes.value : undefined;
106
+ return mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts, aliasStore, entropy)
107
+ .andThen((stateTokenValue) => (0, v2_token_ops_js_1.mintContinueAndCheckpointTokens)({
108
+ entry: { sessionId: String(sessionId), runId: String(runId), nodeId: String(nodeId), attemptId: String(attemptId), workflowHashRef },
109
+ ports: tokenCodecPorts, aliasStore, entropy,
110
+ }).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)(output_schemas_js_1.V2CheckpointWorkflowOutputSchema.parse({
104
111
  checkpointNodeId,
105
- stateToken: tokenResult.value,
106
- nextCall: { tool: 'continue_workflow', params: { intent: 'rehydrate', stateToken: tokenResult.value } },
107
- }));
112
+ stateToken: stateTokenValue,
113
+ nextCall: { tool: 'continue_workflow', params: { continueToken } },
114
+ }))))
115
+ .mapErr((e) => ({ kind: 'store_failed', cause: e }));
108
116
  }
109
- function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeId, checkpointNodeId, mintEventId, lock, sessionStore, tokenCodecPorts) {
117
+ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeId, attemptId, checkpointNodeId, mintEventId, lock, sessionStore, tokenCodecPorts, aliasStore, entropy) {
110
118
  const nodeCreatedEventId = mintEventId();
111
119
  const edgeCreatedEventId = mintEventId();
112
120
  const rawEvents = [
@@ -156,14 +164,18 @@ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeI
156
164
  return sessionStore.append(lock, { events: validated, snapshotPins })
157
165
  .mapErr((cause) => ({ kind: 'store_failed', cause }))
158
166
  .andThen(() => {
159
- const tokenResult = mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts);
160
- if (!tokenResult.ok)
161
- return (0, neverthrow_1.errAsync)(tokenResult.error);
162
- return (0, neverthrow_1.okAsync)(output_schemas_js_1.V2CheckpointWorkflowOutputSchema.parse({
167
+ const workflowHashRefRes = (0, workflow_hash_ref_js_1.deriveWorkflowHashRef)(originalNode.data.workflowHash);
168
+ const workflowHashRef = workflowHashRefRes.isOk() ? workflowHashRefRes.value : undefined;
169
+ return mintStateTokenForNode(originalNode, sessionId, runId, nodeId, tokenCodecPorts, aliasStore, entropy)
170
+ .andThen((stateTokenValue) => (0, v2_token_ops_js_1.mintContinueAndCheckpointTokens)({
171
+ entry: { sessionId: String(sessionId), runId: String(runId), nodeId: String(nodeId), attemptId: String(attemptId), workflowHashRef },
172
+ ports: tokenCodecPorts, aliasStore, entropy,
173
+ }).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)(output_schemas_js_1.V2CheckpointWorkflowOutputSchema.parse({
163
174
  checkpointNodeId: String(checkpointNodeId),
164
- stateToken: tokenResult.value,
165
- nextCall: { tool: 'continue_workflow', params: { intent: 'rehydrate', stateToken: tokenResult.value } },
166
- }));
175
+ stateToken: stateTokenValue,
176
+ nextCall: { tool: 'continue_workflow', params: { continueToken } },
177
+ }))))
178
+ .mapErr((e) => ({ kind: 'store_failed', cause: e }));
167
179
  });
168
180
  }
169
181
  function mapCheckpointErrorToToolError(e) {