@exaudeus/workrail 3.38.0 → 3.40.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 (38) hide show
  1. package/dist/cli-worktrain.js +231 -0
  2. package/dist/console-ui/assets/{index-BtOJj6Xy.js → index-CXWCAonr.js} +1 -1
  3. package/dist/console-ui/index.html +1 -1
  4. package/dist/coordinators/pr-review.d.ts +62 -0
  5. package/dist/coordinators/pr-review.js +575 -0
  6. package/dist/daemon/workflow-runner.d.ts +3 -2
  7. package/dist/daemon/workflow-runner.js +6 -3
  8. package/dist/manifest.json +58 -34
  9. package/dist/mcp/output-schemas.d.ts +10 -10
  10. package/dist/mcp/tools.d.ts +12 -12
  11. package/dist/trigger/trigger-router.js +9 -2
  12. package/dist/types/workflow-source.d.ts +0 -1
  13. package/dist/types/workflow-source.js +3 -6
  14. package/dist/types/workflow.d.ts +1 -1
  15. package/dist/types/workflow.js +1 -2
  16. package/dist/v2/durable-core/domain/artifact-contract-validator.js +66 -0
  17. package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.d.ts +25 -0
  18. package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.js +31 -0
  19. package/dist/v2/durable-core/schemas/artifacts/index.d.ts +3 -1
  20. package/dist/v2/durable-core/schemas/artifacts/index.js +14 -1
  21. package/dist/v2/durable-core/schemas/artifacts/review-verdict.d.ts +41 -0
  22. package/dist/v2/durable-core/schemas/artifacts/review-verdict.js +30 -0
  23. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +236 -236
  24. package/dist/v2/durable-core/schemas/session/events.d.ts +50 -50
  25. package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
  26. package/dist/v2/durable-core/schemas/session/manifest.d.ts +4 -4
  27. package/dist/v2/durable-core/schemas/session/outputs.d.ts +8 -8
  28. package/dist/v2/usecases/console-routes.js +178 -0
  29. package/docs/design/coordinator-artifact-protocol-design-candidates.md +155 -0
  30. package/docs/design/coordinator-artifact-protocol-design-review.md +103 -0
  31. package/docs/design/coordinator-artifact-protocol-implementation-plan.md +259 -0
  32. package/docs/discovery/coordinator-design-review.md +73 -0
  33. package/docs/discovery/coordinator-script-design.md +96 -679
  34. package/docs/discovery/hypothesis-challenge-report.md +44 -0
  35. package/docs/discovery/simulation-report.md +85 -0
  36. package/docs/ideas/backlog.md +158 -100
  37. package/package.json +1 -1
  38. package/workflows/mr-review-workflow.agentic.v2.json +5 -1
@@ -238,8 +238,8 @@
238
238
  "bytes": 31
239
239
  },
240
240
  "cli-worktrain.js": {
241
- "sha256": "984167ed2dd411c409971fbfcd35847c368a205f3d147af9b6310a90377c47f9",
242
- "bytes": 32342
241
+ "sha256": "b5f05c66e89a4d837f42ba1710e6daa49f32a68e43821ab2453f8993ba1d8ced",
242
+ "bytes": 44941
243
243
  },
244
244
  "cli.d.ts": {
245
245
  "sha256": "43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012",
@@ -453,12 +453,12 @@
453
453
  "sha256": "cf9d09641f1c31fffe6c7835b30bbbad52572befec1acab7fb9a0c188431af36",
454
454
  "bytes": 60355
455
455
  },
