workspai 0.76.0 → 0.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +2 -2
  2. package/contracts/create-planner-capabilities.v1.json +24 -0
  3. package/contracts/runtime-command-surface.v1.json +3 -1
  4. package/contracts/workspace-intelligence/workspace-model.v1.json +4 -0
  5. package/contracts/workspace-intelligence-architecture.v1.json +3 -1
  6. package/dist/analyze-TJM66CPF.js +1 -0
  7. package/dist/autopilot-release-C7Q4OTPY.js +1 -0
  8. package/dist/capabilities-command-TIBIKWPK.js +1 -0
  9. package/dist/{chunk-Z2M2XCIB.js → chunk-223SWPTL.js} +1 -1
  10. package/dist/{chunk-RKFTUIZ4.js → chunk-3EMAC3MF.js} +1 -1
  11. package/dist/{chunk-BZLDCASY.js → chunk-3EPR3D5Q.js} +1 -1
  12. package/dist/{chunk-PUH3TSPC.js → chunk-3SQIV3F4.js} +1 -1
  13. package/dist/{chunk-HRGIHWYH.js → chunk-475GQJ2D.js} +1 -1
  14. package/dist/{chunk-FBF767WP.js → chunk-47UR6ZH4.js} +1 -1
  15. package/dist/{chunk-AGI46TSQ.js → chunk-4CXV3PPV.js} +1 -1
  16. package/dist/chunk-4ZUBPFSO.js +6 -0
  17. package/dist/chunk-5KXOV7W4.js +1 -0
  18. package/dist/{chunk-4MXKXHLW.js → chunk-DWKCFHHL.js} +1 -1
  19. package/dist/{chunk-L6VNI4DN.js → chunk-E7WJ2QX7.js} +1 -1
  20. package/dist/{chunk-KW35SWG6.js → chunk-GLBFY7AB.js} +2 -2
  21. package/dist/{chunk-KO4DM2AV.js → chunk-HRVHQBTA.js} +1 -1
  22. package/dist/{chunk-X7MDTBX5.js → chunk-IAXRGH4Q.js} +1 -1
  23. package/dist/{chunk-QIPW3G2H.js → chunk-IDETNYCF.js} +1 -1
  24. package/dist/{chunk-YLLCZMKP.js → chunk-IHWS3ALP.js} +1 -1
  25. package/dist/{chunk-R3Z4LY3O.js → chunk-J2MPBSQJ.js} +1 -1
  26. package/dist/{chunk-FD2ZGGCQ.js → chunk-JVZA35OL.js} +1 -1
  27. package/dist/{chunk-H4YHIOCT.js → chunk-LUPKDFQ3.js} +3 -3
  28. package/dist/chunk-N7DOKE7V.js +2 -0
  29. package/dist/{chunk-TJ3MDZMC.js → chunk-O3TVVQ6X.js} +1 -1
  30. package/dist/{chunk-4BBFEHPL.js → chunk-QCX6BO2M.js} +1 -1
  31. package/dist/{chunk-PSQPKK6H.js → chunk-SC43A6LH.js} +52 -52
  32. package/dist/chunk-SEZTSMRR.js +1 -0
  33. package/dist/{chunk-TFFNHWXY.js → chunk-TGNPMOM6.js} +1 -1
  34. package/dist/chunk-UNEK3VVR.js +2684 -0
  35. package/dist/{chunk-2I2A55RE.js → chunk-UP3UWAJV.js} +1 -1
  36. package/dist/{chunk-IKNWNGLY.js → chunk-UTIK3K3M.js} +1 -1
  37. package/dist/{chunk-UOTOJJI4.js → chunk-V6HVDVKJ.js} +5 -5
  38. package/dist/chunk-WC2K5QFI.js +10 -0
  39. package/dist/{chunk-ZXQC36NJ.js → chunk-X5XFT5UZ.js} +1 -1
  40. package/dist/{chunk-23CNBYIW.js → chunk-ZIWWE4BQ.js} +1 -1
  41. package/dist/{create-ZRUQ3KNZ.js → create-YPAZJYCE.js} +1 -1
  42. package/dist/{doctor-7V7LJLHX.js → doctor-W5PXJ5FL.js} +1 -1
  43. package/dist/{goal-lifecycle-EM4DUJCR.js → goal-lifecycle-5R55CA7H.js} +1 -1
  44. package/dist/{goal-pack-YMWZHAH6.js → goal-pack-IS6GGJPH.js} +1 -1
  45. package/dist/index.js +256 -247
  46. package/dist/{pipeline-6MBH3MU2.js → pipeline-LW3SW2WT.js} +1 -1
  47. package/dist/{project-agent-entry-ZXAE2MAJ.js → project-agent-entry-5TYKK5IV.js} +1 -1
  48. package/dist/{project-intelligence-lens-NBTPOK2R.js → project-intelligence-lens-TEOSTKNU.js} +1 -1
  49. package/dist/{project-test-coverage-HOZC72EK.js → project-test-coverage-T4TIWGKN.js} +1 -1
  50. package/dist/{proof-carrying-change-WJFAKK3C.js → proof-carrying-change-2TKRADCW.js} +1 -1
  51. package/dist/{verified-goal-B7EX2PBE.js → verified-goal-RN4TOV34.js} +1 -1
  52. package/dist/{workspace-EBPYCSEM.js → workspace-A33YMF2N.js} +1 -1
  53. package/dist/{workspace-agent-sync-Y4F6FBBC.js → workspace-agent-sync-VCA4G4DT.js} +1 -1
  54. package/dist/{workspace-context-Y7F7GJCQ.js → workspace-context-YBWLSKR6.js} +1 -1
  55. package/dist/{workspace-contract-XJMWMVQE.js → workspace-contract-3QUZDBMM.js} +1 -1
  56. package/dist/{workspace-explain-T2J5ZLY7.js → workspace-explain-NXYRAQFI.js} +1 -1
  57. package/dist/{workspace-foundation-2UP6IMTH.js → workspace-foundation-DZ52PECX.js} +1 -1
  58. package/dist/{workspace-graph-stream-MZVL3OCX.js → workspace-graph-stream-4VT46HZ7.js} +1 -1
  59. package/dist/{workspace-intelligence-FZRQIFFM.js → workspace-intelligence-FKYQQDJ6.js} +1 -1
  60. package/dist/{workspace-intelligence-runner-IXT62JG7.js → workspace-intelligence-runner-3K2JZH6Q.js} +1 -1
  61. package/dist/{workspace-knowledge-graph-EFC4TUDZ.js → workspace-knowledge-graph-CPBKNXQI.js} +1 -1
  62. package/dist/workspace-knowledge-graph-snapshot-67XDXUOT.js +1 -0
  63. package/dist/{workspace-mcp-serve-C42UUU7W.js → workspace-mcp-serve-UXPKX7K6.js} +1 -1
  64. package/dist/{workspace-model-72SJ6WXT.js → workspace-model-POCPMNRT.js} +1 -1
  65. package/dist/{workspace-onboarding-TFDAIHTS.js → workspace-onboarding-KLG3GG7S.js} +1 -1
  66. package/dist/{workspace-registry-summary-ZNTXSUI4.js → workspace-registry-summary-M4WMFDQ4.js} +1 -1
  67. package/dist/{workspace-repair-engine-542TAL3Z.js → workspace-repair-engine-2VGN42QD.js} +1 -1
  68. package/dist/workspace-run-5YQR7GEZ.js +1 -0
  69. package/dist/{workspace-verify-UXKENOQU.js → workspace-verify-PLAKTF3J.js} +1 -1
  70. package/dist/{workspace-watch-DV5AHLOK.js → workspace-watch-VNU4KVYN.js} +1 -1
  71. package/docs/README.md +2 -0
  72. package/docs/agent-framework-adapters.md +4 -0
  73. package/docs/ci-workflows.md +12 -1
  74. package/docs/commands-reference.md +2 -0
  75. package/docs/create-planner-capabilities.md +1 -0
  76. package/docs/creating-workspaces-and-projects.md +24 -7
  77. package/docs/doctor-command.md +3 -0
  78. package/docs/model-gateways.md +204 -0
  79. package/docs/native-kit-baselines.md +2 -1
  80. package/package.json +3 -1
  81. package/scripts/enterprise-package-smoke.mjs +102 -0
  82. package/dist/analyze-QVRVJB7I.js +0 -1
  83. package/dist/autopilot-release-DOGIETAT.js +0 -1
  84. package/dist/capabilities-command-FYBUVHZ7.js +0 -1
  85. package/dist/chunk-4R44E7HN.js +0 -6
  86. package/dist/chunk-5S6IZ6PY.js +0 -2
  87. package/dist/chunk-NSC4VWV2.js +0 -1
  88. package/dist/chunk-QFDTKOYS.js +0 -2649
  89. package/dist/chunk-QVFIR64T.js +0 -10
  90. package/dist/chunk-VODNLROY.js +0 -1
  91. package/dist/workspace-knowledge-graph-snapshot-QIMF7TCF.js +0 -1
  92. package/dist/workspace-run-NAPJYNSZ.js +0 -1
