workspai 0.62.0 → 0.64.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 (98) hide show
  1. package/contracts/create-planner-capabilities.v1.json +251 -8
  2. package/contracts/studio-card-repair-capabilities.v1.json +65 -1
  3. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +28 -0
  4. package/dist/analyze-NUGNB256.js +1 -0
  5. package/dist/{artifact-remediation-plan-HPNQTNJ2.js → artifact-remediation-plan-XIQNI35L.js} +1 -1
  6. package/dist/autopilot-release-TWJWSVVF.js +1 -0
  7. package/dist/capabilities-command-LHM3XIS6.js +1 -0
  8. package/dist/chunk-2VJUAKMS.js +2 -0
  9. package/dist/{chunk-O6R7SE6Y.js → chunk-3A23KJAQ.js} +1 -1
  10. package/dist/{chunk-GGOQHTZV.js → chunk-5B2GAZAC.js} +1 -1
  11. package/dist/{chunk-PPQL5UTI.js → chunk-6DAQ7PYT.js} +1 -1
  12. package/dist/{chunk-HS3DJMU5.js → chunk-6TBTMWNA.js} +1 -1
  13. package/dist/{chunk-46USUSIK.js → chunk-CCAXADKP.js} +26 -26
  14. package/dist/chunk-CJHWKXDN.js +1 -0
  15. package/dist/{chunk-NBJ6AP7K.js → chunk-CT4IODPG.js} +1 -1
  16. package/dist/{chunk-UZNACYV7.js → chunk-DK6JNE6K.js} +1 -1
  17. package/dist/{chunk-3VU7ROHY.js → chunk-DOXNVBX6.js} +1 -1
  18. package/dist/{chunk-A4BK7C7M.js → chunk-DWB2RRF4.js} +1 -1
  19. package/dist/{chunk-VDEFHP6I.js → chunk-FQSBOLM7.js} +1 -1
  20. package/dist/chunk-GQSRNUCU.js +105 -0
  21. package/dist/chunk-ISOOENLW.js +8 -0
  22. package/dist/chunk-J7RU5WR5.js +2 -0
  23. package/dist/{chunk-DIJGQUEV.js → chunk-JQLJBK5N.js} +1 -1
  24. package/dist/chunk-KANAJH65.js +681 -0
  25. package/dist/{chunk-JNPXLZA6.js → chunk-KJXMLBSY.js} +1 -1
  26. package/dist/{chunk-VRQLHCE2.js → chunk-KV6PS54A.js} +1 -1
  27. package/dist/{chunk-GPOZILMY.js → chunk-L22EABIC.js} +1 -1
  28. package/dist/{chunk-GPGEJVVO.js → chunk-NHTDPXTW.js} +1 -1
  29. package/dist/{chunk-KG3TUTXU.js → chunk-Q2WF7D5U.js} +1 -1
  30. package/dist/chunk-RGNCL5OB.js +1 -0
  31. package/dist/{chunk-TVCJKE2U.js → chunk-RSG2GJXT.js} +1 -1
  32. package/dist/{chunk-KCJ3VS6R.js → chunk-SFO5GVRT.js} +1 -1
  33. package/dist/{chunk-MWCKJOOU.js → chunk-TOYN76K4.js} +1 -1
  34. package/dist/chunk-U5WVR74V.js +1 -0
  35. package/dist/{chunk-W3HXTCSY.js → chunk-UXEO5QCF.js} +1 -1
  36. package/dist/{chunk-PKKP5H3T.js → chunk-VB6I52ZT.js} +3 -3
  37. package/dist/{chunk-QJCCZLOF.js → chunk-VRGEPPUB.js} +1 -1
  38. package/dist/chunk-VYDURWN7.js +1 -0
  39. package/dist/chunk-WRQWVSBJ.js +3 -0
  40. package/dist/{chunk-SS7NJMFL.js → chunk-WY4DOMEA.js} +1 -1
  41. package/dist/{chunk-ZCPT6KC3.js → chunk-XKDR5BGS.js} +6 -6
  42. package/dist/{chunk-E4LJ3PQD.js → chunk-ZGS5NKEO.js} +1 -1
  43. package/dist/chunk-ZH7CXQH3.js +94 -0
  44. package/dist/create-PWJDTKDN.js +1 -0
  45. package/dist/{doctor-MAPZ2ZCD.js → doctor-CGXY4IDE.js} +1 -1
  46. package/dist/{goal-lifecycle-7L5JFYOI.js → goal-lifecycle-BRFFTIU2.js} +1 -1
  47. package/dist/{goal-pack-SGHXUPMU.js → goal-pack-FG3QDNQH.js} +1 -1
  48. package/dist/index.d.ts +2 -1
  49. package/dist/index.js +161 -157
  50. package/dist/{pipeline-W2CKUZBS.js → pipeline-DF4UIHAD.js} +1 -1
  51. package/dist/{platform-capabilities-PR6YL4KC.js → platform-capabilities-DB4BZPTD.js} +1 -1
  52. package/dist/{project-agent-entry-66GTQQPX.js → project-agent-entry-IWUCV72J.js} +1 -1
  53. package/dist/{project-intelligence-lens-NWNWLJMB.js → project-intelligence-lens-PZPPSCUW.js} +1 -1
  54. package/dist/{project-test-coverage-E2Q4QL44.js → project-test-coverage-4S7MEQ6T.js} +1 -1
  55. package/dist/{pythonRapidkitExec-4YTAMLBD.js → pythonRapidkitExec-VAW5XE4Z.js} +1 -1
  56. package/dist/{verified-goal-AY5VU6LG.js → verified-goal-BBHZRYYH.js} +1 -1
  57. package/dist/{workspace-FSOLFNAJ.js → workspace-35Q2IXAR.js} +1 -1
  58. package/dist/{workspace-agent-sync-ZURWHL3H.js → workspace-agent-sync-FFNSW2PD.js} +1 -1
  59. package/dist/{workspace-context-DPDGFTWJ.js → workspace-context-IJ36ZP6G.js} +1 -1
  60. package/dist/{workspace-contract-3BWIRSVQ.js → workspace-contract-JS4LZZQZ.js} +1 -1
  61. package/dist/{workspace-explain-OU2PEVYO.js → workspace-explain-TITIT5XN.js} +1 -1
  62. package/dist/workspace-foundation-GMGDUMPR.js +1 -0
  63. package/dist/{workspace-graph-stream-XTSDKRLM.js → workspace-graph-stream-7UU2YVHC.js} +1 -1
  64. package/dist/{workspace-intelligence-625UN27X.js → workspace-intelligence-5NO4K5SC.js} +1 -1
  65. package/dist/{workspace-intelligence-runner-7RIOUCCM.js → workspace-intelligence-runner-FGEBFVVM.js} +1 -1
  66. package/dist/{workspace-knowledge-graph-3ZBPSAS7.js → workspace-knowledge-graph-RSDP2E36.js} +1 -1
  67. package/dist/workspace-knowledge-graph-snapshot-3FJHH5IK.js +1 -0
  68. package/dist/{workspace-mcp-serve-PYKYJIE6.js → workspace-mcp-serve-WUIQ2AE6.js} +1 -1
  69. package/dist/{workspace-model-ETCLINRB.js → workspace-model-OKY4CQ3X.js} +1 -1
  70. package/dist/{workspace-onboarding-RP3RZ3CC.js → workspace-onboarding-VS3YYNGK.js} +1 -1
  71. package/dist/{workspace-registry-summary-VSOBKAJG.js → workspace-registry-summary-MIDFG6EC.js} +1 -1
  72. package/dist/workspace-repair-engine-VUBT77Y7.js +3 -0
  73. package/dist/workspace-run-SSF6Z26G.js +1 -0
  74. package/dist/{workspace-verify-7ENGIY4S.js → workspace-verify-4R7QHUPO.js} +1 -1
  75. package/dist/{workspace-watch-2YFSB2WL.js → workspace-watch-IOPSHQS5.js} +1 -1
  76. package/docs/ci-workflows.md +1 -1
  77. package/docs/creating-workspaces-and-projects.md +49 -8
  78. package/docs/real-world-qualification.md +7 -0
  79. package/package.json +1 -1
  80. package/dist/analyze-K6JDMF5C.js +0 -1
  81. package/dist/autopilot-release-GNTOXKIL.js +0 -1
  82. package/dist/capabilities-command-VBLZXP2T.js +0 -1
  83. package/dist/chunk-7DSYI7YN.js +0 -3
  84. package/dist/chunk-BQCGULHR.js +0 -1
  85. package/dist/chunk-NA2NXX5P.js +0 -1
  86. package/dist/chunk-NVQUBUTY.js +0 -2
  87. package/dist/chunk-PTNLVI62.js +0 -16
  88. package/dist/chunk-PVXSIYLP.js +0 -1
  89. package/dist/chunk-RJIYCDVC.js +0 -1
  90. package/dist/chunk-SCP5LJNO.js +0 -2
  91. package/dist/chunk-TFOOSYGO.js +0 -8
  92. package/dist/chunk-TR6OFSJM.js +0 -691
  93. package/dist/chunk-VDFHUYAQ.js +0 -91
  94. package/dist/create-CKUQRSJF.js +0 -1
  95. package/dist/workspace-foundation-PPZKC36U.js +0 -1
  96. package/dist/workspace-knowledge-graph-snapshot-ZI4W735H.js +0 -1
  97. package/dist/workspace-repair-engine-L47XZXYZ.js +0 -3
  98. package/dist/workspace-run-QV5ER2VW.js +0 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": "workspai.studio-card-repair-capabilities.v1",
