@exaudeus/workrail 3.73.0 → 3.73.2

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 (38) hide show
  1. package/dist/cli/commands/worktrain-daemon.d.ts +7 -0
  2. package/dist/cli/commands/worktrain-daemon.js +29 -7
  3. package/dist/cli-worktrain.js +11 -0
  4. package/dist/console-ui/assets/{index-HnM-KywY.js → index-CfI4I3OX.js} +1 -1
  5. package/dist/console-ui/index.html +1 -1
  6. package/dist/manifest.json +73 -57
  7. package/dist/mcp/handlers/v2-advance-core/index.d.ts +1 -0
  8. package/dist/mcp/handlers/v2-advance-core/index.js +3 -3
  9. package/dist/mcp/handlers/v2-advance-core/outcome-success.js +3 -28
  10. package/dist/mcp/handlers/v2-advance-events.d.ts +1 -1
  11. package/dist/mcp/handlers/v2-advance-events.js +1 -1
  12. package/dist/mcp/handlers/v2-execution/advance.d.ts +1 -0
  13. package/dist/mcp/handlers/v2-execution/advance.js +3 -3
  14. package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +1 -0
  15. package/dist/mcp/handlers/v2-execution/continue-advance.js +2 -1
  16. package/dist/mcp/handlers/v2-execution/index.js +3 -1
  17. package/dist/mcp/server.js +6 -4
  18. package/dist/mcp/types.d.ts +2 -0
  19. package/dist/trigger/delivery-action.d.ts +1 -0
  20. package/dist/trigger/delivery-action.js +1 -1
  21. package/dist/trigger/delivery-pipeline.d.ts +13 -2
  22. package/dist/trigger/delivery-pipeline.js +58 -3
  23. package/dist/trigger/trigger-router.js +6 -3
  24. package/dist/v2/durable-core/constants.d.ts +1 -0
  25. package/dist/v2/durable-core/constants.js +1 -0
  26. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +202 -0
  27. package/dist/v2/durable-core/schemas/session/events.d.ts +56 -0
  28. package/dist/v2/durable-core/schemas/session/events.js +8 -0
  29. package/dist/v2/infra/local/git-snapshot/index.d.ts +6 -0
  30. package/dist/v2/infra/local/git-snapshot/index.js +39 -0
  31. package/dist/v2/ports/git-snapshot.port.d.ts +10 -0
  32. package/dist/v2/ports/git-snapshot.port.js +9 -0
  33. package/dist/v2/projections/session-metrics.js +17 -2
  34. package/docs/design/engine-boundary-discovery.md +123 -0
  35. package/docs/design/engine-boundary-review-findings.md +72 -0
  36. package/docs/ideas/backlog.md +3178 -542
  37. package/docs/roadmap/open-work-inventory.md +12 -0
  38. package/package.json +2 -1
@@ -238,8 +238,8 @@
238
238
  "bytes": 31
239
239
  },
240
240
  "cli-worktrain.js": {
241
- "sha256": "8e356ca5fdb69b5695af24137ddc54466a1117668181c379b217831f45c46955",
242
- "bytes": 59895
241
+ "sha256": "ab9815d8a2a571ac8fc4923eb3c1f51fc6e096403d3b75a80cd12d0bfe1858f2",
242
+ "bytes": 60401
243
243
  },
244
244
  "cli.d.ts": {
245
245
  "sha256": "43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012",
@@ -338,12 +338,12 @@
338
338
  "bytes": 11306
339
339
  },
340
340
  "cli/commands/worktrain-daemon.d.ts": {
341
- "sha256": "68c3806a61ed28aac7552bfb06505f4be76f19a70a3f581496dd7fb77417b684",
342
- "bytes": 1520
341
+ "sha256": "71bbefa477ff176b15df5f8492a32d626b3de3bc0a161f4c68bc1af93f98b20c",
342
+ "bytes": 1838
343
343
  },
344
344
  "cli/commands/worktrain-daemon.js": {
345
- "sha256": "26c07c857ad0e95aa82bf1d675b6d3b8788250e1d8bbebb9274e6d0c6d00f89b",
346
- "bytes": 14779
345
+ "sha256": "15e1b5531b585c1149658a289fc1d02e40621235c58da5bf00f2de5f090a663e",
346
+ "bytes": 15446
347
347
  },
348
348
  "cli/commands/worktrain-inbox.d.ts": {
349
349
  "sha256": "097d7c58f2e75da833504cf62122a281197c2008f8b70c8a9391d30fdf5a829d",
@@ -473,16 +473,16 @@
473
473
  "sha256": "5fe866e54f796975dec5d8ba9983aefd86074db212d3fccd64eed04bc9f0b3da",
474
474
  "bytes": 8011
475
475
  },
476
+ "console-ui/assets/index-CfI4I3OX.js": {
477
+ "sha256": "899505f097e5252239bf07f156eb1affe5c94ecdf8c97f23388fd713565bdaa8",
478
+ "bytes": 768234
479
+ },
476
480
  "console-ui/assets/index-DHrKiMCf.css": {
477
481
  "sha256": "40290b50e21ee7e82433efe13b1aa31c1ea608bd057a5c4e324982f284bc928b",
478
482
  "bytes": 60673
479
483
  },
