workspai 0.50.0 → 0.52.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 (135) hide show
  1. package/README.md +127 -497
  2. package/contracts/artifact-remediation-plan.v1.json +87 -0
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +24 -0
  4. package/contracts/create-planner-capabilities.v1.json +10 -1
  5. package/contracts/doctor-project-evidence.v1.json +46 -0
  6. package/contracts/doctor-remediation-plan.v1.json +82 -0
  7. package/contracts/doctor-workspace-evidence.v1.json +46 -0
  8. package/contracts/extension-cli-compatibility.v1.json +6 -2
  9. package/contracts/published-contract-catalog.v1.json +22 -1
  10. package/contracts/runtime-command-surface.v1.json +104 -0
  11. package/contracts/workspace-intelligence/doctor-dependency-repair-transaction.v1.json +66 -0
  12. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +5 -0
  13. package/contracts/workspace-intelligence/verified-goal-status.v1.json +27 -0
  14. package/contracts/workspace-intelligence/verified-goal.v1.json +163 -0
  15. package/contracts/workspace-intelligence-chain.v1.json +6 -0
  16. package/dist/analyze-J7VNZMDH.js +1 -0
  17. package/dist/artifact-remediation-plan-2UKY4TKO.js +3 -0
  18. package/dist/autopilot-release-UG23AWVH.js +1 -0
  19. package/dist/chunk-27UR373Z.js +1 -0
  20. package/dist/chunk-2PY65U6X.js +5 -0
  21. package/dist/{chunk-DQ3PI7EP.js → chunk-3D3PFPP5.js} +1 -1
  22. package/dist/chunk-4D7DIGAB.js +1 -0
  23. package/dist/{chunk-IND3TUVU.js → chunk-4UVGTFOX.js} +1 -1
  24. package/dist/chunk-5XJRCP3D.js +36 -0
  25. package/dist/chunk-62K2H72S.js +1 -0
  26. package/dist/chunk-6AXRIAP2.js +86 -0
  27. package/dist/chunk-6HJJHEL6.js +2 -0
  28. package/dist/{chunk-BHYTI3RH.js → chunk-6PBSAAS5.js} +1 -1
  29. package/dist/{chunk-MVLIONQD.js → chunk-7MQZQ4UU.js} +1 -1
  30. package/dist/chunk-7RLGOEWV.js +1 -0
  31. package/dist/{chunk-CV5HKU4P.js → chunk-7T4TSV5C.js} +1 -1
  32. package/dist/chunk-B4CPDK6J.js +2 -0
  33. package/dist/{chunk-SHXJ2GDR.js → chunk-DZ4VKAXB.js} +1 -1
  34. package/dist/{chunk-5EXZBCAZ.js → chunk-F4KBYFZ5.js} +1 -1
  35. package/dist/{chunk-LZQUZGXB.js → chunk-FRJYAJH6.js} +1 -1
  36. package/dist/chunk-FUPHQOJB.js +1 -0
  37. package/dist/{chunk-VKTUWUS6.js → chunk-GHB6QMQH.js} +1 -1
  38. package/dist/chunk-GR6442P7.js +1 -0
  39. package/dist/chunk-HPWLSLMC.js +8 -0
  40. package/dist/{chunk-KXG6E5VK.js → chunk-ICLYL3N5.js} +1 -1
  41. package/dist/chunk-IO54DFWR.js +691 -0
  42. package/dist/{chunk-RTVRZFIJ.js → chunk-KHEJO3JU.js} +1 -1
  43. package/dist/{chunk-IPJ5URDF.js → chunk-LOCPNNSK.js} +1 -1
  44. package/dist/chunk-LPCL4U4L.js +1 -0
  45. package/dist/{chunk-C35UXTDM.js → chunk-M5ICGR55.js} +1 -1
  46. package/dist/{chunk-SS2VV3D5.js → chunk-MBRU3VWJ.js} +2 -2
  47. package/dist/{chunk-DDQ3XK3H.js → chunk-MZFSINY7.js} +3 -3
  48. package/dist/chunk-OTDGTAZJ.js +1 -0
  49. package/dist/chunk-P4OSLAVD.js +3 -0
  50. package/dist/chunk-PS5F4DCT.js +1 -0
  51. package/dist/{chunk-C3FLCDRN.js → chunk-PTTZPDLX.js} +1 -1
  52. package/dist/chunk-Q6CUJ3WF.js +10 -0
  53. package/dist/{chunk-MV7KF75Q.js → chunk-QURMI7ID.js} +1 -1
  54. package/dist/{chunk-RVQLMTTI.js → chunk-ULR66OJR.js} +1 -1
  55. package/dist/chunk-WJVB6SSD.js +16 -0
  56. package/dist/chunk-WJY7ZXVJ.js +2 -0
  57. package/dist/{chunk-6UTM5AJI.js → chunk-XHRHNVCZ.js} +1 -1
  58. package/dist/chunk-ZTKIBREF.js +1 -0
  59. package/dist/{chunk-BQGBU2Y3.js → chunk-ZVOEPWQM.js} +1 -1
  60. package/dist/{create-I23DC7SN.js → create-ESK3CQPK.js} +1 -1
  61. package/dist/{doctor-DOOMYLIH.js → doctor-DLEBZSF7.js} +1 -1
  62. package/dist/index.d.ts +26 -11
  63. package/dist/index.js +129 -129
  64. package/dist/{pipeline-U77HSINC.js → pipeline-NT6AYYWM.js} +1 -1
  65. package/dist/{project-intelligence-lens-BKKVPCLC.js → project-intelligence-lens-Q4SZDI2N.js} +1 -1
  66. package/dist/project-test-coverage-A677ZLW3.js +1 -0
  67. package/dist/verified-goal-MJNZROS5.js +1 -0
  68. package/dist/{workspace-ZEYUVR26.js → workspace-LSOZM2CG.js} +1 -1
  69. package/dist/{workspace-agent-sync-DKYJLUDP.js → workspace-agent-sync-RZBQXCNJ.js} +1 -1
  70. package/dist/{workspace-archive-4JNT4S7N.js → workspace-archive-ZOWQXWJ6.js} +1 -1
  71. package/dist/workspace-context-IYJKO5BN.js +1 -0
  72. package/dist/{workspace-contract-PVLGPBBV.js → workspace-contract-AZFISDLS.js} +1 -1
  73. package/dist/workspace-explain-26UGV7L4.js +1 -0
  74. package/dist/workspace-explain-contract-GIWPCCEF.js +1 -0
  75. package/dist/{workspace-feedback-RATRXFUC.js → workspace-feedback-LIHEWTNV.js} +1 -1
  76. package/dist/{workspace-foundation-D33LJLGT.js → workspace-foundation-H5UTAUXQ.js} +1 -1
  77. package/dist/{workspace-graph-stream-THNG2T7R.js → workspace-graph-stream-KUDOZE73.js} +1 -1
  78. package/dist/workspace-graph-token-efficiency-5FNH4JZ5.js +1 -0
  79. package/dist/{workspace-history-EWFPT74O.js → workspace-history-HULG5EFN.js} +1 -1
  80. package/dist/{workspace-intelligence-MCNSWWDV.js → workspace-intelligence-A4UE4DZK.js} +1 -1
  81. package/dist/{workspace-intelligence-evaluation-7CABG5Y6.js → workspace-intelligence-evaluation-AOLGHYHC.js} +1 -1
  82. package/dist/workspace-intelligence-runner-42QI5RYA.js +1 -0
  83. package/dist/{workspace-intelligence-runtime-registry-ZZ3GRAL2.js → workspace-intelligence-runtime-registry-YOQ5GFFJ.js} +1 -1
  84. package/dist/{workspace-knowledge-graph-2EYR7N56.js → workspace-knowledge-graph-LEM6X5CM.js} +1 -1
  85. package/dist/{workspace-knowledge-graph-query-VOSPPH4W.js → workspace-knowledge-graph-query-EKHIE3E2.js} +1 -1
  86. package/dist/{workspace-mcp-serve-FLAVKWYW.js → workspace-mcp-serve-N2QPR7VJ.js} +1 -1
  87. package/dist/{workspace-model-FMFYLHE4.js → workspace-model-FJXX3NET.js} +1 -1
  88. package/dist/{workspace-onboarding-MYROZDI2.js → workspace-onboarding-IKFISWWY.js} +1 -1
  89. package/dist/workspace-readme-E2M35RJH.js +77 -0
  90. package/dist/{workspace-registry-summary-6VXIAQLX.js → workspace-registry-summary-HOQ3OBNT.js} +1 -1
  91. package/dist/workspace-run-GOZTUGJS.js +1 -0
  92. package/dist/{workspace-verify-FKYI65UQ.js → workspace-verify-32AWCJQG.js} +1 -1
  93. package/dist/workspace-watch-4WVNB26E.js +1 -0
  94. package/docs/README.md +1 -0
  95. package/docs/README_CONTENT_CONTRACT.md +98 -124
  96. package/docs/ci-workflows.md +53 -15
  97. package/docs/commands-reference.md +16 -2
  98. package/docs/doctor-command.md +16 -0
  99. package/docs/workspace-intelligence-runner.md +48 -0
  100. package/docs/workspace-knowledge-graph.md +39 -0
  101. package/docs/workspace-operations.md +9 -6
  102. package/package.json +9 -4
  103. package/scripts/enterprise-package-smoke.mjs +11 -0
  104. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  105. package/templates/kits/fastapi-standard/README.md.j2 +1 -1
  106. package/templates/kits/nestjs-standard/Dockerfile.j2 +1 -1
  107. package/templates/kits/nestjs-standard/README.md.j2 +1 -1
  108. package/templates/kits/nestjs-standard/package.json.j2 +11 -2
  109. package/dist/analyze-ZFQWTCJQ.js +0 -1
  110. package/dist/artifact-remediation-plan-ICN3KOFG.js +0 -3
  111. package/dist/autopilot-release-VKXQ7BS7.js +0 -1
  112. package/dist/chunk-2AXEGYPL.js +0 -1
  113. package/dist/chunk-2D4UOYOJ.js +0 -1
  114. package/dist/chunk-AHLMIL2T.js +0 -1
  115. package/dist/chunk-AL2A7Q4X.js +0 -86
  116. package/dist/chunk-GNQRYISX.js +0 -5
  117. package/dist/chunk-I42F552T.js +0 -2
  118. package/dist/chunk-IDQKVJUF.js +0 -2
  119. package/dist/chunk-JFUD73OZ.js +0 -933
  120. package/dist/chunk-KKAOTTYO.js +0 -8
  121. package/dist/chunk-KMLPHFLD.js +0 -2
  122. package/dist/chunk-L2YK5RV2.js +0 -1
  123. package/dist/chunk-LAJM2SBP.js +0 -15
  124. package/dist/chunk-TDTCMZK7.js +0 -10
  125. package/dist/chunk-UETZ7USY.js +0 -36
  126. package/dist/chunk-WDKNMTJQ.js +0 -1
  127. package/dist/chunk-YPKNQCLK.js +0 -2
  128. package/dist/project-test-coverage-4TEHZJFC.js +0 -1
  129. package/dist/workspace-context-IHUFMZT3.js +0 -1
  130. package/dist/workspace-explain-64HNKAHO.js +0 -1
  131. package/dist/workspace-explain-contract-H7O26QJU.js +0 -1
  132. package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +0 -1
  133. package/dist/workspace-intelligence-runner-TG2VLHNZ.js +0 -1
  134. package/dist/workspace-run-2ZI5UMJ2.js +0 -1
  135. package/dist/workspace-watch-RP5KMVP2.js +0 -1
