workspai 0.48.0 → 0.50.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 (243) hide show
  1. package/README.md +151 -75
  2. package/contracts/analyze-last-run.v1.json +2 -2
  3. package/contracts/artifact-remediation-plan.v1.json +3 -9
  4. package/contracts/autopilot-release.v1.json +2 -0
  5. package/contracts/bootstrap-compliance.v1.json +2 -1
  6. package/contracts/cli-log-event.v1.json +1 -1
  7. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +84 -0
  8. package/contracts/compatibility-matrix.v1.json +2 -0
  9. package/contracts/create-planner-capabilities.v1.json +144 -32
  10. package/contracts/doctor-project-evidence.v1.json +191 -11
  11. package/contracts/doctor-project-scan.v2.json +2 -0
  12. package/contracts/doctor-remediation-plan.v1.json +2 -2
  13. package/contracts/doctor-remediation-plan.v2.json +2 -2
  14. package/contracts/doctor-workspace-cache.v2.json +2 -0
  15. package/contracts/doctor-workspace-evidence.v1.json +189 -10
  16. package/contracts/extension-cli-compatibility.v1.json +11 -1
  17. package/contracts/infra-plan.v1.json +2 -0
  18. package/contracts/ingestion-plan.v1.json +85 -0
  19. package/contracts/ingestion-result.v1.json +59 -0
  20. package/contracts/mirror-ops.v1.json +2 -1
  21. package/contracts/pipeline-last-run.v1.json +2 -2
  22. package/contracts/private-product-manifest.v1.json +2 -0
  23. package/contracts/product-factory-plan.v1.json +2 -0
  24. package/contracts/project-archive.v1.json +2 -0
  25. package/contracts/project-entry-capability.v1.json +2 -3
  26. package/contracts/project-test-coverage.v1.json +189 -0
  27. package/contracts/project-workspace-link.v1.json +66 -0
  28. package/contracts/project-workspace-resolution.v1.json +28 -0
  29. package/contracts/published-contract-catalog.v1.json +50 -0
  30. package/contracts/release-readiness.v1.json +2 -2
  31. package/contracts/runtime-command-surface.v1.json +1456 -123
  32. package/contracts/transparency-evidence.v1.json +2 -1
  33. package/contracts/workspace-archive-capabilities.v1.json +11 -5
  34. package/contracts/workspace-archive-manifest.v1.json +236 -0
  35. package/contracts/workspace-archive-operation-result.v1.json +236 -0
  36. package/contracts/workspace-contract.v1.json +1 -1
  37. package/contracts/workspace-intelligence/agent-action-outcome.v1.json +2 -2
  38. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +1 -1
  39. package/contracts/workspace-intelligence/agent-hooks.v1.json +2 -0
  40. package/contracts/workspace-intelligence/agent-reports-index.v1.json +1 -1
  41. package/contracts/workspace-intelligence/blocker-resolution.v1.json +3 -9
  42. package/contracts/workspace-intelligence/doctor-fix-result.v1.json +2 -2
  43. package/contracts/workspace-intelligence/doctor-graph-diagnosis.v1.json +208 -0
  44. package/contracts/workspace-intelligence/fact-freshness.v1.json +2 -2
  45. package/contracts/workspace-intelligence/mcp-design.v1.json +2 -0
  46. package/contracts/workspace-intelligence/model-usage-event.v1.json +1 -1
  47. package/contracts/workspace-intelligence/project-context-agent.v1.json +360 -0
  48. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +1 -1
  49. package/contracts/workspace-intelligence/workspace-context.v1.json +1 -1
  50. package/contracts/workspace-intelligence/workspace-contract-verify.v1.json +2 -2
  51. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +1 -1
  52. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -1
  53. package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
  54. package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +1 -1
  55. package/contracts/workspace-intelligence/workspace-impact.v1.json +1 -1
  56. package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +1 -1
  57. package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +1 -1
  58. package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +1 -1
  59. package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +2 -2
  60. package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +1 -1
  61. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +48 -5
  62. package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +1 -1
  63. package/contracts/workspace-intelligence/workspace-model-diff.v1.json +1 -1
  64. package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +1 -1
  65. package/contracts/workspace-intelligence/workspace-model.v1.json +97 -5
  66. package/contracts/workspace-intelligence/workspace-operational-skill.v1.json +1 -1
  67. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +1 -1
  68. package/contracts/workspace-intelligence/workspace-verify.v1.json +1 -1
  69. package/contracts/workspace-intelligence-architecture.v1.json +33 -7
  70. package/contracts/workspace-intelligence-chain.v1.json +1 -1
  71. package/contracts/workspace-list.v1.json +2 -0
  72. package/contracts/workspace-model-cache.v1.json +2 -0
  73. package/contracts/workspace-registry.v1.json +1 -1
  74. package/contracts/workspace-run-last.v1.json +1 -1
  75. package/contracts/workspace-share-bundle.v1.json +2 -1
  76. package/contracts/workspace-snapshot.v1.json +2 -0
  77. package/contracts/workspace-snapshot.v2.json +2 -0
  78. package/contracts/workspace-sync.v1.json +2 -0
  79. package/contracts/workspace-watch-event.v1.json +2 -0
  80. package/dist/analyze-ZFQWTCJQ.js +1 -0
  81. package/dist/{artifact-remediation-plan-SPOUHMK5.js → artifact-remediation-plan-ICN3KOFG.js} +1 -1
  82. package/dist/autopilot-release-VKXQ7BS7.js +1 -0
  83. package/dist/chunk-2AXEGYPL.js +1 -0
  84. package/dist/chunk-2D4UOYOJ.js +1 -0
  85. package/dist/chunk-2OIBHUVH.js +1 -0
  86. package/dist/chunk-3GRKUP5W.js +33 -0
  87. package/dist/{managed-agent-markers-AXUM75OE.js → chunk-3RBUSW7H.js} +1 -1
  88. package/dist/chunk-5EXZBCAZ.js +4 -0
  89. package/dist/chunk-6UTM5AJI.js +1 -0
  90. package/dist/chunk-AFIFZTOY.js +2 -0
  91. package/dist/{chunk-BMWFQXGW.js → chunk-AHLMIL2T.js} +1 -1
  92. package/dist/chunk-AL237TSJ.js +7 -0
  93. package/dist/chunk-AL2A7Q4X.js +86 -0
  94. package/dist/{chunk-VU7NZHPM.js → chunk-BHYTI3RH.js} +1 -1
  95. package/dist/{chunk-ESLPI3XZ.js → chunk-BQGBU2Y3.js} +1 -1
  96. package/dist/chunk-C35UXTDM.js +2 -0
  97. package/dist/chunk-C3FLCDRN.js +2 -0
  98. package/dist/chunk-CZC5P2MF.js +1 -0
  99. package/dist/{chunk-Y5UJLPS4.js → chunk-DDQ3XK3H.js} +13 -13
  100. package/dist/{chunk-CRHYBQI3.js → chunk-DQ3PI7EP.js} +1 -1
  101. package/dist/chunk-EWZZUQBR.js +1 -0
  102. package/dist/{chunk-4KUIFXHM.js → chunk-GNQRYISX.js} +3 -3
  103. package/dist/chunk-I42F552T.js +2 -0
  104. package/dist/chunk-IDQKVJUF.js +2 -0
  105. package/dist/{chunk-3VFA7D5T.js → chunk-IND3TUVU.js} +1 -1
  106. package/dist/chunk-IPJ5URDF.js +1 -0
  107. package/dist/{chunk-I46XEIPL.js → chunk-JFUD73OZ.js} +52 -52
  108. package/dist/chunk-KKAOTTYO.js +8 -0
  109. package/dist/chunk-KMLPHFLD.js +2 -0
  110. package/dist/{chunk-NHN4QXPP.js → chunk-KVSYBHUR.js} +1 -1
  111. package/dist/chunk-KXG6E5VK.js +1 -0
  112. package/dist/chunk-L2YK5RV2.js +1 -0
  113. package/dist/chunk-LAJM2SBP.js +15 -0
  114. package/dist/{chunk-5S3DJQEP.js → chunk-LZQUZGXB.js} +1 -1
  115. package/dist/chunk-MOSXTVPU.js +1 -0
  116. package/dist/chunk-MV7KF75Q.js +13 -0
  117. package/dist/chunk-MVLIONQD.js +1 -0
  118. package/dist/chunk-RJIYCDVC.js +1 -0
  119. package/dist/{chunk-BGPXQQNY.js → chunk-RTVRZFIJ.js} +1 -1
  120. package/dist/chunk-RVQLMTTI.js +2 -0
  121. package/dist/chunk-SHXJ2GDR.js +75 -0
  122. package/dist/{chunk-32OJDBIG.js → chunk-SS2VV3D5.js} +1 -1
  123. package/dist/chunk-TDTCMZK7.js +10 -0
  124. package/dist/chunk-UETZ7USY.js +36 -0
  125. package/dist/chunk-VKTUWUS6.js +1 -0
  126. package/dist/chunk-VRW6KXNK.js +6 -0
  127. package/dist/chunk-Y5YAP4F3.js +2 -0
  128. package/dist/chunk-YPKNQCLK.js +2 -0
  129. package/dist/{create-DBQNAMKP.js → create-I23DC7SN.js} +1 -1
  130. package/dist/{demo-kit-DZ7TPG7K.js → demo-kit-KHH63TNA.js} +2 -2
  131. package/dist/{doctor-4NNUDNGZ.js → doctor-DOOMYLIH.js} +1 -1
  132. package/dist/{dotnet-webapi-clean-A6MVDYXX.js → dotnet-webapi-clean-VXEF4SHM.js} +5 -5
  133. package/dist/{gofiber-standard-I5YPQG5V.js → gofiber-standard-AQGSC7ON.js} +3 -3
  134. package/dist/{gogin-standard-VY2L4QT5.js → gogin-standard-7DU3OCBX.js} +3 -3
  135. package/dist/index.d.ts +41 -6
  136. package/dist/index.js +268 -356
  137. package/dist/managed-agent-markers-COE5DJ3W.js +1 -0
  138. package/dist/pipeline-U77HSINC.js +5 -0
  139. package/dist/platform-capabilities-PR6YL4KC.js +1 -0
  140. package/dist/project-intelligence-lens-BKKVPCLC.js +1 -0
  141. package/dist/project-test-coverage-4TEHZJFC.js +1 -0
  142. package/dist/{pythonRapidkitExec-CVCIK225.js → pythonRapidkitExec-YR7P5LWG.js} +1 -1
  143. package/dist/rust-axum-4HXDICIB.js +140 -0
  144. package/dist/{springboot-standard-55XKCBIZ.js → springboot-standard-EK6GYN5T.js} +7 -7
  145. package/dist/workspace-ZEYUVR26.js +1 -0
  146. package/dist/{workspace-agent-sync-662QHXGF.js → workspace-agent-sync-DKYJLUDP.js} +1 -1
  147. package/dist/workspace-archive-4JNT4S7N.js +1 -0
  148. package/dist/{workspace-context-23YYCUCP.js → workspace-context-IHUFMZT3.js} +1 -1
  149. package/dist/workspace-contract-PVLGPBBV.js +1 -0
  150. package/dist/workspace-explain-64HNKAHO.js +1 -0
  151. package/dist/workspace-explain-contract-H7O26QJU.js +1 -0
  152. package/dist/{workspace-feedback-SUVH2LUJ.js → workspace-feedback-RATRXFUC.js} +1 -1
  153. package/dist/{workspace-foundation-WXJ6I7ES.js → workspace-foundation-D33LJLGT.js} +1 -1
  154. package/dist/workspace-graph-stream-THNG2T7R.js +1 -0
  155. package/dist/{workspace-history-BANOJRQ2.js → workspace-history-EWFPT74O.js} +1 -1
  156. package/dist/workspace-intelligence-MCNSWWDV.js +1 -0
  157. package/dist/{workspace-intelligence-evaluation-IPH7M3WV.js → workspace-intelligence-evaluation-7CABG5Y6.js} +1 -1
  158. package/dist/workspace-intelligence-runner-TG2VLHNZ.js +1 -0
  159. package/dist/workspace-intelligence-runtime-registry-ZZ3GRAL2.js +1 -0
  160. package/dist/{workspace-knowledge-graph-ARDC6HHG.js → workspace-knowledge-graph-2EYR7N56.js} +1 -1
  161. package/dist/{workspace-marker-SMBC3Z2Q.js → workspace-marker-7NHMDIRL.js} +1 -1
  162. package/dist/workspace-mcp-serve-FLAVKWYW.js +3 -0
  163. package/dist/workspace-model-FMFYLHE4.js +1 -0
  164. package/dist/workspace-model-hash-ZXYPIGCW.js +1 -0
  165. package/dist/workspace-onboarding-MYROZDI2.js +1 -0
  166. package/dist/{workspace-python-engine-state-2MLKJYQG.js → workspace-python-engine-state-J4QKW55K.js} +1 -1
  167. package/dist/{workspace-registry-summary-ORDK7A36.js → workspace-registry-summary-6VXIAQLX.js} +1 -1
  168. package/dist/workspace-run-2ZI5UMJ2.js +1 -0
  169. package/dist/{workspace-verify-EBVL7FWT.js → workspace-verify-FKYI65UQ.js} +1 -1
  170. package/dist/workspace-watch-RP5KMVP2.js +1 -0
  171. package/docs/GLOSSARY.md +17 -16
  172. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +18 -10
  173. package/docs/README.md +49 -14
  174. package/docs/README_CONTENT_CONTRACT.md +19 -10
  175. package/docs/ci-workflows.md +3 -3
  176. package/docs/commands-reference.md +41 -10
  177. package/docs/contracts/ARTIFACT_CATALOG.md +72 -27
  178. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +2 -0
  179. package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +3 -3
  180. package/docs/contracts/rapidkit-cli-contracts.json +2 -2
  181. package/docs/create-planner-capabilities.md +36 -5
  182. package/docs/creating-workspaces-and-projects.md +75 -15
  183. package/docs/doctor-command.md +148 -39
  184. package/docs/examples/ci-agent-grounding.yml +1 -1
  185. package/docs/from-code-to-shared-understanding.md +6 -3
  186. package/docs/graph-benchmark-methodology.md +2 -2
  187. package/docs/workspace-intelligence-evaluation.md +13 -6
  188. package/docs/workspace-intelligence-runner.md +17 -6
  189. package/docs/workspace-knowledge-graph.md +102 -7
  190. package/docs/workspace-operations.md +154 -10
  191. package/package.json +10 -5
  192. package/scripts/enterprise-package-smoke.mjs +13 -1
  193. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  194. package/dist/analyze-EEEU3MIF.js +0 -1
  195. package/dist/autopilot-release-XGVXPOZI.js +0 -1
  196. package/dist/chunk-22DT744Z.js +0 -1
  197. package/dist/chunk-37CVKXBD.js +0 -1
  198. package/dist/chunk-3NU32T4A.js +0 -2
  199. package/dist/chunk-3ZK2GU7C.js +0 -1
  200. package/dist/chunk-4HDYADHT.js +0 -13
  201. package/dist/chunk-52PBRX7F.js +0 -1
  202. package/dist/chunk-54EP5CEV.js +0 -8
  203. package/dist/chunk-5XATWNME.js +0 -1
  204. package/dist/chunk-7YHK5NM3.js +0 -2
  205. package/dist/chunk-AFL3ACCR.js +0 -2
  206. package/dist/chunk-BFLJ2R4D.js +0 -80
  207. package/dist/chunk-EYJ2CQSK.js +0 -1
  208. package/dist/chunk-FTY7GGXJ.js +0 -33
  209. package/dist/chunk-FXQJX34Z.js +0 -1
  210. package/dist/chunk-GSWPGELT.js +0 -2
  211. package/dist/chunk-GZTYAEWX.js +0 -1
  212. package/dist/chunk-HDXNIN4N.js +0 -1
  213. package/dist/chunk-HZDXO65G.js +0 -36
  214. package/dist/chunk-J5ENLXDF.js +0 -1
  215. package/dist/chunk-KB44JP4M.js +0 -2
  216. package/dist/chunk-LHOZXC2M.js +0 -2
  217. package/dist/chunk-MER6ZBN2.js +0 -13
  218. package/dist/chunk-NAJCUQ4X.js +0 -2
  219. package/dist/chunk-OA537ZQ5.js +0 -1
  220. package/dist/chunk-OW42TZFB.js +0 -1
  221. package/dist/chunk-P3D5YQB2.js +0 -1
  222. package/dist/chunk-PHXQR6PX.js +0 -2
  223. package/dist/chunk-PRTR2DQ2.js +0 -1
  224. package/dist/chunk-QNONOO4F.js +0 -4
  225. package/dist/chunk-RHQW3DTP.js +0 -1
  226. package/dist/chunk-T4YR4RAI.js +0 -2
  227. package/dist/chunk-Y45WZR5N.js +0 -5
  228. package/dist/chunk-YJZOMRAS.js +0 -1
  229. package/dist/pipeline-TQM43A3K.js +0 -5
  230. package/dist/platform-capabilities-2B4QMZXE.js +0 -1
  231. package/dist/workspace-NCWRINEF.js +0 -1
  232. package/dist/workspace-archive-P76EDIUG.js +0 -10
  233. package/dist/workspace-contract-TU2I7GC2.js +0 -1
  234. package/dist/workspace-dependency-graph-BP4EXYQ5.js +0 -1
  235. package/dist/workspace-explain-MWUEN643.js +0 -1
  236. package/dist/workspace-explain-contract-ZPI3JXJU.js +0 -1
  237. package/dist/workspace-intelligence-MFJE7W67.js +0 -1
  238. package/dist/workspace-intelligence-runner-THYLHHMF.js +0 -1
  239. package/dist/workspace-mcp-serve-EZR6O76D.js +0 -3
  240. package/dist/workspace-model-7OU2M3LE.js +0 -1
  241. package/dist/workspace-model-hash-MHXK5MEI.js +0 -1
  242. package/dist/workspace-run-RLIYSOTN.js +0 -1
  243. package/dist/workspace-watch-3BPGLFLB.js +0 -1
