workspai 0.43.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +28 -11
  2. package/contracts/agent-customization-pack.v1.json +1 -1
  3. package/contracts/autopilot-release.v1.json +204 -0
  4. package/contracts/cli-operation-result.v1.json +119 -0
  5. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +1368 -0
  6. package/contracts/command-capabilities.v1.json +303 -0
  7. package/contracts/compatibility-matrix.v1.json +37 -0
  8. package/contracts/create-planner-capabilities.v1.json +156 -65
  9. package/contracts/doctor-project-scan.v2.json +60 -0
  10. package/contracts/doctor-remediation-plan.v1.json +19 -4
  11. package/contracts/doctor-remediation-plan.v2.json +7 -0
  12. package/contracts/doctor-workspace-cache.v2.json +82 -0
  13. package/contracts/extension-cli-compatibility.v1.json +48 -3
  14. package/contracts/infra-plan.v1.json +189 -0
  15. package/contracts/private-product-manifest.v1.json +155 -0
  16. package/contracts/product-factory-plan.v1.json +200 -0
  17. package/contracts/project-archive.v1.json +40 -0
  18. package/contracts/project-entry-capability.v1.json +127 -0
  19. package/contracts/published-contract-catalog.v1.json +339 -0
  20. package/contracts/runtime-command-surface.v1.json +1680 -11
  21. package/contracts/version.v1.json +48 -0
  22. package/contracts/workspace-archive-capabilities.v1.json +90 -0
  23. package/contracts/workspace-archive-manifest.v1.json +107 -0
  24. package/contracts/workspace-archive-operation-result.v1.json +565 -0
  25. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
  26. package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
  27. package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
  28. package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
  29. package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
  30. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
  31. package/contracts/workspace-intelligence-architecture.v1.json +723 -0
  32. package/contracts/workspace-intelligence-chain.v1.json +1194 -0
  33. package/contracts/workspace-list.v1.json +56 -0
  34. package/contracts/workspace-model-cache.v1.json +55 -0
  35. package/contracts/workspace-snapshot.v1.json +58 -0
  36. package/contracts/workspace-snapshot.v2.json +97 -0
  37. package/contracts/workspace-sync.v1.json +30 -0
  38. package/contracts/workspace-watch-event.v1.json +112 -0
  39. package/dist/analyze-YLV7NVLF.js +1 -0
  40. package/dist/{artifact-remediation-plan-244S5K6I.js → artifact-remediation-plan-WLZGROUU.js} +2 -2
  41. package/dist/autopilot-release-YBN3SWAA.js +1 -0
  42. package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
  43. package/dist/chunk-2QOWRBQD.js +1 -0
  44. package/dist/chunk-42G2OK64.js +1 -0
  45. package/dist/chunk-5AKYMAIL.js +1 -0
  46. package/dist/chunk-5GNT4RJI.js +8 -0
  47. package/dist/{chunk-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
  48. package/dist/chunk-6AA3WWQZ.js +2 -0
  49. package/dist/chunk-6ZENXBMG.js +33 -0
  50. package/dist/chunk-7RIWU5TZ.js +1 -0
  51. package/dist/chunk-BJLE5CH7.js +4 -0
  52. package/dist/{chunk-PPHTYJ7G.js → chunk-DXPU4DDV.js} +36 -37
  53. package/dist/{chunk-DOCPUNWS.js → chunk-G3H5R3RR.js} +1 -1
  54. package/dist/chunk-HYJK7W3B.js +1 -0
  55. package/dist/chunk-IMUU5Q2V.js +13 -0
  56. package/dist/chunk-J4AICQFB.js +1 -0
  57. package/dist/{chunk-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
  58. package/dist/{chunk-ONU457VN.js → chunk-K63BSU56.js} +52 -50
  59. package/dist/chunk-KPPGZCUW.js +78 -0
  60. package/dist/chunk-KU4S7RCM.js +1 -0
  61. package/dist/chunk-LCRROMRR.js +2 -0
  62. package/dist/chunk-LG6RFLPZ.js +1 -0
  63. package/dist/{chunk-JHC6SCJC.js → chunk-NHN4QXPP.js} +1 -1
  64. package/dist/{chunk-U6AXYUQY.js → chunk-OOOPYUL2.js} +1 -1
  65. package/dist/chunk-P7SCWJFG.js +8 -0
  66. package/dist/chunk-QWU2CZBG.js +2 -0
  67. package/dist/chunk-V2H2KRMZ.js +1 -0
  68. package/dist/chunk-WANW4QA4.js +4 -0
  69. package/dist/chunk-XIVFLY6G.js +1 -0
  70. package/dist/chunk-ZWO6K24C.js +2 -0
  71. package/dist/{create-42RTNLH2.js → create-KFR6FLRT.js} +1 -1
  72. package/dist/doctor-YJDM5XBH.js +1 -0
  73. package/dist/index.d.ts +284 -25
  74. package/dist/index.js +214 -204
  75. package/dist/pipeline-FEDYO3IA.js +5 -0
  76. package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
  77. package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
  78. package/dist/{workspace-DZHWB7BV.js → workspace-PLXOO6ST.js} +1 -1
  79. package/dist/workspace-agent-sync-G5YVI3BJ.js +1 -0
  80. package/dist/workspace-archive-EEGLHZDW.js +10 -0
  81. package/dist/workspace-context-E3UFWL5X.js +1 -0
  82. package/dist/{workspace-contract-2TA27LGT.js → workspace-contract-LQJDZV36.js} +1 -1
  83. package/dist/workspace-explain-G74ZIF23.js +1 -0
  84. package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
  85. package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-YY6WQPWQ.js} +1 -1
  86. package/dist/{workspace-foundation-FQWHPQGX.js → workspace-foundation-3C2DLCVI.js} +1 -1
  87. package/dist/{workspace-history-CGCK2DJI.js → workspace-history-VF3CHDYQ.js} +1 -1
  88. package/dist/workspace-intelligence-3GG7GEDQ.js +1 -0
  89. package/dist/workspace-mcp-serve-MJMUV4RY.js +3 -0
  90. package/dist/{workspace-model-F3B75TYT.js → workspace-model-NG45SRM5.js} +1 -1
  91. package/dist/workspace-registry-summary-JM2XY52C.js +1 -0
  92. package/dist/workspace-run-WEQYIERE.js +1 -0
  93. package/dist/{workspace-verify-OAATQV5T.js → workspace-verify-ZNT6JX7D.js} +1 -1
  94. package/dist/workspace-watch-W47T4RX2.js +1 -0
  95. package/docs/AI_FEATURES.md +67 -34
  96. package/docs/README.md +2 -1
  97. package/docs/commands-reference.md +39 -14
  98. package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
  99. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +27 -6
  100. package/docs/contracts/README.md +3 -2
  101. package/docs/create-planner-capabilities.md +36 -18
  102. package/docs/workspace-operations.md +25 -0
  103. package/package.json +27 -14
  104. package/scripts/enterprise-package-smoke.mjs +40 -8
  105. package/scripts/prepack-enterprise.mjs +12 -0
  106. package/dist/analyze-5BU4QIPK.js +0 -1
  107. package/dist/autopilot-release-45YVOBQO.js +0 -1
  108. package/dist/chunk-3QVTWKUI.js +0 -4
  109. package/dist/chunk-753LOKFZ.js +0 -2
  110. package/dist/chunk-AMDKXXLP.js +0 -1
  111. package/dist/chunk-AQ4XZZC6.js +0 -1
  112. package/dist/chunk-CDE4Q77U.js +0 -2
  113. package/dist/chunk-DNAY5ALC.js +0 -1
  114. package/dist/chunk-FHSMY75W.js +0 -1
  115. package/dist/chunk-FM7GMFZA.js +0 -2
  116. package/dist/chunk-HV5ZFXAZ.js +0 -13
  117. package/dist/chunk-LRW2SAGL.js +0 -4
  118. package/dist/chunk-LTWYYP6E.js +0 -7
  119. package/dist/chunk-NAAQMSO3.js +0 -1
  120. package/dist/chunk-NFUXULIF.js +0 -1
  121. package/dist/chunk-OL64GWQC.js +0 -9
  122. package/dist/chunk-SI3AQKIP.js +0 -1
  123. package/dist/chunk-TH5Y3EMA.js +0 -33
  124. package/dist/chunk-UQKCCWUL.js +0 -78
  125. package/dist/chunk-XNGANEXM.js +0 -2
  126. package/dist/doctor-DK4BON3N.js +0 -1
  127. package/dist/pipeline-HQ57V6OZ.js +0 -5
  128. package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
  129. package/dist/workspace-archive-GCZNI44O.js +0 -3
  130. package/dist/workspace-context-GEXDHA7A.js +0 -1
  131. package/dist/workspace-explain-D5NNL3NG.js +0 -1
  132. package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
  133. package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
  134. package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
  135. package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
  136. package/dist/workspace-run-3WJXIQKR.js +0 -1
  137. package/dist/workspace-watch-HU2OTQ52.js +0 -1
@@ -1,3 +0,0 @@
1
- import {b}from'./chunk-HV5ZFXAZ.js';import {b as b$1}from'./chunk-CDE4Q77U.js';import {d}from'./chunk-AMDKXXLP.js';import {c,e}from'./chunk-AQ4XZZC6.js';import {c as c$2,b as b$2}from'./chunk-DNAY5ALC.js';import {k}from'./chunk-FHSMY75W.js';import {c as c$3}from'./chunk-XNGANEXM.js';import {c as c$1}from'./chunk-NAAQMSO3.js';import u from'path';import P from'readline';import v from'fs-extra';var h=".workspai/reports/INDEX.json";function O(t,e){return t.kind!==e.kind?false:t.kind==="project"&&e.kind==="project"?t.project.toLowerCase()===e.project.toLowerCase():t.kind==="blocker"&&e.kind==="blocker"?t.blockerId===e.blockerId:t.kind==="trace"&&e.kind==="trace"?t.diffRef===e.diffRef:true}var C=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{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 _(t){let e=t.trim().replace(/\\/g,"/");return e.length>0&&!u.isAbsolute(e)&&!e.split("/").includes("..")&&(e.startsWith(".workspai/")||e.startsWith(".rapidkit/"))}async function l(t,e){if(!_(e))throw new Error(`Unsafe artifact path: ${e}`);let i=await c$1(t,e)??u.join(t,e);return await v.pathExists(i)?v.readJson(i):null}async function W(t){let e$1=[],i=new Set,s=((await l(t,d))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){e$1.push({artifact:d,reasons:s});for(let n of s)i.add(n);}let a=await l(t,c$2);if(e(a)){let n=(a.blockingReasons??[]).filter(r=>typeof r=="string"&&r.trim().length>0);if(n.length>0){e$1.push({artifact:c$2,reasons:n});for(let r of n)i.add(r);}}let c=await l(t,c$3),p=(c?.violations??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(p.length>0||String(c?.status??"").toLowerCase()==="failed"){let n=p.length>0?p:["Workspace contract verification failed"];e$1.push({artifact:c$3,reasons:n});for(let r of n)i.add(r);}return {blockingReasons:[...i],sources:e$1}}async function A(t,e$1,i){switch(e$1){case "getWorkspaceModel":return l(t,k);case "getEvidenceIndex":return l(t,h);case "getBlockers":return W(t);case "getSafeCommands":return {safeCommands:(await l(t,b$1))?.safeCommands??[]};case "getProjectContext":{let o=await l(t,b$1);if(!o)return null;let s=String(i.project??"").trim(),a=o.scope?.activeProject??void 0,c=s||a,p=Array.isArray(o.projects)?o.projects:[],n=c&&p.find(r=>typeof r.name=="string"&&r.name.toLowerCase()===c.toLowerCase());return {workspace:o.workspace??null,scope:o.scope??null,validation:o.validation??null,project:n??null,safeCommands:o.safeCommands??[]}}case "getArtifact":{let o=String(i.relativePath??"").trim();return l(t,o)}case "listOperationalSkills":return l(t,b$2);case "getWorkspaceExplain":{let o=String(i.target??"release-blocked").trim(),s=c(o);if(!s)throw new Error(`Invalid explain target: ${o}`);let a=await l(t,c$2);return e(a)&&O(a.target,s)?a:b({workspacePath:t,target:s})}default:throw new Error(`Unknown tool: ${e$1}`)}}function R(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,result:e})}
2
- `);}function w(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,error:{code:-32e3,message:e}})}
3
- `);}async function z(t){let e=u.resolve(t.workspacePath),i=P.createInterface({input:process.stdin,terminal:false});for await(let o of i){let s=o.trim();if(!s)continue;let a;try{a=JSON.parse(s);}catch{w(null,"Invalid JSON-RPC request");continue}let{id:c,method:p,params:n}=a;try{if(p==="initialize"){R(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){R(c,{tools:C.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))});continue}if(p==="tools/call"){let r=String(n?.name??""),T=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},E=await A(e,r,T);R(c,{content:[{type:"text",text:JSON.stringify(E,null,2)}],isError:E==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(r){w(c,r instanceof Error?r.message:String(r));}}}async function U(t,e,i={}){return A(u.resolve(t),e,i)}export{C as WORKSPACE_MCP_READ_TOOLS,U as invokeMcpToolForTest,z as runWorkspaceMcpServe};
@@ -1 +0,0 @@
1
- import {a}from'./chunk-A5FBGRJA.js';import {b as b$1,j}from'./chunk-XNGANEXM.js';import {c,d}from'./chunk-NAAQMSO3.js';import {r,p}from'./chunk-LZQNVH7D.js';import {o}from'./chunk-5XATWNME.js';import n from'path';import {existsSync}from'fs';import y from'fs-extra';var k=".workspai/workspace-registry.v1.json",w="workspace-registry.v1";function C(t){return {slug:t.slug,relativePath:t.relativePath,framework:t.framework,kit:t.kit,source:t.source}}async function x(t){let r=o(t,"workspace.json").find(e=>existsSync(e));if(!r)return {exists:false,legacyProjectCount:0};try{let e=await y.readJson(r),s=Array.isArray(e.projects)?e.projects.length:0,o=typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||n.basename(t);return {exists:true,manifestPath:r,workspaceName:o,profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:s}}catch{return {exists:true,manifestPath:r,legacyProjectCount:0,workspaceName:n.basename(t)}}}async function A(t){let r$1=a(t);for(let e of r())if(await y.pathExists(e))try{let o=((await y.readJson(e)).workspaces||[]).find(a$1=>a(a$1.path)===r$1);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:e}}catch{continue}return {exists:false,projectCount:0,registryPath:n.join(p(),"workspaces.json")}}async function b(t){let r=n.resolve(t),e=await c(r,b$1),s=await x(r),o=await A(r),a=!!e,c$1=[];if(a)try{let{contract:S}=await j({workspacePath:r});c$1=S.projects||[];}catch{c$1=[];}let W={contract:{exists:a,projectCount:c$1.length,path:b$1},globalRegistry:{exists:o.exists,projectCount:o.projectCount,path:o.registryPath},legacyWorkspaceJson:{exists:s.exists,projectCount:s.legacyProjectCount,path:s.manifestPath?n.relative(r,s.manifestPath):void 0}},i="none",u=[],p=0;return a?(i="workspace.contract.json",u=c$1.map(C),p=u.length):o.projectCount>0?(i="global-registry",p=o.projectCount):s.legacyProjectCount>0&&(i="legacy-workspace.json",p=s.legacyProjectCount),{contractExists:a,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:r,workspaceName:s.workspaceName||n.basename(r),profile:s.profile,projectCount:p,authority:i,contractPath:b$1,projects:u,sources:W}}}async function J(t){let r=await c(t,k);if(!r)return null;try{let e=await y.readJson(r);return e?.schemaVersion!==w?null:e}catch{return null}}async function V(t,r){let s={...(await b(t)).summary,generatedAt:(r?.now??new Date).toISOString(),registrySummaryPath:k};return await d(t,k,s),s}function Y(t,r=""){return t.projectCount>0?t.authority==="workspace.contract.json"?`${t.projectCount} project(s) registered in workspace contract${r}.`:t.authority==="global-registry"?`${t.projectCount} project(s) registered in global workspace registry${r}.`:`${t.projectCount} project(s) registered in legacy workspace manifest${r}.`:`Workspace state exists, but no projects are registered yet${r}.`}export{k as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,w as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,Y as formatWorkspaceRegistrySyncSummary,V as publishWorkspaceRegistrySummary,J as readWorkspaceRegistrySummary,b as resolveWorkspaceRegisteredProjects};
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-3QVTWKUI.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-753LOKFZ.js';
@@ -1 +0,0 @@
1
- import {a}from'./chunk-U6AXYUQY.js';import {b as b$1,p}from'./chunk-FHSMY75W.js';import w from'fs';var M="workspace-watch-event.v1";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 b(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??(()=>p({...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=b(c,a),i=m(a),l=c?m(c)!==i:true;return {schemaVersion:M,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}}},P=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),R=new Set(["reports","cache","tmp",".cache"]);function y(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>P.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&R.has(r[o+1]))return false;return true}async function G(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({schemaVersion:M,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=>{y(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=w.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{M as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,b as diffWatchModels,y as isWatchRelevantPath,G as runWorkspaceWatch};