456
- "console-ui/assets/index-BtOJj6Xy.js": {
457
- "sha256": "92758189eacadde70ae3288c09100f130d51bf27811b3a92b9ea355f45243836",
456
+ "console-ui/assets/index-CXWCAonr.js": {
457
+ "sha256": "c158530b825c05ca94f709c20579976d94af944c5777958993c1146ecf912c43",
458
458
  "bytes": 754955
459
459
  },
460
460
  "console-ui/index.html": {
461
- "sha256": "13df1ae3bcff9a53cdfde1ab8e78db4c6e582809588d45f81096699c1c91b71c",
461
+ "sha256": "638d7716dfecb261d018c33aa45210c15415df5d0c036d3d6e1eb7fa8f1667fa",
462
462
  "bytes": 417
463
463
  },
464
464
  "console/standalone-console.d.ts": {
@@ -469,6 +469,14 @@
469
469
  "sha256": "759d8be0b9804aa2e6301f14afb2dc97d45231434058f64d1cfbec6e025a1991",
470
470
  "bytes": 6325
471
471
  },
472
+ "coordinators/pr-review.d.ts": {
473
+ "sha256": "8d2d5155b30c6d54da0ef38e3bd3c855266d57848ac60d9cf29a3325698fde28",
474
+ "bytes": 2815
475
+ },
476
+ "coordinators/pr-review.js": {
477
+ "sha256": "70f3288df0d243312a0301ea527bfdfe1b3284f19b57a2aeb2af3792e78f65ef",
478
+ "bytes": 24166
479
+ },
472
480
  "core/error-handler.d.ts": {
473
481
  "sha256": "80451f12ac8e185133ec3dc4c57285491a785f27525ed21e729db1da3f61010d",
474
482
  "bytes": 1368
@@ -510,12 +518,12 @@
510
518
  "bytes": 1009
511
519
  },
512
520
  "daemon/workflow-runner.d.ts": {
513
- "sha256": "d62587e9c7da974ff986d2d9cb67f0b30f7f3cb98a469cf98daf1d6fd16fa897",
514
- "bytes": 4593
521
+ "sha256": "6870cd7444074c43eae9451f97c9e4c0ea65462ca71ce51d9fae539defcacefc",
522
+ "bytes": 4710
515
523
  },
516
524
  "daemon/workflow-runner.js": {
517
- "sha256": "e3784aa04ead526de3ac9103d40967b32e3095ae3021ac13237034290be4ba4c",
518
- "bytes": 63597
525
+ "sha256": "f48238053a14dc07d032cc99502507fbb2e2937284efcfab91404715fcef7e47",
526
+ "bytes": 63877
519
527
  },
520
528
  "di/container.d.ts": {
521
529
  "sha256": "003bb7fb7478d627524b9b1e76bd0a963a243794a687ff233b96dc0e33a06d9f",
@@ -1134,7 +1142,7 @@
1134
1142
  "bytes": 7991
1135
1143
  },
1136
1144
  "mcp/output-schemas.d.ts": {
1137
- "sha256": "14a62e19960e14baad957a8d2cd1e2377b3f5f152ac7f5363debafc09395688d",
1145
+ "sha256": "7256e28820efc7093db818fffbeca547efbdd5aca4e9d42341c47805403479d3",
1138
1146
  "bytes": 93176
1139
1147
  },
1140
1148
  "mcp/output-schemas.js": {
@@ -1206,7 +1214,7 @@
1206
1214
  "bytes": 479
1207
1215
  },
1208
1216
  "mcp/tools.d.ts": {
1209
- "sha256": "8474e810cae37197d5968be4c3dfb9751ba2b09fe8a7f39e0e7dcc414af4bdb5",
1217
+ "sha256": "d29bd8bfb33e9e0457deb55fc79929bd25252d0d6ec28f4768fbacc9fb2c79e9",
1210
1218
  "bytes": 5976
1211
1219
  },
1212
1220
  "mcp/tools.js": {
@@ -1602,8 +1610,8 @@
1602
1610
  "bytes": 2010
1603
1611
  },
1604
1612
  "trigger/trigger-router.js": {
1605
- "sha256": "e7b620d2b23a5e74f6fd3b5a39a5299d19d38f745401c545277c399336ef5eaf",
1606
- "bytes": 15565
1613
+ "sha256": "46b4a49b980810e85889f3645e6160cee038e391b808ac9aea4609d8c8086455",
1614
+ "bytes": 15874
1607
1615
  },
1608
1616
  "trigger/trigger-store.d.ts": {
1609
1617
  "sha256": "7afb05127d55bc3757a550dd15d4b797766b3fff29d1bfe76b303764b93322e7",
@@ -1654,20 +1662,20 @@
1654
1662
  "bytes": 2845
1655
1663
  },
1656
1664
  "types/workflow-source.d.ts": {
1657
- "sha256": "ee439c36ac3002780837ff393120d08a1c21ef2641421cdf72f0e1449d0211eb",
1658
- "bytes": 2746
1665
+ "sha256": "5a5e4647827d898b4c953dfe4b2228ad06ca026ff1354fe7266c5703715a3304",
1666
+ "bytes": 2692
1659
1667
  },
1660
1668
  "types/workflow-source.js": {
1661
- "sha256": "cb6c45e74af2b790aa24dd3ce1360f9199c834952239c10b30518d3bddb47706",
1662
- "bytes": 4025
1669
+ "sha256": "2e3292177d799f3cfdaacf675d2e947931c69b1117b7e6ee3dbfb6ff24a87846",
1670
+ "bytes": 4004
1663
1671
  },
1664
1672
  "types/workflow.d.ts": {
1665
- "sha256": "8b30e692f8eb53915da6420eeae22a1dddd21154aa7ff4b9e67a217d8fc8e8bc",
1666
- "bytes": 2247
1673
+ "sha256": "3d4d125548f3c674859e22d9b2f68a7bcdccadbae7f15cf4bb5ee8054f8bce1c",
1674
+ "bytes": 2235
1667
1675
  },
1668
1676
  "types/workflow.js": {
1669
- "sha256": "a46ec904e8ad212553e309885602346b32640aa68fbe81ea5d12f63d966602c1",
1670
- "bytes": 5725
1677
+ "sha256": "2a0b176826e27d8785cd7b7104f58ee37496217211344c3dc7466ca5b7bf30e1",
1678
+ "bytes": 5574
1671
1679
  },
1672
1680
  "utils/DashboardWriter.d.ts": {
1673
1681
  "sha256": "b56e29e0f4122642f50009bac222a990622663d22a49e4616c57ae222bc4cd4a",
@@ -1778,8 +1786,8 @@
1778
1786
  "bytes": 1343
1779
1787
  },
1780
1788
  "v2/durable-core/domain/artifact-contract-validator.js": {
1781
- "sha256": "2bfc928afd5c11882f219e17db729cb18123952873312e12b9857697998061e6",
1782
- "bytes": 3749
1789
+ "sha256": "d7ad3b9c3c3bbb54616682640be23bb04b6256bb96f8fad5daf56cc0df43ec36",
1790
+ "bytes": 6500
1783
1791
  },
1784
1792
  "v2/durable-core/domain/assessment-consequence-event-builder.d.ts": {
1785
1793
  "sha256": "9f35e91667653fe2228ccf199d1620c233a3291e7e7705931b116b250e94cef3",
@@ -2125,13 +2133,21 @@
2125
2133
  "sha256": "82b2cd8a2cc618e3bce3b1e79cb9c4edc3bbd1cd801eceda95dabea90fafbb10",
2126
2134
  "bytes": 1492
2127
2135
  },
2136
+ "v2/durable-core/schemas/artifacts/coordinator-signal.d.ts": {
2137
+ "sha256": "9bf3d18568555f2da5a21a54e1e83934ab6f6a94df10ab4d39016a5e1561962a",
2138
+ "bytes": 1407
2139
+ },
2140
+ "v2/durable-core/schemas/artifacts/coordinator-signal.js": {
2141
+ "sha256": "b6453c5d57e4c3f05e11d4bc477821dba07e502ccd5ce98e850fb01fe3505a75",
2142
+ "bytes": 1242
2143
+ },
2128
2144
  "v2/durable-core/schemas/artifacts/index.d.ts": {
2129
- "sha256": "82f39a33032b6b627862e82aa25d7761851eafe94421d03697770acd1df338e3",
2130
- "bytes": 812
2145
+ "sha256": "424f87839cbb39dc0edb970c2ab2866bf69e746df713b51e84656c13c81772c5",
2146
+ "bytes": 1323
2131
2147
  },
2132
2148
  "v2/durable-core/schemas/artifacts/index.js": {
2133
- "sha256": "f9afda3e1bb220994ad46f39ad9c3072d97c0cd012d679f25bd239339c7cd4ea",
2134
- "bytes": 2770
2149
+ "sha256": "0cbd4659adcaf8ba1e5a4c176d3868fc9794764eb6f6d5061b9e4134c50f1e31",
2150
+ "bytes": 4827
2135
2151
  },
2136
2152
  "v2/durable-core/schemas/artifacts/loop-control.d.ts": {
2137
2153
  "sha256": "714e2980400da0aaf814c691d8915653393316e70bc9af9da72130bb07e959be",
@@ -2141,6 +2157,14 @@
2141
2157
  "sha256": "c4b2ed38f9fdda3fbe3e4b68b0a228890fd9a7c73117a6d202928acabe6fc0f9",
2142
2158
  "bytes": 2115
2143
2159
  },
2160
+ "v2/durable-core/schemas/artifacts/review-verdict.d.ts": {
2161
+ "sha256": "9f62b447edc4dfb042e1316c4cc3f005dd0afef2e6e30e6d9fff5c89e048c68c",
2162
+ "bytes": 1562
2163
+ },
2164
+ "v2/durable-core/schemas/artifacts/review-verdict.js": {
2165
+ "sha256": "72915617cb08834e37a65c45b3eb84ff04c84d6e4a12c9e87be5a90a3d80cee5",
2166
+ "bytes": 1206
2167
+ },
2144
2168
  "v2/durable-core/schemas/compiled-workflow/index.d.ts": {
2145
2169
  "sha256": "451822411a8c1ca5236939b6dc7a58e0a00aa4cf82bcec67ce7cc38e942fa820",
2146
2170
  "bytes": 11821
@@ -2182,7 +2206,7 @@
2182
2206
  "bytes": 3397
2183
2207
  },
2184
2208
  "v2/durable-core/schemas/export-bundle/index.d.ts": {
2185
- "sha256": "fa406033adbb001b8044836a96c999273814d14b35e4c6d98b644ab22424d3d9",
2209
+ "sha256": "521e9667b1a5167f44b8d67eec35b7b237733f41d568a150f84e31796f0ba546",
2186
2210
  "bytes": 535324
2187
2211
  },
2188
2212
  "v2/durable-core/schemas/export-bundle/index.js": {
@@ -2238,7 +2262,7 @@
2238
2262
  "bytes": 2138
2239
2263
  },
2240
2264
  "v2/durable-core/schemas/session/events.d.ts": {
2241
- "sha256": "dc0098d909c240bccd9508c6ed987b50b6a9c162f1f9f7a1d49d53dfefc1535f",
2265
+ "sha256": "e49769b06e5ce888cf94c935c1f204b8def5fecc33ce526fc9c00655439d88d7",
2242
2266
  "bytes": 80635
2243
2267
  },
2244
2268
  "v2/durable-core/schemas/session/events.js": {
@@ -2246,7 +2270,7 @@
2246
2270
  "bytes": 12950
2247
2271
  },
2248
2272
  "v2/durable-core/schemas/session/gaps.d.ts": {
2249
- "sha256": "c42f2b86dd8275f5e35c8b144d5f49775741612b8625806b1aebeeb594248338",
2273
+ "sha256": "64580ca179127c75c8b0ec8b8c5df3cb87ec315605220a2cb42eb9da48407bdc",
2250
2274
  "bytes": 8983
2251
2275
  },
2252
2276
  "v2/durable-core/schemas/session/gaps.js": {
@@ -2262,7 +2286,7 @@
2262
2286
  "bytes": 715
2263
2287
  },
2264
2288
  "v2/durable-core/schemas/session/manifest.d.ts": {
2265
- "sha256": "1acc586f52df0935354241278ab3201d3e57fd5be5c41bbb69dbbe338121130a",
2289
+ "sha256": "ac903651f9cb59faedae49642ff9d9b52ddaa0a8c25cb3f6129b2d69572b914e",
2266
2290
  "bytes": 1594
2267
2291
  },
2268
2292
  "v2/durable-core/schemas/session/manifest.js": {
@@ -2270,7 +2294,7 @@
2270
2294
  "bytes": 1526
2271
2295
  },
2272
2296
  "v2/durable-core/schemas/session/outputs.d.ts": {
2273
- "sha256": "0501691be580d8dd52464c124b5e2433256f2e2ece2c0618f0d261137ffee1cc",
2297
+ "sha256": "bee0f72882c6eea71273b9ff6a695264e6a425408685dde6ced74d783274df66",
2274
2298
  "bytes": 4285
2275
2299
  },
2276
2300
  "v2/durable-core/schemas/session/outputs.js": {
@@ -2914,8 +2938,8 @@
2914
2938
  "bytes": 697
2915
2939
  },
2916
2940
  "v2/usecases/console-routes.js": {
2917
- "sha256": "411338d53f59a88cf1157b66bc15f772844d8e06b4c94e66c0d847ee505ea920",
2918
- "bytes": 22102
2941
+ "sha256": "ebc39fb04a1bfdfd2f9159ef7728f5a0cafd3384d6191c5a0bc6862b8918d298",
2942
+ "bytes": 28445
2919
2943
  },
2920
2944
  "v2/usecases/console-service.d.ts": {
2921
2945
  "sha256": "fc8fe65427fa9f4f3535344b385b36f66ca06b7e3bfaea708931817a3edcad2b",
@@ -2257,9 +2257,9 @@ export declare const V2ResumeSessionOutputSchema: z.ZodObject<{
2257
2257
  tool: "continue_workflow";
2258
2258
  }>;
2259
2259
  }, "strip", z.ZodTypeAny, {
2260
- confidence: "strong" | "weak" | "medium";
2261
- workflowId: string;
2260
+ confidence: "medium" | "strong" | "weak";
2262
2261
  sessionId: string;
2262
+ workflowId: string;
2263
2263
  runId: string;
2264
2264
  isComplete: boolean;
2265
2265
  sessionTitle: string | null;
@@ -2278,9 +2278,9 @@ export declare const V2ResumeSessionOutputSchema: z.ZodObject<{
2278
2278
  pendingStepId: string | null;
2279
2279
  whyMatched: ("matched_exact_id" | "matched_notes" | "matched_notes_partial" | "matched_workflow_id" | "matched_head_sha" | "matched_branch" | "matched_repo_root" | "recency_fallback")[];
2280
2280
  }, {
2281
- confidence: "strong" | "weak" | "medium";
2282
- workflowId: string;
2281
+ confidence: "medium" | "strong" | "weak";
2283
2282
  sessionId: string;
2283
+ workflowId: string;
2284
2284
  runId: string;
2285
2285
  isComplete: boolean;
2286
2286
  sessionTitle: string | null;
@@ -2302,9 +2302,9 @@ export declare const V2ResumeSessionOutputSchema: z.ZodObject<{
2302
2302
  totalEligible: z.ZodNumber;
2303
2303
  }, "strip", z.ZodTypeAny, {
2304
2304
  candidates: {
2305
- confidence: "strong" | "weak" | "medium";
2306
- workflowId: string;
2305
+ confidence: "medium" | "strong" | "weak";
2307
2306
  sessionId: string;
2307
+ workflowId: string;
2308
2308
  runId: string;
2309
2309
  isComplete: boolean;
2310
2310
  sessionTitle: string | null;
@@ -2326,9 +2326,9 @@ export declare const V2ResumeSessionOutputSchema: z.ZodObject<{
2326
2326
  totalEligible: number;
2327
2327
  }, {
2328
2328
  candidates: {
2329
- confidence: "strong" | "weak" | "medium";
2330
- workflowId: string;
2329
+ confidence: "medium" | "strong" | "weak";
2331
2330
  sessionId: string;
2331
+ workflowId: string;
2332
2332
  runId: string;
2333
2333
  isComplete: boolean;
2334
2334
  sessionTitle: string | null;
@@ -2545,14 +2545,14 @@ export declare const CreateSessionOutputSchema: z.ZodObject<{
2545
2545
  createdAt: z.ZodString;
2546
2546
  }, "strip", z.ZodTypeAny, {
2547
2547
  path: string;
2548
- workflowId: string;
2549
2548
  sessionId: string;
2549
+ workflowId: string;
2550
2550
  dashboardUrl: string | null;
2551
2551
  createdAt: string;
2552
2552
  }, {
2553
2553
  path: string;
2554
- workflowId: string;
2555
2554
  sessionId: string;
2555
+ workflowId: string;
2556
2556
  dashboardUrl: string | null;
2557
2557
  createdAt: string;
2558
2558
  }>;
@@ -61,12 +61,12 @@ export declare const CreateSessionInput: z.ZodObject<{
61
61
  sessionId: z.ZodString;
62
62
  initialData: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
63
63
  }, "strip", z.ZodTypeAny, {
64
- workflowId: string;
65
64
  sessionId: string;
65
+ workflowId: string;
66
66
  initialData: Record<string, unknown>;
67
67
  }, {
68
- workflowId: string;
69
68
  sessionId: string;
69
+ workflowId: string;
70
70
  initialData?: Record<string, unknown> | undefined;
71
71
  }>;
72
72
  export type CreateSessionInput = z.infer<typeof CreateSessionInput>;
@@ -75,12 +75,12 @@ export declare const UpdateSessionInput: z.ZodObject<{
75
75
  sessionId: z.ZodString;
76
76
  updates: z.ZodRecord<z.ZodString, z.ZodUnknown>;
77
77
  }, "strip", z.ZodTypeAny, {
78
- workflowId: string;
79
78
  sessionId: string;
79
+ workflowId: string;
80
80
  updates: Record<string, unknown>;
81
81
  }, {
82
- workflowId: string;
83
82
  sessionId: string;
83
+ workflowId: string;
84
84
  updates: Record<string, unknown>;
85
85
  }>;
86
86
  export type UpdateSessionInput = z.infer<typeof UpdateSessionInput>;
@@ -89,12 +89,12 @@ export declare const ReadSessionInput: z.ZodObject<{
89
89
  sessionId: z.ZodString;
90
90
  path: z.ZodOptional<z.ZodString>;
91
91
  }, "strip", z.ZodTypeAny, {
92
- workflowId: string;
93
92
  sessionId: string;
93
+ workflowId: string;
94
94
  path?: string | undefined;
95
95
  }, {
96
- workflowId: string;
97
96
  sessionId: string;
97
+ workflowId: string;
98
98
  path?: string | undefined;
99
99
  }>;
100
100
  export type ReadSessionInput = z.infer<typeof ReadSessionInput>;
@@ -116,36 +116,36 @@ export declare const sessionTools: readonly [ToolDefinition<z.ZodObject<{
116
116
  sessionId: z.ZodString;
117
117
  initialData: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
118
118
  }, "strip", z.ZodTypeAny, {
119
- workflowId: string;
120
119
  sessionId: string;
120
+ workflowId: string;
121
121
  initialData: Record<string, unknown>;
122
122
  }, {
123
- workflowId: string;
124
123
  sessionId: string;
124
+ workflowId: string;
125
125
  initialData?: Record<string, unknown> | undefined;
126
126
  }>>, ToolDefinition<z.ZodObject<{
127
127
  workflowId: z.ZodString;
128
128
  sessionId: z.ZodString;
129
129
  updates: z.ZodRecord<z.ZodString, z.ZodUnknown>;
130
130
  }, "strip", z.ZodTypeAny, {
131
- workflowId: string;
132
131
  sessionId: string;
132
+ workflowId: string;
133
133
  updates: Record<string, unknown>;
134
134
  }, {
135
- workflowId: string;
136
135
  sessionId: string;
136
+ workflowId: string;
137
137
  updates: Record<string, unknown>;
138
138
  }>>, ToolDefinition<z.ZodObject<{
139
139
  workflowId: z.ZodString;
140
140
  sessionId: z.ZodString;
141
141
  path: z.ZodOptional<z.ZodString>;
142
142
  }, "strip", z.ZodTypeAny, {
143
- workflowId: string;
144
143
  sessionId: string;
144
+ workflowId: string;
145
145
  path?: string | undefined;
146
146
  }, {
147
- workflowId: string;
148
147
  sessionId: string;
148
+ workflowId: string;
149
149
  path?: string | undefined;
150
150
  }>>, ToolDefinition<z.ZodObject<{
151
151
  sessionId: z.ZodOptional<z.ZodString>;
@@ -38,6 +38,7 @@ exports.interpolateGoalTemplate = interpolateGoalTemplate;
38
38
  const crypto = __importStar(require("node:crypto"));
39
39
  const node_child_process_1 = require("node:child_process");
40
40
  const node_util_1 = require("node:util");
41
+ const assert_never_js_1 = require("../runtime/assert-never.js");
41
42
  const index_js_1 = require("../v2/infra/in-memory/keyed-async-queue/index.js");
42
43
  const delivery_client_js_1 = require("./delivery-client.js");
43
44
  const delivery_action_js_1 = require("./delivery-action.js");
@@ -298,10 +299,13 @@ class TriggerRouter {
298
299
  console.log(`[TriggerRouter] Workflow timed out: triggerId=${trigger.id} ` +
299
300
  `workflowId=${trigger.workflowId} reason=${result.reason} message=${result.message}`);
300
301
  }
301
- else {
302
+ else if (result._tag === 'error') {
302
303
  console.log(`[TriggerRouter] Workflow failed: triggerId=${trigger.id} ` +
303
304
  `workflowId=${trigger.workflowId} error=${result.message} stopReason=${result.stopReason}`);
304
305
  }
306
+ else {
307
+ (0, assert_never_js_1.assertNever)(result);
308
+ }
305
309
  this.notificationService?.notify(result, workflowTrigger.goal);
306
310
  await maybeRunDelivery(trigger.id, trigger, originalResult, this.execFn);
307
311
  });
@@ -334,10 +338,13 @@ class TriggerRouter {
334
338
  console.log(`[TriggerRouter] Dispatch timed out: workflowId=${workflowTrigger.workflowId} ` +
335
339
  `reason=${result.reason} message=${result.message}`);
336
340
  }
337
- else {
341
+ else if (result._tag === 'error') {
338
342
  console.log(`[TriggerRouter] Dispatch failed: workflowId=${workflowTrigger.workflowId} ` +
339
343
  `error=${result.message} stopReason=${result.stopReason}`);
340
344
  }
345
+ else {
346
+ (0, assert_never_js_1.assertNever)(result);
347
+ }
341
348
  this.notificationService?.notify(result, workflowTrigger.goal);
342
349
  });
343
350
  return workflowTrigger.workflowId;
@@ -46,6 +46,5 @@ export declare function createCustomDirectorySource(directoryPath: string, label
46
46
  export declare function createGitRepositorySource(repositoryUrl: string, branch: string, localCachePath: string): GitRepositorySource;
47
47
  export declare function createRemoteRegistrySource(registryUrl: string): RemoteRegistrySource;
48
48
  export declare function createPluginSource(pluginName: string, pluginVersion: string): PluginSource;
49
- export declare function assertNever(x: never): never;
50
49
  export declare function getSourceDisplayName(source: WorkflowSource): string;
51
50
  export declare function getSourcePath(source: WorkflowSource): string | undefined;
@@ -15,9 +15,9 @@ exports.createCustomDirectorySource = createCustomDirectorySource;
15
15
  exports.createGitRepositorySource = createGitRepositorySource;
16
16
  exports.createRemoteRegistrySource = createRemoteRegistrySource;
17
17
  exports.createPluginSource = createPluginSource;
18
- exports.assertNever = assertNever;
19
18
  exports.getSourceDisplayName = getSourceDisplayName;
20
19
  exports.getSourcePath = getSourcePath;
20
+ const assert_never_js_1 = require("../runtime/assert-never.js");
21
21
  exports.WORKFLOW_SOURCE_KINDS = [
22
22
  'bundled',
23
23
  'user',
@@ -69,9 +69,6 @@ function createRemoteRegistrySource(registryUrl) {
69
69
  function createPluginSource(pluginName, pluginVersion) {
70
70
  return Object.freeze({ kind: 'plugin', pluginName, pluginVersion });
71
71
  }
72
- function assertNever(x) {
73
- throw new Error(`Unexpected source kind: ${JSON.stringify(x)}`);
74
- }
75
72
  function getSourceDisplayName(source) {
76
73
  switch (source.kind) {
77
74
  case 'bundled':
@@ -89,7 +86,7 @@ function getSourceDisplayName(source) {
89
86
  case 'plugin':
90
87
  return source.pluginName;
91
88
  default:
92
- return assertNever(source);
89
+ return (0, assert_never_js_1.assertNever)(source);
93
90
  }
94
91
  }
95
92
  function getSourcePath(source) {
@@ -105,7 +102,7 @@ function getSourcePath(source) {
105
102
  case 'plugin':
106
103
  return undefined;
107
104
  default:
108
- return assertNever(source);
105
+ return (0, assert_never_js_1.assertNever)(source);
109
106
  }
110
107
  }
111
108
  function extractRepoName(url) {
@@ -28,4 +28,4 @@ export declare function isWorkflowDefinition(obj: unknown): obj is WorkflowDefin
28
28
  export type { WorkflowDefinition, WorkflowStepDefinition, LoopStepDefinition, LoopConfigDefinition, FunctionDefinition, FunctionParameter, FunctionCall } from './workflow-definition';
29
29
  export { isLoopStepDefinition, isWorkflowStepDefinition, hasWorkflowDefinitionShape } from './workflow-definition';
30
30
  export type { WorkflowSource, WorkflowSourceKind, BundledSource, UserDirectorySource, ProjectDirectorySource, CustomDirectorySource, GitRepositorySource, RemoteRegistrySource, PluginSource } from './workflow-source';
31
- export { WORKFLOW_SOURCE_KINDS, createBundledSource, createUserDirectorySource, createProjectDirectorySource, createCustomDirectorySource, createGitRepositorySource, createRemoteRegistrySource, createPluginSource, getSourceDisplayName, getSourcePath, assertNever } from './workflow-source';
31
+ export { WORKFLOW_SOURCE_KINDS, createBundledSource, createUserDirectorySource, createProjectDirectorySource, createCustomDirectorySource, createGitRepositorySource, createRemoteRegistrySource, createPluginSource, getSourceDisplayName, getSourcePath, } from './workflow-source';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertNever = exports.getSourcePath = exports.getSourceDisplayName = exports.createPluginSource = exports.createRemoteRegistrySource = exports.createGitRepositorySource = exports.createCustomDirectorySource = exports.createProjectDirectorySource = exports.createUserDirectorySource = exports.createBundledSource = exports.WORKFLOW_SOURCE_KINDS = exports.hasWorkflowDefinitionShape = exports.isWorkflowStepDefinition = exports.isLoopStepDefinition = void 0;
3
+ exports.getSourcePath = exports.getSourceDisplayName = exports.createPluginSource = exports.createRemoteRegistrySource = exports.createGitRepositorySource = exports.createCustomDirectorySource = exports.createProjectDirectorySource = exports.createUserDirectorySource = exports.createBundledSource = exports.WORKFLOW_SOURCE_KINDS = exports.hasWorkflowDefinitionShape = exports.isWorkflowStepDefinition = exports.isLoopStepDefinition = void 0;
4
4
  exports.createWorkflow = createWorkflow;
5
5
  exports.toWorkflowSummary = toWorkflowSummary;
6
6
  exports.toWorkflowSourceInfo = toWorkflowSourceInfo;
@@ -102,4 +102,3 @@ Object.defineProperty(exports, "createRemoteRegistrySource", { enumerable: true,
102
102
  Object.defineProperty(exports, "createPluginSource", { enumerable: true, get: function () { return workflow_source_2.createPluginSource; } });
103
103
  Object.defineProperty(exports, "getSourceDisplayName", { enumerable: true, get: function () { return workflow_source_2.getSourceDisplayName; } });
104
104
  Object.defineProperty(exports, "getSourcePath", { enumerable: true, get: function () { return workflow_source_2.getSourcePath; } });
105
- Object.defineProperty(exports, "assertNever", { enumerable: true, get: function () { return workflow_source_2.assertNever; } });
@@ -21,6 +21,10 @@ function validateArtifactContract(artifacts, contract) {
21
21
  switch (contractRef) {
22
22
  case index_js_1.LOOP_CONTROL_CONTRACT_REF:
23
23
  return validateLoopControlContract(artifacts, contractRef, required);
24
+ case index_js_1.COORDINATOR_SIGNAL_CONTRACT_REF:
25
+ return validateCoordinatorSignalContract(artifacts, contractRef, required);
26
+ case index_js_1.REVIEW_VERDICT_CONTRACT_REF:
27
+ return validateReviewVerdictContract(artifacts, contractRef, required);
24
28
  default:
25
29
  return {
26
30
  valid: false,
@@ -63,6 +67,68 @@ function validateLoopControlContract(artifacts, contractRef, required) {
63
67
  }
64
68
  return { valid: true, artifact: parseResult.data };
65
69
  }
70
+ function validateCoordinatorSignalContract(artifacts, contractRef, required) {
71
+ const signalArtifacts = artifacts.filter(index_js_1.isCoordinatorSignalArtifact);
72
+ if (signalArtifacts.length === 0) {
73
+ if (required) {
74
+ return {
75
+ valid: false,
76
+ error: {
77
+ code: 'MISSING_REQUIRED_ARTIFACT',
78
+ contractRef,
79
+ message: `Required artifact missing: ${contractRef}. Agent must provide an artifact with kind='wr.coordinator_signal'.`,
80
+ },
81
+ };
82
+ }
83
+ return { valid: true, artifact: null };
84
+ }
85
+ const artifact = signalArtifacts[0];
86
+ const parseResult = index_js_1.CoordinatorSignalArtifactV1Schema.safeParse(artifact);
87
+ if (!parseResult.success) {
88
+ const issues = parseResult.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`);
89
+ return {
90
+ valid: false,
91
+ error: {
92
+ code: 'INVALID_ARTIFACT_SCHEMA',
93
+ contractRef,
94
+ message: `Artifact schema validation failed for ${contractRef}`,
95
+ issues,
96
+ },
97
+ };
98
+ }
99
+ return { valid: true, artifact: parseResult.data };
100
+ }
101
+ function validateReviewVerdictContract(artifacts, contractRef, required) {
102
+ const verdictArtifacts = artifacts.filter(index_js_1.isReviewVerdictArtifact);
103
+ if (verdictArtifacts.length === 0) {
104
+ if (required) {
105
+ return {
106
+ valid: false,
107
+ error: {
108
+ code: 'MISSING_REQUIRED_ARTIFACT',
109
+ contractRef,
110
+ message: `Required artifact missing: ${contractRef}. Agent must provide an artifact with kind='wr.review_verdict'.`,
111
+ },
112
+ };
113
+ }
114
+ return { valid: true, artifact: null };
115
+ }
116
+ const artifact = verdictArtifacts[0];
117
+ const parseResult = index_js_1.ReviewVerdictArtifactV1Schema.safeParse(artifact);
118
+ if (!parseResult.success) {
119
+ const issues = parseResult.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`);
120
+ return {
121
+ valid: false,
122
+ error: {
123
+ code: 'INVALID_ARTIFACT_SCHEMA',
124
+ contractRef,
125
+ message: `Artifact schema validation failed for ${contractRef}`,
126
+ issues,
127
+ },
128
+ };
129
+ }
130
+ return { valid: true, artifact: parseResult.data };
131
+ }
66
132
  function requiresArtifactValidation(outputContract) {
67
133
  if (!outputContract)
68
134
  return false;
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const COORDINATOR_SIGNAL_CONTRACT_REF: "wr.contracts.coordinator_signal";
3
+ export declare const CoordinatorSignalKindSchema: z.ZodEnum<["progress", "finding", "data_needed", "approval_needed", "blocked"]>;
4
+ export type CoordinatorSignalKind = z.infer<typeof CoordinatorSignalKindSchema>;
5
+ export declare const CoordinatorSignalArtifactV1Schema: z.ZodObject<{
6
+ kind: z.ZodLiteral<"wr.coordinator_signal">;
7
+ signalKind: z.ZodEnum<["progress", "finding", "data_needed", "approval_needed", "blocked"]>;
8
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9
+ sessionId: z.ZodOptional<z.ZodString>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ kind: "wr.coordinator_signal";
12
+ signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
13
+ payload: Record<string, unknown>;
14
+ sessionId?: string | undefined;
15
+ }, {
16
+ kind: "wr.coordinator_signal";
17
+ signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
18
+ payload: Record<string, unknown>;
19
+ sessionId?: string | undefined;
20
+ }>;
21
+ export type CoordinatorSignalArtifactV1 = z.infer<typeof CoordinatorSignalArtifactV1Schema>;
22
+ export declare function isCoordinatorSignalArtifact(artifact: unknown): artifact is {
23
+ readonly kind: 'wr.coordinator_signal';
24
+ };
25
+ export declare function parseCoordinatorSignalArtifact(artifact: unknown): CoordinatorSignalArtifactV1 | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoordinatorSignalArtifactV1Schema = exports.CoordinatorSignalKindSchema = exports.COORDINATOR_SIGNAL_CONTRACT_REF = void 0;
4
+ exports.isCoordinatorSignalArtifact = isCoordinatorSignalArtifact;
5
+ exports.parseCoordinatorSignalArtifact = parseCoordinatorSignalArtifact;
6
+ const zod_1 = require("zod");
7
+ exports.COORDINATOR_SIGNAL_CONTRACT_REF = 'wr.contracts.coordinator_signal';
8
+ exports.CoordinatorSignalKindSchema = zod_1.z.enum([
9
+ 'progress',
10
+ 'finding',
11
+ 'data_needed',
12
+ 'approval_needed',
13
+ 'blocked',
14
+ ]);
15
+ exports.CoordinatorSignalArtifactV1Schema = zod_1.z
16
+ .object({
17
+ kind: zod_1.z.literal('wr.coordinator_signal'),
18
+ signalKind: exports.CoordinatorSignalKindSchema,
19
+ payload: zod_1.z.record(zod_1.z.unknown()),
20
+ sessionId: zod_1.z.string().optional(),
21
+ })
22
+ .strict();
23
+ function isCoordinatorSignalArtifact(artifact) {
24
+ return (typeof artifact === 'object' &&
25
+ artifact !== null &&
26
+ artifact.kind === 'wr.coordinator_signal');
27
+ }
28
+ function parseCoordinatorSignalArtifact(artifact) {
29
+ const result = exports.CoordinatorSignalArtifactV1Schema.safeParse(artifact);
30
+ return result.success ? result.data : null;
31
+ }
@@ -1,5 +1,7 @@
1
1
  export { ASSESSMENT_CONTRACT_REF, AssessmentArtifactV1Schema, AssessmentDimensionSubmissionSchema, isAssessmentArtifact, parseAssessmentArtifact, type AssessmentArtifactV1, type AssessmentDimensionSubmission, } from './assessment.js';
2
2
  export { LOOP_CONTROL_CONTRACT_REF, LoopControlDecisionSchema, LoopControlMetadataV1Schema, LoopControlArtifactV1Schema, isLoopControlArtifact, parseLoopControlArtifact, findLoopControlArtifact, type LoopControlDecision, type LoopControlMetadataV1, type LoopControlArtifactV1, } from './loop-control.js';
3
- export declare const ARTIFACT_CONTRACT_REFS: readonly ["wr.contracts.assessment", "wr.contracts.loop_control"];
3
+ export { COORDINATOR_SIGNAL_CONTRACT_REF, CoordinatorSignalKindSchema, CoordinatorSignalArtifactV1Schema, isCoordinatorSignalArtifact, parseCoordinatorSignalArtifact, type CoordinatorSignalKind, type CoordinatorSignalArtifactV1, } from './coordinator-signal.js';
4
+ export { REVIEW_VERDICT_CONTRACT_REF, ReviewVerdictArtifactV1Schema, isReviewVerdictArtifact, parseReviewVerdictArtifact, type ReviewVerdictArtifactV1, } from './review-verdict.js';
5
+ export declare const ARTIFACT_CONTRACT_REFS: readonly ["wr.contracts.assessment", "wr.contracts.loop_control", "wr.contracts.coordinator_signal", "wr.contracts.review_verdict"];
4
6
  export type ArtifactContractRef = (typeof ARTIFACT_CONTRACT_REFS)[number];
5
7
  export declare function isValidContractRef(ref: string): ref is ArtifactContractRef;