workspai 0.76.0 → 0.77.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 (92) hide show
  1. package/README.md +2 -2
  2. package/contracts/create-planner-capabilities.v1.json +24 -0
  3. package/contracts/runtime-command-surface.v1.json +3 -1
  4. package/contracts/workspace-intelligence/workspace-model.v1.json +4 -0
  5. package/contracts/workspace-intelligence-architecture.v1.json +3 -1
  6. package/dist/analyze-TJM66CPF.js +1 -0
  7. package/dist/autopilot-release-C7Q4OTPY.js +1 -0
  8. package/dist/capabilities-command-TIBIKWPK.js +1 -0
  9. package/dist/{chunk-Z2M2XCIB.js → chunk-223SWPTL.js} +1 -1
  10. package/dist/{chunk-RKFTUIZ4.js → chunk-3EMAC3MF.js} +1 -1
  11. package/dist/{chunk-BZLDCASY.js → chunk-3EPR3D5Q.js} +1 -1
  12. package/dist/{chunk-PUH3TSPC.js → chunk-3SQIV3F4.js} +1 -1
  13. package/dist/{chunk-HRGIHWYH.js → chunk-475GQJ2D.js} +1 -1
  14. package/dist/{chunk-FBF767WP.js → chunk-47UR6ZH4.js} +1 -1
  15. package/dist/{chunk-AGI46TSQ.js → chunk-4CXV3PPV.js} +1 -1
  16. package/dist/chunk-4ZUBPFSO.js +6 -0
  17. package/dist/chunk-5KXOV7W4.js +1 -0
  18. package/dist/{chunk-4MXKXHLW.js → chunk-DWKCFHHL.js} +1 -1
  19. package/dist/{chunk-L6VNI4DN.js → chunk-E7WJ2QX7.js} +1 -1
  20. package/dist/{chunk-KW35SWG6.js → chunk-GLBFY7AB.js} +2 -2
  21. package/dist/{chunk-KO4DM2AV.js → chunk-HRVHQBTA.js} +1 -1
  22. package/dist/{chunk-X7MDTBX5.js → chunk-IAXRGH4Q.js} +1 -1
  23. package/dist/{chunk-QIPW3G2H.js → chunk-IDETNYCF.js} +1 -1
  24. package/dist/{chunk-YLLCZMKP.js → chunk-IHWS3ALP.js} +1 -1
  25. package/dist/{chunk-R3Z4LY3O.js → chunk-J2MPBSQJ.js} +1 -1
  26. package/dist/{chunk-FD2ZGGCQ.js → chunk-JVZA35OL.js} +1 -1
  27. package/dist/{chunk-H4YHIOCT.js → chunk-LUPKDFQ3.js} +3 -3
  28. package/dist/chunk-N7DOKE7V.js +2 -0
  29. package/dist/{chunk-TJ3MDZMC.js → chunk-O3TVVQ6X.js} +1 -1
  30. package/dist/{chunk-4BBFEHPL.js → chunk-QCX6BO2M.js} +1 -1
  31. package/dist/{chunk-PSQPKK6H.js → chunk-SC43A6LH.js} +52 -52
  32. package/dist/chunk-SEZTSMRR.js +1 -0
  33. package/dist/{chunk-TFFNHWXY.js → chunk-TGNPMOM6.js} +1 -1
  34. package/dist/chunk-UNEK3VVR.js +2684 -0
  35. package/dist/{chunk-2I2A55RE.js → chunk-UP3UWAJV.js} +1 -1
  36. package/dist/{chunk-IKNWNGLY.js → chunk-UTIK3K3M.js} +1 -1
  37. package/dist/{chunk-UOTOJJI4.js → chunk-V6HVDVKJ.js} +5 -5
  38. package/dist/chunk-WC2K5QFI.js +10 -0
  39. package/dist/{chunk-ZXQC36NJ.js → chunk-X5XFT5UZ.js} +1 -1
  40. package/dist/{chunk-23CNBYIW.js → chunk-ZIWWE4BQ.js} +1 -1
  41. package/dist/{create-ZRUQ3KNZ.js → create-YPAZJYCE.js} +1 -1
  42. package/dist/{doctor-7V7LJLHX.js → doctor-W5PXJ5FL.js} +1 -1
  43. package/dist/{goal-lifecycle-EM4DUJCR.js → goal-lifecycle-5R55CA7H.js} +1 -1
  44. package/dist/{goal-pack-YMWZHAH6.js → goal-pack-IS6GGJPH.js} +1 -1
  45. package/dist/index.js +256 -247
  46. package/dist/{pipeline-6MBH3MU2.js → pipeline-LW3SW2WT.js} +1 -1
  47. package/dist/{project-agent-entry-ZXAE2MAJ.js → project-agent-entry-5TYKK5IV.js} +1 -1
  48. package/dist/{project-intelligence-lens-NBTPOK2R.js → project-intelligence-lens-TEOSTKNU.js} +1 -1
  49. package/dist/{project-test-coverage-HOZC72EK.js → project-test-coverage-T4TIWGKN.js} +1 -1
  50. package/dist/{proof-carrying-change-WJFAKK3C.js → proof-carrying-change-2TKRADCW.js} +1 -1
  51. package/dist/{verified-goal-B7EX2PBE.js → verified-goal-RN4TOV34.js} +1 -1
  52. package/dist/{workspace-EBPYCSEM.js → workspace-A33YMF2N.js} +1 -1
  53. package/dist/{workspace-agent-sync-Y4F6FBBC.js → workspace-agent-sync-VCA4G4DT.js} +1 -1
  54. package/dist/{workspace-context-Y7F7GJCQ.js → workspace-context-YBWLSKR6.js} +1 -1
  55. package/dist/{workspace-contract-XJMWMVQE.js → workspace-contract-3QUZDBMM.js} +1 -1
  56. package/dist/{workspace-explain-T2J5ZLY7.js → workspace-explain-NXYRAQFI.js} +1 -1
  57. package/dist/{workspace-foundation-2UP6IMTH.js → workspace-foundation-DZ52PECX.js} +1 -1
  58. package/dist/{workspace-graph-stream-MZVL3OCX.js → workspace-graph-stream-4VT46HZ7.js} +1 -1
  59. package/dist/{workspace-intelligence-FZRQIFFM.js → workspace-intelligence-FKYQQDJ6.js} +1 -1
  60. package/dist/{workspace-intelligence-runner-IXT62JG7.js → workspace-intelligence-runner-3K2JZH6Q.js} +1 -1
  61. package/dist/{workspace-knowledge-graph-EFC4TUDZ.js → workspace-knowledge-graph-CPBKNXQI.js} +1 -1
  62. package/dist/workspace-knowledge-graph-snapshot-67XDXUOT.js +1 -0
  63. package/dist/{workspace-mcp-serve-C42UUU7W.js → workspace-mcp-serve-UXPKX7K6.js} +1 -1
  64. package/dist/{workspace-model-72SJ6WXT.js → workspace-model-POCPMNRT.js} +1 -1
  65. package/dist/{workspace-onboarding-TFDAIHTS.js → workspace-onboarding-KLG3GG7S.js} +1 -1
  66. package/dist/{workspace-registry-summary-ZNTXSUI4.js → workspace-registry-summary-M4WMFDQ4.js} +1 -1
  67. package/dist/{workspace-repair-engine-542TAL3Z.js → workspace-repair-engine-2VGN42QD.js} +1 -1
  68. package/dist/workspace-run-5YQR7GEZ.js +1 -0
  69. package/dist/{workspace-verify-UXKENOQU.js → workspace-verify-PLAKTF3J.js} +1 -1
  70. package/dist/{workspace-watch-DV5AHLOK.js → workspace-watch-VNU4KVYN.js} +1 -1
  71. package/docs/README.md +2 -0
  72. package/docs/agent-framework-adapters.md +4 -0
  73. package/docs/ci-workflows.md +12 -1
  74. package/docs/commands-reference.md +2 -0
  75. package/docs/create-planner-capabilities.md +1 -0
  76. package/docs/creating-workspaces-and-projects.md +24 -7
  77. package/docs/doctor-command.md +3 -0
  78. package/docs/model-gateways.md +204 -0
  79. package/docs/native-kit-baselines.md +2 -1
  80. package/package.json +3 -1
  81. package/scripts/enterprise-package-smoke.mjs +102 -0
  82. package/dist/analyze-QVRVJB7I.js +0 -1
  83. package/dist/autopilot-release-DOGIETAT.js +0 -1
  84. package/dist/capabilities-command-FYBUVHZ7.js +0 -1
  85. package/dist/chunk-4R44E7HN.js +0 -6
  86. package/dist/chunk-5S6IZ6PY.js +0 -2
  87. package/dist/chunk-NSC4VWV2.js +0 -1
  88. package/dist/chunk-QFDTKOYS.js +0 -2649
  89. package/dist/chunk-QVFIR64T.js +0 -10
  90. package/dist/chunk-VODNLROY.js +0 -1
  91. package/dist/workspace-knowledge-graph-snapshot-QIMF7TCF.js +0 -1
  92. package/dist/workspace-run-NAPJYNSZ.js +0 -1
