workspai 0.48.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 (39) hide show
  1. package/README.md +70 -54
  2. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
  3. package/contracts/extension-cli-compatibility.v1.json +2 -1
  4. package/contracts/published-contract-catalog.v1.json +5 -0
  5. package/contracts/runtime-command-surface.v1.json +18 -2
  6. package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
  7. package/dist/autopilot-release-R4XRTWEM.js +1 -0
  8. package/dist/{chunk-I46XEIPL.js → chunk-EKZLUMCS.js} +2 -2
  9. package/dist/{chunk-5S3DJQEP.js → chunk-K4X3DM7R.js} +1 -1
  10. package/dist/{chunk-Y5UJLPS4.js → chunk-TIE2XMGH.js} +2 -2
  11. package/dist/{create-DBQNAMKP.js → create-S64IWHAP.js} +1 -1
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.js +108 -108
  14. package/dist/{pipeline-TQM43A3K.js → pipeline-LHTPE3DR.js} +1 -1
  15. package/dist/{workspace-NCWRINEF.js → workspace-PJPRBUMQ.js} +1 -1
  16. package/dist/{workspace-foundation-WXJ6I7ES.js → workspace-foundation-WPLD7OEO.js} +1 -1
  17. package/dist/workspace-graph-stream-KAGGQPJT.js +1 -0
  18. package/dist/{workspace-intelligence-runner-THYLHHMF.js → workspace-intelligence-runner-OTYTHV6B.js} +1 -1
  19. package/dist/workspace-run-QND2SIYA.js +1 -0
  20. package/dist/workspace-watch-7HWGA5TF.js +1 -0
  21. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +11 -8
  22. package/docs/README.md +45 -13
  23. package/docs/README_CONTENT_CONTRACT.md +1 -1
  24. package/docs/ci-workflows.md +3 -3
  25. package/docs/commands-reference.md +2 -2
  26. package/docs/contracts/ARTIFACT_CATALOG.md +7 -1
  27. package/docs/creating-workspaces-and-projects.md +16 -12
  28. package/docs/doctor-command.md +30 -28
  29. package/docs/examples/ci-agent-grounding.yml +1 -1
  30. package/docs/from-code-to-shared-understanding.md +2 -2
  31. package/docs/workspace-intelligence-evaluation.md +8 -6
  32. package/docs/workspace-intelligence-runner.md +17 -6
  33. package/docs/workspace-operations.md +13 -5
  34. package/package.json +9 -4
  35. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  36. package/dist/autopilot-release-XGVXPOZI.js +0 -1
  37. package/dist/workspace-run-RLIYSOTN.js +0 -1
  38. package/dist/workspace-watch-3BPGLFLB.js +0 -1
  39. /package/dist/{chunk-QNONOO4F.js → chunk-E2KJ5QWY.js} +0 -0