480
- "console-ui/assets/index-HnM-KywY.js": {
481
- "sha256": "dceb8f4d616f8c18643b6705b96f0749436f32c5c39fb71df7cadd9cb8def8a0",
482
- "bytes": 768234
483
- },
484
484
  "console-ui/index.html": {
485
- "sha256": "73bcca58451f05a95e6b4cbad9ce993f2bbbc5bddb4d92ebbef8969fb3422bec",
485
+ "sha256": "958b1601100f528545fcd2b4fe9cf4580bfd0a7977f826fce6593af47f90c15d",
486
486
  "bytes": 417
487
487
  },
488
488
  "console/standalone-console.d.ts": {
@@ -1166,12 +1166,12 @@
1166
1166
  "bytes": 5741
1167
1167
  },
1168
1168
  "mcp/handlers/v2-advance-core/index.d.ts": {
1169
- "sha256": "8c306cad3b4b5120f206df58a4c0e7a8bcca1a68d01759a1bd5e28e64649e904",
1170
- "bytes": 3567
1169
+ "sha256": "be738510d019c387bf755c97ac0e1fc2513c77bccbb9084e6b59fd7f78d2f6fc",
1170
+ "bytes": 3661
1171
1171
  },
1172
1172
  "mcp/handlers/v2-advance-core/index.js": {
1173
- "sha256": "a821bb07fab92983c7d9aaf2806d885ca3bd2240186b69f335150c94cceae0fd",
1174
- "bytes": 8087
1173
+ "sha256": "f3238283cd06dc7f3e28ae46fc7497deb09f95f4087b285cdb14871c343a65cc",
1174
+ "bytes": 8126
1175
1175
  },
1176
1176
  "mcp/handlers/v2-advance-core/input-validation.d.ts": {
1177
1177
  "sha256": "4e057b4496c0d0b263a1296f313df6583df3b5fb34855c1e26d38cbdd39536ea",
@@ -1194,16 +1194,16 @@
1194
1194
  "bytes": 1055
1195
1195
  },
1196
1196
  "mcp/handlers/v2-advance-core/outcome-success.js": {
1197
- "sha256": "9b7169001269c1c94a158cd9b82ed60bcef1831202527446b75c23232f4fb031",
1198
- "bytes": 10509
1197
+ "sha256": "92c6971536d97cd34d2bf9c391dc0c5bae1eb44ceb0e313990ce49a97d9e6a78",
1198
+ "bytes": 9617
1199
1199
  },
1200
1200
  "mcp/handlers/v2-advance-events.d.ts": {
1201
- "sha256": "318894df12e0dfc74cad9e81fcea44bc04ea972d6e887cd5b196de1f144e256b",
1202
- "bytes": 3226
1201
+ "sha256": "eb8cbcc5cf8bc55d44468e21e4eb75710bb76216e1ff395453d25007b3c041a1",
1202
+ "bytes": 3235
1203
1203
  },
1204
1204
  "mcp/handlers/v2-advance-events.js": {
1205
- "sha256": "b3278a63cebab6b54b72cef596c0c7dee31d04246a29339828f283386174e6ad",
1206
- "bytes": 5919
1205
+ "sha256": "8b4352085fc5960845792c4305ce5b2256f1fdc34ebb3ce311f69e069286f60c",
1206
+ "bytes": 5941
1207
1207
  },
1208
1208
  "mcp/handlers/v2-checkpoint.d.ts": {
1209
1209
  "sha256": "8f22b341bb0ffffb3b24a89067e2a6513ef004ca21c1a42ce48979c2c663b18c",
@@ -1246,20 +1246,20 @@
1246
1246
  "bytes": 645
1247
1247
  },
1248
1248
  "mcp/handlers/v2-execution/advance.d.ts": {
1249
- "sha256": "87f555395916cff6737b989a27cdf1ba558c0ebb87d81195c7c9adcb20cc089a",
1250
- "bytes": 2116
1249
+ "sha256": "e6060dd20c5efcf317900c7712317e702df79ff5d1bd53a7ab38aa6869403daa",
1250
+ "bytes": 2210
1251
1251
  },
1252
1252
  "mcp/handlers/v2-execution/advance.js": {
1253
- "sha256": "849726273445bfc7e10352b6a0896a12b3aad7df952e63fe88016d59ce9c8e85",
1254
- "bytes": 3828
1253
+ "sha256": "c5c5e6e6bd1cc073da499a505a5ed03122f979a9106d2f9d7c3e0b603ffcedc2",
1254
+ "bytes": 3867
1255
1255
  },
1256
1256
  "mcp/handlers/v2-execution/continue-advance.d.ts": {
1257
- "sha256": "6de9b9bb05dee9bbc2c3729960601eca4eb59da5b2e2d2baa5acf20fd14cb118",
1258
- "bytes": 2070
1257
+ "sha256": "de65ee6a04e2151394a407a40f74eeeb72e03d9919a63ef85fb353464e08a474",
1258
+ "bytes": 2164
1259
1259
  },
1260
1260
  "mcp/handlers/v2-execution/continue-advance.js": {
1261
- "sha256": "30e82a97410d19105859b49fcdb0711a602eb25d0a1ce2cc55a190f696926f1b",
1262
- "bytes": 10227
1261
+ "sha256": "eb1fe005ec29aa55a8a03e6df3462232aa804d8d33c884163eb9a7f650983c55",
1262
+ "bytes": 10269
1263
1263
  },
1264
1264
  "mcp/handlers/v2-execution/continue-rehydrate.d.ts": {
1265
1265
  "sha256": "8412323cb149f7818ed19400758da9e0452b35a18d080afd88955a03bd965b92",
@@ -1274,8 +1274,8 @@
1274
1274
  "bytes": 1437
1275
1275
  },