@@ -0,0 +1 @@
1
+ export{b as RAPIDKIT_AGENT_GROUNDING_END,a as RAPIDKIT_AGENT_GROUNDING_START,d as extractManagedAgentSection,c as upsertManagedAgentSection}from'./chunk-3RBUSW7H.js';
@@ -0,0 +1,5 @@
1
+ import {a as a$3}from'./chunk-KKAOTTYO.js';import {c}from'./chunk-LZQUZGXB.js';import {q}from'./chunk-AL2A7Q4X.js';import {c as c$1}from'./chunk-FPJNWPKU.js';import {a as a$4}from'./chunk-RTVRZFIJ.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-2OIBHUVH.js';import {g}from'./chunk-DDQ3XK3H.js';import {d,a as a$2,e as e$1}from'./chunk-SS2VV3D5.js';import {a as a$1}from'./chunk-AHLMIL2T.js';import c$2 from'chalk';import p from'path';function G(a){return a===0?"pass":a===2?"warn":"fail"}function I(a){return a.some(r=>r.status==="fail")?"blocked":a.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(a,r){if(r)return 3;let i=a.some(o=>o.status==="fail"),t=a.some(o=>o.status==="warn");return i?1:t?2:0}function N(a,r){return a===2&&!r?0:a}async function O(a){let r=await g(a,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-PVLGPBBV.js');await t({workspacePath:a}),i=true;}catch{i=false;}return {sync:r,contractSynced:i}}async function V(a$5={}){let r=p.resolve(a$5.workspacePath??process.cwd()),i=a(r);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t=[],o=[],l=false,d$1,f$1,m,y=Date.now();try{let{sync:e,contractSynced:s}=await O(i),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:n,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${s?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||o.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),o.push("workspace sync stage failed");}let w=Date.now();try{let e=await q({workspace:true,json:true,quiet:true,strict:a$5.strict===true,ci:a$5.strict!==true}),s=G(e),n=await d(i,a$1.doctor)??a$2(i,a$1.doctor);t.push({name:"doctor",status:s,durationMs:Date.now()-w,summary:s==="pass"?"doctor workspace passed":s==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:n}),s==="fail"?o.push("doctor workspace gate failed"):s==="warn"&&o.push("doctor workspace reported warnings");}catch(e){l=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),o.push("doctor workspace stage failed");}if(a$5.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let s=await a$3({workspacePath:i,json:true,strict:a$5.strict===true});d$1=p.isAbsolute(s.enterpriseControls.evidencePath)?s.enterpriseControls.evidencePath:p.join(i,s.enterpriseControls.evidencePath);let n=s.summary.verdict==="blocked"?"fail":s.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${s.summary.verdict} (score ${s.summary.score}/100)`,evidencePath:d$1}),n==="fail"?o.push("analyze reported blocked verdict"):n==="warn"&&o.push("analyze reported needs-attention verdict");}catch(s){l=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${s instanceof Error?s.message:String(s)}`}),o.push("analyze stage failed");}}let h=Date.now();try{let e=await a$4({startPath:i,writeReport:true,skipVerify:a$5.skipVerify===true});f$1=e.evidencePath;let s=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:s,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),s==="fail"?o.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):s==="warn"&&o.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),o.push("readiness stage failed");}if(a$5.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),s=a$5.autopilotMode??"audit";try{let n=await c({workspacePath:i,mode:s,json:true,skipPipelineStages:true});m=n.artifacts.reportPath;let P=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${s}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:m}),P!=="pass"&&o.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),o.push("autopilot release stage failed");}}let M=I(t),k=j(t,l),F=p.join(i,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:M,exitCode:k,stagesPassed:t.filter(e=>e.status==="pass").length,stagesWarn:t.filter(e=>e.status==="warn").length,stagesFailed:t.filter(e=>e.status==="fail").length},stages:t,blockingReasons:[...new Set(o)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$1,autopilotEvidencePath:m}};if(a$5.writeReport!==false){let e$2=f(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e()});await e$1(i,".workspai/reports/pipeline-last-run.json",e$2);}if(a$5.writeReport!==false&&a$5.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&a$5.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-DKYJLUDP.js'),s=await e({workspacePath:i,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:s.indexPath,writtenFiles:s.writtenFiles,blockers:s.blockers};}catch{}return u}async function ae(a){let r;try{r=await V(a);}catch(t){let o=t instanceof Error?t.message:String(t);a.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:o}),null,2)):console.log(c$2.red(`Pipeline failed: ${o}`)),process.exit(1);}if(a.json)console.log(JSON.stringify(r,null,2));else {console.log(c$2.bold.cyan(`
2
+ \u{1F517} Workspai Governance Pipeline
3
+ `)),console.log(c$2.bold(`Workspace: ${c$2.cyan(p.basename(r.workspacePath))}`)),console.log(c$2.gray(`Path: ${r.workspacePath}`)),console.log(c$2.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let o=t.status==="pass"?c$2.green("PASS"):t.status==="warn"?c$2.yellow("WARN"):t.status==="skipped"?c$2.gray("SKIP"):c$2.red("FAIL");console.log(` - ${t.name}: ${o} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$2.bold(`
4
+ Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
5
+ Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$2.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}let i=N(r.summary.exitCode,a.strict===true);i!==0&&process.exit(i);}export{N as pipelineProcessExitCode,V as runPipeline,ae as runPipelineCommand};
@@ -0,0 +1 @@
1
+ export{f as augmentPathWithNodeBin,h as buildLatestStableGeneratorEnv,g as buildPackageRunnerSubprocessEnv,a as detectPlatformKind,i as getDefaultPythonCommand,r as getLegacyWorkspaceRegistryDirectory,j as getPythonCommandCandidates,k as getPythonVersionProbeCandidates,p as getRapidkitLocalScriptCandidates,t as getUserLocalBinCandidates,o as getVenvActivateScriptPath,l as getVenvBinDirectory,m as getVenvPythonPath,n as getVenvRapidkitPath,q as getWorkspaceRegistryDirectory,s as getWorkspaceRegistryFileCandidates,b as isWindowsPlatform,d as resolvePackageRunnerExecutable,e as resolvePackageRunnerInvocation,c as shouldUseShellExecution}from'./chunk-RJIYCDVC.js';
@@ -0,0 +1 @@
1
+ export{a as PROJECT_CONTEXT_AGENT_SCHEMA_VERSION,b as PROJECT_GROUNDING_MODE_VALUES,d as WORKSPAI_PROJECT_GROUNDING_END,c as WORKSPAI_PROJECT_GROUNDING_START,e as buildProjectContextAgent,h as resolveWorkspaceProjectLensTargets,f as syncProjectIntelligenceLens,g as syncWorkspaceProjectLenses}from'./chunk-SHXJ2GDR.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-2OIBHUVH.js';import {f,e}from'./chunk-SS2VV3D5.js';import {createHash}from'crypto';import c from'path';import {execa}from'execa';import u from'fs-extra';var J="workspai.project-test-coverage.v1",k=".workspai/reports/project-test-coverage-last-run.json",L=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","deno.json","deno.jsonc"];function p(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function g(e,t,o=0){let n=p(e),r=Math.min(p(t),n),i=p(o);return {total:n,covered:r,skipped:i,percent:n>0?Math.round(r/n*1e4)/100:null}}function N(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;return g(t.total,t.covered,t.skipped)}function y(e,t){let o=c.isAbsolute(t)?t:c.resolve(e,t),n=c.relative(e,o);return n&&!n.startsWith("..")?n.split(c.sep).join("/"):t}async function x(e){return createHash("sha256").update(await u.readFile(e)).digest("hex")}async function I(e){let t=c.resolve(e);for(;;){if(await u.pathExists(c.join(t,".workspai","project.json"))||await u.pathExists(c.join(t,".rapidkit","project.json"))||(await Promise.all(L.map(r=>u.pathExists(c.join(t,r))))).some(Boolean))return t;let n=c.dirname(t);if(n===t)return c.resolve(e);t=n;}}async function $(e){if(await u.pathExists(c.join(e,"deno.json"))||await u.pathExists(c.join(e,"deno.jsonc")))return "deno";if(await u.pathExists(c.join(e,"bun.lock"))||await u.pathExists(c.join(e,"bun.lockb")))return "bun";if(await u.pathExists(c.join(e,"package.json")))return "node";if(await u.pathExists(c.join(e,"pyproject.toml"))||await u.pathExists(c.join(e,"requirements.txt")))return "python";if(await u.pathExists(c.join(e,"go.mod")))return "go";let t=await u.pathExists(c.join(e,"pom.xml"))||await u.pathExists(c.join(e,"build.gradle"))||await u.pathExists(c.join(e,"build.gradle.kts"));return t&&(await P(e,o=>o.endsWith(".kt")||o.endsWith(".kts")&&o!=="build.gradle.kts"&&o!=="settings.gradle.kts",4)).length>0?"kotlin":t?"java":await u.pathExists(c.join(e,"Cargo.toml"))?"rust":await u.pathExists(c.join(e,"composer.json"))?"php":await u.pathExists(c.join(e,"Gemfile"))?"ruby":await u.pathExists(c.join(e,"mix.exs"))?"elixir":await u.pathExists(c.join(e,"deps.edn"))||await u.pathExists(c.join(e,"project.clj"))?"clojure":await u.pathExists(c.join(e,"build.sbt"))?"scala":await u.pathExists(c.join(e,"CMakeLists.txt"))?(await P(e,n=>/\.(c|cc|cpp|cxx)$/.test(n),3)).some(n=>/\.(cc|cpp|cxx)$/.test(n))?"cpp":"c":(await P(e,o=>/\.(sln|csproj)$/.test(o),2)).length>0?"dotnet":"unknown"}async function P(e,t,o=5){let n=[],r=[{dir:e,depth:0}],i=new Set([".git",".workspai",".rapidkit","node_modules",".venv","vendor","deps"]);for(;r.length>0;){let s=r.shift();if(!s)break;let a=await u.readdir(s.dir,{withFileTypes:true}).catch(()=>[]);for(let l of a){if(i.has(l.name))continue;let d=c.join(s.dir,l.name),m=c.relative(e,d).split(c.sep).join("/");l.isFile()&&t(l.name,m)&&n.push(d),l.isDirectory()&&s.depth<o&&r.push({dir:d,depth:s.depth+1});}}return n}async function S(e,t){let o=await u.readJson(t),n=o.total??o,r={};for(let s of ["lines","branches","functions","statements"]){let a=N(n[s]);a&&(r[s]=a);}let i=[];for(let[s,a]of Object.entries(o)){if(s==="total"||!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d={};for(let m of ["lines","branches","functions","statements"]){let b=N(l[m]);b&&(d[m]=b);}i.push({path:y(e,s),metrics:d});}return {metrics:r,files:i,source:{format:"istanbul-json",path:t,sha256:await x(t)}}}async function H(e,t){let o=await u.readJson(t),n=o.totals??{},r={lines:g(n.num_statements,n.covered_lines)};p(n.num_branches)>0&&(r.branches=g(n.num_branches,n.covered_branches));let i=[];for(let[s,a]of Object.entries(o.files??{})){let l=a?.summary??{};i.push({path:y(e,s),metrics:{lines:g(l.num_statements,l.covered_lines),...p(l.num_branches)>0?{branches:g(l.num_branches,l.covered_branches)}:{}}});}return {metrics:r,files:i,source:{format:"coverage-py-json",path:t,sha256:await x(t)}}}function j(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=p(t.count),n=p(t.covered);return o>0?g(o,n):void 0}async function V(e,t){let o=await u.readJson(t),n=Array.isArray(o.data)?o.data[0]??{}:o,r=n.totals??{},i={};i.lines=j(r.lines),i.functions=j(r.functions),i.branches=j(r.branches),i.statements=j(r.regions);let s=[];for(let a of Array.isArray(n.files)?n.files:[]){if(!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d=l.summary??{};s.push({path:y(e,String(l.filename??"unknown")),metrics:{lines:j(d.lines),functions:j(d.functions),branches:j(d.branches),statements:j(d.regions)}});}return {metrics:i,files:s,source:{format:"llvm-cov-json",path:t,sha256:await x(t)}}}async function M(e,t){let o=await u.readFile(t,"utf8"),n=[],r="",i=0,s=0,a=0,l=0,d=0,m=0,b=v=>{r&&(n.push({path:y(e,r),metrics:{lines:g(v.lineTotal,v.lineCovered),functions:g(v.functionTotal,v.functionCovered),branches:g(v.branchTotal,v.branchCovered)}}),i+=v.lineTotal,s+=v.lineCovered,a+=v.functionTotal,l+=v.functionCovered,d+=v.branchTotal,m+=v.branchCovered);},h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0};for(let v of o.split(/\r?\n/))v.startsWith("SF:")?r=v.slice(3):v.startsWith("LF:")?h.lineTotal=p(v.slice(3)):v.startsWith("LH:")?h.lineCovered=p(v.slice(3)):v.startsWith("FNF:")?h.functionTotal=p(v.slice(4)):v.startsWith("FNH:")?h.functionCovered=p(v.slice(4)):v.startsWith("BRF:")?h.branchTotal=p(v.slice(4)):v.startsWith("BRH:")?h.branchCovered=p(v.slice(4)):v==="end_of_record"&&(b(h),r="",h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0});return {metrics:{lines:g(i,s),functions:g(a,l),branches:g(d,m)},files:n,source:{format:"lcov",path:t,sha256:await x(t)}}}async function G(e,t){let o=await u.readFile(t,"utf8"),n=new Map;for(let s of o.split(/\r?\n/).slice(1)){let a=/^(.+?):\d+\.\d+,\d+\.\d+\s+(\d+)\s+(\d+)$/.exec(s.trim());if(!a)continue;let l=n.get(a[1])??{total:0,covered:0},d=p(a[2]);l.total+=d,p(a[3])>0&&(l.covered+=d),n.set(a[1],l);}let r=[...n.entries()].map(([s,a])=>({path:y(e,s),metrics:{statements:g(a.total,a.covered)}})),i=[...n.values()].reduce((s,a)=>({total:s.total+a.total,covered:s.covered+a.covered}),{total:0,covered:0});return {metrics:{statements:g(i.total,i.covered)},files:r,source:{format:"go-coverprofile",path:t,sha256:await x(t)}}}function T(e,t){let n=[...e.matchAll(new RegExp(`<counter\\s+type=["']${t}["']\\s+missed=["'](\\d+)["']\\s+covered=["'](\\d+)["']\\s*\\/?\\s*>`,"gi"))].at(-1);return n?g(Number(n[1])+Number(n[2]),n[2]):void 0}async function C(e,t){let o=await u.readFile(e,"utf8"),n={};if(t==="cobertura-xml"){let r=/<coverage\b([^>]*)>/i.exec(o)?.[1]??"",i=/\bline-rate=["']([\d.]+)["']/i.exec(r)?.[1],s=/\bbranch-rate=["']([\d.]+)["']/i.exec(r)?.[1];i&&(n.lines=g(1e4,Math.round(Number(i)*1e4))),s&&(n.branches=g(1e4,Math.round(Number(s)*1e4)));}if(t==="clover-xml"){let i=[...o.matchAll(/<metrics\b([^>]*)\/?>/gi)].at(-1)?.[1]??"",s=m=>p(new RegExp(`\\b${m}=["'](\\d+)["']`,"i").exec(i)?.[1]),a=s("statements"),l=s("methods"),d=s("conditionals");a>0&&(n.statements=g(a,s("coveredstatements"))),l>0&&(n.functions=g(l,s("coveredmethods"))),d>0&&(n.branches=g(d,s("coveredconditionals")));}return n.lines??=T(o,"LINE"),n.branches??=T(o,"BRANCH"),n.functions??=T(o,"METHOD"),n.statements??=T(o,"INSTRUCTION"),{metrics:n,files:[],source:{format:t,path:e,sha256:await x(e)}}}async function q(e){let t=await u.readFile(e,"utf8"),o=/<scoverage\b([^>]*)>/i.exec(t)?.[1]??"",n=b=>p(new RegExp(`\\b${b}=["']([\\d.]+)["']`,"i").exec(o)?.[1]),r=n("statement-count"),i=n("statements-invoked"),s=n("branch-count"),a=n("branches-invoked"),l=n("statement-rate"),d=n("branch-rate"),m={};return r>0?m.statements=g(r,i):l>0&&(m.statements=g(1e4,Math.round(l*100))),s>0?m.branches=g(s,a):d>0&&(m.branches=g(1e4,Math.round(d*100))),{metrics:m,files:[],source:{format:"scoverage-xml",path:e,sha256:await x(e)}}}async function D(e,t){let o=await u.readJson(t),n=new Map;for(let s of Object.values(o)){let a=s?.coverage;if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[l,d]of Object.entries(a)){if(!Array.isArray(d))continue;let m=n.get(l)??[];d.forEach((b,h)=>{typeof b=="number"&&(m[h]=Math.max(m[h]??0,b));}),n.set(l,m);}}let r=[...n.entries()].map(([s,a])=>{let l=a.filter(d=>typeof d=="number");return {path:y(e,s),metrics:{lines:g(l.length,l.filter(d=>d>0).length)}}}),i=r.reduce((s,a)=>{let l=a.metrics.lines;return {total:s.total+(l?.total??0),covered:s.covered+(l?.covered??0)}},{total:0,covered:0});return {metrics:{lines:g(i.total,i.covered)},files:r,source:{format:"simplecov-json",path:t,sha256:await x(t)}}}async function z(e){let t=[{relativePath:"coverage/coverage-summary.json",parser:r=>S(e,r)},{relativePath:"coverage.json",parser:async r=>{let i=await u.readJson(r);return Array.isArray(i.data)?V(e,r):H(e,r)}},{relativePath:"coverage/lcov.info",parser:r=>M(e,r)},{relativePath:"cover/lcov.info",parser:r=>M(e,r)},{relativePath:"lcov.info",parser:r=>M(e,r)},{relativePath:"coverage.out",parser:r=>G(e,r)},{relativePath:"target/site/jacoco/jacoco.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"build/reports/jacoco/test/jacocoTestReport.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"coverage.xml",parser:r=>C(r,"clover-xml")},{relativePath:".resultset.json",parser:r=>D(e,r)}];for(let r of t){let i=c.join(e,r.relativePath);if(await u.pathExists(i))return r.parser(i)}let n=(await P(e,(r,i)=>r==="coverage.cobertura.xml"||r==="jacoco.xml"||r==="clover.xml"||r==="scoverage.xml"||i.endsWith("/coverage-summary.json"),7)).sort()[0];return n?n.endsWith("coverage-summary.json")?S(e,n):n.endsWith("jacoco.xml")?C(n,"jacoco-xml"):n.endsWith("coverage.cobertura.xml")?C(n,"cobertura-xml"):n.endsWith("scoverage.xml")?q(n):C(n,"clover-xml"):null}async function B(e){return u.readJson(c.join(e,"package.json")).catch(()=>null)}async function U(e,t){let o=(n,r)=>({cwd:e,executable:n,args:r});if(t==="node"||t==="bun"){let r=(await B(e))?.scripts??{},i=["test:coverage","test:cov","coverage"].find(a=>typeof r[a]=="string"),s=t==="bun"?"bun":await u.pathExists(c.join(e,"pnpm-lock.yaml"))?"pnpm":await u.pathExists(c.join(e,"yarn.lock"))?"yarn":"npm";if(i)return {runner:String(r[i]).split(/\s+/)[0]||s,invocations:[o(s,s==="yarn"?[i]:["run",i])],diagnostics:[]};if(typeof r.test=="string"){let a=s==="yarn"?["test","--coverage"]:s==="bun"?["test","--coverage","--coverage-reporter=lcov"]:["test","--","--coverage"];return {runner:String(r.test).split(/\s+/)[0]||s,invocations:[o(s,a)],diagnostics:[]}}return {runner:null,invocations:[],diagnostics:["No project-owned test or coverage script was detected."]}}if(t==="deno")return {runner:"deno",invocations:[o("deno",["test","--coverage=coverage"]),o("deno",["coverage","--lcov","--output=coverage/lcov.info","coverage"])],diagnostics:[]};if(t==="python")return {runner:"pytest-cov",invocations:[o(await u.pathExists(c.join(e,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"))?c.join(".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"):process.platform==="win32"?"python":"python3",["-m","pytest","--cov=.","--cov-report=json:coverage.json"])],diagnostics:[]};if(t==="go")return {runner:"go test",invocations:[o("go",["test","./...","-coverprofile=coverage.out"])],diagnostics:[]};if(t==="java"){let n=await u.pathExists(c.join(e,"gradlew")),r=await u.pathExists(c.join(e,"gradlew.bat")),i=n||r,s=await u.pathExists(c.join(e,"mvnw")),a=await u.pathExists(c.join(e,"mvnw.cmd")),l=i?process.platform==="win32"&&r?".\\gradlew.bat":"./gradlew":await u.pathExists(c.join(e,"pom.xml"))?process.platform==="win32"&&a?".\\mvnw.cmd":s?"./mvnw":"mvn":"gradle";return {runner:i?"jacoco/gradle":"jacoco/maven",invocations:[o(l,i?["test","jacocoTestReport"]:["test","jacoco:report"])],diagnostics:[]}}return t==="dotnet"?{runner:"dotnet coverlet",invocations:[o("dotnet",["test","--collect:XPlat Code Coverage"])],diagnostics:[]}:t==="rust"?{runner:"cargo llvm-cov",invocations:[o("cargo",["llvm-cov","--json","--output-path","coverage.json"])],diagnostics:["cargo-llvm-cov must be available in the project toolchain."]}:t==="php"?{runner:"phpunit",invocations:[o(process.platform==="win32"?"vendor\\bin\\phpunit.bat":"vendor/bin/phpunit",["--coverage-clover","coverage.xml"])],diagnostics:[]}:t==="ruby"?{runner:"simplecov",invocations:[o("bundle",["exec","rspec"])],diagnostics:["The test suite must enable SimpleCov to emit .resultset.json."]}:t==="elixir"?{runner:"mix cover",invocations:[o("mix",["test","--cover"])],diagnostics:["Configure ExCoveralls for JSON or LCOV interchange when machine-readable coverage is required."]}:t==="clojure"?{runner:"cloverage",invocations:[o("clojure",["-M:coverage"])],diagnostics:["The project must declare a coverage alias such as cloverage."]}:t==="scala"?{runner:"sbt-scoverage",invocations:[o("sbt",["clean","coverage","test","coverageReport"])],diagnostics:["The project must declare the scoverage plugin."]}:t==="kotlin"?{runner:"jacoco/gradle",invocations:[o(await u.pathExists(c.join(e,process.platform==="win32"?"gradlew.bat":"gradlew"))?process.platform==="win32"?".\\gradlew.bat":"./gradlew":"gradle",["test","jacocoTestReport"])],diagnostics:["The project must declare the JaCoCo Gradle plugin."]}:t==="c"||t==="cpp"?{runner:"CTest/LLVM coverage",invocations:[o("ctest",["--test-dir","build","--output-on-failure"])],diagnostics:["The native build must be instrumented for coverage and export LCOV, Cobertura, or LLVM JSON evidence."]}:{runner:null,invocations:[],diagnostics:["Project runtime could not be detected."]}}function K(e,t){let o=e?c.relative(e,t).split(c.sep).join("/"):c.resolve(t),n=c.basename(t).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"project",r=createHash("sha256").update(o).digest("hex").slice(0,12);return `${n}--${r}`}function X(e){return e.lines?"lines":e.statements?"statements":e.branches?"branches":"functions"}async function se(e$1={}){let t=await I(e$1.projectPath??process.cwd()),o=a(t),n=await $(t),r=Math.max(0,Math.min(100,Math.round(e$1.target??80))),i=await U(t,n),s=[],a$1=Date.now();if(e$1.run)for(let f of i.invocations){let w=await execa(f.executable,f.args,{cwd:f.cwd,reject:false,timeout:6e5}).catch(()=>({exitCode:1}));if(s.push(Number(w.exitCode??1)),Number(w.exitCode??1)!==0)break}let l=await z(t).catch(()=>null),d=l?X(l.metrics):"lines",m=l?.metrics[d]?.percent??null,b=e$1.run&&s.some(f=>f!==0)?"failed":m===null?"unavailable":m>=r?"passed":"below-target",h=K(o,t),v=c.join(t,k),R=o?`.workspai/reports/projects/${h}/project-test-coverage-last-run.json`:null,E={schemaVersion:J,generatedAt:new Date().toISOString(),status:b,project:{id:h,name:c.basename(t),path:t,workspacePath:o},runtime:n,runner:i.runner,target:{metric:d,percent:r},metrics:l?.metrics??{},files:l?.files??[],lowCoverageFiles:(l?.files??[]).map(f=>{let w=f.metrics[d]??f.metrics.lines??f.metrics.statements;return {path:f.path,percent:w?.percent??null,uncovered:Math.max(0,(w?.total??0)-(w?.covered??0))}}).filter(f=>f.percent===null||f.percent<r).sort((f,w)=>w.uncovered-f.uncovered||f.path.localeCompare(w.path)),source:l?.source??{format:"unknown",path:null,sha256:null},execution:{requested:e$1.run===true,invocations:i.invocations,exitCodes:s,durationMs:Date.now()-a$1},diagnostics:[...i.diagnostics,...l?[]:["No supported machine-readable coverage artifact was found."]],artifactPaths:{project:v,workspaceLatest:o?c.join(o,k):null,workspaceProject:o&&R?c.join(o,R):null}};return o&&R&&await f(o,k,[{relativePath:k,payload:E},{relativePath:R,payload:E}]),await e(t,k,E),E}export{k as PROJECT_TEST_COVERAGE_ARTIFACT,J as PROJECT_TEST_COVERAGE_SCHEMA,se as collectProjectTestCoverage};
@@ -1 +1 @@
1
- export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-FTY7GGXJ.js';
1
+ export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-3GRKUP5W.js';
@@ -0,0 +1,140 @@
1
+ import {c}from'./chunk-IBJEQHJR.js';import {i}from'./chunk-VRW6KXNK.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import t from'path';import d from'chalk';import {execa}from'execa';var f="3000";function w(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")||"axum-api"}function k(e,i){return `[package]
2
+ name = "${e}"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ description = "${i.replace(/["\r\n]/g," ")}"
6
+
7
+ [dependencies]
8
+ axum = "0.8"
9
+ serde = { version = "1", features = ["derive"] }
10
+ tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
11
+ tower-http = { version = "0.6", features = ["trace"] }
12
+ tracing = "0.1"
13
+ tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
14
+
15
+ [dev-dependencies]
16
+ tower = { version = "0.5", features = ["util"] }
17
+ `}function _(e){return `use axum::{routing::get, Json, Router};
18
+ use serde::Serialize;
19
+ use std::{env, net::SocketAddr};
20
+ use tower_http::trace::TraceLayer;
21
+ use tracing::info;
22
+
23
+ #[derive(Serialize)]
24
+ struct Health {
25
+ status: &'static str,
26
+ }
27
+
28
+ fn app() -> Router {
29
+ Router::new()
30
+ .route("/health", get(|| async { Json(Health { status: "ok" }) }))
31
+ .layer(TraceLayer::new_for_http())
32
+ }
33
+
34
+ #[tokio::main]
35
+ async fn main() -> Result<(), Box<dyn std::error::Error>> {
36
+ tracing_subscriber::fmt()
37
+ .with_env_filter(
38
+ tracing_subscriber::EnvFilter::try_from_default_env()
39
+ .unwrap_or_else(|_| "info,tower_http=info".into()),
40
+ )
41
+ .init();
42
+
43
+ let port = env::var("PORT").unwrap_or_else(|_| "${e}".to_string());
44
+ let address: SocketAddr = format!("0.0.0.0:{port}").parse()?;
45
+ let listener = tokio::net::TcpListener::bind(address).await?;
46
+ info!(%address, "Axum service listening");
47
+ axum::serve(listener, app())
48
+ .with_graceful_shutdown(shutdown_signal())
49
+ .await?;
50
+ Ok(())
51
+ }
52
+
53
+ async fn shutdown_signal() {
54
+ let _ = tokio::signal::ctrl_c().await;
55
+ }
56
+
57
+ #[cfg(test)]
58
+ mod tests {
59
+ use super::*;
60
+ use axum::{body::Body, http::{Request, StatusCode}};
61
+ use tower::ServiceExt;
62
+
63
+ #[tokio::test]
64
+ async fn health_is_ready() {
65
+ let response = app()
66
+ .oneshot(Request::builder().uri("/health").body(Body::empty()).unwrap())
67
+ .await
68
+ .unwrap();
69
+ assert_eq!(response.status(), StatusCode::OK);
70
+ }
71
+ }
72
+ `}function h(e){return `FROM rust:1-bookworm AS builder
73
+ WORKDIR /app
74
+ COPY Cargo.toml Cargo.lock* ./
75
+ COPY src ./src
76
+ RUN cargo build --release
77
+
78
+ FROM debian:bookworm-slim
79
+ RUN useradd --create-home --uid 10001 app
80
+ COPY --from=builder /app/target/release/${e} /usr/local/bin/${e}
81
+ USER app
82
+ ENV PORT=3000
83
+ EXPOSE 3000
84
+ CMD ["/usr/local/bin/${e}"]
85
+ `}function b(){return `name: CI
86
+ on:
87
+ push:
88
+ pull_request:
89
+ permissions:
90
+ contents: read
91
+ jobs:
92
+ verify:
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: dtolnay/rust-toolchain@stable
97
+ with:
98
+ components: rustfmt, clippy
99
+ - uses: Swatinem/rust-cache@v2
100
+ - run: cargo fmt --check
101
+ - run: cargo clippy --all-targets --all-features -- -D warnings
102
+ - run: cargo test --all-targets --all-features
103
+ - run: cargo build --release
104
+ `}function y(){return `#!/usr/bin/env sh
105
+ set -eu
106
+ COMMAND="\${1:-help}"
107
+ shift 2>/dev/null || true
108
+ case "$COMMAND" in
109
+ init) cargo fetch "$@" ;;
110
+ dev) RUST_LOG="\${RUST_LOG:-info,tower_http=info}" cargo run "$@" ;;
111
+ start) cargo run --release "$@" ;;
112
+ build) cargo build --release "$@" ;;
113
+ test) cargo test --all-targets --all-features "$@" ;;
114
+ lint) cargo clippy --all-targets --all-features -- -D warnings ;;
115
+ format) cargo fmt --all "$@" ;;
116
+ help|--help|-h)
117
+ echo "Workspai Rust/Axum commands: init, dev, start, build, test, lint, format"
118
+ ;;
119
+ *) echo "Unknown command: $COMMAND" >&2; exit 1 ;;
120
+ esac
121
+ `}function v(){return `@echo off
122
+ set COMMAND=%1
123
+ if "%COMMAND%"=="init" cargo fetch
124
+ if "%COMMAND%"=="dev" cargo run
125
+ if "%COMMAND%"=="start" cargo run --release
126
+ if "%COMMAND%"=="build" cargo build --release
127
+ if "%COMMAND%"=="test" cargo test --all-targets --all-features
128
+ if "%COMMAND%"=="lint" cargo clippy --all-targets --all-features -- -D warnings
129
+ if "%COMMAND%"=="format" cargo fmt --all
130
+ if "%COMMAND%"=="help" echo Workspai Rust/Axum commands: init, dev, start, build, test, lint, format
131
+ `}async function O(e,i){i||await b$1(e)||await promises.stat(t.join(e,".git")).then(()=>true).catch(()=>false)||await execa("git",["init"],{cwd:e,reject:false,env:a()});}async function T(e,i$1){let n=w(i$1.project_name),a=i$1.port&&/^\d+$/.test(i$1.port)?i$1.port:f,p=i$1.description?.trim()||"Production-ready Axum API scaffolded by Workspai.",m=new Date().toISOString(),o=i();await promises.mkdir(e,{recursive:true}),await c(t.join(e,"Cargo.toml"),k(n,p)),await c(t.join(e,"src","main.rs"),_(a)),await c(t.join(e,".env.example"),`PORT=${a}
132
+ RUST_LOG=info
133
+ `),await c(t.join(e,".gitignore"),`/target
134
+ .env
135
+ `),await c(t.join(e,"Dockerfile"),h(n)),await c(t.join(e,".dockerignore"),`target
136
+ .git
137
+ .env
138
+ `),await c(t.join(e,".github","workflows","ci.yml"),b()),await c(t.join(e,"rapidkit"),y()),await c(t.join(e,"rapidkit.cmd"),v()),await c(t.join(e,".workspai","context.json"),JSON.stringify({engine:"npm",runtime:"rust",framework:"axum",kind:"backend",category:"backend"},null,2)),await c(t.join(e,".workspai","project.json"),JSON.stringify({schema_version:"1.0",name:n,slug:n,kind:"backend",project_type:"backend",category:"backend",runtime:"rust",framework:"axum",framework_display_name:"Axum",kit_name:"rust.axum",kit:"rust.axum",engine:"npm",support_tier:"extended",module_support:false,modules:[],workspai_version:o,rapidkit_version:o,generated_by:"workspai",generated_at:m,ports:[{name:"http",port:Number(a),protocol:"http"}],contracts:{owns:[],apis:[{method:"GET",path:"/health"}],publishes:[],consumes:[],dependsOn:[],env:["PORT","RUST_LOG"]}},null,2)),process.platform!=="win32"&&await promises.chmod(t.join(e,"rapidkit"),493),await O(e,i$1.skipGit??false),console.log(d.green(`
139
+ \u2705 Rust/Axum project ready!
140
+ `)),console.log(d.gray(`Next: cd ${i$1.project_name} && npx workspai init`));}export{f as DEFAULT_AXUM_PORT,T as generateRustAxumKit};
@@ -1,4 +1,4 @@
1
- import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import g from'path';import i from'chalk';import R from'ora';import {execa}from'execa';var x="21",j="3.5.0",M="2.8.9";function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function h(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function E(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function T(e,t){let s=f(e)||"com.workspai.apps",p=f(t)||"service";return `${s}.${p}`}function A(e){return e.replace(/\./g,"/")}function P(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function C(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"workspai",workspai_version:t,rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function D(e){return `<?xml version="1.0" encoding="UTF-8"?>
1
+ import {b,c}from'./chunk-IBJEQHJR.js';import {i}from'./chunk-VRW6KXNK.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import g from'path';import i$1 from'chalk';import R from'ora';import {execa}from'execa';var x="21",j="3.5.0",M="2.8.9";function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function h(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function E(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function T(e,t){let s=f(e)||"com.workspai.apps",p=f(t)||"service";return `${s}.${p}`}function A(e){return e.replace(/\./g,"/")}function P(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function C(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"workspai",workspai_version:t,rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function D(e){return `<?xml version="1.0" encoding="UTF-8"?>
2
2
  <project xmlns="http://maven.apache.org/POM/4.0.0"