@@ -1 +1 @@
1
- import {d,n}from'./chunk-VODNLROY.js';import {a,b}from'./chunk-S5KTATOU.js';function u(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function w(r){let s=u(r),n$1=n(r)??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n$1),o=new Map;for(let t of n$1.nodes){let e=s.get(t.id)??d({missing:t.id}),l=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,f)=>c.localeCompare(f)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:l})});}return o}function y(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function M(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{u as a,w as b,y as c,M as d};
1
+ import {d,n}from'./chunk-SEZTSMRR.js';import {a,b}from'./chunk-S5KTATOU.js';function u(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function w(r){let s=u(r),n$1=n(r)??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n$1),o=new Map;for(let t of n$1.nodes){let e=s.get(t.id)??d({missing:t.id}),l=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,f)=>c.localeCompare(f)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:l})});}return o}function y(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function M(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{u as a,w as b,y as c,M as d};
@@ -1 +1 @@
1
- import a from'path';import Y from'fs-extra';import q from'chalk';async function U(p,n={}){let e=a.resolve(p),{WORKSPACE_CONTRACT_PATH:l,syncWorkspaceContract:d,verifyWorkspaceContract:S,writeWorkspaceContractVerifyEvidence:j}=await import('./workspace-contract-XJMWMVQE.js'),w=await d({workspacePath:e,strict:true}),{syncWorkspaceReadme:E,WORKSPACE_README_PATH:R}=await import('./workspace-readme-4FCKAQME.js'),x=await E({workspacePath:e,workspaceName:w.contract.workspace.name,profile:w.contract.workspace.profile??"minimal",projectCount:w.contract.projects.length}),{buildWorkspaceModel:h,writeWorkspaceModel:g}=await import('./workspace-model-72SJ6WXT.js'),r=await h({workspacePath:e,includeEvidence:true}),k=await g(r,e),{buildWorkspaceImpact:G,buildWorkspaceModelSnapshot:O,diffWorkspaceModel:$,writeWorkspaceImpact:M,writeWorkspaceModelDiff:T,writeWorkspaceModelSnapshot:_}=await import('./workspace-intelligence-FZRQIFFM.js'),{WORKSPACE_INTELLIGENCE_ARTIFACTS:s}=await import('./workspace-intelligence-runtime-registry-ZLPF7BAY.js'),{syncWorkspaceAgentGrounding:P}=await import('./workspace-agent-sync-Y4F6FBBC.js'),W=await P({workspacePath:e,model:r,write:true,refreshContext:true,strict:false,preset:"enterprise",targets:["all"],projectGrounding:n.projectGrounding??"managed"}),v=new Set(W.writtenFiles),i=new Set(W.projectLenses?.skipped.map(t=>`${t.name}: ${t.reason}`)??[]),{readWorkspaceKnowledgeGraphSnapshot:C}=await import('./workspace-knowledge-graph-snapshot-QIMF7TCF.js'),o=await C(e),y=false;if(o.status==="miss"){if(o.reason!=="live-input-mismatch")throw new Error(`Workspace consumer sync could not validate canonical Model/Graph evidence (${o.reason}).`);r=await h({workspacePath:e,includeEvidence:true}),k=await g(r,e);let{buildWorkspaceAgentContext:t,writeWorkspaceAgentContext:f}=await import('./workspace-context-Y7F7GJCQ.js'),m=await t({workspacePath:e,model:r,agent:"generic",includeEvidence:true});await f(m,e);let b=await P({workspacePath:e,model:r,write:true,refreshContext:false,strict:false,preset:"enterprise",targets:["all"],projectGrounding:n.projectGrounding??"managed"});for(let c of b.writtenFiles)v.add(c);for(let c of b.projectLenses?.skipped??[])i.add(`${c.name}: ${c.reason}`);if(o=await C(e),o.status==="miss")throw new Error(`Workspace consumer reconciliation did not produce fresh canonical evidence (${o.reason}).`);y=true;}let F=a.join(e,s.snapshot),u=false;if(!await Y.pathExists(F)){let t=await O({workspacePath:e,model:r});await _(t,e),u=true;}let I=await $({workspacePath:e,fromPath:s.snapshot,model:r}),N=await T(I,e),L=await G({workspacePath:e,fromPath:s.diff}),K=await M(L,e),z=await S({workspacePath:e,strict:true}),H=await j({workspacePath:e,result:z}),V=(o.graph.source.inputs?.scopes??[]).filter(t=>t.truncated);for(let t of V)i.add(`${t.kind}:${t.id} graph inventory reached its ${t.fileLimit}-file emergency bound; inventory completeness is bounded.`);let A=o.graph.quality.completeness?.providers.bounded??0;A>0&&i.add(`${A} graph provider(s) used declared adaptive semantic/deep budgets; inspect provider inputCoverage before making exhaustive symbol-level claims.`);let D=[l,(await import('./workspace-registry-summary-ZNTXSUI4.js')).WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,a.relative(e,x).split(a.sep).join("/")||R,a.relative(e,k).split(a.sep).join("/"),s.knowledgeGraph,...u?[s.snapshot]:[],a.relative(e,N).split(a.sep).join("/"),a.relative(e,K).split(a.sep).join("/"),a.relative(e,H).split(a.sep).join("/"),...v].filter((t,f,m)=>m.indexOf(t)===f);return n.silent||console.log(q.gray(`\u2713 Workspace Intelligence synced \xB7 ${r.summary.projectCount} project(s) \xB7 model + graph + agent grounding \xB7 freshness sealed`)),{workspacePath:e,projectCount:r.summary.projectCount,baselineCreated:u,freshnessSealed:true,reconciledAfterGrounding:y,writtenFiles:D,warnings:[...i].sort()}}async function ee(p,n={}){let e=a.resolve(p),l=n.workspaceName??a.basename(e),{registerWorkspaceStrict:d}=await import('./workspace-EBPYCSEM.js');return await d(e,l),U(e,{silent:n.silent})}export{U as a,ee as b};
1
+ import a from'path';import Y from'fs-extra';import q from'chalk';async function U(p,n={}){let e=a.resolve(p),{WORKSPACE_CONTRACT_PATH:l,syncWorkspaceContract:d,verifyWorkspaceContract:S,writeWorkspaceContractVerifyEvidence:j}=await import('./workspace-contract-3QUZDBMM.js'),w=await d({workspacePath:e,strict:true}),{syncWorkspaceReadme:E,WORKSPACE_README_PATH:R}=await import('./workspace-readme-4FCKAQME.js'),x=await E({workspacePath:e,workspaceName:w.contract.workspace.name,profile:w.contract.workspace.profile??"minimal",projectCount:w.contract.projects.length}),{buildWorkspaceModel:h,writeWorkspaceModel:g}=await import('./workspace-model-POCPMNRT.js'),r=await h({workspacePath:e,includeEvidence:true}),k=await g(r,e),{buildWorkspaceImpact:G,buildWorkspaceModelSnapshot:O,diffWorkspaceModel:$,writeWorkspaceImpact:M,writeWorkspaceModelDiff:T,writeWorkspaceModelSnapshot:_}=await import('./workspace-intelligence-FKYQQDJ6.js'),{WORKSPACE_INTELLIGENCE_ARTIFACTS:s}=await import('./workspace-intelligence-runtime-registry-ZLPF7BAY.js'),{syncWorkspaceAgentGrounding:P}=await import('./workspace-agent-sync-VCA4G4DT.js'),W=await P({workspacePath:e,model:r,write:true,refreshContext:true,strict:false,preset:"enterprise",targets:["all"],projectGrounding:n.projectGrounding??"managed"}),v=new Set(W.writtenFiles),i=new Set(W.projectLenses?.skipped.map(t=>`${t.name}: ${t.reason}`)??[]),{readWorkspaceKnowledgeGraphSnapshot:C}=await import('./workspace-knowledge-graph-snapshot-67XDXUOT.js'),o=await C(e),y=false;if(o.status==="miss"){if(o.reason!=="live-input-mismatch")throw new Error(`Workspace consumer sync could not validate canonical Model/Graph evidence (${o.reason}).`);r=await h({workspacePath:e,includeEvidence:true}),k=await g(r,e);let{buildWorkspaceAgentContext:t,writeWorkspaceAgentContext:f}=await import('./workspace-context-YBWLSKR6.js'),m=await t({workspacePath:e,model:r,agent:"generic",includeEvidence:true});await f(m,e);let b=await P({workspacePath:e,model:r,write:true,refreshContext:false,strict:false,preset:"enterprise",targets:["all"],projectGrounding:n.projectGrounding??"managed"});for(let c of b.writtenFiles)v.add(c);for(let c of b.projectLenses?.skipped??[])i.add(`${c.name}: ${c.reason}`);if(o=await C(e),o.status==="miss")throw new Error(`Workspace consumer reconciliation did not produce fresh canonical evidence (${o.reason}).`);y=true;}let F=a.join(e,s.snapshot),u=false;if(!await Y.pathExists(F)){let t=await O({workspacePath:e,model:r});await _(t,e),u=true;}let I=await $({workspacePath:e,fromPath:s.snapshot,model:r}),N=await T(I,e),L=await G({workspacePath:e,fromPath:s.diff}),K=await M(L,e),z=await S({workspacePath:e,strict:true}),H=await j({workspacePath:e,result:z}),V=(o.graph.source.inputs?.scopes??[]).filter(t=>t.truncated);for(let t of V)i.add(`${t.kind}:${t.id} graph inventory reached its ${t.fileLimit}-file emergency bound; inventory completeness is bounded.`);let A=o.graph.quality.completeness?.providers.bounded??0;A>0&&i.add(`${A} graph provider(s) used declared adaptive semantic/deep budgets; inspect provider inputCoverage before making exhaustive symbol-level claims.`);let D=[l,(await import('./workspace-registry-summary-M4WMFDQ4.js')).WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,a.relative(e,x).split(a.sep).join("/")||R,a.relative(e,k).split(a.sep).join("/"),s.knowledgeGraph,...u?[s.snapshot]:[],a.relative(e,N).split(a.sep).join("/"),a.relative(e,K).split(a.sep).join("/"),a.relative(e,H).split(a.sep).join("/"),...v].filter((t,f,m)=>m.indexOf(t)===f);return n.silent||console.log(q.gray(`\u2713 Workspace Intelligence synced \xB7 ${r.summary.projectCount} project(s) \xB7 model + graph + agent grounding \xB7 freshness sealed`)),{workspacePath:e,projectCount:r.summary.projectCount,baselineCreated:u,freshnessSealed:true,reconciledAfterGrounding:y,writtenFiles:D,warnings:[...i].sort()}}async function ee(p,n={}){let e=a.resolve(p),l=n.workspaceName??a.basename(e),{registerWorkspaceStrict:d}=await import('./workspace-A33YMF2N.js');return await d(e,l),U(e,{silent:n.silent})}export{U as a,ee as b};
@@ -1,4 +1,4 @@
1
- import {g,f,h as h$2}from'./chunk-5S6IZ6PY.js';import {b as b$4}from'./chunk-IKNWNGLY.js';import {b as b$7,a as a$4}from'./chunk-D5LLTUTY.js';import {b as b$2}from'./chunk-B6FJ6RG6.js';import {a as a$3}from'./chunk-4BBFEHPL.js';import {O,e as e$1,g as g$1,h as h$1,c as c$2,i as i$1,f as f$1,b as b$6,d as d$3}from'./chunk-QFDTKOYS.js';import {g as g$2}from'./chunk-YLLCZMKP.js';import {e,c as c$1}from'./chunk-252EKOR6.js';import {i,b as b$5,k,j,m,z,y,w}from'./chunk-6BO4QHKA.js';import {h,e as e$2,b as b$3,d as d$1}from'./chunk-EFHSRPW7.js';import {a}from'./chunk-TQEMLBAG.js';import {b as b$1,a as a$1,c,d as d$2}from'./chunk-VQZ5PI5J.js';import {promises}from'fs';import*as b from'fs-extra';import d from'path';import a$2 from'chalk';import {execa}from'execa';function dt(e){let t=e.projectCount??0,n=t===1?"project":"projects",o=e.pythonEngine==="installed"?`Python ${e.pythonVersion||"3.10+"} \xB7 ${e.installMethod||"local environment"}`:e.pythonEngine==="skipped"?"Python engine not installed":"Runtime-neutral foundation";return ["","\u2713 Workspace ready",`${e.workspaceName} \xB7 ${e.profile} \xB7 ${t} registered ${n}`,`Location ${e.workspacePath}`,`Runtime ${o}`,...e.note?[`Note ${e.note}`]:[],"","Workspace Intelligence"," \u2713 Contract and project registry"," \u2713 Canonical model and proof-backed graph"," \u2713 Agent context, grounding, and evidence index","","Next",` ${h$2(e.workspacePath)}`," npx workspai create"," npx workspai workspace intelligence run --for-agent generic --strict --json","","Evidence .workspai/reports/INDEX.json","Guide README.md",""]}function J(e){let t=dt(e);for(let n of t)n==="\u2713 Workspace ready"?console.log(a$2.green.bold(n)):n==="Workspace Intelligence"||n==="Next"?console.log(a$2.cyan.bold(n)):n.startsWith(" \u2713")?console.log(a$2.green(n)):n.startsWith("Location")||n.startsWith("Runtime")?console.log(a$2.gray(n)):console.log(n);}function M(){return i()}var ut="transactions";function mt(){return d.join(w(),ut)}async function Ue(){let e=mt();return await b$7(e),a$4({journalDirectory:e})}async function qe(e){for(let t of y())await e.captureFile(t);}async function le(e){let t=await Ue();try{return await qe(t),await t.captureOwnedTree(e),t}catch(n){return F(t,n)}}async function yt(e){let t=await Ue();try{return await Ye(t,e),t}catch(n){return F(t,n)}}async function Ye(e,t){await qe(e),await e.captureOwnedTree(d.join(t,a$1)),await e.captureOwnedTree(d.join(t,".venv"));for(let o of [".agents",".amazonq",".claude",".cursor",".github",".grok",".vscode",".windsurf"])await e.captureOwnedTree(d.join(t,o));let n=[c,".gitignore",d.join(a$1,"workspace.json"),d.join(a$1,"toolchain.lock"),d.join(a$1,"policies.yml"),d.join(a$1,"cache-config.yml"),g$2,a$3,"pyproject.toml","poetry.toml","poetry.lock","rapidkit","rapidkit.cmd","README.md","AGENTS.md","CLAUDE.md","GEMINI.md","QWEN.md",".windsurfrules",".rapidkit-global"];for(let o of n)await e.captureFile(d.join(t,o));}async function Q(e){await e.commit(),e.journalPath&&await promises.rm(d.dirname(e.journalPath),{recursive:true,force:true}).catch(t=>e$2.debug(`Could not remove committed lifecycle journal: ${t}`));}async function F(e,t){try{await e.rollback();}catch(n){throw new AggregateError([t,n],"Workspace lifecycle failed and rollback was incomplete.")}throw t}async function X(e$1,t,n,o,i){let r=e(t,h(),n,i?.pythonEngine?{coreStatus:i.pythonEngine,...i.pythonEngineReason?{coreReason:i.pythonEngineReason}:{},...o?{pythonVersion:o}:{}}:void 0);o&&!i?.pythonEngine&&(r.metadata||(r.metadata={}),r.metadata.python={pythonVersion:o}),await c$1(e$1,r);}async function G(e){await b.outputFile(d.join(e,".gitignore"),`.venv/
1
+ import {g,f,h as h$2}from'./chunk-N7DOKE7V.js';import {b as b$4}from'./chunk-UTIK3K3M.js';import {b as b$7,a as a$4}from'./chunk-D5LLTUTY.js';import {b as b$2}from'./chunk-B6FJ6RG6.js';import {a as a$3}from'./chunk-QCX6BO2M.js';import {V as V$1,e as e$1,g as g$1,h as h$1,c as c$2,i as i$1,f as f$1,b as b$6,d as d$3}from'./chunk-UNEK3VVR.js';import {g as g$2}from'./chunk-IHWS3ALP.js';import {e,c as c$1}from'./chunk-252EKOR6.js';import {i,b as b$5,k,j,m,z,y,w}from'./chunk-6BO4QHKA.js';import {h,e as e$2,b as b$3,d as d$1}from'./chunk-EFHSRPW7.js';import {a}from'./chunk-TQEMLBAG.js';import {b as b$1,a as a$1,c,d as d$2}from'./chunk-VQZ5PI5J.js';import {promises}from'fs';import*as b from'fs-extra';import d from'path';import a$2 from'chalk';import {execa}from'execa';function dt(e){let t=e.projectCount??0,n=t===1?"project":"projects",o=e.pythonEngine==="installed"?`Python ${e.pythonVersion||"3.10+"} \xB7 ${e.installMethod||"local environment"}`:e.pythonEngine==="skipped"?"Python engine not installed":"Runtime-neutral foundation";return ["","\u2713 Workspace ready",`${e.workspaceName} \xB7 ${e.profile} \xB7 ${t} registered ${n}`,`Location ${e.workspacePath}`,`Runtime ${o}`,...e.note?[`Note ${e.note}`]:[],"","Workspace Intelligence"," \u2713 Contract and project registry"," \u2713 Canonical model and proof-backed graph"," \u2713 Agent context, grounding, and evidence index","","Next",` ${h$2(e.workspacePath)}`," npx workspai create"," npx workspai workspace intelligence run --for-agent generic --strict --json","","Evidence .workspai/reports/INDEX.json","Guide README.md",""]}function J(e){let t=dt(e);for(let n of t)n==="\u2713 Workspace ready"?console.log(a$2.green.bold(n)):n==="Workspace Intelligence"||n==="Next"?console.log(a$2.cyan.bold(n)):n.startsWith(" \u2713")?console.log(a$2.green(n)):n.startsWith("Location")||n.startsWith("Runtime")?console.log(a$2.gray(n)):console.log(n);}function M(){return i()}var ut="transactions";function mt(){return d.join(w(),ut)}async function Ue(){let e=mt();return await b$7(e),a$4({journalDirectory:e})}async function qe(e){for(let t of y())await e.captureFile(t);}async function le(e){let t=await Ue();try{return await qe(t),await t.captureOwnedTree(e),t}catch(n){return F(t,n)}}async function yt(e){let t=await Ue();try{return await Ye(t,e),t}catch(n){return F(t,n)}}async function Ye(e,t){await qe(e),await e.captureOwnedTree(d.join(t,a$1)),await e.captureOwnedTree(d.join(t,".venv"));for(let o of [".agents",".amazonq",".claude",".cursor",".github",".grok",".vscode",".windsurf"])await e.captureOwnedTree(d.join(t,o));let n=[c,".gitignore",d.join(a$1,"workspace.json"),d.join(a$1,"toolchain.lock"),d.join(a$1,"policies.yml"),d.join(a$1,"cache-config.yml"),g$2,a$3,"pyproject.toml","poetry.toml","poetry.lock","rapidkit","rapidkit.cmd","README.md","AGENTS.md","CLAUDE.md","GEMINI.md","QWEN.md",".windsurfrules",".rapidkit-global"];for(let o of n)await e.captureFile(d.join(t,o));}async function Q(e){await e.commit(),e.journalPath&&await promises.rm(d.dirname(e.journalPath),{recursive:true,force:true}).catch(t=>e$2.debug(`Could not remove committed lifecycle journal: ${t}`));}async function F(e,t){try{await e.rollback();}catch(n){throw new AggregateError([t,n],"Workspace lifecycle failed and rollback was incomplete.")}throw t}async function X(e$1,t,n,o,i){let r=e(t,h(),n,i?.pythonEngine?{coreStatus:i.pythonEngine,...i.pythonEngineReason?{coreReason:i.pythonEngineReason}:{},...o?{pythonVersion:o}:{}}:void 0);o&&!i?.pythonEngine&&(r.metadata||(r.metadata={}),r.metadata.python={pythonVersion:o}),await c$1(e$1,r);}async function G(e){await b.outputFile(d.join(e,".gitignore"),`.venv/
2
2
  __pycache__/
3
3
  *.pyc
4
4
  .env
@@ -37,7 +37,7 @@ cache:
37
37
  prune_on_bootstrap: false
38
38
  self_heal: true
39
39
  verify_integrity: false
40
- `}async function et(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),t=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return t?t[1]:void 0}catch{return}}async function tt(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),t=e.trim();return t.length>0?t:void 0}catch{return}}async function ee(e,t,n,o,i,r){let[u,h]=await Promise.all([et(),tt()]),l=[{fileName:"workspace.json",content:Je(t,n,o,i,r)},{fileName:"toolchain.lock",content:Qe(n,o,process.version,u,h,r)},{fileName:"policies.yml",content:Xe()},{fileName:"cache-config.yml",content:Ze()}];for(let w of l)await b.outputFile(d.join(e,a$1,w.fileName),w.content,"utf-8");}async function an(e$1,t){let{workspaceName:n=d.basename(e$1),installMethod:o="venv",pythonVersion:i,profile:r,writeMarker:u=true,writeGitignore:h$1=true,onlyIfMissing:l=true}=t||{},w=[],[g,f]=await Promise.all([et(),tt()]),c$2=[{relPath:d.join(a$1,"workspace.json"),legacyRelPath:d.join(b$1,"workspace.json"),content:Je(n,o,i,r)},{relPath:d.join(a$1,"toolchain.lock"),legacyRelPath:d.join(b$1,"toolchain.lock"),content:Qe(o,i,process.version,g,f)},{relPath:d.join(a$1,"policies.yml"),legacyRelPath:d.join(b$1,"policies.yml"),content:Xe()},{relPath:d.join(a$1,"cache-config.yml"),legacyRelPath:d.join(b$1,"cache-config.yml"),content:Ze()}];for(let m of c$2){let p=d.join(e$1,m.relPath),s=d.join(e$1,m.legacyRelPath),$=await b.pathExists(p),k=await b.pathExists(s);l&&$||(l&&k?(await b.copy(s,p),w.push(m.relPath)):(await b.outputFile(p,m.content,"utf-8"),w.push(m.relPath)));}if(u&&(!await b.pathExists(d.join(e$1,c))||!l)){let p=e(n,h(),o);i&&(p.metadata||(p.metadata={}),p.metadata.python={pythonVersion:i}),await c$1(e$1,p),w.push(c);}if(h$1){let m=d.join(e$1,".gitignore");(!l||!await b.pathExists(m))&&(await G(e$1),w.push(".gitignore"));}return w}var ft={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function wt(e){let t=e,n=new Set;for(;!O(t);){if(n.has(t))return "minimal";n.add(t);let o=ft[t];if(!o)return "minimal";t=o;}return t}var V="3.10",nt=["3.10","3.11","3.12"];async function xe(e){try{let{stdout:t}=await execa(e,["--version"],{timeout:3e3}),n=t.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function vt(e,t){try{await promises.writeFile(d.join(e,".python-version"),`${t}
40
+ `}async function et(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),t=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return t?t[1]:void 0}catch{return}}async function tt(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),t=e.trim();return t.length>0?t:void 0}catch{return}}async function ee(e,t,n,o,i,r){let[u,h]=await Promise.all([et(),tt()]),l=[{fileName:"workspace.json",content:Je(t,n,o,i,r)},{fileName:"toolchain.lock",content:Qe(n,o,process.version,u,h,r)},{fileName:"policies.yml",content:Xe()},{fileName:"cache-config.yml",content:Ze()}];for(let w of l)await b.outputFile(d.join(e,a$1,w.fileName),w.content,"utf-8");}async function an(e$1,t){let{workspaceName:n=d.basename(e$1),installMethod:o="venv",pythonVersion:i,profile:r,writeMarker:u=true,writeGitignore:h$1=true,onlyIfMissing:l=true}=t||{},w=[],[g,f]=await Promise.all([et(),tt()]),c$2=[{relPath:d.join(a$1,"workspace.json"),legacyRelPath:d.join(b$1,"workspace.json"),content:Je(n,o,i,r)},{relPath:d.join(a$1,"toolchain.lock"),legacyRelPath:d.join(b$1,"toolchain.lock"),content:Qe(o,i,process.version,g,f)},{relPath:d.join(a$1,"policies.yml"),legacyRelPath:d.join(b$1,"policies.yml"),content:Xe()},{relPath:d.join(a$1,"cache-config.yml"),legacyRelPath:d.join(b$1,"cache-config.yml"),content:Ze()}];for(let m of c$2){let p=d.join(e$1,m.relPath),s=d.join(e$1,m.legacyRelPath),$=await b.pathExists(p),k=await b.pathExists(s);l&&$||(l&&k?(await b.copy(s,p),w.push(m.relPath)):(await b.outputFile(p,m.content,"utf-8"),w.push(m.relPath)));}if(u&&(!await b.pathExists(d.join(e$1,c))||!l)){let p=e(n,h(),o);i&&(p.metadata||(p.metadata={}),p.metadata.python={pythonVersion:i}),await c$1(e$1,p),w.push(c);}if(h$1){let m=d.join(e$1,".gitignore");(!l||!await b.pathExists(m))&&(await G(e$1),w.push(".gitignore"));}return w}var ft={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function wt(e){let t=e,n=new Set;for(;!V$1(t);){if(n.has(t))return "minimal";n.add(t);let o=ft[t];if(!o)return "minimal";t=o;}return t}var V="3.10",nt=["3.10","3.11","3.12"];async function xe(e){try{let{stdout:t}=await execa(e,["--version"],{timeout:3e3}),n=t.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function vt(e,t){try{await promises.writeFile(d.join(e,".python-version"),`${t}
41
41
  `,"utf-8"),e$2.debug(`Created .python-version with ${t}`);}catch(n){e$2.warn(`Failed to create .python-version: ${n}`);}}function ce(){let n=[...(process.env.PATH||"").split(d.delimiter).filter(Boolean)];for(let o of z())n.includes(o)||n.unshift(o);process.env.PATH=n.join(d.delimiter);}async function he(e,t){ce(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let n=M();try{return await execa(n,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(t)throw new d$3;try{await execa(n,["-m","pip","--version"],{timeout:2500});}catch{throw new h$1}e.stop?.();let{installPipx:o}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!o)throw new d$3;e.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(i){let r=i,u=String(r?.stderr||r?.shortMessage||r?.message||"");throw new f$1("Install pipx with python -m pip",i instanceof Error?i:new Error(u))}e.succeed("pipx installed"),ce();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(i){let r=i,u=String(r?.stderr||r?.shortMessage||r?.message||"pipx not runnable after install");throw new f$1("Verify pipx after install",new Error(`${u}
42
42
 
43
43
  Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function H(e,t){return e.kind==="binary"?execa("pipx",t):execa(e.pythonCmd,["-m","pipx",...t])}function ot(e){let t=e.match(/^(\d+)\.(\d+)/);return t?`${t[1]}.${t[2]}`:null}function He(e){if(!e)return null;let t=e.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return t?`${t[1]}.${t[2]}`:null}function Ie(e,t){let[n,o]=e.split(".").map(u=>Number(u)),[i,r]=t.split(".").map(u=>Number(u));return n!==i?n-i:o-r}function te(e,t){return Ie(e,t)>=0}async function kt(e){let t=new Set,n=k(14,10);for(let f of n)try{let c=await execa(f.command,f.args,{timeout:2500}),m=He(`${c.stdout||""}
@@ -120,7 +120,7 @@ for %%R in ("%USERPROFILE%\\.local\\bin\\rapidkit.exe" "%APPDATA%\\Python\\Scrip
120
120
  echo RapidKit launcher could not find a local Python CLI. 1>&2
121
121
  ${o}echo Tip: for npm-owned workspace commands, run npx --yes --package workspai workspai %* from a shell where npm is on PATH. 1>&2
122
122
  exit /b 1
123
- `}async function ge(e,t,n={}){await b.outputFile(d.join(e,"rapidkit"),xt(t,n),{encoding:"utf-8",mode:493}),await b.outputFile(d.join(e,"rapidkit.cmd"),It(t,n),"utf-8");}async function rn(e,t){let{skipGit:n=false,skipPythonEngine:o=false,testMode:i$1=false,demoMode:r=false,dryRun:u=false,yes:h=false,userConfig:l={},installMethod:w,profile:g$2,parentDirectory:f,suppressReceipt:c=false,json:m=false}=t,p=e||"rapidkit",s=f?d.resolve(f,p):d.resolve(process.cwd(),p);if(await b.pathExists(s))throw new e$1(p);if(await g(s),u){if(!m){let v=g$2||(h?"minimal":void 0),I=w||l.defaultInstallMethod||"poetry",E=l.pythonVersion||"3.10";await _t(s,p,r,l,v,I,E,n,o);}return}if(r){await Et(s,p,n);return}let $=new Set(["python-only","polyglot","enterprise"]),k=g$2||"";if(!h&&!g$2){let{selectedProfile:v}=await b$2([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);k=v;}else k||(k="minimal");let U=!h&&$.has(k),q=$.has(k)?o?"skip":U?(await b$2([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install":"skip",_e=U&&q==="install",st=typeof l.pythonVersion=="string"&&l.pythonVersion.trim().length>0?l.pythonVersion.trim():void 0,lt=w||l.defaultInstallMethod||"poetry",C=q==="install"?await Pt():{poetry:true,pipx:true,pip:true,venv:true},Ce=_e?await kt(st):{choices:nt.map(v=>({name:v,value:v})),defaultValue:V},ct=bt(lt,C),pt=[{name:C.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":C.pipx||C.pip?"\u{1F3AF} Poetry (Recommended) \u2014 not detected (can be installed)":"\u{1F3AF} Poetry (Recommended) \u2014 unavailable (system pipx package required)",value:"poetry"},{name:C.venv?"\u{1F4E6} pip with venv (Standard, zero extra tools)":"\u{1F4E6} pip with venv \u2014 unavailable (system venv package required)",value:"venv"},{name:C.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":C.pip?"\u{1F527} pipx (Global isolated) \u2014 not detected (can be installed)":"\u{1F527} pipx (Global isolated) \u2014 unavailable (system pipx package required)",value:"pipx"}],x=_e?await b$2([{type:"rawlist",name:"pythonVersion",message:"Select minimum Python version for RapidKit:",choices:Ce.choices,default:Ce.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:pt,default:ct}]):await(async()=>{if(q==="skip")return {pythonVersion:l.pythonVersion||"3.10",installMethod:"venv"};let v=w||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return e$2.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:l.pythonVersion||"3.10",installMethod:v}})();if(O(k)){let v=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),I=await le(s);try{await b.ensureDir(s),v.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,k,{bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"workspace-profile-does-not-install-python-at-create"}),await G(s);let E=await b$4(s,{workspaceName:p,silent:true});await Q(I),n||await Z(s,v,"Initial commit: Workspai workspace"),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:E?.projectCount??0});}catch(E){return v.fail("Failed to create workspace"),F(I,E)}return}if($.has(k)&&q==="skip"){let v=b$3("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"}),I=await le(s);try{await b.ensureDir(s),v.succeed("Directory created");let E={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await X(s,p,"venv",void 0,E),await ee(s,p,"venv",void 0,k,E),await G(s),await ge(s,"venv",{pythonEngineSkipped:true});let R=await b$4(s,{workspaceName:p,silent:true});await Q(I),n||await Z(s,v,`Initial commit: Workspai workspace (${k})`),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:R?.projectCount??0,pythonEngine:"skipped",note:"Install the optional Python engine later only when a Python-backed kit needs it."});return}catch(E){return v.fail("Failed to create workspace"),F(I,E)}}{let v=M(),I=false;try{await execa(v,["--version"],{timeout:5e3}),I=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),I=true;}catch{I=false;}}if(!I){let E=k,R=wt(k);if(U&&!h){console.log(a$2.yellow(`
123
+ `}async function ge(e,t,n={}){await b.outputFile(d.join(e,"rapidkit"),xt(t,n),{encoding:"utf-8",mode:493}),await b.outputFile(d.join(e,"rapidkit.cmd"),It(t,n),"utf-8");}async function rn(e,t){let{skipGit:n=false,skipPythonEngine:o=false,testMode:i$1=false,demoMode:r=false,dryRun:u=false,yes:h=false,userConfig:l={},installMethod:w,profile:g$2,parentDirectory:f,suppressReceipt:c=false,json:m=false}=t,p=e||"rapidkit",s=f?d.resolve(f,p):d.resolve(process.cwd(),p);if(await b.pathExists(s))throw new e$1(p);if(await g(s),u){if(!m){let v=g$2||(h?"minimal":void 0),I=w||l.defaultInstallMethod||"poetry",E=l.pythonVersion||"3.10";await _t(s,p,r,l,v,I,E,n,o);}return}if(r){await Et(s,p,n);return}let $=new Set(["python-only","polyglot","enterprise"]),k=g$2||"";if(!h&&!g$2){let{selectedProfile:v}=await b$2([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);k=v;}else k||(k="minimal");let U=!h&&$.has(k),q=$.has(k)?o?"skip":U?(await b$2([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install":"skip",_e=U&&q==="install",st=typeof l.pythonVersion=="string"&&l.pythonVersion.trim().length>0?l.pythonVersion.trim():void 0,lt=w||l.defaultInstallMethod||"poetry",C=q==="install"?await Pt():{poetry:true,pipx:true,pip:true,venv:true},Ce=_e?await kt(st):{choices:nt.map(v=>({name:v,value:v})),defaultValue:V},ct=bt(lt,C),pt=[{name:C.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":C.pipx||C.pip?"\u{1F3AF} Poetry (Recommended) \u2014 not detected (can be installed)":"\u{1F3AF} Poetry (Recommended) \u2014 unavailable (system pipx package required)",value:"poetry"},{name:C.venv?"\u{1F4E6} pip with venv (Standard, zero extra tools)":"\u{1F4E6} pip with venv \u2014 unavailable (system venv package required)",value:"venv"},{name:C.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":C.pip?"\u{1F527} pipx (Global isolated) \u2014 not detected (can be installed)":"\u{1F527} pipx (Global isolated) \u2014 unavailable (system pipx package required)",value:"pipx"}],x=_e?await b$2([{type:"rawlist",name:"pythonVersion",message:"Select minimum Python version for RapidKit:",choices:Ce.choices,default:Ce.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:pt,default:ct}]):await(async()=>{if(q==="skip")return {pythonVersion:l.pythonVersion||"3.10",installMethod:"venv"};let v=w||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return e$2.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:l.pythonVersion||"3.10",installMethod:v}})();if(V$1(k)){let v=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),I=await le(s);try{await b.ensureDir(s),v.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,k,{bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"workspace-profile-does-not-install-python-at-create"}),await G(s);let E=await b$4(s,{workspaceName:p,silent:true});await Q(I),n||await Z(s,v,"Initial commit: Workspai workspace"),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:E?.projectCount??0});}catch(E){return v.fail("Failed to create workspace"),F(I,E)}return}if($.has(k)&&q==="skip"){let v=b$3("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"}),I=await le(s);try{await b.ensureDir(s),v.succeed("Directory created");let E={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await X(s,p,"venv",void 0,E),await ee(s,p,"venv",void 0,k,E),await G(s),await ge(s,"venv",{pythonEngineSkipped:true});let R=await b$4(s,{workspaceName:p,silent:true});await Q(I),n||await Z(s,v,`Initial commit: Workspai workspace (${k})`),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:R?.projectCount??0,pythonEngine:"skipped",note:"Install the optional Python engine later only when a Python-backed kit needs it."});return}catch(E){return v.fail("Failed to create workspace"),F(I,E)}}{let v=M(),I=false;try{await execa(v,["--version"],{timeout:5e3}),I=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),I=true;}catch{I=false;}}if(!I){let E=k,R=wt(k);if(U&&!h){console.log(a$2.yellow(`
124
124
  \u26A0\uFE0F Python 3.10+ is not detected on this system.
125
125
  `)),console.log(a$2.cyan(`You have 3 options:
126
126
  `));let{pythonAction:D}=await b$2([{type:"rawlist",name:"pythonAction",message:"What would you like to do?",choices:[{name:"\u{1F4E5} Install Python now (I'll show you the command for your OS)",value:"install"},{name:`\u{1F504} Switch to "${R}" profile (no Python required)`,value:"fallback"},{name:"\u274C Cancel and install Python manually",value:"cancel"}]}]);if(D==="cancel"&&(console.log(a$2.cyan(`
@@ -136,9 +136,9 @@ exit /b 1
136
136
  `))),console.log(a$2.gray(` After installing, run: npx workspai ${p}
137
137
  `)),process.exit(0);}if(D==="fallback"&&(console.log(a$2.green(`
138
138
  \u2705 Switching to "${R}" profile (no Python required).
139
- `)),k=R,O(R))){let A=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),Y=await le(s);try{await b.ensureDir(s),A.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,R,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await G(s);let fe=await b$4(s,{workspaceName:p,silent:true});await Q(Y),n||await Z(s,A,`Initial commit: Workspai workspace (${R} profile)`),c||J({workspaceName:p,workspacePath:s,profile:R,projectCount:fe?.projectCount??0,note:`Requested ${E}; used ${R} because Python was unavailable.`});return}catch(fe){return A.fail("Failed to create workspace"),F(Y,fe)}}}else if(console.log(a$2.yellow(`
139
+ `)),k=R,V$1(R))){let A=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),Y=await le(s);try{await b.ensureDir(s),A.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,R,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await G(s);let fe=await b$4(s,{workspaceName:p,silent:true});await Q(Y),n||await Z(s,A,`Initial commit: Workspai workspace (${R} profile)`),c||J({workspaceName:p,workspacePath:s,profile:R,projectCount:fe?.projectCount??0,note:`Requested ${E}; used ${R} because Python was unavailable.`});return}catch(fe){return A.fail("Failed to create workspace"),F(Y,fe)}}}else if(console.log(a$2.yellow(`
140
140
  \u26A0\uFE0F Python not detected. Auto-switching to "${R}" profile (no Python required).
141
- `)),k=R,O(R)){let D=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),A=await le(s);try{await b.ensureDir(s),D.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,R,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await G(s);let Y=await b$4(s,{workspaceName:p,silent:true});await Q(A),n||await Z(s,D,`Initial commit: Workspai workspace (${R})`),c||J({workspaceName:p,workspacePath:s,profile:R,projectCount:Y?.projectCount??0,note:`Requested ${E}; used ${R} because Python was unavailable.`});return}catch(Y){return D.fail("Failed to create workspace"),F(A,Y)}}}}if(x.installMethod==="venv"&&!C.venv){let v=await xe(i()),I=v?ot(v):null;throw new g$1(`python${I||x.pythonVersion}-venv`,d.basename(s))}if(x.installMethod==="pipx"&&!C.pipx&&!C.pip)throw new h$1;if(x.installMethod==="poetry"&&!C.poetry&&!C.pipx&&!C.pip)throw new c$2;let _=b$3("Creating directory",{component:"create",phase:"workspace.directory"}),Ae=await le(s);try{await b.ensureDir(s),_.succeed("Directory created"),_.start("Detecting Python version");let v=null,I=await it(x.pythonVersion);if(I)v=await xe(I),v?(e$2.info(` Detected Python ${v}`),_.succeed(`Python ${v} detected`)):_.warn("Could not detect exact Python version");else {let R=M();v=await xe(R),v?_.succeed(`Python ${v} detected`):_.warn("Could not detect Python version, proceeding with defaults");}if(await X(s,p,x.installMethod,v||void 0),await ee(s,p,x.installMethod,v||x.pythonVersion,k||g$2),await G(s),await Be(s,p),x.installMethod==="poetry")try{await at(s,x.pythonVersion,_,i$1,l,h);}catch(R){let ne=R?.details||R?.message||String(R);if(ne.includes("pyenv")||ne.includes("exit status 127")||ne.includes("returned non-zero exit status 127")){_.warn("Poetry encountered Python discovery issues, trying venv method"),e$2.debug(`Poetry error (attempting venv fallback): ${ne}`);try{await Ee(s,x.pythonVersion,_,i$1,l),x.installMethod="venv";}catch(A){throw A}}else throw R}else x.installMethod==="venv"?await Ee(s,x.pythonVersion,_,i$1,l):await rt(s,_,i$1,l,h);v&&await vt(s,v),await ge(s,x.installMethod),_.succeed("Workspai environment ready!");let E=await b$4(s,{workspaceName:p,silent:true});await Q(Ae),t.skipGit||await Z(s,_,"Initial commit: Workspai environment"),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:E?.projectCount??0,pythonEngine:"installed",pythonVersion:x.pythonVersion,installMethod:x.installMethod});}catch(v){return _.fail("Failed to create Workspai environment"),F(Ae,v)}}async function it(e){let t=[];if(!b$5())try{let{stdout:r}=await execa("pyenv",["which","python"]),u=r.trim();u&&t.push(u);}catch{}let n=Number(e.split(".")[1]),o=k(n,10).map(r=>r.command).filter(Boolean);t.push(`python${e}`,...o,...j());let i=[...new Set(t)];for(let r of i)try{let u=r==="py"?["-3","--version"]:["--version"],h=r==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:l}=await execa(r,u,{timeout:2e3}),w=l.match(/Python (\d+\.\d+)/)?.[1];if(w&&te(w,e))return await execa(r,h,{timeout:2e3}),r}catch{continue}return null}async function at(e,t,n,o,i,r=false){await Rt(n,r),n.start("Finding Python interpreter");let u=await it(t);u?(e$2.debug(`Found working Python: ${u}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let h=d.join(e,"pyproject.toml"),w=(await b.pathExists(h)?await promises.readFile(h,"utf-8"):"").includes("rapidkit-core");if(w)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${t}`],{cwd:e}),n.succeed("Poetry project initialized");let m=await promises.readFile(h,"utf-8");m.includes("[tool.poetry]")?m=m.replace("[tool.poetry]",`[tool.poetry]
141
+ `)),k=R,V$1(R)){let D=b$3("Creating workspace",{component:"create",phase:"workspace.python-free"}),A=await le(s);try{await b.ensureDir(s),D.succeed("Directory created"),await X(s,p,"venv",void 0),await ee(s,p,"venv",void 0,R,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await G(s);let Y=await b$4(s,{workspaceName:p,silent:true});await Q(A),n||await Z(s,D,`Initial commit: Workspai workspace (${R})`),c||J({workspaceName:p,workspacePath:s,profile:R,projectCount:Y?.projectCount??0,note:`Requested ${E}; used ${R} because Python was unavailable.`});return}catch(Y){return D.fail("Failed to create workspace"),F(A,Y)}}}}if(x.installMethod==="venv"&&!C.venv){let v=await xe(i()),I=v?ot(v):null;throw new g$1(`python${I||x.pythonVersion}-venv`,d.basename(s))}if(x.installMethod==="pipx"&&!C.pipx&&!C.pip)throw new h$1;if(x.installMethod==="poetry"&&!C.poetry&&!C.pipx&&!C.pip)throw new c$2;let _=b$3("Creating directory",{component:"create",phase:"workspace.directory"}),Ae=await le(s);try{await b.ensureDir(s),_.succeed("Directory created"),_.start("Detecting Python version");let v=null,I=await it(x.pythonVersion);if(I)v=await xe(I),v?(e$2.info(` Detected Python ${v}`),_.succeed(`Python ${v} detected`)):_.warn("Could not detect exact Python version");else {let R=M();v=await xe(R),v?_.succeed(`Python ${v} detected`):_.warn("Could not detect Python version, proceeding with defaults");}if(await X(s,p,x.installMethod,v||void 0),await ee(s,p,x.installMethod,v||x.pythonVersion,k||g$2),await G(s),await Be(s,p),x.installMethod==="poetry")try{await at(s,x.pythonVersion,_,i$1,l,h);}catch(R){let ne=R?.details||R?.message||String(R);if(ne.includes("pyenv")||ne.includes("exit status 127")||ne.includes("returned non-zero exit status 127")){_.warn("Poetry encountered Python discovery issues, trying venv method"),e$2.debug(`Poetry error (attempting venv fallback): ${ne}`);try{await Ee(s,x.pythonVersion,_,i$1,l),x.installMethod="venv";}catch(A){throw A}}else throw R}else x.installMethod==="venv"?await Ee(s,x.pythonVersion,_,i$1,l):await rt(s,_,i$1,l,h);v&&await vt(s,v),await ge(s,x.installMethod),_.succeed("Workspai environment ready!");let E=await b$4(s,{workspaceName:p,silent:true});await Q(Ae),t.skipGit||await Z(s,_,"Initial commit: Workspai environment"),c||J({workspaceName:p,workspacePath:s,profile:k,projectCount:E?.projectCount??0,pythonEngine:"installed",pythonVersion:x.pythonVersion,installMethod:x.installMethod});}catch(v){return _.fail("Failed to create Workspai environment"),F(Ae,v)}}async function it(e){let t=[];if(!b$5())try{let{stdout:r}=await execa("pyenv",["which","python"]),u=r.trim();u&&t.push(u);}catch{}let n=Number(e.split(".")[1]),o=k(n,10).map(r=>r.command).filter(Boolean);t.push(`python${e}`,...o,...j());let i=[...new Set(t)];for(let r of i)try{let u=r==="py"?["-3","--version"]:["--version"],h=r==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:l}=await execa(r,u,{timeout:2e3}),w=l.match(/Python (\d+\.\d+)/)?.[1];if(w&&te(w,e))return await execa(r,h,{timeout:2e3}),r}catch{continue}return null}async function at(e,t,n,o,i,r=false){await Rt(n,r),n.start("Finding Python interpreter");let u=await it(t);u?(e$2.debug(`Found working Python: ${u}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let h=d.join(e,"pyproject.toml"),w=(await b.pathExists(h)?await promises.readFile(h,"utf-8"):"").includes("rapidkit-core");if(w)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${t}`],{cwd:e}),n.succeed("Poetry project initialized");let m=await promises.readFile(h,"utf-8");m.includes("[tool.poetry]")?m=m.replace("[tool.poetry]",`[tool.poetry]
142
142
  package-mode = false`):m.includes("[project]")&&(m.includes("[build-system]")?m=m.replace("[build-system]",`
143
143
  [tool.poetry]
144
144
  package-mode = false
@@ -0,0 +1,10 @@
1
+ import {d,b,e}from'./chunk-P5LI5DL3.js';import {a}from'./chunk-NMXGSVMD.js';import {d as d$3}from'./chunk-S5KTATOU.js';import {B,q as q$2,A,u as u$1,z,D}from'./chunk-O3TVVQ6X.js';import {d as d$2,c as c$1}from'./chunk-ROOPODG6.js';import {k,m,g as g$1,f}from'./chunk-LUPKDFQ3.js';import {g}from'./chunk-BLEIUQL6.js';import {q as q$3,e as e$1,g as g$2}from'./chunk-6BO4QHKA.js';import {a as a$1}from'./chunk-TQEMLBAG.js';import {c,d as d$1}from'./chunk-25AWHAB5.js';import {u,q as q$1,t as t$1}from'./chunk-VQZ5PI5J.js';import {p as p$1,t}from'./chunk-ODK4LCEL.js';import J from'fs';import p from'path';import M from'chalk';import {execa}from'execa';var St={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Rt={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],c:["cmake -S . -B build"],cpp:["cmake -S . -B build"],elixir:["mix deps.get"],ruby:["bundle install"],clojure:["clojure -P"],scala:["sbt update"],kotlin:["./gradlew dependencies","gradle dependencies"],deno:[],bun:["bun install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],c:["ctest --test-dir build --output-on-failure"],cpp:["ctest --test-dir build --output-on-failure"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],clojure:["clojure -X:test"],scala:["sbt test"],kotlin:["./gradlew test","gradle test"],deno:["deno task test","deno test"],bun:["bun test","bun run test"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],c:["cmake --build build"],cpp:["cmake --build build"],elixir:["mix compile"],ruby:["gem build *.gemspec"],clojure:[],scala:["sbt compile"],kotlin:["./gradlew build","gradle build"],deno:["deno task build"],bun:["bun run build"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],c:[],cpp:[],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],clojure:["clojure -M:run"],scala:["sbt run"],kotlin:["./gradlew run","gradle run"],deno:["deno task start","deno task dev"],bun:["bun run start","bun run dev"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function fe(e,r){if(r){let t=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=f(r),o=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:t==="fiber"?"fiber":t==="aspnetcore"||t==="asp-net-core"?"aspnetcore":t}`;return St[o]}}function Ze(e,r,t){if(r){let n=fe(e,r);if(n&&n.commands[t])return n.commands[t]}if(["init","test","build","start"].includes(t)){let n=Rt[t]?.[e]??[];return n.length>0?n[0]:void 0}}var Ct={test:"test",build:"build",start:"start"};function ge(e){if(e.stage==="init")return e.runtime==="node"?A(e.projectPath):Ze(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=Ct[e.stage];if(r){let t=u$1(e.projectPath,r,{framework:e.framework});if(t)return z(e.projectPath,t.scriptName)}}return Ze(e.runtime,e.framework,e.stage)}function Et(e){let r=k(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,s)=>s.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function rt(e){return Et(e).primary}function nt(e,r,t){if(!e)return "unknown";r||(r={timeout:["timed out","timeout","deadline exceeded","SocketTimeoutException"],dependency:["cannot find module","import.*error","Could not find a package configuration file provided by","CMAKE_PREFIX_PATH","failed to fetch","error while requesting resource","unable to (?:resolve|connect)","could not resolve host","network (?:is )?unreachable","ECONNREFUSED","ENOTFOUND","EAI_AGAIN","getaddrinfo","npm error","npm ERR!","registry.npmjs","pypi.org","Could not fetch URL","Max retries exceeded","NewConnectionError"],setup:["ModuleNotFoundError","No module named","error:","not found"],"test-failure":["FAILED","FAIL","failed"],runtime:["Exception","Error:","panic","TypeError"],unknown:[]});for(let[n,s]of Object.entries(r))if(!(n==="test-failure"&&t&&t!=="test")){for(let o of s)if(new RegExp(o,"i").test(e))return n}return "unknown"}async function ne(e,r){let t=e.split(/[&|;]\s*/)[0].trim(),n=async i=>{let d=p.isAbsolute(i)?i:p.resolve(r??process.cwd(),i);try{return await J.promises.access(d,process.platform==="win32"?J.constants.F_OK:J.constants.X_OK),true}catch{return false}};if((t.includes("/")||t.includes("\\"))&&await n(t))return {valid:true};let s=t.split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(s))return {valid:true};if(s.includes("/")||s.includes("\\")){let i=p.isAbsolute(s)?s:p.resolve(r??process.cwd(),s);try{return await J.promises.access(i,process.platform==="win32"?J.constants.F_OK:J.constants.X_OK),{valid:true}}catch{return {valid:false,reason:`Command '${s}' not found or not executable in '${r??process.cwd()}'`}}}try{let i=process.platform==="win32"?"where":"which";if((await execa(i,[s],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${s}' not found or not executable`}}function st(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(s=>["init","test","build","start"].includes(s))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}async function ot(e,r){if(!e)return {healthy:true};switch(e.type){case "port":{let t=e.value;try{let n=await import('net');return new Promise(s=>{let o=new n.Socket,i=5e3;o.setTimeout(i),o.on("connect",()=>{o.destroy(),s({healthy:true,reason:`Port ${t} is listening`});}),o.on("timeout",()=>{o.destroy(),s({healthy:false,reason:`Port ${t} timeout after ${i}ms`});}),o.on("error",d=>{o.destroy(),s({healthy:false,reason:`Port ${t} error: ${String(d)}`});}),o.connect(t,"localhost");})}catch(n){return {healthy:false,reason:`Port check error: ${n instanceof Error?n.message:String(n)}`}}}case "http":{let t=e.value,n;try{let s=new AbortController;n=setTimeout(()=>s.abort(),5e3);let o=await fetch(t,{method:"GET",signal:s.signal});return {healthy:o.status===200,reason:`HTTP ${o.status}`,metadata:{status:o.status}}}catch(s){return {healthy:false,reason:`HTTP check error: ${s instanceof Error?s.message:String(s)}`}}finally{n&&clearTimeout(n);}}case "log":{let t=e.value;if(!r)return {healthy:true};try{let n=[p.join(r,".workspai","last-run.log"),p.join(r,".rapidkit","last-run.log")].find(s=>J.existsSync(s));if(n){let s=J.readFileSync(n,"utf-8"),o=new RegExp(t,"i");return {healthy:o.test(s),reason:o.test(s)?"Log pattern found":"Log pattern not found"}}return {healthy:true,reason:"No log file to check"}}catch(n){return {healthy:false,reason:`Log check error: ${n instanceof Error?n.message:String(n)}`}}}case "command":{let t=e.value;try{let n=await execa(t,[],{cwd:r,reject:false,shell:true});return {healthy:n.exitCode===0,reason:n.exitCode===0?"Health check passed":"Health check failed",metadata:{exitCode:n.exitCode}}}catch(n){return {healthy:false,reason:`Command check error: ${n instanceof Error?n.message:String(n)}`}}}default:return {healthy:true}}}var at={init:"init",test:"test",build:"build",start:"start"};function jt(e){return e in at?at[e]:null}function Pt(e,r){let n=q$2(e)?.contextJson?.commands;if(!n||typeof n!="object"||Array.isArray(n))return;let s=n[r];if(typeof s=="string"&&s.trim().length>0)return s.trim();if(s&&typeof s=="object"&&!Array.isArray(s)){let o=s,i=o.default??o.dev;if(typeof i=="string"&&i.trim().length>0)return i.trim()}}function it(e,r,t=D(e)){let n=jt(r);if(!n)return Pt(e,r)?{supported:true}:{supported:false,reason:`Workspace stage "${r}" is not part of the Workspai fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No Workspai project metadata was detected for this target."};let s=t.commandMap[n];if(!s||s.status!=="supported"){let o=t.runtimeSupportTier==="observed"||t.frameworkSupportTier==="observed";return {supported:false,reason:s?.reason??`Command "${n}" is not supported for this project runtime/framework.`,shouldFail:!o}}return {supported:true}}var At=new Set(["init","test","build","start"]),Ft=new Set([".git","node_modules",".workspai",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function q(e){try{return await J.promises.access(e,J.constants.F_OK),true}catch{return false}}function ut(e,r){let t=p.relative(p.resolve(e),p.resolve(r));return t===""||!t.startsWith(`..${p.sep}`)&&t!==".."&&!p.isAbsolute(t)}function Ot(e){let r=p.resolve(e.projectPath,e.unit.root);return !e.selectedProjectPaths.some(t=>p.resolve(t)===p.resolve(e.projectPath)?false:ut(e.projectPath,t)&&ut(t,r))}async function Tt(e){for(let r of e)if(await q(r))return true;return false}async function Dt(e,r,t){if(r==="python"){let i=[p.join(e,".workspai","cli.py"),p.join(e,".rapidkit","cli.py")];for(let d of i)if(await q(d))return {valid:true};return {valid:false,reason:"Project-local .workspai/cli.py is missing. Run `workspai init` in this project first."}}let s={go:"go",rust:"cargo",dotnet:"dotnet",php:"php"}[r];if(s)return ne(s,e);let o=t.trim().split(/\s+/)[0];if(o&&["npm","npx","pnpm","yarn"].includes(o)){let i=e$1(o);if((await execa(i.command,[...i.prefixArgs,"--version"],{reject:false,env:g$2()})).exitCode===0)return {valid:true}}return ne(t,e)}async function oe(e){let r=await J.promises.readFile(e,"utf-8");return JSON.parse(r)}function U(e){return e.replace(/\\/g,"/")}function It(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function $t(e){let r=p.join(e,p$1.model);if(await q(r))try{let n=((await oe(r)).projects??[]).map(s=>typeof s.path=="string"?d$2(e,s.path):null).filter(s=>!!s).filter((s,o,i)=>i.indexOf(s)===o).filter(s=>J.existsSync(s));if(n.length>0)return n.sort()}catch{}return a(e,{skipDirs:Ft,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(t,n)=>await Tt([...u(t,"context.json"),...u(t,"project.json")])?true:p.resolve(t)===p.resolve(n)?false:k(t).length>0})}async function gt(e){for(let r of [p.join(".workspai","project.json"),p.join(".workspai","context.json"),p.join(".rapidkit","project.json"),p.join(".rapidkit","context.json")]){let t=p.join(e,r);if(await q(t))try{let n=await oe(t),s=n.name??n.projectName??n.slug;if(typeof s=="string"&&s.trim())return s.trim()}catch{}}return null}async function Mt(e){for(let r of [p.join(".workspai","project.json"),p.join(".workspai","context.json"),p.join(".rapidkit","project.json"),p.join(".rapidkit","context.json")]){let t=p.join(e,r);if(await q(t))try{let n=await oe(t);for(let s of ["kind","category","project_type"]){let o=n[s];if(typeof o=="string"&&o.trim().toLowerCase()==="gateway")return true}}catch{}}return false}async function Nt(e,r,t){let n=It(t);if(!n)return {projects:r,normalizedScope:null};let s=U(n).toLowerCase(),o=[];for(let i of r){let d=await gt(i);c$1({workspacePath:e,projectPath:i,declaredName:d}).map(g=>U(g).toLowerCase()).includes(s)&&o.push(i);}if(o.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:o,normalizedScope:n}}async function Wt(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false,env:a$1()});if(n.exitCode!==0)return new Set(r);let s=n.stdout.split(/\r?\n/).map(i=>i.trim()).filter(i=>i.length>0).map(i=>U(i));if(s.length===0)return new Set;let o=new Set;for(let i of r){let d=U(p.relative(e,i));if(!d||d===".")continue;let u=`${d}/`;s.some(g=>g===d||g.startsWith(u))&&o.add(i);}return o}async function Lt(e,r,t$1){let n=await g(e,t.workspaceContract)??q$1(e,"workspace.contract.json");if(await q(n))try{let l=await _t(e,r,t$1,n);if(l.graphStatus!=="missing")return l}catch{return {expanded:t$1,graphStatus:"invalid",expansionDepth:0}}let s=await g(e,".workspai/workspace-dependency-graph.json")??q$1(e,"workspace-dependency-graph.json");if(!await q(s))return {expanded:t$1,graphStatus:"missing",expansionDepth:0};let o;try{o=await oe(s);}catch{return {expanded:t$1,graphStatus:"invalid",expansionDepth:0}}let i=new Set(r.map(l=>p.resolve(l))),d=new Map;if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t$1,graphStatus:"invalid",expansionDepth:0};let u=Array.isArray(o.projects)?o.projects:[];for(let l of u){if(!l||typeof l!="object"||Array.isArray(l))continue;let c=l,f=typeof c.path=="string"?c.path:"",x=p.resolve(e,f);if(!i.has(x))continue;let v=Array.isArray(c.dependsOn)?c.dependsOn.filter(k=>typeof k=="string"):[];for(let k of v){let R=p.resolve(e,k);i.has(R)&&(d.has(R)||d.set(R,new Set),d.get(R)?.add(x));}}let g$1=d$3(d,t$1);return {expanded:g$1.reached,graphStatus:"loaded",expansionDepth:g$1.added}}async function _t(e,r,t,n){let s=await oe(n);if(!s||typeof s!="object"||Array.isArray(s))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let o=s,i=Array.isArray(o.projects)?o.projects:null;if(!i)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let d=new Map,u=new Map;for(let x of r){let v=U(p.relative(e,x));u.set(v,p.resolve(x));}let g=new Map,l=new Map,c=new Map;for(let x of i){if(!x||typeof x!="object"||Array.isArray(x))continue;let v=x,k=typeof v.slug=="string"?v.slug:"",R=typeof v.relativePath=="string"?U(v.relativePath):k,b=u.get(R);!k||!b||d.set(k,b);}for(let x of i){if(!x||typeof x!="object"||Array.isArray(x))continue;let v=x,k=typeof v.slug=="string"?v.slug:"",R=d.get(k);if(!R)continue;let b=v.contracts&&typeof v.contracts=="object"&&!Array.isArray(v.contracts)?v.contracts:{},E=Array.isArray(b.dependsOn)?b.dependsOn.filter(w=>typeof w=="string"):[],N=Array.isArray(b.publishes)?b.publishes.filter(w=>typeof w=="string"):[],z=Array.isArray(b.consumes)?b.consumes.filter(w=>typeof w=="string"):[];for(let w of E){let A=d.get(w);A&&(c.has(A)||c.set(A,new Set),c.get(A)?.add(R));}for(let w of N)g.has(w)||g.set(w,new Set),g.get(w)?.add(R);for(let w of z)l.has(w)||l.set(w,new Set),l.get(w)?.add(R);}for(let[x,v]of g.entries()){let k=l.get(x);if(k)for(let R of v){c.has(R)||c.set(R,new Set);for(let b of k)b!==R&&c.get(R)?.add(b);}}let f=d$3(c,t);return {expanded:f.reached,graphStatus:"loaded",expansionDepth:f.added}}async function Gt(e,r){if(typeof r=="boolean")return r;let t=t$1(e,"policies.yml").find(o=>J.existsSync(o))??q$1(e,"policies.yml");if(!await q(t))return true;let n="";try{n=await J.promises.readFile(t,"utf-8");}catch{return true}let s=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return s?s[1]==="true":true}function Bt(e,r){let t=process.env.RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS;if(t){let n=Number.parseInt(t,10);if(Number.isFinite(n)&&n>0)return n}return e!=="init"?9e4:r==="python"||r==="java"||r==="jvm-generic"||r==="dotnet"||r==="rust"?6e5:3e5}function Kt(e){let r=e.trim();if(!r||/[&|;<>()$`"'\n\r]/.test(r))return null;let[t,...n]=r.split(/\s+/);return !t||/^[A-Za-z_][A-Za-z0-9_]*=/.test(t)||![t,...n].every(s=>/^[A-Za-z0-9_./:@%+,=\\-]+$/.test(s))?null:{file:t,args:n}}function Ut(e){let r=p.basename(e).toLowerCase();return r==="python"||r==="python3"||r==="python.exe"||r==="python3.exe"||/(?:^|[\\/])\.venv[\\/]/.test(e)}function zt(e,r){let t=q$3({unitRoot:e}),n=[];for(let s of r){let o=s.args[0]==="-m"&&s.args[1]==="venv";if(!(o&&t.venvExists)){if(Ut(s.executable)&&!o){let i=t.usedForDependencyInstall?t.interpreter:p.isAbsolute(s.executable)?s.executable:p.resolve(e,s.executable);n.push({...s,executable:i});continue}n.push(s);}}return n}function Ht(e){return e.map(r=>[r.executable,...r.args].join(" ")).join(" && ")}function Vt(e){let r=e.split(/\s&&\s/),t=[];for(let n of r){let s=Kt(n);if(!s)return null;t.push({executable:s.file,args:s.args});}return t.length>0?t:null}async function ct(e,r,t){let n="",s="",o=0,i=false,d="",u="";for(let l of r){let c=await execa(l.executable,l.args,{cwd:e,reject:false,timeout:t,forceKillAfterDelay:1e3});n+=`${c.stdout??""}
2
+ `,s+=`${c.stderr??""}
3
+ `,i=!!(typeof c=="object"&&c!==null&&"timedOut"in c&&c.timedOut);let f=c.exitCode,x=i||(typeof f=="number"?f!==0:!!c.failed);if(o=i?124:typeof f=="number"?f:x?127:0,o!==0&&l.executable==="uv"&&(s+="\nMissing admitted lock tool `uv`. Install uv and retry; Workspai does not fall back to an unlocked pip freeze."),o!==0){d=typeof c.message=="string"?c.message:"",u=typeof c.shortMessage=="string"?c.shortMessage:"";break}}let g=ht({stdout:n,stderr:s,message:d,shortMessage:u});return {exitCode:o,stdout:g.stdout,stderr:g.stderr,timedOut:i}}async function Jt(e,r){let t=[];for(let n of r){let s=n.args[0]==="-m"&&n.args[1]==="venv"&&n.args[2],o=p.isAbsolute(n.executable)?p.resolve(n.executable):n.executable.includes("/")||n.executable.includes("\\")?p.resolve(e,n.executable):null;if(!!!(o&&t.some(d=>{let u=p.relative(d,o);return u!==""&&!u.startsWith("..")&&!p.isAbsolute(u)}))){let d=await ne(n.executable,e);if(!d.valid){let u=p.basename(n.executable);return {valid:false,reason:u==="uv"||u==="uv.exe"?"Missing admitted lock tool `uv`. Install uv and retry; no environment was changed.":d.reason||`Required executable is unavailable: ${n.executable}`}}}s&&t.push(p.resolve(e,n.args[2]));}return {valid:true}}function qt(e){let r=e.match(/Ran (\d+) tests?/i);if(!r)return null;let t=Number(e.match(/skipped\s*=\s*(\d+)/i)?.[1]??0),n=Number(e.match(/failures\s*=\s*(\d+)/i)?.[1]??0),s=Number(e.match(/errors\s*=\s*(\d+)/i)?.[1]??0);return {ran:Number(r[1]),skipped:t,failed:n+s}}function dt(e,r){let t=Number.parseInt(process.env[e]??"",10);return Number.isFinite(t)&&t>0?t:r}function Ce(e){return new Promise(r=>setTimeout(r,e))}async function lt(e){let r=process.argv[1];if(e.useRapidkitWrapper&&!r)return {exitCode:1,stdout:"",stderr:"Workspai entrypoint is unavailable for startup verification.",healthStatus:{healthy:false,reason:"Workspai entrypoint is unavailable."}};let t=e.useRapidkitWrapper&&r?execa(process.execPath,[r,"start"],{cwd:e.projectPath,reject:false,timeout:e.timeoutMs,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}}):e.argv?execa(e.argv.executable,e.argv.args,{cwd:e.projectPath,reject:false,timeout:e.timeoutMs}):null;if(!t)return {exitCode:127,stdout:"",stderr:"Refusing to execute a lifecycle start command through a shell.",healthStatus:{healthy:false,reason:"Lifecycle start commands run as argv, not a shell."}};let n=Promise.resolve(t).then(l=>({kind:"exit",result:l}),l=>({kind:"error",error:l})),s=dt("WORKSPAI_WORKSPACE_RUN_STARTUP_GRACE_MS",2e3),o=await Promise.race([n,Ce(s).then(()=>({kind:"alive"}))]);if(o.kind==="error"){let l=typeof o.error=="object"&&o.error!==null&&"timedOut"in o.error&&!!o.error.timedOut;return {exitCode:l?124:1,stdout:"",stderr:o.error instanceof Error?o.error.message:String(o.error),timedOut:l,healthStatus:{healthy:false,reason:"The start command failed before readiness."}}}if(o.kind==="exit"){let l=Number(o.result.exitCode??0);return {exitCode:l,stdout:String(o.result.stdout??""),stderr:String(o.result.stderr??""),healthStatus:{healthy:l===0,reason:l===0?"The start command completed successfully.":`The start command exited with code ${l} before readiness.`}}}let i=fe(e.runtime,e.framework)?.healthCheck,d=i?{healthy:false,reason:"The configured health check has not passed yet."}:{healthy:true,reason:`The service remained alive for ${s}ms (bounded startup smoke).`};if(i){let l=dt("WORKSPAI_WORKSPACE_RUN_STARTUP_HEALTH_TIMEOUT_MS",15e3),c=Date.now()+l;for(;Date.now()<c;){let f=await ot(i,e.projectPath);if(d={healthy:f.healthy,reason:f.reason},f.healthy)break;if((await Promise.race([n,Ce(350).then(()=>({kind:"alive"}))])).kind!=="alive"){d={healthy:false,reason:"The service exited before its configured health check passed."};break}}}try{t.kill?.("SIGTERM",{forceKillAfterDelay:1e3});}catch{try{t.kill?.();}catch{}}let u=await Promise.race([n,Ce(2e3).then(()=>({kind:"alive"}))]),g=u.kind==="exit"?u.result:void 0;return {exitCode:d.healthy?0:1,stdout:String(g?.stdout??""),stderr:String(g?.stderr??""),healthStatus:d}}async function je(e,r,t,n=false){let s=process.argv[1];if(!s)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};let o=false,i,d;try{let u=execa(process.execPath,[s,...e],{cwd:r,reject:false,detached:process.platform!=="win32",env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});t&&t>0&&(d=setTimeout(()=>{o=true;let l=u.pid;if(!l){u.kill("SIGTERM");return}if(process.platform==="win32"){execa("taskkill",["/pid",String(l),"/T","/F"],{reject:false});return}try{process.kill(-l,"SIGTERM");}catch{u.kill("SIGTERM");}i=setTimeout(()=>{try{process.kill(-l,"SIGKILL");}catch{}},1e3),i.unref();},t),d.unref()),n&&(u.stdout?.on("data",l=>process.stdout.write(l)),u.stderr?.on("data",l=>process.stderr.write(l)));let g=await u;return {exitCode:o?124:Number(g.exitCode??1),stdout:g.stdout,stderr:o?`${g.stderr??""}${g.stderr?`
4
+ `:""}Stage timed out after ${t}ms`:g.stderr,shortMessage:g.shortMessage,message:g.message}}catch(u){let g=o||typeof u=="object"&&u!==null&&"timedOut"in u&&!!u.timedOut;return {exitCode:g?124:1,stdout:typeof u=="object"&&u!==null&&"stdout"in u?String(u.stdout??""):"",stderr:g?`Stage timed out after ${t}ms`:typeof u=="object"&&u!==null&&"stderr"in u?String(u.stderr??""):u instanceof Error?u.message:String(u)}}finally{d&&clearTimeout(d),i&&clearTimeout(i);}}function yt(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"||e==="rust"||e==="php"}function Xt(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}function ye(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString("utf8"):e==null?"":String(e)}function ht(e){let r=ye(e.stdout),t=ye(e.stderr);if(r.trim()||t.trim())return {stdout:r,stderr:t};let n=ye(e.message).trim(),s=ye(e.shortMessage).trim();return {stdout:r,stderr:n||s}}function Yt(e,r=8){if(e.length<=r)return e.join(`
5
+ `);let t=kt(e),n=t?e.lastIndexOf(t):-1,s=new Set([0,1]);if(n>=0)for(let o=Math.max(0,n-2);o<=n+2;o+=1)o<e.length&&s.add(o);for(let o=e.length-1;o>=0&&s.size<r;o-=1)s.add(o);return [...s].sort((o,i)=>o-i).slice(0,r).map(o=>e[o]).join(`
6
+ `)}function kt(e){let r=/(?:\bnot found\b|\bno such\b|\bmissing\b|\bfailed\b|\berror\b|\bexception\b|\bcannot\b|\bdenied\b|\btimeout\b|\btimed out\b|\benoent\b|\beacces\b|\beperm\b)/i;return [...e].reverse().find(t=>r.test(t))??e.at(-1)}async function Zt(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function Ee(e){let r=c=>{let f=g$1(c);return f==="node"||f==="bun"?"node":f==="python"?"python":f==="go"?"go":f==="java"?"java":f==="php"?"php":f==="ruby"?"ruby":f==="rust"?"rust":f==="dotnet"?"dotnet":f==="elixir"?"elixir":f==="clojure"||f==="scala"||f==="kotlin"?"jvm-generic":rt(e)},t=c=>{if(!c)return;let f$1=f(c);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(f$1))return f$1},n=q$2(e),s=n?.detection??m(e,n?.projectJson??null),o=n?.contextJson,i=r(s.runtime),d=t(s.key),u={},g=new Set(["init","test","build","start"]);if(o?.commands&&typeof o.commands=="object")for(let[c,f]of Object.entries(o.commands))typeof f=="string"&&g.has(c)&&(u[c]=f);let l;if(o?.commandEnvironments&&typeof o.commandEnvironments=="object"){let c=o.commandEnvironments;l={dev:typeof c.dev=="string"?c.dev:void 0,staging:typeof c.staging=="string"?c.staging:void 0,prod:typeof c.prod=="string"?c.prod:void 0,default:typeof c.default=="string"?c.default:void 0};}return {runtime:i,framework:d,commandOverrides:Object.keys(u).length>0?u:void 0,environmentCommandVariants:l,environment:typeof o?.environment=="string"?o.environment:void 0}}async function pt(e,r,t,n,s,o,i,d=false,u){let g=!s?.[r]&&yt(t),l;if(s&&s[r]?l=s[r]:g?l=`rapidkit ${r}`:l=ge({projectPath:e,runtime:t,framework:n,stage:r}),!l)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let c=st(l,o,i);if(!c)return {exitCode:127,command:l,message:"Failed to resolve stage command",errorCategory:"runtime"};let f=u&&u.length>0?t==="python"?zt(e,u):u:void 0,x=ge({projectPath:e,runtime:t,framework:n,stage:r});if(!f?.length)if(g){if(x){let S=g?await Dt(e,t,x):await ne(x,e);if(!S.valid)return {exitCode:127,command:c,message:S.reason||"Command not available",errorCategory:"setup"}}}else {let S=await ne(c,e);if(!S.valid)return {exitCode:127,command:c,message:S.reason||"Command not available",errorCategory:"setup"}}let v=f?.length?Ht(f):c;if(f?.length){let S=await Jt(e,f);if(!S.valid)return {exitCode:127,command:v,message:S.reason,errorCategory:"setup"}}let k=0,R="",b="",E,N=false,z,w=Bt(r,t),A=Date.now();try{let S=f?.length?f:Vt(c),m={exitCode:127,stdout:"",stderr:"Refusing to execute a lifecycle command through a shell.",timedOut:false},y=r==="start"?await(async()=>{if(g)return lt({projectPath:e,useRapidkitWrapper:g,runtime:t,framework:n,timeoutMs:w});if(!S?.length)return {...m,healthStatus:{healthy:false,reason:"Lifecycle start commands run as argv, not a shell."}};if(S.length>1){let O=await ct(e,S.slice(0,-1),w);if(O.exitCode!==0)return {...O,healthStatus:{healthy:false,reason:"A start prerequisite exited before readiness."}}}return lt({projectPath:e,useRapidkitWrapper:g,runtime:t,framework:n,timeoutMs:w,argv:S[S.length-1]})})():g?r==="init"&&Xt()?await Zt(e):await je([r],e,w,d):S?.length?await ct(e,S,w):m;N=!!(typeof y=="object"&&y!==null&&"timedOut"in y&&y.timedOut),k=N?124:Number(y.exitCode??0);let a=ht(y);if(R=a.stdout,b=a.stderr,z=r==="start"?y.healthStatus:void 0,k!==0){let O=`${R}
7
+ ${b}`,C=Date.now()-A,$=nt(O,void 0,r);E=N||k===124||k===143&&C>=Math.floor(w*.8)||$==="timeout"?"timeout":$;}}catch(S){let m=typeof S=="object"&&S!==null&&"timedOut"in S&&!!S.timedOut,y=m?`Stage timed out after ${w}ms`:S instanceof Error?S.message:"Command execution failed",a=m?"timeout":"runtime";return {exitCode:m?124:1,command:v,message:y,errorCategory:a,failureDiagnostic:{category:a,exitCode:m?124:1,command:v,timedOut:m,timeoutMs:w,outputExcerpt:y}}}let D=`${R}
8
+ ${b}`.split(/\r?\n/).map(S=>S.trim()).filter(Boolean),_=Yt(D),H=kt(D),ee=Date.now()-A;if(r==="test"&&t==="go"&&k!==0&&/(?:matched no packages|no packages to test)/i.test(D.join(`
9
+ `)))return {exitCode:0,command:v,skipped:true,message:"No Go packages matched; test stage is not applicable to this runtime unit."};let I=r==="test"&&t==="python"?qt(`${R}
10
+ ${b}`):null,Y=I!==null&&I.ran>0&&I.failed===0&&I.skipped===I.ran;Y&&k===0&&(k=1,E="runtime");let te=N||k===124||k===143&&ee>=Math.floor(w*.8),ae=k===0?void 0:te?"timeout":E,ie=k===0?void 0:{category:ae??"unknown",exitCode:k,command:v,timedOut:te,timeoutMs:w,outputExcerpt:_||`Stage failed with exit code ${k}`};return {exitCode:k,command:v,errorCategory:ae,healthStatus:z,failureDiagnostic:ie,testCounts:I??void 0,message:te?`Stage timed out after ${w}ms`:Y?`Required Python tests were skipped (${I?.skipped??0}/${I?.ran??0}); missing framework dependencies cannot pass.`:k!==0?H?`Stage failed with exit code ${k}: ${H}`:`Stage failed with exit code ${k}`:void 0}}function mt(e){try{return JSON.parse(e)}catch{return null}}function Qt(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx workspai setup dotnet` or `npx workspai init`.";case "go":return "Install Go 1.21+, then rerun `npx workspai setup go` or `npx workspai init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx workspai setup java` or `npx workspai init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx workspai setup node` or `npx workspai init`.";case "python":return "Install Python 3.10+, then rerun `wspai workspace run init` so Workspai can create the project `.venv` and install into it. Do not pip-install agent dependencies into system Python.";default:return null}}async function er(e){let r=[],t=await je(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let o=mt(t.stdout)?.healthScore,i=Number(o?.errors??0);Number.isFinite(i)&&i>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${i} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await je(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let s=mt(n.stdout),o=String(s?.overallStatus??"").toLowerCase();o==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):o==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}var tr=new Set(["dev","stop"]);function rr(e){let r=e.trim();return !r||tr.has(r.toLowerCase())?false:At.has(r)?true:/^[a-z][a-z0-9_-]*$/i.test(r)}function ft(e,r,t){let n=U(p.relative(t,r));return (Array.isArray(e.projects)?e.projects:[]).some(o=>{if(!o||typeof o!="object")return false;let i=o,d=[i.relativePath,i.path].filter(u=>typeof u=="string"&&u.length>0).map(u=>U(u));return i.status==="passed"&&(d.includes(n)||d.some(u=>u.endsWith(`/${n}`)))})}function nr(e,r){return fe(e,r)?.dependencies??[]}function sr(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function Lr(e$1){if(!rr(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let r=Date.now(),t=p.resolve(e$1.workspacePath);c({blockId:"workspace.run.resolve",status:"running",message:"Resolving workspace project fleet",component:"workspace-run"});let n=await d(t),s=await $t(t),{projects:o,normalizedScope:i}=await Nt(t,s,e$1.scope),d$2=e$1.affected===true,u=e$1.blastRadius===true,g=e$1.since?.trim()||"HEAD~1",l=d$2?await Wt(t,o,g):new Set(o),c$1,f="not-applicable",x=0,v="all";if(d$2&&u){let m=await Lt(t,s,l);c$1=m.expanded,f=m.graphStatus,x=m.expansionDepth,v="affected+blast-radius";}else d$2?(c$1=l,v="affected"):(c$1=l,v="all");c({blockId:"workspace.run.resolve",status:"succeeded",message:`Resolved ${o.length} project(s)`,component:"workspace-run",attributes:{projects:o.length,selectionMode:v}}),c({blockId:"workspace.run.gates",status:"running",message:"Evaluating workspace run gates",component:"workspace-run"});let k=e$1.stage==="init"||e$1.planOnly===true?false:await Gt(t,e$1.enforceGates),R=k?await er(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],b$1=R.find(m=>m.status==="fail");c({blockId:"workspace.run.gates",status:b$1?"blocked":"succeeded",message:b$1?`Blocked by ${b$1.gate}`:"Workspace run gates passed",component:"workspace-run",attributes:{gates:R}});let E=o.filter(m=>c$1.has(m)),N=e$1.continueOnError===true||e$1.stage==="init",z=e$1.parallel===true,w=sr(e$1.maxWorkers,E.length),A=E.length,D=0;c({blockId:"workspace.run.execute",status:b$1?"blocked":"running",message:b$1?`Execution blocked by ${b$1.gate}`:`Executing ${e$1.stage} across ${A} project(s)`,component:"workspace-run",progress:{completed:0,total:A},attributes:{stage:e$1.stage,parallel:z,maxWorkers:w}}),e$1.json||console.log(M.gray(`Workspace run (${e$1.stage}) started: ${A} target(s), ${z?`parallel x${w}`:"sequential"}`));let _=new Map;for(let m of s){let y=U(p.relative(t,m)),a=await gt(m),O=o.includes(m),C=O&&c$1.has(m);_.set(m,{path:m,relativePath:y,projectName:a??(p.basename(y)||p.basename(m)),selected:C,affected:C,status:"skipped",exitCode:null,durationMs:0,reason:C?void 0:O?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(b$1)for(let m of E){let y=_.get(m);y&&(y.status="blocked",y.reason=`blocked by ${b$1.gate}`,y.exitCode=1);}else {let m=async y=>{let a=_.get(y);if(!a)return;let O=U(p.relative(t,y));e$1.json||console.log(M.gray(`\u23F3 [${D}/${A}] ${e$1.stage} ${O}`)),a.selected=true,a.affected=true;let C=Date.now(),$=B(y),T=e$1.runtime?.trim().toLowerCase(),W=$.units.filter(h=>Ot({projectPath:y,unit:h,selectedProjectPaths:E})).filter(h=>!T||h.runtime===T).map(h=>({unit:h,stage:h.stages.find(P=>P.stage===e$1.stage)})).filter(h=>!!h.stage),G=W.map(({unit:h,stage:P})=>({unitId:h.id,runtime:h.runtime,role:h.role,root:h.root,manifest:h.manifest,stage:P.stage,command:P.command,status:"planned",exitCode:null,durationMs:0}));a.runtimeExecutions=G;let Pe=$.polyglot||!!T||W.length>1||W.length===1&&W[0]?.unit.root!=="."||await Mt(y);if(!Pe&&G.length===1){let h=await Ee(y);a.framework=h.framework,a.runtimeDetected=h.runtime;let P=h.commandOverrides?.[e$1.stage],L=P||(yt(h.runtime)?`rapidkit ${e$1.stage}`:ge({projectPath:y,runtime:h.runtime,framework:h.framework,stage:e$1.stage}));if(L){let F=G[0];G.splice(0,G.length,{...F,unitId:`project:${h.runtime}`,root:".",manifest:W.map(({unit:ue})=>ue.manifest).join(", "),command:L});}}if(e$1.planOnly){a.runtimeDetected||(a.runtimeDetected=W[0]?.unit.runtime),a.status="skipped",a.reason=W.length>0?`plan only: ${W.length} runtime unit(s)`:T?`no ${T} runtime unit supports stage "${e$1.stage}"`:`no runtime unit supports stage "${e$1.stage}"`,a.durationMs=Date.now()-C,D+=1;return}if(Pe){if(W.length===0){a.status="failed",a.reason=T?`No ${T} runtime unit supports stage "${e$1.stage}"`:`No runtime unit supports stage "${e$1.stage}"`,a.errorCategory="setup",a.errorMessage=a.reason,a.exitCode=127,a.durationMs=Date.now()-C,D+=1;return}let h;for(let F=0;F<W.length;F+=1){let{unit:ue,stage:we}=W[F],Z=G[F],Fe=p.resolve(y,ue.root),xt=Date.now(),ve=await Ee(Fe),B=await pt(Fe,e$1.stage,ue.runtime,ve.framework,{[e$1.stage]:we.command},ve.environmentCommandVariants,ve.environment,!e$1.json,we.argvSequence);if(Z.durationMs=Date.now()-xt,Z.exitCode=B.exitCode,Z.status=B.skipped?"skipped":B.exitCode===0?"passed":"failed",Z.reason=B.message,Z.errorCategory=B.errorCategory,Z.testCounts=B.testCounts,Z.failureDiagnostic=B.failureDiagnostic,B.exitCode!==0&&!h&&(h=B.message??we.command),B.exitCode!==0&&!N){for(let Oe of G.slice(F+1))Oe.status="skipped",Oe.reason="stopped after runtime-unit failure";break}}let P=G.find(F=>F.status==="failed");a.runtimeDetected=W[0]?.unit.runtime,a.executionCommand=G.filter(F=>F.status!=="skipped").map(F=>`[${F.runtime}:${F.root}] ${F.command}`).join(" && "),a.durationMs=Date.now()-C;let L=G.find(F=>F.status==="passed");a.exitCode=P?.exitCode??0,a.status=P?"failed":L?"passed":"skipped",a.reason=P?h??"runtime-unit stage failed":L?void 0:"No applicable runtime unit executed the requested stage",a.errorCategory=P?P.errorCategory??"runtime":void 0,a.errorMessage=a.reason,a.failureDiagnostic=P?.failureDiagnostic,D+=1;return}let{runtime:he,framework:ke,commandOverrides:bt,environmentCommandVariants:wt,environment:vt}=await Ee(y);a.runtimeDetected=he,a.framework=ke;let be=it(y,e$1.stage);if(!be.supported){a.status=be.shouldFail===false?"skipped":"failed",a.reason=be.reason??`stage "${e$1.stage}" unsupported for project`,a.durationMs=Date.now()-C,a.exitCode=a.status==="failed"?127:null,a.status==="failed"&&(a.errorCategory="setup",a.errorMessage=a.reason),D+=1;return}if(e$1.reusePassed&&n){let h=n.stages[e$1.stage]??n.stages[e$1.stage];if(h&&ft(h,y,t)){a.status="passed",a.reason="reused passed result from workspace-run-last.json",a.durationMs=Date.now()-C,a.exitCode=0,D+=1,e$1.json||console.log(M.gray(`\u21BA reused passed cache for ${O}`));return}}let Ae=nr(he,ke).filter(h=>h!==e$1.stage);if(Ae.length>0&&n){let h=Ae.find(P=>{let L=n.stages[P];return !L||!ft(L,y,t)});if(h){a.status="skipped",a.reason=`dependency stage "${h}" not satisfied in workspace-run-last.json`,a.durationMs=Date.now()-C,a.exitCode=null,D+=1;return}}let j=await pt(y,e$1.stage,he,ke,bt,wt,vt,!e$1.json);a.executionCommand=j.command,a.errorCategory=j.errorCategory,a.healthStatus=j.healthStatus,a.failureDiagnostic=j.failureDiagnostic,a.durationMs=Date.now()-C,a.exitCode=j.exitCode;let V=a.runtimeExecutions?.[0];if(V&&(V.command=j.command,V.status=j.skipped?"skipped":j.exitCode===0?"passed":"failed",V.exitCode=j.exitCode,V.durationMs=a.durationMs,V.reason=j.message,V.errorCategory=j.errorCategory,V.testCounts=j.testCounts,V.failureDiagnostic=j.failureDiagnostic),j.skipped?(a.status="skipped",a.reason=j.message):j.exitCode===0?(a.status="passed",a.reason=void 0):(a.status="failed",a.reason=j.message||"stage command failed",a.errorMessage=j.message),D+=1,!e$1.json){let h=A>0?Math.round(D/A*100):100,P=a.status==="passed"?M.green("\u2705"):M.red("\u274C");if(console.log(M.gray(`${P} [${D}/${A}] (${h}%) ${O} ${a.durationMs}ms`)),a.status==="failed"){a.reason&&console.log(M.red(` Reason: ${a.reason}`)),a.executionCommand&&console.log(M.gray(` Command: ${a.executionCommand}`));let L=Qt(a.runtimeDetected);L&&a.errorCategory==="setup"&&console.log(M.gray(` Hint: ${L}`));}}};if(z&&E.length>1){let y=0,a=false,O=new Array(w).fill(null).map(async()=>{for(;y<E.length;){if(a&&!N)return;let C=y;y+=1;let $=E[C];await m($),_.get($)?.status==="failed"&&(a=true);}});if(await Promise.all(O),!N&&a){let C=false;for(let $ of E){let T=_.get($);if(T){if(T.status==="failed"){C=true;continue}C&&T.status==="skipped"&&(T.reason=T.reason||"stopped after failure");}}}}else for(let y of E){await m(y);let a=_.get(y);if(!N&&a?.status==="failed"){let O=E.slice(E.indexOf(y)+1);for(let C of O){let $=_.get(C);$&&($.status="skipped",$.reason="stopped after failure");}break}}}let H=[];for(let m of s){let y=_.get(m);y&&H.push(y);}let ee=H.filter(m=>m.status==="passed").length,X=H.filter(m=>m.status==="failed").length,I=H.filter(m=>m.status==="blocked").length,Y=H.filter(m=>m.status==="skipped").length;c({blockId:"workspace.run.execute",status:X>0?"failed":b$1?"blocked":"succeeded",message:`Workspace run finished: ${ee} passed, ${X} failed, ${I} blocked, ${Y} skipped`,component:"workspace-run",progress:{completed:A,total:A,percent:100},attributes:{passed:ee,failed:X,blocked:I,skipped:Y,stage:e$1.stage}});let te=e$1.strict===true,ae=X>0||I>0||te&&R.some(m=>m.status==="fail"||m.status==="warn")?1:0,ie={schemaVersion:"1.0",workspacePath:t,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:d$2,blastRadius:u,since:d$2?g:null,parallel:z,maxWorkers:w,continueOnError:N,strict:te,enforceGates:k,scope:i,reusePassed:e$1.reusePassed===true,planOnly:e$1.planOnly===true,runtime:e$1.runtime?.trim()||null},selection:{mode:v,since:d$2?g:null,scope:i,graphStatus:f,expansionDepth:x},gates:{enforced:k,results:R,blocked:!!b$1,blockingGate:b$1?.gate},summary:{projectCount:s.length,selectedCount:E.length,passed:ee,failed:X,skipped:Y,blocked:I,exitCode:ae},projects:H,enterpriseControls:{jsonReady:true,evidencePath:b}},S=p.join(t,b);c({blockId:"workspace.run.publish",status:"running",message:"Publishing workspace run evidence",component:"workspace.run"});try{await e(t,ie),c({blockId:"workspace.run.publish",status:"succeeded",message:"Workspace run evidence published",component:"workspace.run"}),d$1({workspacePath:t,relativePath:b,blockId:"workspace.run.publish"});}catch(m){throw c({blockId:"workspace.run.publish",status:"failed",message:m instanceof Error?m.message:"Workspace run evidence publish failed",component:"workspace.run"}),m}return e$1.json||(b$1&&(console.log(M.red(`\u274C Workspace run blocked by ${b$1.gate}`)),console.log(M.gray(` ${b$1.summary}`))),console.log(M.cyan(`Workspace run (${e$1.stage}) => passed: ${ee}, failed: ${X}, blocked: ${I}, skipped: ${Y}`)),console.log(M.gray(`Report: ${S}`))),ie}export{Bt as a,Lr as b};
@@ -1 +1 @@
1
- import {c}from'./chunk-4MXKXHLW.js';import {j,i,d as d$1,f as f$1,c as c$2,e,h}from'./chunk-QIPW3G2H.js';import {g}from'./chunk-5HNQIMGW.js';import {a as a$1}from'./chunk-AGI46TSQ.js';import {c as c$3}from'./chunk-HRGIHWYH.js';import {b}from'./chunk-DWDYLKVW.js';import {b as b$1}from'./chunk-KO4DM2AV.js';import {d as d$2}from'./chunk-ROOPODG6.js';import {f,i as i$1}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {q,p}from'./chunk-ODK4LCEL.js';import R from'path';import _ from'fs-extra';var we=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ke=/(?:^|\s)(?:\/(?:home|Users|private|var|tmp|mnt|opt|srv|root|workspace|workspaces|data|Volumes|etc|usr|run|dev|proc|sys)\/[^\s]+|[A-Za-z]:[\\/][^\s]+|\\\\[^\\\s]+\\[^\s]+)/,ve=/(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:github_pat_|gh[pousr]_|glpat-|npm_|xox[baprs]-|sk-(?:proj-)?)[A-Za-z0-9_-]{12,}|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b|\bAIza[A-Za-z0-9_-]{20,}|\bBearer\s+[A-Za-z0-9._~+/-]{16,}|[a-z][a-z0-9+.-]*:\/\/[^\s:/]+:[^\s@/]+@|\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*[^\s]{6,})/i,ye=[{category:"test-coverage",patterns:[/\b(?:test\s+)?coverage\b/i,/\bcoverage\s+(?:to|above|at least)\b/i]},{category:"dependency-security",patterns:[/\b(?:dependency|dependencies|package|packages)\b.*\b(?:security|vulnerab|audit)\b/i,/\b(?:security|vulnerab|audit)\b.*\b(?:dependency|dependencies|package|packages)\b/i]},{category:"release-readiness",patterns:[/\brelease[ -]readiness\b/i,/\bready (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare\b[^\n]{0,80}\bfor release\b/i]},{category:"defect-repair",patterns:[/\b(?:fix|repair|resolve|debug)\b.*\b(?:bug|error|failure|issue|regression)\b/i]},{category:"performance",patterns:[/\b(?:performance|latency|throughput|cpu|optimi[sz]e|faster|slower)\b/i,/\b(?:memory\s+(?:allocation|consumption|footprint|leak|pressure|usage)|out[ -]of[ -]memory|heap|ram)\b/i]},{category:"refactor",patterns:[/\b(?:refactor|restructure|decouple|extract|simplify|cleanup|clean up)\b/i]},{category:"documentation",patterns:[/\b(?:document|documentation|readme|guide|tutorial|docs)\b/i]},{category:"feature-change",patterns:[/\b(?:add|build|create|enforce|enhance|harden|implement|improve|introduce|support)\b/i]},{category:"system-understanding",patterns:[/\b(?:understand|explain|map|find|where|how|architecture|analy[sz]e|search)\b/i]}];function Pe(e){if(typeof e!="string")throw new Error("Goal intent must be text.");let t=e.trim().replace(/\s+/g," ");if(!t)throw new Error("Goal intent cannot be empty.");if(t.length>2e3)throw new Error("Goal intent exceeds the 2000 character safety limit.");if(we.test(t))throw new Error("Goal intent contains unsupported control characters.");if(ke.test(t))throw new Error("Goal intent contains a machine-local absolute path. Use a workspace-relative path or project scope.");if(ve.test(t))throw new Error("Goal intent appears to contain secret material and was not persisted.");return t}function je(e){let t=e.match(/\b(?:coverage\D{0,24})?((?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?))\s*(?:%|percent(?:age)?(?:\s+points?)?)/i);if(!t||!/coverage/i.test(e))return null;let r=Number(t[1]);return Number.isFinite(r)&&r>=0&&r<=100?r:null}var oe=[{runtime:"cpp",patterns:[/\bc\+\+/i,/\bcpp\b/i]},{runtime:"dotnet",patterns:[/\.net\b/i,/\bdotnet\b/i,/\bc#/i,/\bcsharp\b/i]},{runtime:"node",patterns:[/\bnode(?:\.js)?\b/i,/\btypescript\b/i,/\bjavascript\b/i,/\b(?:js|ts)\b/i]},{runtime:"python",patterns:[/\bpython\b/i,/\bpytest\b/i]},{runtime:"go",patterns:[/\bgolang\b/i,/\bgo(?:\s+(?:test|coverage|tests))\b/i]},{runtime:"java",patterns:[/\bjava\b/i,/\bjunit\b/i,/\bjacoco\b/i]},{runtime:"rust",patterns:[/\brust\b/i,/\bcargo\b/i]},{runtime:"php",patterns:[/\bphp\b/i,/\bphpunit\b/i]},{runtime:"ruby",patterns:[/\bruby\b/i,/\brspec\b/i]},{runtime:"kotlin",patterns:[/\bkotlin\b/i]},{runtime:"scala",patterns:[/\bscala\b/i]},{runtime:"clojure",patterns:[/\bclojure\b/i]},{runtime:"elixir",patterns:[/\belixir\b/i]},{runtime:"deno",patterns:[/\bdeno\b/i]},{runtime:"bun",patterns:[/\bbun\b/i]},{runtime:"c",patterns:[/\bc(?:\s+(?:test|coverage|tests|code))\b/i]}];function Ge(e){return oe.filter(t=>t.patterns.some(r=>r.test(e))).map(t=>t.runtime)}function K(e,t={}){let r=Pe(e),n=ye.filter(u=>u.patterns.some(j=>j.test(r))).map(u=>u.category),a=n.some(u=>u!=="feature-change")?n.filter(u=>u!=="feature-change"):n,s=a[0]??"feature-change",l=je(r),d=Ge(r),p=d.length===0&&t.selectedCoverageRuntime?[t.selectedCoverageRuntime]:d,m=[...new Set((t.availableCoverageRuntimes??[]).filter(u=>oe.some(j=>j.runtime===u)))].sort(),b=[];return a.length>1&&a[0]!=="test-coverage"&&b.push(`The intent also contains signals for: ${a.slice(1).join(", ")}.`),s==="test-coverage"&&l===null&&b.push("A numeric test coverage target is required for machine verification."),s==="test-coverage"&&p.length>1&&b.push(`The Goal names multiple coverage runtimes: ${p.join(", ")}. Select one runtime per Goal.`),s==="test-coverage"&&p.length===0&&m.length>1&&b.push(`Coverage scope is ambiguous across detected runtimes: ${m.join(", ")}. Name one runtime or language in the Goal.`),s==="test-coverage"&&p.length===1&&m.length>0&&!m.includes(p[0])&&b.push(`The requested ${p[0]} coverage runtime is not present in the selected scope. Detected runtimes: ${m.join(", ")}.`),{original:r,normalized:r.toLocaleLowerCase("en-US"),statement:r.replace(/[.!?]+$/,""),category:s,confidence:a.length===1?"high":a.length>1?"medium":"low",ambiguities:b,...l===null?{}:{requestedTarget:{metric:"test-coverage-percent",operator:"at-least",value:l,...p.length===1?{runtime:p[0]}:{}}}}}function ae(e){let t={"test-coverage":["test suite coverage configuration instrumentation","CI tests LCOV Cobertura JaCoCo LLVM coverage"],"dependency-security":["dependency manifest lockfile security audit vulnerability"],"release-readiness":["release pipeline readiness gates build test deploy"],"defect-repair":["failure error test implementation call path"],"feature-change":["API implementation module dependency tests"],refactor:["module dependency ownership implementation tests"],performance:["performance benchmark latency throughput runtime"],documentation:["documentation README guide architecture decision"],"system-understanding":["architecture service API dependency ownership"]};return [...new Set([e.statement,...t[e.category]])].slice(0,3)}var se="contracts/workspace-intelligence/goal-pack.v1.json",ie="contracts/workspace-intelligence/goal-agent-handoff.v1.json",Ce="contracts/workspace-intelligence/goal-plan-result.v1.json",ue="contracts/workspace-intelligence/goal-index.v1.json",de=new Set(["node","bun","deno","python","go","java","dotnet","rust","php","ruby","elixir","clojure","scala","kotlin","c","cpp"]);function Ae(e,t){let r=e.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)??[],n=new Set(t.map(m=>m.toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"")).filter(Boolean)),a=[];for(let m=0;m<r.length;){let b=0;for(let u=Math.min(4,r.length-m);u>=1;u-=1){let j=r.slice(m,m+u).join("").toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"");if(n.has(j)){b=u;break}}if(b>0){m+=b;continue}a.push(r[m]),m+=1;}let s=a.findIndex((m,b)=>{let u=m.toLocaleLowerCase("en-US"),j=a[b+1]?.toLocaleLowerCase("en-US");return u==="without"&&["breaking","changing","modifying","removing"].includes(j??"")||u==="while"&&["keeping","maintaining","preserving"].includes(j??"")}),l=s>=2?a.slice(0,s):a,d=l.length>=2?l.join(" "):e;if(s<2)return [d];let p=a.slice(s).filter(m=>!["without","while","breaking","changing","modifying","removing","keeping","maintaining","preserving"].includes(m.toLocaleLowerCase("en-US")));return p.length>0?[d,p.join(" ")]:[d]}function ce(e){return e.split(R.sep).join("/")}function V(e,t){return d$2(e,t.path,{...t.absolutePath?{absolutePath:t.absolutePath}:{}})}function le(e){let t=e.requested.trim().replace(/^project:/,"");if(!t)throw new Error("Project goal scope must name a project.");let r=R.isAbsolute(t)?R.resolve(t):null,n=e.model.projects.filter(a=>a.name===t||ce(a.path)===ce(t)||r!==null&&V(e.workspacePath,a)===r);if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found in the canonical model: ${t}`:`Project goal scope is ambiguous in the canonical model: ${t}`);return n[0]}async function Re(e){let t=await a$1(e);if(t.status==="miss")throw new Error(`Canonical model and live graph evidence are required (${t.reason}). Run \`workspai workspace intelligence run --for-agent generic --strict --json\` or retry with --refresh.`);let{model:r,graph:n}=t;return a(r,"contracts/workspace-intelligence/workspace-model.v1.json","Goal source model"),a(n,"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json","Goal source graph"),b$1(n,r),{model:r,graph:n}}function pe(e){let t=e.scope.trim();if(t==="workspace")return {kind:"workspace",projects:e.model.projects.map(n=>n.name).sort(),selectionSource:e.selectionSource,resolution:"selected"};let r=t.startsWith("projects:")?"projects:":t.startsWith("project:")&&t.slice(8).includes(",")?"project:":null;if(r){let n=t.slice(r.length).split(",").map(l=>l.trim()).filter(Boolean);if(n.length<2)throw new Error("A project-set Goal scope must name at least two projects.");let a=n.map(l=>le({workspacePath:e.workspacePath,model:e.model,requested:l})),s=[...new Set(a.map(l=>l.name))].sort();if(s.length!==n.length)throw new Error("A project-set Goal scope must not contain duplicate projects.");return {kind:"project-set",projects:s,selectionSource:e.selectionSource,resolution:"selected"}}if(t)return {kind:"project",projects:[le({workspacePath:e.workspacePath,model:e.model,requested:t}).name],selectionSource:e.selectionSource,resolution:"selected"};throw new Error("Goal scope cannot be empty.")}async function Se(e){if(e.explicitScope?.trim())return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:e.explicitScope,selectionSource:"explicit"}),selectionRequired:false};if(e.invocationProjectPath){let t=R.resolve(e.invocationProjectPath),r=e.model.projects.filter(n=>V(e.workspacePath,n)===t);if(r.length!==1)throw new Error("The invocation project is not represented uniquely in the canonical workspace model. Refresh intelligence or pass --scope explicitly.");return {scope:{kind:"project",projects:[r[0].name],selectionSource:"invocation-project",resolution:"selected"},selectionRequired:false}}if(e.model.projects.length===1)return {scope:{kind:"project",projects:[e.model.projects[0].name],selectionSource:"single-project-workspace",resolution:"selected"},selectionRequired:false};if(e.selectScope){let t=await e.selectScope({workspaceName:e.model.workspace.name,projects:e.model.projects.map(n=>({name:n.name,runtime:n.runtime,runtimeCandidates:[...n.runtimeCandidates].sort(),framework:n.framework})).sort((n,a)=>n.name.localeCompare(a.name))}),r=t.kind==="workspace"?"workspace":t.projects.length===1?`project:${t.projects[0]}`:`projects:${t.projects.join(",")}`;return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:r,selectionSource:"interactive"}),selectionRequired:false}}return {scope:{kind:"workspace",projects:e.model.projects.map(t=>t.name).sort(),selectionSource:"workspace",resolution:"selection-required"},selectionRequired:true}}function Ee(e,t){if(t.kind==="workspace")return {entities:e.quality.entityCount,relationships:e.quality.relationCount,proofs:e.quality.proofCount,unresolved:e.quality.unknownCount,proofCoveragePercent:Number((e.quality.relationProofCoverageRatio*100).toFixed(2))};let r=new Set(t.projects),n=e.entities.filter(p=>p.projectId!==void 0&&r.has(p.projectId)),a=new Set(n.map(p=>p.id)),s=e.relations.filter(p=>a.has(p.from)||a.has(p.to)),l=new Set([...n.flatMap(p=>p.proofIds),...s.flatMap(p=>p.proofIds)]),d=s.filter(p=>p.proofIds.length>0).length;return {entities:n.length,relationships:s.length,proofs:l.size,unresolved:s.length-d,proofCoveragePercent:s.length===0?100:Number((d/s.length*100).toFixed(2))}}function Ie(e){let t=new Map;for(let n of e){let a=t.get(n.kind)??[];a.push(n),t.set(n.kind,a);}let r=[];for(let n=0;[...t.values()].some(a=>n<a.length);n+=1)for(let a of t.values()){let s=a[n];s&&r.push(s);}return r}async function Te(e){let t=R.join(e.workspacePath,p.intelligenceRun),r=await _.readJson(t).catch(()=>null),a=(Array.isArray(r?.stages)?r.stages:[]).filter(o=>o.status==="blocked"||o.status==="failed").map(o=>String(o.id??"unknown")).sort(),s=r?.status,l={status:s==="passed"?"passed":s==="blocked"||s==="failed"?"blocked":"unknown",artifact:p.intelligenceRun,blockedStages:a},d={status:"not-applicable",runtime:null,runtimeChoices:[],runner:null,existingEvidence:[],prerequisites:[]};if(e.intent.category==="test-coverage"){let o=e.intent.requestedTarget?.runtime;if(e.intent.ambiguities.some(P=>P.startsWith("Coverage scope is ambiguous")||P.startsWith("The Goal names multiple coverage runtimes")||P.startsWith("The selected projects do not share a common canonical coverage runtime")||P.startsWith("The requested ")))d={status:"requires-setup",runtime:o??null,runtimeChoices:e.coverageRuntimeChoices,runner:null,existingEvidence:[],prerequisites:["Select exactly one detected runtime or language for this coverage Goal."]};else {let P=o?e.projects.filter(c=>c.runtimeCandidates.includes(o)):e.projects,i=await Promise.all(P.map(async c=>({project:c,capability:await c$3(V(e.workspacePath,c),o??(de.has(c.runtime)?c.runtime:"unknown"))}))),h=i.map(c=>c.capability.status);d={status:h.includes("unsupported")?"unsupported":h.includes("requires-setup")?"requires-setup":"available",runtime:i.length===1?i[0].capability.runtime:[...new Set(i.map(c=>c.capability.runtime))].join(","),runtimeChoices:e.coverageRuntimeChoices,runner:i.length===1?i[0].capability.runner:[...new Set(i.flatMap(c=>c.capability.runner?[c.capability.runner]:[]))].join(",")||null,existingEvidence:i.flatMap(c=>c.capability.existingEvidence.map(C=>({project:c.project.name,...C}))).filter((c,C,w)=>w.findIndex(k=>k.project===c.project&&k.path===c.path&&k.sha256===c.sha256)===C).sort((c,C)=>c.project.localeCompare(C.project)||c.path.localeCompare(C.path)),prerequisites:[...new Set(i.flatMap(c=>c.capability.prerequisites))].sort()};}}let p$1=ae(e.intent),m=[...Ae(p$1[0],e.projects.map(o=>o.name)),...p$1.slice(1)].filter((o,y,P)=>P.indexOf(o)===y).slice(0,3),b=m.map((o,y)=>{let P=o.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)?.length??0,i=y===0&&P>=4?2:1,h=e.projects.map(w=>{let k=G=>g(e.graph,{query:o,projectId:w.name,...G?{kind:G}:{},limit:60,relationsPerEntity:0,minimumTermMatches:i}).entities,S=k(),me=[...new Set(e.graph.entities.filter(G=>G.projectId===w.name||G.projectId===void 0&&G.identity.scope==="workspace").map(G=>G.kind))].flatMap(G=>k(G).slice(0,8)),F=[...S,...me];return F.filter((G,ge)=>F.findIndex(he=>he.id===G.id)===ge)}),c=[],C=new Set;for(let w=0;h.some(k=>w<k.length);w+=1)for(let k of h){let S=k[w];!S||C.has(S.id)||(C.add(S.id),c.push(S));}return Ie(c)}),u={"test-coverage":["test-suite"],"dependency-security":["package","module"],"release-readiness":["pipeline","deployment","lifecycle-stage"],"defect-repair":["test-suite","lifecycle-stage"],"feature-change":["project","runtime-unit","api","package","module","test-suite"],refactor:["package","module","api","test-suite"],performance:["lifecycle-stage","test-suite","pipeline"],documentation:["document","decision"],"system-understanding":["project","service","api","package","protocol"]},j=new Set(e.projects.map(o=>o.name)),v=e.graph.entities.filter(o=>o.proofIds.length>0&&(!o.projectId||j.has(o.projectId))&&u[e.intent.category].includes(o.kind)).sort((o,y)=>u[e.intent.category].indexOf(o.kind)-u[e.intent.category].indexOf(y.kind)||o.label.localeCompare(y.label)),f=[],M=new Set,E=o=>{!o||f.length>=20||M.has(o.id)||(M.add(o.id),f.push(o));},I=(e.intent.statement.match(/[A-Za-z][A-Za-z0-9+#.-]{1,}/g)??[]).length>=2,g$1=I?b[0]??[]:[];for(let o of g$1.slice(0,12))E(o);if(!I)for(let o of v)E(o);for(let o=0;f.length<20&&b.slice(1).some(y=>o<y.length);o+=1)for(let y of b.slice(1))E(y[o]);if(I)for(let o of v)E(o);for(let o of g$1.slice(12))E(o);let T=f.map(o=>({entityId:o.id,kind:o.kind,label:o.label,proofIds:o.proofIds.slice(0,12)})),L=b[0]?.length??0;return {workspaceIntelligence:l,measurement:d,retrieval:{status:I&&L>=3?"grounded":T.length>0?"partial":"empty",strategy:"deterministic-category-v1",queries:m,anchors:T}}}async function xe(e$1){let t=R.join(e$1,f$1);if(!await _.pathExists(t))return {schemaVersion:e,generatedAt:new Date(0).toISOString(),activeGoalId:null,goals:[]};let r=await _.readJson(t);a(r,ue,"Goal index");try{i(r);}catch(n){let a=h(r);if(!(a!==null&&n instanceof Error&&n.message==="Goal index is inconsistent: activeGoalId must identify the only selected actionable lifecycle entry.")||!a)throw n;return a}return r}function _e(e$1,t,r){let n=e$1.goals.find(l=>l.id===t.id),a=t.state==="ready-to-plan",s={id:t.id,fingerprint:t.fingerprint,objective:t.intent.statement,category:t.intent.category,state:t.state,lifecycle:n?.lifecycle==="cancelled"?"cancelled":a?"active":"planned",scope:t.scope,createdAt:n?.createdAt??t.generatedAt,updatedAt:r,goalPack:t.artifacts.goalPack,agentHandoff:t.artifacts.agentHandoff,...n?.verifiedGoalId?{verifiedGoalId:n.verifiedGoalId}:{},...n?.repairTransactionId?{repairTransactionId:n.repairTransactionId}:{},...n?.repairTransactionIds?{repairTransactionIds:n.repairTransactionIds}:{},...n?.changeTransactionId?{changeTransactionId:n.changeTransactionId}:{},...n?.changeTransactionIds?{changeTransactionIds:n.changeTransactionIds}:{},...n?.verificationReceipt?{verificationReceipt:n.verificationReceipt}:{}};return {schemaVersion:e,generatedAt:r,activeGoalId:s.lifecycle==="active"?t.id:e$1.activeGoalId===t.id?null:e$1.activeGoalId,goals:[...e$1.goals.filter(l=>l.id!==t.id).map(l=>s.lifecycle==="active"&&l.lifecycle==="active"?{...l,lifecycle:"planned",updatedAt:r}:l),s].sort((l,d)=>l.id.localeCompare(d.id))}}async function nt(e){let t=b({startPath:R.resolve(e.startPath),explicitWorkspacePath:e.workspacePath,strict:true,requireProjectMembership:!e.scope?.trim()});if(!t)throw new Error("No canonical Workspai workspace could be resolved.");let r=R.resolve(t.workspacePath);e.refresh&&await c({workspacePath:r,strict:false,agent:"generic"});let{model:n,graph:a$1}=await Re(r),s=await Se({workspacePath:r,invocationProjectPath:t.projectPath,model:n,explicitScope:e.scope,selectScope:e.selectScope}),l=s.scope,d$2=n.projects.filter(i=>l.projects.includes(i.name));if(d$2.length===0)throw new Error("A Goal Pack requires at least one registered project in its selected scope.");let p$1=e.maxAttempts??5;if(!Number.isInteger(p$1)||p$1<1||p$1>25)throw new Error("--max-attempts must be an integer from 1 to 25.");let m=new Date().toISOString(),b$1=d(n),u=d$2.map(i=>({name:i.name,runtimes:[...new Set(i.runtimeCandidates.filter(h=>de.has(h)))].sort()})),j$1=[...new Set(u.flatMap(i=>i.runtimes))].sort(),v=u.length<=1?j$1:u[0].runtimes.filter(i=>u.every(h=>h.runtimes.includes(i))),f$2=K(e.intent,{availableCoverageRuntimes:v,...e.runtime?{selectedCoverageRuntime:e.runtime}:v.length===1?{selectedCoverageRuntime:v[0]}:{}});if(e.runtime&&!v.includes(e.runtime)){let i=e.runtime,h=u.filter(c=>!c.runtimes.includes(i)).map(c=>c.name);throw new Error(d$2.length>1&&h.length>0?`--runtime ${e.runtime} is not canonical for every project in the selected Goal scope. Missing from: ${h.join(", ")}. Split the projects into runtime-compatible Goal scopes.`:`--runtime ${e.runtime} is not present in the canonical Workspace Model for the selected Goal scope. Available runtimes: ${v.join(", ")||"none"}.`)}if(e.runtime&&f$2.category!=="test-coverage")throw new Error("--runtime is valid only for a test-coverage Goal.");if(e.runtime&&f$2.requestedTarget?.runtime&&f$2.requestedTarget.runtime!==e.runtime)throw new Error(`--runtime ${e.runtime} conflicts with the ${f$2.requestedTarget.runtime} runtime named in the Goal intent.`);if(!s.selectionRequired&&f$2.category==="test-coverage"&&f$2.requestedTarget&&!f$2.requestedTarget.runtime&&v.length>1&&!e.runtime&&e.selectCoverageRuntime){let i=await e.selectCoverageRuntime({workspaceName:n.workspace.name,scope:l,projects:d$2.map(h=>({name:h.name,runtime:h.runtime,runtimeCandidates:[...h.runtimeCandidates].sort()})),runtimes:v});if(!v.includes(i))throw new Error("The selected coverage runtime is outside the canonical Goal scope.");f$2=K(e.intent,{availableCoverageRuntimes:v,selectedCoverageRuntime:i});}!s.selectionRequired&&f$2.category==="test-coverage"&&d$2.length>1&&v.length===0&&(f$2={...f$2,ambiguities:[`The selected projects do not share a common canonical coverage runtime: ${u.map(i=>`${i.name} (${i.runtimes.join(", ")||"none"})`).join("; ")}. Split them into runtime-compatible Goal scopes so every selected project is verified.`,...f$2.ambiguities]}),s.selectionRequired&&(f$2={...f$2,ambiguities:[`Goal scope is unresolved across ${l.projects.length} registered projects: ${l.projects.join(", ")}. Select one project, multiple projects, or the entire workspace.`,...f$2.ambiguities]});let M=await Te({workspacePath:r,projects:d$2,graph:a$1,intent:f$2,coverageRuntimeChoices:v}),E={generatedAt:m,intent:f$2,workspaceName:n.workspace.name,scope:l,sourceBinding:{model:{artifact:p.model,schemaVersion:q.model,hashAlgorithm:"sha256",hashSemantics:"workspace-model-structural-v1",hash:b$1,generatedAt:n.generatedAt},graph:{artifact:p.knowledgeGraph,schemaVersion:q.knowledgeGraph,hashAlgorithm:"sha256",hashSemantics:"canonical-json-v1",hash:c$1(a$1),generatedAt:a$1.generatedAt,modelHash:a$1.source.hash,...a$1.source.inputs?.hash?{inputHash:a$1.source.inputs.hash}:{}}},preflight:M,baseline:{projectCount:d$2.length,runtimes:[...new Set(d$2.flatMap(i=>i.runtimeCandidates))].sort(),frameworks:[...new Set(d$2.map(i=>i.framework))].sort(),graph:Ee(a$1,l)},maxAttempts:p$1,consumer:e.consumer??"generic"},I={digestCanonical:c$1},{goalPack:g,handoff:T}=j(E,I);a(g,se,"Goal Pack"),a(T,ie,"Goal agent handoff");let L=false,o=async()=>{let i=R.join(r,g.artifacts.goalPack),h=R.join(r,g.artifacts.agentHandoff),[c,C]=await Promise.all([_.pathExists(i),_.pathExists(h)]);if(c!==C)throw new Error(`Goal Pack instance is incomplete and cannot be resumed: ${g.id}`);if(!c)return;let[w,k]=await Promise.all([_.readJson(i),_.readJson(h)]);a(w,se,"Persisted Goal Pack"),a(k,ie,"Persisted goal agent handoff");let S=j({...E,generatedAt:w.generatedAt,sourceBinding:w.sourceBinding},I);if(w.id!==g.id||k.goalId!==g.id||c$1(w)!==c$1(S.goalPack)||c$1(k)!==c$1(S.handoff))throw new Error(`Goal Pack instance failed immutable integrity validation: ${g.id}`);g=w,T=k,L=true;};if(e.dryRun)await o();else {let i$2=`.workspai/goals/${g.id}/publication`;await f(r,i$2,async()=>{await o();let h=_e(await xe(r),g,new Date().toISOString());a(h,ue,"Goal index"),i(h),await i$1(r,d$1,L?[{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]:[{relativePath:g.artifacts.goalPack,payload:g},{relativePath:g.artifacts.agentHandoff,payload:T},{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]);});}let y=[g.artifacts.goalPack,g.artifacts.agentHandoff,d$1,f$1],P={schemaVersion:c$2,result:g.state==="needs-confirmation"?"needs-confirmation":g.state==="blocked"?"blocked":g.state==="needs-evidence"?"needs-evidence":"planned",resolution:{source:t.source,invocationScope:t.projectPath?"project":"workspace"},goalPack:g,agentHandoff:T,writtenArtifacts:e.dryRun?[]:L?[d$1,f$1]:y,dryRun:e.dryRun===true,resumed:L};return a(P,Ce,"Goal plan result"),P}export{nt as a};
1
+ import {c}from'./chunk-DWKCFHHL.js';import {j,i,d as d$1,f as f$1,c as c$2,e,h}from'./chunk-IDETNYCF.js';import {g}from'./chunk-5HNQIMGW.js';import {a as a$1}from'./chunk-4CXV3PPV.js';import {c as c$3}from'./chunk-475GQJ2D.js';import {b}from'./chunk-DWDYLKVW.js';import {b as b$1}from'./chunk-HRVHQBTA.js';import {d as d$2}from'./chunk-ROOPODG6.js';import {f,i as i$1}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {q,p}from'./chunk-ODK4LCEL.js';import R from'path';import _ from'fs-extra';var we=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ke=/(?:^|\s)(?:\/(?:home|Users|private|var|tmp|mnt|opt|srv|root|workspace|workspaces|data|Volumes|etc|usr|run|dev|proc|sys)\/[^\s]+|[A-Za-z]:[\\/][^\s]+|\\\\[^\\\s]+\\[^\s]+)/,ve=/(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:github_pat_|gh[pousr]_|glpat-|npm_|xox[baprs]-|sk-(?:proj-)?)[A-Za-z0-9_-]{12,}|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b|\bAIza[A-Za-z0-9_-]{20,}|\bBearer\s+[A-Za-z0-9._~+/-]{16,}|[a-z][a-z0-9+.-]*:\/\/[^\s:/]+:[^\s@/]+@|\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*[^\s]{6,})/i,ye=[{category:"test-coverage",patterns:[/\b(?:test\s+)?coverage\b/i,/\bcoverage\s+(?:to|above|at least)\b/i]},{category:"dependency-security",patterns:[/\b(?:dependency|dependencies|package|packages)\b.*\b(?:security|vulnerab|audit)\b/i,/\b(?:security|vulnerab|audit)\b.*\b(?:dependency|dependencies|package|packages)\b/i]},{category:"release-readiness",patterns:[/\brelease[ -]readiness\b/i,/\bready (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare\b[^\n]{0,80}\bfor release\b/i]},{category:"defect-repair",patterns:[/\b(?:fix|repair|resolve|debug)\b.*\b(?:bug|error|failure|issue|regression)\b/i]},{category:"performance",patterns:[/\b(?:performance|latency|throughput|cpu|optimi[sz]e|faster|slower)\b/i,/\b(?:memory\s+(?:allocation|consumption|footprint|leak|pressure|usage)|out[ -]of[ -]memory|heap|ram)\b/i]},{category:"refactor",patterns:[/\b(?:refactor|restructure|decouple|extract|simplify|cleanup|clean up)\b/i]},{category:"documentation",patterns:[/\b(?:document|documentation|readme|guide|tutorial|docs)\b/i]},{category:"feature-change",patterns:[/\b(?:add|build|create|enforce|enhance|harden|implement|improve|introduce|support)\b/i]},{category:"system-understanding",patterns:[/\b(?:understand|explain|map|find|where|how|architecture|analy[sz]e|search)\b/i]}];function Pe(e){if(typeof e!="string")throw new Error("Goal intent must be text.");let t=e.trim().replace(/\s+/g," ");if(!t)throw new Error("Goal intent cannot be empty.");if(t.length>2e3)throw new Error("Goal intent exceeds the 2000 character safety limit.");if(we.test(t))throw new Error("Goal intent contains unsupported control characters.");if(ke.test(t))throw new Error("Goal intent contains a machine-local absolute path. Use a workspace-relative path or project scope.");if(ve.test(t))throw new Error("Goal intent appears to contain secret material and was not persisted.");return t}function je(e){let t=e.match(/\b(?:coverage\D{0,24})?((?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?))\s*(?:%|percent(?:age)?(?:\s+points?)?)/i);if(!t||!/coverage/i.test(e))return null;let r=Number(t[1]);return Number.isFinite(r)&&r>=0&&r<=100?r:null}var oe=[{runtime:"cpp",patterns:[/\bc\+\+/i,/\bcpp\b/i]},{runtime:"dotnet",patterns:[/\.net\b/i,/\bdotnet\b/i,/\bc#/i,/\bcsharp\b/i]},{runtime:"node",patterns:[/\bnode(?:\.js)?\b/i,/\btypescript\b/i,/\bjavascript\b/i,/\b(?:js|ts)\b/i]},{runtime:"python",patterns:[/\bpython\b/i,/\bpytest\b/i]},{runtime:"go",patterns:[/\bgolang\b/i,/\bgo(?:\s+(?:test|coverage|tests))\b/i]},{runtime:"java",patterns:[/\bjava\b/i,/\bjunit\b/i,/\bjacoco\b/i]},{runtime:"rust",patterns:[/\brust\b/i,/\bcargo\b/i]},{runtime:"php",patterns:[/\bphp\b/i,/\bphpunit\b/i]},{runtime:"ruby",patterns:[/\bruby\b/i,/\brspec\b/i]},{runtime:"kotlin",patterns:[/\bkotlin\b/i]},{runtime:"scala",patterns:[/\bscala\b/i]},{runtime:"clojure",patterns:[/\bclojure\b/i]},{runtime:"elixir",patterns:[/\belixir\b/i]},{runtime:"deno",patterns:[/\bdeno\b/i]},{runtime:"bun",patterns:[/\bbun\b/i]},{runtime:"c",patterns:[/\bc(?:\s+(?:test|coverage|tests|code))\b/i]}];function Ge(e){return oe.filter(t=>t.patterns.some(r=>r.test(e))).map(t=>t.runtime)}function K(e,t={}){let r=Pe(e),n=ye.filter(u=>u.patterns.some(j=>j.test(r))).map(u=>u.category),a=n.some(u=>u!=="feature-change")?n.filter(u=>u!=="feature-change"):n,s=a[0]??"feature-change",l=je(r),d=Ge(r),p=d.length===0&&t.selectedCoverageRuntime?[t.selectedCoverageRuntime]:d,m=[...new Set((t.availableCoverageRuntimes??[]).filter(u=>oe.some(j=>j.runtime===u)))].sort(),b=[];return a.length>1&&a[0]!=="test-coverage"&&b.push(`The intent also contains signals for: ${a.slice(1).join(", ")}.`),s==="test-coverage"&&l===null&&b.push("A numeric test coverage target is required for machine verification."),s==="test-coverage"&&p.length>1&&b.push(`The Goal names multiple coverage runtimes: ${p.join(", ")}. Select one runtime per Goal.`),s==="test-coverage"&&p.length===0&&m.length>1&&b.push(`Coverage scope is ambiguous across detected runtimes: ${m.join(", ")}. Name one runtime or language in the Goal.`),s==="test-coverage"&&p.length===1&&m.length>0&&!m.includes(p[0])&&b.push(`The requested ${p[0]} coverage runtime is not present in the selected scope. Detected runtimes: ${m.join(", ")}.`),{original:r,normalized:r.toLocaleLowerCase("en-US"),statement:r.replace(/[.!?]+$/,""),category:s,confidence:a.length===1?"high":a.length>1?"medium":"low",ambiguities:b,...l===null?{}:{requestedTarget:{metric:"test-coverage-percent",operator:"at-least",value:l,...p.length===1?{runtime:p[0]}:{}}}}}function ae(e){let t={"test-coverage":["test suite coverage configuration instrumentation","CI tests LCOV Cobertura JaCoCo LLVM coverage"],"dependency-security":["dependency manifest lockfile security audit vulnerability"],"release-readiness":["release pipeline readiness gates build test deploy"],"defect-repair":["failure error test implementation call path"],"feature-change":["API implementation module dependency tests"],refactor:["module dependency ownership implementation tests"],performance:["performance benchmark latency throughput runtime"],documentation:["documentation README guide architecture decision"],"system-understanding":["architecture service API dependency ownership"]};return [...new Set([e.statement,...t[e.category]])].slice(0,3)}var se="contracts/workspace-intelligence/goal-pack.v1.json",ie="contracts/workspace-intelligence/goal-agent-handoff.v1.json",Ce="contracts/workspace-intelligence/goal-plan-result.v1.json",ue="contracts/workspace-intelligence/goal-index.v1.json",de=new Set(["node","bun","deno","python","go","java","dotnet","rust","php","ruby","elixir","clojure","scala","kotlin","c","cpp"]);function Ae(e,t){let r=e.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)??[],n=new Set(t.map(m=>m.toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"")).filter(Boolean)),a=[];for(let m=0;m<r.length;){let b=0;for(let u=Math.min(4,r.length-m);u>=1;u-=1){let j=r.slice(m,m+u).join("").toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"");if(n.has(j)){b=u;break}}if(b>0){m+=b;continue}a.push(r[m]),m+=1;}let s=a.findIndex((m,b)=>{let u=m.toLocaleLowerCase("en-US"),j=a[b+1]?.toLocaleLowerCase("en-US");return u==="without"&&["breaking","changing","modifying","removing"].includes(j??"")||u==="while"&&["keeping","maintaining","preserving"].includes(j??"")}),l=s>=2?a.slice(0,s):a,d=l.length>=2?l.join(" "):e;if(s<2)return [d];let p=a.slice(s).filter(m=>!["without","while","breaking","changing","modifying","removing","keeping","maintaining","preserving"].includes(m.toLocaleLowerCase("en-US")));return p.length>0?[d,p.join(" ")]:[d]}function ce(e){return e.split(R.sep).join("/")}function V(e,t){return d$2(e,t.path,{...t.absolutePath?{absolutePath:t.absolutePath}:{}})}function le(e){let t=e.requested.trim().replace(/^project:/,"");if(!t)throw new Error("Project goal scope must name a project.");let r=R.isAbsolute(t)?R.resolve(t):null,n=e.model.projects.filter(a=>a.name===t||ce(a.path)===ce(t)||r!==null&&V(e.workspacePath,a)===r);if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found in the canonical model: ${t}`:`Project goal scope is ambiguous in the canonical model: ${t}`);return n[0]}async function Re(e){let t=await a$1(e);if(t.status==="miss")throw new Error(`Canonical model and live graph evidence are required (${t.reason}). Run \`workspai workspace intelligence run --for-agent generic --strict --json\` or retry with --refresh.`);let{model:r,graph:n}=t;return a(r,"contracts/workspace-intelligence/workspace-model.v1.json","Goal source model"),a(n,"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json","Goal source graph"),b$1(n,r),{model:r,graph:n}}function pe(e){let t=e.scope.trim();if(t==="workspace")return {kind:"workspace",projects:e.model.projects.map(n=>n.name).sort(),selectionSource:e.selectionSource,resolution:"selected"};let r=t.startsWith("projects:")?"projects:":t.startsWith("project:")&&t.slice(8).includes(",")?"project:":null;if(r){let n=t.slice(r.length).split(",").map(l=>l.trim()).filter(Boolean);if(n.length<2)throw new Error("A project-set Goal scope must name at least two projects.");let a=n.map(l=>le({workspacePath:e.workspacePath,model:e.model,requested:l})),s=[...new Set(a.map(l=>l.name))].sort();if(s.length!==n.length)throw new Error("A project-set Goal scope must not contain duplicate projects.");return {kind:"project-set",projects:s,selectionSource:e.selectionSource,resolution:"selected"}}if(t)return {kind:"project",projects:[le({workspacePath:e.workspacePath,model:e.model,requested:t}).name],selectionSource:e.selectionSource,resolution:"selected"};throw new Error("Goal scope cannot be empty.")}async function Se(e){if(e.explicitScope?.trim())return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:e.explicitScope,selectionSource:"explicit"}),selectionRequired:false};if(e.invocationProjectPath){let t=R.resolve(e.invocationProjectPath),r=e.model.projects.filter(n=>V(e.workspacePath,n)===t);if(r.length!==1)throw new Error("The invocation project is not represented uniquely in the canonical workspace model. Refresh intelligence or pass --scope explicitly.");return {scope:{kind:"project",projects:[r[0].name],selectionSource:"invocation-project",resolution:"selected"},selectionRequired:false}}if(e.model.projects.length===1)return {scope:{kind:"project",projects:[e.model.projects[0].name],selectionSource:"single-project-workspace",resolution:"selected"},selectionRequired:false};if(e.selectScope){let t=await e.selectScope({workspaceName:e.model.workspace.name,projects:e.model.projects.map(n=>({name:n.name,runtime:n.runtime,runtimeCandidates:[...n.runtimeCandidates].sort(),framework:n.framework})).sort((n,a)=>n.name.localeCompare(a.name))}),r=t.kind==="workspace"?"workspace":t.projects.length===1?`project:${t.projects[0]}`:`projects:${t.projects.join(",")}`;return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:r,selectionSource:"interactive"}),selectionRequired:false}}return {scope:{kind:"workspace",projects:e.model.projects.map(t=>t.name).sort(),selectionSource:"workspace",resolution:"selection-required"},selectionRequired:true}}function Ee(e,t){if(t.kind==="workspace")return {entities:e.quality.entityCount,relationships:e.quality.relationCount,proofs:e.quality.proofCount,unresolved:e.quality.unknownCount,proofCoveragePercent:Number((e.quality.relationProofCoverageRatio*100).toFixed(2))};let r=new Set(t.projects),n=e.entities.filter(p=>p.projectId!==void 0&&r.has(p.projectId)),a=new Set(n.map(p=>p.id)),s=e.relations.filter(p=>a.has(p.from)||a.has(p.to)),l=new Set([...n.flatMap(p=>p.proofIds),...s.flatMap(p=>p.proofIds)]),d=s.filter(p=>p.proofIds.length>0).length;return {entities:n.length,relationships:s.length,proofs:l.size,unresolved:s.length-d,proofCoveragePercent:s.length===0?100:Number((d/s.length*100).toFixed(2))}}function Ie(e){let t=new Map;for(let n of e){let a=t.get(n.kind)??[];a.push(n),t.set(n.kind,a);}let r=[];for(let n=0;[...t.values()].some(a=>n<a.length);n+=1)for(let a of t.values()){let s=a[n];s&&r.push(s);}return r}async function Te(e){let t=R.join(e.workspacePath,p.intelligenceRun),r=await _.readJson(t).catch(()=>null),a=(Array.isArray(r?.stages)?r.stages:[]).filter(o=>o.status==="blocked"||o.status==="failed").map(o=>String(o.id??"unknown")).sort(),s=r?.status,l={status:s==="passed"?"passed":s==="blocked"||s==="failed"?"blocked":"unknown",artifact:p.intelligenceRun,blockedStages:a},d={status:"not-applicable",runtime:null,runtimeChoices:[],runner:null,existingEvidence:[],prerequisites:[]};if(e.intent.category==="test-coverage"){let o=e.intent.requestedTarget?.runtime;if(e.intent.ambiguities.some(P=>P.startsWith("Coverage scope is ambiguous")||P.startsWith("The Goal names multiple coverage runtimes")||P.startsWith("The selected projects do not share a common canonical coverage runtime")||P.startsWith("The requested ")))d={status:"requires-setup",runtime:o??null,runtimeChoices:e.coverageRuntimeChoices,runner:null,existingEvidence:[],prerequisites:["Select exactly one detected runtime or language for this coverage Goal."]};else {let P=o?e.projects.filter(c=>c.runtimeCandidates.includes(o)):e.projects,i=await Promise.all(P.map(async c=>({project:c,capability:await c$3(V(e.workspacePath,c),o??(de.has(c.runtime)?c.runtime:"unknown"))}))),h=i.map(c=>c.capability.status);d={status:h.includes("unsupported")?"unsupported":h.includes("requires-setup")?"requires-setup":"available",runtime:i.length===1?i[0].capability.runtime:[...new Set(i.map(c=>c.capability.runtime))].join(","),runtimeChoices:e.coverageRuntimeChoices,runner:i.length===1?i[0].capability.runner:[...new Set(i.flatMap(c=>c.capability.runner?[c.capability.runner]:[]))].join(",")||null,existingEvidence:i.flatMap(c=>c.capability.existingEvidence.map(C=>({project:c.project.name,...C}))).filter((c,C,w)=>w.findIndex(k=>k.project===c.project&&k.path===c.path&&k.sha256===c.sha256)===C).sort((c,C)=>c.project.localeCompare(C.project)||c.path.localeCompare(C.path)),prerequisites:[...new Set(i.flatMap(c=>c.capability.prerequisites))].sort()};}}let p$1=ae(e.intent),m=[...Ae(p$1[0],e.projects.map(o=>o.name)),...p$1.slice(1)].filter((o,y,P)=>P.indexOf(o)===y).slice(0,3),b=m.map((o,y)=>{let P=o.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)?.length??0,i=y===0&&P>=4?2:1,h=e.projects.map(w=>{let k=G=>g(e.graph,{query:o,projectId:w.name,...G?{kind:G}:{},limit:60,relationsPerEntity:0,minimumTermMatches:i}).entities,S=k(),me=[...new Set(e.graph.entities.filter(G=>G.projectId===w.name||G.projectId===void 0&&G.identity.scope==="workspace").map(G=>G.kind))].flatMap(G=>k(G).slice(0,8)),F=[...S,...me];return F.filter((G,ge)=>F.findIndex(he=>he.id===G.id)===ge)}),c=[],C=new Set;for(let w=0;h.some(k=>w<k.length);w+=1)for(let k of h){let S=k[w];!S||C.has(S.id)||(C.add(S.id),c.push(S));}return Ie(c)}),u={"test-coverage":["test-suite"],"dependency-security":["package","module"],"release-readiness":["pipeline","deployment","lifecycle-stage"],"defect-repair":["test-suite","lifecycle-stage"],"feature-change":["project","runtime-unit","api","package","module","test-suite"],refactor:["package","module","api","test-suite"],performance:["lifecycle-stage","test-suite","pipeline"],documentation:["document","decision"],"system-understanding":["project","service","api","package","protocol"]},j=new Set(e.projects.map(o=>o.name)),v=e.graph.entities.filter(o=>o.proofIds.length>0&&(!o.projectId||j.has(o.projectId))&&u[e.intent.category].includes(o.kind)).sort((o,y)=>u[e.intent.category].indexOf(o.kind)-u[e.intent.category].indexOf(y.kind)||o.label.localeCompare(y.label)),f=[],M=new Set,E=o=>{!o||f.length>=20||M.has(o.id)||(M.add(o.id),f.push(o));},I=(e.intent.statement.match(/[A-Za-z][A-Za-z0-9+#.-]{1,}/g)??[]).length>=2,g$1=I?b[0]??[]:[];for(let o of g$1.slice(0,12))E(o);if(!I)for(let o of v)E(o);for(let o=0;f.length<20&&b.slice(1).some(y=>o<y.length);o+=1)for(let y of b.slice(1))E(y[o]);if(I)for(let o of v)E(o);for(let o of g$1.slice(12))E(o);let T=f.map(o=>({entityId:o.id,kind:o.kind,label:o.label,proofIds:o.proofIds.slice(0,12)})),L=b[0]?.length??0;return {workspaceIntelligence:l,measurement:d,retrieval:{status:I&&L>=3?"grounded":T.length>0?"partial":"empty",strategy:"deterministic-category-v1",queries:m,anchors:T}}}async function xe(e$1){let t=R.join(e$1,f$1);if(!await _.pathExists(t))return {schemaVersion:e,generatedAt:new Date(0).toISOString(),activeGoalId:null,goals:[]};let r=await _.readJson(t);a(r,ue,"Goal index");try{i(r);}catch(n){let a=h(r);if(!(a!==null&&n instanceof Error&&n.message==="Goal index is inconsistent: activeGoalId must identify the only selected actionable lifecycle entry.")||!a)throw n;return a}return r}function _e(e$1,t,r){let n=e$1.goals.find(l=>l.id===t.id),a=t.state==="ready-to-plan",s={id:t.id,fingerprint:t.fingerprint,objective:t.intent.statement,category:t.intent.category,state:t.state,lifecycle:n?.lifecycle==="cancelled"?"cancelled":a?"active":"planned",scope:t.scope,createdAt:n?.createdAt??t.generatedAt,updatedAt:r,goalPack:t.artifacts.goalPack,agentHandoff:t.artifacts.agentHandoff,...n?.verifiedGoalId?{verifiedGoalId:n.verifiedGoalId}:{},...n?.repairTransactionId?{repairTransactionId:n.repairTransactionId}:{},...n?.repairTransactionIds?{repairTransactionIds:n.repairTransactionIds}:{},...n?.changeTransactionId?{changeTransactionId:n.changeTransactionId}:{},...n?.changeTransactionIds?{changeTransactionIds:n.changeTransactionIds}:{},...n?.verificationReceipt?{verificationReceipt:n.verificationReceipt}:{}};return {schemaVersion:e,generatedAt:r,activeGoalId:s.lifecycle==="active"?t.id:e$1.activeGoalId===t.id?null:e$1.activeGoalId,goals:[...e$1.goals.filter(l=>l.id!==t.id).map(l=>s.lifecycle==="active"&&l.lifecycle==="active"?{...l,lifecycle:"planned",updatedAt:r}:l),s].sort((l,d)=>l.id.localeCompare(d.id))}}async function nt(e){let t=b({startPath:R.resolve(e.startPath),explicitWorkspacePath:e.workspacePath,strict:true,requireProjectMembership:!e.scope?.trim()});if(!t)throw new Error("No canonical Workspai workspace could be resolved.");let r=R.resolve(t.workspacePath);e.refresh&&await c({workspacePath:r,strict:false,agent:"generic"});let{model:n,graph:a$1}=await Re(r),s=await Se({workspacePath:r,invocationProjectPath:t.projectPath,model:n,explicitScope:e.scope,selectScope:e.selectScope}),l=s.scope,d$2=n.projects.filter(i=>l.projects.includes(i.name));if(d$2.length===0)throw new Error("A Goal Pack requires at least one registered project in its selected scope.");let p$1=e.maxAttempts??5;if(!Number.isInteger(p$1)||p$1<1||p$1>25)throw new Error("--max-attempts must be an integer from 1 to 25.");let m=new Date().toISOString(),b$1=d(n),u=d$2.map(i=>({name:i.name,runtimes:[...new Set(i.runtimeCandidates.filter(h=>de.has(h)))].sort()})),j$1=[...new Set(u.flatMap(i=>i.runtimes))].sort(),v=u.length<=1?j$1:u[0].runtimes.filter(i=>u.every(h=>h.runtimes.includes(i))),f$2=K(e.intent,{availableCoverageRuntimes:v,...e.runtime?{selectedCoverageRuntime:e.runtime}:v.length===1?{selectedCoverageRuntime:v[0]}:{}});if(e.runtime&&!v.includes(e.runtime)){let i=e.runtime,h=u.filter(c=>!c.runtimes.includes(i)).map(c=>c.name);throw new Error(d$2.length>1&&h.length>0?`--runtime ${e.runtime} is not canonical for every project in the selected Goal scope. Missing from: ${h.join(", ")}. Split the projects into runtime-compatible Goal scopes.`:`--runtime ${e.runtime} is not present in the canonical Workspace Model for the selected Goal scope. Available runtimes: ${v.join(", ")||"none"}.`)}if(e.runtime&&f$2.category!=="test-coverage")throw new Error("--runtime is valid only for a test-coverage Goal.");if(e.runtime&&f$2.requestedTarget?.runtime&&f$2.requestedTarget.runtime!==e.runtime)throw new Error(`--runtime ${e.runtime} conflicts with the ${f$2.requestedTarget.runtime} runtime named in the Goal intent.`);if(!s.selectionRequired&&f$2.category==="test-coverage"&&f$2.requestedTarget&&!f$2.requestedTarget.runtime&&v.length>1&&!e.runtime&&e.selectCoverageRuntime){let i=await e.selectCoverageRuntime({workspaceName:n.workspace.name,scope:l,projects:d$2.map(h=>({name:h.name,runtime:h.runtime,runtimeCandidates:[...h.runtimeCandidates].sort()})),runtimes:v});if(!v.includes(i))throw new Error("The selected coverage runtime is outside the canonical Goal scope.");f$2=K(e.intent,{availableCoverageRuntimes:v,selectedCoverageRuntime:i});}!s.selectionRequired&&f$2.category==="test-coverage"&&d$2.length>1&&v.length===0&&(f$2={...f$2,ambiguities:[`The selected projects do not share a common canonical coverage runtime: ${u.map(i=>`${i.name} (${i.runtimes.join(", ")||"none"})`).join("; ")}. Split them into runtime-compatible Goal scopes so every selected project is verified.`,...f$2.ambiguities]}),s.selectionRequired&&(f$2={...f$2,ambiguities:[`Goal scope is unresolved across ${l.projects.length} registered projects: ${l.projects.join(", ")}. Select one project, multiple projects, or the entire workspace.`,...f$2.ambiguities]});let M=await Te({workspacePath:r,projects:d$2,graph:a$1,intent:f$2,coverageRuntimeChoices:v}),E={generatedAt:m,intent:f$2,workspaceName:n.workspace.name,scope:l,sourceBinding:{model:{artifact:p.model,schemaVersion:q.model,hashAlgorithm:"sha256",hashSemantics:"workspace-model-structural-v1",hash:b$1,generatedAt:n.generatedAt},graph:{artifact:p.knowledgeGraph,schemaVersion:q.knowledgeGraph,hashAlgorithm:"sha256",hashSemantics:"canonical-json-v1",hash:c$1(a$1),generatedAt:a$1.generatedAt,modelHash:a$1.source.hash,...a$1.source.inputs?.hash?{inputHash:a$1.source.inputs.hash}:{}}},preflight:M,baseline:{projectCount:d$2.length,runtimes:[...new Set(d$2.flatMap(i=>i.runtimeCandidates))].sort(),frameworks:[...new Set(d$2.map(i=>i.framework))].sort(),graph:Ee(a$1,l)},maxAttempts:p$1,consumer:e.consumer??"generic"},I={digestCanonical:c$1},{goalPack:g,handoff:T}=j(E,I);a(g,se,"Goal Pack"),a(T,ie,"Goal agent handoff");let L=false,o=async()=>{let i=R.join(r,g.artifacts.goalPack),h=R.join(r,g.artifacts.agentHandoff),[c,C]=await Promise.all([_.pathExists(i),_.pathExists(h)]);if(c!==C)throw new Error(`Goal Pack instance is incomplete and cannot be resumed: ${g.id}`);if(!c)return;let[w,k]=await Promise.all([_.readJson(i),_.readJson(h)]);a(w,se,"Persisted Goal Pack"),a(k,ie,"Persisted goal agent handoff");let S=j({...E,generatedAt:w.generatedAt,sourceBinding:w.sourceBinding},I);if(w.id!==g.id||k.goalId!==g.id||c$1(w)!==c$1(S.goalPack)||c$1(k)!==c$1(S.handoff))throw new Error(`Goal Pack instance failed immutable integrity validation: ${g.id}`);g=w,T=k,L=true;};if(e.dryRun)await o();else {let i$2=`.workspai/goals/${g.id}/publication`;await f(r,i$2,async()=>{await o();let h=_e(await xe(r),g,new Date().toISOString());a(h,ue,"Goal index"),i(h),await i$1(r,d$1,L?[{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]:[{relativePath:g.artifacts.goalPack,payload:g},{relativePath:g.artifacts.agentHandoff,payload:T},{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]);});}let y=[g.artifacts.goalPack,g.artifacts.agentHandoff,d$1,f$1],P={schemaVersion:c$2,result:g.state==="needs-confirmation"?"needs-confirmation":g.state==="blocked"?"blocked":g.state==="needs-evidence"?"needs-evidence":"planned",resolution:{source:t.source,invocationScope:t.projectPath?"project":"workspace"},goalPack:g,agentHandoff:T,writtenArtifacts:e.dryRun?[]:L?[d$1,f$1]:y,dryRun:e.dryRun===true,resumed:L};return a(P,Ce,"Goal plan result"),P}export{nt as a};
@@ -1,2 +1,2 @@
1
- import {l}from'./chunk-QIPW3G2H.js';import {a as a$1}from'./chunk-AGI46TSQ.js';import {b}from'./chunk-DWDYLKVW.js';import {j}from'./chunk-VODNLROY.js';import {b as b$1}from'./chunk-VN2MKTQO.js';import {a}from'./chunk-AFIFZTOY.js';import {c}from'./chunk-EWZZUQBR.js';import {s,t,p}from'./chunk-ODK4LCEL.js';import Pe from'crypto';import O from'fs';import M from'fs/promises';import f from'path';var fe=s.projectAgentEntry.schemaVersion,L=t.projectAgentEntry,Ce="workspai.agent-bootstrap-receipt.v1",Ve="<!-- WORKSPAI:AGENT-ENTRY:START -->",Be="<!-- WORKSPAI:AGENT-ENTRY:END -->",B=["generic","codex","claude","gemini","qwen","kimi","grok","copilot","cursor","windsurf","amazon-q"],Ue=["CLAUDE.md","GEMINI.md","QWEN.md",".amazonq/rules/workspai-agent-entry.md"];function Se(t){let s=t?.trim().toLowerCase()||"generic";if(s==="orca")return "grok";if(B.includes(s))return s;throw new Error(`Unsupported agent host "${s}". Expected one of: ${B.join(", ")}.`)}function me(t){let s=t.map(c=>c.id).sort(),n=[...B].sort();if(s.length!==n.length||s.some((c,p)=>c!==n[p]))throw new Error("Project agent entry must define each supported host exactly once.")}function U(t){let{integrity:s,...n}=t;return n}function T(t){return c(t)}function Je(t$1){me(t$1.hosts);let s={schemaVersion:fe,generatedAt:t$1.context.generatedAt,project:{name:t$1.context.project.name,relativePath:t$1.context.project.relativePath,...t$1.context.project.runtime?{runtime:t$1.context.project.runtime}:{},...t$1.context.project.framework?{framework:t$1.context.project.framework}:{}},workspace:{name:t$1.context.workspace.name,relationship:t$1.context.workspace.relationship,localBinding:t.projectWorkspaceLink,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},canonical:{projectContext:t.projectContextAgent,projectGrounding:".workspai/PROJECT-GROUNDING.md",projectKnowledgeGraph:t.projectKnowledgeGraphReference,goalIndex:`workspace:${t.goalIndex}`,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json"},protocol:{mode:"canonical-first",bootstrapCommand:"workspai agent bootstrap --for-agent generic --strict --json",verifyCommand:"workspai project agent-entry verify --for-agent all --strict --json",requiredReadOrder:[L,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",t.projectContextAgent,`workspace:${t.goalIndex}`,`workspace:${p.skillsIndex}`,"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json","source:targeted-live-files"],sourcePolicy:{liveSourceAuthority:"exact-implementation",workspaceEvidenceAuthority:"identity-topology-readiness-goals",broadScanBeforeBootstrap:false,sourceMutation:"governed-only",verificationClaims:"cli-evidence-only"},degradedMode:{discloseMissingEvidence:true,allowCompleteArchitectureClaims:false,allowReadOnlySourceInspection:true}},hosts:[...t$1.hosts].sort((c,p)=>c.id.localeCompare(p.id))},n={...s,integrity:{algorithm:"sha256",projectContextHash:t$1.context.integrity.payloadHash,payloadHash:T(s),portable:true,absolutePathsEmitted:false}};if(!A(n))throw new Error("Project agent entry rejected a non-portable local path.");return a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n}function A(t){return typeof t=="string"?!(/^[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])file:\/\//i.test(t)||/(?:^|[\s("'`])\\\\[^\\\s]+[\\]/.test(t)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(t)):Array.isArray(t)?t.every(A):t&&typeof t=="object"?Object.values(t).every(A):true}async function Te(t){let s=f.join(t,L),n=JSON.parse(await M.readFile(s,"utf8"));if(a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n.integrity.payloadHash!==T(U(n)))throw new Error("Project agent entry integrity validation failed.");if(me(n.hosts),!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project agent entry contains a non-portable local path.");return n}async function Re(t$1){let s=f.join(t$1,t.projectContextAgent),n=JSON.parse(await M.readFile(s,"utf8"));a(n,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent");let c=U(n),p=Pe.createHash("sha256").update(JSON.stringify(c)).digest("hex");if(n.integrity.payloadHash!==p)throw new Error("Project context agent integrity validation failed.");if(!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project context agent contains a non-portable local path.");return n}function xe(t){return t.includes("blocked")?"blocked":t.includes("degraded")?"degraded":"ready"}async function Ye(t$1){let s=b({startPath:f.resolve(t$1.startPath??process.cwd()),strict:true,requireProjectMembership:true});if(!s?.projectPath)throw new Error("No canonically bound Workspai project was resolved.");let n=s.projectPath,c$1=s.workspacePath,p$1=await Te(n),o=await Re(n);if(p$1.integrity.projectContextHash!==o.integrity.payloadHash||p$1.project.name!==o.project.name||p$1.workspace.name!==o.workspace.name)throw new Error("Project agent entry is not bound to the current project context.");let J=t$1.forAgent?.trim().toLowerCase()||"generic",Y=J==="all",g=Y?"all":Se(J),D=g,m=Y?p$1.hosts:p$1.hosts.filter(e=>e.id===g),z=p$1.hosts.find(e=>e.id==="generic");if(m.length===0&&z&&m.push(z),m.length===0)throw new Error("Project agent entry does not define generic host coverage.");let y=[],d=(e,r,P,h)=>y.push({id:e,status:r,message:P,...h?{artifact:h}:{}});d("workspace-binding","passed","Canonical workspace membership is resolved."),d("entry-integrity","passed","Project entry manifest integrity is valid.",L),d("project-context-integrity","passed","Project context integrity and manifest binding are valid.",t.projectContextAgent);let $=[...new Set(m.flatMap(e=>e.entryFiles))].sort(),ue=$.filter(e=>!O.existsSync(f.join(n,e))),k=m.some(e=>e.status==="blocked")||ue.length>0?"blocked":m.some(e=>e.status==="degraded")?"degraded":"ready";d("host-discovery",k==="ready"?"passed":k==="degraded"?"warning":"failed",k==="ready"?`${g} has discoverable Workspai entry coverage.`:k==="degraded"?m.find(e=>e.reason)?.reason??`${g} entry coverage is degraded.`:`${g} entry coverage is missing required files.`,$[0]);let Z=[p.agentIndex,p.agentContext,p.skillsIndex,p.model,p.knowledgeGraph],R=Z.filter(e=>!O.existsSync(f.join(c$1,e)));d("canonical-evidence",R.length===0?"passed":"failed",R.length===0?"Required canonical workspace evidence is present.":`Required canonical evidence is missing: ${R.join(", ")}.`);let E=[],x=null,u=null;for(let e of Z)if(!R.includes(e))try{let r=JSON.parse(await M.readFile(f.join(c$1,e),"utf8"));b$1(e,r,e),e===p.model&&(x=r),e===p.knowledgeGraph&&(u=r);}catch{E.push(e);}d("canonical-contracts",E.length===0?"passed":"failed",E.length===0?"Canonical workspace evidence satisfies its published schemas.":`Canonical evidence failed contract validation: ${E.join(", ")}.`);let b$2=t.projectKnowledgeGraphReference,Q=f.join(n,b$2),X="failed",I="The project Knowledge Graph reference is missing.";if(O.existsSync(Q)&&u)try{let e=JSON.parse(await M.readFile(Q,"utf8"));b$1(b$2,e,b$2);let r=j(u,o.project.name),{integrity:P,...h}=e,C=u.source;e.project.name===o.project.name&&e.canonical.sourceHash===C?.hash&&e.canonical.projectionHash===c(r)&&e.integrity.payloadHash===c(h)?(X="passed",I="The project reference integrity-binds the exact current projection of canonical workspace evidence."):I="The project Knowledge Graph reference is stale or does not match the canonical project projection.";}catch{I="The project Knowledge Graph reference failed schema or integrity validation.";}d("project-knowledge-graph",X,I,b$2);let ee=x?.workspace,te=u?.workspace,oe=Array.isArray(u?.entities)?u.entities:[],ne=Array.isArray(x?.projects)?x.projects:[],re=E.length===0&&ee?.name===o.workspace.name&&te?.name===o.workspace.name&&ne.some(e=>e.name===o.project.name)&&oe.some(e=>e.projectId===o.project.name);d("canonical-project-membership",re?"passed":"failed",re?"The project and workspace identities agree across the entry, Model, and Graph.":`The project or workspace identity is missing or inconsistent in canonical evidence (entry workspace=${o.workspace.name}, model workspace=${String(ee?.name??"missing")}, graph workspace=${String(te?.name??"missing")}, entry project=${o.project.name}, model projects=${ne.map(e=>String(e.name??"missing")).join(",")||"missing"}, graph projects=${[...new Set(oe.map(e=>e.projectId).filter(e=>typeof e=="string"))].join(",")||"missing"}).`);let se=!o.intelligence.freshness.graphMatchesModel||["missing","stale"].includes(o.intelligence.freshness.model)||["missing","stale"].includes(o.intelligence.freshness.graph)?"failed":o.intelligence.freshness.model==="unknown"||o.intelligence.freshness.graph==="unknown"?"warning":"passed",j$1=false,G;if(t$1.validateLiveInputs!==false)try{let e=await a$1(c$1);j$1=e.status==="hit";let r=e.status==="hit"?"Live project inputs match the persisted Model and Knowledge Graph snapshot.":`Live project inputs require an intelligence refresh (${e.reason}).`;G={id:"live-inputs",status:j$1?"passed":"failed",message:r};}catch{G={id:"live-inputs",status:"failed",message:"Live project inputs could not be validated against canonical graph evidence."};}else G={id:"live-inputs",status:"warning",message:"Live input validation was skipped; persisted compatibility was checked only."};let K=se==="warning"&&o.intelligence.freshness.model==="unknown"&&o.intelligence.freshness.graph==="fresh"&&o.intelligence.freshness.graphMatchesModel&&j$1?"passed":se;d("persisted-freshness",K,K==="passed"?o.intelligence.freshness.model==="unknown"?"Model and Graph bindings are current; live input validation closes structural freshness while verify-before-use facts remain individually governed.":"Persisted Model and Knowledge Graph bindings are current.":K==="warning"?"Persisted evidence is compatible, but at least one freshness state is unknown.":"Persisted Model or Knowledge Graph evidence is missing, stale, or mismatched."),y.push(G);let i={present:false,appliesToProject:false,status:"none"},_=[],we=f.join(c$1,t.goalIndex);if(O.existsSync(we)){let e=null;try{e=await l({workspacePath:c$1,validateBindings:false});}catch{_.push("workspai goal --list --json"),d("active-goal","failed","The Goal index is present but invalid.");}if(e?.active&&(i={present:true,appliesToProject:e.active.scope.projects.includes(o.project.name),status:"invalid",id:e.active.id,objective:e.active.objective,lifecycle:e.active.lifecycle,goalPack:`workspace:${e.active.goalPack}`,agentHandoff:`workspace:${e.active.agentHandoff}`}),e)try{let r=await l({workspacePath:c$1,validateBindings:true});r.active&&(i={present:true,appliesToProject:r.active.scope.projects.includes(o.project.name),status:"ready",id:r.active.id,objective:r.active.objective,lifecycle:r.active.lifecycle,goalPack:`workspace:${r.active.goalPack}`,agentHandoff:`workspace:${r.active.agentHandoff}`}),d("active-goal","passed",r.active?"The active Goal Pack and agent handoff have valid canonical bindings.":"No active Goal Pack is selected.");}catch(r){let P=r instanceof Error?r.message:String(r),h=i.present&&/\bstale\b|--refresh/i.test(P);if(i.present&&(i.status=h?"stale":"invalid"),h&&i.objective){let w=e.active,ve=w?.scope.kind==="project"&&w.scope.projects.length===1?`project:${w.scope.projects[0]}`:w?.scope.kind==="project-set"&&w.scope.projects.length>1?`projects:${w.scope.projects.join(",")}`:"workspace";_.push(`workspai goal ${JSON.stringify(i.objective)} --scope ${ve} --for-agent generic --refresh --json`);}else _.push("workspai goal --status --json");let C=!i.present||i.appliesToProject;d("active-goal",C?"failed":"warning",h?C?"The selected Goal Pack is present but stale; regenerate it against current canonical evidence before acting.":"The selected Goal Pack is stale, but it does not apply to this project; current project evidence remains usable while the Goal is refreshed for its own scope.":i.present?C?"The selected Goal Pack is present but its canonical binding or handoff is invalid.":"The selected Goal Pack has an invalid canonical binding, but it does not apply to this project; current project evidence remains usable while the Goal is repaired for its own scope.":"The Goal index could not be validated.");}}else d("active-goal","passed","No Goal index is present for this workspace.");let ae=y.filter(e=>e.id!=="active-goal"),W=ae.some(e=>e.status==="failed")?"blocked":ae.some(e=>e.status==="warning")?"degraded":"ready",ye=y.some(e=>e.id==="active-goal"&&e.status==="failed")?"blocked":y.some(e=>e.id==="active-goal"&&e.status==="warning")?"degraded":"ready",N=xe([k,W,ye]),v=o.blockers.some(e=>e.severity==="error")?"blocked":o.blockers.length>0?"degraded":"ready",ke=v==="blocked"?"blocked":v==="degraded"?"degraded":"not-verified",je=`command:workspai agent bootstrap --for-agent ${g} --strict --json`,Ae=p$1.protocol.requiredReadOrder.map(e=>e==="command:workspai agent bootstrap --for-agent generic --strict --json"?je:e),ie={schemaVersion:Ce,generatedAt:(t$1.now??new Date).toISOString(),status:N,statusScope:"agent-grounding",readiness:{agentGrounding:N,architectureEvidence:W,projectEnvironment:v,release:ke},requestedAgent:D,resolvedHost:g,project:{name:o.project.name,relativePath:o.project.relativePath,...o.project.runtime?{runtime:o.project.runtime}:{},...o.project.framework?{framework:o.project.framework}:{}},workspace:{name:o.workspace.name,relationship:o.workspace.relationship,resolved:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},entry:{artifact:L,schemaVersion:fe,hostStatus:k,entryFiles:$},canonicalEvidence:{projectContext:t.projectContextAgent,projectKnowledgeGraph:t.projectKnowledgeGraphReference,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json",modelFreshness:j$1?"fresh":o.intelligence.freshness.model,graphFreshness:j$1?"fresh":o.intelligence.freshness.graph,graphMatchesModel:o.intelligence.freshness.graphMatchesModel,liveInputsValidated:j$1,blockerCount:o.blockers.length},activeGoal:i,requiredReadOrder:Ae,claims:{architecture:W==="ready"?"allowed-with-citations":"prohibited",sourceInspection:"bounded-and-targeted",sourceMutation:"governed-cli-transaction-only",verification:"cli-evidence-only"},checks:y,nextActions:N==="ready"?[...i.present&&i.appliesToProject&&i.agentHandoff?[`read:${i.agentHandoff}`]:[],...v==="blocked"?["workspai doctor project --json","workspai workspace explain release-blocked --json"]:v==="degraded"?["workspai doctor project --json"]:[],`workspai workspace graph search <task-query> --scope project:${o.project.name} --limit 12 --json`,"inspect only the returned proof paths and target source files"]:[..._,"workspai workspace intelligence run --for-agent generic --strict --json",`workspai agent bootstrap --for-agent ${g} --strict --json`]},ce=T(U(p$1)),Ee=T({manifestHash:ce,projectContextHash:o.integrity.payloadHash,requestedAgent:D,status:N,generatedAt:ie.generatedAt}),pe={...ie,receiptId:Ee},F={...pe,integrity:{algorithm:"sha256",manifestHash:ce,projectContextHash:o.integrity.payloadHash,payloadHash:T(pe),portable:true,absolutePathsEmitted:false}};if(!A(F))throw new Error("Agent bootstrap receipt rejected a non-portable local path.");return a(F,"contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json","Agent bootstrap receipt"),F}
1
+ import {l}from'./chunk-IDETNYCF.js';import {a as a$1}from'./chunk-4CXV3PPV.js';import {b}from'./chunk-DWDYLKVW.js';import {j}from'./chunk-SEZTSMRR.js';import {b as b$1}from'./chunk-VN2MKTQO.js';import {a}from'./chunk-AFIFZTOY.js';import {c}from'./chunk-EWZZUQBR.js';import {s,t,p}from'./chunk-ODK4LCEL.js';import Pe from'crypto';import O from'fs';import M from'fs/promises';import f from'path';var fe=s.projectAgentEntry.schemaVersion,L=t.projectAgentEntry,Ce="workspai.agent-bootstrap-receipt.v1",Ve="<!-- WORKSPAI:AGENT-ENTRY:START -->",Be="<!-- WORKSPAI:AGENT-ENTRY:END -->",B=["generic","codex","claude","gemini","qwen","kimi","grok","copilot","cursor","windsurf","amazon-q"],Ue=["CLAUDE.md","GEMINI.md","QWEN.md",".amazonq/rules/workspai-agent-entry.md"];function Se(t){let s=t?.trim().toLowerCase()||"generic";if(s==="orca")return "grok";if(B.includes(s))return s;throw new Error(`Unsupported agent host "${s}". Expected one of: ${B.join(", ")}.`)}function me(t){let s=t.map(c=>c.id).sort(),n=[...B].sort();if(s.length!==n.length||s.some((c,p)=>c!==n[p]))throw new Error("Project agent entry must define each supported host exactly once.")}function U(t){let{integrity:s,...n}=t;return n}function T(t){return c(t)}function Je(t$1){me(t$1.hosts);let s={schemaVersion:fe,generatedAt:t$1.context.generatedAt,project:{name:t$1.context.project.name,relativePath:t$1.context.project.relativePath,...t$1.context.project.runtime?{runtime:t$1.context.project.runtime}:{},...t$1.context.project.framework?{framework:t$1.context.project.framework}:{}},workspace:{name:t$1.context.workspace.name,relationship:t$1.context.workspace.relationship,localBinding:t.projectWorkspaceLink,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},canonical:{projectContext:t.projectContextAgent,projectGrounding:".workspai/PROJECT-GROUNDING.md",projectKnowledgeGraph:t.projectKnowledgeGraphReference,goalIndex:`workspace:${t.goalIndex}`,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json"},protocol:{mode:"canonical-first",bootstrapCommand:"workspai agent bootstrap --for-agent generic --strict --json",verifyCommand:"workspai project agent-entry verify --for-agent all --strict --json",requiredReadOrder:[L,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",t.projectContextAgent,`workspace:${t.goalIndex}`,`workspace:${p.skillsIndex}`,"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json","source:targeted-live-files"],sourcePolicy:{liveSourceAuthority:"exact-implementation",workspaceEvidenceAuthority:"identity-topology-readiness-goals",broadScanBeforeBootstrap:false,sourceMutation:"governed-only",verificationClaims:"cli-evidence-only"},degradedMode:{discloseMissingEvidence:true,allowCompleteArchitectureClaims:false,allowReadOnlySourceInspection:true}},hosts:[...t$1.hosts].sort((c,p)=>c.id.localeCompare(p.id))},n={...s,integrity:{algorithm:"sha256",projectContextHash:t$1.context.integrity.payloadHash,payloadHash:T(s),portable:true,absolutePathsEmitted:false}};if(!A(n))throw new Error("Project agent entry rejected a non-portable local path.");return a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n}function A(t){return typeof t=="string"?!(/^[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])file:\/\//i.test(t)||/(?:^|[\s("'`])\\\\[^\\\s]+[\\]/.test(t)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(t)):Array.isArray(t)?t.every(A):t&&typeof t=="object"?Object.values(t).every(A):true}async function Te(t){let s=f.join(t,L),n=JSON.parse(await M.readFile(s,"utf8"));if(a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n.integrity.payloadHash!==T(U(n)))throw new Error("Project agent entry integrity validation failed.");if(me(n.hosts),!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project agent entry contains a non-portable local path.");return n}async function Re(t$1){let s=f.join(t$1,t.projectContextAgent),n=JSON.parse(await M.readFile(s,"utf8"));a(n,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent");let c=U(n),p=Pe.createHash("sha256").update(JSON.stringify(c)).digest("hex");if(n.integrity.payloadHash!==p)throw new Error("Project context agent integrity validation failed.");if(!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project context agent contains a non-portable local path.");return n}function xe(t){return t.includes("blocked")?"blocked":t.includes("degraded")?"degraded":"ready"}async function Ye(t$1){let s=b({startPath:f.resolve(t$1.startPath??process.cwd()),strict:true,requireProjectMembership:true});if(!s?.projectPath)throw new Error("No canonically bound Workspai project was resolved.");let n=s.projectPath,c$1=s.workspacePath,p$1=await Te(n),o=await Re(n);if(p$1.integrity.projectContextHash!==o.integrity.payloadHash||p$1.project.name!==o.project.name||p$1.workspace.name!==o.workspace.name)throw new Error("Project agent entry is not bound to the current project context.");let J=t$1.forAgent?.trim().toLowerCase()||"generic",Y=J==="all",g=Y?"all":Se(J),D=g,m=Y?p$1.hosts:p$1.hosts.filter(e=>e.id===g),z=p$1.hosts.find(e=>e.id==="generic");if(m.length===0&&z&&m.push(z),m.length===0)throw new Error("Project agent entry does not define generic host coverage.");let y=[],d=(e,r,P,h)=>y.push({id:e,status:r,message:P,...h?{artifact:h}:{}});d("workspace-binding","passed","Canonical workspace membership is resolved."),d("entry-integrity","passed","Project entry manifest integrity is valid.",L),d("project-context-integrity","passed","Project context integrity and manifest binding are valid.",t.projectContextAgent);let $=[...new Set(m.flatMap(e=>e.entryFiles))].sort(),ue=$.filter(e=>!O.existsSync(f.join(n,e))),k=m.some(e=>e.status==="blocked")||ue.length>0?"blocked":m.some(e=>e.status==="degraded")?"degraded":"ready";d("host-discovery",k==="ready"?"passed":k==="degraded"?"warning":"failed",k==="ready"?`${g} has discoverable Workspai entry coverage.`:k==="degraded"?m.find(e=>e.reason)?.reason??`${g} entry coverage is degraded.`:`${g} entry coverage is missing required files.`,$[0]);let Z=[p.agentIndex,p.agentContext,p.skillsIndex,p.model,p.knowledgeGraph],R=Z.filter(e=>!O.existsSync(f.join(c$1,e)));d("canonical-evidence",R.length===0?"passed":"failed",R.length===0?"Required canonical workspace evidence is present.":`Required canonical evidence is missing: ${R.join(", ")}.`);let E=[],x=null,u=null;for(let e of Z)if(!R.includes(e))try{let r=JSON.parse(await M.readFile(f.join(c$1,e),"utf8"));b$1(e,r,e),e===p.model&&(x=r),e===p.knowledgeGraph&&(u=r);}catch{E.push(e);}d("canonical-contracts",E.length===0?"passed":"failed",E.length===0?"Canonical workspace evidence satisfies its published schemas.":`Canonical evidence failed contract validation: ${E.join(", ")}.`);let b$2=t.projectKnowledgeGraphReference,Q=f.join(n,b$2),X="failed",I="The project Knowledge Graph reference is missing.";if(O.existsSync(Q)&&u)try{let e=JSON.parse(await M.readFile(Q,"utf8"));b$1(b$2,e,b$2);let r=j(u,o.project.name),{integrity:P,...h}=e,C=u.source;e.project.name===o.project.name&&e.canonical.sourceHash===C?.hash&&e.canonical.projectionHash===c(r)&&e.integrity.payloadHash===c(h)?(X="passed",I="The project reference integrity-binds the exact current projection of canonical workspace evidence."):I="The project Knowledge Graph reference is stale or does not match the canonical project projection.";}catch{I="The project Knowledge Graph reference failed schema or integrity validation.";}d("project-knowledge-graph",X,I,b$2);let ee=x?.workspace,te=u?.workspace,oe=Array.isArray(u?.entities)?u.entities:[],ne=Array.isArray(x?.projects)?x.projects:[],re=E.length===0&&ee?.name===o.workspace.name&&te?.name===o.workspace.name&&ne.some(e=>e.name===o.project.name)&&oe.some(e=>e.projectId===o.project.name);d("canonical-project-membership",re?"passed":"failed",re?"The project and workspace identities agree across the entry, Model, and Graph.":`The project or workspace identity is missing or inconsistent in canonical evidence (entry workspace=${o.workspace.name}, model workspace=${String(ee?.name??"missing")}, graph workspace=${String(te?.name??"missing")}, entry project=${o.project.name}, model projects=${ne.map(e=>String(e.name??"missing")).join(",")||"missing"}, graph projects=${[...new Set(oe.map(e=>e.projectId).filter(e=>typeof e=="string"))].join(",")||"missing"}).`);let se=!o.intelligence.freshness.graphMatchesModel||["missing","stale"].includes(o.intelligence.freshness.model)||["missing","stale"].includes(o.intelligence.freshness.graph)?"failed":o.intelligence.freshness.model==="unknown"||o.intelligence.freshness.graph==="unknown"?"warning":"passed",j$1=false,G;if(t$1.validateLiveInputs!==false)try{let e=await a$1(c$1);j$1=e.status==="hit";let r=e.status==="hit"?"Live project inputs match the persisted Model and Knowledge Graph snapshot.":`Live project inputs require an intelligence refresh (${e.reason}).`;G={id:"live-inputs",status:j$1?"passed":"failed",message:r};}catch{G={id:"live-inputs",status:"failed",message:"Live project inputs could not be validated against canonical graph evidence."};}else G={id:"live-inputs",status:"warning",message:"Live input validation was skipped; persisted compatibility was checked only."};let K=se==="warning"&&o.intelligence.freshness.model==="unknown"&&o.intelligence.freshness.graph==="fresh"&&o.intelligence.freshness.graphMatchesModel&&j$1?"passed":se;d("persisted-freshness",K,K==="passed"?o.intelligence.freshness.model==="unknown"?"Model and Graph bindings are current; live input validation closes structural freshness while verify-before-use facts remain individually governed.":"Persisted Model and Knowledge Graph bindings are current.":K==="warning"?"Persisted evidence is compatible, but at least one freshness state is unknown.":"Persisted Model or Knowledge Graph evidence is missing, stale, or mismatched."),y.push(G);let i={present:false,appliesToProject:false,status:"none"},_=[],we=f.join(c$1,t.goalIndex);if(O.existsSync(we)){let e=null;try{e=await l({workspacePath:c$1,validateBindings:false});}catch{_.push("workspai goal --list --json"),d("active-goal","failed","The Goal index is present but invalid.");}if(e?.active&&(i={present:true,appliesToProject:e.active.scope.projects.includes(o.project.name),status:"invalid",id:e.active.id,objective:e.active.objective,lifecycle:e.active.lifecycle,goalPack:`workspace:${e.active.goalPack}`,agentHandoff:`workspace:${e.active.agentHandoff}`}),e)try{let r=await l({workspacePath:c$1,validateBindings:true});r.active&&(i={present:true,appliesToProject:r.active.scope.projects.includes(o.project.name),status:"ready",id:r.active.id,objective:r.active.objective,lifecycle:r.active.lifecycle,goalPack:`workspace:${r.active.goalPack}`,agentHandoff:`workspace:${r.active.agentHandoff}`}),d("active-goal","passed",r.active?"The active Goal Pack and agent handoff have valid canonical bindings.":"No active Goal Pack is selected.");}catch(r){let P=r instanceof Error?r.message:String(r),h=i.present&&/\bstale\b|--refresh/i.test(P);if(i.present&&(i.status=h?"stale":"invalid"),h&&i.objective){let w=e.active,ve=w?.scope.kind==="project"&&w.scope.projects.length===1?`project:${w.scope.projects[0]}`:w?.scope.kind==="project-set"&&w.scope.projects.length>1?`projects:${w.scope.projects.join(",")}`:"workspace";_.push(`workspai goal ${JSON.stringify(i.objective)} --scope ${ve} --for-agent generic --refresh --json`);}else _.push("workspai goal --status --json");let C=!i.present||i.appliesToProject;d("active-goal",C?"failed":"warning",h?C?"The selected Goal Pack is present but stale; regenerate it against current canonical evidence before acting.":"The selected Goal Pack is stale, but it does not apply to this project; current project evidence remains usable while the Goal is refreshed for its own scope.":i.present?C?"The selected Goal Pack is present but its canonical binding or handoff is invalid.":"The selected Goal Pack has an invalid canonical binding, but it does not apply to this project; current project evidence remains usable while the Goal is repaired for its own scope.":"The Goal index could not be validated.");}}else d("active-goal","passed","No Goal index is present for this workspace.");let ae=y.filter(e=>e.id!=="active-goal"),W=ae.some(e=>e.status==="failed")?"blocked":ae.some(e=>e.status==="warning")?"degraded":"ready",ye=y.some(e=>e.id==="active-goal"&&e.status==="failed")?"blocked":y.some(e=>e.id==="active-goal"&&e.status==="warning")?"degraded":"ready",N=xe([k,W,ye]),v=o.blockers.some(e=>e.severity==="error")?"blocked":o.blockers.length>0?"degraded":"ready",ke=v==="blocked"?"blocked":v==="degraded"?"degraded":"not-verified",je=`command:workspai agent bootstrap --for-agent ${g} --strict --json`,Ae=p$1.protocol.requiredReadOrder.map(e=>e==="command:workspai agent bootstrap --for-agent generic --strict --json"?je:e),ie={schemaVersion:Ce,generatedAt:(t$1.now??new Date).toISOString(),status:N,statusScope:"agent-grounding",readiness:{agentGrounding:N,architectureEvidence:W,projectEnvironment:v,release:ke},requestedAgent:D,resolvedHost:g,project:{name:o.project.name,relativePath:o.project.relativePath,...o.project.runtime?{runtime:o.project.runtime}:{},...o.project.framework?{framework:o.project.framework}:{}},workspace:{name:o.workspace.name,relationship:o.workspace.relationship,resolved:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},entry:{artifact:L,schemaVersion:fe,hostStatus:k,entryFiles:$},canonicalEvidence:{projectContext:t.projectContextAgent,projectKnowledgeGraph:t.projectKnowledgeGraphReference,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json",modelFreshness:j$1?"fresh":o.intelligence.freshness.model,graphFreshness:j$1?"fresh":o.intelligence.freshness.graph,graphMatchesModel:o.intelligence.freshness.graphMatchesModel,liveInputsValidated:j$1,blockerCount:o.blockers.length},activeGoal:i,requiredReadOrder:Ae,claims:{architecture:W==="ready"?"allowed-with-citations":"prohibited",sourceInspection:"bounded-and-targeted",sourceMutation:"governed-cli-transaction-only",verification:"cli-evidence-only"},checks:y,nextActions:N==="ready"?[...i.present&&i.appliesToProject&&i.agentHandoff?[`read:${i.agentHandoff}`]:[],...v==="blocked"?["workspai doctor project --json","workspai workspace explain release-blocked --json"]:v==="degraded"?["workspai doctor project --json"]:[],`workspai workspace graph search <task-query> --scope project:${o.project.name} --limit 12 --json`,"inspect only the returned proof paths and target source files"]:[..._,"workspai workspace intelligence run --for-agent generic --strict --json",`workspai agent bootstrap --for-agent ${g} --strict --json`]},ce=T(U(p$1)),Ee=T({manifestHash:ce,projectContextHash:o.integrity.payloadHash,requestedAgent:D,status:N,generatedAt:ie.generatedAt}),pe={...ie,receiptId:Ee},F={...pe,integrity:{algorithm:"sha256",manifestHash:ce,projectContextHash:o.integrity.payloadHash,payloadHash:T(pe),portable:true,absolutePathsEmitted:false}};if(!A(F))throw new Error("Agent bootstrap receipt rejected a non-portable local path.");return a(F,"contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json","Agent bootstrap receipt"),F}
2
2
  export{fe as a,L as b,Ce as c,Ve as d,Be as e,B as f,Ue as g,Se as h,Je as i,Ye as j};
@@ -1 +1 @@
1
- export{b as buildWorkspaceManifest,f as createProject,a as initializeStandaloneGitRepository,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,c as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-UOTOJJI4.js';
1
+ export{b as buildWorkspaceManifest,f as createProject,a as initializeStandaloneGitRepository,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,c as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-V6HVDVKJ.js';
@@ -1 +1 @@
1
- export{d as DOCTOR_WORKSPACE_REPORT_PATH,r as applyEnvKeyAddFix,n as applyFileAppendFix,o as applyFileCopyFix,m as applyFileCreateFix,q as applyJsonEditFix,s as applyMakefileTargetFix,l as applyPackageScriptFix,j as assertOperationPathInsideProject,k as assertOperationPathInsideProjectResolved,i as buildRepairOperationIdentity,u as computeDoctorFixAwareExitCode,t as computeDoctorGateExitCode,p as decodeJsonPointerSegment,h as parseInternalRepairCommand,g as parsePackageScriptFix,f as pythonPackageListProvesDependencies,e as resolveDoctorPolicyProfile,v as runDoctor}from'./chunk-PSQPKK6H.js';
1
+ export{d as DOCTOR_WORKSPACE_REPORT_PATH,r as applyEnvKeyAddFix,n as applyFileAppendFix,o as applyFileCopyFix,m as applyFileCreateFix,q as applyJsonEditFix,s as applyMakefileTargetFix,l as applyPackageScriptFix,j as assertOperationPathInsideProject,k as assertOperationPathInsideProjectResolved,i as buildRepairOperationIdentity,u as computeDoctorFixAwareExitCode,t as computeDoctorGateExitCode,p as decodeJsonPointerSegment,h as parseInternalRepairCommand,g as parsePackageScriptFix,f as pythonPackageListProvesDependencies,e as resolveDoctorPolicyProfile,v as runDoctor}from'./chunk-SC43A6LH.js';
@@ -1 +1 @@
1
- export{f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,k as buildGoalLifecycleResult,l as inspectGoalLifecycle,q as linkGoalChangeTransaction,p as linkGoalRepairTransaction,n as prepareGoalVerification,m as transitionGoalLifecycle,o as verifyGoalLifecycle}from'./chunk-QIPW3G2H.js';
1
+ export{f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,k as buildGoalLifecycleResult,l as inspectGoalLifecycle,q as linkGoalChangeTransaction,p as linkGoalRepairTransaction,n as prepareGoalVerification,m as transitionGoalLifecycle,o as verifyGoalLifecycle}from'./chunk-IDETNYCF.js';
@@ -1 +1 @@
1
- export{a as planGoalPack}from'./chunk-ZXQC36NJ.js';export{b as GOAL_AGENT_HANDOFF_SCHEMA_VERSION,f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,g as GOAL_LIFECYCLE_RESULT_SCHEMA_VERSION,d as GOAL_PACK_LAST_RUN_PATH,a as GOAL_PACK_SCHEMA_VERSION,c as GOAL_PLAN_RESULT_SCHEMA_VERSION}from'./chunk-QIPW3G2H.js';
1
+ export{a as planGoalPack}from'./chunk-X5XFT5UZ.js';export{b as GOAL_AGENT_HANDOFF_SCHEMA_VERSION,f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,g as GOAL_LIFECYCLE_RESULT_SCHEMA_VERSION,d as GOAL_PACK_LAST_RUN_PATH,a as GOAL_PACK_SCHEMA_VERSION,c as GOAL_PLAN_RESULT_SCHEMA_VERSION}from'./chunk-IDETNYCF.js';