workspai 0.65.0 → 0.66.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.
- package/README.md +4 -1
- package/contracts/agent-customization-pack.v1.json +4 -2
- package/contracts/analyze-last-run.v1.json +9 -1
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +113 -0
- package/contracts/extension-cli-compatibility.v1.json +2 -0
- package/contracts/published-contract-catalog.v1.json +10 -0
- package/contracts/runtime-command-surface.v1.json +47 -2
- package/contracts/workspace-activity-event.v1.json +132 -0
- package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
- package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
- package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
- package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
- package/dist/analyze-UJQWGNM2.js +1 -0
- package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
- package/dist/autopilot-release-U6F4M2BQ.js +1 -0
- package/dist/capabilities-command-XUKPO25Z.js +1 -0
- package/dist/chunk-2LIVMG5C.js +2 -0
- package/dist/{chunk-XGE2FDI4.js → chunk-2PACEMNE.js} +1 -1
- package/dist/chunk-334J2KIP.js +7 -0
- package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
- package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
- package/dist/chunk-4XEH3WNV.js +13 -0
- package/dist/chunk-5OA33JH2.js +2 -0
- package/dist/chunk-5TY74LLW.js +2 -0
- package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
- package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
- package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
- package/dist/chunk-6UNATTB7.js +1 -0
- package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
- package/dist/chunk-7FF5EOIO.js +2 -0
- package/dist/{chunk-D5YJOQYK.js → chunk-AP4PV6WJ.js} +1 -1
- package/dist/chunk-AXUA7PFV.js +2 -0
- package/dist/chunk-B4IVVTMQ.js +2 -0
- package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
- package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
- package/dist/chunk-DUBOKZMA.js +49 -0
- package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
- package/dist/{chunk-2RL6RRT2.js → chunk-EHH4SKVH.js} +50 -50
- package/dist/chunk-EP4CUWOO.js +9 -0
- package/dist/chunk-FY4X2VOE.js +39 -0
- package/dist/chunk-GAYK3WGV.js +2 -0
- package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
- package/dist/{chunk-YN5X2FTP.js → chunk-H7MRINGP.js} +1 -1
- package/dist/chunk-HJLGXFMK.js +1 -0
- package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
- package/dist/{chunk-HDNATYW7.js → chunk-IIFFEEMX.js} +1 -1
- package/dist/chunk-IVF6NEHS.js +1 -0
- package/dist/chunk-JC4XSU7G.js +1 -0
- package/dist/chunk-JRP6WP5C.js +681 -0
- package/dist/chunk-JZJBA2V2.js +1 -0
- package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
- package/dist/chunk-L5Q2S5GY.js +3 -0
- package/dist/chunk-LPCZHKD5.js +1 -0
- package/dist/chunk-MZ7U4BIQ.js +157 -0
- package/dist/chunk-NMXGSVMD.js +1 -0
- package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
- package/dist/chunk-O37UBRMX.js +4 -0
- package/dist/chunk-OI2VOU6S.js +1 -0
- package/dist/chunk-PD7Y6HIM.js +2 -0
- package/dist/chunk-PJPS7CNH.js +1 -0
- package/dist/chunk-QGAPGZPL.js +97 -0
- package/dist/chunk-R2M5OJOK.js +5 -0
- package/dist/chunk-SX6A656X.js +1 -0
- package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
- package/dist/chunk-TTHO4MFC.js +2 -0
- package/dist/chunk-U5ENEDJA.js +7 -0
- package/dist/chunk-UOCERSAN.js +1 -0
- package/dist/chunk-UPIPSSXY.js +1 -0
- package/dist/chunk-UTV4DTNM.js +1 -0
- package/dist/chunk-VA5VSOBL.js +2 -0
- package/dist/chunk-VQOWB26M.js +12 -0
- package/dist/chunk-VQZ5PI5J.js +1 -0
- package/dist/chunk-WTWRSEOW.js +1 -0
- package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
- package/dist/{chunk-YYQEWAES.js → chunk-XQFWUM2P.js} +1 -1
- package/dist/chunk-XWKGZRHN.js +1 -0
- package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
- package/dist/chunk-ZQH2I5RQ.js +1 -0
- package/dist/{create-ALT2ME6H.js → create-SOLLXXAB.js} +1 -1
- package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
- package/dist/{doctor-RW4R3O5C.js → doctor-NQ5PUCUP.js} +1 -1
- package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
- package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-IPNY7KNR.js} +1 -1
- package/dist/goal-pack-2WV3EA4Y.js +1 -0
- package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
- package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +170 -170
- package/dist/live-command-Q6E45N7S.js +18 -0
- package/dist/{pipeline-U4N2DVD7.js → pipeline-MIMENSI7.js} +1 -1
- package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
- package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
- package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
- package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
- package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
- package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
- package/dist/verified-goal-46JWNCDY.js +1 -0
- package/dist/{workspace-HGUZWNAB.js → workspace-KO37XHF6.js} +1 -1
- package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-32FIJQBH.js} +1 -1
- package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
- package/dist/{workspace-context-4WIWFW26.js → workspace-context-JKRPX775.js} +1 -1
- package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-4T3NYNK5.js} +1 -1
- package/dist/workspace-explain-MOGL4GEA.js +1 -0
- package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
- package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
- package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-GHWO3BZU.js} +1 -1
- package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-PTVS47NJ.js} +1 -1
- package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
- package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
- package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-PJIPTXL3.js} +1 -1
- package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
- package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
- package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
- package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
- package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-VANN7RCA.js} +1 -1
- package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
- package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
- package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
- package/dist/workspace-model-VSVKLX7M.js +1 -0
- package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
- package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
- package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
- package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
- package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
- package/dist/workspace-run-3BXKTLVL.js +1 -0
- package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-EJCSOBIK.js} +1 -1
- package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-JTIFBF4Z.js} +1 -1
- package/docs/SETUP.md +10 -0
- package/docs/agent-entry.md +22 -7
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +41 -7
- package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
- package/docs/contracts/README.md +4 -3
- package/docs/real-world-qualification.md +19 -3
- package/docs/workspace-knowledge-graph.md +95 -27
- package/docs/workspace-live-activity.md +199 -0
- package/docs/workspace-operations.md +32 -9
- package/package.json +1 -1
- package/dist/analyze-5PDVWECJ.js +0 -1
- package/dist/autopilot-release-JVIJCTKX.js +0 -1
- package/dist/capabilities-command-LHM3XIS6.js +0 -1
- package/dist/chunk-2647BYBC.js +0 -1
- package/dist/chunk-27UR373Z.js +0 -1
- package/dist/chunk-2C5ZBVBI.js +0 -2
- package/dist/chunk-6JWNDWOA.js +0 -1
- package/dist/chunk-CCDGHPEJ.js +0 -2
- package/dist/chunk-DFG33SBR.js +0 -2
- package/dist/chunk-FY4IIAIF.js +0 -1
- package/dist/chunk-HEZZ72V4.js +0 -94
- package/dist/chunk-HN7P4T3B.js +0 -681
- package/dist/chunk-ILIBOMYL.js +0 -1
- package/dist/chunk-J7QYANXK.js +0 -8
- package/dist/chunk-JD3A5QM6.js +0 -2
- package/dist/chunk-JQLJBK5N.js +0 -1
- package/dist/chunk-KLSSPJTV.js +0 -1
- package/dist/chunk-L22EABIC.js +0 -7
- package/dist/chunk-MDTI3UEB.js +0 -1
- package/dist/chunk-MOSXTVPU.js +0 -1
- package/dist/chunk-MYJQGGIU.js +0 -5
- package/dist/chunk-NOV6723U.js +0 -1
- package/dist/chunk-NYEAMMUL.js +0 -1
- package/dist/chunk-NZ3WZYD5.js +0 -1
- package/dist/chunk-O5B2L3R2.js +0 -1
- package/dist/chunk-OWB5KWSS.js +0 -13
- package/dist/chunk-P5PSZQPB.js +0 -2
- package/dist/chunk-QI3HG6IG.js +0 -144
- package/dist/chunk-SWGSFLTC.js +0 -1
- package/dist/chunk-THIOE2PB.js +0 -2
- package/dist/chunk-U5FCQTVL.js +0 -4
- package/dist/chunk-UXEO5QCF.js +0 -33
- package/dist/chunk-VR6XMUF3.js +0 -2
- package/dist/chunk-VVJK5NFY.js +0 -2
- package/dist/chunk-VXKWWX7S.js +0 -8
- package/dist/chunk-W322YDHS.js +0 -49
- package/dist/chunk-WPRLXKWC.js +0 -8
- package/dist/chunk-Y5YAP4F3.js +0 -2
- package/dist/chunk-YOCN7GF4.js +0 -1
- package/dist/goal-pack-YWPI43QL.js +0 -1
- package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
- package/dist/verified-goal-WM34TTGE.js +0 -1
- package/dist/workspace-explain-TE2LGOAV.js +0 -1
- package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
- package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
- package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
- package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
- package/dist/workspace-model-ZL6WCICX.js +0 -1
- package/dist/workspace-repair-engine-NX7I632M.js +0 -3
- package/dist/workspace-run-6GT5OBQ5.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-C4S22E6S.js';import {b}from'./chunk-VQOWB26M.js';import {q,f as f$1,g}from'./chunk-PJPS7CNH.js';import {d}from'./chunk-7FF5EOIO.js';import {e as e$1,d as d$1}from'./chunk-GAYK3WGV.js';import {f,e}from'./chunk-6UNATTB7.js';import E from'path';import A from'fs-extra';var re=f.agentContext,se=e.agentContext;function ne(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="gemini"||t==="qwen"||t==="kimi"||t==="grok"||t==="copilot"||t==="windsurf"||t==="amazon-q"||t==="orca"?t:"generic"}function G(e){return `npx --yes --package workspai workspai ${e}`.trim()}function x(e){return `npx workspai ${e}`.trim()}async function C(e,t,i){let s=E.join(e,t);if(!await A.pathExists(s))return null;try{let n=await A.readJson(s);return typeof n!="object"||n===null||!("schemaVersion"in n)||n.schemaVersion!==i?null:n}catch{return null}}function m(e$1){return {id:e$1.id,scope:e$1.scope,display:x(e$1.args),execute:G(e$1.args),description:e$1.description,...e$1.project?{project:e$1.project}:{},freshness:f$1({id:`command.${e$1.id}`,label:`${e$1.id} command`,scope:"command",value:{display:x(e$1.args),execute:G(e$1.args)},...e$1.project?{project:e$1.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e$1.generatedAt,now:e$1.now,sourceArtifact:e.model,sourcePath:`safeCommands.${e$1.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function L(e,t){return `workspace run ${t} --scope project:${e.name}`}function ae(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function oe(e){return [e.name,e.path,E.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function ie(e,t,i){let s={generatedAt:e.generatedAt,now:i},n=[m({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...s}),m({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...s}),m({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...s}),m({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...s}),m({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...s}),m({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...s}),m({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...s}),m({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...s})],c=t?[t]:e.projects;for(let a of c)a.commands.fleetStages.includes("test")&&n.push(m({id:`project.${a.name}.test`,scope:"project",project:a.name,args:L(a,"test"),description:`Run tests for ${a.name} through workspace orchestration.`,...s})),a.commands.fleetStages.includes("build")&&n.push(m({id:`project.${a.name}.build`,scope:"project",project:a.name,args:L(a,"build"),description:`Build ${a.name} through workspace orchestration.`,...s}));return n}function ce(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function pe(e,t){if(!t?.startsWith("project:"))return;let i=ae(t);if(i)return e.projects.find(s=>oe(s).includes(i))}function de(e,t,i){let s=[...e.validation?.issues??[]];t?.startsWith("project:")&&!i&&s.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let n=s.filter(a=>a.severity==="error").length,c=s.filter(a=>a.severity==="warning").length;return {status:n>0?"failed":c>0?"warning":"passed",errors:n,warnings:c,issues:s}}async function me(e,t){let i=[],s=[];for(let[n,c]of Object.entries(e.evidence))c&&await d$1(t,c.path)!==null?i.push(`${n}: ${c.path}`):s.push(n);return {available:i.sort(),missing:s.sort()}}function le(e){let t=e.summary.projectCount,i=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",s=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${i}, and ${s}.`}function ge(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),((e.summary.extendedProjects??0)>0||e.summary.observedProjects>0)&&t.push("Some projects use extended or observed support tiers; command coverage may be partial."),t}async function We(e$1){let t=e$1.model??await q({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),i=ne(e$1.agent),s=pe(t,e$1.scope),n=de(t,e$1.scope,s);if(e$1.strict===true&&n.status!=="passed"){let r=n.issues.map(g=>`${g.severity}:${g.code}:${g.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${r}`)}let c=e$1.now??new Date,a=t.facts??[],K=new Set((s?[s]:t.projects).map(r=>r.name)),R=a.filter(r=>r.project?K.has(r.project):true),H=(s?[s]:t.projects).map(r=>{let g=R.filter(p=>p.project===r.name);return {name:r.name,path:r.path,kind:r.kind,category:r.category,runtime:r.runtime,framework:r.frameworkDisplayName,...r.generator?{generator:r.generator}:{},createCapability:r.createCapability,supportTier:r.supportTier,...r.governance?{governance:r.governance}:{},safeCommands:ce(r),importantFiles:r.importantFiles,facts:g}}),S=await me(t,e$1.workspacePath),F=E.join(e$1.workspacePath,e.knowledgeGraph),u=await A.pathExists(F)?await A.readJson(F).catch(()=>null):null,N=false;if(u?.schemaVersion===f.knowledgeGraph)try{b(u,t),N=true;}catch{}let $=le(t),M=ie(t,s,c),b$2=await C(e$1.workspacePath,e.impact,f.impact),l=await C(e$1.workspacePath,e.doctor,f.doctor),v=await C(e$1.workspacePath,e.analyze,f.analyze),k=await C(e$1.workspacePath,e.readiness,f.readiness),h=await C(e$1.workspacePath,e.verify,f.verify),w=await C(e$1.workspacePath,e.explain,f.explain),f$2=await C(e$1.workspacePath,e.diff,f.diff),B=b$2?.summary?{changed:b$2.summary.changed,risk:b$2.summary.risk,affectedProjects:b$2.summary.affectedProjects,blastRadius:b$2.summary.blastRadius,recommendedCommands:b$2.summary.recommendedCommands}:void 0,U=l?.summary?{verdict:l.summary.verdict,totalIssues:l.summary.totalIssues,advisoryFindings:l.summary.advisoryFindings,blockingFindings:l.summary.blockingFindings,unknownFindings:l.summary.unknownFindings,hasSystemErrors:l.summary.hasSystemErrors,topSignals:(()=>{let r=Array.isArray(l.projects)?l.projects:[],g=[];for(let p of r.slice(0,6)){let te=Array.isArray(p.probes)?p.probes:[];for(let y of te.slice(0,10))(y?.status==="fail"||y?.severity==="error")&&g.push({label:y.label,scope:y.scope,issueClass:y.issueClass,status:y.status,severity:y.severity,recommendation:y.recommendation});}return g.slice(0,8)})()}:void 0,J=v?.summary?{score:v.summary.score,verdict:v.summary.verdict,findingCounts:v.summary.findings,topFindings:(Array.isArray(v.findings)?v.findings:[]).filter(p=>p?.severity==="fail"||p?.severity==="warn").slice(0,8).map(p=>({severity:p.severity,title:p.title,target:p.target,remediation:p.remediation}))}:void 0,X=k?{overallStatus:k.overallStatus,blocking:k.blocking,blockingReasons:k.blockingReasons,evidencePath:k.evidencePath,gates:Array.isArray(k.gates)?k.gates.slice(0,6).map(r=>({gate:r.gate,status:r.status,summary:r.summary})):void 0}:void 0,Q=h?.summary?{verdict:h.summary.verdict,exitCode:h.summary.exitCode,stepsFailed:h.summary.stepsFailed,stepsMissing:h.summary.stepsMissing,blockingReasons:h.blockingReasons,missingEvidence:h.missingEvidence}:void 0,Y=w?{summary:w.summary,blockingReasons:w.blockingReasons,releaseVerdict:w.releaseVerdict,evidenceFreshness:w.evidenceFreshness,sections:Array.isArray(w.sections)?w.sections.slice(0,4).map(r=>({id:r.id,title:r.title,body:r.body})):void 0}:void 0,Z=f$2?.summary?{changed:f$2.summary.changed,addedProjects:f$2.summary.addedProjects,removedProjects:f$2.summary.removedProjects,changedProjects:f$2.summary.changedProjects,workspaceChanges:f$2.summary.workspaceChanges,validationChanges:f$2.summary.validationChanges,gitChangedFiles:f$2.summary.gitChangedFiles}:void 0,ee=M.map(r=>f$1({id:`context.command.${r.id}`,label:`${r.id} safe command`,scope:"command",value:{display:r.display,execute:r.execute,scope:r.scope},...r.project?{project:r.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:c,sourceArtifact:e.agentContext,sourcePath:`safeCommands.${r.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),I=[...R,...ee],W=g({facts:I,generatedAt:c.toISOString(),now:c}),j=b$1();return {schemaVersion:re,generatedAt:c.toISOString(),agent:i,workspaceSummary:$,modelRef:e.model,knowledgeGraph:{artifact:e.knowledgeGraph,schemaVersion:f.knowledgeGraph,available:N,...typeof u?.quality?.entityCount=="number"?{entityCount:u.quality.entityCount}:{},...typeof u?.quality?.relationCount=="number"?{relationCount:u.quality.relationCount}:{},...typeof u?.quality?.proofCount=="number"?{proofCount:u.quality.proofCount}:{},queryCommands:[x("workspace graph search <query> --limit 12 --json"),x("workspace graph entities [kind] --json"),x("workspace graph evidence <entity-or-relation> --json"),x("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:j.schemaVersion,contractPath:j.contractPath,currentStep:"context",canonicalReadOrder:[...j.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:`workspace:${t.workspace.name}`,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...s?{activeProject:s.name}:{}},projects:H,safeCommands:M,facts:I,factFreshness:W,evidence:S,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:n,agentInstructions:[`Read \`${e.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${e.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...ge(t),...W.verifyBeforeUseFacts>0?[`${W.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[$,`Evidence available: ${S.available.length}. Missing evidence groups: ${S.missing.join(", ")||"none"}.`,s?`Active project scope: ${s.name} (${s.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
|
|
2
|
+
`),impactSummary:B,doctorSummary:U,analyzeSummary:J,readinessSummary:X,verifySummary:Q,explainSummary:Y,diffSummary:Z}}async function je(e,t){return e$1(t,se,d(e))}export{re as a,se as b,We as c,je as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {k,q}from'./chunk-NVND4727.js';import {b as b$2,c as c$2,a as a$3}from'./chunk-JZJBA2V2.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {d,a as a$1,p,g as g$2,f as f$2,e as e$2}from'./chunk-7FF5EOIO.js';import {c,b as b$1,j as j$1,z as z$1,f as f$1}from'./chunk-L5Q2S5GY.js';import {m,l}from'./chunk-U5ENEDJA.js';import {a as a$5}from'./chunk-GR6442P7.js';import {g as g$1,d as d$2,a as a$4,e as e$1}from'./chunk-GAYK3WGV.js';import {a}from'./chunk-2LIVMG5C.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {f,e,i,h}from'./chunk-6UNATTB7.js';import {t}from'./chunk-VQZ5PI5J.js';import g from'path';import P from'fs-extra';import It from'crypto';import {execFile}from'child_process';import {promisify}from'util';import {createRequire}from'module';var Rt=new Set(c().map(e=>e.id)),At=[...k().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.id,runtime:"node",runtimeCandidates:["node"],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.minNodeVersion?{runtimeRequirements:{node:`>=${e.minNodeVersion}`}}:e.minNodeMajor?{runtimeRequirements:{node:`>=${e.minNodeMajor}`}}:{}})),...q().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.framework,runtime:e.runtime,runtimeCandidates:[...e.runtimeCandidates],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.nodeSupport?{runtimeRequirements:{node:e.nodeSupport.requirement}}:{}})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"node",runtimeCandidates:["node","php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",plannerFramework:"symfony",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",plannerFramework:"rails",runtime:"ruby",runtimeCandidates:["ruby"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],H=new Map;for(let e of At){H.set(e.id,e);for(let t of e.aliases)H.set(t,e);}var Mt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function K(e){return e?.trim().toLowerCase()||void 0}function Qe(e){let t=K(e.kitId)??K(e.framework)??K(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let r=e.kitId?b$1(e.kitId):void 0;if(r&&Rt.has(r))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:r,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let o=H.get(t)??H.get(K(e.framework)??"")??H.get(K(e.runtime)??"");if(o)return {lane:"official",status:o.status,canExecuteCreate:o.canExecuteCreate,requested:t,resolved:o.id,officialCommands:o.officialCommands,fallbackLane:o.canExecuteCreate?void 0:"existing",reason:o.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let s=K(e.runtime);return s&&Mt.has(s)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:s,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function $r(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Lr="rapidkit-freshness-metadata-v1";function fe(e){if(Array.isArray(e))return e.map(t=>fe(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=fe(e[r]);return t}return e}function Ft(e){return JSON.stringify(fe(e))}function G(e){return It.createHash("sha256").update(Ft(e)).digest("hex")}var Ze=".workspai/workspace-graph.overrides.json",Dt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),Ot=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),tt=600,rt=5,Gt=256*1024,et={inferred:1,contract:2,manual:3};function _t(e){return e.split(g.sep).join("/")}function Z(e,t){return _t(g.relative(e,t)||".")}function nt(e){let t=new Map;for(let r of e.projects)t.has(r.name)||t.set(r.name,{id:r.name,path:r.path,...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kind?{kind:r.kind}:{}});return [...t.values()].sort((r,o)=>r.id.localeCompare(o.id))}function ot(e,t){let r=new Map,o=new Map;for(let n of t.projects){if(r.has(n.name))continue;let c=n.absolutePath?g.resolve(n.absolutePath):g.resolve(e,n.path);r.set(n.name,c),o.has(c)||o.set(c,n.name);}let s=[...o.entries()].map(([n,c])=>({dir:n,id:c})).sort((n,c)=>c.dir.length-n.dir.length||n.dir.localeCompare(c.dir));return {idToDir:r,dirToId:o,sortedDirs:s}}function ee(e,t){let r=g.resolve(t);for(let{dir:o,id:s}of e.sortedDirs)if(r===o||r.startsWith(`${o}${g.sep}`))return s;return null}async function he(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function ye(e){try{return await P.pathExists(e)?await P.readFile(e,"utf8"):null}catch{return null}}async function st(e,t){let r=[],o=new Map;for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json")),a=typeof c?.name=="string"?c.name.trim():"";a&&!o.has(a)&&o.set(a,s);}for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json"));if(c){let a=["dependencies","devDependencies","peerDependencies","optionalDependencies"],i=new Set;for(let l of a){let u=c[l];if(!(!u||typeof u!="object"||Array.isArray(u)))for(let p of Object.keys(u)){let d=o.get(p);!d||d===s||i.has(d)||(i.add(d),r.push({from:s,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Tt(e,t,s,n)),r.push(...await Nt(e,t,s,n));}return r}async function Tt(e,t,r,o){let s=await ye(g.join(o,"pyproject.toml"));if(!s)return [];let n=[],c=new Set,a=/path\s*=\s*["']([^"']+)["']/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"pyproject.toml")),detail:`path dependency ${i[1]}`}]}));}return n}async function Nt(e,t,r,o){let s=await ye(g.join(o,"go.mod"));if(!s)return [];let n=[],c=new Set,a=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"go.mod")),detail:`go.mod replace ${i[1]}`}]}));}return n}async function Kt(e,t){let r=[],o=[e];for(;o.length>0&&r.length<t;){let s=o.shift();if(!s)continue;let n=[];try{n=await P.readdir(s,{withFileTypes:true});}catch{continue}let c=[],a=[];for(let i of n)if(i.isDirectory()){if(Ot.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;c.push(g.join(s,i.name));}else i.isFile()&&Dt.has(g.extname(i.name))&&a.push(g.join(s,i.name));a.sort((i,l)=>i.localeCompare(l)),c.sort((i,l)=>i.localeCompare(l));for(let i of a){if(r.length>=t)break;r.push(i);}o.push(...c);}return r}var $t=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function Vt(e){let t=new Set;for(let r of $t){r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){let s=o[1];s.startsWith(".")&&t.add(s);}}return [...t]}async function ke(e,t,r,o){let s=new Map;for(let[n,c]of t.idToDir.entries()){if(o&&!o.has(n))continue;let a=await Kt(c,r);for(let i of a){let l=await P.stat(i).catch(()=>null);if(!l||l.size>Gt)continue;let u=await ye(i);if(u)for(let p of Vt(u)){let d=g.resolve(g.dirname(i),p),f=ee(t,d);if(!f||f===n)continue;let y=`${n}\0${f}`,m=s.get(y);m||(m={from:n,to:f,evidence:[]},s.set(y,m)),m.evidence.length<rt&&m.evidence.push({file:Z(e,i),detail:`imports ${p}`});}}}return [...s.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function Ht(e,t,r){let o=new Map;for(let s of r.projects){let n=Bt(e,t,s);n&&o.set(s.slug,n);}return o}function Bt(e,t,r){let o=[r.relativePath,r.externalPath].filter(s=>typeof s=="string"&&s.length>0);for(let s of o){let n=g.resolve(e,s),c=t.dirToId.get(n)??ee(t,n);if(c)return c}return t.idToDir.has(r.slug)?r.slug:null}function at(e,t,r){let o=[],s=Ht(e,t,r),n=g$2,c=new Map,a=new Map;for(let i of r.projects){let l=s.get(i.slug);if(!l)continue;let u=i.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of u.dependsOn??[]){let d=s.get(p);!d||d===l||o.push({from:l,to:d,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of u.publishes??[])c.has(p)||c.set(p,new Set),c.get(p)?.add(l);for(let p of u.consumes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(l);}for(let[i,l]of c.entries()){let u=a.get(i);if(u)for(let p of u)for(let d of l)p!==d&&o.push({from:p,to:d,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${i}`}]});}return o.push(...Lt(r,s)),o}function me(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Lt(e,t){let r=[],o=e.projects.map(s=>({project:s,id:t.get(s.slug)})).filter(s=>!!s.id).filter(s=>me(s.project.slug).length>=3);for(let s of e.projects){let n=t.get(s.slug);if(!n)continue;let c=s.contracts?.env??[];if(c.length===0)continue;let a=new Set;for(let i of c){let l=me(i);for(let u of o)u.id===n||a.has(u.id)||!(l.includes(me(u.project.slug))&&(u.project.ports?.length??0)>0)||(a.add(u.id),r.push({from:n,to:u.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:g$2,detail:`env ${i} references ${u.project.slug}`}]}));}}return r}async function it(e,t){let r=await he(g.join(e,Ze)),o=Array.isArray(r?.edges)?r?.edges:[],s=[],n=new Set(f$2);for(let c of o){if(!c||typeof c!="object"||Array.isArray(c))continue;let a=c,i=typeof a.from=="string"?a.from:"",l=typeof a.to=="string"?a.to:"",u=typeof a.kind=="string"?a.kind:"";if(!t.has(i)||!t.has(l)||i===l||!n.has(u))continue;let p=Array.isArray(a.evidence)?a.evidence.map(d=>d&&typeof d=="object"&&typeof d.file=="string"?{file:d.file,...typeof d.detail=="string"?{detail:d.detail}:{}}:null).filter(d=>!!d):[];s.push({from:i,to:l,kind:u,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:Ze,detail:"manual edge"}]});}return s}function Ut(e){return `${e.from}\0${e.to}\0${e.kind}`}function zt(e){let t=new Set,r=[];for(let o of e){let s=`${o.file}\0${o.detail??""}`;t.has(s)||(t.add(s),r.push(o));}return r.sort((o,s)=>o.file.localeCompare(s.file)||(o.detail??"").localeCompare(s.detail??"")).slice(0,rt)}function qt(e){let t=new Map;for(let r of e){let o=Ut(r),s=t.get(o);if(!s){t.set(o,{...r,evidence:[...r.evidence]});continue}let n=et[s.source],c=et[r.source];c>n?t.set(o,{...r,evidence:[...r.evidence,...s.evidence]}):c===n&&s.evidence.push(...r.evidence);}return [...t.values()].map(r=>({from:r.from,to:r.to,kind:r.kind,source:r.source,confidence:r.confidence,evidence:zt(r.evidence)})).sort((r,o)=>r.from.localeCompare(o.from)||r.to.localeCompare(o.to)||r.kind.localeCompare(o.kind)||r.source.localeCompare(o.source))}function ge(e){return Math.round(e*1e3)/1e3}function Jt(e){return Math.max(0,Math.min(100,Math.round(e)))}function Xt(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function Yt(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Qt(e,t){let r=a$6({nodes:e,edges:t}),o=new Map;for(let s of e){let n=r.byId.get(s.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},c=t.filter(f=>f.from===s.id||f.to===s.id),a=c.filter(f=>f.source==="contract"||f.source==="manual").length,i=c.filter(f=>f.confidence==="low").length,l=[],u=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+a*8;n.isHotspot&&(u+=24,l.push("Critical-path hotspot in dependency graph")),n.reach>0&&l.push(`Change reaches ${n.reach} dependent project(s)`),n.fanIn>0&&l.push(`${n.fanIn} direct dependent project(s)`),n.fanOut>0&&l.push(`${n.fanOut} direct dependency project(s)`),a>0&&l.push(`${a} contract/manual edge(s)`),i>0&&l.push(`${i} low-confidence inferred edge(s) need review`),c.length===0&&l.push(e.length===1?"Single-project workspace; inter-project dependency edges are not applicable":"No dependency evidence connected to this project yet");let p=Jt(u),d=Xt(p);o.set(s.id,{weight:d,score:p,verificationPriority:Yt(d),reasons:l.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return o}function Zt(e,t){let r=Qt(e,t);return e.map(o=>({...o,operationalProfile:r.get(o.id)}))}function er(e,t){let r=new Set;for(let i of t)r.add(i.from),r.add(i.to);let o=e.length,s=t.length,n=e.filter(i=>r.has(i.id)).length,c=Math.max(0,o-n),a=a$6({nodes:e,edges:t});return {nodeCount:o,edgeCount:s,inferredEdges:t.filter(i=>i.source==="inferred").length,contractEdges:t.filter(i=>i.source==="contract").length,manualEdges:t.filter(i=>i.source==="manual").length,authoritativeEdges:t.filter(i=>i.source==="contract"||i.source==="manual").length,lowConfidenceEdges:t.filter(i=>i.confidence==="low").length,orphanCount:c,connectedNodeCount:n,density:ge(o>1?s/(o*(o-1)):0),edgeCoverageRatio:ge(o>0?n/o:1),evidenceCoverageRatio:ge(s>0?t.filter(i=>i.evidence.length>0).length/s:1),hotspotCount:a.hotspots.length,hasCycle:rr(e,t)}}function tr(e,t,r){let o=[],s=e.filter(n=>!t.some(c=>c.from===n.id||c.to===n.id)).map(n=>n.id).sort((n,c)=>n.localeCompare(c));return r.nodeCount===0&&o.push({code:"graph.empty",severity:"info",message:"Workspace model has no projects, so dependency reasoning is unavailable.",recommendation:"Import, scaffold, or register projects before relying on graph-aware impact."}),r.nodeCount>1&&r.edgeCount===0?o.push({code:"graph.edges.missing",severity:"warning",message:"Projects were detected, but no inter-project dependency edges were found.",recommendation:"Run graph explain, add workspace contract relationships, or define manual graph overrides for operational dependencies that code imports cannot reveal.",nodeIds:s}):r.nodeCount>1&&r.orphanCount>0&&o.push({code:"graph.orphans.detected",severity:"warning",message:`${r.orphanCount} project(s) have no dependency evidence connected to the graph.`,recommendation:"Review isolated projects and add package, contract, or manual edges when they participate in release-critical flows.",nodeIds:s.slice(0,12)}),r.lowConfidenceEdges>0&&o.push({code:"graph.low_confidence_edges",severity:"info",message:`${r.lowConfidenceEdges} inferred edge(s) are low confidence.`,recommendation:"Promote important low-confidence relationships to workspace contract or manual overrides."}),r.edgeCount>0&&r.evidenceCoverageRatio<1&&o.push({code:"graph.evidence.partial",severity:"warning",message:"Some dependency edges do not include file-level evidence.",recommendation:"Attach evidence to manual overrides so agents can audit why a relationship exists."}),r.hasCycle&&o.push({code:"graph.cycle.detected",severity:"error",message:"The dependency graph contains at least one directed cycle.",recommendation:"Break the cycle or document the relationship explicitly before using graph-aware release gates."}),o.sort((n,c)=>{let a={error:0,warning:1,info:2};return a[n.severity]-a[c.severity]||n.code.localeCompare(c.code)})}function rr(e,t){let r=new Map;for(let i of e)r.set(i.id,[]);for(let i of t)r.has(i.from)||r.set(i.from,[]),r.get(i.from)?.push(i.to);let o=0,s=1,n=2,c=new Map;for(let i of r.keys())c.set(i,o);let a=i=>{let l=[{id:i,index:0}];for(c.set(i,s);l.length>0;){let u=l[l.length-1],p=r.get(u.id)??[];if(u.index>=p.length){c.set(u.id,n),l.pop();continue}let d=p[u.index];u.index+=1;let f=c.get(d)??o;if(f===s)return true;f===o&&(c.set(d,s),l.push({id:d,index:0}));}return false};for(let i of [...r.keys()].sort())if(c.get(i)===o&&a(i))return true;return false}function ct(e,t,r,o){let s=qt(r.filter(i=>t.has(i.from)&&t.has(i.to))),n=Zt(e,s),c=er(e,s),a=tr(e,s,c);return {schemaVersion:e$2,generatedAt:(o??new Date).toISOString(),nodes:n,edges:s,stats:c,...a.length>0?{diagnostics:a}:{}}}async function dt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];return c.push(...await st(t,n)),c.push(...await ke(t,n,r)),e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}async function pt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];if(c.push(...await st(t,n)),e.structuralChange)c.push(...await ke(t,n,r));else {c.push(...await ke(t,n,r,e.changedProjectIds));for(let a of e.previousGraph.edges)a.kind==="code-import"&&a.source==="inferred"&&!e.changedProjectIds.has(a.from)&&s.has(a.from)&&s.has(a.to)&&c.push({from:a.from,to:a.to,kind:"code-import",source:"inferred",confidence:a.confidence,evidence:a.evidence});}return e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}var te="workspace-model-producer.v3";var ve=h.workspaceModelCache.schemaVersion,we=i.workspaceModelCache,ir=["package.json","pyproject.toml","setup.py","requirements.txt","requirements.in","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","Gemfile.lock","mix.exs","mix.lock","deno.json","deno.jsonc","deno.lock","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],cr=[".csproj",".fsproj",".vbproj",".sln",".slnx",".gemspec"],lt=[i.workspaceContract,".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],ut=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".vue",".svelte",".rb",".go",".py",".java",".kt",".kts",".rs",".cs",".php",".ex",".exs",".clj",".cljs",".scala",".c",".cc",".cpp",".cxx",".h",".hh",".hpp",".hxx",".proto",".graphql",".gql",".sql",".sh"]),dr=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),pr=1500,re=promisify(execFile);function lr(e){return ut.has(g.extname(e).toLowerCase())}async function ur(e){try{let{stdout:t}=await re("git",["-C",e,"rev-parse","--show-toplevel"],{encoding:"utf8",timeout:1e4,maxBuffer:1048576}),r=t.trim();if(!r)return null;let o=g.relative(r,e).split(g.sep).join("/");if(o===".."||o.startsWith("../"))return null;let s=o||".",n=o?`HEAD:${o}`:"HEAD^{tree}",{stdout:c}=await re("git",["-C",r,"rev-parse",n],{encoding:"utf8",timeout:1e4,maxBuffer:1024*1024}),[a,i]=await Promise.all([re("git",["-C",r,"diff","--name-only","-z","HEAD","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024}),re("git",["-C",r,"ls-files","--others","--exclude-standard","-z","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024})]),l=new Set([a.stdout,i.stdout].flatMap(p=>p.toString("utf8").split("\0")).filter(Boolean)),u=[`git-tree:${c.trim()}`];for(let p of [...l].sort((d,f)=>d.localeCompare(f))){let d=g.resolve(r,p),f=g.relative(e,d).split(g.sep).join("/");f===".."||f.startsWith("../")||!lr(f)||u.push(`${f}:${await L(d)??"<deleted>"}`);}return u}catch{return null}}var B=null;function be(){if(B)return B;try{B=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{B="0.0.0";}return B}async function L(e){try{let t=await P.readFile(e);return It.createHash("sha256").update(t).digest("hex")}catch{return null}}async function ft(e){let t={};for(let o of ir){let s=await L(g.join(e,o));s&&(t[o]=s);}let r=await P.readdir(e).catch(()=>[]);for(let o of r.sort((s,n)=>s.localeCompare(n))){if(!cr.some(n=>o.toLowerCase().endsWith(n)))continue;let s=await L(g.join(e,o));s&&(t[o]=s);}return t}async function fr(e){let t=await ft(e),r=await ur(e),o=r??[];if(r)return G({manifests:t,source:o});let s=[e];for(;s.length>0&&o.length<pr;){let n=s.shift();if(!n)continue;let c=[];try{c=await P.readdir(n,{withFileTypes:true});}catch{continue}let a=[];for(let i of c)if(i.isDirectory()){if(dr.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;a.push(g.join(n,i.name));}else if(i.isFile()&&ut.has(g.extname(i.name))){let l=g.join(n,i.name),u=await P.stat(l).catch(()=>null);if(u){let p=g.relative(e,l).split(g.sep).join("/");o.push(`${p}:${u.size}:${Math.round(u.mtimeMs)}`);}}a.sort((i,l)=>i.localeCompare(l)),s.push(...a);}return o.sort((n,c)=>n.localeCompare(c)),G({manifests:t,source:o})}async function ne(e,t){let r=g.resolve(e),o={},s=[...new Set(t.map(n=>g.relative(r,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c));for(let n of s)o[n]=await fr(g.join(r,n));return o}async function oe(e){let t=g.resolve(e),r={};for(let o of lt){let s=await L(g.join(t,o));s&&(r[o]=s);}return r}async function se(e){let t=g.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>g.relative(t,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c)),o=[];for(let n of r){let c=await ft(g.join(t,n));o.push({project:n,manifests:c});}let s={};for(let n of lt){let c=await L(g.join(t,n));c&&(s[n]=c);}return G({cacheSchema:ve,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:o,workspaceFiles:s})}async function je(e){let t=await d$2(e,we)??a$4(e,we);try{if(!await P.pathExists(t))return null;let r=await P.readJson(t);return !r||r.schemaVersion!==ve||r.producerRevision!==te||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function ae(e,t){let r={schemaVersion:ve,producerRevision:te,...t};return e$1(e,we,r)}var mt="rapidkit-fact-freshness-v1",U={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function mr(e){switch(e){case "durable":return U.durable;case "derived":return U.derived;case "evidence-backed":return U.evidenceBacked;case "live":return U.live;case "verify-before-use":return U.verifyBeforeUse}}function gr(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let r=t+e.ttlSeconds*1e3;return e.now.getTime()>r?"stale":"fresh"}function hr(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),o=Date.parse(r),s=Number.isFinite(o),n=s?r:t.toISOString(),c=e.ttlSeconds===void 0?mr(e.kind):e.ttlSeconds,a=gr({generatedAt:n,ttlSeconds:c,status:e.status??(s?void 0:"unknown"),now:t}),i=Date.parse(n),l=c===null||!Number.isFinite(i)?void 0:new Date(i+c*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||a!=="fresh");return {schemaVersion:mt,kind:e.kind,category:e.category,generatedAt:n,ttlSeconds:c,...l?{expiresAt:l.toISOString()}:{},status:a,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??G(e.value??null),reason:e.reason}}function b(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:hr({...e.freshness,value:e.value})}}function gt(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},o={structure:0,verification:0,state:0},s=0,n=0,c=0,a=0;for(let i of e.facts)r[i.freshness.kind]+=1,o[i.freshness.category]+=1,i.freshness.status==="stale"&&(s+=1),i.freshness.status==="unknown"&&(n+=1),i.freshness.kind==="live"&&(c+=1),i.freshness.verifyBeforeUse&&(a+=1);return {schemaVersion:mt,generatedAt:t,status:s>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:s,unknownFacts:n,liveFacts:c,verifyBeforeUseFacts:a,byKind:r,byCategory:o}}function z(e,t){let r=[...new Set(e)],o=r.filter(s=>t.has(s)).length;return {eligibleCount:r.length,boundCount:o,unknownCount:r.length-o,coverageRatio:r.length===0?null:o/r.length}}function ht(e,t){let r=e.filter(d=>d.kind==="project").map(d=>d.id),o=e.filter(d=>d.kind==="endpoint").map(d=>d.id),s=new Set(o),n=e.filter(d=>d.kind==="api"&&!!d.projectId&&d.attributes.runtimeRegistrationRequired===true).map(d=>d.id),c=new Set(n),a=new Map(e.map(d=>[d.id,d.kind])),i=new Set(t.filter(d=>d.kind==="implements"||d.kind==="defines"&&a.get(d.from)==="file"&&a.get(d.to)==="endpoint").flatMap(d=>s.has(d.from)?[d.from]:s.has(d.to)?[d.to]:[])),l=new Set(t.filter(d=>d.kind==="implements"&&(a.get(d.from)==="runtime-unit"||a.get(d.to)==="runtime-unit")).flatMap(d=>c.has(d.from)?[d.from]:c.has(d.to)?[d.to]:[])),u=new Set(r),p=d=>new Set(t.filter(f=>f.kind===d).flatMap(f=>[f.from,f.to]).filter(f=>u.has(f)));return {apiImplementation:z(o,i),apiRuntimeRegistration:z(n,l),projectTests:z(r,p("tests")),projectDeployment:z(r,p("deploys")),projectOwnership:z(r,p("owns"))}}function kt(e,t){return e.filter(o=>o.code.includes("unknown")||o.code.includes("unresolved")||o.code.includes("limit_reached")||o.code.endsWith(".empty_result")).reduce((o,s)=>o+Math.max(s.entityIds?.length??0,s.relationIds?.length??0,1),0)+Object.values(t).reduce((o,s)=>o+s.unknownCount,0)}function Ce(e,t){return t===0?1:e/t}function kr(e,t,r,o){return e.entityIds?.some(s=>t.has(s))||e.relationIds?.some(s=>r.has(s))?true:e.entityIds?.length||e.relationIds?.length?false:!/\bproject\b/i.test(e.message)||e.message.includes(o)}function yr(e,t,r,o,s){let n=new Set(s.filter(a=>a.provider===e.id).map(a=>a.id)),c=e.inputCoverage?.filter(a=>a.scope==="workspace"||a.scope==="project"&&a.scopeId===t);return {...e,discoveredEntities:r.filter(a=>a.proofIds.some(i=>n.has(i))).length,discoveredRelations:o.filter(a=>a.proofIds.some(i=>n.has(i))).length,proofCount:n.size,...c?{inputCoverage:c}:{}}}function wr(e,t){let r=new Set(e.entities.filter(m=>m.projectId===t).map(m=>m.id)),o=e.relations.filter(m=>r.has(m.from)||r.has(m.to)),s=new Set(r);for(let m of o)s.add(m.from),s.add(m.to);let n=e.entities.filter(m=>s.has(m.id)),c=new Set([...n,...o].flatMap(m=>m.proofIds)),a=e.proofs.filter(m=>c.has(m.id)),i=new Set(o.map(m=>m.id)),l=e.diagnostics.filter(m=>kr(m,s,i,t)),u=e.providers.map(m=>yr(m,t,n,o,a)),p=e.source.inputs?.scopes.filter(m=>m.kind==="workspace"||m.kind==="project"&&m.id===t)??[],d=p.filter(m=>!m.truncated).length,f=u.reduce((m,v)=>(v.status==="failed"?m.failed+=1:v.status==="skipped"||v.inputCoverage?.every(x=>x.status==="not-applicable")?m.notApplicable+=1:v.status==="partial"||v.inputCoverage?.some(x=>x.status==="bounded")?m.bounded+=1:m.complete+=1,m),{complete:0,bounded:0,notApplicable:0,failed:0}),y=ht(n,o);return {...e,entities:n,relations:o,proofs:a,providers:u,quality:{entityCount:n.length,relationCount:o.length,proofCount:a.length,entityProofCoverageRatio:Ce(n.filter(m=>m.proofIds.length>0).length,n.length),relationProofCoverageRatio:Ce(o.filter(m=>m.proofIds.length>0).length,o.length),providerSuccessRatio:Ce(u.filter(m=>m.status!=="failed").length,u.length),conflictCount:l.filter(m=>m.code.includes("conflict")).length,unknownCount:kt(l,y),bindingCoverage:y,...e.quality.completeness?{completeness:{status:p.some(m=>m.truncated)||f.bounded>0||f.failed>0?"bounded":"complete",inventory:{scopeCount:p.length,completeScopes:d,boundedScopes:p.length-d,eligibleFiles:p.reduce((m,v)=>m+(v.eligibleFileCount??v.fileCount),0),indexedFiles:p.reduce((m,v)=>m+v.fileCount,0),eligibleFileCountExact:p.every(m=>m.eligibleFileCountExact!==false)},providers:f}}:{},portable:true,secretValuesEmitted:false},diagnostics:l}}var vr=h.projectKnowledgeGraphReference.schemaVersion;function wt(e,t){let r=wr(e,t),o={schemaVersion:vr,generatedAt:e.generatedAt,project:{name:t},canonical:{graph:"workspace:.workspai/reports/workspace-knowledge-graph.json",boundedQuery:`workspai workspace graph search <task-query> --scope project:${t} --limit 12 --json`,sourceHash:e.source.hash,projectionHash:c$1(r)},summary:{entityCount:r.entities.length,relationCount:r.relations.length,proofCount:r.proofs.length}};return {...o,integrity:{algorithm:"sha256",payloadHash:c$1(o),portable:true,absolutePathsEmitted:false}}}function vt(e,t){return g.resolve(t.absolutePath??g.join(e,t.path))}var br=f.model,ie=e.model;function Pe(e){return e.projectTopology??e.graph}function jt(e){return !!(e.projectTopology&&e.graph&&c$1(e.projectTopology)===c$1(e.graph))}function eo(e){let t=e.engineStatus==="hit"||e.engineStatus==="unchanged"?"reused":e.engineStatus==="incremental"?"partially-reused":"rebuilt";return {schemaVersion:"workspace-model-build.v1",mode:e.mode,outcome:t,engineStatus:e.engineStatus}}var jr=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","terraform.tf"],Cr=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function Ct(e,t){return (g.relative(e,t)||".").split(g.sep).join("/")}async function Pt(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Pr(e,t){for(let r of t)if(await P.pathExists(g.join(e,r)))return true;return false}function Se(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function Sr(e,t){let r=g.resolve(e),o=[{dirPath:r,depth:0}],s=new Set,n=new Set;for(;o.length>0;){let c=o.shift();if(!c)continue;let a=g.resolve(c.dirPath);if(n.has(a))continue;if(n.add(a),a!==r&&await Pr(a,jr)){s.add(a);continue}if(c.depth>=t)continue;let i=[];try{i=await P.readdir(a,{withFileTypes:true});}catch{continue}for(let l of i)!l.isDirectory()||Cr.has(l.name)||a$5(l.name)||l.name.startsWith(".")&&l.name!==".config"||o.push({dirPath:g.join(a,l.name),depth:c.depth+1});}return Array.from(s).sort((c,a)=>c.localeCompare(a))}function Er(e){let t=new Set,r=[];for(let o of e){let s=g.resolve(o);t.has(s)||(t.add(s),r.push(s));}return r.sort((o,s)=>o.localeCompare(s))}function bt(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function Wr(e,t){return e?.[t]===true}function xr(e,t,r){let o=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=bt(o,"generator"),n=bt(o,"command_display"),c=typeof t=="string"&&t.startsWith("frontend.");if(!(!s&&!c))return {...s?{id:s}:{},...t?{kit:t}:{},displayName:r,source:Wr(o,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function Rr(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","product.json","tsconfig.json","pnpm-workspace.yaml","bunfig.toml",".bunfig.toml","nx.json","turbo.json","pyproject.toml","requirements.txt","go.mod","go.work","go.work.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","rust-toolchain.toml","rust-toolchain","CMakeLists.txt","meson.build","Makefile","WORKSPACE","WORKSPACE.bazel","MODULE.bazel","BUILD","BUILD.bazel",".bazelrc","composer.json","Gemfile","mix.exs","deno.json","setup.py","setup.cfg","Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","README.md"],r=[];for(let s of t)await P.pathExists(g.join(e,s))&&r.push(s);let o=new Set(["package.json","pyproject.toml","go.mod","go.work","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","CMakeLists.txt","meson.build","composer.json","Gemfile","mix.exs","deno.json"]);if(!r.some(s=>o.has(s))){let s=[],n=new Set([".git",".workspai",".rapidkit",".venv","build","dist","node_modules","target","third_party","vendor"]),c=(p,d)=>{let f=p.toLowerCase();return ["package.json","pyproject.toml","go.mod","pom.xml","build.gradle","build.gradle.kts","cargo.toml","cmakelists.txt","meson.build","composer.json","gemfile","mix.exs","deno.json"].includes(f)||f.endsWith(".gemspec")||f==="description"&&d.toLowerCase()==="r"},a=async(p,d)=>{if(d>3||s.length>=512)return;let f=await P.readdir(p,{withFileTypes:true}).catch(()=>[]);for(let y of f.sort((m,v)=>m.name.localeCompare(v.name))){if(s.length>=512)return;y.isFile()&&c(y.name,g.basename(p))?s.push(g.relative(e,g.join(p,y.name)).split(g.sep).join("/")):y.isDirectory()&&!n.has(y.name)&&await a(g.join(p,y.name),d+1);}};await a(e,0);let i=new Map;for(let p of s){let d=p.split("/")[0],f=i.get(d)??[];f.push(p),i.set(d,f);}for(let p of i.values())p.sort((d,f)=>d.split("/").length-f.split("/").length||d.localeCompare(f));let l=[],u=[...i.keys()].sort();for(let p=0;l.length<16&&u.some(d=>p<(i.get(d)?.length??0));p+=1)for(let d of u){let f=i.get(d)?.[p];f&&l.length<16&&l.push(f);}r.push(...l.filter(p=>!r.includes(p)));}return r}async function R(e,t,r,o=t){let s=await d$2(e,t),n=s!==null,c={path:o.split(g.sep).join("/"),exists:n};if(s&&r){let a=await Pt(s);typeof a?.generatedAt=="string"&&(c.generatedAt=a.generatedAt);let i=a?.status??a?.result??a?.verdict;typeof i=="string"&&(c.status=i);}return c}async function Ar(e,t,r){let o=Ct(e,t),s=".workspai/reports",n=i=>R(t,`${s}/${i}`,r,`${o}/${s}/${i}`),c=await n("doctor-project-last-run.json");return {doctor:c?.exists===true?c:await n("doctor-last-run.json"),remediationPlan:await n("doctor-remediation-plan-last-run.json"),fixResult:await n("doctor-fix-result-last-run.json"),analyze:await n("analyze-last-run.json"),readiness:await n("release-readiness-last-run.json")}}async function Mr(e,t,r){let o=j$1(t),s=m(t,o),n=z$1(t),c=f$1(s.runtime),a=await b$2(t,o,{runtime:s.runtime,framework:s.key}),i=r.contractProject?.slug?r.contractProject.slug:typeof o?.name=="string"&&o.name.trim()?o.name.trim():g.basename(t),l$1=typeof o?.kit_name=="string"?o.kit_name:typeof o?.kit=="string"?o.kit:r.contractProject?.kit,u=typeof o?.engine=="string"?o.engine:n.engine!=="unknown"?n.engine:void 0,p=xr(o,l$1,s.displayName),d=Qe({kitId:l$1,framework:s.key,runtime:s.runtime}),f=l(t),y=[s.runtime,...f.filter(v=>v!==s.runtime)],m$1=await c$2({projectPath:t,declaration:r.contractProject?.governance});return {name:i,path:Ct(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:a,category:a$3(a),runtime:s.runtime,runtimeCandidates:y,framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:c.tier,runtimeDoctorSupport:c.doctorSupport,moduleSupport:n.moduleSupport,...l$1?{kit:l$1}:{},...u?{engine:u}:{},...p?{generator:p}:{},createCapability:d,commands:{supported:n.supportedCommands,unsupported:n.unsupportedCommands,global:n.globalCommands,fleetStages:n.fleetStages,localOnly:n.localOnlyCommands,map:n.commandMap},importantFiles:await Rr(t),governance:m$1,evidence:await Ar(e,t,r.includeEvidence),provenance:{path:r.contractProject?"workspace contract declaration reconciled with filesystem discovery":"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",createCapability:"create planner capability contract",governance:r.contractProject?.governance!==void 0?"workspace contract declaration reconciled with repository evidence":"repository and documented external governance discovery",evidence:"project .workspai/reports"}}}async function Ir(e){for(let t$1 of t(e,"workspace.json")){let r=await Pt(t$1);if(r)return r}return null}function Fr(e){if(e.length===0)return "empty-workspace";let t=new Set(e.map(r=>r.category));return t.size>1?"polyglot-product-workspace":t.has("frontend")&&e.length>1?"full-stack-workspace":t.has("frontend")?"frontend-workspace":t.has("desktop")?"desktop-application-workspace":t.has("extension")?"extension-workspace":t.has("platform")?"platform-workspace":t.has("library")?"library-workspace":e.length>1?"backend-platform":"backend-workspace"}function Dr(e){let t=new Set;for(let r of e){let o=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])o.includes(s)&&t.add(s);}return Array.from(t).sort()}function C(e,t,r,o){return {severity:e,code:t,message:r,target:o}}function St(e){let t=[];e.workspace.name.trim()||t.push(C("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(C("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(C("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(C("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let r=new Map;for(let n of e.projects){let c=n.name.toLowerCase(),a=r.get(c)??[];a.push(n),r.set(c,a),n.importantFiles.length||t.push(C("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path));let i=g.isAbsolute(n.path)?n.path:g.resolve(e.workspace.root,n.path);P.existsSync(i)||t.push(C("warning","project.path.missing",`Registered project ${n.name} is not available at its declared path.`,n.path)),n.runtime==="unknown"&&t.push(C("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let l=["test","build"];for(let d of l)n.commands.supported.includes(d)&&n.commands.unsupported.includes(d)&&t.push(C("error","project.commands.conflict",`Project ${n.name} marks ${d} as both supported and unsupported.`,n.path));let u=new Set(n.commands.fleetStages),p=new Set(n.commands.localOnly);for(let d of n.commands.fleetStages){p.has(d)&&t.push(C("error","project.commands.scope-conflict",`Project ${n.name} marks ${d} as both fleet and local-only.`,n.path));let f=n.commands.map[d];(!f||f.status!=="supported"||f.fleetEligible!==true||f.executionScope!=="fleet")&&t.push(C("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${d} as a fleet stage without a supported fleet capability.`,n.path));}for(let d of n.commands.localOnly){let f=n.commands.map[d];(!f||f.status!=="supported"||f.executionScope!=="local-only"||f.fleetEligible===true)&&t.push(C("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${d} as local-only without a matching local-only capability.`,n.path));}for(let d of Object.values(n.commands.map))d.status==="supported"&&(d.fleetEligible===true&&!u.has(d.command)&&t.push(C("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${d.command} is fleet-eligible but missing from fleetStages.`,n.path)),d.executionScope==="local-only"&&d.fleetEligible!==true&&!p.has(d.command)&&t.push(C("error","project.commands.local-only-missing",`Project ${n.name} capability ${d.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,c]of r.entries())c.length>1&&t.push(C("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${c.length} project roots.`,c.map(a=>a.path).join(", ")));e.projectTopology&&e.graph&&c$1({...e.projectTopology,generatedAt:"<ignored>"})!==c$1({...e.graph,generatedAt:"<ignored>"})&&t.push(C("error","workspace.project-topology.alias-mismatch","Deprecated model.graph must remain structurally identical to canonical model.projectTopology during the v1 migration window.","projectTopology"));let o=t.filter(n=>n.severity==="error").length,s=t.filter(n=>n.severity==="warning").length;return {status:o>0?"failed":s>0?"warning":"passed",errors:o,warnings:s,issues:t}}function to(e){return St(e)}function j(e){return e.join(".")}function Or(e,t){let r=ie,o=e.generatedAt,s=[b({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),b({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),b({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),b({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),b({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),b({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})],n=Pe(e);n&&s.push(b({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:n.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??o,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),b({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:n.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??o,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[c,a]of e.projects.entries()){let i=`projects[${c}]`,l={kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};s.push(b({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...l,sourcePath:j([i,"kind"])}}),b({id:`project.${a.name}.category`,label:`${a.name} category`,scope:"project",project:a.name,value:a.category,freshness:{...l,sourcePath:j([i,"category"])}}),b({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...l,sourcePath:j([i,"runtime"])}}),b({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...l,sourcePath:j([i,"frameworkDisplayName"])}}),b({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...l,sourcePath:j([i,"supportTier"])}}),b({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...l,sourcePath:j([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}),...["ci","release","ownership"].map(u=>b({id:`project.${a.name}.governance.${u}`,label:`${a.name} ${u} governance`,scope:"policy",project:a.name,value:a.governance?.[u]??{status:"unknown",provider:null,evidence:[],reference:null},freshness:{...l,sourcePath:j([i,"governance",u]),reason:"Governance truth is reconciled from repository surfaces and explicit workspace contract declarations."}})));for(let[u,p]of Object.entries(a.evidence))s.push(b({id:`project.${a.name}.evidence.${u}`,label:`${a.name} ${u} evidence`,scope:"evidence",project:a.name,value:p?{path:p.path,exists:p.exists,status:p.status??null}:{exists:false},freshness:{kind:p?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:p?.generatedAt??o,now:t,status:p?.exists?void 0:"unknown",sourceArtifact:p?.path??r,sourcePath:j([i,"evidence",u]),verifyBeforeUse:true,reason:p?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[c,a]of Object.entries(e.evidence))s.push(b({id:`workspace.evidence.${c}`,label:`Workspace ${c} evidence`,scope:"evidence",value:a?{path:a.path,exists:a.exists,status:a.status??null}:null,freshness:{kind:a?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:a?.generatedAt??o,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:j(["evidence",c]),verifyBeforeUse:true,reason:a?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return s}async function Ee(e,t){let[r,o,s,n,c,a$3]=await Promise.all([a(e),Ir(e),We(e),a$1(e),a$2(e,{descendIntoMatchedProjects:false}),Sr(e,t)]),i=new Map;for(let u of s?.projects??[]){let p=u.externalPath?g.resolve(e,u.externalPath):g.resolve(e,u.relativePath);i.set(p,u);}let l=Er([...c,...a$3,...i.keys(),...n.map(u=>g.isAbsolute(u.path)?u.path:g.join(e,u.path))]);return {marker:r,workspaceJson:o,workspaceContract:s,contractProjectPaths:i,projectPaths:l}}async function ce(e$1){let t$1=g.resolve(e$1.workspacePath),r=e$1.includeAbsolutePaths===true,o=e$1.includeEvidence===true,s=Se(e$1.observableScanDepth),n=e$1.now??new Date,{marker:c,workspaceJson:a,workspaceContract:i$1,contractProjectPaths:l,projectPaths:u}=await Ee(t$1,s),p=e$1.reuseProjectModels,d=await Promise.all(u.map(k=>{if(p){let xt=g.relative(t$1,g.resolve(k)).split(g.sep).join("/"),xe=p.get(xt);if(xe)return Promise.resolve(xe)}return Mr(t$1,k,{includeAbsolutePaths:r,includeEvidence:o,contractProject:l.get(g.resolve(k))})})),f=typeof a?.workspace_name=="string"?a.workspace_name:typeof a?.name=="string"?a.name:c?.name||i$1?.workspace.name||g.basename(t$1),y=typeof a?.profile=="string"?a.profile:typeof a?.mode=="string"?a.mode:i$1?.workspace.profile,m=Array.from(new Set(d.map(k=>k.kind))).sort(),v=Array.from(new Set(d.map(k=>k.category))).sort(),x=Array.from(new Set(d.flatMap(k=>k.runtimeCandidates.length>0?k.runtimeCandidates:[k.runtime]))).sort(),q=Array.from(new Set(d.map(k=>k.framework))).sort(),_=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(k=>P.existsSync(g.join(t$1,k))),J=t(t$1,"workspace.contract.json").map(k=>g.relative(t$1,k).split(g.sep).join("/")).find(k=>P.existsSync(g.join(t$1,k)))??i.workspaceContract,D=await P.pathExists(g.join(t$1,J)),X={schemaVersion:br,generatedAt:n.toISOString(),workspace:{name:f,root:t$1,...y?{profile:y}:{},type:c?"rapidkit-workspace":"observed-workspace",...c?{marker:{createdBy:c.createdBy,version:c.version,createdAt:c.createdAt}}:{}},identity:{workspaceType:Fr(d),surfaces:m,categories:v,runtimeFamilies:x,businessCapabilities:Dr(d)},discovery:{observableScanDepth:s},projects:d,policies:{mode:typeof a?.policy_mode=="string"?a.policy_mode:typeof a?.policyMode=="string"?a.policyMode:"warn",source:_??null,exists:!!_},contracts:{workspaceContractPath:J,exists:D,status:D?"known":"missing"},evidence:{doctor:await R(t$1,e.doctor,o),projectDoctor:await R(t$1,i.doctorProject,o),doctorRemediationPlan:await R(t$1,i.doctorRemediationPlan,o),artifactRemediationPlan:await R(t$1,i.artifactRemediationPlan,o),doctorFixResult:await R(t$1,i.doctorFixResult,o),analyze:await R(t$1,e.analyze,o),readiness:await R(t$1,e.readiness,o),pipeline:await R(t$1,i.pipelineLastRun,o)},summary:{projectCount:d.length,runtimes:x,frameworks:q,firstClassProjects:d.filter(k=>k.supportTier==="first-class").length,extendedProjects:d.filter(k=>k.supportTier==="extended").length,observedProjects:d.filter(k=>k.supportTier==="observed").length}},S=await Et(t$1,X,{contractExists:D,now:n,incrementalGraph:e$1.incrementalGraph}),E={...X,projectTopology:S,graph:S},O=St(E),T=Or({...E},n),Wt=gt({facts:T,generatedAt:n.toISOString(),now:n});return {...E,facts:T,factFreshness:Wt,validation:O}}async function ro(e){if(e.cache!==true)return {model:await ce(e),cache:"disabled"};let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),{marker:s,workspaceJson:n,projectPaths:c}=await Ee(t,r),a=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:c,workspaceJson:n,marker:s}),i=await je(t);if(i&&i.cliVersion===o&&i.inputsHash===a&&jt(i.model))return {model:i.model,cache:"hit"};let l=await ce({...e}),[u,p]=await Promise.all([ne(t,c),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:a,generatedAt:(e.now??new Date).toISOString(),model:l,projectSignatures:u,workspaceFileSignatures:p}),{model:l,cache:"miss"}}function Gr(e,t){let r=new Set,o=new Set,s=new Set;for(let[n,c]of Object.entries(t))n in e?e[n]!==c&&r.add(n):o.add(n);for(let n of Object.keys(e))n in t||s.add(n);return {changed:r,added:o,removed:s}}function _r(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])return false;return true}async function no(e){let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),s=e.now??new Date,{marker:n,workspaceJson:c,projectPaths:a}=await Ee(t,r),i=await je(t),l=async()=>{let S=await ce({...e}),E=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n}),[O,T]=await Promise.all([ne(t,a),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:E,generatedAt:s.toISOString(),model:S,projectSignatures:O,workspaceFileSignatures:T}),{model:S,mode:"full"}},u=i?Pe(i.model):void 0;if(!i||i.cliVersion!==o||!i.projectSignatures||!u||!jt(i.model))return l();let p=await oe(t);if(!_r(i.workspaceFileSignatures,p))return l();let d=await ne(t,a),{changed:f,added:y,removed:m}=Gr(i.projectSignatures,d);if(f.size===0&&y.size===0&&m.size===0)return {model:i.model,mode:"unchanged"};let v=new Set([...f,...y]),x=new Map;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");!v.has(E)&&!m.has(E)&&x.set(E,S);}let q=new Set,_=false;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");f.has(E)&&q.add(S.name);}let J=y.size>0||m.size>0,D=await ce({...e,reuseProjectModels:x,incrementalGraph:{previousGraph:u,changedProjectIds:q,structuralChange:J||_}});for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");if(!f.has(E))continue;let O=D.projects.find(T=>T.path.split(g.sep).join("/")===E);if(O&&O.name!==S.name){_=true;break}}if(_)return l();let X=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n});return await ae(t,{cliVersion:o,inputsHash:X,generatedAt:s.toISOString(),model:D,projectSignatures:d,workspaceFileSignatures:p}),{model:D,mode:"incremental"}}async function We(e){try{let{contract:t}=await p({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Et(e,t,r){let o=r.contractExists?await We(e):null;try{return r.incrementalGraph?await pt({workspacePath:e,model:t,contract:o,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await dt({workspacePath:e,model:t,contract:o,now:r.now})}catch{let s=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:s,edges:[],stats:{nodeCount:s.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:s.length,connectedNodeCount:0,density:0,edgeCoverageRatio:s.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:s.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:s.map(n=>n.id).sort((n,c)=>n.localeCompare(c))}]:void 0}}}async function oo(e$1,t,r={}){let o=e$1.contracts.exists?await We(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-V2EAYDCL.js'),n=d(e$1),c=r.refreshKnowledgeGraph?null:await P.readJson(g.join(t,e.knowledgeGraph)).then(p=>p).catch(()=>null),a=await s({workspacePath:t,workspace:{name:e$1.workspace.name,...e$1.workspace.profile?{profile:e$1.workspace.profile}:{}},projects:e$1.projects.map(p=>({id:p.name,path:p.path,...p.absolutePath?{absolutePath:p.absolutePath}:{},runtime:p.runtime,runtimeCandidates:p.runtimeCandidates,framework:p.framework,kind:p.kind,category:p.category,...p.governance?{governance:p.governance}:{},...p.kit?{kit:p.kit}:{}})),projectTopology:Pe(e$1)??await Et(t,e$1,{contractExists:e$1.contracts.exists,now:new Date(e$1.generatedAt)}),contract:o,now:new Date(e$1.generatedAt),source:{kind:"workspace-model",artifact:ie,hashAlgorithm:"sha256",hash:d$1(n)},previousGraph:c}),i$1=[],l=new Map;for(let p of e$1.projects){let d=vt(t,p);if(!(await P.stat(d).catch(()=>null))?.isDirectory())continue;let y=await P.realpath(d),m=l.get(y);if(m)throw new Error(`Projects ${m} and ${p.name} resolve to the same graph artifact root: ${d}`);l.set(y,p.name),i$1.push({rootPath:d,relativePath:i.projectKnowledgeGraphReference,payload:wt(a,p.name)});}let u=await g$1(t,ie,[{rootPath:t,relativePath:e.knowledgeGraph,payload:a},{rootPath:t,relativePath:ie,payload:n},...i$1]);for(let p of i$1){let d=g.join(p.rootPath,e.knowledgeGraph);(await P.readJson(d).catch(()=>null))?.schemaVersion===f.knowledgeGraph&&await P.remove(d).catch(()=>{});}return u[1]}export{Qe as a,$r as b,Lr as c,G as d,mt as e,b as f,gt as g,ht as h,kt as i,wr as j,br as k,ie as l,Pe as m,eo as n,to as o,Or as p,ce as q,ro as r,no as s,oo as t};
|