3
- "invariant": "A card repair starts with its declared repairPolicy but every unresolved policy path transfers to governed causal source repair. It closes only after its exact producer refreshes, its selected causal action set is absent, and aggregate Workspace Verify completes without an execution failure. Unrelated workspace blockers are reported separately and do not reopen the selected card.",
3
+ "invariant": "An aggregate card is a presentation boundary, never a mutation boundary. Blocking findings form a deterministic sequential causal queue; each CLI transaction owns exactly one causal finding family and one canonical project unless declared dependencies require a bounded cross-project closure. Advisory and informational findings never widen that queue. A card repair starts with its declared repairPolicy but every unresolved policy path transfers to governed causal source repair. After each exact target closes, fresh evidence selects the next target. The card closes only after its exact producer refreshes, no selected causal action remains, and aggregate Workspace Verify completes without an execution failure. Unrelated workspace blockers are reported separately and do not reopen the selected card.",
4
4
  "cards": [
5
5
  {
6
6
  "cardId": "doctor",
@@ -11,6 +11,8 @@
11
11
  "verifyArtifact": ".workspai/reports/doctor-last-run.json",
12
12
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
13
13
  "targetClosure": "exact-producer-and-causal-action-set",
14
+ "aggregateRepair": "sequential-causal-queue",
15
+ "transactionScope": "one-causal-finding-family",
14
16
  "workspacePosture": "reported-separately",
15
17
  "repairPolicy": "diagnose-and-repair",
16
18
  "remediationArtifacts": [
@@ -27,6 +29,8 @@
27
29
  "verifyArtifact": ".workspai/reports/doctor-project-last-run.json",
28
30
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
29
31
  "targetClosure": "exact-producer-and-causal-action-set",
32
+ "aggregateRepair": "sequential-causal-queue",
33
+ "transactionScope": "one-causal-finding-family",
30
34
  "workspacePosture": "reported-separately",
31
35
  "repairPolicy": "diagnose-and-repair",
32
36
  "remediationArtifacts": [
@@ -43,6 +47,8 @@
43
47
  "verifyArtifact": ".workspai/reports/pipeline-last-run.json",
44
48
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
45
49
  "targetClosure": "exact-producer-and-causal-action-set",
50
+ "aggregateRepair": "sequential-causal-queue",
51
+ "transactionScope": "one-causal-finding-family",
46
52
  "workspacePosture": "reported-separately",
47
53
  "repairPolicy": "source-repair-then-produce",
48
54
  "remediationArtifacts": [
@@ -58,6 +64,8 @@
58
64
  "verifyArtifact": ".workspai/reports/analyze-last-run.json",
59
65
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
60
66
  "targetClosure": "exact-producer-and-causal-action-set",
67
+ "aggregateRepair": "sequential-causal-queue",
68
+ "transactionScope": "one-causal-finding-family",
61
69
  "workspacePosture": "reported-separately",
62
70
  "repairPolicy": "source-repair-then-produce",
63
71
  "remediationArtifacts": [
@@ -73,6 +81,8 @@
73
81
  "verifyArtifact": ".workspai/reports/release-readiness-last-run.json",
74
82
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
75
83
  "targetClosure": "exact-producer-and-causal-action-set",
84
+ "aggregateRepair": "sequential-causal-queue",
85
+ "transactionScope": "one-causal-finding-family",
76
86
  "workspacePosture": "reported-separately",
77
87
  "repairPolicy": "source-repair-then-produce",
78
88
  "remediationArtifacts": [
@@ -88,6 +98,8 @@
88
98
  "verifyArtifact": ".workspai/reports/bootstrap-compliance.latest.json",
89
99
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
90
100
  "targetClosure": "exact-producer-and-causal-action-set",
101
+ "aggregateRepair": "sequential-causal-queue",
102
+ "transactionScope": "one-causal-finding-family",
91
103
  "workspacePosture": "reported-separately",
92
104
  "repairPolicy": "source-repair-then-produce",
93
105
  "remediationArtifacts": [
@@ -103,6 +115,8 @@
103
115
  "verifyArtifact": ".workspai/workspace-registry.v1.json",
104
116
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
105
117
  "targetClosure": "exact-producer-and-causal-action-set",
118
+ "aggregateRepair": "sequential-causal-queue",
119
+ "transactionScope": "one-causal-finding-family",
106
120
  "workspacePosture": "reported-separately",
107
121
  "repairPolicy": "refresh-producer",
108
122
  "remediationArtifacts": []
@@ -116,6 +130,8 @@
116
130
  "verifyArtifact": ".workspai/workspace.json",
117
131
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
118
132
  "targetClosure": "exact-producer-and-causal-action-set",
133
+ "aggregateRepair": "sequential-causal-queue",
134
+ "transactionScope": "one-causal-finding-family",
119
135
  "workspacePosture": "reported-separately",
120
136
  "repairPolicy": "refresh-producer",
121
137
  "remediationArtifacts": []
@@ -129,6 +145,8 @@
129
145
  "verifyArtifact": ".workspai/reports/workspace-contract-verify-last-run.json",
130
146
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
131
147
  "targetClosure": "exact-producer-and-causal-action-set",
148
+ "aggregateRepair": "sequential-causal-queue",
149
+ "transactionScope": "one-causal-finding-family",
132
150
  "workspacePosture": "reported-separately",
133
151
  "repairPolicy": "source-repair-then-produce",
134
152
  "remediationArtifacts": []
@@ -142,6 +160,8 @@
142
160
  "verifyArtifact": ".workspai/reports/autopilot-release-last-run.json",
143
161
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
144
162
  "targetClosure": "exact-producer-and-causal-action-set",
163
+ "aggregateRepair": "sequential-causal-queue",
164
+ "transactionScope": "one-causal-finding-family",
145
165
  "workspacePosture": "reported-separately",
146
166
  "repairPolicy": "source-repair-then-produce",
147
167
  "remediationArtifacts": []
@@ -155,6 +175,8 @@
155
175
  "verifyArtifact": ".workspai/reports/workspace-run-last.json",
156
176
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
157
177
  "targetClosure": "exact-producer-and-causal-action-set",
178
+ "aggregateRepair": "sequential-causal-queue",
179
+ "transactionScope": "one-causal-finding-family",
158
180
  "workspacePosture": "reported-separately",
159
181
  "repairPolicy": "source-repair-then-produce",
160
182
  "remediationArtifacts": [
@@ -170,6 +192,8 @@
170
192
  "verifyArtifact": ".workspai/toolchain.lock",
171
193
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
172
194
  "targetClosure": "exact-producer-and-causal-action-set",
195
+ "aggregateRepair": "sequential-causal-queue",
196
+ "transactionScope": "one-causal-finding-family",
173
197
  "workspacePosture": "reported-separately",
174
198
  "repairPolicy": "source-repair-then-produce",
175
199
  "remediationArtifacts": []
@@ -183,6 +207,8 @@
183
207
  "verifyArtifact": ".workspai/reports/doctor-project-last-run.json",
184
208
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
185
209
  "targetClosure": "exact-producer-and-causal-action-set",
210
+ "aggregateRepair": "sequential-causal-queue",
211
+ "transactionScope": "one-causal-finding-family",
186
212
  "workspacePosture": "reported-separately",
187
213
  "repairPolicy": "diagnose-and-repair",
188
214
  "remediationArtifacts": [
@@ -198,6 +224,8 @@
198
224
  "verifyArtifact": ".workspai/reports/snapshot-last-run.json",
199
225
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
200
226
  "targetClosure": "exact-producer-and-causal-action-set",
227
+ "aggregateRepair": "sequential-causal-queue",
228
+ "transactionScope": "one-causal-finding-family",
201
229
  "workspacePosture": "reported-separately",
202
230
  "repairPolicy": "refresh-producer",
203
231
  "remediationArtifacts": []
@@ -211,6 +239,8 @@
211
239
  "verifyArtifact": ".workspai/reports/workspace-model.json",
212
240
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
213
241
  "targetClosure": "exact-producer-and-causal-action-set",
242
+ "aggregateRepair": "sequential-causal-queue",
243
+ "transactionScope": "one-causal-finding-family",
214
244
  "workspacePosture": "reported-separately",
215
245
  "repairPolicy": "refresh-producer",
216
246
  "remediationArtifacts": []
@@ -224,6 +254,8 @@
224
254
  "verifyArtifact": ".workspai/reports/workspace-model-snapshot.json",
225
255
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
226
256
  "targetClosure": "exact-producer-and-causal-action-set",
257
+ "aggregateRepair": "sequential-causal-queue",
258
+ "transactionScope": "one-causal-finding-family",
227
259
  "workspacePosture": "reported-separately",
228
260
  "repairPolicy": "refresh-producer",
229
261
  "remediationArtifacts": []
@@ -237,6 +269,8 @@
237
269
  "verifyArtifact": ".workspai/reports/workspace-model-diff-last-run.json",
238
270
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
239
271
  "targetClosure": "exact-producer-and-causal-action-set",
272
+ "aggregateRepair": "sequential-causal-queue",
273
+ "transactionScope": "one-causal-finding-family",
240
274
  "workspacePosture": "reported-separately",
241
275
  "repairPolicy": "refresh-producer",
242
276
  "remediationArtifacts": []
@@ -250,6 +284,8 @@
250
284
  "verifyArtifact": ".workspai/reports/workspace-impact-last-run.json",
251
285
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
252
286
  "targetClosure": "exact-producer-and-causal-action-set",
287
+ "aggregateRepair": "sequential-causal-queue",
288
+ "transactionScope": "one-causal-finding-family",
253
289
  "workspacePosture": "reported-separately",
254
290
  "repairPolicy": "refresh-producer",
255
291
  "remediationArtifacts": []
@@ -263,6 +299,8 @@
263
299
  "verifyArtifact": ".workspai/reports/workspace-intelligence-run-last-run.json",
264
300
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
265
301
  "targetClosure": "exact-producer-and-causal-action-set",
302
+ "aggregateRepair": "sequential-causal-queue",
303
+ "transactionScope": "one-causal-finding-family",
266
304
  "workspacePosture": "reported-separately",
267
305
  "repairPolicy": "source-repair-then-produce",
268
306
  "remediationArtifacts": []
@@ -276,6 +314,8 @@
276
314
  "verifyArtifact": ".workspai/reports/workspace-verify-last-run.json",
277
315
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
278
316
  "targetClosure": "exact-producer-and-causal-action-set",
317
+ "aggregateRepair": "sequential-causal-queue",
318
+ "transactionScope": "one-causal-finding-family",
279
319
  "workspacePosture": "reported-separately",
280
320
  "repairPolicy": "source-repair-then-produce",
281
321
  "remediationArtifacts": [
@@ -291,6 +331,8 @@
291
331
  "verifyArtifact": ".workspai/reports/workspace-explain-last-run.json",
292
332
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
293
333
  "targetClosure": "exact-producer-and-causal-action-set",
334
+ "aggregateRepair": "sequential-causal-queue",
335
+ "transactionScope": "one-causal-finding-family",
294
336
  "workspacePosture": "reported-separately",
295
337
  "repairPolicy": "refresh-producer",
296
338
  "remediationArtifacts": []
@@ -304,6 +346,8 @@
304
346
  "verifyArtifact": ".workspai/reports/workspace-why-last-run.json",
305
347
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
306
348
  "targetClosure": "exact-producer-and-causal-action-set",
349
+ "aggregateRepair": "sequential-causal-queue",
350
+ "transactionScope": "one-causal-finding-family",
307
351
  "workspacePosture": "reported-separately",
308
352
  "repairPolicy": "refresh-producer",
309
353
  "remediationArtifacts": []
@@ -317,6 +361,8 @@
317
361
  "verifyArtifact": ".workspai/reports/workspace-trace-last-run.json",
318
362
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
319
363
  "targetClosure": "exact-producer-and-causal-action-set",
364
+ "aggregateRepair": "sequential-causal-queue",
365
+ "transactionScope": "one-causal-finding-family",
320
366
  "workspacePosture": "reported-separately",
321
367
  "repairPolicy": "refresh-producer",
322
368
  "remediationArtifacts": []
@@ -330,6 +376,8 @@
330
376
  "verifyArtifact": ".workspai/reports/workspace-model.json",
331
377
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
332
378
  "targetClosure": "exact-producer-and-causal-action-set",
379
+ "aggregateRepair": "sequential-causal-queue",
380
+ "transactionScope": "one-causal-finding-family",
333
381
  "workspacePosture": "reported-separately",
334
382
  "repairPolicy": "refresh-producer",
335
383
  "remediationArtifacts": []
@@ -343,6 +391,8 @@
343
391
  "verifyArtifact": ".workspai/reports/workspace-context-agent.json",
344
392
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
345
393
  "targetClosure": "exact-producer-and-causal-action-set",
394
+ "aggregateRepair": "sequential-causal-queue",
395
+ "transactionScope": "one-causal-finding-family",
346
396
  "workspacePosture": "reported-separately",
347
397
  "repairPolicy": "refresh-producer",
348
398
  "remediationArtifacts": []
@@ -356,6 +406,8 @@
356
406
  "verifyArtifact": ".workspai/reports/agent-customization-pack.json",
357
407
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
358
408
  "targetClosure": "exact-producer-and-causal-action-set",
409
+ "aggregateRepair": "sequential-causal-queue",
410
+ "transactionScope": "one-causal-finding-family",
359
411
  "workspacePosture": "reported-separately",
360
412
  "repairPolicy": "refresh-producer",
361
413
  "remediationArtifacts": []
@@ -369,6 +421,8 @@
369
421
  "verifyArtifact": ".workspai/reports/share-bundle.json",
370
422
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
371
423
  "targetClosure": "exact-producer-and-causal-action-set",
424
+ "aggregateRepair": "sequential-causal-queue",
425
+ "transactionScope": "one-causal-finding-family",
372
426
  "workspacePosture": "reported-separately",
373
427
  "repairPolicy": "refresh-producer",
374
428
  "remediationArtifacts": []
@@ -382,6 +436,8 @@
382
436
  "verifyArtifact": ".workspai/archive-manifest.json",
383
437
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
384
438
  "targetClosure": "exact-producer-and-causal-action-set",
439
+ "aggregateRepair": "sequential-causal-queue",
440
+ "transactionScope": "one-causal-finding-family",
385
441
  "workspacePosture": "reported-separately",
386
442
  "repairPolicy": "refresh-producer",
387
443
  "remediationArtifacts": []
@@ -395,6 +451,8 @@
395
451
  "verifyArtifact": ".workspai/reports/mirror-ops.latest.json",
396
452
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
397
453
  "targetClosure": "exact-producer-and-causal-action-set",
454
+ "aggregateRepair": "sequential-causal-queue",
455
+ "transactionScope": "one-causal-finding-family",
398
456
  "workspacePosture": "reported-separately",
399
457
  "repairPolicy": "refresh-producer",
400
458
  "remediationArtifacts": []
@@ -408,6 +466,8 @@
408
466
  "verifyArtifact": ".workspai/cache-config.yml",
409
467
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
410
468
  "targetClosure": "exact-producer-and-causal-action-set",
469
+ "aggregateRepair": "sequential-causal-queue",
470
+ "transactionScope": "one-causal-finding-family",
411
471
  "workspacePosture": "reported-separately",
412
472
  "repairPolicy": "refresh-producer",
413
473
  "remediationArtifacts": []
@@ -421,6 +481,8 @@
421
481
  "verifyArtifact": ".workspai/policies.yml",
422
482
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
423
483
  "targetClosure": "exact-producer-and-causal-action-set",
484
+ "aggregateRepair": "sequential-causal-queue",
485
+ "transactionScope": "one-causal-finding-family",
424
486
  "workspacePosture": "reported-separately",
425
487
  "repairPolicy": "source-repair-then-produce",
426
488
  "remediationArtifacts": []
@@ -434,6 +496,8 @@
434
496
  "verifyArtifact": ".workspai/reports/infra-plan.json",
435
497
  "aggregateVerifyCommand": "npx workspai workspace verify --json",
436
498
  "targetClosure": "exact-producer-and-causal-action-set",
499
+ "aggregateRepair": "sequential-causal-queue",
500
+ "transactionScope": "one-causal-finding-family",
437
501
  "workspacePosture": "reported-separately",
438
502
  "repairPolicy": "source-repair-then-produce",
439
503
  "remediationArtifacts": []
@@ -64,6 +64,34 @@
64
64
  "additionalProperties": false
65
65
  }
66
66
  },
67
+ "selectedTarget": {
68
+ "type": "object",
69
+ "description": "One immutable causal finding target selected from an aggregate card for the next CLI-owned transaction.",
70
+ "required": ["findingId", "actionIds", "repairMode", "sourceMutation"],
71
+ "properties": {
72
+ "findingId": { "type": "string", "minLength": 1 },
73
+ "causalKey": { "type": "string", "minLength": 1 },
74
+ "actionIds": {
75
+ "type": "array",
76
+ "minItems": 1,
77
+ "uniqueItems": true,
78
+ "items": { "type": "string", "minLength": 1 }
79
+ },
80
+ "sourcePaths": {
81
+ "type": "array",
82
+ "uniqueItems": true,
83
+ "items": { "type": "string", "minLength": 1 }
84
+ },
85
+ "projectName": { "type": "string", "minLength": 1 },
86
+ "projectPath": { "type": "string", "minLength": 1 },
87
+ "repairMode": {
88
+ "enum": ["edit-file", "run-command", "refresh-evidence", "verify-before-fix", "manual-guidance"]
89
+ },
90
+ "sourceMutation": { "enum": ["required", "allowed", "forbidden"] },
91
+ "verifyCommand": { "type": "string", "minLength": 1 }
92
+ },
93
+ "additionalProperties": false
94
+ },
67
95
  "artifactPath": {
68
96
  "type": "string"
69
97
  },
@@ -0,0 +1 @@
1
+ export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-KV6PS54A.js';
@@ -1 +1 @@
1
- export{a as buildArtifactRemediationPlan,b as writeArtifactRemediationPlan}from'./chunk-7DSYI7YN.js';
1
+ export{a as buildArtifactRemediationPlan,b as writeArtifactRemediationPlan}from'./chunk-WRQWVSBJ.js';
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-KJXMLBSY.js';
@@ -0,0 +1 @@
1
+ export{b as runDoctorCapabilities}from'./chunk-6TBTMWNA.js';
@@ -0,0 +1,2 @@
1
+ import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k,q}from'./chunk-GQSRNUCU.js';import {c,i}from'./chunk-J7RU5WR5.js';import {a}from'./chunk-T5YRFRJV.js';import {j as j$2}from'./chunk-XKDR5BGS.js';import {e,f as f$1}from'./chunk-X6TNBARH.js';import {b}from'./chunk-UJXE4UAX.js';import {l,s,j as j$1,t,k as k$2}from'./chunk-MOSXTVPU.js';import ce,{promises}from'fs';import c$1 from'path';import T,{homedir}from'os';import {pathToFileURL}from'url';import m from'process';import k$1 from'fs-extra';function z(o){let t=o.label.indexOf(" \u2014 ");return t>=0?o.label.slice(t+3).trim():o.label.trim()}function Q(){let o=c().map(n=>({value:n.id,label:`${K(n.category)} \xB7 ${z(n)}`,hint:`${n.runtime} \xB7 tested baseline`,name:n.label})),e=k().map(n=>({value:n.kitId,label:`Frontend \xB7 ${n.displayName}`,hint:"official \xB7 latest stable",name:`${n.displayName} \u2014 ${n.framework}`})),t=q().map(n=>({value:n.kitId,label:`${K(n.category)} \xB7 ${n.displayName}`,hint:`${n.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${n.displayName} \u2014 ${n.category}`})),i=[...o,...e,...t].sort((n,r)=>{let s=["Backend","Frontend","Desktop","Extension"],a=n.label?.split(" \xB7 ")[0]??"",l=r.label?.split(" \xB7 ")[0]??"";return s.indexOf(a)-s.indexOf(l)||(n.label??"").localeCompare(r.label??"")});return D(i),i}function K(o){return o.charAt(0).toUpperCase()+o.slice(1)}function D(o){let e=new Set,t=new Set;for(let i of o){let n=i.label??i.name??String(i.value),r=String(i.value);if(e.has(n))throw new Error(`Duplicate kit picker label: ${n}`);if(t.has(r))throw new Error(`Duplicate kit picker value: ${r}`);e.add(n),t.add(r);}}var Z=".workspairc.json",ee=".rapidkitrc.json",oe=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],te=["workspai.config.json","rapidkit.config.json"];function U(o){return typeof o=="object"&&o!==null&&"code"in o&&o.code==="ENOENT"}function R(o,e){let t=e instanceof Error?e.message:String(e),i=o.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${o}.${i} Cause: ${t}`}async function Qe(){for(let o of [c$1.join(T.homedir(),Z),c$1.join(T.homedir(),ee)])try{let e$1=await promises.readFile(o,"utf-8"),t=JSON.parse(e$1);return e.debug(`Loaded config from ${o}`),t}catch{}return e.debug("No user config found, using defaults"),{}}async function Xe(o=process.cwd(),e$1={}){let t=o,i=c$1.parse(t).root;for(;t!==i;){for(let n of te){let r=c$1.join(t,n);try{let s=await promises.readFile(r,"utf-8"),a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${n}`),a}catch(s){if(U(s))continue;throw new Error(R(r,s))}}for(let n of oe){let r=c$1.join(t,n);try{await promises.access(r);}catch(s){if(U(s))continue;throw new Error(R(r,s))}if(e.debug(`Found config file: ${r}`),!e$1.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${r} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let a=await import(pathToFileURL(r).href),l=a.default||a;return e.debug(`Loaded Workspai config from ${n}`),l}catch(s){throw new Error(R(r,s))}}t=c$1.dirname(t);}return e.debug("No Workspai config file found, using defaults"),{}}function Ze(o,e,t){return {author:t.author||e.workspace?.defaultAuthor||o.author,pythonVersion:t.pythonVersion||e.workspace?.pythonVersion||o.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||e.workspace?.installMethod||o.defaultInstallMethod,defaultKit:t.defaultKit||e.projects?.defaultKit||o.defaultKit,skipGit:t.skipGit??e.projects?.skipGit??o.skipGit,license:t.license||o.license,testRapidKitPath:t.testRapidKitPath||o.testRapidKitPath}}function eo(o){return f$1("DEV_PATH")||o.testRapidKitPath||void 0}var x=class extends Error{constructor(t,i){super(["Workspai workspaces cannot be nested.",`Target: ${t}`,`Containing workspace: ${i}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
2
+ `));this.targetPath=t;this.containingWorkspacePath=i;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function ie(o){try{return !!await k$1.stat(o)}catch{return false}}function re(o,e){let t=o.indexOf(e);if(t>=0&&t+1<o.length)return o[t+1];let i=o.find(n=>n.startsWith(`${e}=`));if(i)return i.slice(e.length+1)}function se(o){return o.includes("--here")}async function G(o){let e=c$1.resolve(o);for(;;){let t=[c$1.join(e,".workspai-workspace"),c$1.join(e,".rapidkit-workspace"),c$1.join(e,".workspai","workspace.json"),c$1.join(e,".rapidkit","workspace.json")];if((await Promise.all(t.map(ie))).some(Boolean))return e;let i=c$1.dirname(e);if(i===e)return;e=i;}}async function po(o){let e=c$1.resolve(o),t=await G(c$1.dirname(e));if(t)throw new x(e,t)}async function ae(o,e=homedir()){let i=[{value:"managed",label:"Managed home",hint:k$2(e)}];return await G(o)||i.push({value:"here",label:"Current directory",hint:o}),i}function J(o,e=m.cwd()){if(se(o))return c$1.resolve(e);let t=re(o,"--output");if(t)return c$1.resolve(t)}function uo(o,e=m.cwd()){let t=c$1.resolve(o),i=c$1.resolve(e),n=c$1.relative(i,t);return n.length>0&&!n.startsWith("..")&&!c$1.isAbsolute(n)?`cd ${n}`:`cd ${t}`}function mo(o,e={}){let t=e.argv??[],i=e.outputParent??J(t,m.cwd());return l(o.trim(),{homeDir:e.homeDir,outputDir:i})}function fo(o,e,t={}){return o?c$1.resolve(o)===c$1.resolve(e)?true:t.outputParent===void 0:false}async function go(o,e={}){let t=e.cwd??m.cwd(),i=e.homeDir??homedir(),n=J(o,t);if(n!==void 0)return n;let r=e.hasYes??(o.includes("--yes")||o.includes("-y"));if(!(e.interactive??(!r&&!!m.stdin.isTTY&&!b())))return;let a=await ae(t,i);if(a.length===1)return;let{location:l}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:a,default:0}]);if(l==="here")return c$1.resolve(t)}var pe=["minimal","python-only","node-only","go-only","java-only","dotnet-only","polyglot","enterprise"],de=new Set(["minimal","node-only","go-only","java-only","dotnet-only"]),xo=new Set(["python-only","polyglot","enterprise"]);function ue(o){return typeof o=="string"&&pe.includes(o)}function jo(o){return ue(o)&&de.has(o)}var Y={"python-only":"python","node-only":"node","go-only":"go","java-only":"java","dotnet-only":"dotnet"},me={python:"Python",node:"Node",go:"Go",java:"Java",dotnet:".NET",php:"PHP",ruby:"Ruby",rust:"Rust",elixir:"Elixir",clojure:"Clojure",scala:"Scala",kotlin:"Kotlin",deno:"Deno",bun:"Bun",c:"C",cpp:"C++",unknown:"Unknown"},fe={python:"python-only",node:"node-only",go:"go-only",java:"java-only",dotnet:"dotnet-only"},V=["node","deno","bun","python","go","java","kotlin","scala","dotnet","php","ruby","rust","elixir","clojure","c","cpp","unknown"];function j(o){return o==="bun"||o==="deno"?"node":o==="kotlin"||o==="scala"?"java":o}function E(o){return typeof o!="string"||o.trim().length===0?"minimal":o.trim().toLowerCase()}function f(o){if(typeof o!="string")return "unknown";let e=o.trim().toLowerCase();return e==="python"||e==="node"||e==="go"||e==="java"||e==="dotnet"||e==="php"||e==="ruby"||e==="rust"||e==="elixir"||e==="clojure"||e==="scala"||e==="kotlin"||e==="deno"||e==="bun"||e==="c"||e==="cpp"?e:e==="c++"||e==="cplusplus"||e==="cc"||e==="clang++"||e==="g++"?"cpp":e==="clang"||e==="gcc"?"c":"unknown"}function P(o){let e=new Set;for(let t of o)e.add(f(t));return [...e].sort((t,i)=>V.indexOf(t)-V.indexOf(i))}function ge(o){let e=P(o).filter(t=>t!=="unknown");if(e.length!==0)return e.length===1?fe[e[0]]:"polyglot"}function H(o,e={}){return `npx workspai bootstrap --profile ${o}${e.ci?" --ci --json":""}`}function ke(o,e){return o?"none":e==="strict"?"error":"warning"}function g(o){let e=o.ok?void 0:ge(o.runtimes)??"polyglot";return {ok:o.ok,checkId:o.checkId,status:o.ok?"passed":"failed",profile:o.profile,runtimes:o.runtimes,message:o.message,recommendedProfile:e,recommendedCommand:e?H(e):void 0,ciRecommendedCommand:e?H(e,{ci:true}):void 0,severity:ke(o.ok,o.mode)}}function Eo(o){let e=E(o.profile),t=P(o.runtimes),i=o.mode??"warn",n=Y[e];if(n){let r=t.length===0||t.every(s=>j(s)===n);return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:t,message:r?`${e} profile validated for discovered projects.`:`${e} profile mismatch: detected runtimes [${t.join(", ")}].`,mode:i})}if(e==="minimal"){let r=t.filter(l=>l!=="unknown"),a=new Set(r.map(l=>j(l))).size<=1;return g({ok:a,checkId:"profile.minimal",profile:e,runtimes:t,message:a?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${r.join(", ")}].`,mode:i})}return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:t,message:`${e} profile accepts the detected runtime mix.`,mode:i})}function vo(o){let e=E(o.profile),t=f(o.runtime),i=o.mode??"warn",n=Y[e];if(!n||t==="unknown")return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:[t],message:t==="unknown"?`Project "${o.subjectLabel}" runtime is unknown; profile compatibility will be checked by workspace doctor.`:`${e} profile accepts project "${o.subjectLabel}".`,mode:i});let r=j(t)===n;return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:r?[t]:P([n,t]),message:r?`Project "${o.subjectLabel}" is compatible with workspace profile "${e}".`:`Project "${o.subjectLabel}" is ${me[t]}, but workspace profile is "${e}".`,mode:i})}async function Fo(o){let e=(await Promise.all(s(o,"policies.yml").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "warn";try{return (await k$1.readFile(e,"utf-8")).match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}catch{return "warn"}}async function Io(o){let e=(await Promise.all(s(o,"workspace.json").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "minimal";try{let t=await k$1.readJson(e);return E(t.profile)}catch{return "minimal"}}async function $o(o,e={}){let t$1=new Set,i$1=[],n=new Set,r=[o];for(;r.length>0;){let s=r.pop();if(!s||n.has(s))continue;n.add(s);let a=[];try{a=await ce.promises.readdir(s,{withFileTypes:true});}catch{continue}for(let l of a){if(!l.isDirectory()||l.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(l.name))continue;let p=c$1.join(s,l.name);if(p!==o&&j$1(p))continue;if((await Promise.all([...t(p,"context.json"),...t(p,"project.json")].map(async q=>k$1.pathExists(q)))).some(Boolean)){i$1.push(p);continue}r.push(p);}}for(let s of i$1){let a=i(s);t$1.add(f(j$2(s,a).runtime));}for(let s of await a(o))t$1.add(f(s.runtime));for(let s of e.additionalRuntimes??[])t$1.add(f(s));return P(t$1)}function Ao(o,e={}){let t=e.ci?o.ciRecommendedCommand:o.recommendedCommand;return t?`Recommended: ${t}`:null}export{Q as a,Qe as b,Xe as c,Ze as d,eo as e,po as f,uo as g,mo as h,fo as i,go as j,xo as k,jo as l,Eo as m,vo as n,Fo as o,Io as p,$o as q,Ao as r};
@@ -1 +1 @@
1
- import {b,c,d as d$1}from'./chunk-E4LJ3PQD.js';import {c as c$2}from'./chunk-W6FHVXNL.js';import {a as a$4}from'./chunk-X7FYEKLI.js';import {c as c$1,d as d$4}from'./chunk-HCFWT42C.js';import {a as a$1,b as b$1}from'./chunk-PYCJWW4B.js';import {p as p$1,a,o,g,d as d$3,f as f$1}from'./chunk-NBJ6AP7K.js';import {p,l,f as f$2}from'./chunk-NA2NXX5P.js';import {d}from'./chunk-EWZZUQBR.js';import {a as a$2}from'./chunk-KG3TUTXU.js';import {d as d$2,e as e$1}from'./chunk-CCDGHPEJ.js';import {a as a$3}from'./chunk-AFIFZTOY.js';import {f,e,i,g as g$1,h}from'./chunk-NZ3WZYD5.js';import m from'path';import v from'fs-extra';var fe="rapidkit-blocker-resolution-v1";function pe(e){let t=e.blockers.map(s=>s.trim()).filter(Boolean).slice(0,12),r=e.stderrTail?.trim().slice(-400)??"";return f$2({blockers:t,exitCode:e.exitCode??null,stderrTail:r})}function we(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function me(e){let t=we(e.reason),r=pe({blockers:[e.reason]}),s=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",...e.sourceCommand?{}:{studioActionId:"run-analyze"}}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:fe,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:r,commandRetryHint:t==="artifact-missing"?e.sourceCommand?`Run the source command once: ${e.sourceCommand}, then verify.`:"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:s,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function Re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function Ce(e){return e.length===0||e.every(t=>Re(t))}function ge(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&Ce(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function tt(e,t){let r=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${r} \u2014 add your first project to continue.`:`Workspace scaffold${r}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var ye=f.verify,G=e.verify;function Ae(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ke(e){let t=await v.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==f$1)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);a$3(t,"contracts/workspace-intelligence/workspace-impact.v1.json",`Workspace impact ${e}`);let s=r;a$3(s.diff,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Embedded workspace diff in ${e}`);let i=[];s.summary.affectedProjects!==s.affectedProjects.length&&i.push("summary.affectedProjects does not match affectedProjects.length"),s.summary.workspaceItems!==s.workspaceImpact.length&&i.push("summary.workspaceItems does not match workspaceImpact.length"),s.summary.recommendedCommands!==s.verificationPlan.length&&i.push("summary.recommendedCommands does not match verificationPlan.length"),s.summary.blastRadius.directlyAffected!==s.affectedProjects.length&&i.push("blastRadius.directlyAffected does not match affectedProjects.length"),s.summary.blastRadius.transitivelyAffected!==s.transitiveImpact.length&&i.push("blastRadius.transitivelyAffected does not match transitiveImpact.length");let o=s.transitiveImpact.reduce((u,d)=>Math.max(u,d.distance??0),0);s.summary.blastRadius.maxDistance!==o&&i.push("blastRadius.maxDistance does not match transitive impact distances");let k=l(s.diff.currentModel)?.edges.length??0;if(s.summary.blastRadius.graphEdges!==k&&i.push("blastRadius.graphEdges does not match the embedded model graph"),s.summary.changed!==s.diff.summary.changed&&i.push("summary.changed does not match embedded diff summary"),s.fromRef!==s.diff.fromRef&&i.push("fromRef does not match embedded diff fromRef"),s.workspace.name!==s.diff.currentModel.workspace.name&&i.push("workspace.name does not match the embedded model"),s.diff.toHash!==d(s.diff.currentModel)&&i.push("embedded diff current-model hash does not match toHash"),i.length>0)throw new Error(`Workspace impact semantic integrity failed: ${i.join("; ")} (${e})`);return s}function Ee(e){let t=new Set,r=[];for(let s of e){let i=`${s.scope}:${s.project??""}:${s.display}`;t.has(i)||(t.add(i),r.push(s));}return r}function Se(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function We(e$1,t){if(e$1.id==="workspace.doctor")return m.join(t,e.doctor);if(e$1.id==="workspace.contract.verify")return m.join(t,e.contractVerify);if(e$1.id==="workspace.readiness")return m.join(t,e.readiness);if(e$1.id==="workspace.analyze")return m.join(t,".workspai","reports","analyze-last-run.json");if(e$1.id==="workspace.pipeline")return m.join(t,".workspai","reports","pipeline-last-run.json");if(e$1.id==="workspace.doctor-fix")return m.join(t,".workspai","reports","doctor-fix-result-last-run.json");if(e$1.id.startsWith("project.")&&e$1.id.includes("."))return m.join(t,".workspai","reports","workspace-run-last.json")}function C(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function je(e){if(!c$1(e,"workspace"))return {status:"fail",message:"Doctor evidence contract is missing or unsupported."};try{d$4(e);}catch(s){return {status:"fail",message:`Doctor evidence semantic validation failed: ${s instanceof Error?s.message:String(s)}`}}let t=a$4(e);return t.hasSystemErrors||t.blockingFindings>0?{status:"fail",message:`Doctor evidence reports ${t.blockingFindings} canonical blocking finding(s).`}:t.advisoryFindings+t.unknownFindings+t.contradictionCount+t.missingDiagnosisProjects>0||t.staleEvidence||t.unknownFreshness||t.minimumDiagnosisCompleteness<100?{status:"warn",message:`Doctor evidence needs attention (${t.advisoryFindings} advisory, ${t.unknownFindings} unknown, ${t.contradictionCount} contradictory; ${t.minimumDiagnosisCompleteness}% complete).`}:{status:"pass",message:"Canonical Doctor evidence is complete, fresh, and healthy."}}function xe(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function Pe(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function Ie(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Analyze evidence reports blocking findings."}:r==="needs-attention"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is ready."}}function Ve(e){let t=e.schemaVersion===h.doctorFixResult.schemaVersion?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let r=t,s=Array.isArray(r.remainingBlockers)?r.remainingBlockers:[];if(s.length>0)return {status:"fail",message:`Doctor fix result reports ${s.length} remaining blocker(s).`};let i=Array.isArray(r.appliedFixes)?r.appliedFixes:[];return i.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${i.length} applied fix(es) with no remaining blockers.`}}async function Fe(e,t){let r=await d$2(e,i.doctorRemediationPlan);if(!r)return false;try{let s=C(await v.readJson(r));if(!s||(Array.isArray(s.steps)?s.steps:[]).length>0)return false;let o=typeof s.generatedAt=="string"?s.generatedAt:void 0;if(!o||!t)return true;let k=Date.parse(o),u=Date.parse(t);return !Number.isFinite(k)||!Number.isFinite(u)?true:k>=u}catch{return false}}function $e(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function Oe(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function De(e,t,r){let s=$e(t),i=c$2(e,s??void 0);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let o=i.stage;if(s&&o!==s)return {status:"missing",message:`Workspace run evidence is for stage "${o}", expected "${s}".`};let k=Array.isArray(i.projects)?i.projects:[],u=t.project?.toLowerCase();if(!u)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let d=k.find(g=>{let c=C(g);if(!c)return false;let n=typeof c.projectName=="string"?c.projectName.toLowerCase():"",a=["projectPath","relativePath","path"].map(f=>c[f]).filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.replace(/\\/g,"/").toLowerCase());return n===u||a.some(f=>f.endsWith(`/${u}`)||f===u)});if(d){let g=R(i.generatedAt,r,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let c=C(d),n=typeof c?.status=="string"?c.status:"unknown";return n==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:n==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:n==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${n} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function R(e,t,r){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${r} is stale: missing generatedAt timestamp (required after impact ${t}).`;let s=Date.parse(e),i=Date.parse(t);return Number.isFinite(s)?Number.isFinite(i)&&s<i?`${r} is stale: generated at ${e}, before impact ${t}.`:null:`${r} is stale: invalid generatedAt timestamp (required after impact ${t}).`}function Be(e){if(e.id==="workspace.doctor")return g$1.doctor;if(e.id==="workspace.readiness")return g$1.readiness;if(e.id==="workspace.contract.verify")return g$1.contractVerify;if(e.id==="workspace.analyze")return g$1.analyze;if(e.id==="workspace.pipeline")return "contracts/pipeline-last-run.v1.json"}async function _e(e,t,r,s){let i=We(e,t),o=i?m.relative(t,i).split(m.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};let k=i?await d$2(t,o??""):null;if(!i||!k)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:o,message:o?`Missing evidence report: ${o}`:"No evidence mapping exists for this command."};let u;try{u=await v.readJson(k);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is unreadable JSON: ${n instanceof Error?n.message:String(n)}`}}let d=C(u);if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:"Evidence report is not a JSON object."};let g=Be(e);if(g)try{a$3(d,g,`${e.label} evidence`);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is invalid: ${n instanceof Error?n.message:String(n)}`}}let c;if(e.id==="workspace.doctor"){let n=R(d.generatedAt,s,"Doctor evidence");n?c={status:"fail",message:n}:c=je(d);}else if(e.id==="workspace.readiness"){let n=R(d.generatedAt,s,"Release readiness evidence");n?c={status:"fail",message:n}:c=xe(d);}else if(e.id==="workspace.contract.verify"){let n=R(d.generatedAt,s,"Workspace contract verify evidence");n?c={status:"fail",message:n}:c=Pe(d);}else if(e.id==="workspace.analyze"){let n=R(d.generatedAt,s,"Analyze evidence");n?c={status:"fail",message:n}:c=Ie(d);}else if(e.id==="workspace.pipeline"){let n=R(d.generatedAt,s,"Pipeline evidence");n?c={status:"fail",message:n}:c=Oe(d);}else if(e.id==="workspace.doctor-fix"){let n=d.schemaVersion===h.doctorFixResult.schemaVersion?d:d.fixResult,a=C(n),f=typeof a?.generatedAt=="string"?a.generatedAt:void 0,y=R(f,s,"Doctor fix result");y?c={status:"fail",message:y}:await Fe(t,f)?c={status:"skipped",message:"No current doctor remediation steps are pending."}:c=Ve(d);}else if(e.id.startsWith("project."))c=De(d,e,s);else {let n=R(d.generatedAt,s,"Evidence report");n?c={status:"fail",message:n}:c={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:c.status,required:e.required,evidencePath:o,message:c.message}}function Ne(e,t={blockingReasons:[],needsAttention:false}){let r=e.filter(n=>n.status==="pass").length,s=e.filter(n=>n.status==="warn").length,i=e.filter(n=>n.status==="fail").length,o=e.filter(n=>n.status==="missing").length,k=e.filter(n=>n.status==="skipped").length,u=e.filter(n=>n.required&&(n.status==="fail"||n.status==="missing")).map(n=>`${n.id}: ${n.message}`),d=e.filter(n=>n.required&&n.status==="missing").length,g="ready",c=0;return u.length>0||t.blockingReasons.length>0?(g="blocked",c=2):(s>0||e.some(n=>!n.required&&n.status==="fail")||d>0||t.needsAttention)&&(g="needs-attention",c=1),{verdict:g,exitCode:c,stepsPassed:r,stepsWarn:s,stepsFailed:i,stepsMissing:o,stepsSkipped:k}}function He(e,t){let r=x(e.affectedProjects.map(a=>a.project?.name).filter(a=>typeof a=="string")),s=new Set(r.map(a=>a.toLowerCase())),i=x(e.transitiveImpact.map(a=>a.project?.name).filter(a=>typeof a=="string").filter(a=>!s.has(a.toLowerCase()))),o=new Map;for(let a of t){if(a.scope!=="project"||!a.project)continue;let f=a.project.toLowerCase(),y=o.get(f)??[];y.push(a),o.set(f,y);}let k=[],u=[],d=[],g=[],c=false,n=(a,f)=>{let y=o.get(a.toLowerCase())??[];if(y.length===0){d.push(a);return}let P=y.filter(p=>p.status==="fail"),b=P.filter(p=>p.required),I=y.filter(p=>p.status==="missing"),E=I.filter(p=>p.required),V=y.some(p=>p.status==="pass"||p.status==="warn");if(b.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has failed verification evidence (${b.map(p=>p.id).join(", ")}).`);return}if(P.length>0){u.push(a),c=true;return}if(E.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has missing required verification evidence (${E.map(p=>p.id).join(", ")}).`);return}if(I.length>0){u.push(a),c=true;return}if(V){k.push(a);return}d.push(a);};for(let a of r)n(a,"directly-changed");for(let a of i)n(a,"transitive dependent");return {subgraph:{totalProjects:r.length+i.length,directlyChanged:r,transitiveDependents:i,covered:x(k),uncovered:x(u),unverifiable:x(d)},blockingReasons:g,needsAttention:c}}function x(e){return [...new Set(e)].sort((t,r)=>t.localeCompare(r))}async function Me(e$1){let t=m.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let o=Ae(t,e$1.fromImpactPath);return {impact:await ke(o),fromImpactRef:m.relative(t,o).split(m.sep).join("/"),impactFromDisk:true}}let r=m.join(t,g);if(await v.pathExists(r))return {impact:await ke(r),fromImpactRef:g,impactFromDisk:true};let s=m.join(t,d$3);if(await v.pathExists(s))return {impact:await p$1({workspacePath:t,fromPath:d$3,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:d$3,impactFromDisk:false};let i=await p({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:f$1,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:e.diff,workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:l(i)?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:f.diff,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:e.model,fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}},impactFromDisk:false}}function Te(e,t){if(t)return e.generatedAt}async function bt(e){let t=m.resolve(e.workspacePath),{impact:r,fromImpactRef:s,impactFromDisk:i}=await Me(e),o$1=r.diff.currentModel,k=i?await p({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}):o$1,u=[];if(i){let l=await p$1({workspacePath:t,fromPath:r.diff.fromRef,diff:r.diff,scope:e.scope,now:e.now}),W=[r.affectedProjects,r.transitiveImpact,r.verificationPlan],A=[l.affectedProjects,l.transitiveImpact,l.verificationPlan];JSON.stringify(W)!==JSON.stringify(A)&&u.push("workspace.impact: Persisted impact semantics do not match the impact re-derived from the embedded diff. Regenerate diff and impact.");}i&&d(k)!==r.diff.toHash&&u.push("workspace.impact: Impact evidence is stale because the current workspace model no longer matches the embedded model. Regenerate diff and impact.");let d$2=r.diff.git;if(i&&d$2?.available){let l=a(t,{ref:d$2.ref}),W=r.diff.changes.filter(h=>h.type.startsWith("git.")).map(h=>`${h.type}:${h.target.replace(/^git:/,"")}`).sort(),A=[...l.changedFiles.map(h=>`git.file.changed:${h}`),...l.untrackedFiles.map(h=>`git.untracked:${h}`),...l.deletedFiles.map(h=>`git.deleted:${h}`)].sort();(!l.available||l.commit!==d$2.commit||JSON.stringify(A)!==JSON.stringify(W))&&u.push("workspace.impact: Impact evidence is stale because Git changes no longer match the diff observation. Regenerate diff and impact.");}let g=Te(r,i),c$1=Ee([...o(),...r.verificationPlan]).filter(l=>Se(e.scope,l)),n=[];for(let l of c$1)n.push(await _e(l,t,o$1.contracts.exists===true,g));let a$2=He(r,n),f=a$1(l(o$1)??{nodes:[],edges:[]}),y=b(o$1),P=await Ke(t),b$2=c(y,P?.freshness?.projectHashes),I={verdict:b$2.verdict,baseline:b$2.baseline,changed:b$2.changed,added:b$2.added,removed:b$2.removed,projectHashes:d$1(y)},E=b$1(f),V=o$1.policies?.mode??"warn",p$2=await Le(o$1,t),B=qe(V,p$2),S=Ne(n,{blockingReasons:[...a$2.blockingReasons,...E,...B.blockingReasons,...u],needsAttention:a$2.needsAttention||B.needsAttention}),he=n.filter(l=>l.status==="missing"&&l.evidencePath).map(l=>l.evidencePath),_=[...n.filter(l=>l.required&&(l.status==="fail"||l.status==="missing")).map(l=>`${l.id}: ${l.message}`),...a$2.blockingReasons,...E,...B.blockingReasons,...u],ve=p$2.filter(l=>l.severity==="error").length,be=o$1.summary?.projectCount??o$1.projects.length,U=ge({projectCount:be,verdict:S.verdict,exitCode:S.exitCode,blockingReasons:_,policyErrorCount:ve});S.verdict=U.verdict,S.exitCode=U.exitCode;let Y=Array.from(new Set(_.map(l=>l.trim()).filter(Boolean))).slice(0,12).map((l,W)=>{let A=n.find(h=>l.startsWith(`${h.id}:`));return me({reason:l,blockerId:`blocker-${W+1}`,sourceCommand:A?.command.display,sourceArtifact:A?.evidencePath,verifyCommand:"npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json",verifyArtifact:G})});return {schemaVersion:ye,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:s,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:S,steps:n,missingEvidence:he,blockingReasons:_,...Y.length>0?{resolutionHints:Y}:{},verificationPlan:c$1,affectedSubgraph:a$2.subgraph,graphIntegrity:f,freshness:I,policyMode:V,policyViolations:p$2}}async function Le(e$1,t){let r=[];for(let i of e$1.validation?.issues??[])r.push({source:"model",severity:i.severity,code:i.code,message:i.message,target:i.target});let s=await d$2(t,e.contractVerify);try{if(s&&await v.pathExists(s)){let i=await v.readJson(s);if(Array.isArray(i.violations))for(let o of i.violations)typeof o=="string"&&o.trim().length>0&&r.push({source:"contract",severity:"error",code:"contract.violation",message:o});}}catch{}return r.sort((i,o)=>i.source!==o.source?i.source.localeCompare(o.source):i.code!==o.code?i.code.localeCompare(o.code):i.message.localeCompare(o.message))}function qe(e,t){let r=t.filter(s=>s.severity==="error");return e==="enforce"&&r.length>0?{blockingReasons:r.map(s=>`policy.${s.code}: ${s.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:r.length>0}}async function Ke(e){let t=m.join(e,G);try{if(!await v.pathExists(t))return null;let r=await v.readJson(t);return r&&r.schemaVersion===ye?r:null}catch{return null}}async function wt(e,t){return e$1(t,G,a$2(e))}function ze(e,t){let r=t?.strict?"strict":"default",s=[];if(e.summary.verdict==="blocked")return s.push(...e.blockingReasons),s.length===0&&s.push("verify verdict is blocked."),{passed:false,mode:r,exitCode:2,reasons:s};if(r==="strict"){if(e.summary.verdict!=="ready"&&s.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let i=[...e.freshness.changed,...e.freshness.added].slice(0,5);s.push(`freshness is stale${i.length>0?`: ${i.join(", ")}`:""} (strict requires fresh).`);}if(s.length>0)return {passed:false,mode:r,exitCode:1,reasons:s}}return {passed:true,mode:r,exitCode:0,reasons:s}}function Rt(e,t){return ze(e,t).exitCode}export{fe as a,tt as b,ye as c,G as d,He as e,bt as f,wt as g,ze as h,Rt as i};
1
+ import {b,c,d as d$1}from'./chunk-ZGS5NKEO.js';import {c as c$2}from'./chunk-W6FHVXNL.js';import {a as a$4}from'./chunk-X7FYEKLI.js';import {c as c$1,d as d$4}from'./chunk-HCFWT42C.js';import {a as a$1,b as b$1}from'./chunk-PYCJWW4B.js';import {p as p$1,a,o,g,d as d$3,f as f$1}from'./chunk-CT4IODPG.js';import {p,l,f as f$2}from'./chunk-CJHWKXDN.js';import {d}from'./chunk-EWZZUQBR.js';import {a as a$2}from'./chunk-Q2WF7D5U.js';import {d as d$2,e as e$1}from'./chunk-CCDGHPEJ.js';import {a as a$3}from'./chunk-AFIFZTOY.js';import {f,e,i,g as g$1,h}from'./chunk-NZ3WZYD5.js';import m from'path';import v from'fs-extra';var fe="rapidkit-blocker-resolution-v1";function pe(e){let t=e.blockers.map(s=>s.trim()).filter(Boolean).slice(0,12),r=e.stderrTail?.trim().slice(-400)??"";return f$2({blockers:t,exitCode:e.exitCode??null,stderrTail:r})}function we(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function me(e){let t=we(e.reason),r=pe({blockers:[e.reason]}),s=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",...e.sourceCommand?{}:{studioActionId:"run-analyze"}}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:fe,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:r,commandRetryHint:t==="artifact-missing"?e.sourceCommand?`Run the source command once: ${e.sourceCommand}, then verify.`:"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:s,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function Re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function Ce(e){return e.length===0||e.every(t=>Re(t))}function ge(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&Ce(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function tt(e,t){let r=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${r} \u2014 add your first project to continue.`:`Workspace scaffold${r}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var ye=f.verify,G=e.verify;function Ae(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ke(e){let t=await v.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==f$1)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);a$3(t,"contracts/workspace-intelligence/workspace-impact.v1.json",`Workspace impact ${e}`);let s=r;a$3(s.diff,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Embedded workspace diff in ${e}`);let i=[];s.summary.affectedProjects!==s.affectedProjects.length&&i.push("summary.affectedProjects does not match affectedProjects.length"),s.summary.workspaceItems!==s.workspaceImpact.length&&i.push("summary.workspaceItems does not match workspaceImpact.length"),s.summary.recommendedCommands!==s.verificationPlan.length&&i.push("summary.recommendedCommands does not match verificationPlan.length"),s.summary.blastRadius.directlyAffected!==s.affectedProjects.length&&i.push("blastRadius.directlyAffected does not match affectedProjects.length"),s.summary.blastRadius.transitivelyAffected!==s.transitiveImpact.length&&i.push("blastRadius.transitivelyAffected does not match transitiveImpact.length");let o=s.transitiveImpact.reduce((u,d)=>Math.max(u,d.distance??0),0);s.summary.blastRadius.maxDistance!==o&&i.push("blastRadius.maxDistance does not match transitive impact distances");let k=l(s.diff.currentModel)?.edges.length??0;if(s.summary.blastRadius.graphEdges!==k&&i.push("blastRadius.graphEdges does not match the embedded model graph"),s.summary.changed!==s.diff.summary.changed&&i.push("summary.changed does not match embedded diff summary"),s.fromRef!==s.diff.fromRef&&i.push("fromRef does not match embedded diff fromRef"),s.workspace.name!==s.diff.currentModel.workspace.name&&i.push("workspace.name does not match the embedded model"),s.diff.toHash!==d(s.diff.currentModel)&&i.push("embedded diff current-model hash does not match toHash"),i.length>0)throw new Error(`Workspace impact semantic integrity failed: ${i.join("; ")} (${e})`);return s}function Ee(e){let t=new Set,r=[];for(let s of e){let i=`${s.scope}:${s.project??""}:${s.display}`;t.has(i)||(t.add(i),r.push(s));}return r}function Se(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function We(e$1,t){if(e$1.id==="workspace.doctor")return m.join(t,e.doctor);if(e$1.id==="workspace.contract.verify")return m.join(t,e.contractVerify);if(e$1.id==="workspace.readiness")return m.join(t,e.readiness);if(e$1.id==="workspace.analyze")return m.join(t,".workspai","reports","analyze-last-run.json");if(e$1.id==="workspace.pipeline")return m.join(t,".workspai","reports","pipeline-last-run.json");if(e$1.id==="workspace.doctor-fix")return m.join(t,".workspai","reports","doctor-fix-result-last-run.json");if(e$1.id.startsWith("project.")&&e$1.id.includes("."))return m.join(t,".workspai","reports","workspace-run-last.json")}function C(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function je(e){if(!c$1(e,"workspace"))return {status:"fail",message:"Doctor evidence contract is missing or unsupported."};try{d$4(e);}catch(s){return {status:"fail",message:`Doctor evidence semantic validation failed: ${s instanceof Error?s.message:String(s)}`}}let t=a$4(e);return t.hasSystemErrors||t.blockingFindings>0?{status:"fail",message:`Doctor evidence reports ${t.blockingFindings} canonical blocking finding(s).`}:t.advisoryFindings+t.unknownFindings+t.contradictionCount+t.missingDiagnosisProjects>0||t.staleEvidence||t.unknownFreshness||t.minimumDiagnosisCompleteness<100?{status:"warn",message:`Doctor evidence needs attention (${t.advisoryFindings} advisory, ${t.unknownFindings} unknown, ${t.contradictionCount} contradictory; ${t.minimumDiagnosisCompleteness}% complete).`}:{status:"pass",message:"Canonical Doctor evidence is complete, fresh, and healthy."}}function xe(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function Pe(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function Ie(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Analyze evidence reports blocking findings."}:r==="needs-attention"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is ready."}}function Ve(e){let t=e.schemaVersion===h.doctorFixResult.schemaVersion?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let r=t,s=Array.isArray(r.remainingBlockers)?r.remainingBlockers:[];if(s.length>0)return {status:"fail",message:`Doctor fix result reports ${s.length} remaining blocker(s).`};let i=Array.isArray(r.appliedFixes)?r.appliedFixes:[];return i.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${i.length} applied fix(es) with no remaining blockers.`}}async function Fe(e,t){let r=await d$2(e,i.doctorRemediationPlan);if(!r)return false;try{let s=C(await v.readJson(r));if(!s||(Array.isArray(s.steps)?s.steps:[]).length>0)return false;let o=typeof s.generatedAt=="string"?s.generatedAt:void 0;if(!o||!t)return true;let k=Date.parse(o),u=Date.parse(t);return !Number.isFinite(k)||!Number.isFinite(u)?true:k>=u}catch{return false}}function $e(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function Oe(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function De(e,t,r){let s=$e(t),i=c$2(e,s??void 0);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let o=i.stage;if(s&&o!==s)return {status:"missing",message:`Workspace run evidence is for stage "${o}", expected "${s}".`};let k=Array.isArray(i.projects)?i.projects:[],u=t.project?.toLowerCase();if(!u)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let d=k.find(g=>{let c=C(g);if(!c)return false;let n=typeof c.projectName=="string"?c.projectName.toLowerCase():"",a=["projectPath","relativePath","path"].map(f=>c[f]).filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.replace(/\\/g,"/").toLowerCase());return n===u||a.some(f=>f.endsWith(`/${u}`)||f===u)});if(d){let g=R(i.generatedAt,r,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let c=C(d),n=typeof c?.status=="string"?c.status:"unknown";return n==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:n==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:n==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${n} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function R(e,t,r){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${r} is stale: missing generatedAt timestamp (required after impact ${t}).`;let s=Date.parse(e),i=Date.parse(t);return Number.isFinite(s)?Number.isFinite(i)&&s<i?`${r} is stale: generated at ${e}, before impact ${t}.`:null:`${r} is stale: invalid generatedAt timestamp (required after impact ${t}).`}function Be(e){if(e.id==="workspace.doctor")return g$1.doctor;if(e.id==="workspace.readiness")return g$1.readiness;if(e.id==="workspace.contract.verify")return g$1.contractVerify;if(e.id==="workspace.analyze")return g$1.analyze;if(e.id==="workspace.pipeline")return "contracts/pipeline-last-run.v1.json"}async function _e(e,t,r,s){let i=We(e,t),o=i?m.relative(t,i).split(m.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};let k=i?await d$2(t,o??""):null;if(!i||!k)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:o,message:o?`Missing evidence report: ${o}`:"No evidence mapping exists for this command."};let u;try{u=await v.readJson(k);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is unreadable JSON: ${n instanceof Error?n.message:String(n)}`}}let d=C(u);if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:"Evidence report is not a JSON object."};let g=Be(e);if(g)try{a$3(d,g,`${e.label} evidence`);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is invalid: ${n instanceof Error?n.message:String(n)}`}}let c;if(e.id==="workspace.doctor"){let n=R(d.generatedAt,s,"Doctor evidence");n?c={status:"fail",message:n}:c=je(d);}else if(e.id==="workspace.readiness"){let n=R(d.generatedAt,s,"Release readiness evidence");n?c={status:"fail",message:n}:c=xe(d);}else if(e.id==="workspace.contract.verify"){let n=R(d.generatedAt,s,"Workspace contract verify evidence");n?c={status:"fail",message:n}:c=Pe(d);}else if(e.id==="workspace.analyze"){let n=R(d.generatedAt,s,"Analyze evidence");n?c={status:"fail",message:n}:c=Ie(d);}else if(e.id==="workspace.pipeline"){let n=R(d.generatedAt,s,"Pipeline evidence");n?c={status:"fail",message:n}:c=Oe(d);}else if(e.id==="workspace.doctor-fix"){let n=d.schemaVersion===h.doctorFixResult.schemaVersion?d:d.fixResult,a=C(n),f=typeof a?.generatedAt=="string"?a.generatedAt:void 0,y=R(f,s,"Doctor fix result");y?c={status:"fail",message:y}:await Fe(t,f)?c={status:"skipped",message:"No current doctor remediation steps are pending."}:c=Ve(d);}else if(e.id.startsWith("project."))c=De(d,e,s);else {let n=R(d.generatedAt,s,"Evidence report");n?c={status:"fail",message:n}:c={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:c.status,required:e.required,evidencePath:o,message:c.message}}function Ne(e,t={blockingReasons:[],needsAttention:false}){let r=e.filter(n=>n.status==="pass").length,s=e.filter(n=>n.status==="warn").length,i=e.filter(n=>n.status==="fail").length,o=e.filter(n=>n.status==="missing").length,k=e.filter(n=>n.status==="skipped").length,u=e.filter(n=>n.required&&(n.status==="fail"||n.status==="missing")).map(n=>`${n.id}: ${n.message}`),d=e.filter(n=>n.required&&n.status==="missing").length,g="ready",c=0;return u.length>0||t.blockingReasons.length>0?(g="blocked",c=2):(s>0||e.some(n=>!n.required&&n.status==="fail")||d>0||t.needsAttention)&&(g="needs-attention",c=1),{verdict:g,exitCode:c,stepsPassed:r,stepsWarn:s,stepsFailed:i,stepsMissing:o,stepsSkipped:k}}function He(e,t){let r=x(e.affectedProjects.map(a=>a.project?.name).filter(a=>typeof a=="string")),s=new Set(r.map(a=>a.toLowerCase())),i=x(e.transitiveImpact.map(a=>a.project?.name).filter(a=>typeof a=="string").filter(a=>!s.has(a.toLowerCase()))),o=new Map;for(let a of t){if(a.scope!=="project"||!a.project)continue;let f=a.project.toLowerCase(),y=o.get(f)??[];y.push(a),o.set(f,y);}let k=[],u=[],d=[],g=[],c=false,n=(a,f)=>{let y=o.get(a.toLowerCase())??[];if(y.length===0){d.push(a);return}let P=y.filter(p=>p.status==="fail"),b=P.filter(p=>p.required),I=y.filter(p=>p.status==="missing"),E=I.filter(p=>p.required),V=y.some(p=>p.status==="pass"||p.status==="warn");if(b.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has failed verification evidence (${b.map(p=>p.id).join(", ")}).`);return}if(P.length>0){u.push(a),c=true;return}if(E.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has missing required verification evidence (${E.map(p=>p.id).join(", ")}).`);return}if(I.length>0){u.push(a),c=true;return}if(V){k.push(a);return}d.push(a);};for(let a of r)n(a,"directly-changed");for(let a of i)n(a,"transitive dependent");return {subgraph:{totalProjects:r.length+i.length,directlyChanged:r,transitiveDependents:i,covered:x(k),uncovered:x(u),unverifiable:x(d)},blockingReasons:g,needsAttention:c}}function x(e){return [...new Set(e)].sort((t,r)=>t.localeCompare(r))}async function Me(e$1){let t=m.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let o=Ae(t,e$1.fromImpactPath);return {impact:await ke(o),fromImpactRef:m.relative(t,o).split(m.sep).join("/"),impactFromDisk:true}}let r=m.join(t,g);if(await v.pathExists(r))return {impact:await ke(r),fromImpactRef:g,impactFromDisk:true};let s=m.join(t,d$3);if(await v.pathExists(s))return {impact:await p$1({workspacePath:t,fromPath:d$3,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:d$3,impactFromDisk:false};let i=await p({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:f$1,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:e.diff,workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:l(i)?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:f.diff,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:e.model,fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}},impactFromDisk:false}}function Te(e,t){if(t)return e.generatedAt}async function bt(e){let t=m.resolve(e.workspacePath),{impact:r,fromImpactRef:s,impactFromDisk:i}=await Me(e),o$1=r.diff.currentModel,k=i?await p({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}):o$1,u=[];if(i){let l=await p$1({workspacePath:t,fromPath:r.diff.fromRef,diff:r.diff,scope:e.scope,now:e.now}),W=[r.affectedProjects,r.transitiveImpact,r.verificationPlan],A=[l.affectedProjects,l.transitiveImpact,l.verificationPlan];JSON.stringify(W)!==JSON.stringify(A)&&u.push("workspace.impact: Persisted impact semantics do not match the impact re-derived from the embedded diff. Regenerate diff and impact.");}i&&d(k)!==r.diff.toHash&&u.push("workspace.impact: Impact evidence is stale because the current workspace model no longer matches the embedded model. Regenerate diff and impact.");let d$2=r.diff.git;if(i&&d$2?.available){let l=a(t,{ref:d$2.ref}),W=r.diff.changes.filter(h=>h.type.startsWith("git.")).map(h=>`${h.type}:${h.target.replace(/^git:/,"")}`).sort(),A=[...l.changedFiles.map(h=>`git.file.changed:${h}`),...l.untrackedFiles.map(h=>`git.untracked:${h}`),...l.deletedFiles.map(h=>`git.deleted:${h}`)].sort();(!l.available||l.commit!==d$2.commit||JSON.stringify(A)!==JSON.stringify(W))&&u.push("workspace.impact: Impact evidence is stale because Git changes no longer match the diff observation. Regenerate diff and impact.");}let g=Te(r,i),c$1=Ee([...o(),...r.verificationPlan]).filter(l=>Se(e.scope,l)),n=[];for(let l of c$1)n.push(await _e(l,t,o$1.contracts.exists===true,g));let a$2=He(r,n),f=a$1(l(o$1)??{nodes:[],edges:[]}),y=b(o$1),P=await Ke(t),b$2=c(y,P?.freshness?.projectHashes),I={verdict:b$2.verdict,baseline:b$2.baseline,changed:b$2.changed,added:b$2.added,removed:b$2.removed,projectHashes:d$1(y)},E=b$1(f),V=o$1.policies?.mode??"warn",p$2=await Le(o$1,t),B=qe(V,p$2),S=Ne(n,{blockingReasons:[...a$2.blockingReasons,...E,...B.blockingReasons,...u],needsAttention:a$2.needsAttention||B.needsAttention}),he=n.filter(l=>l.status==="missing"&&l.evidencePath).map(l=>l.evidencePath),_=[...n.filter(l=>l.required&&(l.status==="fail"||l.status==="missing")).map(l=>`${l.id}: ${l.message}`),...a$2.blockingReasons,...E,...B.blockingReasons,...u],ve=p$2.filter(l=>l.severity==="error").length,be=o$1.summary?.projectCount??o$1.projects.length,U=ge({projectCount:be,verdict:S.verdict,exitCode:S.exitCode,blockingReasons:_,policyErrorCount:ve});S.verdict=U.verdict,S.exitCode=U.exitCode;let Y=Array.from(new Set(_.map(l=>l.trim()).filter(Boolean))).slice(0,12).map((l,W)=>{let A=n.find(h=>l.startsWith(`${h.id}:`));return me({reason:l,blockerId:`blocker-${W+1}`,sourceCommand:A?.command.display,sourceArtifact:A?.evidencePath,verifyCommand:"npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json",verifyArtifact:G})});return {schemaVersion:ye,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:s,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:S,steps:n,missingEvidence:he,blockingReasons:_,...Y.length>0?{resolutionHints:Y}:{},verificationPlan:c$1,affectedSubgraph:a$2.subgraph,graphIntegrity:f,freshness:I,policyMode:V,policyViolations:p$2}}async function Le(e$1,t){let r=[];for(let i of e$1.validation?.issues??[])r.push({source:"model",severity:i.severity,code:i.code,message:i.message,target:i.target});let s=await d$2(t,e.contractVerify);try{if(s&&await v.pathExists(s)){let i=await v.readJson(s);if(Array.isArray(i.violations))for(let o of i.violations)typeof o=="string"&&o.trim().length>0&&r.push({source:"contract",severity:"error",code:"contract.violation",message:o});}}catch{}return r.sort((i,o)=>i.source!==o.source?i.source.localeCompare(o.source):i.code!==o.code?i.code.localeCompare(o.code):i.message.localeCompare(o.message))}function qe(e,t){let r=t.filter(s=>s.severity==="error");return e==="enforce"&&r.length>0?{blockingReasons:r.map(s=>`policy.${s.code}: ${s.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:r.length>0}}async function Ke(e){let t=m.join(e,G);try{if(!await v.pathExists(t))return null;let r=await v.readJson(t);return r&&r.schemaVersion===ye?r:null}catch{return null}}async function wt(e,t){return e$1(t,G,a$2(e))}function ze(e,t){let r=t?.strict?"strict":"default",s=[];if(e.summary.verdict==="blocked")return s.push(...e.blockingReasons),s.length===0&&s.push("verify verdict is blocked."),{passed:false,mode:r,exitCode:2,reasons:s};if(r==="strict"){if(e.summary.verdict!=="ready"&&s.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let i=[...e.freshness.changed,...e.freshness.added].slice(0,5);s.push(`freshness is stale${i.length>0?`: ${i.join(", ")}`:""} (strict requires fresh).`);}if(s.length>0)return {passed:false,mode:r,exitCode:1,reasons:s}}return {passed:true,mode:r,exitCode:0,reasons:s}}function Rt(e,t){return ze(e,t).exitCode}export{fe as a,tt as b,ye as c,G as d,He as e,bt as f,wt as g,ze as h,Rt as i};