1276
1276
  "mcp/handlers/v2-execution/index.js": {
1277
- "sha256": "ab5ca7e41236fcbcbb0116b3a11bd931478f8ec4be1073884c33d6aee86cc22e",
1278
- "bytes": 7757
1277
+ "sha256": "ee6ba69f2aae10f1ef0faa8806e4df2eb71a657086fb603d3b44c43675aa58c9",
1278
+ "bytes": 7948
1279
1279
  },
1280
1280
  "mcp/handlers/v2-execution/replay.d.ts": {
1281
1281
  "sha256": "4f1601755e98c336f7d98c096753c38559d76ab5ebbacb1aed679983d46cb6b7",
@@ -1402,8 +1402,8 @@
1402
1402
  "bytes": 960
1403
1403
  },
1404
1404
  "mcp/server.js": {
1405
- "sha256": "b4bb802ebe0fe7374ff0c60062bc9950fc2aba9aef21934805d16d531c0e8313",
1406
- "bytes": 15911
1405
+ "sha256": "91e4b51e8be636d70ebf5113e962c9c23adc918fb4e03da6f7c2a04e5825c35e",
1406
+ "bytes": 16048
1407
1407
  },
1408
1408
  "mcp/step-content-envelope.d.ts": {
1409
1409
  "sha256": "19bd63c4d4de1d5d93393d346625d28ffd1bebdc320d4ba4e694cb740ec97d3b",
@@ -1502,8 +1502,8 @@
1502
1502
  "bytes": 747
1503
1503
  },
1504
1504
  "mcp/types.d.ts": {
1505
- "sha256": "801d390c856e733b5c728d0500dffc8c40c1247892682f58655aba1a9dfb9653",
1506
- "bytes": 4981
1505
+ "sha256": "cd0d181354d236cb1d87a74457407789983351ac425741daa2f00f56d4b352c3",
1506
+ "bytes": 5102
1507
1507
  },
1508
1508
  "mcp/types.js": {
1509
1509
  "sha256": "d10c4070e4c3454d80f0fa9cdc0e978c69c53c13fd09baa8710fcd802fed8926",
@@ -1790,12 +1790,12 @@
1790
1790
  "bytes": 15048
1791
1791
  },
1792
1792
  "trigger/delivery-action.d.ts": {
1793
- "sha256": "559e2b2645aa60528f73de351cd35ebf45c5b82f47797aa15ddd681319315d39",
1794
- "bytes": 1759
1793
+ "sha256": "bba98a08e35653304b604cd3ec126374cb731620db27ee2c8d6782d5b5b31207",
1794
+ "bytes": 1785
1795
1795
  },
1796
1796
  "trigger/delivery-action.js": {
1797
- "sha256": "44790087b051ed8a4f3e5cdd3bed5d3026260a12d99b57b5740d99fe68efb2ec",
1798
- "bytes": 14646
1797
+ "sha256": "26442cbe007f6f1b595d43db2b2d1acd2ba7798beb09566d225081af9a021324",
1798
+ "bytes": 14651
1799
1799
  },
1800
1800
  "trigger/delivery-client.d.ts": {
1801
1801
  "sha256": "0cb2be24b854cb31e3d2fe7eeaba6032de7a9b2a5290c8bc886df94faf5306f7",
@@ -1806,12 +1806,12 @@
1806
1806
  "bytes": 1269
1807
1807
  },
1808
1808
  "trigger/delivery-pipeline.d.ts": {
1809
- "sha256": "b22d6048844357996bff383cea6c3cf5fc7ba75a0ee4441c755e83654af4b77b",
1810
- "bytes": 858
1809
+ "sha256": "257f04e9018bda1a4a373e0709951057dd40b9a30c749c87f3a720f77137bbba",
1810
+ "bytes": 1463
1811
1811
  },
1812
1812
  "trigger/delivery-pipeline.js": {
1813
- "sha256": "a5628cbf46cb65090e9e34c86fc78cb0b5fe2be6558efa2a3ce2009600a42d0a",
1814
- "bytes": 6796
1813
+ "sha256": "ba011b9360749df47ee540cea08ccba57534a57a8a1d91d3ec240f990396be14",
1814
+ "bytes": 9611
1815
1815
  },
1816
1816
  "trigger/dispatch-deduplicator.d.ts": {
1817
1817
  "sha256": "e1b7f48f7c03a391812ff7b40aa8cff7784d175df7c58de1a152e2a2c4eff060",
@@ -1874,8 +1874,8 @@
1874
1874
  "bytes": 3220
1875
1875
  },
1876
1876
  "trigger/trigger-router.js": {
1877
- "sha256": "9676fb57236040d46b923c8016394b519561ab18c99884dc190cf2221e2f1ecf",
1878
- "bytes": 20550
1877
+ "sha256": "ec971ba1f36a6ace7521fad51ba833fa804d5591b3b51e9805e331bbf5ef7159",
1878
+ "bytes": 20769
1879
1879
  },
1880
1880
  "trigger/trigger-store.d.ts": {
1881
1881
  "sha256": "f846ca66494a2a1b834914652c845373d777bdeaaaefdc101ad1e78083d9ad5b",
@@ -2030,12 +2030,12 @@
2030
2030
  "bytes": 447
2031
2031
  },
