workspai 0.47.0 → 0.49.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 (103) hide show
  1. package/README.md +247 -136
  2. package/contracts/agent-customization-pack.v1.json +5 -0
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
  4. package/contracts/extension-cli-compatibility.v1.json +8 -2
  5. package/contracts/published-contract-catalog.v1.json +33 -1
  6. package/contracts/runtime-command-surface.v1.json +163 -3
  7. package/contracts/workspace-intelligence/model-usage-event.v1.json +82 -0
  8. package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
  9. package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +53 -0
  10. package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +120 -0
  11. package/contracts/workspace-intelligence-architecture.v1.json +31 -2
  12. package/contracts/workspace-intelligence-chain.v1.json +44 -3
  13. package/dist/analyze-EEEU3MIF.js +1 -0
  14. package/dist/{artifact-remediation-plan-EPALZ2LC.js → artifact-remediation-plan-SPOUHMK5.js} +1 -1
  15. package/dist/autopilot-release-R4XRTWEM.js +1 -0
  16. package/dist/{chunk-2TEDAKP6.js → chunk-32OJDBIG.js} +1 -1
  17. package/dist/{chunk-ZDN7RHXJ.js → chunk-37CVKXBD.js} +1 -1
  18. package/dist/{chunk-YCL3I2JO.js → chunk-3NU32T4A.js} +1 -1
  19. package/dist/chunk-3VFA7D5T.js +1 -0
  20. package/dist/{chunk-CW7PGBIQ.js → chunk-4HDYADHT.js} +1 -1
  21. package/dist/{chunk-PBHP6JNY.js → chunk-54EP5CEV.js} +1 -1
  22. package/dist/{chunk-NOFM7MNA.js → chunk-AFL3ACCR.js} +1 -1
  23. package/dist/{chunk-MEMHNE7Y.js → chunk-BFLJ2R4D.js} +1 -1
  24. package/dist/{chunk-6SWRNA47.js → chunk-BGPXQQNY.js} +1 -1
  25. package/dist/chunk-BMWFQXGW.js +1 -0
  26. package/dist/{chunk-2GHUZDYA.js → chunk-CRHYBQI3.js} +1 -1
  27. package/dist/{chunk-KZZ36CK5.js → chunk-E2KJ5QWY.js} +1 -1
  28. package/dist/{chunk-BSRVO52Y.js → chunk-EKZLUMCS.js} +2 -2
  29. package/dist/{chunk-76YOPAOT.js → chunk-ESLPI3XZ.js} +1 -1
  30. package/dist/{chunk-DV6GJD4K.js → chunk-HDXNIN4N.js} +1 -1
  31. package/dist/{chunk-TNQI5VCW.js → chunk-HZDXO65G.js} +14 -14
  32. package/dist/{chunk-COARSXRC.js → chunk-J5ENLXDF.js} +1 -1
  33. package/dist/{chunk-QDWYIRHR.js → chunk-K4X3DM7R.js} +1 -1
  34. package/dist/chunk-LHOZXC2M.js +2 -0
  35. package/dist/{chunk-RWRLFSKW.js → chunk-NAJCUQ4X.js} +1 -1
  36. package/dist/{chunk-ZM5NQ5Z2.js → chunk-OW42TZFB.js} +1 -1
  37. package/dist/{chunk-SK6XRKGG.js → chunk-P3D5YQB2.js} +1 -1
  38. package/dist/{chunk-TWNFECMN.js → chunk-PHXQR6PX.js} +1 -1
  39. package/dist/{chunk-ITCAMC2E.js → chunk-PRTR2DQ2.js} +1 -1
  40. package/dist/{chunk-7VLCK5JW.js → chunk-RHQW3DTP.js} +1 -1
  41. package/dist/{chunk-22NJ2ZMG.js → chunk-T4YR4RAI.js} +1 -1
  42. package/dist/{chunk-VBSQ7MF6.js → chunk-TIE2XMGH.js} +20 -20
  43. package/dist/{chunk-HSGFUKCN.js → chunk-VU7NZHPM.js} +1 -1
  44. package/dist/{chunk-U5EZHZBX.js → chunk-YJZOMRAS.js} +1 -1
  45. package/dist/{create-7JKJDAQV.js → create-S64IWHAP.js} +1 -1
  46. package/dist/{doctor-PGPNIS76.js → doctor-4NNUDNGZ.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-6TVFBTVI.js → dotnet-webapi-clean-A6MVDYXX.js} +4 -4
  48. package/dist/{gofiber-standard-2BL7GWZB.js → gofiber-standard-I5YPQG5V.js} +1 -1
  49. package/dist/{gogin-standard-XGP3KBXA.js → gogin-standard-VY2L4QT5.js} +1 -1
  50. package/dist/index.d.ts +35 -11
  51. package/dist/index.js +138 -136
  52. package/dist/{pipeline-IB6ILJSV.js → pipeline-LHTPE3DR.js} +1 -1
  53. package/dist/{springboot-standard-JJNUID6M.js → springboot-standard-55XKCBIZ.js} +4 -4
  54. package/dist/{workspace-H3QXBFGB.js → workspace-PJPRBUMQ.js} +1 -1
  55. package/dist/{workspace-agent-sync-C7SG2Z5W.js → workspace-agent-sync-662QHXGF.js} +1 -1
  56. package/dist/{workspace-context-BKQBKA4C.js → workspace-context-23YYCUCP.js} +1 -1
  57. package/dist/{workspace-contract-RPQQBQXR.js → workspace-contract-TU2I7GC2.js} +1 -1
  58. package/dist/{workspace-dependency-graph-23BI2HG7.js → workspace-dependency-graph-BP4EXYQ5.js} +1 -1
  59. package/dist/workspace-explain-MWUEN643.js +1 -0
  60. package/dist/workspace-explain-contract-ZPI3JXJU.js +1 -0
  61. package/dist/{workspace-feedback-WAID3IOE.js → workspace-feedback-SUVH2LUJ.js} +1 -1
  62. package/dist/{workspace-foundation-5OOJEO2D.js → workspace-foundation-WPLD7OEO.js} +1 -1
  63. package/dist/workspace-graph-stream-KAGGQPJT.js +1 -0
  64. package/dist/{workspace-history-C6OP3IAQ.js → workspace-history-BANOJRQ2.js} +1 -1
  65. package/dist/{workspace-intelligence-VKDL3H2J.js → workspace-intelligence-MFJE7W67.js} +1 -1
  66. package/dist/workspace-intelligence-evaluation-IPH7M3WV.js +1 -0
  67. package/dist/{workspace-intelligence-runner-LVALAZY7.js → workspace-intelligence-runner-OTYTHV6B.js} +1 -1
  68. package/dist/{workspace-knowledge-graph-FE2NTZKV.js → workspace-knowledge-graph-ARDC6HHG.js} +1 -1
  69. package/dist/workspace-knowledge-graph-export-UYAYFTWX.js +10 -0
  70. package/dist/workspace-mcp-serve-EZR6O76D.js +3 -0
  71. package/dist/{workspace-model-S33CIB2R.js → workspace-model-7OU2M3LE.js} +1 -1
  72. package/dist/{workspace-registry-summary-A3YDL63D.js → workspace-registry-summary-ORDK7A36.js} +1 -1
  73. package/dist/workspace-run-QND2SIYA.js +1 -0
  74. package/dist/{workspace-verify-ZGH3NXAH.js → workspace-verify-EBVL7FWT.js} +1 -1
  75. package/dist/workspace-watch-7HWGA5TF.js +1 -0
  76. package/docs/GLOSSARY.md +28 -24
  77. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +11 -8
  78. package/docs/README.md +62 -23
  79. package/docs/README_CONTENT_CONTRACT.md +154 -0
  80. package/docs/ci-workflows.md +3 -3
  81. package/docs/commands-reference.md +16 -3
  82. package/docs/contracts/ARTIFACT_CATALOG.md +35 -20
  83. package/docs/contracts/README.md +3 -0
  84. package/docs/creating-workspaces-and-projects.md +16 -12
  85. package/docs/doctor-command.md +30 -28
  86. package/docs/examples/ci-agent-grounding.yml +1 -1
  87. package/docs/from-code-to-shared-understanding.md +2 -2
  88. package/docs/graph-benchmark-methodology.md +2 -2
  89. package/docs/workspace-intelligence-evaluation.md +149 -0
  90. package/docs/workspace-intelligence-runner.md +17 -6
  91. package/docs/workspace-knowledge-graph.md +31 -10
  92. package/docs/workspace-operations.md +13 -5
  93. package/package.json +9 -4
  94. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  95. package/dist/analyze-UVXPRGYZ.js +0 -1
  96. package/dist/autopilot-release-5BQ6F5L2.js +0 -1
  97. package/dist/chunk-LNRAB7UY.js +0 -1
  98. package/dist/chunk-NRYS4CLR.js +0 -2
  99. package/dist/workspace-explain-WVN7JH3U.js +0 -1
  100. package/dist/workspace-explain-contract-SEFTVF6J.js +0 -1
  101. package/dist/workspace-mcp-serve-KT2I676Z.js +0 -3
  102. package/dist/workspace-run-M4LNJILC.js +0 -1
  103. package/dist/workspace-watch-EVBJTMV7.js +0 -1
