workspai 0.45.0 → 0.47.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 +307 -532
- package/contracts/agent-customization-pack.v1.json +6 -1
- package/contracts/bootstrap-compliance.v1.json +14 -0
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +8 -0
- package/contracts/extension-cli-compatibility.v1.json +9 -2
- package/contracts/mirror-ops.v1.json +16 -0
- package/contracts/published-contract-catalog.v1.json +38 -1
- package/contracts/runtime-command-surface.v1.json +190 -7
- package/contracts/transparency-evidence.v1.json +13 -0
- package/contracts/workspace-archive-capabilities.v1.json +17 -6
- package/contracts/workspace-contract.v1.json +78 -0
- package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +4 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +20 -0
- package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +72 -0
- package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +212 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +200 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +260 -0
- package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +60 -0
- package/contracts/workspace-intelligence-architecture.v1.json +7 -4
- package/contracts/workspace-intelligence-chain.v1.json +51 -4
- package/contracts/workspace-share-bundle.v1.json +16 -0
- package/dist/analyze-UVXPRGYZ.js +1 -0
- package/dist/artifact-remediation-plan-EPALZ2LC.js +3 -0
- package/dist/autopilot-release-5BQ6F5L2.js +1 -0
- package/dist/chunk-22NJ2ZMG.js +2 -0
- package/dist/{chunk-XIVFLY6G.js → chunk-2GHUZDYA.js} +1 -1
- package/dist/chunk-2TEDAKP6.js +2 -0
- package/dist/chunk-52PBRX7F.js +1 -0
- package/dist/chunk-6SWRNA47.js +4 -0
- package/dist/chunk-76YOPAOT.js +1 -0
- package/dist/chunk-7VLCK5JW.js +1 -0
- package/dist/{chunk-DXPU4DDV.js → chunk-BSRVO52Y.js} +92 -78
- package/dist/chunk-COARSXRC.js +1 -0
- package/dist/chunk-CV5HKU4P.js +1 -0
- package/dist/chunk-CW7PGBIQ.js +13 -0
- package/dist/{chunk-KU4S7RCM.js → chunk-DV6GJD4K.js} +1 -1
- package/dist/chunk-EYJ2CQSK.js +1 -0
- package/dist/chunk-FB7SCXAZ.js +1 -0
- package/dist/chunk-FPJNWPKU.js +1 -0
- package/dist/{chunk-JP25YL3J.js → chunk-FTY7GGXJ.js} +2 -2
- package/dist/chunk-FXQJX34Z.js +1 -0
- package/dist/{chunk-J4AICQFB.js → chunk-HSGFUKCN.js} +1 -1
- package/dist/{chunk-OOOPYUL2.js → chunk-ITCAMC2E.js} +1 -1
- package/dist/chunk-KB44JP4M.js +2 -0
- package/dist/{chunk-WANW4QA4.js → chunk-KZZ36CK5.js} +1 -1
- package/dist/chunk-LNRAB7UY.js +1 -0
- package/dist/chunk-MEMHNE7Y.js +80 -0
- package/dist/chunk-MER6ZBN2.js +13 -0
- package/dist/chunk-NOFM7MNA.js +2 -0
- package/dist/chunk-NRYS4CLR.js +2 -0
- package/dist/chunk-OA537ZQ5.js +1 -0
- package/dist/chunk-PBHP6JNY.js +8 -0
- package/dist/chunk-QDWYIRHR.js +8 -0
- package/dist/chunk-RWRLFSKW.js +2 -0
- package/dist/chunk-SK6XRKGG.js +1 -0
- package/dist/chunk-THIOE2PB.js +2 -0
- package/dist/chunk-TNQI5VCW.js +36 -0
- package/dist/chunk-TWNFECMN.js +2 -0
- package/dist/{chunk-2QOWRBQD.js → chunk-U5EZHZBX.js} +1 -1
- package/dist/{chunk-K63BSU56.js → chunk-VBSQ7MF6.js} +62 -51
- package/dist/chunk-WDKNMTJQ.js +1 -0
- package/dist/chunk-YCL3I2JO.js +2 -0
- package/dist/chunk-ZDN7RHXJ.js +1 -0
- package/dist/chunk-ZM5NQ5Z2.js +1 -0
- package/dist/{create-KFR6FLRT.js → create-7JKJDAQV.js} +1 -1
- package/dist/doctor-PGPNIS76.js +1 -0
- package/dist/{dotnet-webapi-clean-BYUUHX5Y.js → dotnet-webapi-clean-6TVFBTVI.js} +20 -20
- package/dist/{gofiber-standard-B6UK5GR7.js → gofiber-standard-2BL7GWZB.js} +1 -1
- package/dist/{gogin-standard-BXU44VEM.js → gogin-standard-XGP3KBXA.js} +1 -1
- package/dist/index.d.ts +112 -16
- package/dist/index.js +198 -195
- package/dist/pipeline-IB6ILJSV.js +5 -0
- package/dist/{platform-capabilities-YICBF4FA.js → platform-capabilities-2B4QMZXE.js} +1 -1
- package/dist/{pythonRapidkitExec-UJYIB6FL.js → pythonRapidkitExec-CVCIK225.js} +1 -1
- package/dist/{springboot-standard-PEHDKH2L.js → springboot-standard-JJNUID6M.js} +6 -6
- package/dist/workspace-H3QXBFGB.js +1 -0
- package/dist/{workspace-agent-sync-G5YVI3BJ.js → workspace-agent-sync-C7SG2Z5W.js} +1 -1
- package/dist/workspace-archive-P76EDIUG.js +10 -0
- package/dist/{workspace-context-E3UFWL5X.js → workspace-context-BKQBKA4C.js} +1 -1
- package/dist/workspace-contract-RPQQBQXR.js +1 -0
- package/dist/workspace-dependency-graph-23BI2HG7.js +1 -0
- package/dist/workspace-explain-WVN7JH3U.js +1 -0
- package/dist/workspace-explain-contract-SEFTVF6J.js +1 -0
- package/dist/{workspace-feedback-YY6WQPWQ.js → workspace-feedback-WAID3IOE.js} +1 -1
- package/dist/{workspace-foundation-3C2DLCVI.js → workspace-foundation-5OOJEO2D.js} +1 -1
- package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +1 -0
- package/dist/{workspace-history-VF3CHDYQ.js → workspace-history-C6OP3IAQ.js} +1 -1
- package/dist/workspace-intelligence-VKDL3H2J.js +1 -0
- package/dist/workspace-intelligence-runner-LVALAZY7.js +1 -0
- package/dist/workspace-knowledge-graph-FE2NTZKV.js +1 -0
- package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +1 -0
- package/dist/workspace-knowledge-graph-query-VOSPPH4W.js +1 -0
- package/dist/workspace-mcp-serve-KT2I676Z.js +3 -0
- package/dist/workspace-model-S33CIB2R.js +1 -0
- package/dist/workspace-model-hash-MHXK5MEI.js +1 -0
- package/dist/workspace-python-engine-state-2MLKJYQG.js +2 -0
- package/dist/workspace-registry-summary-A3YDL63D.js +1 -0
- package/dist/workspace-run-M4LNJILC.js +1 -0
- package/dist/{workspace-verify-ZNT6JX7D.js → workspace-verify-ZGH3NXAH.js} +1 -1
- package/dist/workspace-watch-EVBJTMV7.js +1 -0
- package/docs/AI_DYNAMIC_INTEGRATION.md +73 -432
- package/docs/AI_EXAMPLES.md +37 -395
- package/docs/AI_FEATURES.md +76 -465
- package/docs/AI_QUICKSTART.md +49 -209
- package/docs/DEVELOPMENT.md +5 -5
- package/docs/From Code to Shared Understanding.png +0 -0
- package/docs/GLOSSARY.md +60 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +91 -9
- package/docs/OPTIMIZATION_GUIDE.md +19 -51
- package/docs/PACKAGE_MANAGER_POLICY.md +4 -1
- package/docs/README.md +91 -42
- package/docs/SECURITY.md +13 -6
- package/docs/SETUP.md +6 -3
- package/docs/UTILITIES.md +8 -20
- package/docs/WORKSPACE_MARKER_SPEC.md +27 -20
- package/docs/ci-workflows.md +19 -5
- package/docs/commands-reference.md +88 -13
- package/docs/config-file-guide.md +67 -246
- package/docs/contracts/ARTIFACT_CATALOG.md +78 -36
- package/docs/contracts/CLI_LOG_EVENT_STREAM.md +1 -1
- package/docs/contracts/README.md +48 -9
- package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +4 -4
- package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +14 -10
- package/docs/creating-workspaces-and-projects.md +649 -0
- package/docs/doctor-command.md +5 -4
- package/docs/examples/ci-agent-grounding.yml +16 -10
- package/docs/from-code-to-shared-understanding.md +69 -38
- package/docs/graph-benchmark-methodology.md +121 -0
- package/docs/workspace-intelligence-runner.md +186 -0
- package/docs/workspace-knowledge-graph.md +295 -0
- package/docs/workspace-operations.md +78 -11
- package/docs/workspace-run.md +4 -1
- package/package.json +10 -8
- package/rapidkit.config.example.cjs +5 -5
- package/scripts/enforce-package-manager.cjs +1 -1
- package/scripts/prepack-enterprise.mjs +4 -0
- package/workspai.config.example.cjs +12 -47
- package/dist/analyze-YLV7NVLF.js +0 -1
- package/dist/artifact-remediation-plan-WLZGROUU.js +0 -3
- package/dist/autopilot-release-YBN3SWAA.js +0 -1
- package/dist/chunk-2K3GYCPS.js +0 -1
- package/dist/chunk-42G2OK64.js +0 -1
- package/dist/chunk-5AKYMAIL.js +0 -1
- package/dist/chunk-5GNT4RJI.js +0 -8
- package/dist/chunk-5PVEQ6CZ.js +0 -13
- package/dist/chunk-6AA3WWQZ.js +0 -2
- package/dist/chunk-6ZENXBMG.js +0 -33
- package/dist/chunk-7RIWU5TZ.js +0 -1
- package/dist/chunk-7UZVOYF5.js +0 -2
- package/dist/chunk-BJLE5CH7.js +0 -4
- package/dist/chunk-G3H5R3RR.js +0 -1
- package/dist/chunk-HYJK7W3B.js +0 -1
- package/dist/chunk-IMUU5Q2V.js +0 -13
- package/dist/chunk-KPPGZCUW.js +0 -78
- package/dist/chunk-LCRROMRR.js +0 -2
- package/dist/chunk-LG6RFLPZ.js +0 -1
- package/dist/chunk-P424XYHP.js +0 -1
- package/dist/chunk-P7SCWJFG.js +0 -8
- package/dist/chunk-QWU2CZBG.js +0 -2
- package/dist/chunk-V2H2KRMZ.js +0 -1
- package/dist/chunk-XZGVNGRB.js +0 -1
- package/dist/chunk-ZWO6K24C.js +0 -2
- package/dist/doctor-YJDM5XBH.js +0 -1
- package/dist/imported-projects-registry-FOIE27WT.js +0 -1
- package/dist/pipeline-FEDYO3IA.js +0 -5
- package/dist/workspace-PLXOO6ST.js +0 -1
- package/dist/workspace-archive-EEGLHZDW.js +0 -10
- package/dist/workspace-contract-LQJDZV36.js +0 -1
- package/dist/workspace-explain-G74ZIF23.js +0 -1
- package/dist/workspace-explain-contract-KT757JGQ.js +0 -1
- package/dist/workspace-intelligence-3GG7GEDQ.js +0 -1
- package/dist/workspace-mcp-serve-MJMUV4RY.js +0 -3
- package/dist/workspace-model-NG45SRM5.js +0 -1
- package/dist/workspace-python-engine-state-MTWIIZPY.js +0 -2
- package/dist/workspace-registry-summary-JM2XY52C.js +0 -1
- package/dist/workspace-run-WEQYIERE.js +0 -1
- package/dist/workspace-watch-W47T4RX2.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {a as a$3}from'./chunk-PBHP6JNY.js';import {c}from'./chunk-QDWYIRHR.js';import {q}from'./chunk-MEMHNE7Y.js';import {d as d$1}from'./chunk-VBSQ7MF6.js';import {c as c$1}from'./chunk-FPJNWPKU.js';import {a as a$4}from'./chunk-6SWRNA47.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {d,a as a$2,e as e$1}from'./chunk-2TEDAKP6.js';import {a as a$1}from'./chunk-LNRAB7UY.js';import c$2 from'chalk';import p from'path';function G(a){return a===0?"pass":a===2?"warn":"fail"}function I(a){return a.some(r=>r.status==="fail")?"blocked":a.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(a,r){if(r)return 3;let i=a.some(o=>o.status==="fail"),t=a.some(o=>o.status==="warn");return i?1:t?2:0}function N(a,r){return a===2&&!r?0:a}async function O(a){let r=await d$1(a,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-RPQQBQXR.js');await t({workspacePath:a}),i=true;}catch{i=false;}return {sync:r,contractSynced:i}}async function V(a$5={}){let r=p.resolve(a$5.workspacePath??process.cwd()),i=a(r);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t=[],o=[],l=false,d$1,f$1,m,y=Date.now();try{let{sync:e,contractSynced:s}=await O(i),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:n,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${s?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||o.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),o.push("workspace sync stage failed");}let w=Date.now();try{let e=await q({workspace:true,json:true,quiet:true,strict:a$5.strict===true,ci:a$5.strict!==true}),s=G(e),n=await d(i,a$1.doctor)??a$2(i,a$1.doctor);t.push({name:"doctor",status:s,durationMs:Date.now()-w,summary:s==="pass"?"doctor workspace passed":s==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:n}),s==="fail"?o.push("doctor workspace gate failed"):s==="warn"&&o.push("doctor workspace reported warnings");}catch(e){l=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),o.push("doctor workspace stage failed");}if(a$5.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let s=await a$3({workspacePath:i,json:true,strict:a$5.strict===true});d$1=p.isAbsolute(s.enterpriseControls.evidencePath)?s.enterpriseControls.evidencePath:p.join(i,s.enterpriseControls.evidencePath);let n=s.summary.verdict==="blocked"?"fail":s.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${s.summary.verdict} (score ${s.summary.score}/100)`,evidencePath:d$1}),n==="fail"?o.push("analyze reported blocked verdict"):n==="warn"&&o.push("analyze reported needs-attention verdict");}catch(s){l=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${s instanceof Error?s.message:String(s)}`}),o.push("analyze stage failed");}}let h=Date.now();try{let e=await a$4({startPath:i,writeReport:true,skipVerify:a$5.skipVerify===true});f$1=e.evidencePath;let s=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:s,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),s==="fail"?o.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):s==="warn"&&o.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),o.push("readiness stage failed");}if(a$5.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),s=a$5.autopilotMode??"audit";try{let n=await c({workspacePath:i,mode:s,json:true,skipPipelineStages:true});m=n.artifacts.reportPath;let P=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${s}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:m}),P!=="pass"&&o.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),o.push("autopilot release stage failed");}}let M=I(t),k=j(t,l),F=p.join(i,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:M,exitCode:k,stagesPassed:t.filter(e=>e.status==="pass").length,stagesWarn:t.filter(e=>e.status==="warn").length,stagesFailed:t.filter(e=>e.status==="fail").length},stages:t,blockingReasons:[...new Set(o)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$1,autopilotEvidencePath:m}};if(a$5.writeReport!==false){let e$2=f(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e()});await e$1(i,".workspai/reports/pipeline-last-run.json",e$2);}if(a$5.writeReport!==false&&a$5.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&a$5.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-C7SG2Z5W.js'),s=await e({workspacePath:i,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:s.indexPath,writtenFiles:s.writtenFiles,blockers:s.blockers};}catch{}return u}async function ae(a){let r;try{r=await V(a);}catch(t){let o=t instanceof Error?t.message:String(t);a.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:o}),null,2)):console.log(c$2.red(`Pipeline failed: ${o}`)),process.exit(1);}if(a.json)console.log(JSON.stringify(r,null,2));else {console.log(c$2.bold.cyan(`
|
|
2
|
+
\u{1F517} Workspai Governance Pipeline
|
|
3
|
+
`)),console.log(c$2.bold(`Workspace: ${c$2.cyan(p.basename(r.workspacePath))}`)),console.log(c$2.gray(`Path: ${r.workspacePath}`)),console.log(c$2.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let o=t.status==="pass"?c$2.green("PASS"):t.status==="warn"?c$2.yellow("WARN"):t.status==="skipped"?c$2.gray("SKIP"):c$2.red("FAIL");console.log(` - ${t.name}: ${o} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$2.bold(`
|
|
4
|
+
Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
|
|
5
|
+
Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$2.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}let i=N(r.summary.exitCode,a.strict===true);i!==0&&process.exit(i);}export{N as pipelineProcessExitCode,V as runPipeline,ae as runPipelineCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as augmentPathWithNodeBin,g as buildPackageRunnerSubprocessEnv,a as detectPlatformKind,h as getDefaultPythonCommand,q as getLegacyWorkspaceRegistryDirectory,i as getPythonCommandCandidates,j as getPythonVersionProbeCandidates,o as getRapidkitLocalScriptCandidates,s as getUserLocalBinCandidates,n as getVenvActivateScriptPath,k as getVenvBinDirectory,l as getVenvPythonPath,m as getVenvRapidkitPath,p as getWorkspaceRegistryDirectory,r as getWorkspaceRegistryFileCandidates,b as isWindowsPlatform,d as resolvePackageRunnerExecutable,e as resolvePackageRunnerInvocation,c as shouldUseShellExecution}from'./chunk-
|
|
1
|
+
export{f as augmentPathWithNodeBin,g as buildPackageRunnerSubprocessEnv,a as detectPlatformKind,h as getDefaultPythonCommand,q as getLegacyWorkspaceRegistryDirectory,i as getPythonCommandCandidates,j as getPythonVersionProbeCandidates,o as getRapidkitLocalScriptCandidates,s as getUserLocalBinCandidates,n as getVenvActivateScriptPath,k as getVenvBinDirectory,l as getVenvPythonPath,m as getVenvRapidkitPath,p as getWorkspaceRegistryDirectory,r as getWorkspaceRegistryFileCandidates,b as isWindowsPlatform,d as resolvePackageRunnerExecutable,e as resolvePackageRunnerInvocation,c as shouldUseShellExecution}from'./chunk-EYJ2CQSK.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-
|
|
1
|
+
export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-FTY7GGXJ.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import g from'path';import i from'chalk';import
|
|
1
|
+
import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import g from'path';import i from'chalk';import R from'ora';import {execa}from'execa';var x="21",j="3.5.0",M="2.8.9";function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function h(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function E(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function T(e,t){let s=f(e)||"com.workspai.apps",p=f(t)||"service";return `${s}.${p}`}function A(e){return e.replace(/\./g,"/")}function P(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function C(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"workspai",workspai_version:t,rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function D(e){return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
4
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
@@ -344,7 +344,7 @@ management:
|
|
|
344
344
|
SPRING_PROFILES_ACTIVE=local
|
|
345
345
|
API_BASE_PATH=/api/v1
|
|
346
346
|
JAVA_OPTS=-Xms256m -Xmx512m
|
|
347
|
-
`}function H(){return `FROM maven:3.9.9-eclipse-temurin
|
|
347
|
+
`}function H(e){return `FROM maven:3.9.9-eclipse-temurin-${e.java_version} AS build
|
|
348
348
|
WORKDIR /workspace
|
|
349
349
|
|
|
350
350
|
COPY pom.xml ./
|
|
@@ -353,12 +353,12 @@ RUN mvn -B -q -DskipTests dependency:go-offline
|
|
|
353
353
|
COPY src ./src
|
|
354
354
|
RUN mvn -B -DskipTests package
|
|
355
355
|
|
|
356
|
-
FROM eclipse-temurin
|
|
356
|
+
FROM eclipse-temurin:${e.java_version}-jre
|
|
357
357
|
WORKDIR /app
|
|
358
358
|
|
|
359
359
|
COPY --from=build /workspace/target/*.jar /app/app.jar
|
|
360
360
|
|
|
361
|
-
EXPOSE
|
|
361
|
+
EXPOSE ${e.port}
|
|
362
362
|
ENV JAVA_OPTS=""
|
|
363
363
|
|
|
364
364
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
|
@@ -368,7 +368,7 @@ ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
|
|
368
368
|
context: .
|
|
369
369
|
dockerfile: Dockerfile
|
|
370
370
|
ports:
|
|
371
|
-
- "${e.port}
|
|
371
|
+
- "${e.port}:${e.port}"
|
|
372
372
|
env_file:
|
|
373
373
|
- .env
|
|
374
374
|
environment:
|
|
@@ -689,7 +689,7 @@ class ServiceRuntimeE2ETest {
|
|
|
689
689
|
}
|
|
690
690
|
`}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",r={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=c(),l=`${b(r.project_name)}Application`,o=A(r.package_name);try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i.yellow(`
|
|
691
691
|
\u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(i.gray(` Install: https://maven.apache.org/install.html
|
|
692
|
-
`));}let c$2
|
|
692
|
+
`));}let c$2=R(`Generating Spring Boot project: ${r.project_name}...`).start();try{let n=(d,v)=>c$1(g.join(e,d),v),$=g.join(e,"rapidkit"),y=g.join(e,"rapidkit.cmd");if(await Promise.all([n("pom.xml",D(r)),n(".gitignore",Y()),n(".editorconfig",X()),n(".env.example",U(r)),n(".dockerignore",z()),n("Dockerfile",H(r)),n("docker-compose.yml",F(r)),n(".github/workflows/ci.yml",K(r)),n("README.md",Q(r)),n("src/main/resources/application.yml",J(r)),n("src/test/resources/application.yml",G()),n(`src/main/java/${o}/${l}.java`,B(r,l)),n(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(r)),n(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(r)),n(`src/main/java/${o}/application/SystemInfoService.java`,q(r)),n(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(r)),n(`src/main/java/${o}/api/http/SystemInfoController.java`,N(r)),n(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(r)),n(`src/test/java/${o}/${l}Tests.java`,ne(r,l)),n(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(r)),n(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(r)),n("scripts/perf-smoke.sh",Z(r)),n(".workspai/project.json",C(r,b$2)),n(".workspai/context.json",P()),n("rapidkit",ee(r)),n("rapidkit.cmd",te())]),await promises.chmod($,493),await promises.chmod(y,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),r.skipInstall||await oe(e)||console.log(i.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$2.succeed(i.green(`Project created at ${e}`)),r.skipInstall)c$2.info(i.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$2.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$2.succeed(i.gray("\u2713 maven dependency warm-up completed"));}catch{c$2.warn(i.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!r.skipGit)try{await b$1(e)?console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i.green(`
|
|
693
693
|
\u2728 Spring Boot project created successfully!
|
|
694
694
|
`)),console.log(i.cyan("\u{1F4C2} Location:"),i.white(e)),console.log(i.cyan(`
|
|
695
695
|
\u{1F680} Get started:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{h as createProject,g as createWorkspace,j as createWorkspaceShareBundle,i as listWorkspaces,a as normalizeWorkspaceEntry,f as registerProjectInWorkspace,e as registerProjectInWorkspaceStrict,c as registerWorkspace,b as registerWorkspaceStrict,d as syncWorkspaceProjects}from'./chunk-VBSQ7MF6.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-
|
|
1
|
+
export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-TNQI5VCW.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-2GHUZDYA.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {e,c,b as b$1,d}from'./chunk-52PBRX7F.js';import {a}from'./chunk-KB44JP4M.js';import {f as f$1,o,l,r}from'./chunk-5XATWNME.js';import z from'crypto';import Z from'os';import f from'path';import {once}from'events';import {createWriteStream,createReadStream}from'fs';import*as X from'readline';import {Transform,Readable}from'stream';import {pipeline}from'stream/promises';import {lookup}from'dns/promises';import N from'net';import h from'fs-extra';import*as q from'yauzl';import*as Y from'yazl';var P=".workspai/archive-manifest.json",S=".rapidkit/archive-manifest.json",he="workspai.workspace.archive",fe=300*1e3,le=5*1024*1024*1024,pe=20*1024*1024*1024,j=2e5,me=5*1024*1024*1024,ue=1e3,O=5,de=64*1024*1024;function ve(r){let t=r.toLowerCase().split("%")[0];if(N.isIPv4(t)){let e=t.split(".").map(Number);return e[0]===0||e[0]===10||e[0]===127||e[0]===169&&e[1]===254||e[0]===172&&e[1]>=16&&e[1]<=31||e[0]===192&&e[1]===168||e[0]===100&&e[1]>=64&&e[1]<=127||e[0]>=224}return N.isIPv6(t)?t==="::"||t==="::1"||t.startsWith("fc")||t.startsWith("fd")||/^fe[89ab]/.test(t)||t.startsWith("ff")||t.startsWith("::ffff:127.")||t.startsWith("::ffff:10.")||t.startsWith("::ffff:192.168."):true}async function K(r,t){let e=new URL(r);if(e.protocol!=="https:"&&e.protocol!=="http:")throw new Error(`Workspace archive URL protocol is not supported: ${e.protocol}`);if(e.protocol!=="https:"&&!t)throw new Error("Remote workspace archives require HTTPS unless private-network access is explicitly enabled.");if(e.username||e.password)throw new Error("Workspace archive URL must not contain embedded credentials.");if(t)return e;let a=e.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(a==="localhost"||a.endsWith(".localhost"))throw new Error("Workspace archive URL resolves to a private or local network address.");let i=N.isIP(a)?[{address:a}]:await lookup(a,{all:true,verbatim:true});if(i.length===0||i.some(({address:s})=>ve(s)))throw new Error("Workspace archive URL resolves to a private or local network address.");return e}async function we(r,t,e){let a=await K(r,e);for(let i=0;i<=O;i+=1){let s=await fetch(a,{signal:t,redirect:"manual",credentials:"omit"});if(![301,302,303,307,308].includes(s.status))return s;let n=s.headers.get("location");if(await s.body?.cancel(),!n)throw new Error("Workspace archive redirect is missing a Location header.");if(i===O)throw new Error(`Workspace archive download exceeded ${O} redirects.`);a=await K(new URL(n,a).href,e);}throw new Error("Workspace archive redirect policy failed.")}var ye=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),ge=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log"]),Ee=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function R(r){return r.replace(/\\/g,"/")}function G(r){return r.trim().replace(/\.workspai-archive\.zip$/i,"").replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function Q(r){let t=R(r).trim();if(!t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0"))return false;let e=t.split("/").filter(Boolean);return e.length>0&&!e.some(a=>a===".."||a===".")}function ee(r){if(!Q(r))throw new Error(`Archive contains an unsafe path: ${r}`)}function Ae(r,t){let e=f.relative(t,r);return e===""||!!e&&!e.startsWith("..")&&!f.isAbsolute(e)}function ke(r,t){let a=R(r).split("/").filter(Boolean);if((a[0]===".workspai"||a[0]===".rapidkit")&&["cache","reports"].includes(a[1]||"")||a.some(s=>ye.has(s)))return true;let i=a[a.length-1]||"";return ge.has(i)||/\.(?:workspai|rapidkit)-archive\.zip$/i.test(i)||!t?.includeEnv&&Ee.some(s=>s.test(i))?true:i.endsWith(".pyc")||i.endsWith(".log")}async function*te(r,t,e){let a=(await h.readdir(t,{withFileTypes:true})).sort((i,s)=>i.name.localeCompare(s.name));for(let i of a){let s=f.join(t,i.name),n=R(f.relative(r,s));if(!(!n||ke(n,e))){if(i.isDirectory()){yield*te(r,s,e);continue}i.isFile()&&(yield {relativePath:n,fullPath:s});}}}async function Pe(r){for(let t of o(r,"workspace.json"))try{let e=await h.readJson(t);if(typeof e.workspace_name=="string"&&e.workspace_name.trim())return e.workspace_name.trim();if(typeof e.name=="string"&&e.name.trim())return e.name.trim()}catch{}return f.basename(f.resolve(r))}async function We(r){let t=await h.stat(r.fullPath),e=z.createHash("sha256"),a=0;for await(let s of createReadStream(r.fullPath)){let n=Buffer.isBuffer(s)?s:Buffer.from(s);a+=n.length,e.update(n);}let i=await h.stat(r.fullPath);if(t.size!==i.size||t.mtimeMs!==i.mtimeMs||a!==i.size)throw new Error(`Workspace file changed while preparing archive: ${r.relativePath}`);return {...r,size:a,mtimeMs:i.mtimeMs,sha256:e.digest("hex")}}async function k(r,t){r.write(t)||await once(r,"drain");}async function re(r){await new Promise((t,e)=>{r.once("error",e),r.end(t);});}async function*b(r){let t=X.createInterface({input:createReadStream(r),crlfDelay:1/0});for await(let e of t){let a=e.trim();a&&(yield JSON.parse(a));}}async function Se(r){let t=createWriteStream(r.manifestPath,{flags:"wx"});try{await k(t,`{
|
|
2
|
+
`);for(let[a,i]of Object.entries(r.manifestBase))await k(t,` ${JSON.stringify(a)}: ${JSON.stringify(i,null,2)},
|
|
3
|
+
`);await k(t,` "files": [
|
|
4
|
+
`);let e=true;for await(let a of b(r.spoolPath)){let{mtimeMs:i,...s}=a;await k(t,`${e?"":`,
|
|
5
|
+
`} ${JSON.stringify(s)}`),e=false;}await k(t,`
|
|
6
|
+
]
|
|
7
|
+
}
|
|
8
|
+
`),await re(t);}catch(e){throw t.destroy(),await h.remove(r.manifestPath).catch(()=>{}),e}}async function Re(r,t){let e=[];for await(let a of b(t)){let{mtimeMs:i,...s}=a;e.push(s);}return {...r,files:e}}async function _e(r,t){try{await h.rename(r,t);}catch(e){let a=e.code;if(a!=="EEXIST"&&a!=="EPERM")throw e;await h.move(r,t,{overwrite:true});}}async function Ge(r){let t=f.resolve(r.workspacePath);if(!f$1(t))throw new Error("Workspace export requires a Workspai workspace root with .workspai-workspace or a legacy .rapidkit-workspace marker.");let e=await Pe(t),a=f.resolve(r.outputPath||`${G(e)}.workspai-archive.zip`),i={schemaVersion:b$1,version:1,kind:he,workspaceName:e,exportedAt:(r.now??new Date).toISOString(),exportedBy:"workspai",archiveFormat:r.compression==="deflate"?"zip-deflate":"zip-store",containerFormat:"zip64",compression:r.compression==="deflate"?"deflate":"store",streaming:true,security:{envFilesIncluded:r.includeEnv===true,excludedByDefault:[".git","node_modules",".venv","dist","build","target",".env","*.pem","*.key","*.log"]}},s=f.resolve(a);await h.ensureDir(f.dirname(a));let n=`${a}.${process.pid}.${z.randomUUID()}.tmp`,o=await h.mkdtemp(f.join(Z.tmpdir(),"workspai-archive-export-")),p=f.join(o,"manifest-files.jsonl"),l=f.join(o,"archive-manifest.json"),u=new Y.ZipFile,y=r.now??new Date,c$1=r.compression==="deflate";try{let m=createWriteStream(p,{flags:"wx"});try{for await(let d of te(t,t,{includeEnv:r.includeEnv===true})){if(f.resolve(d.fullPath)===s)continue;let v=await We(d),E={path:v.relativePath,size:v.size,sha256:v.sha256,mtimeMs:v.mtimeMs};await k(m,`${JSON.stringify(E)}
|
|
9
|
+
`);}await re(m);}catch(d){throw m.destroy(),d}await Se({manifestBase:i,spoolPath:p,manifestPath:l});for await(let d of b(p)){let v=f.join(t,...d.path.split("/"));u.addFile(v,d.path,{compress:c$1,forceZip64Format:d.size>=4294967295,mtime:y});}u.addFile(l,P,{compress:c$1,mtime:y}),u.end({forceZip64Format:true,comment:""}),await pipeline(u.outputStream,createWriteStream(n,{flags:"wx"}));for await(let d of b(p)){let v=f.join(t,...d.path.split("/")),E=await h.stat(v);if(E.size!==d.size||E.mtimeMs!==d.mtimeMs)throw new Error(`Workspace file changed while writing archive: ${d.path}`)}let g=await h.stat(n);await _e(n,a);let w=await Re(i,p);return _({schemaVersion:c,operation:"export",status:"passed",archivePath:a,manifest:w,bytesWritten:g.size})}finally{await h.remove(o).catch(()=>{}),await h.remove(n).catch(()=>{});}}async function ae(r,t={}){if(/^https?:\/\//i.test(r)){let e=await h.mkdtemp(f.join(Z.tmpdir(),"workspai-workspace-archive-")),a=f.join(e,"workspace.workspai-archive.zip"),i=new AbortController,s=t.downloadTimeoutMs??fe,n=s>0?setTimeout(()=>i.abort(new Error("Download timed out")),s):null;try{let o=await we(r,i.signal,t.allowPrivateNetwork===true);if(!o.ok)throw new Error(`Failed to download workspace archive: HTTP ${o.status}`);if(!o.body)throw new Error("Failed to download workspace archive: response body is empty.");let p=t.maxDownloadBytes??le,l=Number(o.headers.get("content-length"));if(Number.isFinite(l)&&l>p)throw new Error(`Workspace archive download exceeds configured limit (${l} > ${p} bytes).`);let u=0,y=new Transform({transform(m,g,w){if(u+=m.length,u>p){w(new Error(`Workspace archive download exceeds configured limit (${p} bytes).`));return}w(null,m);}}),c=Readable.fromWeb(o.body);return await pipeline(c,y,createWriteStream(a,{flags:"wx"})),{archivePath:a,cleanup:e}}catch(o){throw await h.remove(e).catch(()=>{}),i.signal.aborted?new Error(`Workspace archive download timed out after ${s}ms.`,{cause:o}):o}finally{n&&clearTimeout(n);}}return {archivePath:f.resolve(r)}}function be(r){return new Promise((t,e)=>{q.open(r,{autoClose:false,lazyEntries:true,decodeStrings:true,validateEntrySizes:true,strictFileNames:true},(a,i)=>{a||!i?e(a??new Error("Failed to open workspace archive.")):t(i);});})}function ze(r){return new Promise((t,e)=>{let a=[],i=s=>e(s);r.once("error",i),r.on("entry",s=>{try{if(ee(s.fileName),s.isEncrypted())throw new Error(`Encrypted workspace archive entries are not supported: ${s.fileName}`);s.fileName.endsWith("/")||a.push({name:s.fileName,size:s.uncompressedSize,compressedSize:s.compressedSize,crc32:s.crc32,entry:s}),r.readEntry();}catch(n){e(n);}}),r.once("end",()=>{r.removeListener("error",i),t(a);}),r.readEntry();})}function M(r,t){return new Promise((e,a)=>{r.openReadStream(t,(i,s)=>{i||!s?a(i??new Error(`Failed to read ${t.fileName}.`)):e(s);});})}async function xe(r,t,e=de){if(t.size>e)throw new Error(`Workspace archive manifest exceeds ${e} bytes.`);let a=[],i=0,s=await M(r,t.entry);for await(let n of s){let o=Buffer.isBuffer(n)?n:Buffer.from(n);if(i+=o.length,i>e)throw s.destroy(),new Error(`Workspace archive manifest exceeds ${e} bytes.`);a.push(o);}return Buffer.concat(a,i)}function Oe(r){let t=JSON.parse(r.toString("utf-8"));a(t,d,"Workspace archive manifest");let e=new Set;for(let a of t.files){if(!Q(a.path)||R(a.path)!==a.path)throw new Error(`Workspace archive manifest contains an unsafe path: ${a.path}`);if(a.path===P||a.path===S)throw new Error(`Workspace archive manifest cannot inventory itself: ${a.path}`);if(e.has(a.path))throw new Error(`Workspace archive manifest contains duplicate path: ${a.path}`);e.add(a.path);}return t}function _(r){return a(r,e,"Workspace archive operation result"),r}function Ne(r$1){return r(R(r$1))}function Ce(r){let t=new Map;for(let e of r){if(e.name===P||e.name===S)continue;let a=Ne(e.name),i=t.get(a);if(!i){t.set(a,{...e,sourceName:e.name,targetName:a});continue}let s=e.name===a,n=i.sourceName===i.targetName;if(s&&!n){t.set(a,{...e,sourceName:e.name,targetName:a});continue}if(!(i.size===e.size&&i.crc32===e.crc32)&&!n)throw new Error(`Workspace archive contains conflicting entries for ${a}: ${i.sourceName}, ${e.name}`)}return [...t.values()].sort((e,a)=>e.targetName.localeCompare(a.targetName))}async function $(r,t={}){let e=await ae(r,t),a;try{a=await be(e.archivePath);let i=await ze(a);if(i.length>j)throw new Error(`Workspace archive contains too many entries (${i.length} > ${j}).`);for(let l of i){if(l.size>me)throw new Error(`Workspace archive entry is too large: ${l.name}`);if(l.size/Math.max(1,l.compressedSize)>ue)throw new Error(`Workspace archive entry has an unsafe compression ratio: ${l.name}`)}let s=i.reduce((l,u)=>l+u.size,0),n=t.maxExpandedBytes??pe;if(s>n)throw new Error(`Workspace archive payload exceeds configured limit (${s} > ${n} bytes).`);let o=i.find(l=>l.name===P||l.name===S);if(!o)throw new Error(`Workspace archive is missing ${l("","archive-manifest.json").replace(/^\//,"")}.`);let p=Oe(await xe(a,o));return {archivePath:e.archivePath,entries:i,manifest:p,zipFile:a,cleanup:e.cleanup}}catch(i){throw a?.close(),e.cleanup&&await h.remove(e.cleanup).catch(()=>{}),i}}async function T(r){r.zipFile?.close(),r.cleanup&&await h.remove(r.cleanup).catch(()=>{});}async function Me(r){let t=await $(r.archivePathOrUrl,r.safety);try{let e=new Map(t.entries.filter(i=>i.name!==P&&i.name!==S).map(i=>[i.name,i])),a=t.manifest.files.map(i=>({path:i.path,size:e.get(i.path)?.size??i.size,hasChecksum:typeof i.sha256=="string"&&i.sha256.length>0}));return _({schemaVersion:c,operation:"inspect",status:"passed",archivePath:t.archivePath,manifest:t.manifest,fileCount:a.length,totalBytes:a.reduce((i,s)=>i+s.size,0),entries:a})}finally{await T(t);}}async function ie(r){let t=await $(r.archivePathOrUrl,r.safety);try{let e=new Map(t.entries.filter(c=>c.name!==P&&c.name!==S).map(c=>[c.name,c])),a=new Set(t.manifest.files.map(c=>c.path)),i=[...e.keys()].filter(c=>!a.has(c)).sort(),s=[],n=[],o=[],p=0;for(let c of t.manifest.files){ee(c.path);let m=e.get(c.path);if(!m){s.push(c.path);continue}let g=z.createHash("sha256"),w=0,d=await M(t.zipFile,m.entry);for await(let E of d){let I=Buffer.isBuffer(E)?E:Buffer.from(E);w+=I.length,g.update(I);}let v={size:w,sha256:g.digest("hex")};if(w!==m.size||w!==c.size){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:v});continue}if(!c.sha256){n.push(c.path);continue}if(v.sha256!==c.sha256){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:v});continue}p+=1;}let l=r.requireChecksums===true&&n.length>0,u=s.length>0||o.length>0||l||i.length>0,y=n.length>0;return _({schemaVersion:c,operation:"verify",archivePath:t.archivePath,manifest:t.manifest,status:u?"failed":y?"warning":"passed",fileCount:t.manifest.files.length,totalBytes:t.manifest.files.reduce((c,m)=>c+m.size,0),verifiedFiles:p,missingChecksumFiles:n,missingArchiveEntries:s,extraArchiveEntries:i,mismatches:o})}finally{await T(t);}}async function Qe(r){let t=await ae(r.archivePathOrUrl,r.safety);try{return await $e({archivePath:t.archivePath,strict:r.strict})}finally{t.cleanup&&await h.remove(t.cleanup).catch(()=>{});}}async function $e(r){let t=await Me({archivePathOrUrl:r.archivePath}),e=await ie({archivePathOrUrl:r.archivePath,requireChecksums:r.strict===true}),a=[],i=[];a.push({id:"manifest-present",status:"passed",message:`Archive manifest found for workspace "${t.manifest.workspaceName}".`}),a.push({id:"integrity",status:e.status,message:e.status==="passed"?`Verified ${e.verifiedFiles}/${e.fileCount} files.`:"Archive integrity verification did not fully pass."});let s=t.manifest.security?.envFilesIncluded===true;a.push({id:"secrets-policy",status:s?"warning":"passed",message:s?"Archive manifest says environment/private files were intentionally included.":"Archive manifest excludes environment/private files by default."}),s&&i.push("Share this archive only through trusted internal channels."),e.missingChecksumFiles.length>0&&i.push("Re-export the archive with the latest RapidKit/Workspai tooling."),e.mismatches.length>0&&i.push("Reject this archive and request a fresh export from the owner."),(e.extraArchiveEntries.length>0||e.missingArchiveEntries.length>0)&&i.push("Regenerate the archive so ZIP entries and manifest entries match."),r.strict===true&&e.status!=="passed"&&i.push("Do not hydrate this archive in strict or production workflows.");let n=a.some(p=>p.status==="failed"),o=a.some(p=>p.status==="warning");return _({schemaVersion:c,operation:"doctor",archivePath:t.archivePath,status:n?"failed":o?"warning":"passed",workspaceName:t.manifest.workspaceName,fileCount:t.fileCount,totalBytes:t.totalBytes,checks:a,recommendedActions:i})}async function Te(r,t){let e=await h.lstat(r).catch(i=>{if(i.code==="ENOENT")return null;throw i});if(!e)return false;if(e.isSymbolicLink())throw new Error(`Output directory must not be a symbolic link: ${r}`);if(!e.isDirectory())throw new Error(`Output path is not a directory: ${r}`);if((await h.readdir(r)).length>0&&!t)throw new Error(`Output directory is not empty: ${r}. Use --force to overwrite.`);return true}async function et(r){let t=await $(r.archivePathOrUrl,r.safety);try{let e=await ie({archivePathOrUrl:t.archivePath,requireChecksums:r.strict===true});if(e.status==="failed"){let o=[e.missingArchiveEntries.length?`missing entries: ${e.missingArchiveEntries.join(", ")}`:"",e.extraArchiveEntries.length?`unexpected entries: ${e.extraArchiveEntries.join(", ")}`:"",e.mismatches.length?`checksum/size mismatches: ${e.mismatches.map(p=>p.path).join(", ")}`:"",e.missingChecksumFiles.length&&r.strict===true?`missing checksums: ${e.missingChecksumFiles.join(", ")}`:""].filter(Boolean).join("; ");throw new Error(`Workspace archive verification failed${o?` (${o})`:""}.`)}if(e.status==="warning"&&r.strict===true)throw new Error(`Workspace archive verification requires checksums for every file: ${e.missingChecksumFiles.join(", ")}`);let a=Ce(t.entries),i=t.manifest,s=f.resolve(r.outputPath||G(i.workspaceName||"imported-workspace")),n=await Te(s,r.force===true);if(!r.dryRun){let o=f.dirname(s),p=`${process.pid}-${z.randomUUID()}`,l=f.join(o,`.${f.basename(s)}.hydrate-${p}.tmp`),u=f.join(o,`.${f.basename(s)}.hydrate-${p}.backup`),y=false,c=false;await h.ensureDir(o);try{await h.ensureDir(l);for(let m of a){let g=f.resolve(l,m.targetName);if(!Ae(g,l))throw new Error(`Archive entry escapes output directory: ${m.targetName}`);await h.ensureDir(f.dirname(g));let w=await M(t.zipFile,m.entry);await pipeline(w,createWriteStream(g,{flags:"wx"}));}n&&(await h.rename(s,u),y=true),await h.rename(l,s),c=true,y&&await h.remove(u).catch(()=>{});}catch(m){throw y&&!await h.pathExists(s)&&await h.rename(u,s).catch(()=>{}),m}finally{await h.remove(l).catch(()=>{}),c&&await h.remove(u).catch(()=>{});}}return _({schemaVersion:c,operation:"hydrate",status:"passed",archivePath:t.archivePath,outputPath:s,dryRun:r.dryRun===true,manifest:i,files:a.map(o=>({path:o.targetName,size:o.size}))})}finally{await T(t);}}
|
|
10
|
+
export{he as WORKSPACE_ARCHIVE_KIND,P as WORKSPACE_ARCHIVE_MANIFEST_PATH,K as assertSafeRemoteArchiveUrl,Qe as doctorWorkspaceArchive,Ge as exportWorkspaceArchive,et as hydrateWorkspaceArchive,Me as inspectWorkspaceArchive,ve as isPrivateAddress,Q as isSafeArchiveEntryName,G as sanitizeWorkspaceArchiveName,ke as shouldExcludeWorkspaceArchivePath,ie as verifyWorkspaceArchive};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-
|
|
1
|
+
export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-NRYS4CLR.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{d as WORKSPACE_CONTRACT_PATH,f as WORKSPACE_CONTRACT_SCHEMA_VERSION,e as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,g as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,h as WorkspaceContractVerificationError,j as buildWorkspaceContract,n as buildWorkspaceContractGraph,i as discoverProjectJsonFiles,m as readWorkspaceContract,l as syncWorkspaceContract,o as verifyWorkspaceContract,k as writeWorkspaceContract,p as writeWorkspaceContractVerifyEvidence}from'./chunk-22NJ2ZMG.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as WORKSPACE_GRAPH_OVERRIDES_PATH,d as graphHasCycle,e as hashDependencyGraph,f as inferWorkspaceDependencyGraph,g as inferWorkspaceDependencyGraphIncremental}from'./chunk-COARSXRC.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-CW7PGBIQ.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-NOFM7MNA.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-HSGFUKCN.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-76YOPAOT.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-BSRVO52Y.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-A3YDL63D.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_GRAPH_TOKEN_EFFICIENCY_SCHEMA_VERSION,b as buildWorkspaceGraphTokenEfficiencyReport}from'./chunk-CV5HKU4P.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-
|
|
1
|
+
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-76YOPAOT.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,o as buildWorkspaceImpact,j as buildWorkspaceModelSnapshot,l as diffWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,n as workspaceVerificationPlan,p as writeWorkspaceImpact,m as writeWorkspaceModelDiff,k as writeWorkspaceModelSnapshot}from'./chunk-NOFM7MNA.js';export{d as hashWorkspaceModel}from'./chunk-OA537ZQ5.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1,c}from'./chunk-CW7PGBIQ.js';import {a as a$2}from'./chunk-PBHP6JNY.js';import {q}from'./chunk-MEMHNE7Y.js';import {d}from'./chunk-VBSQ7MF6.js';import {a as a$3}from'./chunk-6SWRNA47.js';import {k as k$2}from'./chunk-TNQI5VCW.js';import {a as a$1,e as e$2,f as f$1}from'./chunk-NRYS4CLR.js';import {f,g,h as h$1}from'./chunk-ZM5NQ5Z2.js';import {j,k as k$1,l as l$1,m,o,p}from'./chunk-NOFM7MNA.js';import {k,n}from'./chunk-ZDN7RHXJ.js';import {j as j$1,e as e$1}from'./chunk-76YOPAOT.js';import {l,o as o$1,p as p$1}from'./chunk-22NJ2ZMG.js';import {e}from'./chunk-2TEDAKP6.js';import {b as b$2}from'./chunk-YCL3I2JO.js';import {a,b,h,i,g as g$1,f as f$2}from'./chunk-LNRAB7UY.js';import se from'path';import ce from'fs-extra';function r(a,t){if(!a)throw new Error(`Workspace Intelligence run semantic violation: ${t}`)}function ee(a,t){return a.length===t.length&&a.every((d,l)=>d===t[l])}function te(a$2){b$2(a.intelligenceRun,a$2,"Workspace Intelligence run report"),r(a$2.chainSchemaVersion===a$1,`chainSchemaVersion must be ${a$1}`),r(a$2.artifactPath===a.intelligenceRun,`artifactPath must be ${a.intelligenceRun}`),r(a$2.preflight.length===g$1.length,`preflight must contain exactly ${g$1.length} entries`);for(let[o,i]of g$1.entries()){let s=a$2.preflight[o];r(s?.id===i,`preflight[${o}].id must be ${i}`),r(ee(s.artifacts,h[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(s.status==="passed"&&s.result==="synchronized"||s.status==="failed"&&s.result==="failed","sync preflight status and result are incoherent"):r(s.status==="passed"&&(s.result==="created"||s.result==="reused")||s.status==="failed"&&s.result==="failed"||s.status==="skipped"&&s.result==="skipped","baseline preflight status and result are incoherent");}let t=a$2.preflight[1];r(a$2.baselineCreated===(t?.result==="created"),"baselineCreated must match the baseline preflight result"),r(a$2.stages.length===f$2.length,`stages must contain exactly ${f$2.length} canonical steps`);let d=a$2.preflight[0],l=d?.status==="failed";for(let[o,i$1]of f$2.entries()){let s=a$2.stages[o];r(s?.id===i$1,`stages[${o}].id must be ${i$1}`),r(ee(s.artifacts,i[i$1].produces),`${i$1} artifacts must match the runtime registry`),l&&r(s.status==="skipped",`${i$1} must be skipped after a hard failure`),s.status==="passed"?r(s.exitCode===0,`${i$1} passed stage must have exitCode 0`):s.status==="blocked"?r(s.exitCode!==0,`${i$1} blocked stage must have a non-zero exitCode`):s.status==="failed"?(r(s.exitCode===1,`${i$1} failed stage must have exitCode 1`),l=true):(r(s.exitCode===0,`${i$1} skipped stage must have exitCode 0`),r(s.durationMs===0,`${i$1} skipped stage must have durationMs 0`)),o===0&&((d?.status==="failed"||s.status==="failed")&&r(t?.status==="skipped","baseline must be skipped when sync or model fails"),t?.status==="skipped"&&r(d?.status==="failed"||s.status==="failed"||s.status==="skipped","baseline may be skipped only after an upstream failure"),t?.status!=="passed"&&(l=true));}let m=a$2.preflight.some(o=>o.status==="failed")||a$2.stages.some(o=>o.status==="failed"),E=a$2.stages.some(o=>o.status==="blocked"),n=m?"failed":E?"blocked":"passed",u=n==="failed"?1:n==="blocked"?2:0;r(a$2.status===n,`status must be ${n}`),r(a$2.exitCode===u,`exitCode must be ${u}`);}var le=a.intelligenceRun,de=b.intelligenceRun,ae=le;async function $e(a$4){let t=se.resolve(a$4.workspacePath),d$1=[],l$2=[],m$1=false,E=async(e,p)=>{let f=[...h[e]];if(m$1){d$1.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:f,message:"skipped because a required upstream operation failed"});return}let k=Date.now();try{let c=await p();d$1.push({id:e,status:"passed",result:c.result,durationMs:Date.now()-k,artifacts:f,message:c.message});}catch(c){m$1=true,d$1.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-k,artifacts:f,message:c instanceof Error?c.message:String(c)});}},n$1=async(e,p)=>{let f=[...i[e].produces];if(m$1){l$2.push({id:e,status:"skipped",durationMs:0,artifacts:f,exitCode:0,message:"skipped because a required upstream stage failed"});return}let k=Date.now();try{let c=await p(),b=c.exitCode??0;l$2.push({id:e,status:c.blocked||b!==0?"blocked":"passed",durationMs:Date.now()-k,artifacts:f,exitCode:b,message:c.message});}catch(c){m$1=true,l$2.push({id:e,status:"failed",durationMs:Date.now()-k,artifacts:f,exitCode:1,message:c instanceof Error?c.message:String(c)});}};await E("sync",async()=>{let e=await d(t,true),p=await l({workspacePath:t});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${p.contract.projects.length} projects`}});let u,o$2=()=>{if(!u)throw new Error("canonical workspace model is unavailable");return u};await n$1("model",async()=>(u=await k({workspacePath:t,includeEvidence:true}),await n(u,t),{message:`${u.summary.projectCount} projects modeled`}));let i$1=se.join(t,a.snapshot),s=false;await E("baseline",async()=>{if(!await ce.pathExists(i$1)){let e=await j({workspacePath:t,model:o$2()});return await k$1(e,t),s=true,{result:"created",message:"initial structural baseline created"}}return {result:"reused",message:"existing structural baseline reused"}}),await n$1("diff",async()=>{let e=await l$1({workspacePath:t,fromPath:a.snapshot,model:o$2()});return await m(e,t),{message:e.summary.changed?"workspace changes detected":"no workspace changes"}}),await n$1("impact",async()=>{let e=await o({workspacePath:t,fromPath:a.diff});return await p(e,t),{message:`${e.summary.risk} risk; ${e.summary.affectedProjects} affected`}}),await n$1("doctor-evidence",async()=>{let e=await q({workspace:t,json:true,quiet:true});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await n$1("contract-evidence",async()=>{let e=await o$1({workspacePath:t,strict:true});return await p$1({workspacePath:t,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await n$1("analyze-evidence",async()=>{let e=await a$2({workspacePath:t,json:true,strict:false});return {blocked:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||a$4.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await n$1("readiness-evidence",async()=>{let e=await a$3({startPath:t,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||a$4.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await n$1("verify",async()=>{let e=await f({workspacePath:t,fromImpactPath:a.impact});await g(e,t);let p=h$1(e,{strict:a$4.strict===true});return await j$1(t,e$1(e,p.passed)),{blocked:!p.passed,exitCode:p.exitCode,message:`${e.summary.verdict}; gate ${p.passed?"passed":"blocked"}`}}),await n$1("context",async()=>{u=await k({workspacePath:t,includeEvidence:true});let e=await e$2({workspacePath:t,model:u,agent:a$4.agent??"generic",includeEvidence:true});return await f$1(e,t),{message:`context grounded for ${e.agent}`}}),await n$1("agent-sync",async()=>({message:`${(await k$2({workspacePath:t,agent:a$4.agent??"generic",write:true,refreshContext:false,strict:false,preset:"enterprise"})).writtenFiles.length} grounding files written`})),await n$1("explain",async()=>{let e=await b$1({workspacePath:t,target:{kind:"release-blocked"}});return await c(e,t),{message:e.summary}});let re=l$2.some(e=>e.status==="blocked"),W=m$1?"failed":re?"blocked":"passed",ie=m$1?1:W==="blocked"?2:0,R={schemaVersion:de,chainSchemaVersion:a$1,generatedAt:new Date().toISOString(),workspacePath:t,baselineCreated:s,preflight:d$1,status:W,exitCode:ie,stages:l$2,artifactPath:ae};return te(R),await e(t,ae,R),R}export{le as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,de as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,$e as runWorkspaceIntelligenceChain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,c as assertWorkspaceKnowledgeGraphSourceBinding,d as buildWorkspaceKnowledgeGraph,e as knowledgeEntityId}from'./chunk-RWRLFSKW.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-FB7SCXAZ.js';import {createHash}from'crypto';function f(n){return Array.isArray(n)?`[${n.map(f).join(",")}]`:n&&typeof n=="object"?`{${Object.entries(n).sort(([r],[d])=>r.localeCompare(d)).map(([r,d])=>`${JSON.stringify(r)}:${f(d)}`).join(",")}}`:JSON.stringify(n)}function y(n){return createHash("sha256").update(f({entities:n.entities,relations:n.relations,proofs:n.proofs.map(({observedAt:r,freshness:d,...t})=>t)})).digest("hex")}function A(n,r){return [...new Set([...Object.keys(n),...Object.keys(r)])].filter(d=>f(n[d])!==f(r[d])).sort()}function h(n,r){let d=new Map(n.map(a=>[a.id,a])),t=new Map(r.map(a=>[a.id,a])),s=r.filter(a=>!d.has(a.id)),o=n.filter(a=>!t.has(a.id)),g=[];for(let[a,i]of d){let c=t.get(a);if(!c)continue;let p=A(i,c);p.length>0&&g.push({id:a,before:i,after:c,changedFields:p});}return {added:[...s].sort((a,i)=>a.id.localeCompare(i.id)),removed:[...o].sort((a,i)=>a.id.localeCompare(i.id)),changed:g.sort((a,i)=>a.id.localeCompare(i.id))}}function K(n){return {...n,observedAt:"1970-01-01T00:00:00.000Z",freshness:"fresh"}}function C(n,r){let d=h(n.map(K),r.map(K)),t=new Map(n.map(o=>[o.id,o])),s=new Map(r.map(o=>[o.id,o]));return {added:d.added.map(o=>s.get(o.id)??o),removed:d.removed.map(o=>t.get(o.id)??o),changed:d.changed.map(o=>({id:o.id,before:t.get(o.id),after:s.get(o.id),changedFields:o.changedFields}))}}function W(n,r){let d=new Set(r);return n.proofs.filter(t=>d.has(t.id)).map(t=>t.artifact)}function O(n,r,d=new Date){let t=h(n.entities,r.entities),s=h(n.relations,r.relations),o=C(n.proofs,r.proofs),g=new Set([...t.added.map(e=>e.id),...t.removed.map(e=>e.id),...t.changed.map(e=>e.id)]),a$1=[...s.added,...s.removed,...s.changed.flatMap(e=>[e.before,e.after].filter(Boolean))];for(let e of a$1)g.add(e.from),g.add(e.to);let i=new Set(g);for(let e of [...n.relations,...r.relations])(g.has(e.from)||g.has(e.to))&&(i.add(e.from),i.add(e.to));let c=new Set([...o.added.map(e=>e.id),...o.removed.map(e=>e.id),...o.changed.map(e=>e.id)]);for(let e of [...t.added,...t.removed])e.proofIds.forEach(l=>c.add(l));for(let e of t.changed)e.before?.proofIds.forEach(l=>c.add(l)),e.after?.proofIds.forEach(l=>c.add(l));for(let e of a$1)e.proofIds.forEach(l=>c.add(l));let p=[...new Set([...W(n,c),...W(r,c),...o.added.map(e=>e.artifact),...o.removed.map(e=>e.artifact),...o.changed.flatMap(e=>[e.before?.artifact,e.after?.artifact])])].filter(e=>!!e).sort(),m=t.removed.length+s.removed.length+o.removed.length,w=m+t.added.length+t.changed.length+s.added.length+s.changed.length+o.added.length+o.removed.length+o.changed.length,u=w===0?"none":m>0||i.size>=10?"high":i.size>=5||w>=5?"medium":"low";return {schemaVersion:a,generatedAt:d.toISOString(),workspace:r.workspace,base:{schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,fingerprint:y(n)},head:{schemaVersion:r.schemaVersion,generatedAt:r.generatedAt,fingerprint:y(r)},entities:t,relations:s,proofs:o,impactedEntityIds:[...i].sort(),changedArtifacts:p,summary:{entityAdds:t.added.length,entityRemovals:t.removed.length,entityChanges:t.changed.length,relationAdds:s.added.length,relationRemovals:s.removed.length,relationChanges:s.changed.length,proofAdds:o.added.length,proofRemovals:o.removed.length,proofChanges:o.changed.length,impactedEntities:i.size,changedArtifacts:p.length,risk:u}}}export{O as buildWorkspaceKnowledgeGraphChangeOverlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_KNOWLEDGE_SEARCH_SCHEMA_VERSION,e as queryKnowledgeEntities,c as queryKnowledgeEvidence,d as queryKnowledgePath,b as resolveKnowledgeTarget,f as searchKnowledgeGraph}from'./chunk-WDKNMTJQ.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b}from'./chunk-CW7PGBIQ.js';import {d,c as c$2,f,e as e$1}from'./chunk-WDKNMTJQ.js';import {c as c$1,e}from'./chunk-HSGFUKCN.js';import {c as c$4,b as b$1}from'./chunk-2GHUZDYA.js';import {d as d$2}from'./chunk-NRYS4CLR.js';import {d as d$3}from'./chunk-ZM5NQ5Z2.js';import {h}from'./chunk-ZDN7RHXJ.js';import {c as c$3}from'./chunk-RWRLFSKW.js';import {e as e$2}from'./chunk-22NJ2ZMG.js';import {d as d$1}from'./chunk-2TEDAKP6.js';import {a as a$2}from'./chunk-KB44JP4M.js';import {a as a$1,c}from'./chunk-LNRAB7UY.js';import {r}from'./chunk-5XATWNME.js';import u from'path';import N from'readline';import g from'fs-extra';var q=a$1.agentIndex,L=new Map(Object.keys(a$1).flatMap(e=>{let t=c[e];return t?[[a$1[e],t]]:[]}));function M(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var J=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceKnowledgeGraph",description:"Read the current proof-backed workspace knowledge graph artifact",inputSchema:{type:"object",properties:{}}},{name:"queryWorkspaceEntities",description:"List workspace knowledge entities, optionally filtered by kind",inputSchema:{type:"object",properties:{kind:{type:"string",description:"Optional entity kind"}}}},{name:"searchWorkspaceGraph",description:"Return bounded, proof-carrying workspace context matching a text query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text, path, symbol, service, or concept to find"},kind:{type:"string",description:"Optional entity kind filter"},limit:{type:"integer",minimum:1,maximum:100,default:12}},required:["query"]}},{name:"getWorkspaceGraphEvidence",description:"Resolve portable evidence for a knowledge graph entity or relation",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]}},{name:"findWorkspaceGraphPath",description:"Find a shortest proof-carrying path between two workspace entities",inputSchema:{type:"object",properties:{from:{type:"string"},to:{type:"string"}},required:["from","to"]}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function H(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!u.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function a(e,t){if(!H(t))throw new Error(`Unsafe artifact path: ${t}`);let r$1=await d$1(e,t)??u.join(e,t);if(!await g.pathExists(r$1))return null;let n=await g.readJson(r$1),o=r(t),c=L.get(o);if(c&&a$2(n,c,`MCP artifact ${o}`),o===a$1.knowledgeGraph){let p=u.join(e,h);if(!await g.pathExists(p))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let l=await g.readJson(p);c$3(n,l);}return n}async function F(e$1){let t=[],r=new Set,o=((await a(e$1,d$3))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$3,reasons:o});for(let i of o)r.add(i);}let c=await a(e$1,c$4);if(e(c)){let i=(c.blockingReasons??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(i.length>0){t.push({artifact:c$4,reasons:i});for(let s of i)r.add(s);}}let p=await a(e$1,e$2),l=(p?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(l.length>0||String(p?.status??"").toLowerCase()==="failed"){let i=l.length>0?l:["Workspace contract verification failed"];t.push({artifact:e$2,reasons:i});for(let s of i)r.add(s);}return {blockingReasons:[...r],sources:t}}async function I(e$2,t,r){switch(t){case "getWorkspaceModel":return a(e$2,h);case "getWorkspaceKnowledgeGraph":return a(e$2,a$1.knowledgeGraph);case "queryWorkspaceEntities":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=String(r.kind??"").trim();return {schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,entities:e$1(n,o||void 0)}}case "searchWorkspaceGraph":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=typeof r.limit=="number"?r.limit:Number(r.limit??12);return f(n,{query:String(r.query??""),...typeof r.kind=="string"&&r.kind.trim()?{kind:r.kind.trim()}:{},limit:Number.isFinite(o)?o:12})}case "getWorkspaceGraphEvidence":{let n=await a(e$2,a$1.knowledgeGraph);return n?c$2(n,String(r.query??"")):null}case "findWorkspaceGraphPath":{let n=await a(e$2,a$1.knowledgeGraph);return n?d(n,String(r.from??""),String(r.to??"")):null}case "getEvidenceIndex":return a(e$2,q);case "getBlockers":return F(e$2);case "getSafeCommands":return {safeCommands:(await a(e$2,d$2))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,d$2);if(!n)return null;let o=String(r.project??"").trim(),c=n.scope?.activeProject??void 0,p=o||c,l=Array.isArray(n.projects)?n.projects:[],i=p&&l.find(s=>typeof s.name=="string"&&s.name.toLowerCase()===p.toLowerCase());return {workspace:n.workspace??null,scope:n.scope??null,validation:n.validation??null,project:i??null,safeCommands:n.safeCommands??[]}}case "getArtifact":{let n=String(r.relativePath??"").trim();return a(e$2,n)}case "listOperationalSkills":return a(e$2,b$1);case "getWorkspaceExplain":{let n=String(r.target??"release-blocked").trim(),o=c$1(n);if(!o)throw new Error(`Invalid explain target: ${n}`);let c=await a(e$2,c$4);return e(c)&&M(c.target,o)?c:b({workspacePath:e$2,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}function R(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
|
|
2
|
+
`);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
|
|
3
|
+
`);}async function ce(e){let t=u.resolve(e.workspacePath),r=N.createInterface({input:process.stdin,terminal:false});for await(let n of r){let o=n.trim();if(!o)continue;let c;try{c=JSON.parse(o);}catch{E(null,"Invalid JSON-RPC request");continue}let{id:p,method:l,params:i}=c;try{if(l==="initialize"){R(p,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(l==="notifications/initialized")continue;if(l==="tools/list"){R(p,{tools:J.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}))});continue}if(l==="tools/call"){let s=String(i?.name??""),K=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},S=await I(t,s,K);R(p,{content:[{type:"text",text:JSON.stringify(S,null,2)}],isError:S==null});continue}E(p,`Unsupported method: ${l??"unknown"}`);}catch(s){E(p,s instanceof Error?s.message:String(s));}}}async function pe(e,t,r={}){return I(u.resolve(e),t,r)}export{J as WORKSPACE_MCP_READ_TOOLS,pe as invokeMcpToolForTest,ce as runWorkspaceMcpServe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{h as WORKSPACE_MODEL_REPORT_PATH,g as WORKSPACE_MODEL_SCHEMA_VERSION,k as buildWorkspaceModel,l as buildWorkspaceModelCached,j as buildWorkspaceModelFacts,m as buildWorkspaceModelIncremental,i as validateWorkspaceModelStrict,n as writeWorkspaceModel}from'./chunk-ZDN7RHXJ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as hashCanonicalJson,d as hashWorkspaceModel,a as stableSort,b as stableStringify}from'./chunk-OA537ZQ5.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b}from'./chunk-GSWPGELT.js';import {o,l as l$1}from'./chunk-5XATWNME.js';import l from'fs-extra';function c(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async function m(n,e,o$1){let s=(await Promise.all(o(n,e).map(async r=>({candidate:r,exists:await l.pathExists(r)})))).find(({exists:r})=>r)?.candidate;if(!s)return false;let t=l$1(n,e),a=c(await l.readJson(s));return await l.outputJson(t,o$1(a),{spaces:2}),await l.appendFile(t,`
|
|
2
|
+
`,"utf-8"),true}async function M(n,e){let o=e.now??new Date().toISOString(),s=e.installMethod==="pip"?"venv":e.installMethod;await m(n,"workspace.json",a=>{let r=c(a.engine),i=c(r.python_core);return delete a.bootstrap_note,delete i.reason,{...a,engine:{...r,install_method:s,python_version:e.pythonVersion??r.python_version??null,python_core:{...i,status:"installed",installed_at:o,...e.coreVersion?{version:e.coreVersion}:{}}}}}),await m(n,"toolchain.lock",a=>{let r=c(a.runtime),i=c(r.python),d=c(i.core);return delete d.reason,{...a,generated_at:o,runtime:{...r,python:{...i,version:e.pythonVersion??i.version??null,install_method:s,core:{...d,status:"installed",installed_at:o,...e.coreVersion?{version:e.coreVersion}:{}}}}}});let t=await a(n);if(t){let a={...t.metadata?.python??{}};delete a.coreReason,t.metadata={...t.metadata,python:{...a,coreStatus:"installed",...e.coreVersion?{coreVersion:e.coreVersion}:{},...e.pythonVersion?{pythonVersion:e.pythonVersion}:{},...e.venvPath?{venvPath:e.venvPath}:{}},npm:{...t.metadata?.npm??{},packageVersion:t.metadata?.npm?.packageVersion??t.version,installMethod:s,lastUsedAt:o}},await b(n,t);}}export{M as markWorkspacePythonEngineInstalled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,b as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,f as buildWorkspaceRegistrySummary,g as formatWorkspaceRegistrySyncSummary,e as publishWorkspaceRegistrySummary,d as readWorkspaceRegistrySummary,c as resolveWorkspaceRegisteredProjects}from'./chunk-7VLCK5JW.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runWorkspaceStage}from'./chunk-KZZ36CK5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-DV6GJD4K.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-
|
|
1
|
+
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-ZM5NQ5Z2.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-ITCAMC2E.js';import {m as m$1}from'./chunk-ZDN7RHXJ.js';import {b as b$1}from'./chunk-COARSXRC.js';import {a as a$1}from'./chunk-KB44JP4M.js';import P from'fs';var w="workspace-watch-event.v1";function b(t){return a$1(t,"contracts/workspace-watch-event.v1.json","Workspace watch event"),t}function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return b$1({projects:o,edges:c})}function R(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>m$1({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>C.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&y.has(r[o+1]))return false;return true}async function I(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit(b({schemaVersion:w,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)}));}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{S(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=P.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
|