2032
2032
  "v2/durable-core/constants.d.ts": {
2033
- "sha256": "14b721867f0866a9a2955b19f16868c39394e80dce2bd94021e6e7f6b4f62429",
2034
- "bytes": 4159
2033
+ "sha256": "bc135e1c75f1eedd84bcb0d98148cc4c37a265cd53403e2abad59e1ab2286335",
2034
+ "bytes": 4212
2035
2035
  },
2036
2036
  "v2/durable-core/constants.js": {
2037
- "sha256": "21a7a514d3a365c7e7690c1c57dd402a25686bfd2dea38082fcc02ee6c266a5c",
2038
- "bytes": 3987
2037
+ "sha256": "a122a4f5e48711620ea511b873558602853b6faf92a5b9d17c877ed944eabd37",
2038
+ "bytes": 4031
2039
2039
  },
2040
2040
  "v2/durable-core/domain/ack-advance-append-plan.d.ts": {
2041
2041
  "sha256": "2b4a8ad0e1d9e9066f100f958e572f19af590ab70946c2396d2d5568875bdf00",
@@ -2478,8 +2478,8 @@
2478
2478
  "bytes": 3397
2479
2479
  },
2480
2480
  "v2/durable-core/schemas/export-bundle/index.d.ts": {
2481
- "sha256": "ae48214ae394702c323a6a4ccd0498ba54c3abcc3104ea9396f5f226b633423e",
2482
- "bytes": 552192
2481
+ "sha256": "bbe43832c5f0c09949104907d14d7b903163d0453bead5afafe59e80f8a7070a",
2482
+ "bytes": 557686
2483
2483
  },
2484
2484
  "v2/durable-core/schemas/export-bundle/index.js": {
2485
2485
  "sha256": "6e3566b2d05ea6302bbf4d311b8ec3e94725a8523834efe7670a79e7bd7dc40d",
@@ -2534,12 +2534,12 @@
2534
2534
  "bytes": 2138
2535
2535
  },
2536
2536
  "v2/durable-core/schemas/session/events.d.ts": {
2537
- "sha256": "878c97d2442d782d202316606b46ad8bf51ba98b0f8b892fd1f6a1c1a6e8eb70",
2538
- "bytes": 84874
2537
+ "sha256": "12f5c9736ab568deeac2fde429a6bb1cb357486b4770ef7fae81b82676898690",
2538
+ "bytes": 86130
2539
2539
  },
2540
2540
  "v2/durable-core/schemas/session/events.js": {
2541
- "sha256": "23651dfa8219a75318474629c45e37bdad2f91f48d1555dfbed649c5c2ed830a",
2542
- "bytes": 13894
2541
+ "sha256": "6cd52e959d42430636a57f6b914792c490e8ae7a8f790cab74ffddffbc6fd262",
2542
+ "bytes": 14212
2543
2543
  },
2544
2544
  "v2/durable-core/schemas/session/gaps.d.ts": {
2545
2545
  "sha256": "85d17b865a1ebe9deaa0c99d69039c514b217362715c6697b0bc5908cbf9fff0",
@@ -2773,6 +2773,14 @@
2773
2773
  "sha256": "c6239baab7d36b12ded5fb5383a8f41e13980470846a7a033e995a6827ba0fda",
2774
2774
  "bytes": 8429
2775
2775
  },
2776
+ "v2/infra/local/git-snapshot/index.d.ts": {
2777
+ "sha256": "4399241c19447df846cddfd02609a278c04f471a38f705ce0c7ce8f7c64e66a4",
2778
+ "bytes": 325
2779
+ },
2780
+ "v2/infra/local/git-snapshot/index.js": {
2781
+ "sha256": "a6ed9bde6deef68af8b3e1afe68da36a3066904c04bab741a8388c14b5e1ce8c",
2782
+ "bytes": 1458
2783
+ },
2776
2784
  "v2/infra/local/hmac-sha256/index.d.ts": {
2777
2785
  "sha256": "dda3865510dfaf2f13947410d998da6ffecc9a2e728b3574f81e69d5db859815",
2778
2786
  "bytes": 272
@@ -2949,6 +2957,14 @@
2949
2957
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
2950
2958
  "bytes": 77
2951
2959
  },
2960
+ "v2/ports/git-snapshot.port.d.ts": {
2961
+ "sha256": "247186671b5251757257cabb061c5915f479298c566e1533f4e123b251f337e0",
2962
+ "bytes": 377
2963
+ },
2964
+ "v2/ports/git-snapshot.port.js": {
2965
+ "sha256": "750489a646660c6568997361e1df4e3850b8279238e5b423b32119d240b1b575",
2966
+ "bytes": 276
2967
+ },
2952
2968
  "v2/ports/hmac-sha256.port.d.ts": {
2953
2969
  "sha256": "36bb3cffc90ce7e9ce5a60fb6cd1667d584e438ac273ca9e98e73094d98e6da9",
2954
2970
  "bytes": 164
@@ -3202,8 +3218,8 @@
3202
3218
  "bytes": 730
3203
3219
  },
3204
3220
  "v2/projections/session-metrics.js": {
3205
- "sha256": "89dd4c149087234e3f4f18382340a9f855942fd96595783b7d7ad5c76449536a",
3206
- "bytes": 3370
3221
+ "sha256": "3c704be9cd13d2074ef61a974f3f1bcdbb46be99d19567765623bf9f97998a67",
3222
+ "bytes": 3942
3207
3223
  },