@@ -1,4 +1,4 @@
1
- import {a as a$3}from'./chunk-PBHP6JNY.js';import {c}from'./chunk-QDWYIRHR.js';import {q}from'./chunk-MEMHNE7Y.js';import {d as d$1}from'./chunk-VBSQ7MF6.js';import {c as c$1}from'./chunk-FPJNWPKU.js';import {a as a$4}from'./chunk-6SWRNA47.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {d,a as a$2,e as e$1}from'./chunk-2TEDAKP6.js';import {a as a$1}from'./chunk-LNRAB7UY.js';import c$2 from'chalk';import p from'path';function G(a){return a===0?"pass":a===2?"warn":"fail"}function I(a){return a.some(r=>r.status==="fail")?"blocked":a.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(a,r){if(r)return 3;let i=a.some(o=>o.status==="fail"),t=a.some(o=>o.status==="warn");return i?1:t?2:0}function N(a,r){return a===2&&!r?0:a}async function O(a){let r=await d$1(a,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-RPQQBQXR.js');await t({workspacePath:a}),i=true;}catch{i=false;}return {sync:r,contractSynced:i}}async function V(a$5={}){let r=p.resolve(a$5.workspacePath??process.cwd()),i=a(r);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t=[],o=[],l=false,d$1,f$1,m,y=Date.now();try{let{sync:e,contractSynced:s}=await O(i),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:n,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${s?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||o.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),o.push("workspace sync stage failed");}let w=Date.now();try{let e=await q({workspace:true,json:true,quiet:true,strict:a$5.strict===true,ci:a$5.strict!==true}),s=G(e),n=await d(i,a$1.doctor)??a$2(i,a$1.doctor);t.push({name:"doctor",status:s,durationMs:Date.now()-w,summary:s==="pass"?"doctor workspace passed":s==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:n}),s==="fail"?o.push("doctor workspace gate failed"):s==="warn"&&o.push("doctor workspace reported warnings");}catch(e){l=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),o.push("doctor workspace stage failed");}if(a$5.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let s=await a$3({workspacePath:i,json:true,strict:a$5.strict===true});d$1=p.isAbsolute(s.enterpriseControls.evidencePath)?s.enterpriseControls.evidencePath:p.join(i,s.enterpriseControls.evidencePath);let n=s.summary.verdict==="blocked"?"fail":s.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${s.summary.verdict} (score ${s.summary.score}/100)`,evidencePath:d$1}),n==="fail"?o.push("analyze reported blocked verdict"):n==="warn"&&o.push("analyze reported needs-attention verdict");}catch(s){l=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${s instanceof Error?s.message:String(s)}`}),o.push("analyze stage failed");}}let h=Date.now();try{let e=await a$4({startPath:i,writeReport:true,skipVerify:a$5.skipVerify===true});f$1=e.evidencePath;let s=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:s,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),s==="fail"?o.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):s==="warn"&&o.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),o.push("readiness stage failed");}if(a$5.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),s=a$5.autopilotMode??"audit";try{let n=await c({workspacePath:i,mode:s,json:true,skipPipelineStages:true});m=n.artifacts.reportPath;let P=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${s}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:m}),P!=="pass"&&o.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),o.push("autopilot release stage failed");}}let M=I(t),k=j(t,l),F=p.join(i,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:M,exitCode:k,stagesPassed:t.filter(e=>e.status==="pass").length,stagesWarn:t.filter(e=>e.status==="warn").length,stagesFailed:t.filter(e=>e.status==="fail").length},stages:t,blockingReasons:[...new Set(o)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$1,autopilotEvidencePath:m}};if(a$5.writeReport!==false){let e$2=f(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e()});await e$1(i,".workspai/reports/pipeline-last-run.json",e$2);}if(a$5.writeReport!==false&&a$5.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&a$5.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-C7SG2Z5W.js'),s=await e({workspacePath:i,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:s.indexPath,writtenFiles:s.writtenFiles,blockers:s.blockers};}catch{}return u}async function ae(a){let r;try{r=await V(a);}catch(t){let o=t instanceof Error?t.message:String(t);a.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:o}),null,2)):console.log(c$2.red(`Pipeline failed: ${o}`)),process.exit(1);}if(a.json)console.log(JSON.stringify(r,null,2));else {console.log(c$2.bold.cyan(`
1
+ import {a as a$3}from'./chunk-54EP5CEV.js';import {c}from'./chunk-K4X3DM7R.js';import {q}from'./chunk-BFLJ2R4D.js';import {d as d$1}from'./chunk-TIE2XMGH.js';import {c as c$1}from'./chunk-FPJNWPKU.js';import {a as a$4}from'./chunk-BGPXQQNY.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {d,a as a$2,e as e$1}from'./chunk-32OJDBIG.js';import {a as a$1}from'./chunk-BMWFQXGW.js';import c$2 from'chalk';import p from'path';function G(a){return a===0?"pass":a===2?"warn":"fail"}function I(a){return a.some(r=>r.status==="fail")?"blocked":a.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(a,r){if(r)return 3;let i=a.some(o=>o.status==="fail"),t=a.some(o=>o.status==="warn");return i?1:t?2:0}function N(a,r){return a===2&&!r?0:a}async function O(a){let r=await d$1(a,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-TU2I7GC2.js');await t({workspacePath:a}),i=true;}catch{i=false;}return {sync:r,contractSynced:i}}async function V(a$5={}){let r=p.resolve(a$5.workspacePath??process.cwd()),i=a(r);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t=[],o=[],l=false,d$1,f$1,m,y=Date.now();try{let{sync:e,contractSynced:s}=await O(i),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:n,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${s?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||o.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),o.push("workspace sync stage failed");}let w=Date.now();try{let e=await q({workspace:true,json:true,quiet:true,strict:a$5.strict===true,ci:a$5.strict!==true}),s=G(e),n=await d(i,a$1.doctor)??a$2(i,a$1.doctor);t.push({name:"doctor",status:s,durationMs:Date.now()-w,summary:s==="pass"?"doctor workspace passed":s==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:n}),s==="fail"?o.push("doctor workspace gate failed"):s==="warn"&&o.push("doctor workspace reported warnings");}catch(e){l=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),o.push("doctor workspace stage failed");}if(a$5.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let s=await a$3({workspacePath:i,json:true,strict:a$5.strict===true});d$1=p.isAbsolute(s.enterpriseControls.evidencePath)?s.enterpriseControls.evidencePath:p.join(i,s.enterpriseControls.evidencePath);let n=s.summary.verdict==="blocked"?"fail":s.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${s.summary.verdict} (score ${s.summary.score}/100)`,evidencePath:d$1}),n==="fail"?o.push("analyze reported blocked verdict"):n==="warn"&&o.push("analyze reported needs-attention verdict");}catch(s){l=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${s instanceof Error?s.message:String(s)}`}),o.push("analyze stage failed");}}let h=Date.now();try{let e=await a$4({startPath:i,writeReport:true,skipVerify:a$5.skipVerify===true});f$1=e.evidencePath;let s=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:s,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),s==="fail"?o.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):s==="warn"&&o.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),o.push("readiness stage failed");}if(a$5.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),s=a$5.autopilotMode??"audit";try{let n=await c({workspacePath:i,mode:s,json:true,skipPipelineStages:true});m=n.artifacts.reportPath;let P=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${s}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:m}),P!=="pass"&&o.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),o.push("autopilot release stage failed");}}let M=I(t),k=j(t,l),F=p.join(i,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:M,exitCode:k,stagesPassed:t.filter(e=>e.status==="pass").length,stagesWarn:t.filter(e=>e.status==="warn").length,stagesFailed:t.filter(e=>e.status==="fail").length},stages:t,blockingReasons:[...new Set(o)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$1,autopilotEvidencePath:m}};if(a$5.writeReport!==false){let e$2=f(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e()});await e$1(i,".workspai/reports/pipeline-last-run.json",e$2);}if(a$5.writeReport!==false&&a$5.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&a$5.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-662QHXGF.js'),s=await e({workspacePath:i,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:s.indexPath,writtenFiles:s.writtenFiles,blockers:s.blockers};}catch{}return u}async function ae(a){let r;try{r=await V(a);}catch(t){let o=t instanceof Error?t.message:String(t);a.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:o}),null,2)):console.log(c$2.red(`Pipeline failed: ${o}`)),process.exit(1);}if(a.json)console.log(JSON.stringify(r,null,2));else {console.log(c$2.bold.cyan(`
2
2
  \u{1F517} Workspai Governance Pipeline
3
3
  `)),console.log(c$2.bold(`Workspace: ${c$2.cyan(p.basename(r.workspacePath))}`)),console.log(c$2.gray(`Path: ${r.workspacePath}`)),console.log(c$2.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let o=t.status==="pass"?c$2.green("PASS"):t.status==="warn"?c$2.yellow("WARN"):t.status==="skipped"?c$2.gray("SKIP"):c$2.red("FAIL");console.log(` - ${t.name}: ${o} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$2.bold(`
4
4
  Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
@@ -687,11 +687,11 @@ class ServiceRuntimeE2ETest {
687
687
  assertThat(response.getBody()).containsEntry("status", "UP");
688
688
  }
689
689
  }
690
- `}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",r={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=c(),l=`${b(r.project_name)}Application`,o=A(r.package_name);try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i.yellow(`
690
+ `}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",n={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=c(),l=`${b(n.project_name)}Application`,o=A(n.package_name);if(!n.skipInstall)try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i.yellow(`
691
691
  \u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(i.gray(` Install: https://maven.apache.org/install.html
692
- `));}let c$2=R(`Generating Spring Boot project: ${r.project_name}...`).start();try{let n=(d,v)=>c$1(g.join(e,d),v),$=g.join(e,"rapidkit"),y=g.join(e,"rapidkit.cmd");if(await Promise.all([n("pom.xml",D(r)),n(".gitignore",Y()),n(".editorconfig",X()),n(".env.example",U(r)),n(".dockerignore",z()),n("Dockerfile",H(r)),n("docker-compose.yml",F(r)),n(".github/workflows/ci.yml",K(r)),n("README.md",Q(r)),n("src/main/resources/application.yml",J(r)),n("src/test/resources/application.yml",G()),n(`src/main/java/${o}/${l}.java`,B(r,l)),n(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(r)),n(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(r)),n(`src/main/java/${o}/application/SystemInfoService.java`,q(r)),n(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(r)),n(`src/main/java/${o}/api/http/SystemInfoController.java`,N(r)),n(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(r)),n(`src/test/java/${o}/${l}Tests.java`,ne(r,l)),n(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(r)),n(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(r)),n("scripts/perf-smoke.sh",Z(r)),n(".workspai/project.json",C(r,b$2)),n(".workspai/context.json",P()),n("rapidkit",ee(r)),n("rapidkit.cmd",te())]),await promises.chmod($,493),await promises.chmod(y,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),r.skipInstall||await oe(e)||console.log(i.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$2.succeed(i.green(`Project created at ${e}`)),r.skipInstall)c$2.info(i.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$2.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$2.succeed(i.gray("\u2713 maven dependency warm-up completed"));}catch{c$2.warn(i.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!r.skipGit)try{await b$1(e)?console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i.green(`
692
+ `));}let c$2=R(`Generating Spring Boot project: ${n.project_name}...`).start();try{let r=(d,v)=>c$1(g.join(e,d),v),$=g.join(e,"rapidkit"),y=g.join(e,"rapidkit.cmd");if(await Promise.all([r("pom.xml",D(n)),r(".gitignore",Y()),r(".editorconfig",X()),r(".env.example",U(n)),r(".dockerignore",z()),r("Dockerfile",H(n)),r("docker-compose.yml",F(n)),r(".github/workflows/ci.yml",K(n)),r("README.md",Q(n)),r("src/main/resources/application.yml",J(n)),r("src/test/resources/application.yml",G()),r(`src/main/java/${o}/${l}.java`,B(n,l)),r(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(n)),r(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(n)),r(`src/main/java/${o}/application/SystemInfoService.java`,q(n)),r(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(n)),r(`src/main/java/${o}/api/http/SystemInfoController.java`,N(n)),r(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(n)),r(`src/test/java/${o}/${l}Tests.java`,ne(n,l)),r(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(n)),r(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(n)),r("scripts/perf-smoke.sh",Z(n)),r(".workspai/project.json",C(n,b$2)),r(".workspai/context.json",P()),r("rapidkit",ee(n)),r("rapidkit.cmd",te())]),await promises.chmod($,493),await promises.chmod(y,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),n.skipInstall||await oe(e)||console.log(i.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$2.succeed(i.green(`Project created at ${e}`)),n.skipInstall)c$2.info(i.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$2.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$2.succeed(i.gray("\u2713 maven dependency warm-up completed"));}catch{c$2.warn(i.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!n.skipGit)try{await b$1(e)?console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i.green(`
693
693
  \u2728 Spring Boot project created successfully!
694
694
  `)),console.log(i.cyan("\u{1F4C2} Location:"),i.white(e)),console.log(i.cyan(`
695
695
  \u{1F680} Get started:
696
- `)),console.log(i.white(` cd ${r.project_name}`)),console.log(i.white(" npx workspai init")),console.log(i.white(` npx workspai dev
697
- `)),console.log(i.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(n){c$2.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw n}}export{x as DEFAULT_JAVA_VERSION,M as DEFAULT_SPRINGDOC_VERSION,j as DEFAULT_SPRING_BOOT_VERSION,ve as generateSpringBootKit};
696
+ `)),console.log(i.white(` cd ${n.project_name}`)),console.log(i.white(" npx workspai init")),console.log(i.white(` npx workspai dev
697
+ `)),console.log(i.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(r){c$2.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw r}}export{x as DEFAULT_JAVA_VERSION,M as DEFAULT_SPRINGDOC_VERSION,j as DEFAULT_SPRING_BOOT_VERSION,ve as generateSpringBootKit};
@@ -1 +1 @@
1
- export{h as createProject,g as createWorkspace,j as createWorkspaceShareBundle,i as listWorkspaces,a as normalizeWorkspaceEntry,f as registerProjectInWorkspace,e as registerProjectInWorkspaceStrict,c as registerWorkspace,b as registerWorkspaceStrict,d as syncWorkspaceProjects}from'./chunk-VBSQ7MF6.js';
1
+ export{h as createProject,g as createWorkspace,j as createWorkspaceShareBundle,i as listWorkspaces,a as normalizeWorkspaceEntry,f as registerProjectInWorkspace,e as registerProjectInWorkspaceStrict,c as registerWorkspace,b as registerWorkspaceStrict,d as syncWorkspaceProjects}from'./chunk-TIE2XMGH.js';
@@ -1 +1 @@
1
- export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-TNQI5VCW.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-2GHUZDYA.js';
1
+ export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-HZDXO65G.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-CRHYBQI3.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-NRYS4CLR.js';
1
+ export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-LHOZXC2M.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_CONTRACT_PATH,f as WORKSPACE_CONTRACT_SCHEMA_VERSION,e as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,g as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,h as WorkspaceContractVerificationError,j as buildWorkspaceContract,n as buildWorkspaceContractGraph,i as discoverProjectJsonFiles,m as readWorkspaceContract,l as syncWorkspaceContract,o as verifyWorkspaceContract,k as writeWorkspaceContract,p as writeWorkspaceContractVerifyEvidence}from'./chunk-22NJ2ZMG.js';
1
+ export{d as WORKSPACE_CONTRACT_PATH,f as WORKSPACE_CONTRACT_SCHEMA_VERSION,e as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,g as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,h as WorkspaceContractVerificationError,j as buildWorkspaceContract,n as buildWorkspaceContractGraph,i as discoverProjectJsonFiles,m as readWorkspaceContract,l as syncWorkspaceContract,o as verifyWorkspaceContract,k as writeWorkspaceContract,p as writeWorkspaceContractVerifyEvidence}from'./chunk-T4YR4RAI.js';
@@ -1 +1 @@
1
- export{c as WORKSPACE_GRAPH_OVERRIDES_PATH,d as graphHasCycle,e as hashDependencyGraph,f as inferWorkspaceDependencyGraph,g as inferWorkspaceDependencyGraphIncremental}from'./chunk-COARSXRC.js';
1
+ export{c as WORKSPACE_GRAPH_OVERRIDES_PATH,d as graphHasCycle,e as hashDependencyGraph,f as inferWorkspaceDependencyGraph,g as inferWorkspaceDependencyGraphIncremental}from'./chunk-J5ENLXDF.js';
@@ -0,0 +1 @@
1
+ export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-4HDYADHT.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-CRHYBQI3.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-AFL3ACCR.js';
@@ -0,0 +1 @@
1
+ export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-VU7NZHPM.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-CRHYBQI3.js';
@@ -1 +1 @@
1
- import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-76YOPAOT.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
1
+ import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-ESLPI3XZ.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
@@ -1 +1 @@
1
- import {b}from'./chunk-BSRVO52Y.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-A3YDL63D.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-EKZLUMCS.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-ORDK7A36.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -0,0 +1 @@
1
+ import {d,c}from'./chunk-OA537ZQ5.js';import {a}from'./chunk-KB44JP4M.js';import g from'crypto';import H from'path';var S="workspace-graph-stream.v1";function k(o){return c({...o,generatedAt:"<ignored>",proofs:o.proofs.map(s=>({...s,observedAt:"<ignored>"}))})}function w(o){return "observedAt"in o?{...o,observedAt:"<ignored>"}:o}function v(o,s){let r=new Map(o.map(e=>[e.id,e])),a=new Map(s.map(e=>[e.id,e])),i=s.filter(e=>!r.has(e.id)),p=s.filter(e=>{let t=r.get(e.id);return t?c(w(t))!==c(w(e)):false}),d=o.filter(e=>!a.has(e.id)).map(e=>e.id);return {added:i,updated:p,removed:d}}function M(o,s){let r=new Map(o.map(a=>[a.id,a]));return s.filter(a=>{let i=r.get(a.id);return !i||c(i)!==c(a)})}function f(o){return a(o,"contracts/workspace-intelligence/workspace-graph-stream.v1.json","Workspace graph stream event"),o}var I=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,r){let a=this.now().toISOString(),i=d(s),p=k(r),d$1=this.nextCorrelationId(),e={schemaVersion:S,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 A=f({...e,type:"graph.snapshot",revision:this.revision,payload:{graph:r,reason:"initial"}});return this.previous=r,A}let t=this.previous,R=this.revision,b=t.source.hash,y=k(t);this.revision+=1,this.generation+=1;let c$1=v(t.entities,r.entities),h=v(t.relations,r.relations),l=v(t.proofs,r.proofs),W=c(t.quality)!==c(r.quality),G=f({...e,generation:this.generation,type:"graph.delta",baseRevision:R,baseModelHash:b,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:M(t.providers,r.providers),quality:W?r.quality:null,diagnostics:r.diagnostics}});return this.previous=r,G}};export{S as WORKSPACE_GRAPH_STREAM_SCHEMA_VERSION,I as WorkspaceGraphStreamPublisher};
@@ -1 +1 @@
1
- export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-76YOPAOT.js';
1
+ export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-ESLPI3XZ.js';
@@ -1 +1 @@
1
- export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,o as buildWorkspaceImpact,j as buildWorkspaceModelSnapshot,l as diffWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,n as workspaceVerificationPlan,p as writeWorkspaceImpact,m as writeWorkspaceModelDiff,k as writeWorkspaceModelSnapshot}from'./chunk-NOFM7MNA.js';export{d as hashWorkspaceModel}from'./chunk-OA537ZQ5.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,o as buildWorkspaceImpact,j as buildWorkspaceModelSnapshot,l as diffWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,n as workspaceVerificationPlan,p as writeWorkspaceImpact,m as writeWorkspaceModelDiff,k as writeWorkspaceModelSnapshot}from'./chunk-AFL3ACCR.js';export{d as hashWorkspaceModel}from'./chunk-OA537ZQ5.js';
@@ -0,0 +1 @@
1
+ import {a as a$2,b as b$1,c,d as d$1}from'./chunk-3VFA7D5T.js';import {a as a$1}from'./chunk-KB44JP4M.js';import {a}from'./chunk-BMWFQXGW.js';import d from'crypto';import s from'path';import {open,unlink,stat}from'fs/promises';import u from'fs-extra';var k=a.evaluationLive,O=a.evaluationLastRun,W="contracts/workspace-intelligence/model-usage-event.v1.json",E="contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",P="contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json",_=3e4,N=100,b=25;function C(){return {modelCalls:0,toolCalls:0,tokenSources:{providerReported:0,tokenizerCounted:0,estimated:0,unavailable:0},tokens:{input:0,output:0,cachedInput:0,reasoning:0,observedTotal:0},latencyMs:0,costs:[],outcome:{status:"unknown",verified:false,blockersResolved:0},efficiency:{tokensPerVerifiedOutcome:null,noProgressDecisions:0,repeatedArtifactReads:0}}}function m(t){return t??0}function S(t){let e=C(),a=new Map,n=new Map;for(let o of t){if(o.kind==="model-call"){e.modelCalls+=1;let r={"provider-reported":"providerReported","tokenizer-counted":"tokenizerCounted",estimated:"estimated",unavailable:"unavailable"}[o.modelCall.source];if(e.tokenSources[r]+=1,e.tokens.input+=m(o.modelCall.inputTokens),e.tokens.output+=m(o.modelCall.outputTokens),e.tokens.cachedInput+=m(o.modelCall.cachedInputTokens),e.tokens.reasoning+=m(o.modelCall.reasoningTokens),e.latencyMs+=o.modelCall.latencyMs??0,o.modelCall.cost){let i=o.modelCall.cost.currency.toUpperCase(),l=n.get(i)??{currency:i,amount:0,providerReported:0,estimated:0};l.amount+=o.modelCall.cost.amount,o.modelCall.cost.source==="provider-reported"?l.providerReported+=o.modelCall.cost.amount:l.estimated+=o.modelCall.cost.amount,n.set(i,l);}continue}if(o.kind==="tool-call"){e.toolCalls+=1,e.latencyMs+=o.toolCall.durationMs??0,!o.toolCall.changedSource&&o.toolCall.result==="passed"&&(e.efficiency.noProgressDecisions+=1),o.toolCall.artifact&&a.set(o.toolCall.artifact,(a.get(o.toolCall.artifact)??0)+1);continue}o.kind==="outcome"&&(e.outcome={status:o.outcome.status,verified:o.outcome.verified,blockersResolved:o.outcome.blockersResolved});}return e.tokens.observedTotal=e.tokens.input+e.tokens.output,e.costs=[...n.values()].map(o=>({...o,amount:Number(o.amount.toFixed(8)),providerReported:Number(o.providerReported.toFixed(8)),estimated:Number(o.estimated.toFixed(8))})).sort((o,r)=>o.currency.localeCompare(r.currency)),e.efficiency.repeatedArtifactReads=[...a.values()].reduce((o,r)=>o+Math.max(0,r-1),0),e.efficiency.tokensPerVerifiedOutcome=e.outcome.verified&&e.outcome.status==="passed"?e.tokens.observedTotal:null,e}function x(t,e=new Date){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Evaluation event must be a JSON object.");let a=t,n={...a,schemaVersion:a$2,eventId:typeof a.eventId=="string"&&a.eventId.trim()?a.eventId.trim():d.randomUUID(),recordedAt:typeof a.recordedAt=="string"&&a.recordedAt.trim()?a.recordedAt:e.toISOString()};a$1(n,W,"workspace evaluation event");let o={"model-call":"modelCall","tool-call":"toolCall",outcome:"outcome",milestone:"milestone"}[n.kind],r=["modelCall","toolCall","outcome","milestone"].filter(i=>a[i]!==void 0);if(r.length!==1||r[0]!==o)throw new Error(`Evaluation event kind ${n.kind} requires only ${o}.`);if(n.kind==="model-call"&&n.modelCall.source!=="unavailable"&&n.modelCall.inputTokens===null&&n.modelCall.outputTokens===null)throw new Error("Measured model calls require at least one input or output token count.");return n}function J(t){let e=t.now??new Date,a=s.resolve(t.workspacePath),n={schemaVersion:b$1,runId:t.runId??d.randomUUID(),sessionId:t.sessionId??d.randomUUID(),status:"live",startedAt:e.toISOString(),updatedAt:e.toISOString(),workspace:{name:t.workspaceName?.trim()||s.basename(a),path:a},configuration:{taskId:t.taskId.trim(),strategy:t.strategy??"workspace-intelligence",...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.temperature!==void 0?{temperature:t.temperature}:{},...t.baselineRunId?{baselineRunId:t.baselineRunId}:{}},methodology:{id:"provider-usage-and-verified-outcome.v1",claimBoundary:"Provider-reported and tokenizer-counted values are measured; estimated values remain explicitly labelled. Verified task success is required before reporting tokens per successful outcome."},events:[],summary:C()};return a$1(n,E,"workspace evaluation"),n}async function L(t,e){await u.ensureDir(s.dirname(t));let a=`${t}.${process.pid}.${d.randomUUID()}.tmp`;try{await u.writeJson(a,e,{spaces:2}),await u.rename(a,t);}finally{await u.remove(a).catch(()=>{});}}async function A(t,e){let a=s.join(s.resolve(t),`${k}.lock`);await u.ensureDir(s.dirname(a));for(let n=0;n<N;n+=1)try{let o=await open(a,"wx");try{return await o.writeFile(JSON.stringify({pid:process.pid,acquiredAt:new Date().toISOString()})),await e()}finally{await o.close(),await unlink(a).catch(()=>{});}}catch(o){if(o.code!=="EEXIST")throw o;let i=await stat(a).catch(()=>null);if(i&&Date.now()-i.mtimeMs>_){await unlink(a).catch(()=>{});continue}await new Promise(l=>setTimeout(l,b));}throw new Error("Timed out waiting for the workspace evaluation writer lock.")}async function v(t,e,a=k){let n=s.join(s.resolve(t),a);return a$1(e,E,a),await L(n,e),n}async function T(t,e=k){let a=s.isAbsolute(e)?e:s.join(s.resolve(t),e),n=await u.readJson(a);return a$1(n,E,a),n}async function G(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath);if(e.status!=="live")throw new Error(`Evaluation ${e.runId} is ${e.status}; initialize a new run.`);let a=x(t.payload,t.now);if(e.events.some(o=>o.eventId===a.eventId))return e;let n={...e,updatedAt:(t.now??new Date).toISOString(),events:[...e.events,a],summary:S([...e.events,a])};return await v(t.workspacePath,n),n})}async function H(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath),a=(t.now??new Date).toISOString(),n={...e,status:t.status??"completed",updatedAt:a,completedAt:a,summary:S(e.events)},o=await v(t.workspacePath,n,O);return await v(t.workspacePath,n),{report:n,outputPath:o}})}function q(t,e){let a=t.summary.tokens.observedTotal,n=e.summary.tokens.observedTotal,o=a-n,r={schemaVersion:c,generatedAt:new Date().toISOString(),taskAligned:t.configuration.taskId===e.configuration.taskId,current:{runId:t.runId,strategy:t.configuration.strategy,tokens:a,verified:t.summary.outcome.verified,status:t.summary.outcome.status},baseline:{runId:e.runId,strategy:e.configuration.strategy,tokens:n,verified:e.summary.outcome.verified,status:e.summary.outcome.status},delta:{tokens:o,reductionPercent:n===0?null:Number((-o/n*100).toFixed(2)),modelCalls:t.summary.modelCalls-e.summary.modelCalls,toolCalls:t.summary.toolCalls-e.summary.toolCalls,latencyMs:Number((t.summary.latencyMs-e.summary.latencyMs).toFixed(2))},comparableOutcome:t.summary.outcome.verified&&e.summary.outcome.verified&&t.summary.outcome.status===e.summary.outcome.status};return a$1(r,P,"workspace evaluation comparison"),r}function B(){if(d$1.length!==4)throw new Error("Model usage source taxonomy is incomplete.")}export{O as WORKSPACE_EVALUATION_LAST_RUN_PATH,k as WORKSPACE_EVALUATION_LIVE_PATH,G as appendWorkspaceEvaluationEvent,B as assertWorkspaceEvaluationSourceTaxonomy,q as compareWorkspaceEvaluations,J as createWorkspaceEvaluation,H as finalizeWorkspaceEvaluation,x as normalizeWorkspaceEvaluationEvent,T as readWorkspaceEvaluation,S as summarizeWorkspaceEvaluation,v as writeWorkspaceEvaluation};
@@ -1 +1 @@
1
- import {b as b$1,c}from'./chunk-CW7PGBIQ.js';import {a as a$2}from'./chunk-PBHP6JNY.js';import {q}from'./chunk-MEMHNE7Y.js';import {d}from'./chunk-VBSQ7MF6.js';import {a as a$3}from'./chunk-6SWRNA47.js';import {k as k$2}from'./chunk-TNQI5VCW.js';import {a as a$1,e as e$2,f as f$1}from'./chunk-NRYS4CLR.js';import {f,g,h as h$1}from'./chunk-ZM5NQ5Z2.js';import {j,k as k$1,l as l$1,m,o,p}from'./chunk-NOFM7MNA.js';import {k,n}from'./chunk-ZDN7RHXJ.js';import {j as j$1,e as e$1}from'./chunk-76YOPAOT.js';import {l,o as o$1,p as p$1}from'./chunk-22NJ2ZMG.js';import {e}from'./chunk-2TEDAKP6.js';import {b as b$2}from'./chunk-YCL3I2JO.js';import {a,b,h,i,g as g$1,f as f$2}from'./chunk-LNRAB7UY.js';import se from'path';import ce from'fs-extra';function r(a,t){if(!a)throw new Error(`Workspace Intelligence run semantic violation: ${t}`)}function ee(a,t){return a.length===t.length&&a.every((d,l)=>d===t[l])}function te(a$2){b$2(a.intelligenceRun,a$2,"Workspace Intelligence run report"),r(a$2.chainSchemaVersion===a$1,`chainSchemaVersion must be ${a$1}`),r(a$2.artifactPath===a.intelligenceRun,`artifactPath must be ${a.intelligenceRun}`),r(a$2.preflight.length===g$1.length,`preflight must contain exactly ${g$1.length} entries`);for(let[o,i]of g$1.entries()){let s=a$2.preflight[o];r(s?.id===i,`preflight[${o}].id must be ${i}`),r(ee(s.artifacts,h[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(s.status==="passed"&&s.result==="synchronized"||s.status==="failed"&&s.result==="failed","sync preflight status and result are incoherent"):r(s.status==="passed"&&(s.result==="created"||s.result==="reused")||s.status==="failed"&&s.result==="failed"||s.status==="skipped"&&s.result==="skipped","baseline preflight status and result are incoherent");}let t=a$2.preflight[1];r(a$2.baselineCreated===(t?.result==="created"),"baselineCreated must match the baseline preflight result"),r(a$2.stages.length===f$2.length,`stages must contain exactly ${f$2.length} canonical steps`);let d=a$2.preflight[0],l=d?.status==="failed";for(let[o,i$1]of f$2.entries()){let s=a$2.stages[o];r(s?.id===i$1,`stages[${o}].id must be ${i$1}`),r(ee(s.artifacts,i[i$1].produces),`${i$1} artifacts must match the runtime registry`),l&&r(s.status==="skipped",`${i$1} must be skipped after a hard failure`),s.status==="passed"?r(s.exitCode===0,`${i$1} passed stage must have exitCode 0`):s.status==="blocked"?r(s.exitCode!==0,`${i$1} blocked stage must have a non-zero exitCode`):s.status==="failed"?(r(s.exitCode===1,`${i$1} failed stage must have exitCode 1`),l=true):(r(s.exitCode===0,`${i$1} skipped stage must have exitCode 0`),r(s.durationMs===0,`${i$1} skipped stage must have durationMs 0`)),o===0&&((d?.status==="failed"||s.status==="failed")&&r(t?.status==="skipped","baseline must be skipped when sync or model fails"),t?.status==="skipped"&&r(d?.status==="failed"||s.status==="failed"||s.status==="skipped","baseline may be skipped only after an upstream failure"),t?.status!=="passed"&&(l=true));}let m=a$2.preflight.some(o=>o.status==="failed")||a$2.stages.some(o=>o.status==="failed"),E=a$2.stages.some(o=>o.status==="blocked"),n=m?"failed":E?"blocked":"passed",u=n==="failed"?1:n==="blocked"?2:0;r(a$2.status===n,`status must be ${n}`),r(a$2.exitCode===u,`exitCode must be ${u}`);}var le=a.intelligenceRun,de=b.intelligenceRun,ae=le;async function $e(a$4){let t=se.resolve(a$4.workspacePath),d$1=[],l$2=[],m$1=false,E=async(e,p)=>{let f=[...h[e]];if(m$1){d$1.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:f,message:"skipped because a required upstream operation failed"});return}let k=Date.now();try{let c=await p();d$1.push({id:e,status:"passed",result:c.result,durationMs:Date.now()-k,artifacts:f,message:c.message});}catch(c){m$1=true,d$1.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-k,artifacts:f,message:c instanceof Error?c.message:String(c)});}},n$1=async(e,p)=>{let f=[...i[e].produces];if(m$1){l$2.push({id:e,status:"skipped",durationMs:0,artifacts:f,exitCode:0,message:"skipped because a required upstream stage failed"});return}let k=Date.now();try{let c=await p(),b=c.exitCode??0;l$2.push({id:e,status:c.blocked||b!==0?"blocked":"passed",durationMs:Date.now()-k,artifacts:f,exitCode:b,message:c.message});}catch(c){m$1=true,l$2.push({id:e,status:"failed",durationMs:Date.now()-k,artifacts:f,exitCode:1,message:c instanceof Error?c.message:String(c)});}};await E("sync",async()=>{let e=await d(t,true),p=await l({workspacePath:t});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${p.contract.projects.length} projects`}});let u,o$2=()=>{if(!u)throw new Error("canonical workspace model is unavailable");return u};await n$1("model",async()=>(u=await k({workspacePath:t,includeEvidence:true}),await n(u,t),{message:`${u.summary.projectCount} projects modeled`}));let i$1=se.join(t,a.snapshot),s=false;await E("baseline",async()=>{if(!await ce.pathExists(i$1)){let e=await j({workspacePath:t,model:o$2()});return await k$1(e,t),s=true,{result:"created",message:"initial structural baseline created"}}return {result:"reused",message:"existing structural baseline reused"}}),await n$1("diff",async()=>{let e=await l$1({workspacePath:t,fromPath:a.snapshot,model:o$2()});return await m(e,t),{message:e.summary.changed?"workspace changes detected":"no workspace changes"}}),await n$1("impact",async()=>{let e=await o({workspacePath:t,fromPath:a.diff});return await p(e,t),{message:`${e.summary.risk} risk; ${e.summary.affectedProjects} affected`}}),await n$1("doctor-evidence",async()=>{let e=await q({workspace:t,json:true,quiet:true});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await n$1("contract-evidence",async()=>{let e=await o$1({workspacePath:t,strict:true});return await p$1({workspacePath:t,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await n$1("analyze-evidence",async()=>{let e=await a$2({workspacePath:t,json:true,strict:false});return {blocked:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await n$1("readiness-evidence",async()=>{let e=await a$3({startPath:t,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await n$1("verify",async()=>{let e=await f({workspacePath:t,fromImpactPath:a.impact});await g(e,t);let p=h$1(e,{strict:a$4.strict===true});return await j$1(t,e$1(e,p.passed)),{blocked:!p.passed,exitCode:p.exitCode,message:`${e.summary.verdict}; gate ${p.passed?"passed":"blocked"}`}}),await n$1("context",async()=>{u=await k({workspacePath:t,includeEvidence:true});let e=await e$2({workspacePath:t,model:u,agent:a$4.agent??"generic",includeEvidence:true});return await f$1(e,t),{message:`context grounded for ${e.agent}`}}),await n$1("agent-sync",async()=>({message:`${(await k$2({workspacePath:t,agent:a$4.agent??"generic",write:true,refreshContext:false,strict:false,preset:"enterprise"})).writtenFiles.length} grounding files written`})),await n$1("explain",async()=>{let e=await b$1({workspacePath:t,target:{kind:"release-blocked"}});return await c(e,t),{message:e.summary}});let re=l$2.some(e=>e.status==="blocked"),W=m$1?"failed":re?"blocked":"passed",ie=m$1?1:W==="blocked"?2:0,R={schemaVersion:de,chainSchemaVersion:a$1,generatedAt:new Date().toISOString(),workspacePath:t,baselineCreated:s,preflight:d$1,status:W,exitCode:ie,stages:l$2,artifactPath:ae};return te(R),await e(t,ae,R),R}export{le as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,de as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,$e as runWorkspaceIntelligenceChain};
1
+ import {b as b$1,c}from'./chunk-4HDYADHT.js';import {a as a$2}from'./chunk-54EP5CEV.js';import {q}from'./chunk-BFLJ2R4D.js';import {d}from'./chunk-TIE2XMGH.js';import {a as a$3}from'./chunk-BGPXQQNY.js';import {k as k$2}from'./chunk-HZDXO65G.js';import {a as a$1,e as e$2,f as f$1}from'./chunk-LHOZXC2M.js';import {f,g,h as h$1}from'./chunk-OW42TZFB.js';import {j,k as k$1,l as l$1,m,o,p}from'./chunk-AFL3ACCR.js';import {k,n}from'./chunk-37CVKXBD.js';import {j as j$1,e as e$1}from'./chunk-ESLPI3XZ.js';import {l,o as o$1,p as p$1}from'./chunk-T4YR4RAI.js';import {e}from'./chunk-32OJDBIG.js';import {b as b$2}from'./chunk-3NU32T4A.js';import {a,b,h,i,g as g$1,f as f$2}from'./chunk-BMWFQXGW.js';import se from'path';import ce from'fs-extra';function r(a,t){if(!a)throw new Error(`Workspace Intelligence run semantic violation: ${t}`)}function ee(a,t){return a.length===t.length&&a.every((d,l)=>d===t[l])}function te(a$2){b$2(a.intelligenceRun,a$2,"Workspace Intelligence run report"),r(a$2.chainSchemaVersion===a$1,`chainSchemaVersion must be ${a$1}`),r(a$2.artifactPath===a.intelligenceRun,`artifactPath must be ${a.intelligenceRun}`),r(a$2.preflight.length===g$1.length,`preflight must contain exactly ${g$1.length} entries`);for(let[o,i]of g$1.entries()){let s=a$2.preflight[o];r(s?.id===i,`preflight[${o}].id must be ${i}`),r(ee(s.artifacts,h[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(s.status==="passed"&&s.result==="synchronized"||s.status==="failed"&&s.result==="failed","sync preflight status and result are incoherent"):r(s.status==="passed"&&(s.result==="created"||s.result==="reused")||s.status==="failed"&&s.result==="failed"||s.status==="skipped"&&s.result==="skipped","baseline preflight status and result are incoherent");}let t=a$2.preflight[1];r(a$2.baselineCreated===(t?.result==="created"),"baselineCreated must match the baseline preflight result"),r(a$2.stages.length===f$2.length,`stages must contain exactly ${f$2.length} canonical steps`);let d=a$2.preflight[0],l=d?.status==="failed";for(let[o,i$1]of f$2.entries()){let s=a$2.stages[o];r(s?.id===i$1,`stages[${o}].id must be ${i$1}`),r(ee(s.artifacts,i[i$1].produces),`${i$1} artifacts must match the runtime registry`),l&&r(s.status==="skipped",`${i$1} must be skipped after a hard failure`),s.status==="passed"?r(s.exitCode===0,`${i$1} passed stage must have exitCode 0`):s.status==="blocked"?r(s.exitCode!==0,`${i$1} blocked stage must have a non-zero exitCode`):s.status==="failed"?(r(s.exitCode===1,`${i$1} failed stage must have exitCode 1`),l=true):(r(s.exitCode===0,`${i$1} skipped stage must have exitCode 0`),r(s.durationMs===0,`${i$1} skipped stage must have durationMs 0`)),o===0&&((d?.status==="failed"||s.status==="failed")&&r(t?.status==="skipped","baseline must be skipped when sync or model fails"),t?.status==="skipped"&&r(d?.status==="failed"||s.status==="failed"||s.status==="skipped","baseline may be skipped only after an upstream failure"),t?.status!=="passed"&&(l=true));}let m=a$2.preflight.some(o=>o.status==="failed")||a$2.stages.some(o=>o.status==="failed"),E=a$2.stages.some(o=>o.status==="blocked"),n=m?"failed":E?"blocked":"passed",u=n==="failed"?1:n==="blocked"?2:0;r(a$2.status===n,`status must be ${n}`),r(a$2.exitCode===u,`exitCode must be ${u}`);}var le=a.intelligenceRun,de=b.intelligenceRun,ae=le;async function $e(a$4){let t=se.resolve(a$4.workspacePath),d$1=[],l$2=[],m$1=false,E=async(e,p)=>{let f=[...h[e]];if(m$1){d$1.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:f,message:"skipped because a required upstream operation failed"});return}let k=Date.now();try{let c=await p();d$1.push({id:e,status:"passed",result:c.result,durationMs:Date.now()-k,artifacts:f,message:c.message});}catch(c){m$1=true,d$1.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-k,artifacts:f,message:c instanceof Error?c.message:String(c)});}},n$1=async(e,p)=>{let f=[...i[e].produces];if(m$1){l$2.push({id:e,status:"skipped",durationMs:0,artifacts:f,exitCode:0,message:"skipped because a required upstream stage failed"});return}let k=Date.now();try{let c=await p(),b=c.exitCode??0;l$2.push({id:e,status:c.blocked||b!==0?"blocked":"passed",durationMs:Date.now()-k,artifacts:f,exitCode:b,message:c.message});}catch(c){m$1=true,l$2.push({id:e,status:"failed",durationMs:Date.now()-k,artifacts:f,exitCode:1,message:c instanceof Error?c.message:String(c)});}};await E("sync",async()=>{let e=await d(t,true),p=await l({workspacePath:t});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${p.contract.projects.length} projects`}});let u,o$2=()=>{if(!u)throw new Error("canonical workspace model is unavailable");return u};await n$1("model",async()=>(u=await k({workspacePath:t,includeEvidence:true}),await n(u,t),{message:`${u.summary.projectCount} projects modeled`}));let i$1=se.join(t,a.snapshot),s=false;await E("baseline",async()=>{if(!await ce.pathExists(i$1)){let e=await j({workspacePath:t,model:o$2()});return await k$1(e,t),s=true,{result:"created",message:"initial structural baseline created"}}return {result:"reused",message:"existing structural baseline reused"}}),await n$1("diff",async()=>{let e=await l$1({workspacePath:t,fromPath:a.snapshot,model:o$2()});return await m(e,t),{message:e.summary.changed?"workspace changes detected":"no workspace changes"}}),await n$1("impact",async()=>{let e=await o({workspacePath:t,fromPath:a.diff});return await p(e,t),{message:`${e.summary.risk} risk; ${e.summary.affectedProjects} affected`}}),await n$1("doctor-evidence",async()=>{let e=await q({workspace:t,json:true,quiet:true});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await n$1("contract-evidence",async()=>{let e=await o$1({workspacePath:t,strict:true});return await p$1({workspacePath:t,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await n$1("analyze-evidence",async()=>{let e=await a$2({workspacePath:t,json:true,strict:false});return {blocked:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await n$1("readiness-evidence",async()=>{let e=await a$3({startPath:t,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await n$1("verify",async()=>{let e=await f({workspacePath:t,fromImpactPath:a.impact});await g(e,t);let p=h$1(e,{strict:a$4.strict===true});return await j$1(t,e$1(e,p.passed)),{blocked:!p.passed,exitCode:p.exitCode,message:`${e.summary.verdict}; gate ${p.passed?"passed":"blocked"}`}}),await n$1("context",async()=>{u=await k({workspacePath:t,includeEvidence:true});let e=await e$2({workspacePath:t,model:u,agent:a$4.agent??"generic",includeEvidence:true});return await f$1(e,t),{message:`context grounded for ${e.agent}`}}),await n$1("agent-sync",async()=>({message:`${(await k$2({workspacePath:t,agent:a$4.agent??"generic",write:true,refreshContext:false,strict:false,preset:"enterprise"})).writtenFiles.length} grounding files written`})),await n$1("explain",async()=>{let e=await b$1({workspacePath:t,target:{kind:"release-blocked"}});return await c(e,t),{message:e.summary}});let re=l$2.some(e=>e.status==="blocked"),W=m$1?"failed":re?"blocked":"passed",ie=m$1?1:W==="blocked"?2:0,R={schemaVersion:de,chainSchemaVersion:a$1,generatedAt:new Date().toISOString(),workspacePath:t,baselineCreated:s,preflight:d$1,status:W,exitCode:ie,stages:l$2,artifactPath:ae};return te(R),await e(t,ae,R),R}export{le as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,de as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,$e as runWorkspaceIntelligenceChain};
@@ -1 +1 @@
1
- export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-RWRLFSKW.js';
1
+ export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-NAJCUQ4X.js';
@@ -0,0 +1,10 @@
1
+ function r(t){return String(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function s(t){return Array.isArray(t)?JSON.stringify(t):String(t??"")}function l(t){let o=new Map(t.entities.map(e=>[e.id,e])),d={"@context":{wsp:"https://workspai.dev/ns/workspace#",id:"@id",type:"@type",label:"https://www.w3.org/2000/01/rdf-schema#label",from:{"@id":"wsp:from","@type":"@id"},to:{"@id":"wsp:to","@type":"@id"},proof:{"@id":"wsp:proof","@type":"@id"}},"@id":`urn:workspai:workspace:${encodeURIComponent(t.workspace.name)}`,"@type":"wsp:WorkspaceKnowledgeGraph",generatedAt:t.generatedAt,sourceHash:t.source.hash,"@graph":[...t.entities.map(e=>({"@id":`urn:workspai:entity:${encodeURIComponent(e.id)}`,"@type":`wsp:${e.kind}`,label:e.label,...e.projectId?{projectId:e.projectId}:{},identityKey:e.identity.key,attributes:e.attributes,proof:e.proofIds.map(n=>`urn:workspai:proof:${encodeURIComponent(n)}`)})),...t.relations.map(e=>({"@id":`urn:workspai:relation:${encodeURIComponent(e.id)}`,"@type":`wsp:${e.kind}`,from:`urn:workspai:entity:${encodeURIComponent(e.from)}`,to:`urn:workspai:entity:${encodeURIComponent(e.to)}`,fromLabel:o.get(e.from)?.label??e.from,toLabel:o.get(e.to)?.label??e.to,derivation:e.derivation,trust:e.trust,confidence:e.confidence,proof:e.proofIds.map(n=>`urn:workspai:proof:${encodeURIComponent(n)}`)})),...t.proofs.map(e=>({"@id":`urn:workspai:proof:${encodeURIComponent(e.id)}`,"@type":"wsp:Evidence",provider:e.provider,artifact:e.artifact,...e.pointer?{pointer:e.pointer}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}))]};return JSON.stringify(d,null,2)}function g(t){let o=t.entities.map(e=>{let n=Object.entries(e.attributes).sort(([a],[i])=>a.localeCompare(i)).map(([a,i])=>` <data key="attributes">${r(`${a}=${s(i)}`)}</data>`).join(`
2
+ `);return [` <node id="${r(e.id)}">`,` <data key="kind">${r(e.kind)}</data>`,` <data key="label">${r(e.label)}</data>`,...e.projectId?[` <data key="projectId">${r(e.projectId)}</data>`]:[],...n?[n]:[]," </node>"].join(`
3
+ `)}).join(`
4
+ `),d=t.relations.map(e=>[` <edge id="${r(e.id)}" source="${r(e.from)}" target="${r(e.to)}">`,` <data key="relationKind">${r(e.kind)}</data>`,` <data key="trust">${r(e.trust)}</data>`,` <data key="confidence">${r(e.confidence)}</data>`," </edge>"].join(`
5
+ `)).join(`
6
+ `);return ['<?xml version="1.0" encoding="UTF-8"?>','<graphml xmlns="http://graphml.graphdrawing.org/xmlns">',' <key id="kind" for="node" attr.name="kind" attr.type="string"/>',' <key id="label" for="node" attr.name="label" attr.type="string"/>',' <key id="projectId" for="node" attr.name="projectId" attr.type="string"/>',' <key id="attributes" for="node" attr.name="attributes" attr.type="string"/>',' <key id="relationKind" for="edge" attr.name="kind" attr.type="string"/>',' <key id="trust" for="edge" attr.name="trust" attr.type="string"/>',' <key id="confidence" for="edge" attr.name="confidence" attr.type="string"/>',` <graph id="${r(t.workspace.name)}" edgedefault="directed">`,o,d," </graph>","</graphml>"].join(`
7
+ `)}function m(t){let o=t.entities.map(e=>` <node id="${r(e.id)}" label="${r(e.label)}"><attvalues><attvalue for="0" value="${r(e.kind)}"/><attvalue for="1" value="${r(e.projectId??"")}"/></attvalues></node>`).join(`
8
+ `),d=t.relations.map((e,n)=>` <edge id="${n}" source="${r(e.from)}" target="${r(e.to)}" label="${r(e.kind)}" weight="${e.confidence==="high"?1:e.confidence==="medium"?.66:.33}"/>`).join(`
9
+ `);return ['<?xml version="1.0" encoding="UTF-8"?>','<gexf xmlns="http://gexf.net/1.3" version="1.3">',` <meta lastmodifieddate="${r(t.generatedAt.slice(0,10))}"><creator>Workspai</creator><description>${r(t.workspace.name)} evidence-backed workspace graph</description></meta>`,' <graph mode="static" defaultedgetype="directed">',' <attributes class="node"><attribute id="0" title="kind" type="string"/><attribute id="1" title="projectId" type="string"/></attributes>'," <nodes>",o," </nodes>"," <edges>",d," </edges>"," </graph>","</gexf>"].join(`
10
+ `)}export{m as renderWorkspaceKnowledgeGraphGexf,g as renderWorkspaceKnowledgeGraphGraphMl,l as renderWorkspaceKnowledgeGraphJsonLd};
@@ -0,0 +1,3 @@
1
+ import {b}from'./chunk-4HDYADHT.js';import {d,c as c$2,f,e as e$1}from'./chunk-WDKNMTJQ.js';import {c as c$1,e}from'./chunk-VU7NZHPM.js';import {c as c$4,b as b$1}from'./chunk-CRHYBQI3.js';import {d as d$2}from'./chunk-LHOZXC2M.js';import {d as d$3}from'./chunk-OW42TZFB.js';import {h}from'./chunk-37CVKXBD.js';import {c as c$3}from'./chunk-NAJCUQ4X.js';import {e as e$2}from'./chunk-T4YR4RAI.js';import {d as d$1}from'./chunk-32OJDBIG.js';import {a as a$2}from'./chunk-KB44JP4M.js';import {a as a$1,c}from'./chunk-BMWFQXGW.js';import {r}from'./chunk-5XATWNME.js';import u from'path';import N from'readline';import g from'fs-extra';var L=a$1.agentIndex,q=new Map(Object.keys(a$1).flatMap(e=>{let t=c[e];return t?[[a$1[e],t]]:[]}));function M(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var J=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceKnowledgeGraph",description:"Read the current proof-backed workspace knowledge graph artifact",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceEvaluation",description:"Read the live or finalized provenance-aware model usage and verified-outcome report",inputSchema:{type:"object",properties:{live:{type:"boolean",description:"Read the live report instead of the finalized last-run report"}}}},{name:"queryWorkspaceEntities",description:"List workspace knowledge entities, optionally filtered by kind",inputSchema:{type:"object",properties:{kind:{type:"string",description:"Optional entity kind"}}}},{name:"searchWorkspaceGraph",description:"Return bounded, proof-carrying workspace context matching a text query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text, path, symbol, service, or concept to find"},kind:{type:"string",description:"Optional entity kind filter"},limit:{type:"integer",minimum:1,maximum:100,default:12}},required:["query"]}},{name:"getWorkspaceGraphEvidence",description:"Resolve portable evidence for a knowledge graph entity or relation",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]}},{name:"findWorkspaceGraphPath",description:"Find a shortest proof-carrying path between two workspace entities",inputSchema:{type:"object",properties:{from:{type:"string"},to:{type:"string"}},required:["from","to"]}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function H(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!u.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function a(e,t){if(!H(t))throw new Error(`Unsafe artifact path: ${t}`);let r$1=await d$1(e,t)??u.join(e,t);if(!await g.pathExists(r$1))return null;let n=await g.readJson(r$1),o=r(t),c=q.get(o);if(c&&a$2(n,c,`MCP artifact ${o}`),o===a$1.knowledgeGraph){let p=u.join(e,h);if(!await g.pathExists(p))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let l=await g.readJson(p);c$3(n,l);}return n}async function F(e$1){let t=[],r=new Set,o=((await a(e$1,d$3))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$3,reasons:o});for(let i of o)r.add(i);}let c=await a(e$1,c$4);if(e(c)){let i=(c.blockingReasons??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(i.length>0){t.push({artifact:c$4,reasons:i});for(let s of i)r.add(s);}}let p=await a(e$1,e$2),l=(p?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(l.length>0||String(p?.status??"").toLowerCase()==="failed"){let i=l.length>0?l:["Workspace contract verification failed"];t.push({artifact:e$2,reasons:i});for(let s of i)r.add(s);}return {blockingReasons:[...r],sources:t}}async function I(e$2,t,r){switch(t){case "getWorkspaceModel":return a(e$2,h);case "getWorkspaceKnowledgeGraph":return a(e$2,a$1.knowledgeGraph);case "getWorkspaceEvaluation":return a(e$2,r.live===true?a$1.evaluationLive:a$1.evaluationLastRun);case "queryWorkspaceEntities":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=String(r.kind??"").trim();return {schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,entities:e$1(n,o||void 0)}}case "searchWorkspaceGraph":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=typeof r.limit=="number"?r.limit:Number(r.limit??12);return f(n,{query:String(r.query??""),...typeof r.kind=="string"&&r.kind.trim()?{kind:r.kind.trim()}:{},limit:Number.isFinite(o)?o:12})}case "getWorkspaceGraphEvidence":{let n=await a(e$2,a$1.knowledgeGraph);return n?c$2(n,String(r.query??"")):null}case "findWorkspaceGraphPath":{let n=await a(e$2,a$1.knowledgeGraph);return n?d(n,String(r.from??""),String(r.to??"")):null}case "getEvidenceIndex":return a(e$2,L);case "getBlockers":return F(e$2);case "getSafeCommands":return {safeCommands:(await a(e$2,d$2))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,d$2);if(!n)return null;let o=String(r.project??"").trim(),c=n.scope?.activeProject??void 0,p=o||c,l=Array.isArray(n.projects)?n.projects:[],i=p&&l.find(s=>typeof s.name=="string"&&s.name.toLowerCase()===p.toLowerCase());return {workspace:n.workspace??null,scope:n.scope??null,validation:n.validation??null,project:i??null,safeCommands:n.safeCommands??[]}}case "getArtifact":{let n=String(r.relativePath??"").trim();return a(e$2,n)}case "listOperationalSkills":return a(e$2,b$1);case "getWorkspaceExplain":{let n=String(r.target??"release-blocked").trim(),o=c$1(n);if(!o)throw new Error(`Invalid explain target: ${n}`);let c=await a(e$2,c$4);return e(c)&&M(c.target,o)?c:b({workspacePath:e$2,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}function R(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
2
+ `);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
3
+ `);}async function ce(e){let t=u.resolve(e.workspacePath),r=N.createInterface({input:process.stdin,terminal:false});for await(let n of r){let o=n.trim();if(!o)continue;let c;try{c=JSON.parse(o);}catch{E(null,"Invalid JSON-RPC request");continue}let{id:p,method:l,params:i}=c;try{if(l==="initialize"){R(p,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(l==="notifications/initialized")continue;if(l==="tools/list"){R(p,{tools:J.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}))});continue}if(l==="tools/call"){let s=String(i?.name??""),K=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},S=await I(t,s,K);R(p,{content:[{type:"text",text:JSON.stringify(S,null,2)}],isError:S==null});continue}E(p,`Unsupported method: ${l??"unknown"}`);}catch(s){E(p,s instanceof Error?s.message:String(s));}}}async function pe(e,t,r={}){return I(u.resolve(e),t,r)}export{J as WORKSPACE_MCP_READ_TOOLS,pe as invokeMcpToolForTest,ce as runWorkspaceMcpServe};
@@ -1 +1 @@
1
- export{h as WORKSPACE_MODEL_REPORT_PATH,g as WORKSPACE_MODEL_SCHEMA_VERSION,k as buildWorkspaceModel,l as buildWorkspaceModelCached,j as buildWorkspaceModelFacts,m as buildWorkspaceModelIncremental,i as validateWorkspaceModelStrict,n as writeWorkspaceModel}from'./chunk-ZDN7RHXJ.js';
1
+ export{h as WORKSPACE_MODEL_REPORT_PATH,g as WORKSPACE_MODEL_SCHEMA_VERSION,k as buildWorkspaceModel,l as buildWorkspaceModelCached,j as buildWorkspaceModelFacts,m as buildWorkspaceModelIncremental,i as validateWorkspaceModelStrict,n as writeWorkspaceModel}from'./chunk-37CVKXBD.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-7VLCK5JW.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-RHQW3DTP.js';
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-E2KJ5QWY.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-HDXNIN4N.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-ZM5NQ5Z2.js';
1
+ export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-OW42TZFB.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-PRTR2DQ2.js';import {m as m$1}from'./chunk-37CVKXBD.js';import {b as b$1}from'./chunk-J5ENLXDF.js';import {a as a$1}from'./chunk-KB44JP4M.js';import P from'fs';var w="workspace-watch-event.v1";function b(e){return a$1(e,"contracts/workspace-watch-event.v1.json","Workspace watch event"),e}function g(e){return `${e.from}\0${e.to}\0${e.kind}`}function f(e){return (e.graph?.edges??[]).map(o=>({from:o.from,to:o.to,kind:o.kind}))}function m(e){let r=[...a(e).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(e).map(g).sort((a,n)=>a.localeCompare(n));return b$1({projects:r,edges:c})}function R(e,o){let r=a(o),c=e?a(e):new Map,a$1=[],n=[];for(let[t,s]of r.entries())c.has(t)?c.get(t)!==s&&a$1.push(t):n.push(t);let d=[];for(let t of c.keys())r.has(t)||d.push(t);let i=new Map(e?f(e).map(t=>[g(t),t]):[]),l=new Map(f(o).map(t=>[g(t),t])),p=[];for(let[t,s]of l.entries())i.has(t)||p.push(s);let h=[];for(let[t,s]of i.entries())l.has(t)||h.push(s);let u=(t,s)=>g(t).localeCompare(g(s));return a$1.sort((t,s)=>t.localeCompare(s)),n.sort((t,s)=>t.localeCompare(s)),d.sort((t,s)=>t.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(o,r){this.rebuild=r?.rebuild??(()=>m$1({...o})),this.now=r?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let o=Date.now(),{model:r}=await this.rebuild();return this.model=r,this.buildEvent("ready","initial",null,r,Date.now()-o)}async pulse(){let o=Date.now(),r=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(r,c)?"changed":"unchanged",a,r,c,Date.now()-o);return this.model=c,n}hasStructuralChange(o,r){return o?m(o)!==m(r):true}buildEvent(o,r,c,a,n){let d=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,kind:o,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:r,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(e){if(!e)return false;let o=e.split(/[\\/]/).filter(Boolean);if(o.some(r=>C.has(r)))return false;for(let r=0;r<o.length-1;r+=1)if((o[r]===".workspai"||o[r]===".rapidkit")&&y.has(o[r+1]))return false;return true}async function I(e){let o=new k(e.buildOptions,e.engineOptions),r=await o.start();if(e.emit(r),o.currentModel&&await e.onModel?.(o.currentModel,r),e.once)return;let c=e.debounceMs??250,a=e.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let t=await o.pulse();e.emit(t),o.currentModel&&await e.onModel?.(o.currentModel,t);}catch(t){e.emit(b({schemaVersion:w,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:o.currentModel?m(o.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:t instanceof Error?t.message:String(t)}));}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=t=>{S(t)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};e.onProgress?.(`Watching ${e.workspacePath} for changes (Ctrl+C to stop).`);let u=P.watch(e.workspacePath,{recursive:true},(t,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(t=>{let s=()=>{n&&clearTimeout(n),u.close(),t();};if(e.signal){if(e.signal.aborted){s();return}e.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
package/docs/GLOSSARY.md CHANGED
@@ -24,33 +24,37 @@ CI workflows, and AI consumers.
24
24
 
25
25
  ## Intelligence and governance
26
26
 
27
- | Term | Plain-language meaning |
28
- | --------------- | -------------------------------------------------------------------------------------------------------------------------------- |
29
- | Unified runner | `workspace intelligence run`; the supported way to execute the complete intelligence chain in contract order. |
30
- | Preflight | `sync` and baseline resolution. These prepare the run but are not stages in the 11-stage intelligence chain. |
31
- | Stage | One contract-defined operation in the intelligence chain. Stage order comes from `workspace-intelligence-chain.v1.json`. |
32
- | Gate | A decision that can pass, need attention, or block automation according to evidence and policy. |
33
- | Blocked | The command completed, but evidence or policy prevents the requested release/action. The unified runner uses exit code `2`. |
34
- | Failed | Execution itself failed. The unified runner uses exit code `1`. |
35
- | Needs attention | Evidence is usable but contains warnings or non-blocking gaps. Strict policy can promote it to a blocking result. |
36
- | Fresh / stale | Whether an artifact still matches its governed inputs and dependency closure. A recent timestamp alone does not prove freshness. |
37
- | Snapshot | A stable baseline of the model used for later comparison. |
38
- | Diff | The structural change between the current model and a baseline model or snapshot. |
39
- | Impact | Direct and transitive consequences of a model diff, including verification scope and risk. |
40
- | Verify | The evidence-backed gate over the affected dependency subgraph and workspace policies. |
41
- | Context | A bounded, agent-oriented projection of current workspace evidence. |
42
- | Agent sync | Generation of tool-specific instructions, skills, prompts, indexes, and MCP metadata from canonical evidence. |
27
+ | Term | Plain-language meaning |
28
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
29
+ | Unified runner | `workspace intelligence run`; the supported way to execute the complete intelligence chain in contract order. |
30
+ | Preflight | `sync` and baseline resolution. These prepare the run but are not stages in the 11-stage intelligence chain. |
31
+ | Stage | One contract-defined operation in the intelligence chain. Stage order comes from `workspace-intelligence-chain.v1.json`. |
32
+ | Gate | A decision that can pass, need attention, or block automation according to evidence and policy. |
33
+ | Blocked | The command completed, but evidence or policy prevents the requested release/action. The unified runner uses exit code `2`. |
34
+ | Failed | Execution itself failed. The unified runner uses exit code `1`. |
35
+ | Needs attention | Evidence is usable but contains warnings or non-blocking gaps. Strict policy can promote it to a blocking result. |
36
+ | Fresh / stale | Whether an artifact still matches its governed inputs and dependency closure. A recent timestamp alone does not prove freshness. |
37
+ | Snapshot | A stable baseline of the model used for later comparison. |
38
+ | Diff | The structural change between the current model and a baseline model or snapshot. |
39
+ | Impact | Direct and transitive consequences of a model diff, including verification scope and risk. |
40
+ | Verify | The evidence-backed gate over the affected dependency subgraph and workspace policies. |
41
+ | Context | A bounded, agent-oriented projection of current workspace evidence. |
42
+ | Agent sync | Generation of tool-specific instructions, skills, prompts, indexes, and MCP metadata from canonical evidence. |
43
+ | Evaluation | A provenance-aware record of model calls, tool activity, cost, latency, and verified task outcome produced by `workspace eval`. |
44
+ | Verified outcome | A task result supported by the workspace verification path; smaller context alone is not treated as task success. |
43
45
 
44
46
  ## AI and integration
45
47
 
46
- | Term | Plain-language meaning |
47
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
48
- | Agent grounding | Instructions and evidence references that keep an AI agent inside the correct workspace, contracts, and command loop. |
49
- | Bounded retrieval | Returning only the most relevant entities and proof paths for a question instead of injecting the complete graph or model. |
50
- | MCP | Model Context Protocol; Workspai exposes read-oriented workspace tools through `workspace mcp serve`. |
51
- | Module recommender | The optional embedding-based FastAPI/NestJS recommendation feature. It is separate from deterministic Workspace Intelligence. |
52
- | Canonical path | The current `.workspai` path that new writers and consumers should prefer. |
53
- | Legacy path | A `.rapidkit` compatibility path read for older workspaces; it is not the target for new integrations. |
48
+ | Term | Plain-language meaning |
49
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
50
+ | Agent grounding | Instructions and evidence references that keep an AI agent inside the correct workspace, contracts, and command loop. |
51
+ | Bounded retrieval | Returning only the most relevant entities and proof paths for a question instead of injecting the complete graph or model. |
52
+ | Retrieval benchmark | A deterministic comparison of readable proof-source corpus size with one bounded graph response; it is not billing evidence. |
53
+ | Token provenance | Whether a token value was provider-reported, counted by a named tokenizer, estimated, or unavailable. |
54
+ | MCP | Model Context Protocol; Workspai exposes read-oriented workspace tools through `workspace mcp serve`. |
55
+ | Module recommender | The optional embedding-based FastAPI/NestJS recommendation feature. It is separate from deterministic Workspace Intelligence. |
56
+ | Canonical path | The current `.workspai` path that new writers and consumers should prefer. |
57
+ | Legacy path | A `.rapidkit` compatibility path read for older workspaces; it is not the target for new integrations. |
54
58
 
55
59
  ## Where to continue
56
60
 
@@ -1,11 +1,14 @@
1
1
  # Workspai Practical User Scenarios (Open Source Edition)
2
2
 
3
- Practical workflows for OSS teams using the npm CLI. Command syntax: [commands-reference.md](./commands-reference.md). Import/adopt details: [workspace-operations.md](./workspace-operations.md).
3
+ This guide shows complete, copyable ways to use Workspai on real projects:
4
+ connect existing code, create new applications, prepare AI context, check
5
+ changes, and use the same results in CI.
4
6
 
5
- All scenarios use the same [Unified Workspace Intelligence Runner](./workspace-intelligence-runner.md):
6
- `sync` and baseline resolution are reported separately from the exact 11-stage
7
- chain. Treat exit `1` as an execution failure and exit `2` as an evidence-blocked
8
- completed run that requires remediation before release.
7
+ Command syntax: [commands-reference.md](./commands-reference.md). Import and
8
+ adopt behavior: [workspace-operations.md](./workspace-operations.md). All
9
+ scenarios use the same
10
+ [Workspace Intelligence runner](./workspace-intelligence-runner.md), so the
11
+ system map, checks, and saved reports stay consistent.
9
12
 
10
13
  ## Scenario 0 — Existing project (adopt or import)
11
14
 
@@ -16,7 +19,7 @@ Goal: connect code you already have without reshuffling repositories.
16
19
  ```bash
17
20
  npx workspai adopt /path/to/existing-app --workspace /path/to/workspace --json
18
21
  cd /path/to/workspace
19
- npx workspai workspace intelligence run --for-agent codex --strict --json
22
+ npx workspai workspace intelligence run --for-agent generic --strict --json
20
23
  cd /path/to/existing-app
21
24
  npx workspai doctor project --json
22
25
  ```
@@ -78,7 +81,7 @@ release or agent input:
78
81
 
79
82
  ```bash
80
83
  cd ..
81
- npx workspai workspace intelligence run --for-agent codex --strict --json
84
+ npx workspai workspace intelligence run --for-agent generic --strict --json
82
85
  ```
83
86
 
84
87
  The canonical durable outputs are `.workspai/reports/workspace-model.json`,
@@ -197,7 +200,7 @@ loading every source file or the complete graph into a model prompt.
197
200
 
198
201
  ```bash
199
202
  cd my-workspace
200
- npx workspai workspace intelligence run --for-agent codex --strict --json
203
+ npx workspai workspace intelligence run --for-agent generic --strict --json
201
204
  npx workspai workspace graph search "authentication endpoint" --limit 12 --json
202
205
  npx workspai workspace graph benchmark "authentication endpoint" --limit 12 --json
203
206
  npx workspai workspace mcp serve
package/docs/README.md CHANGED
@@ -1,29 +1,61 @@
1
1
  # Workspai NPM — Documentation Index
2
2
 
3
- Hub for user and contributor documentation. Start with the [main README](../README.md) for install and quickstarts.
3
+ Workspai helps people and tools understand the same software system. Use these
4
+ guides to connect existing projects, create new ones, map their relationships,
5
+ check changes, prepare AI context, and automate release checks.
4
6
 
5
- `workspai` is the canonical package and command; `wspai` is only an optional
6
- short `npx` alias. Install with `npm install -g workspai`, or run the current
7
- release with `npx workspai@latest --help`.
7
+ Start with the [main README](../README.md) for the product overview, or use the
8
+ quickstart below. `workspai` is the main package and command; `wspai` is only a
9
+ shorter optional name.
8
10
 
9
- ## Canonical quickstart
11
+ ## Quickstart: connect an existing project
12
+
13
+ Connect an existing project without moving it, then create one saved,
14
+ checkable view for developers, CI, IDEs, MCP clients, and AI agents:
15
+
16
+ ```bash
17
+ cd /absolute/path/to/project
18
+ npx workspai adopt .
19
+ ```
20
+
21
+ `adopt` keeps the project in place and creates or reuses the minimal default
22
+ workspace. Without the VS Code extension, copy the exact `Next shell step`
23
+ printed by the CLI and continue in that workspace terminal:
10
24
 
11
25
  ```bash
12
- npx workspai adopt /path/to/project --json
13
26
  cd ~/.workspai/workspaces/workspai
14
- npx workspai workspace intelligence run --for-agent codex --strict --json
27
+ npx workspai workspace intelligence run --for-agent generic --strict --json
15
28
  ```
16
29
 
17
- The broader governance/release pipeline is a separate gate:
30
+ Use `generic` for a vendor-neutral context pack, or select `codex`, `claude`,
31
+ `cursor`, or `orca`. Agent Sync also publishes shared files for GitHub Copilot,
32
+ VS Code, and `AGENTS.md` consumers.
33
+
34
+ Use the release pipeline when you need the broader release workflow:
18
35
 
19
36
  ```bash
20
37
  npx workspai pipeline --json --strict
21
38
  ```
22
39
 
23
- Adoption keeps source in place. The runner preserves contract order and writes
24
- the authoritative `.workspai/reports/workspace-intelligence-run-last-run.json`
25
- result alongside the model, agent context, report index, and generated
26
- instructions; see the [Artifact Catalog](./contracts/ARTIFACT_CATALOG.md).
40
+ Adoption keeps source in place. The command maps the system and its
41
+ connections, checks what changes may affect, runs health and release checks,
42
+ and prepares focused AI context under `.workspai/`. When the workspace is not
43
+ ready, the report shows the reason and points to the files or reports behind
44
+ it. Automation details and supported AI tools are documented in the
45
+ [Unified runner](./workspace-intelligence-runner.md). See the
46
+ [Artifact Catalog](./contracts/ARTIFACT_CATALOG.md) for exact paths, writers,
47
+ schemas, and consumers.
48
+
49
+ To start with a new workspace instead:
50
+
51
+ ```bash
52
+ npx workspai create workspace my-workspace --profile minimal --yes
53
+ cd ~/.workspai/workspaces/my-workspace
54
+ npx workspai create project nextjs web --yes
55
+ ```
56
+
57
+ From the workspace terminal, create a project, use `adopt` to link one in place,
58
+ or use `import` to copy or clone one into the workspace.
27
59
 
28
60
  ## Table of contents
29
61
 
@@ -37,16 +69,18 @@ instructions; see the [Artifact Catalog](./contracts/ARTIFACT_CATALOG.md).
37
69
 
38
70
  ## Choose a guide by goal
39
71
 
40
- | I want to… | Start here | Expected outcome |
41
- | ---------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------- |
42
- | Create a workspace or project | [Creating workspaces and projects](./creating-workspaces-and-projects.md) | A registered project with canonical `.workspai` metadata |
43
- | Bring an existing repository under governance | [Workspace operations](./workspace-operations.md#import-and-adoption) | Source stays in place with `adopt`, or is copied/cloned with `import` |
44
- | Run the complete intelligence loop | [Unified runner](./workspace-intelligence-runner.md) | One ordered run report with durable stage evidence |
45
- | Ask an architecture or dependency question | [Workspace Knowledge Graph](./workspace-knowledge-graph.md) | A bounded answer with proof references rather than the whole graph |
46
- | Integrate CI or release gates | [CI workflows](./ci-workflows.md) | Machine-readable exit codes and uploadable evidence |
47
- | Find the writer, schema, or path for an output | [Artifact Catalog](./contracts/ARTIFACT_CATALOG.md) | One canonical source instead of path guessing |
48
- | Understand Workspai terminology | [Glossary](./GLOSSARY.md) | Shared meanings for model, graph, evidence, gate, and artifacts |
49
- | Contribute to the CLI | [Development](./DEVELOPMENT.md) | Local build, test, contract, and documentation gates |
72
+ | I want to… | Start here | Expected outcome |
73
+ | ------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------- |
74
+ | Create a workspace or project | [Creating workspaces and projects](./creating-workspaces-and-projects.md) | A registered project with canonical `.workspai` metadata |
75
+ | Bring an existing repository under governance | [Workspace operations](./workspace-operations.md#import-and-adoption) | Source stays in place with `adopt`, or is copied/cloned with `import` |
76
+ | Run the complete intelligence loop | [Unified runner](./workspace-intelligence-runner.md) | One ordered run report with durable stage evidence |
77
+ | Ask an architecture or dependency question | [Workspace Knowledge Graph](./workspace-knowledge-graph.md) | A bounded answer with proof references rather than the whole graph |
78
+ | Measure agent token, cost, and outcome efficiency | [Workspace Intelligence Evaluation](./workspace-intelligence-evaluation.md) | A live, provenance-aware report suitable for CLI, IDE, and CI |
79
+ | Integrate CI or release gates | [CI workflows](./ci-workflows.md) | Machine-readable exit codes and uploadable evidence |
80
+ | Find the writer, schema, or path for an output | [Artifact Catalog](./contracts/ARTIFACT_CATALOG.md) | One canonical source instead of path guessing |
81
+ | Understand Workspai terminology | [Glossary](./GLOSSARY.md) | Shared meanings for model, graph, evidence, gate, and artifacts |
82
+ | Review or change the main product README | [README content contract](./README_CONTENT_CONTRACT.md) | Stable narrative, claim boundaries, and machine-enforced drift rules |
83
+ | Contribute to the CLI | [Development](./DEVELOPMENT.md) | Local build, test, contract, and documentation gates |
50
84
 
51
85
  There are two different AI-facing features. Workspace Intelligence is
52
86
  deterministic, proof-backed, and does not require an AI API key. The optional
@@ -64,7 +98,9 @@ with [AI Quickstart](./AI_QUICKSTART.md) only when that is your goal.
64
98
  | [workspace-intelligence-runner.md](./workspace-intelligence-runner.md) | Canonical unified runner, execution envelope, report schema, exit codes, failure propagation, and CI consumption |
65
99
  | [workspace-knowledge-graph.md](./workspace-knowledge-graph.md) | Two-minute graph quickstart, proof model, AI/MCP consumption, performance, and honest token-efficiency measurement |
66
100
  | [graph-benchmark-methodology.md](./graph-benchmark-methodology.md) | Reproducible payload-reduction benchmark, formulas, claim boundaries, and publication rules |
101
+ | [workspace-intelligence-evaluation.md](./workspace-intelligence-evaluation.md) | Provider usage, cost provenance, verified outcomes, comparison, and extension consumption |
67
102
  | [GLOSSARY.md](./GLOSSARY.md) | Plain-language definitions for workspace, model, graph, evidence, gates, and AI integrations |
103
+ | [README_CONTENT_CONTRACT.md](./README_CONTENT_CONTRACT.md) | Required root README journey, architecture statements, claim policy, and drift guard |
68
104
  | [create-planner-capabilities.md](./create-planner-capabilities.md) | Native create, official, and existing lanes |
69
105
  | [../contracts/project-entry-capability.v1.json](../contracts/project-entry-capability.v1.json) | Contract: any readable project can enter through adopt/import when it can be registered |
70
106
  | [from-code-to-shared-understanding.md](./from-code-to-shared-understanding.md) | GitHub-rendered Workspace Intelligence diagram |
@@ -79,7 +115,7 @@ with [AI Quickstart](./AI_QUICKSTART.md) only when that is your goal.
79
115
  - Create a workspace or project: [creating-workspaces-and-projects.md](./creating-workspaces-and-projects.md)
80
116
  - Adopt an existing repo: [workspace-operations.md#import-and-adoption](./workspace-operations.md#import-and-adoption)
81
117
  - Scaffold a frontend app: [commands-reference.md](./commands-reference.md) (`create project nextjs <name>`)
82
- - Canonical intelligence gate: `workspace intelligence run --for-agent codex --strict --json`
118
+ - Canonical intelligence gate: `workspace intelligence run --for-agent generic --strict --json`
83
119
  - Broader CI release gate: [commands-reference.md](./commands-reference.md) (`pipeline`, `readiness`)
84
120
  - Targeted model/context inspection — schemas in [contracts/workspace-intelligence/](../contracts/workspace-intelligence/)
85
121
 
@@ -158,7 +194,10 @@ workspai/
158
194
  ├── releases/ # Per-version release notes
159
195
  └── docs/
160
196
  ├── README.md # This index
197
+ ├── README_CONTENT_CONTRACT.md
161
198
  ├── commands-reference.md
199
+ ├── workspace-knowledge-graph.md
200
+ ├── workspace-intelligence-evaluation.md
162
201
  ├── workspace-operations.md
163
202
  ├── workspace-run.md
164
203
  ├── ci-workflows.md