@@ -1,4 +1,4 @@
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(`
1
+ import {a as a$3}from'./chunk-HPWLSLMC.js';import {c}from'./chunk-FRJYAJH6.js';import {q}from'./chunk-6AXRIAP2.js';import {c as c$1}from'./chunk-FPJNWPKU.js';import {a as a$4}from'./chunk-KHEJO3JU.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-2OIBHUVH.js';import {g}from'./chunk-MZFSINY7.js';import {d,a as a$2,e as e$1}from'./chunk-MBRU3VWJ.js';import {a as a$1}from'./chunk-62K2H72S.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-AZFISDLS.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-RZBQXCNJ.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
2
  \u{1F517} Workspai Governance Pipeline
3
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
4
  Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
@@ -1 +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';
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-DZ4VKAXB.js';
@@ -0,0 +1 @@
1
+ export{b as PROJECT_TEST_COVERAGE_ARTIFACT,a as PROJECT_TEST_COVERAGE_SCHEMA,c as collectProjectTestCoverage}from'./chunk-4D7DIGAB.js';
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-7RLGOEWV.js';import {a as a$3}from'./chunk-F4KBYFZ5.js';import {c as c$1}from'./chunk-4D7DIGAB.js';import {a as a$2}from'./chunk-KHEJO3JU.js';import {p}from'./chunk-FUPHQOJB.js';import {a as a$4}from'./chunk-GR6442P7.js';import {e,d}from'./chunk-MBRU3VWJ.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {a,b}from'./chunk-62K2H72S.js';import {createHash}from'crypto';import l from'path';import y from'fs-extra';var W="workspai.verified-goal.v1",x=b.verifiedGoalStatus,C=a.verifiedGoalStatus,J="contracts/workspace-intelligence/verified-goal.v1.json",G="contracts/workspace-intelligence/verified-goal-status.v1.json";function A(e){return Array.isArray(e)?`[${e.map(A).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${A(a)}`).join(",")}}`:JSON.stringify(e)}function H(e){return createHash("sha256").update(A(e)).digest("hex")}var te=["package.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","pyproject.toml","requirements.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","gradle.lockfile","packages.lock.json","Directory.Packages.props","composer.json","composer.lock","Gemfile","Gemfile.lock","mix.exs","mix.lock","deps.edn","project.clj","build.sbt"],ae=new Set(te.map(e=>e.toLowerCase())),se=new Set([".git",".hg",".svn",".workspai",".venv","venv",".tox",".mypy_cache",".pytest_cache","__pycache__","node_modules","vendor","pods","dist","build","out","target","bin","obj","coverage",".coverage",".next",".nuxt",".svelte-kit"]),F=1e5;function ne(e){return ae.has(e.toLowerCase())||/\.(?:csproj|fsproj|vbproj)$/i.test(e)}async function re(e){let t=[e],a=[],s=0;for(;t.length>0;){let o=t.shift();if(o===void 0)break;let i=await y.readdir(o,{withFileTypes:true});if(i.sort((n,r)=>n.name.localeCompare(r.name)),s+=i.length,s>F)throw new Error(`Dependency safety baseline exceeded ${F} filesystem entries under ${e}. Narrow the project boundary before creating this goal.`);for(let n of i){let r=l.join(o,n.name);if(n.isDirectory()){!se.has(n.name.toLowerCase())&&!a$4(n.name)&&t.push(r);continue}n.isFile()&&ne(n.name)&&a.push(r);}}return a}function ie(e){return /^(?:package\.json|package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/i.test(e)?"node":/^(?:pyproject\.toml|requirements\.txt|Pipfile(?:\.lock)?|poetry\.lock|uv\.lock)$/i.test(e)?"python":/^go\.(?:mod|sum)$/i.test(e)?"go":/^Cargo\.(?:toml|lock)$/i.test(e)?"rust":/^(?:pom\.xml|build\.gradle(?:\.kts)?|gradle\.lockfile)$/i.test(e)?"jvm":/^(?:Directory\.Packages\.props|packages\.lock\.json)$/i.test(e)?"dotnet":/^composer\.(?:json|lock)$/i.test(e)?"php":/^Gemfile(?:\.lock)?$/i.test(e)?"ruby":/^mix\.(?:exs|lock)$/i.test(e)?"elixir":/^(?:deps\.edn|project\.clj)$/i.test(e)?"clojure":/^build\.sbt$/i.test(e)?"scala":/\.(?:csproj|fsproj|vbproj)$/i.test(e)?"dotnet":"unknown"}function K(e){try{let t=JSON.parse(e),a={};for(let s of ["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let o=t[s];if(!(!o||typeof o!="object"||Array.isArray(o)))for(let[i,n]of Object.entries(o))typeof n=="string"&&(a[`${s}:${i}`]=n);}return a}catch{return}}async function U(e,t){let s=(await p({workspacePath:e,includeAbsolutePaths:true})).projects.filter(i=>t.kind==="workspace"||i.name===t.projectName||l.resolve(e,i.path)===l.resolve(t.projectPath??"")),o=new Map;for(let i of s){let n=l.resolve(e,i.path),r=await re(n);for(let c of r){let p=l.basename(c),f=await y.readFile(c,"utf8"),d=l.relative(e,c).split(l.sep).join("/");o.set(d,{path:d,ecosystem:ie(p),sha256:createHash("sha256").update(f).digest("hex"),...p==="package.json"?{dependencies:K(f)??{}}:{}});}}return {manifests:[...o.values()].sort((i,n)=>i.path.localeCompare(n.path))}}function O(e){let a=e.replace(/^(?:workspace:|npm:[^@]+@)/,"").match(/(?:^|[^\d])(\d+)(?:\.\d+)?(?:\.\d+)?/);return a?Number(a[1]):null}function S(e){return /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|poetry\.lock|uv\.lock|Pipfile\.lock|go\.sum|Cargo\.lock|gradle\.lockfile|packages\.lock\.json|composer\.lock|Gemfile\.lock|mix\.lock)$/i.test(e)}async function oe(e){let t=e.dependencySafetyBaseline;if(!t)return k({id:"change-policy",label:"Change safety policy",status:"missing",expected:"dependency manifest safety baseline",actual:"baseline unavailable"});let a=[],s=await U(e.workspace.path,e.scope),o=new Map(s.manifests.map(r=>[r.path,r])),i=new Map(t.manifests.map(r=>[r.path,r])),n=new Set;for(let r of t.manifests){let c=o.get(r.path);(!c||c.sha256!==r.sha256)&&n.add(r.path);}for(let r of s.manifests)i.has(r.path)||n.add(r.path);for(let r of s.manifests)!i.has(r.path)&&!S(r.path)&&a.push(`${r.path} was added after the safety baseline`);for(let r of t.manifests){let c=o.get(r.path);if(!c){a.push(`${r.path} was removed`);continue}if(c.sha256===r.sha256)continue;if(r.dependencies){let d=await y.readFile(l.join(e.workspace.path,r.path),"utf8"),m=K(d);if(!m){a.push(`${r.path} is not valid dependency JSON`);continue}for(let[u,g]of Object.entries(r.dependencies)){let h=m[u];if(!h){a.push(`${u.replace(/^[^:]+:/,"")} was removed`);continue}if(h===g)continue;let $=O(g),R=O(h);($===null||R===null||$!==R||/(?:latest|\*)/i.test(h))&&a.push(`${u.replace(/^[^:]+:/,"")} changed outside its proven major range (${g} \u2192 ${h})`);}continue}if(S(r.path))continue;let p=l.posix.dirname(r.path);[...o.values()].some(d=>{let m=l.posix.dirname(d.path);return d.ecosystem===r.ecosystem&&(m===p||p.startsWith(`${m}/`))&&S(d.path)&&n.has(d.path)})||a.push(`${r.path} changed without a matching reconciled ${r.ecosystem} lockfile`);}return k({id:"change-policy",label:"Change safety policy",status:a.length===0?"passed":"blocked",expected:"no force, removal, unbounded, or major dependency changes",actual:a.length===0?"manifest changes are within proven bounds":a.join("; ")})}function E(e,t){if(!/^[a-z0-9][a-z0-9._-]{7,95}$/i.test(t))throw new Error(`Invalid verified goal id: ${t}`);let a=l.join(e,".workspai","goals",t);return {directory:a,goal:l.join(a,"goal.json"),status:l.join(a,"status.json"),latestReport:l.join(e,C)}}function ce(e){return {workspacePath:l.resolve(e.workspace.path),kind:e.kind,scope:e.scope,target:e.criteria.kind==="test-coverage"?e.criteria.minimumPercent:null,constraints:e.constraints}}async function V(e,t){await y.ensureDir(l.dirname(e));let a=`${e}.${process.pid}.${Date.now()}.tmp`;await y.writeJson(a,t,{spaces:2}),await y.rename(a,e);}async function le(e,t){let a=t?.trim();if(!a||a==="workspace")return {scope:{kind:"workspace"}};let s=a.startsWith("project:")?a.slice(8).trim():a;if(!s)throw new Error("Project goal scope must name a project.");let i=(await p({workspacePath:e,includeAbsolutePaths:true})).projects.filter(c=>{let p=l.resolve(e,c.path);return c.name===s||c.path===s||p===l.resolve(s)});if(i.length!==1)throw new Error(i.length===0?`Project goal scope was not found: ${s}`:`Project goal scope is ambiguous: ${s}`);let n=i[0],r=l.resolve(e,n.path);return {project:n,scope:{kind:"project",projectName:n.name,projectPath:r}}}function z(e,t,a){return e===null?"unavailable":a==="minimum"?e>=t?"satisfied":"unsatisfied":e<=t?"satisfied":"unsatisfied"}async function Y(e){if(!e)return null;try{let t=await y.readJson(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function de(e){return Array.isArray(e.projects)?e.projects.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):e.project&&typeof e.project=="object"&&!Array.isArray(e.project)?[e.project]:[]}function ue(e){let t=e.dependencyAudit;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}async function X(e,t){let a$1=await d(e,a.doctor),s=await Y(a$1);if(!s)return {measuredAt:new Date().toISOString(),value:null,target:0,unit:"blocking-vulnerabilities",status:"unavailable",evidencePaths:[],message:"Fresh Doctor dependency evidence is not available."};let o=de(s).filter(c=>{if(t.kind==="workspace")return true;let p=typeof c.name=="string"?c.name:typeof c.projectName=="string"?c.projectName:"",f=typeof c.path=="string"?l.resolve(c.path):typeof c.projectPath=="string"?l.resolve(c.projectPath):"";return p===t.projectName||t.projectPath!==void 0&&f===l.resolve(t.projectPath)}),i=o.map(ue).filter(c=>c!==null),n=i.map(c=>c.blockingFindingCount).filter(c=>Number.isInteger(c)&&Number(c)>=0),r=o.length>0&&n.length===o.length?n.reduce((c,p)=>c+p,0):null;return {measuredAt:(()=>{let c=i.map(p=>p.generatedAt).filter(p=>typeof p=="string").sort();return c[c.length-1]??new Date().toISOString()})(),value:r,target:0,unit:"blocking-vulnerabilities",status:z(r,0,"maximum"),evidencePaths:a$1?[a$1]:[],message:r===null?"Doctor did not publish complete dependency audit counts for the selected scope.":`${r} blocking dependency vulnerability finding(s) remain.`}}async function Q(e){let t=await a$2({startPath:e,writeReport:false}),a=t.gates.filter(o=>o.status==="pass").length,s=t.gates.length;return {measuredAt:t.generatedAt,value:a,target:s,unit:"gates",status:t.overallStatus==="pass"?"satisfied":"unsatisfied",evidencePaths:[...new Set(t.gates.map(o=>o.evidencePath).filter(o=>typeof o=="string"))],message:t.overallStatus==="pass"?"All release readiness gates pass.":`${s-a} release readiness gate(s) still require work.`}}async function B(e){let t=await c$1({projectPath:e.projectPath,target:e.target,run:e.run}),s=t.metrics[t.target.metric]?.percent??null;return {executionStatus:t.status,measurement:{measuredAt:t.generatedAt,value:s,target:e.target,unit:"percent",status:z(s,e.target,"minimum"),evidencePaths:[t.artifactPaths.project],message:t.status==="failed"?"The runtime-native coverage test command failed.":s===null?"Machine-readable coverage evidence is unavailable.":`${t.target.metric} coverage is ${s}% (target ${e.target}%).`}}}async function Z(e){if(e.scope.kind==="project"){if(!e.scope.projectPath)throw new Error("Coverage goal project scope does not have a project path.");return B({projectPath:e.scope.projectPath,target:e.target,run:e.run})}let t=await p({workspacePath:e.workspacePath,includeAbsolutePaths:true});if(t.projects.length===0)return {executionStatus:"unavailable",measurement:{measuredAt:new Date().toISOString(),value:null,target:e.target,unit:"percent",status:"unavailable",evidencePaths:[],message:"The workspace does not contain a registered project to measure."}};let a=[];for(let d of t.projects)a.push({projectName:d.name,result:await B({projectPath:l.resolve(e.workspacePath,d.path),target:e.target,run:e.run})});let s=a.filter(d=>d.result.executionStatus==="failed"),o=a.filter(d=>d.result.measurement.status==="unavailable"),i=a.filter(d=>d.result.measurement.status==="unsatisfied"),n=a.map(d=>d.result.measurement.value).filter(d=>d!==null),r=n.length===a.length&&n.length>0?Math.min(...n):null,c=s.length>0?"failed":o.length>0?"unavailable":i.length>0?"below-target":"passed",p$1=a.map(d=>d.result.measurement.measuredAt).sort(),f=[...s.map(d=>`${d.projectName}: coverage command failed`),...o.map(d=>`${d.projectName}: coverage unavailable`),...i.map(d=>`${d.projectName}: ${d.result.measurement.value??"unknown"}%`)];return {executionStatus:c,measurement:{measuredAt:p$1[p$1.length-1]??new Date().toISOString(),value:r,target:e.target,unit:"percent",status:c==="passed"?"satisfied":c==="below-target"?"unsatisfied":"unavailable",evidencePaths:[...new Set(a.flatMap(d=>d.result.measurement.evidencePaths))],message:c==="passed"?`Every registered project has at least ${e.target}% test coverage.`:`Workspace coverage is not verified: ${f.join("; ")}.`}}}function pe(e){let t=e.scope.kind==="project"?`project ${e.scope.projectName??"selected project"}`:"workspace";return e.kind==="release-readiness"?`Prepare the ${t} for release.`:e.kind==="dependency-security"?`Resolve blocking dependency vulnerabilities in the ${t} without unsafe changes.`:`Raise ${t} test coverage to ${e.target??80}% without breaking its build.`}function ge(e,t){return e==="release-readiness"?{kind:e,readiness:"pass",workspaceVerify:"ready"}:e==="dependency-security"?{kind:e,maximumBlockingVulnerabilities:0,requireFreshAudit:true}:{kind:e,metric:"auto",minimumPercent:t}}async function fe(e){return e.kind==="release-readiness"?Q(e.workspacePath):e.kind==="dependency-security"?X(e.workspacePath,e.scope):(await Z({workspacePath:e.workspacePath,scope:e.scope,target:e.target,run:false})).measurement}async function Ge(e$1){let t=l.resolve(e$1.workspacePath),a=Math.max(0,Math.min(100,Math.round(e$1.target??80))),{scope:s}=await le(t,e$1.scope),o={workspacePath:l.resolve(t),kind:e$1.kind,scope:s,target:e$1.kind==="test-coverage"?a:null,constraints:{allowBreakingChanges:e$1.allowBreakingChanges===true,allowForce:e$1.allowForce===true,requireBuild:e$1.requireBuild!==false,requireTests:e$1.requireTests!==false}},i=H(o),n=`goal-${e$1.kind}-${i.slice(0,16)}`,r=E(t,n);if(await y.pathExists(r.goal)){let{goal:m,status:u}=await ee(t,n);if(m.fingerprint===i)return {goal:m,status:u,resumed:u.state!=="verified"}}let c=new Date().toISOString(),p=await fe({workspacePath:t,kind:e$1.kind,scope:s,target:a}),f={schemaVersion:W,id:n,fingerprint:i,createdAt:c,updatedAt:c,workspace:{name:l.basename(t),path:t},scope:s,kind:e$1.kind,summary:pe({kind:e$1.kind,scope:s,target:a}),constraints:o.constraints,criteria:ge(e$1.kind,a),baseline:p,...e$1.kind==="dependency-security"?{dependencySafetyBaseline:await U(t,s)}:{},artifactPaths:{goal:r.goal,status:r.status,latestReport:r.latestReport}},d={schemaVersion:x,goalId:n,goalFingerprint:i,workspacePath:t,updatedAt:c,state:"planned",attempt:0,progress:p,checks:[],blockingReasons:[],evidencePaths:p.evidencePaths,nextActions:e$1.kind==="test-coverage"?["Add focused tests for the lowest-coverage source paths.","Run verified goal checks."]:e$1.kind==="dependency-security"?["Inspect the fresh project dependency audit.","Apply only compatible non-force dependency repairs.","Reconcile the lockfile, test, build, and verify again."]:["Inspect the current remediation plan and failing release gates.","Repair the next causal blocker, then verify again."],artifactPath:r.status};return a$1(f,J,"Verified goal"),a$1(d,G,"Verified goal status"),await V(r.goal,f),await V(r.status,d),await e(t,C,d),{goal:f,status:d,resumed:false}}async function ee(e,t){let a=E(l.resolve(e),t),s=await y.readJson(a.goal),o=await y.readJson(a.status);a$1(s,J,"Verified goal"),a$1(o,G,"Verified goal status");let i=l.resolve(e),n=l.resolve(s.artifactPaths.goal)===l.resolve(a.goal)&&l.resolve(s.artifactPaths.status)===l.resolve(a.status)&&l.resolve(s.artifactPaths.latestReport)===l.resolve(a.latestReport);if(s.schemaVersion!==W||o.schemaVersion!==x||s.id!==o.goalId||s.fingerprint!==o.goalFingerprint||s.fingerprint!==H(ce(s))||l.resolve(s.workspace.path)!==i||l.resolve(o.workspacePath)!==i||!n)throw new Error(`Verified goal artifacts are inconsistent: ${t}`);return {goal:s,status:o}}function k(e){return {...e,message:e.message??`${e.label}: ${e.actual}; expected ${e.expected}.`}}async function q(e){let t=[],a=e.goal.scope.kind==="project"&&e.goal.scope.projectName?`project:${e.goal.scope.projectName}`:void 0;for(let s of ["test","build"]){if(s==="test"&&e.includeTests===false)continue;if(!(s==="test"?e.goal.constraints.requireTests:e.goal.constraints.requireBuild)){t.push(k({id:s,label:`${s} validation`,status:"skipped",expected:"not required",actual:"skipped by goal contract"}));continue}if(!e.run){t.push(k({id:s,label:`${s} validation`,status:"missing",expected:"fresh passed evidence",actual:"execution disabled"}));continue}let i=await a$3({workspacePath:e.goal.workspace.path,stage:s,scope:a,parallel:false,continueOnError:false,strict:true,json:true,enforceGates:false});if(t.push(k({id:s,label:`${s} validation`,status:i.summary.exitCode===0?"passed":"failed",expected:"exit 0",actual:`exit ${i.summary.exitCode}`,evidencePath:l.join(e.goal.workspace.path,".workspai","reports","workspace-run-last.json")})),i.summary.exitCode!==0)break}return t}async function Ee(e$1){let t=l.resolve(e$1.workspacePath),{goal:a$2,status:s}=await ee(t,e$1.goalId),o=e$1.run!==false,i=[],n;if(o&&e$1.runIntelligence!==false){let u=await c({workspacePath:t,strict:true,agent:"generic"}),g=u.exitCode===0||u.exitCode===2,h=a$2.kind==="release-readiness";i.push(k({id:"workspace-intelligence-chain",label:"Workspace Intelligence chain",status:u.exitCode===0||u.exitCode===2&&!h?"passed":u.exitCode===2?"blocked":"failed",expected:"passed",actual:u.exitCode===2&&g&&!h?`${u.status}; canonical evidence refreshed for goal-scoped verification`:u.status,evidencePath:l.join(t,a.intelligenceRun)}));}if(a$2.kind==="release-readiness"){n=await Q(t),i.push(k({id:"release-readiness",label:"Release readiness",status:n.status==="satisfied"?"passed":"blocked",expected:"all gates pass",actual:n.message,evidencePath:l.join(t,a.readiness)}));let u=await d(t,a.verify),g=await Y(u),h=g?.summary&&typeof g.summary=="object"&&!Array.isArray(g.summary)?String(g.summary.verdict??"missing"):"missing";i.push(k({id:"workspace-verify",label:"Workspace verification",status:h==="ready"?"passed":h==="missing"?"missing":"blocked",expected:"ready",actual:h,evidencePath:l.join(t,a.verify)}));}else if(a$2.kind==="dependency-security")n=await X(t,a$2.scope),i.push(k({id:"dependency-audit",label:"Dependency security audit",status:n.status==="satisfied"?"passed":n.status==="unavailable"?"missing":"blocked",expected:"0 blocking vulnerabilities",actual:n.message,evidencePath:n.evidencePaths[0]})),i.push(a$2.constraints.allowBreakingChanges||a$2.constraints.allowForce?k({id:"change-policy",label:"Change safety policy",status:"blocked",expected:"breaking and force changes disabled",actual:`allowBreakingChanges=${a$2.constraints.allowBreakingChanges}, allowForce=${a$2.constraints.allowForce}`}):await oe(a$2)),n.status==="satisfied"&&i.push(...await q({goal:a$2,run:o}));else {let u=a$2.criteria.kind==="test-coverage"?a$2.criteria.minimumPercent:a$2.baseline.target;if(u===null)throw new Error("Coverage goal does not have a valid target.");let g=await Z({workspacePath:t,scope:a$2.scope,target:u,run:o});n=g.measurement,i.push(k({id:"coverage",label:"Test coverage",status:n.status==="satisfied"?"passed":n.status==="unavailable"?"missing":"blocked",expected:`at least ${u}%`,actual:n.message,evidencePath:n.evidencePaths[0]})),i.push(k({id:"test",label:"Coverage test execution",status:g.executionStatus==="failed"?"failed":g.executionStatus==="unavailable"?"missing":"passed",expected:"runtime-native coverage test command completed",actual:g.executionStatus==="failed"?"coverage test command failed":g.executionStatus==="unavailable"?"coverage execution evidence unavailable":"coverage evidence produced by the test runner",evidencePath:n.evidencePaths[0]})),n.status==="satisfied"&&i.push(...await q({goal:a$2,run:o,includeTests:false}));}let r=i.filter(u=>u.status==="blocked"||u.status==="failed"||u.status==="missing").map(u=>u.message),c$1=[...new Set([...n.evidencePaths,...i.map(u=>u.evidencePath).filter(u=>typeof u=="string")])],p=n.status==="satisfied"&&i.every(u=>u.status==="passed"||u.status==="skipped"),f=E(t,a$2.id),d$1=p?[]:a$2.kind==="test-coverage"?["Inspect low-coverage files from the coverage artifact.","Add focused tests and verify again."]:a$2.kind==="dependency-security"?["Use fresh audit candidates and compatible package-manager repairs.","Reconcile lockfiles before running verified goal checks again."]:["Repair the first blocking readiness gate and verify the goal again."],m={schemaVersion:x,goalId:a$2.id,goalFingerprint:a$2.fingerprint,workspacePath:t,updatedAt:new Date().toISOString(),state:p?"verified":i.some(u=>u.status==="failed")?"failed":"blocked",attempt:s.attempt+1,progress:n,checks:i,blockingReasons:r,evidencePaths:c$1,nextActions:d$1,artifactPath:f.status};return a$1(m,G,"Verified goal status"),await V(f.status,m),await e(t,C,m),m}export{C as VERIFIED_GOAL_LAST_RUN_REPORT_PATH,W as VERIFIED_GOAL_SCHEMA_VERSION,x as VERIFIED_GOAL_STATUS_SCHEMA_VERSION,Ge as planVerifiedGoal,ee as readVerifiedGoal,Ee as verifyVerifiedGoal};
@@ -1 +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
+ 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-MZFSINY7.js';
@@ -1 +1 @@
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';
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-5XJRCP3D.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-3D3PFPP5.js';
@@ -1 +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
+ 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-Q6CUJ3WF.js';
@@ -0,0 +1 @@
1
+ export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-WJY7ZXVJ.js';
@@ -1 +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';
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-B4CPDK6J.js';
@@ -0,0 +1 @@
1
+ export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-QURMI7ID.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-3D3PFPP5.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-PTTZPDLX.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-6PBSAAS5.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-3D3PFPP5.js';
@@ -1 +1 @@
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
+ import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-ZVOEPWQM.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-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};
1
+ import {b}from'./chunk-IO54DFWR.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-HOQ3OBNT.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -1 +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
+ import {c}from'./chunk-P4OSLAVD.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};
@@ -0,0 +1 @@
1
+ export{a as WORKSPACE_GRAPH_TOKEN_EFFICIENCY_SCHEMA_VERSION,b as buildWorkspaceGraphTokenEfficiencyReport}from'./chunk-7T4TSV5C.js';
@@ -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-BQGBU2Y3.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-ZVOEPWQM.js';
@@ -1 +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
+ 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-PTTZPDLX.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-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};
1
+ import {a as a$2,b as b$1,c,d as d$1}from'./chunk-4UVGTFOX.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {a}from'./chunk-62K2H72S.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
+ export{a as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,b as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,c as runWorkspaceIntelligenceChain}from'./chunk-7RLGOEWV.js';
@@ -1 +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
+ 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-62K2H72S.js';
@@ -1 +1 @@
1
- export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-YPKNQCLK.js';
1
+ export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-P4OSLAVD.js';
@@ -1 +1 @@
1
- export{a as WORKSPACE_KNOWLEDGE_SEARCH_SCHEMA_VERSION,e as queryKnowledgeEntities,c as queryKnowledgeEvidence,d as queryKnowledgePath,b as resolveKnowledgeTarget,f as searchKnowledgeGraph}from'./chunk-WDKNMTJQ.js';
1
+ export{a as WORKSPACE_KNOWLEDGE_SEARCH_SCHEMA_VERSION,e as queryKnowledgeEntities,c as queryKnowledgeEvidence,d as queryKnowledgePath,b as resolveKnowledgeTarget,f as searchKnowledgeGraph}from'./chunk-PS5F4DCT.js';
@@ -1,3 +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})}
1
+ import {b}from'./chunk-QURMI7ID.js';import {c as c$1,e}from'./chunk-6PBSAAS5.js';import {d,c as c$2,f,e as e$1}from'./chunk-PS5F4DCT.js';import {c as c$4,b as b$2}from'./chunk-3D3PFPP5.js';import {b as b$1}from'./chunk-WJY7ZXVJ.js';import {d as d$2}from'./chunk-XHRHNVCZ.js';import {c as c$3}from'./chunk-P4OSLAVD.js';import {k}from'./chunk-FUPHQOJB.js';import {h}from'./chunk-B4CPDK6J.js';import {d as d$1}from'./chunk-MBRU3VWJ.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import {a as a$1,c}from'./chunk-62K2H72S.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$2))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$2,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,b$1))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,b$1);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$2);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
2
  `);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
3
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};
@@ -1 +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';
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-FUPHQOJB.js';
@@ -1 +1 @@
1
- export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-2AXEGYPL.js';
1
+ export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-OTDGTAZJ.js';
@@ -0,0 +1,77 @@
1
+ import {b as b$1}from'./chunk-LPCL4U4L.js';import {g as g$1}from'./chunk-MBRU3VWJ.js';import g from'path';import i from'fs-extra';var l="README.md",h="<!-- workspai:workspace-intelligence:start -->",c="<!-- workspai:workspace-intelligence:end -->",m={minimal:"A lightweight workspace boundary that adds runtimes only when you need them.","node-only":"A Node.js-focused workspace with shared evidence and agent grounding.","python-only":"A Python-focused workspace with shared evidence and agent grounding.","go-only":"A Go-focused workspace with shared evidence and agent grounding.","java-only":"A Java-focused workspace with shared evidence and agent grounding.","dotnet-only":"A .NET-focused workspace with shared evidence and agent grounding.",polyglot:"A multi-runtime workspace for projects that share contracts, evidence, and agents.",enterprise:"A governed multi-runtime workspace with the complete evidence, policy, and agent surface."};function w(e){return e?.trim()||"minimal"}async function u(e){let n=g.join(e,".workspai","workspace.json");return await i.pathExists(n)?await i.readJson(n).catch(()=>({})):{}}function f(e){let n=e.engine;if(!n)return;if(n.python_core?.status==="skipped")return "Optional Python engine: not installed";if(n.python_version)return `Optional Python engine: Python ${n.python_version} via ${n.install_method||"local environment"}`}function y(e){let n=w(e.profile),r=b$1().presentations.standard.nodes.map(s=>s.label).join(" \u2192 "),a=e.projectCount===1?"project":"projects",t=m[n]??"A governed workspace with shared evidence for developers, tools, CI, IDEs, and AI agents.";return `${h}
2
+ # ${e.workspaceName}
3
+
4
+ This is a **Workspai Workspace Intelligence** workspace. It gives every registered project one shared, evidence-backed view for developers, CI, IDEs, and AI agents.
5
+
6
+ | Workspace | Current value |
7
+ | --- | --- |
8
+ | Profile | \`${n}\` |
9
+ | Registered projects | ${e.projectCount} ${a} |
10
+ ${e.engineSummary?`| Runtime foundation | ${e.engineSummary} |
11
+ `:""}| Evidence index | [\`.workspai/reports/INDEX.json\`](.workspai/reports/INDEX.json) |
12
+
13
+ ${t}
14
+
15
+ ## Start here
16
+
17
+ Create a project or add existing software:
18
+
19
+ \`\`\`bash
20
+ npx workspai create
21
+ \`\`\`
22
+
23
+ After the workspace has at least one project, run the complete intelligence loop:
24
+
25
+ \`\`\`bash
26
+ npx workspai workspace intelligence run --for-agent generic --strict --json
27
+ \`\`\`
28
+
29
+ The loop is defined by Workspai's versioned contract\u2014not by this README:
30
+
31
+ \`\`\`text
32
+ ${r}
33
+ \`\`\`
34
+
35
+ An empty workspace can be created and synchronized successfully, but strict intelligence checks will keep missing project evidence visible until software is added.
36
+
37
+ ## Useful workspace views
38
+
39
+ \`\`\`bash
40
+ # Refresh the canonical model and its proof-backed graph
41
+ npx workspai workspace model --write --json
42
+
43
+ # Search the graph without loading the full artifact
44
+ npx workspai workspace graph search "authentication service" --limit 12 --json
45
+
46
+ # Rediscover projects and refresh every consumer projection
47
+ npx workspai workspace sync --json
48
+
49
+ # Inspect workspace and project health
50
+ npx workspai doctor workspace
51
+
52
+ # Re-run the governed decision loop for a specific agent surface
53
+ npx workspai workspace intelligence run --for-agent copilot --strict --json
54
+ \`\`\`
55
+
56
+ Generated consumers start with:
57
+
58
+ - \`AGENTS.md\` for agent instructions and workspace routing.
59
+ - \`.workspai/reports/workspace-model.json\` for the canonical workspace model.
60
+ - \`.workspai/reports/workspace-knowledge-graph.json\` for proof-backed relationships.
61
+ - \`.workspai/reports/INDEX.json\` for the current evidence inventory.
62
+
63
+ Change the workspace profile only when its intended runtime or governance boundary changes:
64
+
65
+ \`\`\`bash
66
+ npx workspai bootstrap --profile <minimal|node-only|python-only|go-only|java-only|dotnet-only|polyglot|enterprise>
67
+ \`\`\`
68
+
69
+ Documentation: [workspai.dev](https://workspai.dev/)
70
+ ${c}`}function v(e){return e.includes("# Workspai Workspace")&&e.includes("This directory contains a Workspai development environment.")||/^# .+\n\nWorkspai \*\*[^*]+\*\* workspace\b/m.test(e)}function j(e,n){let o=e.indexOf(h),r=e.indexOf(c);if(o>=0&&r>=o){let t=r+c.length,s=e.slice(0,o).trimEnd(),k=s?n.replace(/^# .+$/m,"## Workspace Intelligence"):n;return `${s}${s?`
71
+
72
+ `:""}${k}${e.slice(t).trimStart().replace(/^/,e.slice(t).trim()?`
73
+
74
+ `:"")}`.trimEnd()}if(!e.trim()||v(e))return n;let a=n.replace(/^# .+$/m,"## Workspace Intelligence");return `${e.trimEnd()}
75
+
76
+ ${a}`}async function b(e){let n=await u(e.workspacePath),o=y({workspaceName:e.workspaceName,profile:e.profile,projectCount:e.projectCount,engineSummary:f(n)}),r=g.join(e.workspacePath,l),a=await i.pathExists(r)?await i.readFile(r,"utf-8"):"",t=`${j(a,o)}
77
+ `;return t!==a&&await g$1(e.workspacePath,l,t),r}export{c as WORKSPACE_README_MANAGED_END,h as WORKSPACE_README_MANAGED_START,l as WORKSPACE_README_PATH,y as renderWorkspaceReadmeManagedBlock,b as syncWorkspaceReadme};
@@ -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-IPJ5URDF.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-LOCPNNSK.js';
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-F4KBYFZ5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-GHB6QMQH.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-6UTM5AJI.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-XHRHNVCZ.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-ICLYL3N5.js';import {f as f$1,r,l}from'./chunk-FUPHQOJB.js';import {a as a$1}from'./chunk-GR6442P7.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import y from'fs';var b="workspace-watch-event.v1";function R(e){return a$2(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 C(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=C(c,a),i=m(a),l=c?m(c)!==i:true;return R({schemaVersion:b,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})}},S=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),j=new Set(["reports","cache","tmp",".cache"]);function O(e){if(!e)return false;let o=e.split(/[\\/]/).filter(Boolean);if(o.some(r=>S.has(r)||a$1(r)))return false;for(let r=0;r<o.length-1;r+=1)if((o[r]===".workspai"||o[r]===".rapidkit")&&j.has(o[r+1]))return false;return true}async function N(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(R({schemaVersion:b,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=>{O(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=y.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{b as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,C as diffWatchModels,O as isWatchRelevantPath,N as runWorkspaceWatch};
package/docs/README.md CHANGED
@@ -77,6 +77,7 @@ or use `import` to copy or clone one into the workspace.
77
77
  | Create a workspace or project | [Creating workspaces and projects](./creating-workspaces-and-projects.md) | A registered project with canonical `.workspai` metadata |
78
78
  | Bring an existing repository under governance | [Workspace operations](./workspace-operations.md#import-and-adoption) | Source stays in place with `adopt`, or is copied/cloned with `import` |
79
79
  | Run the complete intelligence loop | [Unified runner](./workspace-intelligence-runner.md) | One ordered run report with durable stage evidence |
80
+ | Set a release, security, or coverage outcome | [Verified engineering goals](./workspace-intelligence-runner.md#verified-engineering-goals) | A durable success contract with a current evidence-backed verdict |
80
81
  | Ask an architecture or dependency question | [Workspace Knowledge Graph](./workspace-knowledge-graph.md) | A bounded answer with proof references rather than the whole graph |
81
82
  | Measure agent token, cost, and outcome efficiency | [Workspace Intelligence Evaluation](./workspace-intelligence-evaluation.md) | A live, provenance-aware report suitable for CLI, IDE, and CI |
82
83
  | Integrate CI or release gates | [CI workflows](./ci-workflows.md) | Machine-readable exit codes and uploadable evidence |