3208
3224
  "v2/read-only/v1-to-v2-shim.d.ts": {
3209
3225
  "sha256": "b122df1d4eb4119b65465baa00f157ca4466575d3bc6ac20054a361eaff48e02",
@@ -33,6 +33,7 @@ export interface AdvanceCorePorts {
33
33
  readonly mintNodeId: () => NodeId;
34
34
  readonly mintEventId: () => string;
35
35
  };
36
+ readonly gitSnapshot: import('../../../v2/ports/git-snapshot.port.js').GitSnapshotPortV2;
36
37
  }
37
38
  export interface AdvanceContext {
38
39
  readonly truth: LoadedSessionTruthV2;
@@ -29,7 +29,7 @@ function snapshotOf(mode) {
29
29
  }
30
30
  function executeAdvanceCore(args) {
31
31
  const { mode, truth, sessionId, runId, attemptId, workflowHash, inputContext, inputOutput, lock, pinnedWorkflow, ports } = args;
32
- const { snapshotStore, sessionStore, sha256, idFactory } = ports;
32
+ const { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot } = ports;
33
33
  const currentNodeId = nodeIdOf(mode);
34
34
  const snap = snapshotOf(mode);
35
35
  const engineState = snap.enginePayload.engineState;
@@ -71,7 +71,7 @@ function executeAdvanceCore(args) {
71
71
  };
72
72
  const ctx = { truth, sessionId, runId, currentNodeId, attemptId, workflowHash, inputOutput, pinnedWorkflow, engineState, pendingStep };
73
73
  const computed = { reasons: effectiveReasons, outputRequirement, validation: evalValidation };
74
- const portsLocal = { snapshotStore, sessionStore, sha256, idFactory };
74
+ const portsLocal = { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot };
75
75
  return (0, outcome_blocked_js_1.buildBlockedOutcome)({ mode, snap, ctx, computed, v, lock, ports: portsLocal, lockedIndex: args.lockedIndex });
76
76
  }
77
77
  const validation = phase.validation;
@@ -109,7 +109,7 @@ function executeAdvanceCore(args) {
109
109
  const shouldBlockNow = reasons.length > 0 && (0, reason_model_js_1.shouldBlock)(v.autonomy, reasons);
110
110
  const ctx = { truth, sessionId, runId, currentNodeId, attemptId, workflowHash, inputOutput, pinnedWorkflow, engineState, pendingStep };
111
111
  const computed = { reasons, outputRequirement, validation: effectiveValidation };
112
- const ports = { snapshotStore, sessionStore, sha256, idFactory };
112
+ const ports = { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot };
113
113
  if (shouldBlockNow) {
114
114
  return (0, outcome_blocked_js_1.buildBlockedOutcome)({ mode, snap, ctx, computed, v, lock, ports, lockedIndex: args.lockedIndex });
115
115
  }
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildSuccessOutcome = buildSuccessOutcome;
4
- const node_child_process_1 = require("node:child_process");
5
- const node_util_1 = require("node:util");
6
4
  const neverthrow_1 = require("neverthrow");
7
5
  const workflow_compiler_js_1 = require("../../../application/services/workflow-compiler.js");
8
6
  const workflow_interpreter_js_1 = require("../../../application/services/workflow-interpreter.js");
@@ -11,7 +9,6 @@ const v2_state_conversion_js_1 = require("../v2-state-conversion.js");
11
9
  const v2_advance_events_js_1 = require("../v2-advance-events.js");
12
10
  const event_builders_js_1 = require("./event-builders.js");
13
11
  const assessment_recorded_event_builder_js_1 = require("../../../v2/durable-core/domain/assessment-recorded-event-builder.js");
14
- const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
15
12
  function readObservation(events, key) {
16
13
  for (const e of events) {
17
14
  if (e.kind !== 'observation_recorded')
@@ -22,17 +19,6 @@ function readObservation(events, key) {
22
19
  }
23
20
  return null;
24
21
  }
25
- async function resolveEndGitSha(repoRoot) {
26
- if (!repoRoot)
27
- return null;
28
- try {
29
- const { stdout } = await execFileAsync('git', ['rev-parse', 'HEAD'], { cwd: repoRoot, timeout: 2000 });
30
- return stdout.trim() || null;
31
- }
32
- catch {
33
- return null;
34
- }
35
- }
36
22
  function successNodeKind(mode) {
37
23
  switch (mode.kind) {
38
24
  case 'fresh': return undefined;
@@ -43,7 +29,7 @@ function buildSuccessOutcome(args) {
43
29
  const { mode, v, lock, ports } = args;
44
30
  const { truth, sessionId, runId, currentNodeId, attemptId, workflowHash, inputOutput, pinnedWorkflow, engineState, pendingStep } = args.ctx;
45
31
  const { reasons, outputRequirement, validation } = args.computed;
46
- const { snapshotStore, sessionStore, sha256, idFactory } = ports;
32
+ const { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot } = ports;
47
33
  const compiler = new workflow_compiler_js_1.WorkflowCompiler();
48
34
  const interpreter = new workflow_interpreter_js_1.WorkflowInterpreter();
49
35
  const compiledWf = compiler.compile(pinnedWorkflow);
@@ -176,22 +162,11 @@ function buildSuccessOutcome(args) {
176
162
  const repoRoot = readObservation(truth.events, 'repo_root');
177
163
  const startGitSha = readObservation(truth.events, 'git_head_sha');
178
164
  const gitBranch = readObservation(truth.events, 'git_branch');
179
- let agentCommitShas = [];
180
- for (const e of truth.events) {
181
- if (e.kind !== 'context_set')
182
- continue;
183
- const ctx = e.data['context'];
184
- if (ctx && typeof ctx === 'object' && !Array.isArray(ctx)) {
185
- const shas = ctx['metrics_commit_shas'];
186
- if (Array.isArray(shas) && shas.every(s => typeof s === 'string')) {
187
- agentCommitShas = shas;
188
- }
189
- }
190
- }
191
165
  const firstTs = truth.events[0]?.timestampMs;
192
166
  const lastTs = truth.events[truth.events.length - 1]?.timestampMs;
193
167
  const durationMs = (firstTs !== undefined && lastTs !== undefined) ? (lastTs - firstTs) : undefined;
194
- return neverthrow_1.ResultAsync.fromPromise(resolveEndGitSha(repoRoot), (e) => ({ kind: 'advance_apply_failed', message: String(e) })).andThen((endGitSha) => {
168
+ return neverthrow_1.ResultAsync.fromPromise(gitSnapshot.resolveEndSnapshot(repoRoot, startGitSha), (e) => ({ kind: 'advance_apply_failed', message: String(e) })).andThen(({ endSha: endGitSha, commitShas }) => {
169
+ const agentCommitShas = commitShas;
195
170
  const captureConfidence = agentCommitShas.length > 0 ? 'high' : 'none';
196
171
  extraEventsToAppend.push((0, v2_advance_events_js_1.buildRunCompletedEvent)({
197
172
  sessionId: String(sessionId),
@@ -64,7 +64,7 @@ export declare function buildRunCompletedEvent(args: {
64
64
  readonly startGitSha: string | null;
65
65
  readonly endGitSha: string | null;
66
66
  readonly gitBranch: string | null;
67
- readonly agentCommitShas: string[];
67
+ readonly agentCommitShas: readonly string[];
68
68
  readonly captureConfidence: 'high' | 'none';
69
69
  readonly durationMs: number | undefined;
70
70
  readonly idFactory: AdvanceCorePorts['idFactory'];
@@ -137,7 +137,7 @@ function buildRunCompletedEvent(args) {
137
137
  startGitSha,
138
138
  endGitSha,
139
139
  gitBranch,
140
- agentCommitShas,
140
+ agentCommitShas: [...agentCommitShas],
141
141
  captureConfidence,
142
142
  ...(durationMs !== undefined ? { durationMs } : {}),
143
143
  },
@@ -30,5 +30,6 @@ export declare function advanceAndRecord(args: {
30
30
  readonly mintNodeId: () => NodeId;
31
31
  readonly mintEventId: () => string;
32
32
  };
33
+ readonly gitSnapshot: import('../../../v2/ports/git-snapshot.port.js').GitSnapshotPortV2;
33
34
  readonly lockedIndex: SessionIndex;
34
35
  }): RA<void, InternalError | SessionEventLogStoreError | SnapshotStoreError>;
@@ -18,7 +18,7 @@ function countBlockedAttemptChainDepth(nodeId, lockedIndex) {
18
18
  return depth;
19
19
  }
20
20
  function advanceAndRecord(args) {
21
- const { truth, sessionId, runId, nodeId, attemptId, workflowHash, dedupeKey, inputContext, inputOutput, lock, pinnedWorkflow, snapshotStore, sessionStore, sha256, idFactory } = args;
21
+ const { truth, sessionId, runId, nodeId, attemptId, workflowHash, dedupeKey, inputContext, inputOutput, lock, pinnedWorkflow, snapshotStore, sessionStore, sha256, idFactory, gitSnapshot } = args;
22
22
  const hasRun = args.lockedIndex.runStartedByRunId.has(String(runId));
23
23
  const nodeCreated = args.lockedIndex.nodeCreatedByNodeId.get(String(nodeId));
24
24
  const hasNode = nodeCreated !== undefined;
@@ -58,7 +58,7 @@ function advanceAndRecord(args) {
58
58
  mode: { kind: 'retry', blockedNodeId: nodeId, blockedSnapshot: snap },
59
59
  truth, sessionId, runId, attemptId, workflowHash, dedupeKey,
60
60
  inputContext, inputOutput, lock, pinnedWorkflow,
61
- ports: { snapshotStore, sessionStore, sha256, idFactory },
61
+ ports: { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot },
62
62
  lockedIndex: args.lockedIndex,
63
63
  });
64
64
  }
@@ -66,7 +66,7 @@ function advanceAndRecord(args) {
66
66
  mode: { kind: 'fresh', sourceNodeId: nodeId, snapshot: snap },
67
67
  truth, sessionId, runId, attemptId, workflowHash, dedupeKey,
68
68
  inputContext, inputOutput, lock, pinnedWorkflow,
69
- ports: { snapshotStore, sessionStore, sha256, idFactory },
69
+ ports: { snapshotStore, sessionStore, sha256, idFactory, gitSnapshot },
70
70
  lockedIndex: args.lockedIndex,
71
71
  });
72
72
  });
@@ -26,6 +26,7 @@ export declare function handleAdvanceIntent(args: {
26
26
  readonly mintEventId: () => string;
27
27
  };
28
28
  readonly sha256: Sha256PortV2;
29
+ readonly gitSnapshot: import('../../../v2/ports/git-snapshot.port.js').GitSnapshotPortV2;
29
30
  readonly aliasStore: import('../../../v2/ports/token-alias-store.port.js').TokenAliasStorePortV2;
30
31
  readonly entropy: import('../../../v2/ports/random-entropy.port.js').RandomEntropyPortV2;
31
32
  readonly cleanResponseFormat?: boolean;
@@ -11,7 +11,7 @@ const advance_js_1 = require("./advance.js");
11
11
  const sorted_event_log_js_1 = require("../../../v2/durable-core/sorted-event-log.js");
12
12
  const session_index_js_1 = require("../../../v2/durable-core/session-index.js");
13
13
  function handleAdvanceIntent(args) {
14
- const { input, sessionId, runId, nodeId, attemptId, workflowHashRef, truth, gate, sessionStore, snapshotStore, pinnedStore, tokenCodecPorts, idFactory, sha256, aliasStore, entropy, cleanResponseFormat } = args;
14
+ const { input, sessionId, runId, nodeId, attemptId, workflowHashRef, truth, gate, sessionStore, snapshotStore, pinnedStore, tokenCodecPorts, idFactory, sha256, gitSnapshot, aliasStore, entropy, cleanResponseFormat } = args;
15
15
  const dedupeKey = `advance_recorded:${sessionId}:${nodeId}:${attemptId}`;
16
16
  const preLockSortedResult = (0, sorted_event_log_js_1.asSortedEventLog)(truth.events);
17
17
  if (preLockSortedResult.isErr()) {
@@ -133,6 +133,7 @@ function handleAdvanceIntent(args) {
133
133
  sessionStore,
134
134
  sha256,
135
135
  idFactory,
136
+ gitSnapshot,
136
137
  lockedIndex,
137
138
  }).andThen(() => sessionStore
138
139
  .load(sessionId)
@@ -5,6 +5,7 @@ exports.handleV2StartWorkflow = handleV2StartWorkflow;
5
5
  exports.handleV2ContinueWorkflow = handleV2ContinueWorkflow;
6
6
  exports.executeContinueWorkflow = executeContinueWorkflow;
7
7
  const types_js_1 = require("../../types.js");
8
+ const git_snapshot_port_js_1 = require("../../../v2/ports/git-snapshot.port.js");
8
9
  const index_js_1 = require("../../../v2/durable-core/tokens/index.js");
9
10
  const index_js_2 = require("../../../v2/durable-core/ids/index.js");
10
11
  const neverthrow_1 = require("neverthrow");
@@ -79,7 +80,7 @@ function loadAndRehydrate(args) {
79
80
  }));
80
81
  }
81
82
  function executeContinueWorkflow(input, ctx) {
82
- const { gate, sessionStore, snapshotStore, pinnedStore, sha256, tokenCodecPorts, idFactory, tokenAliasStore, entropy } = ctx.v2;
83
+ const { gate, sessionStore, snapshotStore, pinnedStore, sha256, tokenCodecPorts, idFactory, tokenAliasStore, entropy, gitSnapshot } = ctx.v2;
83
84
  const ctxCheck = (0, v2_context_budget_js_1.checkContextBudget)({ tool: 'continue_workflow', context: input.context });
84
85
  if (!ctxCheck.ok)
85
86
  return (0, neverthrow_1.errAsync)({ kind: 'validation_failed', failure: ctxCheck.error });
@@ -139,6 +140,7 @@ function executeContinueWorkflow(input, ctx) {
139
140
  tokenCodecPorts,
140
141
  idFactory,
141
142
  sha256,
143
+ gitSnapshot: gitSnapshot ?? new git_snapshot_port_js_1.NullGitSnapshotV2(),
142
144
  aliasStore: tokenAliasStore,
143
145
  entropy,
144
146
  cleanResponseFormat: ctx.featureFlags?.isEnabled('cleanResponseFormat') ?? false,
@@ -45,9 +45,10 @@ const token_codec_ports_js_1 = require("../v2/durable-core/tokens/token-codec-po
45
45
  const validation_js_1 = require("../application/validation.js");
46
46
  const v1_to_v2_shim_js_1 = require("../v2/read-only/v1-to-v2-shim.js");
47
47
  const index_js_1 = require("../v2/infra/local/workspace-anchor/index.js");
48
+ const index_js_2 = require("../v2/infra/local/git-snapshot/index.js");
48
49
  const workspace_roots_manager_js_1 = require("./workspace-roots-manager.js");
49
- const index_js_2 = require("../v2/infra/local/directory-listing/index.js");
50
- const index_js_3 = require("../v2/infra/local/session-summary-provider/index.js");
50
+ const index_js_3 = require("../v2/infra/local/directory-listing/index.js");
51
+ const index_js_4 = require("../v2/infra/local/session-summary-provider/index.js");
51
52
  const tool_factory_js_1 = require("./tool-factory.js");
52
53
  const dev_mode_js_1 = require("./dev-mode.js");
53
54
  const tool_call_timing_js_1 = require("./tool-call-timing.js");
@@ -97,7 +98,7 @@ async function createToolContext() {
97
98
  });
98
99
  const dataDir = container_js_1.container.resolve(tokens_js_1.DI.V2.DataDir);
99
100
  const fsPort = container_js_1.container.resolve(tokens_js_1.DI.V2.FileSystem);
100
- const directoryListing = new index_js_2.LocalDirectoryListingV2(fsPort);
101
+ const directoryListing = new index_js_3.LocalDirectoryListingV2(fsPort);
101
102
  const validationEngine = container_js_1.container.resolve(tokens_js_1.DI.Infra.ValidationEngine);
102
103
  const compiler = container_js_1.container.resolve(tokens_js_1.DI.Services.WorkflowCompiler);
103
104
  const validationPipelineDeps = {
@@ -129,9 +130,10 @@ async function createToolContext() {
129
130
  validationPipelineDeps,
130
131
  resolvedRootUris: [],
131
132
  workspaceResolver: new index_js_1.LocalWorkspaceAnchorV2(process.cwd()),
133
+ gitSnapshot: new index_js_2.LocalGitSnapshotV2(),
132
134
  dataDir,
133
135
  directoryListing,
134
- sessionSummaryProvider: new index_js_3.LocalSessionSummaryProviderV2({
136
+ sessionSummaryProvider: new index_js_4.LocalSessionSummaryProviderV2({
135
137
  directoryListing,
136
138
  dataDir,
137
139
  sessionStore,
@@ -19,6 +19,7 @@ import type { ValidationPipelineDepsPhase1a } from '../application/services/work
19
19
  import type { TokenAliasStorePortV2 } from '../v2/ports/token-alias-store.port.js';
20
20
  import type { RandomEntropyPortV2 } from '../v2/ports/random-entropy.port.js';
21
21
  import type { RememberedRootsStorePortV2 } from '../v2/ports/remembered-roots-store.port.js';
22
+ import type { GitSnapshotPortV2 } from '../v2/ports/git-snapshot.port.js';
22
23
  import type { ManagedSourceStorePortV2 } from '../v2/ports/managed-source-store.port.js';
23
24
  export interface SessionHealthDetails {
24
25
  readonly health: SessionHealthV2;
@@ -66,6 +67,7 @@ export interface V2Dependencies {
66
67
  readonly validationPipelineDeps: ValidationPipelineDepsPhase1a;
67
68
  readonly resolvedRootUris?: readonly string[];
68
69
  readonly workspaceResolver?: WorkspaceContextResolverPortV2;
70
+ readonly gitSnapshot?: GitSnapshotPortV2;
69
71
  readonly dataDir?: DataDirPortV2;
70
72
  readonly directoryListing?: DirectoryListingPortV2;
71
73
  readonly sessionSummaryProvider?: SessionSummaryProviderPortV2;
@@ -27,6 +27,7 @@ export type DeliveryResult = {
27
27
  } | {
28
28
  readonly _tag: 'pr_opened';
29
29
  readonly url: string;
30
+ readonly sha: string;
30
31
  } | {
31
32
  readonly _tag: 'skipped';
32
33
  readonly reason: string;
@@ -342,7 +342,7 @@ async function runDelivery(artifact, workspacePath, flags, execFn) {
342
342
  });
343
343
  }
344
344
  const prUrl = prStdout.trim().split('\n').at(-1)?.trim() ?? '';
345
- return { _tag: 'pr_opened', url: prUrl };
345
+ return { _tag: 'pr_opened', url: prUrl, sha };
346
346
  }
347
347
  function formatExecError(e) {
348
348
  if (e instanceof Error) {
@@ -1,6 +1,8 @@
1
1
  import type { WorkflowRunSuccess } from '../daemon/workflow-runner.js';
2
2
  import type { TriggerDefinition } from './types.js';
3
3
  import type { ExecFn, HandoffArtifact } from './delivery-action.js';
4
+ import type { ExecutionSessionGateV2 } from '../v2/usecases/execution-session-gate.js';
5
+ import type { SessionEventLogAppendStorePortV2 } from '../v2/ports/session-event-log-store.port.js';
4
6
  export type DeliveryStageOutcome = {
5
7
  readonly kind: 'continue';
6
8
  } | {
@@ -9,10 +11,19 @@ export type DeliveryStageOutcome = {
9
11
  };
10
12
  export interface DeliveryStage {
11
13
  readonly name: string;
12
- run(result: WorkflowRunSuccess, trigger: TriggerDefinition, execFn: ExecFn, ctx: PipelineContext): Promise<DeliveryStageOutcome>;
14
+ run(result: WorkflowRunSuccess, trigger: TriggerDefinition, execFn: ExecFn, ctx: PipelineContext, deps?: DeliveryPipelineDeps): Promise<DeliveryStageOutcome>;
13
15
  }
14
16
  export interface PipelineContext {
15
17
  handoffArtifact?: HandoffArtifact;
18
+ commitSha?: string;
19
+ prUrl?: string;
16
20
  }
17
- export declare function runDeliveryPipeline(stages: readonly DeliveryStage[], result: WorkflowRunSuccess, trigger: TriggerDefinition, execFn: ExecFn, triggerId: string): Promise<void>;
21
+ export interface DeliveryPipelineDeps {
22
+ readonly gate: ExecutionSessionGateV2;
23
+ readonly sessionStore: SessionEventLogAppendStorePortV2 & import('../v2/ports/session-event-log-store.port.js').SessionEventLogReadonlyStorePortV2;
24
+ readonly idFactory: {
25
+ readonly mintEventId: () => string;
26
+ };
27
+ }
28
+ export declare function runDeliveryPipeline(stages: readonly DeliveryStage[], result: WorkflowRunSuccess, trigger: TriggerDefinition, execFn: ExecFn, triggerId: string, deps?: DeliveryPipelineDeps): Promise<void>;
18
29
  export declare const DEFAULT_DELIVERY_PIPELINE: readonly DeliveryStage[];