@@ -1,4 +1,4 @@
1
- import {c}from'./chunk-L6VNI4DN.js';import {c as c$1}from'./chunk-LPCWROQ3.js';import {a as a$3}from'./chunk-TFFNHWXY.js';import {g as g$1}from'./chunk-KW35SWG6.js';import {a as a$2}from'./chunk-Z2M2XCIB.js';import {v}from'./chunk-PSQPKK6H.js';import {f,e}from'./chunk-XF65LQ6M.js';import {c as c$3}from'./chunk-X7FYEKLI.js';import {a}from'./chunk-SVO2GGTV.js';import {g,a as a$1,h}from'./chunk-BLEIUQL6.js';import {p,t,s}from'./chunk-ODK4LCEL.js';import c$2 from'chalk';import d from'path';import G from'fs-extra';function L(s){return s===0?"pass":s===2?"warn":"fail"}async function _(s){try{let a=G.readJsonSync(s),i=a.policyProfile,t=c$3(a).filter(n=>n.status==="blocking").map(n=>`${n.projectName}: ${n.message}`);return {policyProfile:typeof i?.name=="string"?i.name:void 0,blockers:[...new Set(t)].slice(0,12)}}catch{return {blockers:[]}}}function j(s){return s.some(a=>a.status==="fail")?"blocked":s.some(a=>a.status==="warn")?"needs-attention":"ready"}function V(s,a){if(a)return 3;let i=s.some(n=>n.status==="fail"),t=s.some(n=>n.status==="warn");return i?1:t?2:0}function K(s,a){return s===2&&!a?0:s}async function J(s){let a=await g$1(s,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-XJMWMVQE.js');await t({workspacePath:s}),i=true;}catch{i=false;}return {sync:a,contractSynced:i}}async function U(s$1={}){let a$4=d.resolve(s$1.workspacePath??process.cwd()),i=a(a$4);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t$1=[],n=[],u=false,m,w,g$1,h$1=Date.now();try{let{sync:e,contractSynced:r}=await J(i),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t$1.push({name:"sync",status:o,durationMs:Date.now()-h$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${r?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||n.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){u=true,t$1.push({name:"sync",status:"fail",durationMs:Date.now()-h$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),n.push("workspace sync stage failed");}let P=Date.now();try{let e=await v({workspace:true,json:true,quiet:true,strict:s$1.strict===true,ci:s$1.strict!==true}),r=L(e),o=await g(i,p.doctor)??a$1(i,p.doctor),l=await _(o);t$1.push({name:"doctor",status:r,durationMs:Date.now()-P,summary:r==="pass"?"doctor workspace passed":r==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:o,policyProfile:l.policyProfile,blockers:l.blockers}),r==="fail"?n.push(...l.blockers.length>0?l.blockers.map(O=>`doctor: ${O}`):["doctor workspace gate failed"]):r==="warn"&&n.push("doctor workspace reported warnings");}catch(e){u=true,t$1.push({name:"doctor",status:"fail",durationMs:Date.now()-P,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),n.push("doctor workspace stage failed");}if(s$1.skipAnalyze)t$1.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let r=await a$2({workspacePath:i,json:true,strict:s$1.strict===true});m=d.isAbsolute(r.enterpriseControls.evidencePath)?r.enterpriseControls.evidencePath:d.join(i,r.enterpriseControls.evidencePath);let o=r.summary.verdict==="blocked"?"fail":r.summary.verdict==="needs-attention"?"warn":"pass";t$1.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${r.summary.verdict} (score ${r.summary.score}/100)`,evidencePath:m}),o==="fail"?n.push("analyze reported blocked verdict"):o==="warn"&&n.push("analyze reported needs-attention verdict");}catch(r){u=true,t$1.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${r instanceof Error?r.message:String(r)}`}),n.push("analyze stage failed");}}let k=Date.now();try{let e=await a$3({startPath:i,writeReport:true,skipVerify:s$1.skipVerify===true});w=e.evidencePath;let r=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t$1.push({name:"readiness",status:r,durationMs:Date.now()-k,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),r==="fail"?n.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):r==="warn"&&n.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){u=true,t$1.push({name:"readiness",status:"fail",durationMs:Date.now()-k,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),n.push("readiness stage failed");}if(s$1.skipAutopilot)t$1.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),r=s$1.autopilotMode??"audit";try{let o=await c({workspacePath:i,mode:r,json:true,skipPipelineStages:true});g$1=o.artifacts.reportPath;let l=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";t$1.push({name:"autopilot",status:l,durationMs:Date.now()-e,summary:`autopilot ${r}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:g$1}),l!=="pass"&&n.push(...o.blockingReasons.slice(0,5));}catch(o){u=true,t$1.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),n.push("autopilot release stage failed");}}let N=j(t$1),S=V(t$1,u),I=d.join(i,t.pipelineLastRun),p$1={schemaVersion:s.pipelineLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:N,exitCode:S,stagesPassed:t$1.filter(e=>e.status==="pass").length,stagesWarn:t$1.filter(e=>e.status==="warn").length,stagesFailed:t$1.filter(e=>e.status==="fail").length},stages:t$1,blockingReasons:[...new Set(n)],artifacts:{reportPath:I,analyzeEvidencePath:m,readinessEvidencePath:w,autopilotEvidencePath:g$1}};if(s$1.writeReport!==false){let e$1=f(p$1,{commandId:"workspacePipeline",exitCode:S,generatedAt:p$1.generatedAt,blockers:p$1.blockingReasons,runId:e()});await h(i,t.pipelineLastRun,e$1);}if(s$1.writeReport!==false&&s$1.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s$1.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-Y4F6FBBC.js'),r=await e({workspacePath:i,write:true,refreshContext:true,strict:false});p$1.agentGrounding={indexPath:r.indexPath,writtenFiles:r.writtenFiles,blockers:r.blockers};}catch{}return p$1}async function ue(s){let a;try{a=await U(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:n}),null,2)):console.log(c$2.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(a,null,2));else {console.log(c$2.bold.cyan(`
1
+ import {c}from'./chunk-E7WJ2QX7.js';import {c as c$1}from'./chunk-LPCWROQ3.js';import {a as a$3}from'./chunk-TGNPMOM6.js';import {g as g$1}from'./chunk-GLBFY7AB.js';import {a as a$2}from'./chunk-223SWPTL.js';import {v}from'./chunk-SC43A6LH.js';import {f,e}from'./chunk-XF65LQ6M.js';import {c as c$3}from'./chunk-X7FYEKLI.js';import {a}from'./chunk-SVO2GGTV.js';import {g,a as a$1,h}from'./chunk-BLEIUQL6.js';import {p,t,s}from'./chunk-ODK4LCEL.js';import c$2 from'chalk';import d from'path';import G from'fs-extra';function L(s){return s===0?"pass":s===2?"warn":"fail"}async function _(s){try{let a=G.readJsonSync(s),i=a.policyProfile,t=c$3(a).filter(n=>n.status==="blocking").map(n=>`${n.projectName}: ${n.message}`);return {policyProfile:typeof i?.name=="string"?i.name:void 0,blockers:[...new Set(t)].slice(0,12)}}catch{return {blockers:[]}}}function j(s){return s.some(a=>a.status==="fail")?"blocked":s.some(a=>a.status==="warn")?"needs-attention":"ready"}function V(s,a){if(a)return 3;let i=s.some(n=>n.status==="fail"),t=s.some(n=>n.status==="warn");return i?1:t?2:0}function K(s,a){return s===2&&!a?0:s}async function J(s){let a=await g$1(s,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-3QUZDBMM.js');await t({workspacePath:s}),i=true;}catch{i=false;}return {sync:a,contractSynced:i}}async function U(s$1={}){let a$4=d.resolve(s$1.workspacePath??process.cwd()),i=a(a$4);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t$1=[],n=[],u=false,m,w,g$1,h$1=Date.now();try{let{sync:e,contractSynced:r}=await J(i),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t$1.push({name:"sync",status:o,durationMs:Date.now()-h$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${r?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||n.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){u=true,t$1.push({name:"sync",status:"fail",durationMs:Date.now()-h$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),n.push("workspace sync stage failed");}let P=Date.now();try{let e=await v({workspace:true,json:true,quiet:true,strict:s$1.strict===true,ci:s$1.strict!==true}),r=L(e),o=await g(i,p.doctor)??a$1(i,p.doctor),l=await _(o);t$1.push({name:"doctor",status:r,durationMs:Date.now()-P,summary:r==="pass"?"doctor workspace passed":r==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:o,policyProfile:l.policyProfile,blockers:l.blockers}),r==="fail"?n.push(...l.blockers.length>0?l.blockers.map(O=>`doctor: ${O}`):["doctor workspace gate failed"]):r==="warn"&&n.push("doctor workspace reported warnings");}catch(e){u=true,t$1.push({name:"doctor",status:"fail",durationMs:Date.now()-P,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),n.push("doctor workspace stage failed");}if(s$1.skipAnalyze)t$1.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let r=await a$2({workspacePath:i,json:true,strict:s$1.strict===true});m=d.isAbsolute(r.enterpriseControls.evidencePath)?r.enterpriseControls.evidencePath:d.join(i,r.enterpriseControls.evidencePath);let o=r.summary.verdict==="blocked"?"fail":r.summary.verdict==="needs-attention"?"warn":"pass";t$1.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${r.summary.verdict} (score ${r.summary.score}/100)`,evidencePath:m}),o==="fail"?n.push("analyze reported blocked verdict"):o==="warn"&&n.push("analyze reported needs-attention verdict");}catch(r){u=true,t$1.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${r instanceof Error?r.message:String(r)}`}),n.push("analyze stage failed");}}let k=Date.now();try{let e=await a$3({startPath:i,writeReport:true,skipVerify:s$1.skipVerify===true});w=e.evidencePath;let r=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t$1.push({name:"readiness",status:r,durationMs:Date.now()-k,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),r==="fail"?n.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):r==="warn"&&n.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){u=true,t$1.push({name:"readiness",status:"fail",durationMs:Date.now()-k,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),n.push("readiness stage failed");}if(s$1.skipAutopilot)t$1.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),r=s$1.autopilotMode??"audit";try{let o=await c({workspacePath:i,mode:r,json:true,skipPipelineStages:true});g$1=o.artifacts.reportPath;let l=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";t$1.push({name:"autopilot",status:l,durationMs:Date.now()-e,summary:`autopilot ${r}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:g$1}),l!=="pass"&&n.push(...o.blockingReasons.slice(0,5));}catch(o){u=true,t$1.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),n.push("autopilot release stage failed");}}let N=j(t$1),S=V(t$1,u),I=d.join(i,t.pipelineLastRun),p$1={schemaVersion:s.pipelineLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:N,exitCode:S,stagesPassed:t$1.filter(e=>e.status==="pass").length,stagesWarn:t$1.filter(e=>e.status==="warn").length,stagesFailed:t$1.filter(e=>e.status==="fail").length},stages:t$1,blockingReasons:[...new Set(n)],artifacts:{reportPath:I,analyzeEvidencePath:m,readinessEvidencePath:w,autopilotEvidencePath:g$1}};if(s$1.writeReport!==false){let e$1=f(p$1,{commandId:"workspacePipeline",exitCode:S,generatedAt:p$1.generatedAt,blockers:p$1.blockingReasons,runId:e()});await h(i,t.pipelineLastRun,e$1);}if(s$1.writeReport!==false&&s$1.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s$1.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-VCA4G4DT.js'),r=await e({workspacePath:i,write:true,refreshContext:true,strict:false});p$1.agentGrounding={indexPath:r.indexPath,writtenFiles:r.writtenFiles,blockers:r.blockers};}catch{}return p$1}async function ue(s){let a;try{a=await U(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:n}),null,2)):console.log(c$2.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(a,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(d.basename(a.workspacePath))}`)),console.log(c$2.gray(`Path: ${a.workspacePath}`)),console.log(c$2.white(`Verdict: ${a.summary.verdict} Exit: ${a.summary.exitCode} (${a.summary.stagesPassed} pass / ${a.summary.stagesWarn} warn / ${a.summary.stagesFailed} fail)`));for(let t of a.stages){let n=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}: ${n} ${t.summary}`);}if(a.blockingReasons.length>0){console.log(c$2.bold(`
4
4
  Blocking reasons:`));for(let t of a.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
@@ -1 +1 @@
1
- export{c as AGENT_BOOTSTRAP_RECEIPT_SCHEMA_VERSION,f as AGENT_ENTRY_HOST_IDS,g as PROJECT_AGENT_ADAPTER_ENTRY_FILES,b as PROJECT_AGENT_ENTRY_RELATIVE_PATH,a as PROJECT_AGENT_ENTRY_SCHEMA_VERSION,e as WORKSPAI_AGENT_ENTRY_END,d as WORKSPAI_AGENT_ENTRY_START,j as buildAgentBootstrapReceipt,i as buildProjectAgentEntryManifest,h as normalizeAgentEntryHost}from'./chunk-23CNBYIW.js';
1
+ export{c as AGENT_BOOTSTRAP_RECEIPT_SCHEMA_VERSION,f as AGENT_ENTRY_HOST_IDS,g as PROJECT_AGENT_ADAPTER_ENTRY_FILES,b as PROJECT_AGENT_ENTRY_RELATIVE_PATH,a as PROJECT_AGENT_ENTRY_SCHEMA_VERSION,e as WORKSPAI_AGENT_ENTRY_END,d as WORKSPAI_AGENT_ENTRY_START,j as buildAgentBootstrapReceipt,i as buildProjectAgentEntryManifest,h as normalizeAgentEntryHost}from'./chunk-ZIWWE4BQ.js';
@@ -1 +1 @@
1
- export{b as PROJECT_CONTEXT_AGENT_SCHEMA_VERSION,c as PROJECT_GROUNDING_MODE_VALUES,g as PROJECT_PORTABLE_GROUNDING_SKILL_PATH,e as WORKSPAI_PROJECT_GROUNDING_END,d as WORKSPAI_PROJECT_GROUNDING_START,f as WORKSPAI_PROJECT_SKILL_MARKER,i as buildProjectContextAgent,j as resolveProjectPortableSkillTransactionPaths,m as resolveWorkspaceProjectLensTargets,h as selectBoundedProjectLensEntities,k as syncProjectIntelligenceLens,l as syncWorkspaceProjectLenses}from'./chunk-X7MDTBX5.js';
1
+ export{b as PROJECT_CONTEXT_AGENT_SCHEMA_VERSION,c as PROJECT_GROUNDING_MODE_VALUES,g as PROJECT_PORTABLE_GROUNDING_SKILL_PATH,e as WORKSPAI_PROJECT_GROUNDING_END,d as WORKSPAI_PROJECT_GROUNDING_START,f as WORKSPAI_PROJECT_SKILL_MARKER,i as buildProjectContextAgent,j as resolveProjectPortableSkillTransactionPaths,m as resolveWorkspaceProjectLensTargets,h as selectBoundedProjectLensEntities,k as syncProjectIntelligenceLens,l as syncWorkspaceProjectLenses}from'./chunk-IAXRGH4Q.js';
@@ -1 +1 @@
1
- export{b as PROJECT_TEST_COVERAGE_ARTIFACT,a as PROJECT_TEST_COVERAGE_SCHEMA,d as collectProjectTestCoverage,c as inspectProjectTestCoverageCapability}from'./chunk-HRGIHWYH.js';
1
+ export{b as PROJECT_TEST_COVERAGE_ARTIFACT,a as PROJECT_TEST_COVERAGE_SCHEMA,d as collectProjectTestCoverage,c as inspectProjectTestCoverageCapability}from'./chunk-475GQJ2D.js';
@@ -1 +1 @@
1
- export{n as abortProofCarryingChange,u as assertAppliedProofCarryingChangeCurrent,v as assertSealedProofCarryingChangeCurrent,e as attachProofCarryingChangePlan,f as authorizeProofCarryingChange,c as beginProofCarryingChange,b as createDeletedArtifactReference,t as decisionTransactionForCapsule,p as exportProofCarryingChangeCapsule,j as findUncoveredEffectArtifacts,l as inspectProofCarryingChange,m as listProofCarryingChanges,h as recordProofCarryingChangeEffect,d as recordProofCarryingChangePrediction,i as recordProofCarryingChangeVerification,g as resumeProofCarryingChange,r as validateEffectReceiptInput,q as validatePredictedArchitectureChangeInput,o as validateProofCarryingChangeCapsule,s as validateVerificationReceiptInput,k as verifyProofCarryingChange}from'./chunk-RKFTUIZ4.js';
1
+ export{n as abortProofCarryingChange,u as assertAppliedProofCarryingChangeCurrent,v as assertSealedProofCarryingChangeCurrent,e as attachProofCarryingChangePlan,f as authorizeProofCarryingChange,c as beginProofCarryingChange,b as createDeletedArtifactReference,t as decisionTransactionForCapsule,p as exportProofCarryingChangeCapsule,j as findUncoveredEffectArtifacts,l as inspectProofCarryingChange,m as listProofCarryingChanges,h as recordProofCarryingChangeEffect,d as recordProofCarryingChangePrediction,i as recordProofCarryingChangeVerification,g as resumeProofCarryingChange,r as validateEffectReceiptInput,q as validatePredictedArchitectureChangeInput,o as validateProofCarryingChangeCapsule,s as validateVerificationReceiptInput,k as verifyProofCarryingChange}from'./chunk-3EMAC3MF.js';
@@ -1 +1 @@
1
- import {b as b$1}from'./chunk-QVFIR64T.js';import {c}from'./chunk-4MXKXHLW.js';import {a as a$1}from'./chunk-TFFNHWXY.js';import {d as d$2}from'./chunk-HRGIHWYH.js';import {r}from'./chunk-VODNLROY.js';import {d as d$1}from'./chunk-ROOPODG6.js';import {a as a$2}from'./chunk-GR6442P7.js';import {h,g}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {b}from'./chunk-252EKOR6.js';import {p,q as q$1}from'./chunk-ODK4LCEL.js';import {createHash}from'crypto';import d from'path';import v from'fs-extra';var K="workspai.verified-goal.v1",V=q$1.verifiedGoalStatus,$=p.verifiedGoalStatus,z="contracts/workspace-intelligence/verified-goal.v1.json",E="contracts/workspace-intelligence/verified-goal-status.v1.json";function w(e,t){return d$1(e,t.path,{...t.absolutePath?{absolutePath:t.absolutePath}:{}})}function U(e,t,a){if(t.kind==="workspace")return true;let r=w(e,a);return t.kind==="project"?a.name===t.projectName||r===d.resolve(t.projectPath):t.projects.some(i=>i.projectName===a.name||d.resolve(i.projectPath)===r)}function C(e){return Array.isArray(e)?`[${e.map(C).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${C(a)}`).join(",")}}`:JSON.stringify(e)}function Y(e){return createHash("sha256").update(C(e)).digest("hex")}var ne=["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"],ie=new Set(ne.map(e=>e.toLowerCase())),oe=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"]),q=1e5;function ce(e){return ie.has(e.toLowerCase())||/\.(?:csproj|fsproj|vbproj)$/i.test(e)}async function le(e){let t=[e],a=[],r=0;for(;t.length>0;){let i=t.shift();if(i===void 0)break;let o=await v.readdir(i,{withFileTypes:true});if(o.sort((n,s)=>n.name.localeCompare(s.name)),r+=o.length,r>q)throw new Error(`Dependency safety baseline exceeded ${q} filesystem entries under ${e}. Narrow the project boundary before creating this goal.`);for(let n of o){let s=d.join(i,n.name);if(n.isDirectory()){!oe.has(n.name.toLowerCase())&&!a$2(n.name)&&t.push(s);continue}n.isFile()&&ce(n.name)&&a.push(s);}}return a}function ue(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 X(e){try{let t=JSON.parse(e),a={};for(let r of ["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let i=t[r];if(!(!i||typeof i!="object"||Array.isArray(i)))for(let[o,n]of Object.entries(i))typeof n=="string"&&(a[`${r}:${o}`]=n);}return a}catch{return}}async function Q(e,t){let r$1=(await r({workspacePath:e,includeAbsolutePaths:true})).projects.filter(o=>U(e,t,o)),i=new Map;for(let o of r$1){let n=w(e,o),s=await le(n);for(let c of s){let g=d.basename(c),f=await v.readFile(c,"utf8"),p=d.relative(e,c).split(d.sep).join("/");i.set(p,{path:p,ecosystem:ue(g),sha256:createHash("sha256").update(f).digest("hex"),...g==="package.json"?{dependencies:X(f)??{}}:{}});}}return {manifests:[...i.values()].sort((o,n)=>o.path.localeCompare(n.path))}}function W(e){let a=e.replace(/^(?:workspace:|npm:[^@]+@)/,"").match(/(?:^|[^\d])(\d+)(?:\.\d+)?(?:\.\d+)?/);return a?Number(a[1]):null}function x(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 de(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=[],r=await Q(e.workspace.path,e.scope),i=new Map(r.manifests.map(s=>[s.path,s])),o=new Map(t.manifests.map(s=>[s.path,s])),n=new Set;for(let s of t.manifests){let c=i.get(s.path);(!c||c.sha256!==s.sha256)&&n.add(s.path);}for(let s of r.manifests)o.has(s.path)||n.add(s.path);for(let s of r.manifests)!o.has(s.path)&&!x(s.path)&&a.push(`${s.path} was added after the safety baseline`);for(let s of t.manifests){let c=i.get(s.path);if(!c){a.push(`${s.path} was removed`);continue}if(c.sha256===s.sha256)continue;if(s.dependencies){let p=await v.readFile(d.join(e.workspace.path,s.path),"utf8"),m=X(p);if(!m){a.push(`${s.path} is not valid dependency JSON`);continue}for(let[u,l]of Object.entries(s.dependencies)){let h=m[u];if(!h){a.push(`${u.replace(/^[^:]+:/,"")} was removed`);continue}if(h===l)continue;let R=W(l),N=W(h);(R===null||N===null||R!==N||/(?:latest|\*)/i.test(h))&&a.push(`${u.replace(/^[^:]+:/,"")} changed outside its proven major range (${l} \u2192 ${h})`);}continue}if(x(s.path))continue;let g=d.posix.dirname(s.path);[...i.values()].some(p=>{let m=d.posix.dirname(p.path);return p.ecosystem===s.ecosystem&&(m===g||g.startsWith(`${m}/`))&&x(p.path)&&n.has(p.path)})||a.push(`${s.path} changed without a matching reconciled ${s.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 G(e,t){if(!/^[a-z0-9][a-z0-9._-]{7,95}$/i.test(t))throw new Error(`Invalid verified goal id: ${t}`);let a=d.join(e,".workspai","goals",t);return {directory:a,goal:d.join(a,"goal.json"),status:d.join(a,"status.json"),latestReport:d.join(e,$)}}function pe(e){return {workspacePath:d.resolve(e.workspace.path),kind:e.kind,scope:e.scope,target:e.criteria.kind==="test-coverage"?e.criteria.minimumPercent:null,...e.criteria.kind==="test-coverage"&&e.criteria.runtime?{runtime:e.criteria.runtime}:{},constraints:e.constraints}}async function A(e,t){await v.ensureDir(d.dirname(e));let a=`${e}.${process.pid}.${Date.now()}.tmp`;await v.writeJson(a,t,{spaces:2}),await v.rename(a,e);}async function ge(e,t){let a=t?.trim();if(!a||a==="workspace")return {scope:{kind:"workspace"}};let r$1=a.startsWith("projects:")?"projects:":a.startsWith("project:")&&a.slice(8).includes(",")?"project:":null,i=a.startsWith("project:")?a.slice(8).trim():r$1?a.slice(r$1.length).trim():a;if(!i)throw new Error("Project goal scope must name a project.");let o=await r({workspacePath:e,includeAbsolutePaths:true});if(r$1){let g=i.split(",").map(p=>p.trim()).filter(Boolean);if(g.length<2||new Set(g).size!==g.length)throw new Error("A project-set goal scope must name at least two unique projects.");return {scope:{kind:"project-set",projects:g.map(p=>{let m=o.projects.filter(u=>u.name===p||u.path===p);if(m.length!==1)throw new Error(m.length===0?`Project goal scope was not found: ${p}`:`Project goal scope is ambiguous: ${p}`);return m[0]}).map(p=>({projectName:p.name,projectPath:w(e,p)})).sort((p,m)=>p.projectName.localeCompare(m.projectName))}}}let n=o.projects.filter(g=>{let f=w(e,g);return g.name===i||g.path===i||f===d.resolve(i)});if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found: ${i}`:`Project goal scope is ambiguous: ${i}`);let s=n[0],c=w(e,s);return {project:s,scope:{kind:"project",projectName:s.name,projectPath:c}}}function Z(e,t,a){return e===null?"unavailable":a==="minimum"?e>=t?"satisfied":"unsatisfied":e<=t?"satisfied":"unsatisfied"}async function ee(e){if(!e)return null;try{let t=await v.readJson(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function me(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 fe(e){let t=e.dependencyAudit;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}async function te(e,t){let a=await g(e,p.doctor),r=await ee(a);if(!r)return {measuredAt:new Date().toISOString(),value:null,target:0,unit:"blocking-vulnerabilities",status:"unavailable",evidencePaths:[],message:"Fresh Doctor dependency evidence is not available."};let i=me(r).filter(c=>{if(t.kind==="workspace")return true;let g=typeof c.name=="string"?c.name:typeof c.projectName=="string"?c.projectName:"",f=typeof c.path=="string"?d.resolve(c.path):typeof c.projectPath=="string"?d.resolve(c.projectPath):"";return t.kind==="project"?g===t.projectName||f===d.resolve(t.projectPath):t.projects.some(p=>p.projectName===g||d.resolve(p.projectPath)===f)}),o=i.map(fe).filter(c=>c!==null),n=o.map(c=>c.blockingFindingCount).filter(c=>Number.isInteger(c)&&Number(c)>=0),s=i.length>0&&n.length===i.length?n.reduce((c,g)=>c+g,0):null;return {measuredAt:(()=>{let c=o.map(g=>g.generatedAt).filter(g=>typeof g=="string").sort();return c[c.length-1]??new Date().toISOString()})(),value:s,target:0,unit:"blocking-vulnerabilities",status:Z(s,0,"maximum"),evidencePaths:a?[a]:[],message:s===null?"Doctor did not publish complete dependency audit counts for the selected scope.":`${s} blocking dependency vulnerability finding(s) remain.`}}async function ae(e){let t=await a$1({startPath:e,writeReport:false}),a=t.gates.filter(i=>i.status==="pass").length,r=t.gates.length;return {measuredAt:t.generatedAt,value:a,target:r,unit:"gates",status:t.overallStatus==="pass"?"satisfied":"unsatisfied",evidencePaths:[...new Set(t.gates.map(i=>i.evidencePath).filter(i=>typeof i=="string"))],message:t.overallStatus==="pass"?"All release readiness gates pass.":`${r-a} release readiness gate(s) still require work.`}}async function L(e){let t=await d$2({projectPath:e.projectPath,target:e.target,run:e.run,runtime:e.runtime}),r=t.metrics[t.target.metric]?.percent??null;return {executionStatus:t.status,measurement:{measuredAt:t.generatedAt,value:r,target:e.target,unit:"percent",status:Z(r,e.target,"minimum"),evidencePaths:[t.artifactPaths.project],message:t.status==="failed"?"The runtime-native coverage test command failed.":r===null?"Machine-readable coverage evidence is unavailable.":`${t.target.metric} coverage is ${r}% (target ${e.target}%).`}}}async function re(e){if(e.scope.kind==="project"){if(!e.scope.projectPath)throw new Error("Coverage goal project scope does not have a project path.");return L({projectPath:e.scope.projectPath,target:e.target,run:e.run,runtime:e.runtime})}let t=await r({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=t.projects.filter(l=>U(e.workspacePath,e.scope,l)),r$1=e.runtime,i=r$1?a.filter(l=>l.runtimeCandidates.includes(r$1)):a;if(i.length===0)return {executionStatus:"unavailable",measurement:{measuredAt:new Date().toISOString(),value:null,target:e.target,unit:"percent",status:"unavailable",evidencePaths:[],message:`The selected scope does not contain the ${e.runtime} coverage runtime.`}};let o=[];for(let l of i)o.push({projectName:l.name,result:await L({projectPath:w(e.workspacePath,l),target:e.target,run:e.run,runtime:e.runtime})});let n=o.filter(l=>l.result.executionStatus==="failed"),s=o.filter(l=>l.result.measurement.status==="unavailable"),c=o.filter(l=>l.result.measurement.status==="unsatisfied"),g=o.map(l=>l.result.measurement.value).filter(l=>l!==null),f=g.length===o.length&&g.length>0?Math.min(...g):null,p=n.length>0?"failed":s.length>0?"unavailable":c.length>0?"below-target":"passed",m=o.map(l=>l.result.measurement.measuredAt).sort(),u=[...n.map(l=>`${l.projectName}: coverage command failed`),...s.map(l=>`${l.projectName}: coverage unavailable`),...c.map(l=>`${l.projectName}: ${l.result.measurement.value??"unknown"}%`)];return {executionStatus:p,measurement:{measuredAt:m[m.length-1]??new Date().toISOString(),value:f,target:e.target,unit:"percent",status:p==="passed"?"satisfied":p==="below-target"?"unsatisfied":"unavailable",evidencePaths:[...new Set(o.flatMap(l=>l.result.measurement.evidencePaths))],message:p==="passed"?`Every registered project has at least ${e.target}% test coverage.`:`Workspace coverage is not verified: ${u.join("; ")}.`}}}function he(e){let t=e.scope.kind==="project"?`project ${e.scope.projectName??"selected project"}`:e.scope.kind==="project-set"?`projects ${e.scope.projects.map(a=>a.projectName).join(", ")}`:"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 ${e.runtime?`${e.runtime} `:""}${t} test coverage to ${e.target??80}% without breaking its build.`}function ke(e,t,a){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,...a?{runtime:a}:{}}}async function ve(e){return e.kind==="release-readiness"?ae(e.workspacePath):e.kind==="dependency-security"?te(e.workspacePath,e.scope):(await re({workspacePath:e.workspacePath,scope:e.scope,target:e.target,run:false,runtime:e.runtime})).measurement}async function De(e){let t=d.resolve(e.workspacePath),a$1=Math.max(0,Math.min(100,Math.round(e.target??80))),{scope:r}=await ge(t,e.scope),i={workspacePath:d.resolve(t),kind:e.kind,scope:r,target:e.kind==="test-coverage"?a$1:null,...e.kind==="test-coverage"&&e.runtime?{runtime:e.runtime}:{},constraints:{allowBreakingChanges:e.allowBreakingChanges===true,allowForce:e.allowForce===true,requireBuild:e.requireBuild!==false,requireTests:e.requireTests!==false}},o=Y(i),n=`goal-${e.kind}-${o.slice(0,16)}`,s=G(t,n);if(await v.pathExists(s.goal)){let{goal:m,status:u}=await se(t,n);if(m.fingerprint===o)return {goal:m,status:u,resumed:u.state!=="verified"}}let c=new Date().toISOString(),g=await ve({workspacePath:t,kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),f={schemaVersion:K,id:n,fingerprint:o,createdAt:c,updatedAt:c,workspace:{name:await b(t),path:t},scope:r,kind:e.kind,summary:he({kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),constraints:i.constraints,criteria:ke(e.kind,a$1,e.runtime),baseline:g,...e.kind==="dependency-security"?{dependencySafetyBaseline:await Q(t,r)}:{},artifactPaths:{goal:s.goal,status:s.status,latestReport:s.latestReport}},p={schemaVersion:V,goalId:n,goalFingerprint:o,workspacePath:t,updatedAt:c,state:"planned",attempt:0,progress:g,checks:[],blockingReasons:[],evidencePaths:g.evidencePaths,nextActions:e.kind==="test-coverage"?["Add focused tests for the lowest-coverage source paths.","Run verified goal checks."]:e.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:s.status};return a(f,z,"Verified goal"),a(p,E,"Verified goal status"),await A(s.goal,f),await A(s.status,p),await h(t,$,p),{goal:f,status:p,resumed:false}}async function se(e,t){let a$1=G(d.resolve(e),t),r=await v.readJson(a$1.goal),i=await v.readJson(a$1.status);a(r,z,"Verified goal"),a(i,E,"Verified goal status");let o=d.resolve(e),n=d.resolve(r.artifactPaths.goal)===d.resolve(a$1.goal)&&d.resolve(r.artifactPaths.status)===d.resolve(a$1.status)&&d.resolve(r.artifactPaths.latestReport)===d.resolve(a$1.latestReport);if(r.schemaVersion!==K||i.schemaVersion!==V||r.id!==i.goalId||r.fingerprint!==i.goalFingerprint||r.fingerprint!==Y(pe(r))||d.resolve(r.workspace.path)!==o||d.resolve(i.workspacePath)!==o||!n)throw new Error(`Verified goal artifacts are inconsistent: ${t}`);return {goal:r,status:i}}function k(e){return {...e,message:e.message??`${e.label}: ${e.actual}; expected ${e.expected}.`}}async function J(e){let t=[],a=e.goal.scope.kind==="project"?[`project:${e.goal.scope.projectName}`]:e.goal.scope.kind==="project-set"?e.goal.scope.projects.map(r=>`project:${r.projectName}`):[void 0];for(let r of ["test","build"]){if(r==="test"&&e.includeTests===false)continue;if(!(r==="test"?e.goal.constraints.requireTests:e.goal.constraints.requireBuild)){t.push(k({id:r,label:`${r} validation`,status:"skipped",expected:"not required",actual:"skipped by goal contract"}));continue}if(!e.run){t.push(k({id:r,label:`${r} validation`,status:"missing",expected:"fresh passed evidence",actual:"execution disabled"}));continue}let o=false;for(let n of a){let s=await b$1({workspacePath:e.goal.workspace.path,stage:r,scope:n,parallel:false,continueOnError:false,strict:true,json:true,enforceGates:false}),c=n?.replace(/^project:/,"");if(t.push(k({id:c?`${r}:${c}`:r,label:c?`${r} validation \xB7 ${c}`:`${r} validation`,status:s.summary.exitCode===0?"passed":"failed",expected:"exit 0",actual:`exit ${s.summary.exitCode}`,evidencePath:d.join(e.goal.workspace.path,".workspai","reports","workspace-run-last.json")})),s.summary.exitCode!==0){o=true;break}}if(o)break}return t}async function Ie(e){let t=d.resolve(e.workspacePath),{goal:a$1,status:r}=await se(t,e.goalId),i=e.run!==false,o=[],n;if(i&&e.runIntelligence!==false){let u=await c({workspacePath:t,strict:true,agent:"generic"}),l=u.exitCode===0||u.exitCode===2,h=a$1.kind==="release-readiness";o.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&&l&&!h?`${u.status}; canonical evidence refreshed for goal-scoped verification`:u.status,evidencePath:d.join(t,p.intelligenceRun)}));}if(a$1.kind==="release-readiness"){n=await ae(t),o.push(k({id:"release-readiness",label:"Release readiness",status:n.status==="satisfied"?"passed":"blocked",expected:"all gates pass",actual:n.message,evidencePath:d.join(t,p.readiness)}));let u=await g(t,p.verify),l=await ee(u),h=l?.summary&&typeof l.summary=="object"&&!Array.isArray(l.summary)?String(l.summary.verdict??"missing"):"missing";o.push(k({id:"workspace-verify",label:"Workspace verification",status:h==="ready"?"passed":h==="missing"?"missing":"blocked",expected:"ready",actual:h,evidencePath:d.join(t,p.verify)}));}else if(a$1.kind==="dependency-security")n=await te(t,a$1.scope),o.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]})),o.push(a$1.constraints.allowBreakingChanges||a$1.constraints.allowForce?k({id:"change-policy",label:"Change safety policy",status:"blocked",expected:"breaking and force changes disabled",actual:`allowBreakingChanges=${a$1.constraints.allowBreakingChanges}, allowForce=${a$1.constraints.allowForce}`}):await de(a$1)),n.status==="satisfied"&&o.push(...await J({goal:a$1,run:i}));else {let u=a$1.criteria.kind==="test-coverage"?a$1.criteria.minimumPercent:a$1.baseline.target;if(u===null)throw new Error("Coverage goal does not have a valid target.");let l=await re({workspacePath:t,scope:a$1.scope,target:u,run:i,runtime:a$1.criteria.kind==="test-coverage"?a$1.criteria.runtime:void 0});n=l.measurement,o.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]})),o.push(k({id:"test",label:"Coverage test execution",status:l.executionStatus==="failed"?"failed":l.executionStatus==="unavailable"?"missing":"passed",expected:"runtime-native coverage test command completed",actual:l.executionStatus==="failed"?"coverage test command failed":l.executionStatus==="unavailable"?"coverage execution evidence unavailable":"coverage evidence produced by the test runner",evidencePath:n.evidencePaths[0]})),n.status==="satisfied"&&o.push(...await J({goal:a$1,run:i,includeTests:false}));}let s=o.filter(u=>u.status==="blocked"||u.status==="failed"||u.status==="missing").map(u=>u.message),c$1=[...new Set([...n.evidencePaths,...o.map(u=>u.evidencePath).filter(u=>typeof u=="string")])],g$1=n.status==="satisfied"&&o.every(u=>u.status==="passed"||u.status==="skipped"),f=G(t,a$1.id),p$1=g$1?[]:a$1.kind==="test-coverage"?["Inspect low-coverage files from the coverage artifact.","Add focused tests and verify again."]:a$1.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:V,goalId:a$1.id,goalFingerprint:a$1.fingerprint,workspacePath:t,updatedAt:new Date().toISOString(),state:g$1?"verified":o.some(u=>u.status==="failed")?"failed":"blocked",attempt:r.attempt+1,progress:n,checks:o,blockingReasons:s,evidencePaths:c$1,nextActions:p$1,artifactPath:f.status};return a(m,E,"Verified goal status"),await A(f.status,m),await h(t,$,m),m}export{$ as VERIFIED_GOAL_LAST_RUN_REPORT_PATH,K as VERIFIED_GOAL_SCHEMA_VERSION,V as VERIFIED_GOAL_STATUS_SCHEMA_VERSION,De as planVerifiedGoal,se as readVerifiedGoal,Ie as verifyVerifiedGoal};
1
+ import {b as b$1}from'./chunk-WC2K5QFI.js';import {c}from'./chunk-DWKCFHHL.js';import {a as a$1}from'./chunk-TGNPMOM6.js';import {d as d$2}from'./chunk-475GQJ2D.js';import {r}from'./chunk-SEZTSMRR.js';import {d as d$1}from'./chunk-ROOPODG6.js';import {a as a$2}from'./chunk-GR6442P7.js';import {h,g}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {b}from'./chunk-252EKOR6.js';import {p,q as q$1}from'./chunk-ODK4LCEL.js';import {createHash}from'crypto';import d from'path';import v from'fs-extra';var K="workspai.verified-goal.v1",V=q$1.verifiedGoalStatus,$=p.verifiedGoalStatus,z="contracts/workspace-intelligence/verified-goal.v1.json",E="contracts/workspace-intelligence/verified-goal-status.v1.json";function w(e,t){return d$1(e,t.path,{...t.absolutePath?{absolutePath:t.absolutePath}:{}})}function U(e,t,a){if(t.kind==="workspace")return true;let r=w(e,a);return t.kind==="project"?a.name===t.projectName||r===d.resolve(t.projectPath):t.projects.some(i=>i.projectName===a.name||d.resolve(i.projectPath)===r)}function C(e){return Array.isArray(e)?`[${e.map(C).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${C(a)}`).join(",")}}`:JSON.stringify(e)}function Y(e){return createHash("sha256").update(C(e)).digest("hex")}var ne=["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"],ie=new Set(ne.map(e=>e.toLowerCase())),oe=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"]),q=1e5;function ce(e){return ie.has(e.toLowerCase())||/\.(?:csproj|fsproj|vbproj)$/i.test(e)}async function le(e){let t=[e],a=[],r=0;for(;t.length>0;){let i=t.shift();if(i===void 0)break;let o=await v.readdir(i,{withFileTypes:true});if(o.sort((n,s)=>n.name.localeCompare(s.name)),r+=o.length,r>q)throw new Error(`Dependency safety baseline exceeded ${q} filesystem entries under ${e}. Narrow the project boundary before creating this goal.`);for(let n of o){let s=d.join(i,n.name);if(n.isDirectory()){!oe.has(n.name.toLowerCase())&&!a$2(n.name)&&t.push(s);continue}n.isFile()&&ce(n.name)&&a.push(s);}}return a}function ue(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 X(e){try{let t=JSON.parse(e),a={};for(let r of ["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let i=t[r];if(!(!i||typeof i!="object"||Array.isArray(i)))for(let[o,n]of Object.entries(i))typeof n=="string"&&(a[`${r}:${o}`]=n);}return a}catch{return}}async function Q(e,t){let r$1=(await r({workspacePath:e,includeAbsolutePaths:true})).projects.filter(o=>U(e,t,o)),i=new Map;for(let o of r$1){let n=w(e,o),s=await le(n);for(let c of s){let g=d.basename(c),f=await v.readFile(c,"utf8"),p=d.relative(e,c).split(d.sep).join("/");i.set(p,{path:p,ecosystem:ue(g),sha256:createHash("sha256").update(f).digest("hex"),...g==="package.json"?{dependencies:X(f)??{}}:{}});}}return {manifests:[...i.values()].sort((o,n)=>o.path.localeCompare(n.path))}}function W(e){let a=e.replace(/^(?:workspace:|npm:[^@]+@)/,"").match(/(?:^|[^\d])(\d+)(?:\.\d+)?(?:\.\d+)?/);return a?Number(a[1]):null}function x(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 de(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=[],r=await Q(e.workspace.path,e.scope),i=new Map(r.manifests.map(s=>[s.path,s])),o=new Map(t.manifests.map(s=>[s.path,s])),n=new Set;for(let s of t.manifests){let c=i.get(s.path);(!c||c.sha256!==s.sha256)&&n.add(s.path);}for(let s of r.manifests)o.has(s.path)||n.add(s.path);for(let s of r.manifests)!o.has(s.path)&&!x(s.path)&&a.push(`${s.path} was added after the safety baseline`);for(let s of t.manifests){let c=i.get(s.path);if(!c){a.push(`${s.path} was removed`);continue}if(c.sha256===s.sha256)continue;if(s.dependencies){let p=await v.readFile(d.join(e.workspace.path,s.path),"utf8"),m=X(p);if(!m){a.push(`${s.path} is not valid dependency JSON`);continue}for(let[u,l]of Object.entries(s.dependencies)){let h=m[u];if(!h){a.push(`${u.replace(/^[^:]+:/,"")} was removed`);continue}if(h===l)continue;let R=W(l),N=W(h);(R===null||N===null||R!==N||/(?:latest|\*)/i.test(h))&&a.push(`${u.replace(/^[^:]+:/,"")} changed outside its proven major range (${l} \u2192 ${h})`);}continue}if(x(s.path))continue;let g=d.posix.dirname(s.path);[...i.values()].some(p=>{let m=d.posix.dirname(p.path);return p.ecosystem===s.ecosystem&&(m===g||g.startsWith(`${m}/`))&&x(p.path)&&n.has(p.path)})||a.push(`${s.path} changed without a matching reconciled ${s.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 G(e,t){if(!/^[a-z0-9][a-z0-9._-]{7,95}$/i.test(t))throw new Error(`Invalid verified goal id: ${t}`);let a=d.join(e,".workspai","goals",t);return {directory:a,goal:d.join(a,"goal.json"),status:d.join(a,"status.json"),latestReport:d.join(e,$)}}function pe(e){return {workspacePath:d.resolve(e.workspace.path),kind:e.kind,scope:e.scope,target:e.criteria.kind==="test-coverage"?e.criteria.minimumPercent:null,...e.criteria.kind==="test-coverage"&&e.criteria.runtime?{runtime:e.criteria.runtime}:{},constraints:e.constraints}}async function A(e,t){await v.ensureDir(d.dirname(e));let a=`${e}.${process.pid}.${Date.now()}.tmp`;await v.writeJson(a,t,{spaces:2}),await v.rename(a,e);}async function ge(e,t){let a=t?.trim();if(!a||a==="workspace")return {scope:{kind:"workspace"}};let r$1=a.startsWith("projects:")?"projects:":a.startsWith("project:")&&a.slice(8).includes(",")?"project:":null,i=a.startsWith("project:")?a.slice(8).trim():r$1?a.slice(r$1.length).trim():a;if(!i)throw new Error("Project goal scope must name a project.");let o=await r({workspacePath:e,includeAbsolutePaths:true});if(r$1){let g=i.split(",").map(p=>p.trim()).filter(Boolean);if(g.length<2||new Set(g).size!==g.length)throw new Error("A project-set goal scope must name at least two unique projects.");return {scope:{kind:"project-set",projects:g.map(p=>{let m=o.projects.filter(u=>u.name===p||u.path===p);if(m.length!==1)throw new Error(m.length===0?`Project goal scope was not found: ${p}`:`Project goal scope is ambiguous: ${p}`);return m[0]}).map(p=>({projectName:p.name,projectPath:w(e,p)})).sort((p,m)=>p.projectName.localeCompare(m.projectName))}}}let n=o.projects.filter(g=>{let f=w(e,g);return g.name===i||g.path===i||f===d.resolve(i)});if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found: ${i}`:`Project goal scope is ambiguous: ${i}`);let s=n[0],c=w(e,s);return {project:s,scope:{kind:"project",projectName:s.name,projectPath:c}}}function Z(e,t,a){return e===null?"unavailable":a==="minimum"?e>=t?"satisfied":"unsatisfied":e<=t?"satisfied":"unsatisfied"}async function ee(e){if(!e)return null;try{let t=await v.readJson(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function me(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 fe(e){let t=e.dependencyAudit;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}async function te(e,t){let a=await g(e,p.doctor),r=await ee(a);if(!r)return {measuredAt:new Date().toISOString(),value:null,target:0,unit:"blocking-vulnerabilities",status:"unavailable",evidencePaths:[],message:"Fresh Doctor dependency evidence is not available."};let i=me(r).filter(c=>{if(t.kind==="workspace")return true;let g=typeof c.name=="string"?c.name:typeof c.projectName=="string"?c.projectName:"",f=typeof c.path=="string"?d.resolve(c.path):typeof c.projectPath=="string"?d.resolve(c.projectPath):"";return t.kind==="project"?g===t.projectName||f===d.resolve(t.projectPath):t.projects.some(p=>p.projectName===g||d.resolve(p.projectPath)===f)}),o=i.map(fe).filter(c=>c!==null),n=o.map(c=>c.blockingFindingCount).filter(c=>Number.isInteger(c)&&Number(c)>=0),s=i.length>0&&n.length===i.length?n.reduce((c,g)=>c+g,0):null;return {measuredAt:(()=>{let c=o.map(g=>g.generatedAt).filter(g=>typeof g=="string").sort();return c[c.length-1]??new Date().toISOString()})(),value:s,target:0,unit:"blocking-vulnerabilities",status:Z(s,0,"maximum"),evidencePaths:a?[a]:[],message:s===null?"Doctor did not publish complete dependency audit counts for the selected scope.":`${s} blocking dependency vulnerability finding(s) remain.`}}async function ae(e){let t=await a$1({startPath:e,writeReport:false}),a=t.gates.filter(i=>i.status==="pass").length,r=t.gates.length;return {measuredAt:t.generatedAt,value:a,target:r,unit:"gates",status:t.overallStatus==="pass"?"satisfied":"unsatisfied",evidencePaths:[...new Set(t.gates.map(i=>i.evidencePath).filter(i=>typeof i=="string"))],message:t.overallStatus==="pass"?"All release readiness gates pass.":`${r-a} release readiness gate(s) still require work.`}}async function L(e){let t=await d$2({projectPath:e.projectPath,target:e.target,run:e.run,runtime:e.runtime}),r=t.metrics[t.target.metric]?.percent??null;return {executionStatus:t.status,measurement:{measuredAt:t.generatedAt,value:r,target:e.target,unit:"percent",status:Z(r,e.target,"minimum"),evidencePaths:[t.artifactPaths.project],message:t.status==="failed"?"The runtime-native coverage test command failed.":r===null?"Machine-readable coverage evidence is unavailable.":`${t.target.metric} coverage is ${r}% (target ${e.target}%).`}}}async function re(e){if(e.scope.kind==="project"){if(!e.scope.projectPath)throw new Error("Coverage goal project scope does not have a project path.");return L({projectPath:e.scope.projectPath,target:e.target,run:e.run,runtime:e.runtime})}let t=await r({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=t.projects.filter(l=>U(e.workspacePath,e.scope,l)),r$1=e.runtime,i=r$1?a.filter(l=>l.runtimeCandidates.includes(r$1)):a;if(i.length===0)return {executionStatus:"unavailable",measurement:{measuredAt:new Date().toISOString(),value:null,target:e.target,unit:"percent",status:"unavailable",evidencePaths:[],message:`The selected scope does not contain the ${e.runtime} coverage runtime.`}};let o=[];for(let l of i)o.push({projectName:l.name,result:await L({projectPath:w(e.workspacePath,l),target:e.target,run:e.run,runtime:e.runtime})});let n=o.filter(l=>l.result.executionStatus==="failed"),s=o.filter(l=>l.result.measurement.status==="unavailable"),c=o.filter(l=>l.result.measurement.status==="unsatisfied"),g=o.map(l=>l.result.measurement.value).filter(l=>l!==null),f=g.length===o.length&&g.length>0?Math.min(...g):null,p=n.length>0?"failed":s.length>0?"unavailable":c.length>0?"below-target":"passed",m=o.map(l=>l.result.measurement.measuredAt).sort(),u=[...n.map(l=>`${l.projectName}: coverage command failed`),...s.map(l=>`${l.projectName}: coverage unavailable`),...c.map(l=>`${l.projectName}: ${l.result.measurement.value??"unknown"}%`)];return {executionStatus:p,measurement:{measuredAt:m[m.length-1]??new Date().toISOString(),value:f,target:e.target,unit:"percent",status:p==="passed"?"satisfied":p==="below-target"?"unsatisfied":"unavailable",evidencePaths:[...new Set(o.flatMap(l=>l.result.measurement.evidencePaths))],message:p==="passed"?`Every registered project has at least ${e.target}% test coverage.`:`Workspace coverage is not verified: ${u.join("; ")}.`}}}function he(e){let t=e.scope.kind==="project"?`project ${e.scope.projectName??"selected project"}`:e.scope.kind==="project-set"?`projects ${e.scope.projects.map(a=>a.projectName).join(", ")}`:"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 ${e.runtime?`${e.runtime} `:""}${t} test coverage to ${e.target??80}% without breaking its build.`}function ke(e,t,a){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,...a?{runtime:a}:{}}}async function ve(e){return e.kind==="release-readiness"?ae(e.workspacePath):e.kind==="dependency-security"?te(e.workspacePath,e.scope):(await re({workspacePath:e.workspacePath,scope:e.scope,target:e.target,run:false,runtime:e.runtime})).measurement}async function De(e){let t=d.resolve(e.workspacePath),a$1=Math.max(0,Math.min(100,Math.round(e.target??80))),{scope:r}=await ge(t,e.scope),i={workspacePath:d.resolve(t),kind:e.kind,scope:r,target:e.kind==="test-coverage"?a$1:null,...e.kind==="test-coverage"&&e.runtime?{runtime:e.runtime}:{},constraints:{allowBreakingChanges:e.allowBreakingChanges===true,allowForce:e.allowForce===true,requireBuild:e.requireBuild!==false,requireTests:e.requireTests!==false}},o=Y(i),n=`goal-${e.kind}-${o.slice(0,16)}`,s=G(t,n);if(await v.pathExists(s.goal)){let{goal:m,status:u}=await se(t,n);if(m.fingerprint===o)return {goal:m,status:u,resumed:u.state!=="verified"}}let c=new Date().toISOString(),g=await ve({workspacePath:t,kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),f={schemaVersion:K,id:n,fingerprint:o,createdAt:c,updatedAt:c,workspace:{name:await b(t),path:t},scope:r,kind:e.kind,summary:he({kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),constraints:i.constraints,criteria:ke(e.kind,a$1,e.runtime),baseline:g,...e.kind==="dependency-security"?{dependencySafetyBaseline:await Q(t,r)}:{},artifactPaths:{goal:s.goal,status:s.status,latestReport:s.latestReport}},p={schemaVersion:V,goalId:n,goalFingerprint:o,workspacePath:t,updatedAt:c,state:"planned",attempt:0,progress:g,checks:[],blockingReasons:[],evidencePaths:g.evidencePaths,nextActions:e.kind==="test-coverage"?["Add focused tests for the lowest-coverage source paths.","Run verified goal checks."]:e.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:s.status};return a(f,z,"Verified goal"),a(p,E,"Verified goal status"),await A(s.goal,f),await A(s.status,p),await h(t,$,p),{goal:f,status:p,resumed:false}}async function se(e,t){let a$1=G(d.resolve(e),t),r=await v.readJson(a$1.goal),i=await v.readJson(a$1.status);a(r,z,"Verified goal"),a(i,E,"Verified goal status");let o=d.resolve(e),n=d.resolve(r.artifactPaths.goal)===d.resolve(a$1.goal)&&d.resolve(r.artifactPaths.status)===d.resolve(a$1.status)&&d.resolve(r.artifactPaths.latestReport)===d.resolve(a$1.latestReport);if(r.schemaVersion!==K||i.schemaVersion!==V||r.id!==i.goalId||r.fingerprint!==i.goalFingerprint||r.fingerprint!==Y(pe(r))||d.resolve(r.workspace.path)!==o||d.resolve(i.workspacePath)!==o||!n)throw new Error(`Verified goal artifacts are inconsistent: ${t}`);return {goal:r,status:i}}function k(e){return {...e,message:e.message??`${e.label}: ${e.actual}; expected ${e.expected}.`}}async function J(e){let t=[],a=e.goal.scope.kind==="project"?[`project:${e.goal.scope.projectName}`]:e.goal.scope.kind==="project-set"?e.goal.scope.projects.map(r=>`project:${r.projectName}`):[void 0];for(let r of ["test","build"]){if(r==="test"&&e.includeTests===false)continue;if(!(r==="test"?e.goal.constraints.requireTests:e.goal.constraints.requireBuild)){t.push(k({id:r,label:`${r} validation`,status:"skipped",expected:"not required",actual:"skipped by goal contract"}));continue}if(!e.run){t.push(k({id:r,label:`${r} validation`,status:"missing",expected:"fresh passed evidence",actual:"execution disabled"}));continue}let o=false;for(let n of a){let s=await b$1({workspacePath:e.goal.workspace.path,stage:r,scope:n,parallel:false,continueOnError:false,strict:true,json:true,enforceGates:false}),c=n?.replace(/^project:/,"");if(t.push(k({id:c?`${r}:${c}`:r,label:c?`${r} validation \xB7 ${c}`:`${r} validation`,status:s.summary.exitCode===0?"passed":"failed",expected:"exit 0",actual:`exit ${s.summary.exitCode}`,evidencePath:d.join(e.goal.workspace.path,".workspai","reports","workspace-run-last.json")})),s.summary.exitCode!==0){o=true;break}}if(o)break}return t}async function Ie(e){let t=d.resolve(e.workspacePath),{goal:a$1,status:r}=await se(t,e.goalId),i=e.run!==false,o=[],n;if(i&&e.runIntelligence!==false){let u=await c({workspacePath:t,strict:true,agent:"generic"}),l=u.exitCode===0||u.exitCode===2,h=a$1.kind==="release-readiness";o.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&&l&&!h?`${u.status}; canonical evidence refreshed for goal-scoped verification`:u.status,evidencePath:d.join(t,p.intelligenceRun)}));}if(a$1.kind==="release-readiness"){n=await ae(t),o.push(k({id:"release-readiness",label:"Release readiness",status:n.status==="satisfied"?"passed":"blocked",expected:"all gates pass",actual:n.message,evidencePath:d.join(t,p.readiness)}));let u=await g(t,p.verify),l=await ee(u),h=l?.summary&&typeof l.summary=="object"&&!Array.isArray(l.summary)?String(l.summary.verdict??"missing"):"missing";o.push(k({id:"workspace-verify",label:"Workspace verification",status:h==="ready"?"passed":h==="missing"?"missing":"blocked",expected:"ready",actual:h,evidencePath:d.join(t,p.verify)}));}else if(a$1.kind==="dependency-security")n=await te(t,a$1.scope),o.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]})),o.push(a$1.constraints.allowBreakingChanges||a$1.constraints.allowForce?k({id:"change-policy",label:"Change safety policy",status:"blocked",expected:"breaking and force changes disabled",actual:`allowBreakingChanges=${a$1.constraints.allowBreakingChanges}, allowForce=${a$1.constraints.allowForce}`}):await de(a$1)),n.status==="satisfied"&&o.push(...await J({goal:a$1,run:i}));else {let u=a$1.criteria.kind==="test-coverage"?a$1.criteria.minimumPercent:a$1.baseline.target;if(u===null)throw new Error("Coverage goal does not have a valid target.");let l=await re({workspacePath:t,scope:a$1.scope,target:u,run:i,runtime:a$1.criteria.kind==="test-coverage"?a$1.criteria.runtime:void 0});n=l.measurement,o.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]})),o.push(k({id:"test",label:"Coverage test execution",status:l.executionStatus==="failed"?"failed":l.executionStatus==="unavailable"?"missing":"passed",expected:"runtime-native coverage test command completed",actual:l.executionStatus==="failed"?"coverage test command failed":l.executionStatus==="unavailable"?"coverage execution evidence unavailable":"coverage evidence produced by the test runner",evidencePath:n.evidencePaths[0]})),n.status==="satisfied"&&o.push(...await J({goal:a$1,run:i,includeTests:false}));}let s=o.filter(u=>u.status==="blocked"||u.status==="failed"||u.status==="missing").map(u=>u.message),c$1=[...new Set([...n.evidencePaths,...o.map(u=>u.evidencePath).filter(u=>typeof u=="string")])],g$1=n.status==="satisfied"&&o.every(u=>u.status==="passed"||u.status==="skipped"),f=G(t,a$1.id),p$1=g$1?[]:a$1.kind==="test-coverage"?["Inspect low-coverage files from the coverage artifact.","Add focused tests and verify again."]:a$1.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:V,goalId:a$1.id,goalFingerprint:a$1.fingerprint,workspacePath:t,updatedAt:new Date().toISOString(),state:g$1?"verified":o.some(u=>u.status==="failed")?"failed":"blocked",attempt:r.attempt+1,progress:n,checks:o,blockingReasons:s,evidencePaths:c$1,nextActions:p$1,artifactPath:f.status};return a(m,E,"Verified goal status"),await A(f.status,m),await h(t,$,m),m}export{$ as VERIFIED_GOAL_LAST_RUN_REPORT_PATH,K as VERIFIED_GOAL_SCHEMA_VERSION,V as VERIFIED_GOAL_STATUS_SCHEMA_VERSION,De as planVerifiedGoal,se as readVerifiedGoal,Ie 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-KW35SWG6.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-GLBFY7AB.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-R3Z4LY3O.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,L as LEGACY_COPILOT_GROUNDING_SKILL_PATH,x as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,N as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,m as LEGACY_CURSOR_GROUNDING_RULE_PATH,T as LEGACY_MCP_DESIGN_REPORT_PATH,V as LEGACY_VSCODE_AGENT_HOOKS_PATH,K as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,w as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,M as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,j as WORKSPAI_CURSOR_DIAGNOSE_RULE_PATH,i as WORKSPAI_CURSOR_EVIDENCE_RULE_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,l as WORKSPAI_CURSOR_RELEASE_RULE_PATH,k as WORKSPAI_CURSOR_REPAIR_RULE_PATH,S as WORKSPAI_MCP_DESIGN_REPORT_PATH,U as WORKSPAI_VSCODE_AGENT_HOOKS_PATH,n as WORKSPAI_WINDSURF_RULES_PATH}from'./chunk-QYEQVNBF.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-J2MPBSQJ.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,L as LEGACY_COPILOT_GROUNDING_SKILL_PATH,x as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,N as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,m as LEGACY_CURSOR_GROUNDING_RULE_PATH,T as LEGACY_MCP_DESIGN_REPORT_PATH,V as LEGACY_VSCODE_AGENT_HOOKS_PATH,K as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,w as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,M as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,j as WORKSPAI_CURSOR_DIAGNOSE_RULE_PATH,i as WORKSPAI_CURSOR_EVIDENCE_RULE_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,l as WORKSPAI_CURSOR_RELEASE_RULE_PATH,k as WORKSPAI_CURSOR_REPAIR_RULE_PATH,S as WORKSPAI_MCP_DESIGN_REPORT_PATH,U as WORKSPAI_VSCODE_AGENT_HOOKS_PATH,n as WORKSPAI_WINDSURF_RULES_PATH}from'./chunk-QYEQVNBF.js';
@@ -1 +1 @@
1
- export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-FD2ZGGCQ.js';
1
+ export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-JVZA35OL.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-YLLCZMKP.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-IHWS3ALP.js';
@@ -1 +1 @@
1
- export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-FBF767WP.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-QYEQVNBF.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-BZLDCASY.js';
1
+ export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-47UR6ZH4.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-QYEQVNBF.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-3EPR3D5Q.js';
@@ -1 +1 @@
1
- import {c as c$1}from'./chunk-UOTOJJI4.js';import {a}from'./chunk-252EKOR6.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 c$1(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-ZNTXSUI4.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {c as c$1}from'./chunk-V6HVDVKJ.js';import {a}from'./chunk-252EKOR6.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 c$1(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-M4WMFDQ4.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -1 +1 @@
1
- import {b}from'./chunk-KO4DM2AV.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c}from'./chunk-EWZZUQBR.js';import g from'crypto';import H from'path';var M="workspace-graph-stream.v1";function w(o){return c({...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(f(t))!==c(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(i)!==c(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){b(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$1=t.source.hash,y=w(t);this.revision+=1,this.generation+=1;let c$1=u(t.entities,e.entities),h=u(t.relations,e.relations),l=u(t.proofs,e.proofs),G=c(t.quality)!==c(e.quality),A=I({...r,generation:this.generation,type:"graph.delta",baseRevision:W,baseModelHash:b$1,baseGraphHash:y,revision:this.revision,payload:{entitiesAdded:c$1.added,entitiesUpdated:c$1.updated,entitiesRemoved:c$1.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 {b}from'./chunk-HRVHQBTA.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c}from'./chunk-EWZZUQBR.js';import g from'crypto';import H from'path';var M="workspace-graph-stream.v1";function w(o){return c({...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(f(t))!==c(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(i)!==c(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){b(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$1=t.source.hash,y=w(t);this.revision+=1,this.generation+=1;let c$1=u(t.entities,e.entities),h=u(t.relations,e.relations),l=u(t.proofs,e.proofs),G=c(t.quality)!==c(e.quality),A=I({...r,generation:this.generation,type:"graph.delta",baseRevision:W,baseModelHash:b$1,baseGraphHash:y,revision:this.revision,payload:{entitiesAdded:c$1.added,entitiesUpdated:c$1.updated,entitiesRemoved:c$1.removed,relationsAdded:h.added,relationsUpdated:h.updated,relationsRemoved:h.removed,proofsAdded:l.added,proofsUpdated:l.updated,proofsRemoved:l.removed,providersUpdated:E(t.providers,e.providers),quality:G?e.quality:null,diagnostics:e.diagnostics}});return this.previous=e,A}};export{M as WORKSPACE_GRAPH_STREAM_SCHEMA_VERSION,R as WorkspaceGraphStreamPublisher};
@@ -1 +1 @@
1
- export{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-BZLDCASY.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-3EPR3D5Q.js';export{d as hashWorkspaceModel}from'./chunk-EWZZUQBR.js';
@@ -1 +1 @@
1
- export{a as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,b as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,c as runWorkspaceIntelligenceChain}from'./chunk-4MXKXHLW.js';
1
+ export{a as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,b as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,c as runWorkspaceIntelligenceChain}from'./chunk-DWKCFHHL.js';
@@ -1 +1 @@
1
- export{a as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,b as assertWorkspaceKnowledgeGraphSourceBinding,e as buildWorkspaceKnowledgeGraph,c as computeWorkspaceKnowledgeGraphInputFingerprint,f as knowledgeEntityId,d as workspaceKnowledgeGraphInputsMatchLiveState}from'./chunk-KO4DM2AV.js';
1
+ export{a as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,b as assertWorkspaceKnowledgeGraphSourceBinding,e as buildWorkspaceKnowledgeGraph,c as computeWorkspaceKnowledgeGraphInputFingerprint,f as knowledgeEntityId,d as workspaceKnowledgeGraphInputsMatchLiveState}from'./chunk-HRVHQBTA.js';
@@ -0,0 +1 @@
1
+ export{a as readWorkspaceKnowledgeGraphSnapshot}from'./chunk-4CXV3PPV.js';
@@ -1,3 +1,3 @@
1
- import {o,l,m}from'./chunk-RKFTUIZ4.js';import {e as e$1,d,g as g$1,f as f$1}from'./chunk-5HNQIMGW.js';import {b}from'./chunk-FBF767WP.js';import {c as c$1,e}from'./chunk-IVYPC36J.js';import {c as c$2,b as b$3}from'./chunk-QYEQVNBF.js';import {b as b$2}from'./chunk-FD2ZGGCQ.js';import {d as d$1}from'./chunk-PUH3TSPC.js';import {b as b$1}from'./chunk-KO4DM2AV.js';import {m as m$1}from'./chunk-VODNLROY.js';import {h}from'./chunk-YLLCZMKP.js';import {g as g$2}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {w as w$1}from'./chunk-VQZ5PI5J.js';import {p,r}from'./chunk-ODK4LCEL.js';import y from'path';import z from'readline';import w from'fs-extra';var B=p.agentIndex,X=new Map(Object.keys(p).flatMap(e=>{let t=r[e];return t?[[p[e],t]]:[]}));function Y(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 Z={type:"object",properties:{data:true,error:{type:"object",properties:{code:{type:"string"},message:{type:"string"}},required:["code","message"],additionalProperties:false}},oneOf:[{required:["data"]},{required:["error"]}],additionalProperties:false},Q={readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},V=[{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"},projectId:{type:"string",description:"Optional canonical project id 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>"}}}},{name:"listProofCarryingChanges",description:"List proof-carrying changes with lifecycle, assurance, blockers, and integrity state",inputSchema:{type:"object",properties:{}}},{name:"getProofCarryingChange",description:"Read the ledger-derived state and architecture-aware assurance capsule for one change",inputSchema:{type:"object",properties:{changeId:{type:"string",description:"Canonical proof-carrying change id"}},required:["changeId"]}},{name:"validateProofCarryingChange",description:"Replay and validate one proof-carrying capsule and all hash-bound evidence references",inputSchema:{type:"object",properties:{changeId:{type:"string",description:"Canonical proof-carrying change id"}},required:["changeId"]}}].map(e=>({...e,title:e.name.replace(/([a-z])([A-Z])/g,"$1 $2"),inputSchema:{...e.inputSchema,additionalProperties:false},outputSchema:Z,annotations:Q}));function ee(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!y.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function c(e,t){if(!ee(t))throw new Error(`Unsafe artifact path: ${t}`);let n=await g$2(e,t)??y.join(e,t);if(!await w.pathExists(n))return null;let r=await w.readJson(n),o=w$1(t),p$1=X.get(o);if(p$1&&a(r,p$1,`MCP artifact ${o}`),o===p.knowledgeGraph){let a=y.join(e,m$1);if(!await w.pathExists(a))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let u=await w.readJson(a);b$1(r,u);}return r}async function te(e$1){let t=[],n=new Set,o=((await c(e$1,d$1))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$1,reasons:o});for(let i of o)n.add(i);}let p=await c(e$1,c$2);if(e(p)){let i=(p.blockingReasons??[]).filter(l=>typeof l=="string"&&l.trim().length>0);if(i.length>0){t.push({artifact:c$2,reasons:i});for(let l of i)n.add(l);}}let a=await c(e$1,h),u=(a?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(u.length>0||String(a?.status??"").toLowerCase()==="failed"){let i=u.length>0?u:["Workspace contract verification failed"];t.push({artifact:h,reasons:i});for(let l of i)n.add(l);}return {blockingReasons:[...n],sources:t}}async function D(e$2,t,n){switch(t){case "getWorkspaceModel":return c(e$2,m$1);case "getWorkspaceKnowledgeGraph":return c(e$2,p.knowledgeGraph);case "getWorkspaceEvaluation":return c(e$2,n.live===true?p.evaluationLive:p.evaluationLastRun);case "queryWorkspaceEntities":{let r=await c(e$2,p.knowledgeGraph);if(!r)return null;let o=String(n.kind??"").trim();return {schemaVersion:r.schemaVersion,generatedAt:r.generatedAt,entities:f$1(r,o||void 0)}}case "searchWorkspaceGraph":{let r=await c(e$2,p.knowledgeGraph);if(!r)return null;let o=typeof n.limit=="number"?n.limit:Number(n.limit??12);return g$1(r,{query:String(n.query??""),...typeof n.kind=="string"&&n.kind.trim()?{kind:n.kind.trim()}:{},...typeof n.projectId=="string"&&n.projectId.trim()?{projectId:n.projectId.trim()}:{},limit:Number.isFinite(o)?o:12,projection:"agent"})}case "getWorkspaceGraphEvidence":{let r=await c(e$2,p.knowledgeGraph);return r?d(r,String(n.query??"")):null}case "findWorkspaceGraphPath":{let r=await c(e$2,p.knowledgeGraph);return r?e$1(r,String(n.from??""),String(n.to??"")):null}case "getEvidenceIndex":return c(e$2,B);case "getBlockers":return te(e$2);case "getSafeCommands":return {safeCommands:(await c(e$2,b$2))?.safeCommands??[]};case "getProjectContext":{let r=await c(e$2,b$2);if(!r)return null;let o=String(n.project??"").trim(),p=r.scope?.activeProject??void 0,a=o||p,u=Array.isArray(r.projects)?r.projects:[],i=a&&u.find(l=>typeof l.name=="string"&&l.name.toLowerCase()===a.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:i??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(n.relativePath??"").trim();return c(e$2,r)}case "listOperationalSkills":return c(e$2,b$3);case "getWorkspaceExplain":{let r=String(n.target??"release-blocked").trim(),o=c$1(r);if(!o)throw new Error(`Invalid explain target: ${r}`);let p=await c(e$2,c$2);return e(p)&&Y(p.target,o)?p:b({workspacePath:e$2,target:o})}case "listProofCarryingChanges":return m({workspacePath:e$2});case "getProofCarryingChange":return l({workspacePath:e$2,changeId:String(n.changeId??"").trim(),operation:"status"});case "validateProofCarryingChange":return o({workspacePath:e$2,changeId:String(n.changeId??"").trim()});default:throw new Error(`Unknown tool: ${t}`)}}var J="2026-07-28",F=["2024-11-05","2025-03-26","2025-06-18","2025-11-25"],U={name:"workspai-workspace-mcp",version:"1.0.0"};function ne(e){let t=e.params?._meta;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t["io.modelcontextprotocol/protocolVersion"];return typeof n=="string"?n:void 0}function re(e,t){return !t||!e||typeof e!="object"||Array.isArray(e)?e:{...e,_meta:{...e._meta??{},"io.modelcontextprotocol/serverInfo":U}}}function g(e,t,n=false){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:re(t,n)})}
1
+ import {o,l,m}from'./chunk-3EMAC3MF.js';import {e as e$1,d,g as g$1,f as f$1}from'./chunk-5HNQIMGW.js';import {b}from'./chunk-47UR6ZH4.js';import {c as c$1,e}from'./chunk-IVYPC36J.js';import {c as c$2,b as b$3}from'./chunk-QYEQVNBF.js';import {b as b$2}from'./chunk-JVZA35OL.js';import {d as d$1}from'./chunk-3SQIV3F4.js';import {b as b$1}from'./chunk-HRVHQBTA.js';import {m as m$1}from'./chunk-SEZTSMRR.js';import {h}from'./chunk-IHWS3ALP.js';import {g as g$2}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {w as w$1}from'./chunk-VQZ5PI5J.js';import {p,r}from'./chunk-ODK4LCEL.js';import y from'path';import z from'readline';import w from'fs-extra';var B=p.agentIndex,X=new Map(Object.keys(p).flatMap(e=>{let t=r[e];return t?[[p[e],t]]:[]}));function Y(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 Z={type:"object",properties:{data:true,error:{type:"object",properties:{code:{type:"string"},message:{type:"string"}},required:["code","message"],additionalProperties:false}},oneOf:[{required:["data"]},{required:["error"]}],additionalProperties:false},Q={readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},V=[{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"},projectId:{type:"string",description:"Optional canonical project id 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>"}}}},{name:"listProofCarryingChanges",description:"List proof-carrying changes with lifecycle, assurance, blockers, and integrity state",inputSchema:{type:"object",properties:{}}},{name:"getProofCarryingChange",description:"Read the ledger-derived state and architecture-aware assurance capsule for one change",inputSchema:{type:"object",properties:{changeId:{type:"string",description:"Canonical proof-carrying change id"}},required:["changeId"]}},{name:"validateProofCarryingChange",description:"Replay and validate one proof-carrying capsule and all hash-bound evidence references",inputSchema:{type:"object",properties:{changeId:{type:"string",description:"Canonical proof-carrying change id"}},required:["changeId"]}}].map(e=>({...e,title:e.name.replace(/([a-z])([A-Z])/g,"$1 $2"),inputSchema:{...e.inputSchema,additionalProperties:false},outputSchema:Z,annotations:Q}));function ee(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!y.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function c(e,t){if(!ee(t))throw new Error(`Unsafe artifact path: ${t}`);let n=await g$2(e,t)??y.join(e,t);if(!await w.pathExists(n))return null;let r=await w.readJson(n),o=w$1(t),p$1=X.get(o);if(p$1&&a(r,p$1,`MCP artifact ${o}`),o===p.knowledgeGraph){let a=y.join(e,m$1);if(!await w.pathExists(a))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let u=await w.readJson(a);b$1(r,u);}return r}async function te(e$1){let t=[],n=new Set,o=((await c(e$1,d$1))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$1,reasons:o});for(let i of o)n.add(i);}let p=await c(e$1,c$2);if(e(p)){let i=(p.blockingReasons??[]).filter(l=>typeof l=="string"&&l.trim().length>0);if(i.length>0){t.push({artifact:c$2,reasons:i});for(let l of i)n.add(l);}}let a=await c(e$1,h),u=(a?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(u.length>0||String(a?.status??"").toLowerCase()==="failed"){let i=u.length>0?u:["Workspace contract verification failed"];t.push({artifact:h,reasons:i});for(let l of i)n.add(l);}return {blockingReasons:[...n],sources:t}}async function D(e$2,t,n){switch(t){case "getWorkspaceModel":return c(e$2,m$1);case "getWorkspaceKnowledgeGraph":return c(e$2,p.knowledgeGraph);case "getWorkspaceEvaluation":return c(e$2,n.live===true?p.evaluationLive:p.evaluationLastRun);case "queryWorkspaceEntities":{let r=await c(e$2,p.knowledgeGraph);if(!r)return null;let o=String(n.kind??"").trim();return {schemaVersion:r.schemaVersion,generatedAt:r.generatedAt,entities:f$1(r,o||void 0)}}case "searchWorkspaceGraph":{let r=await c(e$2,p.knowledgeGraph);if(!r)return null;let o=typeof n.limit=="number"?n.limit:Number(n.limit??12);return g$1(r,{query:String(n.query??""),...typeof n.kind=="string"&&n.kind.trim()?{kind:n.kind.trim()}:{},...typeof n.projectId=="string"&&n.projectId.trim()?{projectId:n.projectId.trim()}:{},limit:Number.isFinite(o)?o:12,projection:"agent"})}case "getWorkspaceGraphEvidence":{let r=await c(e$2,p.knowledgeGraph);return r?d(r,String(n.query??"")):null}case "findWorkspaceGraphPath":{let r=await c(e$2,p.knowledgeGraph);return r?e$1(r,String(n.from??""),String(n.to??"")):null}case "getEvidenceIndex":return c(e$2,B);case "getBlockers":return te(e$2);case "getSafeCommands":return {safeCommands:(await c(e$2,b$2))?.safeCommands??[]};case "getProjectContext":{let r=await c(e$2,b$2);if(!r)return null;let o=String(n.project??"").trim(),p=r.scope?.activeProject??void 0,a=o||p,u=Array.isArray(r.projects)?r.projects:[],i=a&&u.find(l=>typeof l.name=="string"&&l.name.toLowerCase()===a.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:i??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(n.relativePath??"").trim();return c(e$2,r)}case "listOperationalSkills":return c(e$2,b$3);case "getWorkspaceExplain":{let r=String(n.target??"release-blocked").trim(),o=c$1(r);if(!o)throw new Error(`Invalid explain target: ${r}`);let p=await c(e$2,c$2);return e(p)&&Y(p.target,o)?p:b({workspacePath:e$2,target:o})}case "listProofCarryingChanges":return m({workspacePath:e$2});case "getProofCarryingChange":return l({workspacePath:e$2,changeId:String(n.changeId??"").trim(),operation:"status"});case "validateProofCarryingChange":return o({workspacePath:e$2,changeId:String(n.changeId??"").trim()});default:throw new Error(`Unknown tool: ${t}`)}}var J="2026-07-28",F=["2024-11-05","2025-03-26","2025-06-18","2025-11-25"],U={name:"workspai-workspace-mcp",version:"1.0.0"};function ne(e){let t=e.params?._meta;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t["io.modelcontextprotocol/protocolVersion"];return typeof n=="string"?n:void 0}function re(e,t){return !t||!e||typeof e!="object"||Array.isArray(e)?e:{...e,_meta:{...e._meta??{},"io.modelcontextprotocol/serverInfo":U}}}function g(e,t,n=false){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:re(t,n)})}
2
2
  `);}function f(e,t,n=-32e3){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:n,message:t}})}
3
3
  `);}function oe(e){let t={data:e};return {content:[{type:"text",text:JSON.stringify(t,null,2)}],structuredContent:t,isError:false}}function A(e,t){return {content:[{type:"text",text:t}],structuredContent:{error:{code:e,message:t}},isError:true}}function ie(e,t){for(let n of e.inputSchema.required??[])if(!(n in t))return `Missing required argument: ${n}`;for(let[n,r]of Object.entries(t)){let o=e.inputSchema.properties[n];if(!o)return `Unknown argument for ${e.name}: ${n}`;if(o.type==="string"&&typeof r!="string")return `Argument ${n} must be a string`;if(o.type==="boolean"&&typeof r!="boolean")return `Argument ${n} must be a boolean`;if(o.type==="integer"&&(!Number.isInteger(r)||typeof r!="number"))return `Argument ${n} must be an integer`;if(typeof r=="number"){if(typeof o.minimum=="number"&&r<o.minimum)return `Argument ${n} must be at least ${o.minimum}`;if(typeof o.maximum=="number"&&r>o.maximum)return `Argument ${n} must be at most ${o.maximum}`}}return null}async function Ae(e){let t=y.resolve(e.workspacePath),n=z.createInterface({input:process.stdin,terminal:false});for await(let r of n){let o=r.trim();if(!o)continue;let p;try{p=JSON.parse(o);}catch{f(null,"Invalid JSON-RPC request",-32700);continue}let{id:a,method:u,params:i}=p,l=ne(p)===J;try{if(u==="server/discover"){g(a,{resultType:"complete",supportedVersions:[J],capabilities:{tools:{listChanged:false}},instructions:"Use bounded Workspai graph search before requesting complete workspace artifacts."},true);continue}if(u==="initialize"){let s=typeof i?.protocolVersion=="string"?i.protocolVersion:void 0,k=F.includes(s)?s:F.at(-1);g(a,{protocolVersion:k,capabilities:{tools:{listChanged:false}},serverInfo:U});continue}if(u==="notifications/initialized")continue;if(u==="tools/list"){g(a,{tools:V.map(s=>({name:s.name,title:s.title,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations}))},l);continue}if(u==="tools/call"){let s=String(i?.name??""),k=V.find(m=>m.name===s);if(!k){f(a,`Unknown tool: ${s}`,-32602);continue}if(i?.arguments!==void 0&&(!i.arguments||typeof i.arguments!="object"||Array.isArray(i.arguments))){f(a,"Tool arguments must be an object",-32602);continue}let j=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},v=ie(k,j);if(v){g(a,A("invalid_arguments",v),l);continue}try{let m=await D(t,s,j);g(a,m==null?A("artifact_not_found",`${s} returned no current workspace data`):oe(m),l);}catch(m){g(a,A("tool_execution_failed",m instanceof Error?m.message:String(m)),l);}continue}f(a,`Unsupported method: ${u??"unknown"}`,-32601);}catch(s){f(a,s instanceof Error?s.message:String(s));}}}async function je(e,t,n={}){return D(y.resolve(e),t,n)}export{V as WORKSPACE_MCP_READ_TOOLS,je as invokeMcpToolForTest,Ae as runWorkspaceMcpServe};
@@ -1 +1 @@
1
- export{m as WORKSPACE_MODEL_REPORT_PATH,l as WORKSPACE_MODEL_SCHEMA_VERSION,r as buildWorkspaceModel,s as buildWorkspaceModelCached,q as buildWorkspaceModelFacts,t as buildWorkspaceModelIncremental,o as createWorkspaceModelBuildProvenance,p as validateWorkspaceModelStrict,n as workspaceModelProjectTopology,u as writeWorkspaceModel}from'./chunk-VODNLROY.js';
1
+ export{m as WORKSPACE_MODEL_REPORT_PATH,l as WORKSPACE_MODEL_SCHEMA_VERSION,r as buildWorkspaceModel,s as buildWorkspaceModelCached,q as buildWorkspaceModelFacts,t as buildWorkspaceModelIncremental,o as createWorkspaceModelBuildProvenance,p as validateWorkspaceModelStrict,n as workspaceModelProjectTopology,u as writeWorkspaceModel}from'./chunk-SEZTSMRR.js';
@@ -1 +1 @@
1
- export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-IKNWNGLY.js';
1
+ export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-UTIK3K3M.js';
@@ -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-4BBFEHPL.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-QCX6BO2M.js';