@@ -1,4 +1,4 @@
1
- import {a as a$3}from'./chunk-54EP5CEV.js';import {c}from'./chunk-5S3DJQEP.js';import {q}from'./chunk-BFLJ2R4D.js';import {d as d$1}from'./chunk-Y5UJLPS4.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(`
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(`
@@ -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-Y5UJLPS4.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
- import {b}from'./chunk-I46XEIPL.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-ORDK7A36.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-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
- 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-Y5UJLPS4.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
+ 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};
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-E2KJ5QWY.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-HDXNIN4N.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};
@@ -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
 
@@ -83,7 +115,7 @@ with [AI Quickstart](./AI_QUICKSTART.md) only when that is your goal.
83
115
  - Create a workspace or project: [creating-workspaces-and-projects.md](./creating-workspaces-and-projects.md)
84
116
  - Adopt an existing repo: [workspace-operations.md#import-and-adoption](./workspace-operations.md#import-and-adoption)
85
117
  - Scaffold a frontend app: [commands-reference.md](./commands-reference.md) (`create project nextjs <name>`)
86
- - Canonical intelligence gate: `workspace intelligence run --for-agent codex --strict --json`
118
+ - Canonical intelligence gate: `workspace intelligence run --for-agent generic --strict --json`
87
119
  - Broader CI release gate: [commands-reference.md](./commands-reference.md) (`pipeline`, `readiness`)
88
120
  - Targeted model/context inspection — schemas in [contracts/workspace-intelligence/](../contracts/workspace-intelligence/)
89
121
 
@@ -65,7 +65,7 @@ as one undifferentiated command wall.
65
65
  - Missing relationships mean **not proven**, not independent.
66
66
  - The graph is broader than a code graph, but it is not the entire product.
67
67
  - The canonical runner is
68
- `npx workspai workspace intelligence run --for-agent codex --strict --json`.
68
+ `npx workspai workspace intelligence run --for-agent generic --strict --json`.
69
69
  - `pipeline` is a broader governance/release orchestrator and must not be taught
70
70
  as a replacement for the intelligence chain.
71
71
  - The integrated CLI already exposes current capabilities. Future standalone
@@ -12,9 +12,9 @@ Map of GitHub Actions workflows in this repository. Use this when editing CI to
12
12
  | E2E smoke | `.github/workflows/e2e-smoke.yml` | Focused bridge regression smoke |
13
13
  | Frontend generator smoke | `.github/workflows/frontend-generator-smoke.yml` | Official frontend generator drift gate |
14
14
  | Security | `.github/workflows/security.yml` | Security scanning and policy checks |
15
- | Manual npm release | `.github/workflows/release-npm-manual.yml` | Maintainer-only release gate and publish workflow |
15
+ | Manual npm release | `.github/workflows/release-npm-manual.yml` | Maintainer-only release gate and publish workflow |
16
16
  | Contributor onboarding | `.github/workflows/contributor-onboarding.yml` | Accepted-contributor onboarding automation |
17
- | Welcome | `.github/workflows/welcome.yml` | First-issue and first-contribution messages |
17
+ | Welcome | `.github/workflows/welcome.yml` | First-issue and first-contribution messages |
18
18
 
19
19
  The release workflow requires `Frontend Generator Smoke` for the exact release
20
20
  SHA. Maintainers must dispatch that workflow against the intended release ref
@@ -29,7 +29,7 @@ For Workspai **consumer workspaces** (not this CLI repo), use the copy-paste tem
29
29
  Minimal job:
30
30
 
31
31
  ```yaml
32
- - run: npx workspai workspace intelligence run --for-agent codex --strict --json
32
+ - run: npx workspai workspace intelligence run --for-agent generic --strict --json
33
33
  - run: npx workspai pipeline --json --strict --no-agent-sync
34
34
  - run: node ./node_modules/workspai/scripts/check-agent-customization-drift.mjs --workspace .
35
35
  ```
@@ -18,7 +18,7 @@ npx workspai autopilot release [--mode <audit|safe-fix|enforce>] [--json] [--out
18
18
  Recommended CI:
19
19
 
20
20
  ```bash
21
- npx workspai workspace intelligence run --for-agent codex --strict --json
21
+ npx workspai workspace intelligence run --for-agent generic --strict --json
22
22
  ```
23
23
 
24
24
  Run the broader governance and release orchestrators as separate gates; they
@@ -67,7 +67,7 @@ npx workspai workspace impact --from <workspace-diff-report> [--workspace <path>
67
67
  npx workspai workspace verify [--from-impact <file>] [--workspace <path>] [--scope project:<name>] [--strict] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
68
68
  npx workspai workspace graph [emit|explain|search|benchmark|entities|evidence|path|overlay|dot|mermaid|jsonld|graphml|gexf] [key] [value] [--from <graph.json>] [--output <file>] [--limit <1..100>] [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
69
69
  npx workspai workspace eval [init <task> [strategy]|record|status|report|compare --from <report>] [--workspace <path>] [--output <file>] [--json]
70
- npx workspai workspace watch [--workspace <path>] [--json] [--once] [--scan-depth <count>]
70
+ npx workspai workspace watch [--workspace <path>] [--json] [--graph-stream] [--once] [--scan-depth <count>]
71
71
  npx workspai workspace explain|why <target> [--workspace <path>] [--json] [--write]
72
72
  npx workspai workspace trace --from <workspace-diff-report> [--workspace <path>] [--json] [--write]
73
73
  printf '%s\n' '{"actionId":"fix-api","summary":"API tests passed","outcome":"ok"}' | npx workspai workspace feedback record [--workspace <path>] --json
@@ -191,6 +191,12 @@ on each settled change, driven by graph-aware incremental rebuilds. Events carry
191
191
  removed projects, graph edge deltas, structural `modelHash`, and `mode`/`durationMs`. Canonical
192
192
  source: `src/workspace-watch.ts`.
193
193
 
194
+ Use `workspace watch --graph-stream --json` for the transport-neutral
195
+ `workspace-graph-stream.v1` feed consumed by IDEs. The first line is an
196
+ authoritative snapshot; subsequent lines are hash-linked, revisioned deltas.
197
+ Consumers must request a new snapshot after any revision, identity, generation,
198
+ schema, validation, or hash-continuity failure.
199
+
194
200
  **Health/impact history.** Each `workspace verify` run appends a compact record to
195
201
  `.workspai/reports/workspace-intelligence-history.json` (`workspace-intelligence-history.v1`),
196
202
  a ring buffer capped at the 50 most-recent entries (verdict, risk, freshness, gate, counts).
@@ -356,7 +362,7 @@ canonical file. Legacy files remain readable during the compatibility window.
356
362
  ## Consumer rules
357
363
 
358
364
  1. **Project count:** read `workspace-registry.v1.json` (or run `workspace registry status --json`).
359
- 2. **Workspace Intelligence chain:** run `workspace intelligence run --for-agent codex --strict --json` to preserve Model → Diff → Impact → Doctor + Contract Verify + Analyze → Readiness → Verify → Context → Agent Sync → Explain. `pipeline` is the broader governance/release orchestrator and `autopilot` is a separate release surface; neither redefines the canonical chain. Use `pipeline-last-run.json` only for the pipeline orchestration summary.
365
+ 2. **Workspace Intelligence chain:** run `workspace intelligence run --for-agent generic --strict --json` to preserve Model → Diff → Impact → Doctor + Contract Verify + Analyze → Readiness → Verify → Context → Agent Sync → Explain. `pipeline` is the broader governance/release orchestrator and `autopilot` is a separate release surface; neither redefines the canonical chain. Use `pipeline-last-run.json` only for the pipeline orchestration summary.
360
366
  3. **Do not** use `workspace.json.projects` (removed in schema 1.0).
361
367
  4. Prefer `schemaVersion` constants in each artifact; legacy `v1` on readiness is accepted when reading old reports.
362
368
  5. **Agent retrieval:** start with `AGENTS.md` and `.workspai/reports/INDEX.json`, then use `workspace graph search <query> --limit <n> --json` or MCP `searchWorkspaceGraph` for question-sized facts. Follow returned proof paths to source evidence. Read the full context, model, or graph only when the bounded result is insufficient.
@@ -1,16 +1,20 @@
1
1
  # Creating Workspaces and Projects
2
2
 
3
- This guide explains, in plain language, what Workspai does when you create a
4
- workspace or a project. It covers interactive commands, automation, project
5
- locations, workspace linking, supported kits, and the most important flags.
3
+ Use this guide when you want to start a new software system or add a new
4
+ application to an existing one. Workspai creates the files, records where the
5
+ project belongs, and makes it visible to the same checks and tools as the rest
6
+ of the workspace.
7
+
8
+ The sections below explain project locations, supported starters, interactive
9
+ commands, automation, and the most useful options.
6
10
 
7
11
  For a compact list of command syntax, see
8
12
  [commands-reference.md](./commands-reference.md).
9
13
 
10
14
  ## The two things you can create
11
15
 
12
- A **workspace** is the governed boundary that holds project registrations,
13
- policies, contracts, and Workspace Intelligence reports.
16
+ A **workspace** is the shared home for related projects, rules, and saved
17
+ Workspai reports.
14
18
 
15
19
  A **project** is an application or service, such as a FastAPI API, Go service,
16
20
  Spring Boot service, .NET API, or frontend application.
@@ -588,13 +592,13 @@ native, official, and existing-project lanes.
588
592
 
589
593
  # Failure and cleanup behavior
590
594
 
591
- | Situation | Result |
592
- | -------------------------------------------------------- | -------------------------------------- |
593
- | Invalid name | Stops before normal scaffold writes |
594
- | Target directory already exists | Stops without merging or overwriting |
595
- | Project scaffold fails | Workspace linking does not run |
596
- | Git initialization fails | Usually warns and keeps the scaffold |
597
- | Go or Maven dependency warm-up fails | Warns and keeps the scaffold |
595
+ | Situation | Result |
596
+ | -------------------------------------------------------- | --------------------------------------------------------------------------- |
597
+ | Invalid name | Stops before normal scaffold writes |
598
+ | Target directory already exists | Stops without merging or overwriting |
599
+ | Project scaffold fails | Workspace linking does not run |
600
+ | Git initialization fails | Usually warns and keeps the scaffold |
601
+ | Go or Maven dependency warm-up fails | Warns and keeps the scaffold |
598
602
  | Workspace registration/finalization fails after scaffold | Lifecycle rollback restores metadata and removes a newly owned project tree |
599
603
 
600
604
  Create finalization uses a durable lifecycle transaction. On failure it restores
@@ -1,6 +1,8 @@
1
1
  # Workspai Doctor Command
2
2
 
3
- `doctor` checks health for the npm wrapper environment in system, workspace, or project scope.
3
+ Use `doctor` to find setup and dependency problems before they interrupt
4
+ development or block a release. It can check the computer, an entire workspace,
5
+ or one project, and reports what is wrong and which fixes are available.
4
6
 
5
7
  **Related:** [workspace-operations.md](./workspace-operations.md) · [commands-reference.md](./commands-reference.md) · [Documentation index](./README.md)
6
8
 
@@ -20,7 +22,7 @@ Checks host prerequisites:
20
22
  - RapidKit Core availability
21
23
  - Go (optional)
22
24
 
23
- ### 2) Workspace Check (Canonical)
25
+ ### 2) Workspace Check
24
26
 
25
27
  ```bash
26
28
  cd my-workspace
@@ -87,11 +89,11 @@ npx workspai doctor workspace --profile enterprise-strict --json
87
89
  Doctor supports policy profiles so the same evidence can be interpreted correctly in local,
88
90
  CI, release, and enterprise gates:
89
91
 
90
- | Profile | Use when | Warning behavior |
91
- | ------------------- | -------------------------------- | ---------------------------------------- |
92
- | `local` | Developer diagnostics | Report warnings, do not block |
93
- | `ci` | CI feedback loop | Exit `2` on warnings, `1` on errors |
94
- | `release` | Release readiness gate | Exit `1` on warnings or errors |
92
+ | Profile | Use when | Warning behavior |
93
+ | ------------------- | --------------------------------- | --------------------------------------------------------- |
94
+ | `local` | Developer diagnostics | Report warnings, do not block |
95
+ | `ci` | CI feedback loop | Exit `2` on warnings, `1` on errors |
96
+ | `release` | Release readiness gate | Exit `1` on warnings or errors |
95
97
  | `enterprise-strict` | Enterprise/studio repair workflow | Exit `1`; every warning needs evidence or repair guidance |
96
98
 
97
99
  `--strict` maps to the `release` profile and `--ci` maps to the `ci` profile for backward
@@ -101,11 +103,11 @@ card is advisory locally but blocking for release.
101
103
  Doctor also attaches a **freshness contract** to evidence so tools do not treat live state as
102
104
  durable structure:
103
105
 
104
- | Freshness category | Meaning | Default TTL |
105
- | ------------------ | -------------------------------------------- | ----------- |
106
- | `structure` | Durable project/workspace shape and markers | 7 days |
106
+ | Freshness category | Meaning | Default TTL |
107
+ | ------------------ | --------------------------------------------- | ----------- |
108
+ | `structure` | Durable project/workspace shape and markers | 7 days |
107
109
  | `verification` | Test, script, lint, quality, and probe checks | 24 hours |
108
- | `state` | Live dependency/security state | 5 minutes |
110
+ | `state` | Live dependency/security state | 5 minutes |
109
111
 
110
112
  Each probe can include `freshness`, and each JSON artifact includes `evidenceFreshness`.
111
113
  Workspai and CI should refresh stale or `verifyBeforeUse` evidence before claiming a project is
@@ -113,10 +115,10 @@ ready, repaired, or release-safe.
113
115
 
114
116
  Doctor probes also include an **issue taxonomy** and **repair intent** for Studio-driven repair:
115
117
 
116
- | Field | Purpose |
117
- | ------------------- | ----------------------------------------------------------------------- |
118
- | `issueClass` | Stable category such as `security`, `test`, `container`, or `dependency` |
119
- | `operationalImpact` | Product impact such as `ci-risk`, `release-risk`, or `security-risk` |
118
+ | Field | Purpose |
119
+ | ------------------- | ------------------------------------------------------------------------------------------------------------- |
120
+ | `issueClass` | Stable category such as `security`, `test`, `container`, or `dependency` |
121
+ | `operationalImpact` | Product impact such as `ci-risk`, `release-risk`, or `security-risk` |
120
122
  | `repairIntent.mode` | Studio action mode: `edit-file`, `run-command`, `review-required`, `verify-before-fix`, or `refresh-evidence` |
121
123
 
122
124
  This lets Workspai distinguish "show guidance" from "apply an approved file edit", "run a command",
@@ -164,15 +166,15 @@ same repair evidence without guessing the workspace root.
164
166
 
165
167
  The remediation plan is intentionally ordered for Studio execution:
166
168
 
167
- | Phase | Purpose |
168
- | --- | --- |
169
- | `dependency-baseline` | Restore package/runtime dependency baselines before other fixes |
170
- | `local-environment` | Seed local env files without overwriting operator-owned values |
171
- | `source-hygiene` | Apply safe project-scoped hygiene files such as `.dockerignore` or `.gitignore` rules |
172
- | `command-contract` | Add missing test, quality, audit, or runtime command contracts |
173
- | `runtime-governance` | Run RapidKit/workspace initializers that may touch multiple project surfaces |
174
- | `manual-review` | Surface guidance that requires a human decision |
175
- | `generic-execution` | Last-resort shell remediation when no typed operation exists |
169
+ | Phase | Purpose |
170
+ | --------------------- | ------------------------------------------------------------------------------------- |
171
+ | `dependency-baseline` | Restore package/runtime dependency baselines before other fixes |
172
+ | `local-environment` | Seed local env files without overwriting operator-owned values |
173
+ | `source-hygiene` | Apply safe project-scoped hygiene files such as `.dockerignore` or `.gitignore` rules |
174
+ | `command-contract` | Add missing test, quality, audit, or runtime command contracts |
175
+ | `runtime-governance` | Run RapidKit/workspace initializers that may touch multiple project surfaces |
176
+ | `manual-review` | Surface guidance that requires a human decision |
177
+ | `generic-execution` | Last-resort shell remediation when no typed operation exists |
176
178
 
177
179
  `dependsOn` lets Workspai avoid false loops: for example, a missing test script repair can depend on
178
180
  the project dependency baseline step, so Studio can run or ask for approval in the same order Doctor
@@ -311,11 +313,11 @@ jobs:
311
313
 
312
314
  ## Exit Codes
313
315
 
314
- | Code | Meaning |
315
- | ---- | ------------------------------ |
316
- | `0` | Passed; local-profile warnings remain advisory |
316
+ | Code | Meaning |
317
+ | ---- | ------------------------------------------------------------------ |
318
+ | `0` | Passed; local-profile warnings remain advisory |
317
319
  | `1` | Errors, or warnings under `release`/`enterprise-strict`/`--strict` |
318
- | `2` | Warning-only result under the `ci` profile or `--ci` |
320
+ | `2` | Warning-only result under the `ci` profile or `--ci` |
319
321
 
320
322
  ## Enterprise Probe Extensions
321
323
 
@@ -39,7 +39,7 @@ jobs:
39
39
  # Exit 1 = hard execution failure; exit 2 = completed but evidence-blocked.
40
40
  # Continue here only so the durable run report and blocker evidence can
41
41
  # always be uploaded; the final step below still fails either outcome.
42
- run: npx workspai workspace intelligence run --for-agent codex --strict --json
42
+ run: npx workspai workspace intelligence run --for-agent generic --strict --json
43
43
  continue-on-error: true
44
44
  id: intelligence
45
45
 
@@ -62,14 +62,14 @@ render Mermaid. When this source changes, regenerate
62
62
  Run the complete canonical chain in its versioned order:
63
63
 
64
64
  ```bash
65
- npx workspai workspace intelligence run --for-agent codex --json
65
+ npx workspai workspace intelligence run --for-agent generic --json
66
66
  ```
67
67
 
68
68
  For enterprise CI and release enforcement, add `--strict`. A warning or
69
69
  needs-attention verdict then produces a blocked report and exit code `2`:
70
70
 
71
71
  ```bash
72
- npx workspai workspace intelligence run --for-agent codex --strict --json
72
+ npx workspai workspace intelligence run --for-agent generic --strict --json
73
73
  ```
74
74
 
75
75
  `pipeline` is the broader governance/release orchestrator. It does not replace
@@ -1,11 +1,13 @@
1
1
  # Measure Workspace Intelligence Usage
2
2
 
3
- Workspai can record model usage, tool activity, cost provenance, and the final
4
- verified outcome of an agent task. The resulting artifact is designed for CLI,
5
- IDE, CI, and dashboard consumers.
3
+ Use this feature to answer a practical question: did focused workspace context
4
+ help an AI task use fewer tokens, cost less, or reach a verified result?
6
5
 
7
- It does not store prompt or response bodies. Optional SHA-256 hashes let a
8
- consumer correlate calls without copying private content into the report.
6
+ Workspai records model usage, tool activity, reported cost, and the final
7
+ verified outcome in one report that the CLI, IDE, CI, and dashboards can read.
8
+
9
+ It does not store prompt or response text. Optional SHA-256 hashes can connect
10
+ related calls without copying private content into the report.
9
11
 
10
12
  ## Start a measured task
11
13
 
@@ -50,7 +52,7 @@ printf '%s\n' '{
50
52
  | `provider-reported` | The provider returned the count |
51
53
  | `tokenizer-counted` | A named tokenizer counted the exact serialized input or output |
52
54
  | `estimated` | A documented estimate; never presented as provider billing |
53
- | `unavailable` | The provider exposed no usable count |
55
+ | `unavailable` | The provider exposed no usable count |
54
56
 
55
57
  Tool events record progress and repeated work without storing command output:
56
58
 
@@ -1,14 +1,25 @@
1
1
  # Unified Workspace Intelligence Runner
2
2
 
3
- `workspace intelligence run` is the canonical contract-backed entrypoint for
4
- refreshing Workspace Intelligence evidence in one deterministic execution. Use
5
- it from a Workspai workspace root:
3
+ Use one command when you want the latest answer to these questions:
4
+
5
+ - What projects and relationships exist now?
6
+ - What changed, and what may be affected?
7
+ - Is the workspace healthy and ready?
8
+ - What should developers, CI, IDEs, and AI tools read?
9
+
10
+ Run it from a Workspai workspace root:
6
11
 
7
12
  ```bash
8
- npx workspai workspace intelligence run --for-agent codex --strict --json
13
+ npx workspai workspace intelligence run --for-agent generic --strict --json
9
14
  ```
10
15
 
11
- The authoritative result is written atomically to
16
+ `generic` is the vendor-neutral context surface. Replace it with `codex`,
17
+ `claude`, `cursor`, or `orca` for agent-specific context. The `agent-sync`
18
+ stage also publishes shared grounding for GitHub Copilot, VS Code, and
19
+ `AGENTS.md` consumers.
20
+
21
+ Workspai runs the required steps in a fixed order and saves one final report.
22
+ The technical contract writes that report atomically to
12
23
  `.workspai/reports/workspace-intelligence-run-last-run.json` with schema
13
24
  `workspace-intelligence-run.v1`. JSON stdout returns the same report payload.
14
25
  Consumers should read the persisted report when they need durable evidence and
@@ -154,7 +165,7 @@ publish it without applying the relevant redaction policy.
154
165
  The simplest hard gate is:
155
166
 
156
167
  ```bash
157
- npx workspai workspace intelligence run --for-agent codex --strict --json
168
+ npx workspai workspace intelligence run --for-agent generic --strict --json
158
169
  ```
159
170
 
160
171
  Both exit `1` and exit `2` fail a normal CI step. If artifacts must be uploaded