3
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
4
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -687,11 +687,11 @@ class ServiceRuntimeE2ETest {
687
687
  assertThat(response.getBody()).containsEntry("status", "UP");
688
688
  }
689
689
  }
690
- `}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",n={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=c(),l=`${b(n.project_name)}Application`,o=A(n.package_name);if(!n.skipInstall)try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i.yellow(`
691
- \u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(i.gray(` Install: https://maven.apache.org/install.html
692
- `));}let c$2=R(`Generating Spring Boot project: ${n.project_name}...`).start();try{let r=(d,v)=>c$1(g.join(e,d),v),$=g.join(e,"rapidkit"),y=g.join(e,"rapidkit.cmd");if(await Promise.all([r("pom.xml",D(n)),r(".gitignore",Y()),r(".editorconfig",X()),r(".env.example",U(n)),r(".dockerignore",z()),r("Dockerfile",H(n)),r("docker-compose.yml",F(n)),r(".github/workflows/ci.yml",K(n)),r("README.md",Q(n)),r("src/main/resources/application.yml",J(n)),r("src/test/resources/application.yml",G()),r(`src/main/java/${o}/${l}.java`,B(n,l)),r(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(n)),r(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(n)),r(`src/main/java/${o}/application/SystemInfoService.java`,q(n)),r(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(n)),r(`src/main/java/${o}/api/http/SystemInfoController.java`,N(n)),r(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(n)),r(`src/test/java/${o}/${l}Tests.java`,ne(n,l)),r(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(n)),r(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(n)),r("scripts/perf-smoke.sh",Z(n)),r(".workspai/project.json",C(n,b$2)),r(".workspai/context.json",P()),r("rapidkit",ee(n)),r("rapidkit.cmd",te())]),await promises.chmod($,493),await promises.chmod(y,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),n.skipInstall||await oe(e)||console.log(i.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$2.succeed(i.green(`Project created at ${e}`)),n.skipInstall)c$2.info(i.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$2.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$2.succeed(i.gray("\u2713 maven dependency warm-up completed"));}catch{c$2.warn(i.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!n.skipGit)try{await b$1(e)?console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i.green(`
690
+ `}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",n={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=i(),l=`${b(n.project_name)}Application`,o=A(n.package_name);if(!n.skipInstall)try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i$1.yellow(`
691
+ \u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(i$1.gray(` Install: https://maven.apache.org/install.html
692
+ `));}let c$1=R(`Generating Spring Boot project: ${n.project_name}...`).start();try{let r=(d,v)=>c(g.join(e,d),v),$=g.join(e,"rapidkit"),y=g.join(e,"rapidkit.cmd");if(await Promise.all([r("pom.xml",D(n)),r(".gitignore",Y()),r(".editorconfig",X()),r(".env.example",U(n)),r(".dockerignore",z()),r("Dockerfile",H(n)),r("docker-compose.yml",F(n)),r(".github/workflows/ci.yml",K(n)),r("README.md",Q(n)),r("src/main/resources/application.yml",J(n)),r("src/test/resources/application.yml",G()),r(`src/main/java/${o}/${l}.java`,B(n,l)),r(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(n)),r(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(n)),r(`src/main/java/${o}/application/SystemInfoService.java`,q(n)),r(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(n)),r(`src/main/java/${o}/api/http/SystemInfoController.java`,N(n)),r(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(n)),r(`src/test/java/${o}/${l}Tests.java`,ne(n,l)),r(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(n)),r(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(n)),r("scripts/perf-smoke.sh",Z(n)),r(".workspai/project.json",C(n,b$2)),r(".workspai/context.json",P()),r("rapidkit",ee(n)),r("rapidkit.cmd",te())]),await promises.chmod($,493),await promises.chmod(y,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),n.skipInstall||await oe(e)||console.log(i$1.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$1.succeed(i$1.green(`Project created at ${e}`)),n.skipInstall)c$1.info(i$1.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$1.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$1.succeed(i$1.gray("\u2713 maven dependency warm-up completed"));}catch{c$1.warn(i$1.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!n.skipGit)try{await b$1(e)?console.log(i$1.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i$1.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i$1.green(`
693
693
  \u2728 Spring Boot project created successfully!
694
- `)),console.log(i.cyan("\u{1F4C2} Location:"),i.white(e)),console.log(i.cyan(`
694
+ `)),console.log(i$1.cyan("\u{1F4C2} Location:"),i$1.white(e)),console.log(i$1.cyan(`
695
695
  \u{1F680} Get started:
696
- `)),console.log(i.white(` cd ${n.project_name}`)),console.log(i.white(" npx workspai init")),console.log(i.white(` npx workspai dev
697
- `)),console.log(i.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(r){c$2.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw r}}export{x as DEFAULT_JAVA_VERSION,M as DEFAULT_SPRINGDOC_VERSION,j as DEFAULT_SPRING_BOOT_VERSION,ve as generateSpringBootKit};
696
+ `)),console.log(i$1.white(` cd ${n.project_name}`)),console.log(i$1.white(" npx workspai init")),console.log(i$1.white(` npx workspai dev
697
+ `)),console.log(i$1.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(r){c$1.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw r}}export{x as DEFAULT_JAVA_VERSION,M as DEFAULT_SPRINGDOC_VERSION,j as DEFAULT_SPRING_BOOT_VERSION,ve as generateSpringBootKit};
@@ -0,0 +1 @@
1
+ export{c as captureWorkspaceRegistrationStrict,k as createProject,j as createWorkspace,m as createWorkspaceShareBundle,l as listWorkspaces,a as normalizeWorkspaceEntry,i as registerProjectInWorkspace,h as registerProjectInWorkspaceStrict,f as registerWorkspace,b as registerWorkspaceStrict,d as restoreWorkspaceRegistrationStrict,g as syncWorkspaceProjects,e as unregisterWorkspaceStrict}from'./chunk-DDQ3XK3H.js';
@@ -1 +1 @@
1
- export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-HZDXO65G.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-CRHYBQI3.js';
1
+ export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,e as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_REPORTS_INDEX_PATH,d as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildCanonicalAgentReportReadOrder,j as buildWorkspaceAgentReportsIndex,k as parseAgentGroundingTargets,l as syncWorkspaceAgentGrounding}from'./chunk-UETZ7USY.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-DQ3PI7EP.js';
@@ -0,0 +1 @@
1
+ export{f as WORKSPACE_ARCHIVE_KIND,e as WORKSPACE_ARCHIVE_MANIFEST_PATH,h as assertSafeRemoteArchiveUrl,o as doctorWorkspaceArchive,l as exportWorkspaceArchive,p as hydrateWorkspaceArchive,m as inspectWorkspaceArchive,g as isPrivateAddress,j as isSafeArchiveEntryName,i as sanitizeWorkspaceArchiveName,k as shouldExcludeWorkspaceArchivePath,n as verifyWorkspaceArchive}from'./chunk-TDTCMZK7.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-LHOZXC2M.js';
1
+ export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-IDQKVJUF.js';
@@ -0,0 +1 @@
1
+ export{g as WORKSPACE_CONTRACT_PATH,i as WORKSPACE_CONTRACT_SCHEMA_VERSION,h as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,j as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,k as WorkspaceContractVerificationError,m as buildWorkspaceContract,q as buildWorkspaceContractGraph,l as discoverProjectJsonFiles,p as readWorkspaceContract,o as syncWorkspaceContract,r as verifyWorkspaceContract,n as writeWorkspaceContract,s as writeWorkspaceContractVerifyEvidence}from'./chunk-KMLPHFLD.js';
@@ -0,0 +1 @@
1
+ export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-MV7KF75Q.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-DQ3PI7EP.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-C3FLCDRN.js';
@@ -0,0 +1 @@
1
+ export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-BHYTI3RH.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-DQ3PI7EP.js';
@@ -1 +1 @@
1
- import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-ESLPI3XZ.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
1
+ import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-BQGBU2Y3.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
@@ -1 +1 @@
1
- import {b}from'./chunk-I46XEIPL.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-ORDK7A36.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-JFUD73OZ.js';import {a}from'./chunk-Y5YAP4F3.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-6VXIAQLX.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-YPKNQCLK.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {a}from'./chunk-AFIFZTOY.js';import g from'crypto';import H from'path';var M="workspace-graph-stream.v1";function w(o){return c$1({...o,generatedAt:"<ignored>",proofs:o.proofs.map(s=>({...s,observedAt:"<ignored>"}))})}function f(o){return "observedAt"in o?{...o,observedAt:"<ignored>"}:o}function u(o,s){let e=new Map(o.map(r=>[r.id,r])),a=new Map(s.map(r=>[r.id,r])),i=s.filter(r=>!e.has(r.id)),p=s.filter(r=>{let t=e.get(r.id);return t?c$1(f(t))!==c$1(f(r)):false}),d=o.filter(r=>!a.has(r.id)).map(r=>r.id);return {added:i,updated:p,removed:d}}function E(o,s){let e=new Map(o.map(a=>[a.id,a]));return s.filter(a=>{let i=e.get(a.id);return !i||c$1(i)!==c$1(a)})}function I(o){return a(o,"contracts/workspace-intelligence/workspace-graph-stream.v1.json","Workspace graph stream event"),o}var R=class{previous=null;revision=0;generation=0;workspaceId;sessionId;now;nextCorrelationId;constructor(s){this.workspaceId=`workspace:${g.createHash("sha256").update(H.resolve(s.workspacePath)).digest("hex")}`,this.sessionId=s.sessionId??g.randomUUID(),this.now=s.now??(()=>new Date),this.nextCorrelationId=s.correlationId??(()=>g.randomUUID());}publish(s,e){c(e,s);let a=this.now().toISOString(),i=d(s),p=w(e),d$1=this.nextCorrelationId(),r={schemaVersion:M,workspaceId:this.workspaceId,sessionId:this.sessionId,generation:this.generation,modelHash:i,graphHash:p,generatedAt:a,causationId:d$1,correlationId:d$1};if(!this.previous){let S=I({...r,type:"graph.snapshot",revision:this.revision,payload:{graph:e,reason:"initial"}});return this.previous=e,S}let t=this.previous,W=this.revision,b=t.source.hash,y=w(t);this.revision+=1,this.generation+=1;let c$2=u(t.entities,e.entities),h=u(t.relations,e.relations),l=u(t.proofs,e.proofs),G=c$1(t.quality)!==c$1(e.quality),A=I({...r,generation:this.generation,type:"graph.delta",baseRevision:W,baseModelHash:b,baseGraphHash:y,revision:this.revision,payload:{entitiesAdded:c$2.added,entitiesUpdated:c$2.updated,entitiesRemoved:c$2.removed,relationsAdded:h.added,relationsUpdated:h.updated,relationsRemoved:h.removed,proofsAdded:l.added,proofsUpdated:l.updated,proofsRemoved:l.removed,providersUpdated:E(t.providers,e.providers),quality:G?e.quality:null,diagnostics:e.diagnostics}});return this.previous=e,A}};export{M as WORKSPACE_GRAPH_STREAM_SCHEMA_VERSION,R as WorkspaceGraphStreamPublisher};
@@ -1 +1 @@
1
- export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-ESLPI3XZ.js';
1
+ export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-BQGBU2Y3.js';
@@ -0,0 +1 @@
1
+ export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,i as isGitDiffSource,h as migrateLegacyWorkspaceModelSnapshot,j as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-C3FLCDRN.js';export{d as hashWorkspaceModel}from'./chunk-EWZZUQBR.js';
@@ -1 +1 @@
1
- import {a as a$2,b as b$1,c,d as d$1}from'./chunk-3VFA7D5T.js';import {a as a$1}from'./chunk-KB44JP4M.js';import {a}from'./chunk-BMWFQXGW.js';import d from'crypto';import s from'path';import {open,unlink,stat}from'fs/promises';import u from'fs-extra';var k=a.evaluationLive,O=a.evaluationLastRun,W="contracts/workspace-intelligence/model-usage-event.v1.json",E="contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",P="contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json",_=3e4,N=100,b=25;function C(){return {modelCalls:0,toolCalls:0,tokenSources:{providerReported:0,tokenizerCounted:0,estimated:0,unavailable:0},tokens:{input:0,output:0,cachedInput:0,reasoning:0,observedTotal:0},latencyMs:0,costs:[],outcome:{status:"unknown",verified:false,blockersResolved:0},efficiency:{tokensPerVerifiedOutcome:null,noProgressDecisions:0,repeatedArtifactReads:0}}}function m(t){return t??0}function S(t){let e=C(),a=new Map,n=new Map;for(let o of t){if(o.kind==="model-call"){e.modelCalls+=1;let r={"provider-reported":"providerReported","tokenizer-counted":"tokenizerCounted",estimated:"estimated",unavailable:"unavailable"}[o.modelCall.source];if(e.tokenSources[r]+=1,e.tokens.input+=m(o.modelCall.inputTokens),e.tokens.output+=m(o.modelCall.outputTokens),e.tokens.cachedInput+=m(o.modelCall.cachedInputTokens),e.tokens.reasoning+=m(o.modelCall.reasoningTokens),e.latencyMs+=o.modelCall.latencyMs??0,o.modelCall.cost){let i=o.modelCall.cost.currency.toUpperCase(),l=n.get(i)??{currency:i,amount:0,providerReported:0,estimated:0};l.amount+=o.modelCall.cost.amount,o.modelCall.cost.source==="provider-reported"?l.providerReported+=o.modelCall.cost.amount:l.estimated+=o.modelCall.cost.amount,n.set(i,l);}continue}if(o.kind==="tool-call"){e.toolCalls+=1,e.latencyMs+=o.toolCall.durationMs??0,!o.toolCall.changedSource&&o.toolCall.result==="passed"&&(e.efficiency.noProgressDecisions+=1),o.toolCall.artifact&&a.set(o.toolCall.artifact,(a.get(o.toolCall.artifact)??0)+1);continue}o.kind==="outcome"&&(e.outcome={status:o.outcome.status,verified:o.outcome.verified,blockersResolved:o.outcome.blockersResolved});}return e.tokens.observedTotal=e.tokens.input+e.tokens.output,e.costs=[...n.values()].map(o=>({...o,amount:Number(o.amount.toFixed(8)),providerReported:Number(o.providerReported.toFixed(8)),estimated:Number(o.estimated.toFixed(8))})).sort((o,r)=>o.currency.localeCompare(r.currency)),e.efficiency.repeatedArtifactReads=[...a.values()].reduce((o,r)=>o+Math.max(0,r-1),0),e.efficiency.tokensPerVerifiedOutcome=e.outcome.verified&&e.outcome.status==="passed"?e.tokens.observedTotal:null,e}function x(t,e=new Date){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Evaluation event must be a JSON object.");let a=t,n={...a,schemaVersion:a$2,eventId:typeof a.eventId=="string"&&a.eventId.trim()?a.eventId.trim():d.randomUUID(),recordedAt:typeof a.recordedAt=="string"&&a.recordedAt.trim()?a.recordedAt:e.toISOString()};a$1(n,W,"workspace evaluation event");let o={"model-call":"modelCall","tool-call":"toolCall",outcome:"outcome",milestone:"milestone"}[n.kind],r=["modelCall","toolCall","outcome","milestone"].filter(i=>a[i]!==void 0);if(r.length!==1||r[0]!==o)throw new Error(`Evaluation event kind ${n.kind} requires only ${o}.`);if(n.kind==="model-call"&&n.modelCall.source!=="unavailable"&&n.modelCall.inputTokens===null&&n.modelCall.outputTokens===null)throw new Error("Measured model calls require at least one input or output token count.");return n}function J(t){let e=t.now??new Date,a=s.resolve(t.workspacePath),n={schemaVersion:b$1,runId:t.runId??d.randomUUID(),sessionId:t.sessionId??d.randomUUID(),status:"live",startedAt:e.toISOString(),updatedAt:e.toISOString(),workspace:{name:t.workspaceName?.trim()||s.basename(a),path:a},configuration:{taskId:t.taskId.trim(),strategy:t.strategy??"workspace-intelligence",...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.temperature!==void 0?{temperature:t.temperature}:{},...t.baselineRunId?{baselineRunId:t.baselineRunId}:{}},methodology:{id:"provider-usage-and-verified-outcome.v1",claimBoundary:"Provider-reported and tokenizer-counted values are measured; estimated values remain explicitly labelled. Verified task success is required before reporting tokens per successful outcome."},events:[],summary:C()};return a$1(n,E,"workspace evaluation"),n}async function L(t,e){await u.ensureDir(s.dirname(t));let a=`${t}.${process.pid}.${d.randomUUID()}.tmp`;try{await u.writeJson(a,e,{spaces:2}),await u.rename(a,t);}finally{await u.remove(a).catch(()=>{});}}async function A(t,e){let a=s.join(s.resolve(t),`${k}.lock`);await u.ensureDir(s.dirname(a));for(let n=0;n<N;n+=1)try{let o=await open(a,"wx");try{return await o.writeFile(JSON.stringify({pid:process.pid,acquiredAt:new Date().toISOString()})),await e()}finally{await o.close(),await unlink(a).catch(()=>{});}}catch(o){if(o.code!=="EEXIST")throw o;let i=await stat(a).catch(()=>null);if(i&&Date.now()-i.mtimeMs>_){await unlink(a).catch(()=>{});continue}await new Promise(l=>setTimeout(l,b));}throw new Error("Timed out waiting for the workspace evaluation writer lock.")}async function v(t,e,a=k){let n=s.join(s.resolve(t),a);return a$1(e,E,a),await L(n,e),n}async function T(t,e=k){let a=s.isAbsolute(e)?e:s.join(s.resolve(t),e),n=await u.readJson(a);return a$1(n,E,a),n}async function G(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath);if(e.status!=="live")throw new Error(`Evaluation ${e.runId} is ${e.status}; initialize a new run.`);let a=x(t.payload,t.now);if(e.events.some(o=>o.eventId===a.eventId))return e;let n={...e,updatedAt:(t.now??new Date).toISOString(),events:[...e.events,a],summary:S([...e.events,a])};return await v(t.workspacePath,n),n})}async function H(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath),a=(t.now??new Date).toISOString(),n={...e,status:t.status??"completed",updatedAt:a,completedAt:a,summary:S(e.events)},o=await v(t.workspacePath,n,O);return await v(t.workspacePath,n),{report:n,outputPath:o}})}function q(t,e){let a=t.summary.tokens.observedTotal,n=e.summary.tokens.observedTotal,o=a-n,r={schemaVersion:c,generatedAt:new Date().toISOString(),taskAligned:t.configuration.taskId===e.configuration.taskId,current:{runId:t.runId,strategy:t.configuration.strategy,tokens:a,verified:t.summary.outcome.verified,status:t.summary.outcome.status},baseline:{runId:e.runId,strategy:e.configuration.strategy,tokens:n,verified:e.summary.outcome.verified,status:e.summary.outcome.status},delta:{tokens:o,reductionPercent:n===0?null:Number((-o/n*100).toFixed(2)),modelCalls:t.summary.modelCalls-e.summary.modelCalls,toolCalls:t.summary.toolCalls-e.summary.toolCalls,latencyMs:Number((t.summary.latencyMs-e.summary.latencyMs).toFixed(2))},comparableOutcome:t.summary.outcome.verified&&e.summary.outcome.verified&&t.summary.outcome.status===e.summary.outcome.status};return a$1(r,P,"workspace evaluation comparison"),r}function B(){if(d$1.length!==4)throw new Error("Model usage source taxonomy is incomplete.")}export{O as WORKSPACE_EVALUATION_LAST_RUN_PATH,k as WORKSPACE_EVALUATION_LIVE_PATH,G as appendWorkspaceEvaluationEvent,B as assertWorkspaceEvaluationSourceTaxonomy,q as compareWorkspaceEvaluations,J as createWorkspaceEvaluation,H as finalizeWorkspaceEvaluation,x as normalizeWorkspaceEvaluationEvent,T as readWorkspaceEvaluation,S as summarizeWorkspaceEvaluation,v as writeWorkspaceEvaluation};
1
+ import {a as a$2,b as b$1,c,d as d$1}from'./chunk-IND3TUVU.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {a}from'./chunk-AHLMIL2T.js';import d from'crypto';import s from'path';import {open,unlink,stat}from'fs/promises';import u from'fs-extra';var k=a.evaluationLive,O=a.evaluationLastRun,W="contracts/workspace-intelligence/model-usage-event.v1.json",E="contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",P="contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json",_=3e4,N=100,b=25;function C(){return {modelCalls:0,toolCalls:0,tokenSources:{providerReported:0,tokenizerCounted:0,estimated:0,unavailable:0},tokens:{input:0,output:0,cachedInput:0,reasoning:0,observedTotal:0},latencyMs:0,costs:[],outcome:{status:"unknown",verified:false,blockersResolved:0},efficiency:{tokensPerVerifiedOutcome:null,noProgressDecisions:0,repeatedArtifactReads:0}}}function m(t){return t??0}function S(t){let e=C(),a=new Map,n=new Map;for(let o of t){if(o.kind==="model-call"){e.modelCalls+=1;let r={"provider-reported":"providerReported","tokenizer-counted":"tokenizerCounted",estimated:"estimated",unavailable:"unavailable"}[o.modelCall.source];if(e.tokenSources[r]+=1,e.tokens.input+=m(o.modelCall.inputTokens),e.tokens.output+=m(o.modelCall.outputTokens),e.tokens.cachedInput+=m(o.modelCall.cachedInputTokens),e.tokens.reasoning+=m(o.modelCall.reasoningTokens),e.latencyMs+=o.modelCall.latencyMs??0,o.modelCall.cost){let i=o.modelCall.cost.currency.toUpperCase(),l=n.get(i)??{currency:i,amount:0,providerReported:0,estimated:0};l.amount+=o.modelCall.cost.amount,o.modelCall.cost.source==="provider-reported"?l.providerReported+=o.modelCall.cost.amount:l.estimated+=o.modelCall.cost.amount,n.set(i,l);}continue}if(o.kind==="tool-call"){e.toolCalls+=1,e.latencyMs+=o.toolCall.durationMs??0,!o.toolCall.changedSource&&o.toolCall.result==="passed"&&(e.efficiency.noProgressDecisions+=1),o.toolCall.artifact&&a.set(o.toolCall.artifact,(a.get(o.toolCall.artifact)??0)+1);continue}o.kind==="outcome"&&(e.outcome={status:o.outcome.status,verified:o.outcome.verified,blockersResolved:o.outcome.blockersResolved});}return e.tokens.observedTotal=e.tokens.input+e.tokens.output,e.costs=[...n.values()].map(o=>({...o,amount:Number(o.amount.toFixed(8)),providerReported:Number(o.providerReported.toFixed(8)),estimated:Number(o.estimated.toFixed(8))})).sort((o,r)=>o.currency.localeCompare(r.currency)),e.efficiency.repeatedArtifactReads=[...a.values()].reduce((o,r)=>o+Math.max(0,r-1),0),e.efficiency.tokensPerVerifiedOutcome=e.outcome.verified&&e.outcome.status==="passed"?e.tokens.observedTotal:null,e}function x(t,e=new Date){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Evaluation event must be a JSON object.");let a=t,n={...a,schemaVersion:a$2,eventId:typeof a.eventId=="string"&&a.eventId.trim()?a.eventId.trim():d.randomUUID(),recordedAt:typeof a.recordedAt=="string"&&a.recordedAt.trim()?a.recordedAt:e.toISOString()};a$1(n,W,"workspace evaluation event");let o={"model-call":"modelCall","tool-call":"toolCall",outcome:"outcome",milestone:"milestone"}[n.kind],r=["modelCall","toolCall","outcome","milestone"].filter(i=>a[i]!==void 0);if(r.length!==1||r[0]!==o)throw new Error(`Evaluation event kind ${n.kind} requires only ${o}.`);if(n.kind==="model-call"&&n.modelCall.source!=="unavailable"&&n.modelCall.inputTokens===null&&n.modelCall.outputTokens===null)throw new Error("Measured model calls require at least one input or output token count.");return n}function J(t){let e=t.now??new Date,a=s.resolve(t.workspacePath),n={schemaVersion:b$1,runId:t.runId??d.randomUUID(),sessionId:t.sessionId??d.randomUUID(),status:"live",startedAt:e.toISOString(),updatedAt:e.toISOString(),workspace:{name:t.workspaceName?.trim()||s.basename(a),path:a},configuration:{taskId:t.taskId.trim(),strategy:t.strategy??"workspace-intelligence",...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.temperature!==void 0?{temperature:t.temperature}:{},...t.baselineRunId?{baselineRunId:t.baselineRunId}:{}},methodology:{id:"provider-usage-and-verified-outcome.v1",claimBoundary:"Provider-reported and tokenizer-counted values are measured; estimated values remain explicitly labelled. Verified task success is required before reporting tokens per successful outcome."},events:[],summary:C()};return a$1(n,E,"workspace evaluation"),n}async function L(t,e){await u.ensureDir(s.dirname(t));let a=`${t}.${process.pid}.${d.randomUUID()}.tmp`;try{await u.writeJson(a,e,{spaces:2}),await u.rename(a,t);}finally{await u.remove(a).catch(()=>{});}}async function A(t,e){let a=s.join(s.resolve(t),`${k}.lock`);await u.ensureDir(s.dirname(a));for(let n=0;n<N;n+=1)try{let o=await open(a,"wx");try{return await o.writeFile(JSON.stringify({pid:process.pid,acquiredAt:new Date().toISOString()})),await e()}finally{await o.close(),await unlink(a).catch(()=>{});}}catch(o){if(o.code!=="EEXIST")throw o;let i=await stat(a).catch(()=>null);if(i&&Date.now()-i.mtimeMs>_){await unlink(a).catch(()=>{});continue}await new Promise(l=>setTimeout(l,b));}throw new Error("Timed out waiting for the workspace evaluation writer lock.")}async function v(t,e,a=k){let n=s.join(s.resolve(t),a);return a$1(e,E,a),await L(n,e),n}async function T(t,e=k){let a=s.isAbsolute(e)?e:s.join(s.resolve(t),e),n=await u.readJson(a);return a$1(n,E,a),n}async function G(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath);if(e.status!=="live")throw new Error(`Evaluation ${e.runId} is ${e.status}; initialize a new run.`);let a=x(t.payload,t.now);if(e.events.some(o=>o.eventId===a.eventId))return e;let n={...e,updatedAt:(t.now??new Date).toISOString(),events:[...e.events,a],summary:S([...e.events,a])};return await v(t.workspacePath,n),n})}async function H(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath),a=(t.now??new Date).toISOString(),n={...e,status:t.status??"completed",updatedAt:a,completedAt:a,summary:S(e.events)},o=await v(t.workspacePath,n,O);return await v(t.workspacePath,n),{report:n,outputPath:o}})}function q(t,e){let a=t.summary.tokens.observedTotal,n=e.summary.tokens.observedTotal,o=a-n,r={schemaVersion:c,generatedAt:new Date().toISOString(),taskAligned:t.configuration.taskId===e.configuration.taskId,current:{runId:t.runId,strategy:t.configuration.strategy,tokens:a,verified:t.summary.outcome.verified,status:t.summary.outcome.status},baseline:{runId:e.runId,strategy:e.configuration.strategy,tokens:n,verified:e.summary.outcome.verified,status:e.summary.outcome.status},delta:{tokens:o,reductionPercent:n===0?null:Number((-o/n*100).toFixed(2)),modelCalls:t.summary.modelCalls-e.summary.modelCalls,toolCalls:t.summary.toolCalls-e.summary.toolCalls,latencyMs:Number((t.summary.latencyMs-e.summary.latencyMs).toFixed(2))},comparableOutcome:t.summary.outcome.verified&&e.summary.outcome.verified&&t.summary.outcome.status===e.summary.outcome.status};return a$1(r,P,"workspace evaluation comparison"),r}function B(){if(d$1.length!==4)throw new Error("Model usage source taxonomy is incomplete.")}export{O as WORKSPACE_EVALUATION_LAST_RUN_PATH,k as WORKSPACE_EVALUATION_LIVE_PATH,G as appendWorkspaceEvaluationEvent,B as assertWorkspaceEvaluationSourceTaxonomy,q as compareWorkspaceEvaluations,J as createWorkspaceEvaluation,H as finalizeWorkspaceEvaluation,x as normalizeWorkspaceEvaluationEvent,T as readWorkspaceEvaluation,S as summarizeWorkspaceEvaluation,v as writeWorkspaceEvaluation};
@@ -0,0 +1 @@
1
+ import {a as a$2}from'./chunk-KKAOTTYO.js';import {q as q$1}from'./chunk-AL2A7Q4X.js';import {b as b$1,c}from'./chunk-MV7KF75Q.js';import {a as a$3}from'./chunk-RTVRZFIJ.js';import {g}from'./chunk-DDQ3XK3H.js';import {j,e as e$1}from'./chunk-BQGBU2Y3.js';import {l as l$1}from'./chunk-UETZ7USY.js';import {a as a$1,e as e$2,f as f$1}from'./chunk-IDQKVJUF.js';import {f,g as g$1,h as h$2}from'./chunk-6UTM5AJI.js';import {k,l,h as h$1,m as m$1,n,p as p$1,q}from'./chunk-C3FLCDRN.js';import {m,p,s}from'./chunk-L2YK5RV2.js';import {o,r as r$1,s as s$1}from'./chunk-KMLPHFLD.js';import {e}from'./chunk-SS2VV3D5.js';import {b as b$2}from'./chunk-RVQLMTTI.js';import {a,b,h,i,g as g$2,f as f$2}from'./chunk-AHLMIL2T.js';import re from'path';import ie from'fs-extra';function r(a,t){if(!a)throw new Error(`Workspace Intelligence run semantic violation: ${t}`)}function se(a,t){return a.length===t.length&&a.every((u,d)=>u===t[d])}function ae(a$2){b$2(a.intelligenceRun,a$2,"Workspace Intelligence run report"),r(a$2.chainSchemaVersion===a$1,`chainSchemaVersion must be ${a$1}`),r(a$2.artifactPath===a.intelligenceRun,`artifactPath must be ${a.intelligenceRun}`),r(a$2.preflight.length===g$2.length,`preflight must contain exactly ${g$2.length} entries`);for(let[o,i]of g$2.entries()){let s=a$2.preflight[o];r(s?.id===i,`preflight[${o}].id must be ${i}`),r(se(s.artifacts,h[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(s.status==="passed"&&s.result==="synchronized"||s.status==="failed"&&s.result==="failed","sync preflight status and result are incoherent"):r(s.status==="passed"&&(s.result==="created"||s.result==="reused")||s.status==="failed"&&s.result==="failed"||s.status==="skipped"&&s.result==="skipped","baseline preflight status and result are incoherent");}let t=a$2.preflight[1];r(a$2.baselineCreated===(t?.result==="created"),"baselineCreated must match the baseline preflight result"),r(a$2.stages.length===f$2.length,`stages must contain exactly ${f$2.length} canonical steps`);let u=a$2.preflight[0],d=u?.status==="failed";for(let[o,i$1]of f$2.entries()){let s=a$2.stages[o];r(s?.id===i$1,`stages[${o}].id must be ${i$1}`),r(se(s.artifacts,i[i$1].produces),`${i$1} artifacts must match the runtime registry`),d&&r(s.status==="skipped",`${i$1} must be skipped after a hard failure`),s.status==="passed"?r(s.exitCode===0,`${i$1} passed stage must have exitCode 0`):s.status==="blocked"?r(s.exitCode!==0,`${i$1} blocked stage must have a non-zero exitCode`):s.status==="failed"?(r(s.exitCode===1,`${i$1} failed stage must have exitCode 1`),d=true):(r(s.exitCode===0,`${i$1} skipped stage must have exitCode 0`),r(s.durationMs===0,`${i$1} skipped stage must have durationMs 0`)),o===0&&((u?.status==="failed"||s.status==="failed")&&r(t?.status==="skipped","baseline must be skipped when sync or model fails"),t?.status==="skipped"&&r(u?.status==="failed"||s.status==="failed"||s.status==="skipped","baseline may be skipped only after an upstream failure"),t?.status!=="passed"&&(d=true));}let m=a$2.preflight.some(o=>o.status==="failed")||a$2.stages.some(o=>o.status==="failed"),E=a$2.stages.some(o=>o.status==="blocked"),n=m?"failed":E?"blocked":"passed",f=n==="failed"?1:n==="blocked"?2:0;r(a$2.status===n,`status must be ${n}`),r(a$2.exitCode===f,`exitCode must be ${f}`);}var ue=a.intelligenceRun,pe=b.intelligenceRun,ne=ue;async function Oe(a$4){let t=re.resolve(a$4.workspacePath),u=[],d=[],m$2=false,E=async(e,l)=>{let g=[...h[e]];if(m$2){u.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:g,message:"skipped because a required upstream operation failed"});return}let k=Date.now();try{let c=await l();u.push({id:e,status:"passed",result:c.result,durationMs:Date.now()-k,artifacts:g,message:c.message});}catch(c){m$2=true,u.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-k,artifacts:g,message:c instanceof Error?c.message:String(c)});}},n$1=async(e,l)=>{let g=[...i[e].produces];if(m$2){d.push({id:e,status:"skipped",durationMs:0,artifacts:g,exitCode:0,message:"skipped because a required upstream stage failed"});return}let k=Date.now();try{let c=await l(),b=c.exitCode??0;d.push({id:e,status:c.blocked||b!==0?"blocked":"passed",durationMs:Date.now()-k,artifacts:g,exitCode:b,message:c.message});}catch(c){m$2=true,d.push({id:e,status:"failed",durationMs:Date.now()-k,artifacts:g,exitCode:1,message:c instanceof Error?c.message:String(c)});}};await E("sync",async()=>{let e=await g(t,true),l=await o({workspacePath:t});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${l.contract.projects.length} projects`}});let f$2,o$1=()=>{if(!f$2)throw new Error("canonical workspace model is unavailable");return f$2};await n$1("model",async()=>(f$2={...await p({workspacePath:t,includeEvidence:true}),build:m({mode:"full",engineStatus:"disabled"})},await s(f$2,t),{message:`${f$2.summary.projectCount} projects modeled`}));let i$1=re.join(t,a.snapshot),s$2=false;await E("baseline",async()=>{if(!await ie.pathExists(i$1)){let g=await k({workspacePath:t,model:o$1()});return await l(g,t),s$2=true,{result:"created",message:"initial structural baseline created"}}let e=await ie.readJson(i$1),l$1=h$1(e);return l$1?(await l(l$1,t),{result:"reused",message:"legacy structural baseline migrated and reused"}):{result:"reused",message:"existing structural baseline reused"}}),await n$1("diff",async()=>{let e=await m$1({workspacePath:t,fromPath:a.snapshot,model:o$1()});return await n(e,t),{message:e.summary.changed?"workspace changes detected":"no workspace changes"}}),await n$1("impact",async()=>{let e=await p$1({workspacePath:t,fromPath:a.diff});return await q(e,t),{message:`${e.summary.risk} risk; ${e.summary.affectedProjects} affected`}}),await n$1("doctor-evidence",async()=>{let e=await q$1({workspace:t,json:true,quiet:true});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await n$1("contract-evidence",async()=>{let e=await r$1({workspacePath:t,strict:true});return await s$1({workspacePath:t,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await n$1("analyze-evidence",async()=>{let e=await a$2({workspacePath:t,json:true,strict:false});return {blocked:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await n$1("readiness-evidence",async()=>{let e=await a$3({startPath:t,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await n$1("verify",async()=>{let e=await f({workspacePath:t,fromImpactPath:a.impact});await g$1(e,t);let l=h$2(e,{strict:a$4.strict===true});return await j(t,e$1(e,l.passed)),{blocked:!l.passed,exitCode:l.exitCode,message:`${e.summary.verdict}; gate ${l.passed?"passed":"blocked"}`}}),await n$1("context",async()=>{let e=await e$2({workspacePath:t,model:o$1(),agent:a$4.agent??"generic",includeEvidence:true});return await f$1(e,t),{message:`context grounded for ${e.agent}`}}),await n$1("agent-sync",async()=>({message:`${(await l$1({workspacePath:t,agent:a$4.agent??"generic",write:true,refreshContext:false,strict:false,preset:"enterprise"})).writtenFiles.length} grounding files written`})),await n$1("explain",async()=>{let e=await b$1({workspacePath:t,target:{kind:"release-blocked"}});return await c(e,t),{message:e.summary}});let oe=d.some(e=>e.status==="blocked"),W=m$2?"failed":oe?"blocked":"passed",ce=m$2?1:W==="blocked"?2:0,w={schemaVersion:pe,chainSchemaVersion:a$1,generatedAt:new Date().toISOString(),workspacePath:t,baselineCreated:s$2,preflight:u,status:W,exitCode:ce,stages:d,artifactPath:ne};return ae(w),await e(t,ne,w),w}export{ue as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,pe as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,Oe as runWorkspaceIntelligenceChain};
@@ -0,0 +1 @@
1
+ export{a as WORKSPACE_INTELLIGENCE_ARTIFACTS,b as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMAS,c as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMA_CONTRACTS,d as WORKSPACE_INTELLIGENCE_COMMAND_SIGNATURES,h as WORKSPACE_INTELLIGENCE_PREFLIGHT_ARTIFACTS,g as WORKSPACE_INTELLIGENCE_PREFLIGHT_IDS,e as WORKSPACE_INTELLIGENCE_ROOT_COMMANDS,i as WORKSPACE_INTELLIGENCE_RUNTIME_STEPS,f as WORKSPACE_INTELLIGENCE_STEP_IDS,j as workspaceIntelligenceRuntimeStep}from'./chunk-AHLMIL2T.js';
@@ -1 +1 @@
1
- export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-NAJCUQ4X.js';
1
+ export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-YPKNQCLK.js';
@@ -1 +1 @@
1
- export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-GSWPGELT.js';
1
+ export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-Y5YAP4F3.js';
@@ -0,0 +1,3 @@
1
+ import {b}from'./chunk-MV7KF75Q.js';import {c as c$1,e}from'./chunk-BHYTI3RH.js';import {d,c as c$2,f,e as e$1}from'./chunk-WDKNMTJQ.js';import {c as c$4,b as b$1}from'./chunk-DQ3PI7EP.js';import {d as d$2}from'./chunk-IDQKVJUF.js';import {d as d$3}from'./chunk-6UTM5AJI.js';import {c as c$3}from'./chunk-YPKNQCLK.js';import {k}from'./chunk-L2YK5RV2.js';import {h}from'./chunk-KMLPHFLD.js';import {d as d$1}from'./chunk-SS2VV3D5.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import {a as a$1,c}from'./chunk-AHLMIL2T.js';import {v}from'./chunk-MOSXTVPU.js';import u from'path';import N from'readline';import g from'fs-extra';var L=a$1.agentIndex,q=new Map(Object.keys(a$1).flatMap(e=>{let t=c[e];return t?[[a$1[e],t]]:[]}));function M(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var J=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceKnowledgeGraph",description:"Read the current proof-backed workspace knowledge graph artifact",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceEvaluation",description:"Read the live or finalized provenance-aware model usage and verified-outcome report",inputSchema:{type:"object",properties:{live:{type:"boolean",description:"Read the live report instead of the finalized last-run report"}}}},{name:"queryWorkspaceEntities",description:"List workspace knowledge entities, optionally filtered by kind",inputSchema:{type:"object",properties:{kind:{type:"string",description:"Optional entity kind"}}}},{name:"searchWorkspaceGraph",description:"Return bounded, proof-carrying workspace context matching a text query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text, path, symbol, service, or concept to find"},kind:{type:"string",description:"Optional entity kind filter"},limit:{type:"integer",minimum:1,maximum:100,default:12}},required:["query"]}},{name:"getWorkspaceGraphEvidence",description:"Resolve portable evidence for a knowledge graph entity or relation",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]}},{name:"findWorkspaceGraphPath",description:"Find a shortest proof-carrying path between two workspace entities",inputSchema:{type:"object",properties:{from:{type:"string"},to:{type:"string"}},required:["from","to"]}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function H(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!u.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function a(e,t){if(!H(t))throw new Error(`Unsafe artifact path: ${t}`);let r=await d$1(e,t)??u.join(e,t);if(!await g.pathExists(r))return null;let n=await g.readJson(r),o=v(t),c=q.get(o);if(c&&a$2(n,c,`MCP artifact ${o}`),o===a$1.knowledgeGraph){let p=u.join(e,k);if(!await g.pathExists(p))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let l=await g.readJson(p);c$3(n,l);}return n}async function F(e$1){let t=[],r=new Set,o=((await a(e$1,d$3))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$3,reasons:o});for(let i of o)r.add(i);}let c=await a(e$1,c$4);if(e(c)){let i=(c.blockingReasons??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(i.length>0){t.push({artifact:c$4,reasons:i});for(let s of i)r.add(s);}}let p=await a(e$1,h),l=(p?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(l.length>0||String(p?.status??"").toLowerCase()==="failed"){let i=l.length>0?l:["Workspace contract verification failed"];t.push({artifact:h,reasons:i});for(let s of i)r.add(s);}return {blockingReasons:[...r],sources:t}}async function I(e$2,t,r){switch(t){case "getWorkspaceModel":return a(e$2,k);case "getWorkspaceKnowledgeGraph":return a(e$2,a$1.knowledgeGraph);case "getWorkspaceEvaluation":return a(e$2,r.live===true?a$1.evaluationLive:a$1.evaluationLastRun);case "queryWorkspaceEntities":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=String(r.kind??"").trim();return {schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,entities:e$1(n,o||void 0)}}case "searchWorkspaceGraph":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=typeof r.limit=="number"?r.limit:Number(r.limit??12);return f(n,{query:String(r.query??""),...typeof r.kind=="string"&&r.kind.trim()?{kind:r.kind.trim()}:{},limit:Number.isFinite(o)?o:12})}case "getWorkspaceGraphEvidence":{let n=await a(e$2,a$1.knowledgeGraph);return n?c$2(n,String(r.query??"")):null}case "findWorkspaceGraphPath":{let n=await a(e$2,a$1.knowledgeGraph);return n?d(n,String(r.from??""),String(r.to??"")):null}case "getEvidenceIndex":return a(e$2,L);case "getBlockers":return F(e$2);case "getSafeCommands":return {safeCommands:(await a(e$2,d$2))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,d$2);if(!n)return null;let o=String(r.project??"").trim(),c=n.scope?.activeProject??void 0,p=o||c,l=Array.isArray(n.projects)?n.projects:[],i=p&&l.find(s=>typeof s.name=="string"&&s.name.toLowerCase()===p.toLowerCase());return {workspace:n.workspace??null,scope:n.scope??null,validation:n.validation??null,project:i??null,safeCommands:n.safeCommands??[]}}case "getArtifact":{let n=String(r.relativePath??"").trim();return a(e$2,n)}case "listOperationalSkills":return a(e$2,b$1);case "getWorkspaceExplain":{let n=String(r.target??"release-blocked").trim(),o=c$1(n);if(!o)throw new Error(`Invalid explain target: ${n}`);let c=await a(e$2,c$4);return e(c)&&M(c.target,o)?c:b({workspacePath:e$2,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}function R(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
2
+ `);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
3
+ `);}async function ce(e){let t=u.resolve(e.workspacePath),r=N.createInterface({input:process.stdin,terminal:false});for await(let n of r){let o=n.trim();if(!o)continue;let c;try{c=JSON.parse(o);}catch{E(null,"Invalid JSON-RPC request");continue}let{id:p,method:l,params:i}=c;try{if(l==="initialize"){R(p,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(l==="notifications/initialized")continue;if(l==="tools/list"){R(p,{tools:J.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}))});continue}if(l==="tools/call"){let s=String(i?.name??""),K=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},S=await I(t,s,K);R(p,{content:[{type:"text",text:JSON.stringify(S,null,2)}],isError:S==null});continue}E(p,`Unsupported method: ${l??"unknown"}`);}catch(s){E(p,s instanceof Error?s.message:String(s));}}}async function pe(e,t,r={}){return I(u.resolve(e),t,r)}export{J as WORKSPACE_MCP_READ_TOOLS,pe as invokeMcpToolForTest,ce as runWorkspaceMcpServe};
@@ -0,0 +1 @@
1
+ export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,p as buildWorkspaceModel,q as buildWorkspaceModelCached,o as buildWorkspaceModelFacts,r as buildWorkspaceModelIncremental,m as createWorkspaceModelBuildProvenance,n as validateWorkspaceModelStrict,l as workspaceModelProjectTopology,s as writeWorkspaceModel}from'./chunk-L2YK5RV2.js';
@@ -0,0 +1 @@
1
+ export{c as hashCanonicalJson,e as hashLegacyWorkspaceModelV1,d as hashWorkspaceModel,a as stableSort,b as stableStringify}from'./chunk-EWZZUQBR.js';
@@ -0,0 +1 @@
1
+ export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-2AXEGYPL.js';
@@ -1,2 +1,2 @@
1
- import {a,b}from'./chunk-GSWPGELT.js';import {o,l as l$1}from'./chunk-5XATWNME.js';import l from'fs-extra';function c(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async function m(n,e,o$1){let s=(await Promise.all(o(n,e).map(async r=>({candidate:r,exists:await l.pathExists(r)})))).find(({exists:r})=>r)?.candidate;if(!s)return false;let t=l$1(n,e),a=c(await l.readJson(s));return await l.outputJson(t,o$1(a),{spaces:2}),await l.appendFile(t,`
1
+ import {a,b}from'./chunk-Y5YAP4F3.js';import {s,p}from'./chunk-MOSXTVPU.js';import l from'fs-extra';function c(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async function m(n,e,o){let s$1=(await Promise.all(s(n,e).map(async r=>({candidate:r,exists:await l.pathExists(r)})))).find(({exists:r})=>r)?.candidate;if(!s$1)return false;let t=p(n,e),a=c(await l.readJson(s$1));return await l.outputJson(t,o(a),{spaces:2}),await l.appendFile(t,`
2
2
  `,"utf-8"),true}async function M(n,e){let o=e.now??new Date().toISOString(),s=e.installMethod==="pip"?"venv":e.installMethod;await m(n,"workspace.json",a=>{let r=c(a.engine),i=c(r.python_core);return delete a.bootstrap_note,delete i.reason,{...a,engine:{...r,install_method:s,python_version:e.pythonVersion??r.python_version??null,python_core:{...i,status:"installed",installed_at:o,...e.coreVersion?{version:e.coreVersion}:{}}}}}),await m(n,"toolchain.lock",a=>{let r=c(a.runtime),i=c(r.python),d=c(i.core);return delete d.reason,{...a,generated_at:o,runtime:{...r,python:{...i,version:e.pythonVersion??i.version??null,install_method:s,core:{...d,status:"installed",installed_at:o,...e.coreVersion?{version:e.coreVersion}:{}}}}}});let t=await a(n);if(t){let a={...t.metadata?.python??{}};delete a.coreReason,t.metadata={...t.metadata,python:{...a,coreStatus:"installed",...e.coreVersion?{coreVersion:e.coreVersion}:{},...e.pythonVersion?{pythonVersion:e.pythonVersion}:{},...e.venvPath?{venvPath:e.venvPath}:{}},npm:{...t.metadata?.npm??{},packageVersion:t.metadata?.npm?.packageVersion??t.version,installMethod:s,lastUsedAt:o}},await b(n,t);}}export{M as markWorkspacePythonEngineInstalled};
@@ -1 +1 @@
1
- export{a as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,b as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,f as buildWorkspaceRegistrySummary,g as formatWorkspaceRegistrySyncSummary,e as publishWorkspaceRegistrySummary,d as readWorkspaceRegistrySummary,c as resolveWorkspaceRegisteredProjects}from'./chunk-RHQW3DTP.js';
1
+ export{a as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,b as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,f as buildWorkspaceRegistrySummary,g as formatWorkspaceRegistrySyncSummary,e as publishWorkspaceRegistrySummary,d as readWorkspaceRegistrySummary,c as resolveWorkspaceRegisteredProjects}from'./chunk-IPJ5URDF.js';
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-5EXZBCAZ.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-VKTUWUS6.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-OW42TZFB.js';
1
+ export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-6UTM5AJI.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-KXG6E5VK.js';import {f as f$1,r,l}from'./chunk-L2YK5RV2.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import R from'fs';var P="workspace-watch-event.v1";function b(e){return a$1(e,"contracts/workspace-watch-event.v1.json","Workspace watch event"),e}function g(e){return `${e.from}\0${e.to}\0${e.kind}`}function f(e){return (l(e)?.edges??[]).map(o=>({from:o.from,to:o.to,kind:o.kind}))}function m(e){let r=[...a(e).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(e).map(g).sort((a,n)=>a.localeCompare(n));return f$1({projects:r,edges:c})}function y(e,o){let r=a(o),c=e?a(e):new Map,a$1=[],n=[];for(let[t,s]of r.entries())c.has(t)?c.get(t)!==s&&a$1.push(t):n.push(t);let d=[];for(let t of c.keys())r.has(t)||d.push(t);let i=new Map(e?f(e).map(t=>[g(t),t]):[]),l=new Map(f(o).map(t=>[g(t),t])),p=[];for(let[t,s]of l.entries())i.has(t)||p.push(s);let h=[];for(let[t,s]of i.entries())l.has(t)||h.push(s);let u=(t,s)=>g(t).localeCompare(g(s));return a$1.sort((t,s)=>t.localeCompare(s)),n.sort((t,s)=>t.localeCompare(s)),d.sort((t,s)=>t.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(o,r$1){this.rebuild=r$1?.rebuild??(()=>r({...o})),this.now=r$1?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let o=Date.now(),{model:r}=await this.rebuild();return this.model=r,this.buildEvent("ready","initial",null,r,Date.now()-o)}async pulse(){let o=Date.now(),r=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(r,c)?"changed":"unchanged",a,r,c,Date.now()-o);return this.model=c,n}hasStructuralChange(o,r){return o?m(o)!==m(r):true}buildEvent(o,r,c,a,n){let d=y(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:P,kind:o,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:r,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),S=new Set(["reports","cache","tmp",".cache"]);function j(e){if(!e)return false;let o=e.split(/[\\/]/).filter(Boolean);if(o.some(r=>C.has(r)))return false;for(let r=0;r<o.length-1;r+=1)if((o[r]===".workspai"||o[r]===".rapidkit")&&S.has(o[r+1]))return false;return true}async function T(e){let o=new k(e.buildOptions,e.engineOptions),r=await o.start();if(e.emit(r),o.currentModel&&await e.onModel?.(o.currentModel,r),e.once)return;let c=e.debounceMs??250,a=e.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let t=await o.pulse();e.emit(t),o.currentModel&&await e.onModel?.(o.currentModel,t);}catch(t){e.emit(b({schemaVersion:P,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:o.currentModel?m(o.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:t instanceof Error?t.message:String(t)}));}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=t=>{j(t)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};e.onProgress?.(`Watching ${e.workspacePath} for changes (Ctrl+C to stop).`);let u=R.watch(e.workspacePath,{recursive:true},(t,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(t=>{let s=()=>{n&&clearTimeout(n),u.close(),t();};if(e.signal){if(e.signal.aborted){s();return}e.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{P as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,y as diffWatchModels,j as isWatchRelevantPath,T as runWorkspaceWatch};
package/docs/GLOSSARY.md CHANGED
@@ -5,22 +5,23 @@ CI workflows, and AI consumers.
5
5
 
6
6
  ## Core concepts
7
7
 
8
- | Term | Plain-language meaning |
9
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
- | Workspace | A governed collection of one or more registered projects. It is not required to be a Git monorepo. |
11
- | Project | One registered application, service, library, or infrastructure unit inside or linked to a workspace. |
12
- | Workspace manifest | `.workspai/workspace.json`; workspace identity, profile, engine, and bootstrap metadata. It is not the project registry. |
13
- | Workspace contract | `.workspai/workspace.contract.json`; the operational registry of projects and their declared ports, APIs, ownership, and relationships. |
14
- | Registry summary | `.workspai/workspace-registry.v1.json`; the canonical lightweight project count and registry status for UI and CI. |
15
- | Workspace Model | The canonical, deterministic structural description produced from registered projects, manifests, contracts, policies, and detected facts. |
16
- | Knowledge Graph | A proof-backed representation derived from the Workspace Model. It makes entities and relationships queryable; it is not the source of truth for the model. |
17
- | Dependency graph | The project-to-project dependency subgraph embedded in the Workspace Model and used by impact and verification. |
18
- | Provider | A deterministic source adapter that emits facts from code, manifests, APIs, infrastructure, documentation, Git, or another supported source. |
19
- | Fact | A normalized observation about the workspace, such as a package, endpoint, import, deployment, or owner. |
20
- | Evidence / proof | The source location and extraction details that justify a fact or relationship. |
21
- | Proof path | A traceable route from a query result or relationship back to its supporting evidence. |
22
- | Artifact | A versioned file written under `.workspai/`, usually `.workspai/reports/`, for people or automation to consume. |
23
- | Command projection | The JSON returned on stdout for one command. It can include status and output metadata around a canonical artifact payload. |
8
+ | Term | Plain-language meaning |
9
+ | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | Workspace | A governed collection of one or more registered projects. It is not required to be a Git monorepo. |
11
+ | Project | One registered application, service, library, or infrastructure unit inside or linked to a workspace. |
12
+ | Workspace manifest | `.workspai/workspace.json`; workspace identity, profile, engine, and bootstrap metadata. It is not the project registry. |
13
+ | Workspace contract | `.workspai/workspace.contract.json`; the operational registry of projects and their declared ports, APIs, ownership, and relationships. |
14
+ | Registry summary | `.workspai/workspace-registry.v1.json`; the canonical lightweight project count and registry status for UI and CI. |
15
+ | Workspace Model | The canonical, deterministic structural description produced from registered projects, manifests, contracts, policies, and detected facts. |
16
+ | Knowledge Graph | A proof-backed representation derived from and structurally bound to the canonical Workspace Model. It makes entities and relationships queryable; it cannot replace or mutate the authorizing model. |
17
+ | Structural model hash | A stable SHA-256 over model structure. Volatile timestamps, run correlation, live evidence references, and freshness fields are excluded so harmless refreshes do not create false graph drift. |
18
+ | Dependency graph | The project-to-project dependency subgraph embedded in the Workspace Model and used by impact and verification. |
19
+ | Provider | A deterministic source adapter that emits facts from code, manifests, APIs, infrastructure, documentation, Git, or another supported source. |
20
+ | Fact | A normalized observation about the workspace, such as a package, endpoint, import, deployment, or owner. |
21
+ | Evidence / proof | The source location and extraction details that justify a fact or relationship. |
22
+ | Proof path | A traceable route from a query result or relationship back to its supporting evidence. |
23
+ | Artifact | A versioned file written under `.workspai/`, usually `.workspai/reports/`, for people or automation to consume. |
24
+ | Command projection | The JSON returned on stdout for one command. It can include status and output metadata around a canonical artifact payload. |
24
25
 
25
26
  ## Intelligence and governance
26
27