workspai 0.67.0 → 0.68.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 (107) hide show
  1. package/contracts/workspace-activity-board.v1.json +6 -0
  2. package/contracts/workspace-activity-event.v1.json +31 -1
  3. package/contracts/workspace-activity-monitor-snapshot.v1.json +35 -2
  4. package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +1 -0
  5. package/dist/analyze-JDEWUBC6.js +1 -0
  6. package/dist/{artifact-remediation-plan-GFFHC2ZU.js → artifact-remediation-plan-I7IKC5MR.js} +1 -1
  7. package/dist/autopilot-release-OELUFNLL.js +1 -0
  8. package/dist/capabilities-command-RAAYENQ6.js +1 -0
  9. package/dist/chunk-25AWHAB5.js +2 -0
  10. package/dist/{chunk-KQ2TMI26.js → chunk-2C5XJBYI.js} +1 -1
  11. package/dist/{chunk-TP7VKEUF.js → chunk-2KX6KHEC.js} +1 -1
  12. package/dist/{chunk-2RPFCBS4.js → chunk-3BMYMZQB.js} +1 -1
  13. package/dist/{chunk-BRYJTW6S.js → chunk-3KU3YUWD.js} +1 -1
  14. package/dist/{chunk-ENZPM52J.js → chunk-3NF3M3RE.js} +1 -1
  15. package/dist/{chunk-HQLBO23O.js → chunk-3XF7O66C.js} +3 -3
  16. package/dist/{chunk-H77ZNH5O.js → chunk-3Z4SVBMR.js} +1 -1
  17. package/dist/{chunk-NVND4727.js → chunk-46QH3ZVI.js} +1 -1
  18. package/dist/{chunk-VI4ZRAY6.js → chunk-5OV2WXAR.js} +1 -1
  19. package/dist/{chunk-Y35VLVF6.js → chunk-5XUAAQSV.js} +2 -2
  20. package/dist/{chunk-BHFRP7TV.js → chunk-5YZ2W57R.js} +1 -1
  21. package/dist/{chunk-B4IVVTMQ.js → chunk-64XWHDZ3.js} +1 -1
  22. package/dist/{chunk-KENOAC2Q.js → chunk-7DDEMDG2.js} +1 -1
  23. package/dist/{chunk-IQQMFRWM.js → chunk-7DZNZ3GM.js} +1 -1
  24. package/dist/{chunk-N4QFNOAI.js → chunk-BG6IX6HA.js} +1 -1
  25. package/dist/{chunk-2MVIRJJR.js → chunk-BMAFHX6A.js} +1 -1
  26. package/dist/{chunk-XDPTAV2T.js → chunk-C2VTO5WT.js} +1 -1
  27. package/dist/{chunk-JCGSIDMC.js → chunk-CSZPE637.js} +1 -1
  28. package/dist/{chunk-5OA33JH2.js → chunk-D5LLTUTY.js} +1 -1
  29. package/dist/{chunk-4RV4JVGR.js → chunk-DFVG4DDZ.js} +1 -1
  30. package/dist/{chunk-OCNPOYMA.js → chunk-EHLGPLIU.js} +1 -1
  31. package/dist/{chunk-6254CWUY.js → chunk-GVQKAINC.js} +1 -1
  32. package/dist/{chunk-HYE5UHPV.js → chunk-IXXQMD34.js} +1 -1
  33. package/dist/{chunk-GIQ4SDRJ.js → chunk-JYMO7QXQ.js} +1 -1
  34. package/dist/{chunk-THIG2YQP.js → chunk-KDY4X7SQ.js} +1 -1
  35. package/dist/{chunk-L5Q2S5GY.js → chunk-KFTJVVJR.js} +1 -1
  36. package/dist/{chunk-SX6A656X.js → chunk-KY2GOSO5.js} +1 -1
  37. package/dist/chunk-LDBULT2T.js +4 -0
  38. package/dist/{chunk-PSYQ6IJA.js → chunk-LEOFD3W5.js} +1 -1
  39. package/dist/{chunk-5EVDW7JM.js → chunk-N5HPMATQ.js} +1 -1
  40. package/dist/{chunk-CZVT7T2X.js → chunk-OFYY4725.js} +1 -1
  41. package/dist/{chunk-3O7LZPKA.js → chunk-P3622IM5.js} +1 -1
  42. package/dist/{chunk-TABXSDTR.js → chunk-PKKSRXUS.js} +1 -1
  43. package/dist/{chunk-ARUFY5W3.js → chunk-Q7UGDNSM.js} +1 -1
  44. package/dist/{chunk-2M62CU3O.js → chunk-RVAOJOXA.js} +1 -1
  45. package/dist/{chunk-EHCKITR4.js → chunk-TCLKGPXF.js} +1 -1
  46. package/dist/{chunk-SRLWHOLF.js → chunk-TMRCPT7S.js} +1 -1
  47. package/dist/{chunk-VWBMDGPY.js → chunk-VIN7NJW3.js} +1 -1
  48. package/dist/chunk-W37NOQVG.js +1 -0
  49. package/dist/{chunk-SVYY55IS.js → chunk-W5VKBDSD.js} +1 -1
  50. package/dist/{chunk-YYY2WXOH.js → chunk-WRZSQDZV.js} +1 -1
  51. package/dist/{create-72ITVZXV.js → create-U5PQHOZ4.js} +1 -1
  52. package/dist/{demo-kit-5UQH2OXC.js → demo-kit-RKTHTXHJ.js} +1 -1
  53. package/dist/{doctor-CVYUESRQ.js → doctor-D7YI7LSA.js} +1 -1
  54. package/dist/{dotnet-webapi-clean-YEHYIGOT.js → dotnet-webapi-clean-XL4IBUQV.js} +1 -1
  55. package/dist/{goal-lifecycle-H55AGFCB.js → goal-lifecycle-BMS6GSIU.js} +1 -1
  56. package/dist/{goal-pack-6OBZOPCD.js → goal-pack-RBSVQMMX.js} +1 -1
  57. package/dist/{gofiber-standard-C44IIQYH.js → gofiber-standard-OHHMCNMJ.js} +1 -1
  58. package/dist/{gogin-standard-X7VKACVR.js → gogin-standard-BAZXPOKL.js} +1 -1
  59. package/dist/index.js +23 -23
  60. package/dist/{live-command-5VXPR43F.js → live-command-GNAASZ7U.js} +1 -1
  61. package/dist/{pipeline-SKYOXWHW.js → pipeline-QOMXH2EK.js} +1 -1
  62. package/dist/{project-agent-entry-5IUBEREI.js → project-agent-entry-MH7364BE.js} +1 -1
  63. package/dist/{project-intelligence-lens-LQCN65P2.js → project-intelligence-lens-ZCCHUKVI.js} +1 -1
  64. package/dist/{project-test-coverage-KD4LLFGV.js → project-test-coverage-JPWTBSSJ.js} +1 -1
  65. package/dist/{rust-axum-JKZTZDRZ.js → rust-axum-CCJ6UCBW.js} +1 -1
  66. package/dist/{springboot-standard-PI4FLTAN.js → springboot-standard-M5JQEJML.js} +1 -1
  67. package/dist/{verified-goal-HN7G532B.js → verified-goal-XUXU2X5H.js} +1 -1
  68. package/dist/{workspace-5W7FYGDQ.js → workspace-B33BFZZ3.js} +1 -1
  69. package/dist/{workspace-agent-sync-OZCDQORK.js → workspace-agent-sync-T3MJO2MX.js} +1 -1
  70. package/dist/{workspace-context-L65BR5L6.js → workspace-context-KOCEP4MJ.js} +1 -1
  71. package/dist/{workspace-contract-JYHNEJPV.js → workspace-contract-MQ3QE52V.js} +1 -1
  72. package/dist/{workspace-explain-SUBK6FLO.js → workspace-explain-DTFCKYXK.js} +1 -1
  73. package/dist/{workspace-feedback-MWGCT5R2.js → workspace-feedback-3YLIUFQ7.js} +1 -1
  74. package/dist/{workspace-foundation-VIB3PXNH.js → workspace-foundation-O7O3QIS4.js} +1 -1
  75. package/dist/{workspace-graph-stream-45JHE4MG.js → workspace-graph-stream-XTGGBD7D.js} +1 -1
  76. package/dist/workspace-graph-token-efficiency-5LJKQU2J.js +1 -0
  77. package/dist/{workspace-history-JKW3VJO3.js → workspace-history-7HDZZ4G5.js} +1 -1
  78. package/dist/{workspace-intelligence-3C47PK4L.js → workspace-intelligence-TFEQBPUP.js} +1 -1
  79. package/dist/{workspace-intelligence-benchmark-SRDIHX3X.js → workspace-intelligence-benchmark-PLVUBGWO.js} +1 -1
  80. package/dist/{workspace-intelligence-runner-OWN5ZI6W.js → workspace-intelligence-runner-6ZAV6RO4.js} +1 -1
  81. package/dist/{workspace-knowledge-graph-AKG5NUU6.js → workspace-knowledge-graph-AUXYL3L6.js} +1 -1
  82. package/dist/{workspace-knowledge-graph-query-DXA4CROE.js → workspace-knowledge-graph-query-A7TKONWY.js} +1 -1
  83. package/dist/workspace-knowledge-graph-snapshot-GPBDAKAU.js +1 -0
  84. package/dist/{workspace-mcp-serve-PK226GMV.js → workspace-mcp-serve-TDUXJUAA.js} +1 -1
  85. package/dist/{workspace-model-R4ISKDB2.js → workspace-model-GVXNLSQM.js} +1 -1
  86. package/dist/{workspace-onboarding-Y5RPEFUD.js → workspace-onboarding-ECZ2KJ2A.js} +1 -1
  87. package/dist/{workspace-readme-PL5V3UDH.js → workspace-readme-6N5Y2ZSJ.js} +1 -1
  88. package/dist/{workspace-registry-summary-STGUGROG.js → workspace-registry-summary-5SFBTRGQ.js} +1 -1
  89. package/dist/{workspace-repair-engine-FNLL5ZDK.js → workspace-repair-engine-CKJCTWKX.js} +1 -1
  90. package/dist/workspace-run-ZZ5WHL7W.js +1 -0
  91. package/dist/{workspace-verify-AXVX3PF3.js → workspace-verify-D3QTMAUI.js} +1 -1
  92. package/dist/{workspace-watch-RLBEJKXE.js → workspace-watch-XYJEW2Z2.js} +1 -1
  93. package/docs/ci-workflows.md +1 -1
  94. package/docs/commands-reference.md +3 -1
  95. package/docs/contracts/README.md +1 -1
  96. package/docs/workspace-knowledge-graph.md +1 -0
  97. package/docs/workspace-live-activity.md +18 -4
  98. package/package.json +1 -1
  99. package/dist/analyze-IC2KRVCG.js +0 -1
  100. package/dist/autopilot-release-RECEZAZI.js +0 -1
  101. package/dist/capabilities-command-X4WZIJNR.js +0 -1
  102. package/dist/chunk-5TY74LLW.js +0 -2
  103. package/dist/chunk-UTV4DTNM.js +0 -1
  104. package/dist/chunk-ZI2E7P6O.js +0 -4
  105. package/dist/workspace-graph-token-efficiency-NPECU6Y5.js +0 -1
  106. package/dist/workspace-knowledge-graph-snapshot-SNI5K2RL.js +0 -1
  107. package/dist/workspace-run-GFBFGUFM.js +0 -1
@@ -1 +0,0 @@
1
- import {u,e,k}from'./chunk-VQZ5PI5J.js';import T from'crypto';import p from'fs';import m from'os';import r from'path';var K="workspace-activity-event.v1",N=["run.started","run.completed","run.failed","run.cancelled","block.planned","block.started","block.progress","block.completed","block.failed","block.blocked","block.skipped","edge.declared","operation.started","operation.completed","operation.failed","touch.planned","touch.observed","artifact.published","artifact.rejected","warning.detected"],V=["planned","running","succeeded","warned","blocked","failed","cancelled","skipped","rolled-back"];var _=["package.json","pyproject.toml","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","*.sln"];function l(t){try{return p.existsSync(t)}catch{return false}}function x(t,n){return n.some(e=>{if(e==="*.sln")try{return p.readdirSync(t).some(o=>o.toLowerCase().endsWith(".sln"))}catch{return false}return l(r.join(t,e))})}function I(t,n,e){let o=r.resolve(t),s=e?r.resolve(e):null;for(;;){if(n(o))return o;if(s&&o===s)return null;let a=r.dirname(o);if(a===o)return null;o=a;}}function j(t){for(let n of u(t,e))if(l(n))try{let e=JSON.parse(p.readFileSync(n,"utf8")),o=typeof e.workspace?.root=="string"?e.workspace.root:null;if(o&&k(r.resolve(o)))return r.resolve(o)}catch{}return null}function w(t=process.env){return t.WORKSPAI_ACTIVITY_STATE_DIR?r.resolve(t.WORKSPAI_ACTIVITY_STATE_DIR):process.platform==="win32"?r.join(t.LOCALAPPDATA||m.homedir(),"Workspai","activity"):process.platform==="darwin"?r.join(m.homedir(),"Library","Application Support","Workspai","activity"):r.join(t.XDG_STATE_HOME||r.join(m.homedir(),".local","state"),"workspai","activity")}function W(t,n){let e=r.resolve(n);try{e=p.realpathSync.native(e);}catch{}return process.platform==="win32"&&(e=e.toLowerCase()),`${t}-${T.createHash("sha256").update(e).digest("hex").slice(0,24)}`}function E(t){let n=r.resolve(t);try{n=p.realpathSync.native(n);}catch{}return process.platform==="win32"&&(n=n.toLowerCase()),`local-${T.createHash("sha256").update(n).digest("hex").slice(0,24)}`}function J(t=process.cwd(),n={}){let e=r.resolve(t),o=I(e,k),s=I(e,f=>l(r.join(f,".git"))||x(f,_),o??void 0),a=s?j(s):null,i=o??a??s??e,c=s??o??e,y=o||a?"workspace":s&&u(s,"project.json").some(l)?"project":"ephemeral-project",R=W(y,i),v=w(n.env),k$1=r.join(v,E(c)),A=r.join(v,E(i));return {rootPath:i,observationRootPath:c,statePath:k$1,mirrorStatePaths:A===k$1?[]:[A],scope:{kind:y,id:R,label:r.basename(i)||"project",portable:false}}}function U(t){let n=r.resolve(t.rootPath),e=r.resolve(t.observationRootPath);return {id:W("project",e),kind:e===n?"workspace-root":"project",label:r.basename(e)||t.scope.label}}function q(t,n){let e=r.resolve(n),o=r.relative(r.resolve(t),e);return o===""?".":!o.startsWith("..")&&!r.isAbsolute(o)?o.replaceAll("\\","/"):`<external>/${r.basename(e)}`}var P=200,O=14;function Q(t,n={}){let e=Math.max(10,n.maxRuns??P),o=Date.now()-Math.max(1,n.maxAgeDays??O)*24*60*60*1e3,s=[];try{s=p.readdirSync(t,{withFileTypes:true}).filter(i=>i.isFile()&&i.name.endsWith(".ndjson")).map(i=>{let c=r.join(t,i.name);return {path:c,mtimeMs:p.statSync(c).mtimeMs}}).sort((i,c)=>c.mtimeMs-i.mtimeMs);}catch{return 0}let a=0;for(let[i,c]of s.entries())if(!(i<e&&c.mtimeMs>=o))try{p.unlinkSync(c.path),a+=1;}catch{}return a}export{K as a,N as b,V as c,w as d,J as e,U as f,q as g,P as h,Q as i};
@@ -1,4 +0,0 @@
1
- import {e,d,i,a,b,c}from'./chunk-UTV4DTNM.js';import m from'fs';import y from'path';var E=64*1024,w=1024*1024,_="workspace-activity-monitor-snapshot.v1",T="workspace-activity-monitor-fleet.v1";function N(n){if(!n||typeof n!="object")return false;let s=n;return s.schemaVersion===a&&typeof s.eventId=="string"&&typeof s.runId=="string"&&Number.isInteger(s.sequence)&&Number(s.sequence)>0&&typeof s.timestamp=="string"&&!!s.scope&&typeof s.scope?.id=="string"&&typeof s.scope?.label=="string"&&["ephemeral-project","project","workspace"].includes(String(s.scope?.kind))&&typeof s.scope?.portable=="boolean"&&b.includes(s.kind)&&c.includes(s.status)&&(s.attempt===void 0||Number.isInteger(s.attempt)&&s.attempt>0)&&(s.origin===void 0||typeof s.origin.id=="string"&&typeof s.origin.label=="string"&&["project","workspace-root"].includes(s.origin.kind))&&typeof s.message=="string"}function R(n,s){try{let o=m.statSync(n).size,a;if(o<=E+w)a=m.readFileSync(n,"utf8");else {let t=m.openSync(n,"r");try{let r=Buffer.allocUnsafe(E),d=Buffer.allocUnsafe(w),e=m.readSync(t,r,0,r.length,0),i=Math.max(0,o-d.length),p=m.readSync(t,d,0,d.length,i),c=r.subarray(0,e).toString("utf8"),u=d.subarray(0,p).toString("utf8"),l=u.indexOf(`
2
- `),g=l>=0?u.slice(l+1):"";a=`${c.endsWith(`
3
- `)?c:`${c}
4
- `}${g}`,s.push(`Bounded replay window applied to ${y.basename(n)}.`);}finally{m.closeSync(t);}}return a.split(/\r?\n/).filter(Boolean).flatMap(t=>{try{let r=JSON.parse(t);return N(r)?[r]:[]}catch{return s.push(`Ignored an incomplete activity record in ${y.basename(n)}.`),[]}})}catch(o){return s.push(`Unable to read ${y.basename(n)}: ${o instanceof Error?o.message:String(o)}`),[]}}function W(n,s,o){let a=s.get(n.fromBlockId),t=s.get(n.toBlockId);return !a||!t?"planned":t.status!=="planned"?t.status:o!=="running"&&o!=="planned"?"skipped":a.status==="succeeded"||a.status==="warned"?"running":a.status==="failed"?"failed":a.status==="blocked"?"blocked":a.status==="cancelled"?"cancelled":"planned"}function O(n){let s=e(n.targetPath??process.cwd(),{env:n.env}),o=[],a=y.join(s.statePath,"runs"),t=[];try{t=m.readdirSync(a,{withFileTypes:true}).filter(e=>e.isFile()&&e.name.endsWith(".ndjson")).map(e=>{let i=y.join(a,e.name);return {name:e.name,mtimeMs:m.statSync(i).mtimeMs}}).sort((e,i)=>i.mtimeMs-e.mtimeMs);}catch(e){e.code!=="ENOENT"&&o.push(e instanceof Error?e.message:String(e));}n.runId&&(t=t.filter(e=>e.name===`${n.runId}.ndjson`)),t=t.slice(0,Math.max(1,n.maxRuns??25));let r=t.flatMap(e=>R(y.join(a,e.name),o)).sort((e,i)=>e.timestamp.localeCompare(i.timestamp)||e.sequence-i.sequence),d=Math.max(100,n.maxEvents??2e4);return {resolvedScope:s,events:r.slice(-d),diagnostics:o}}function f(n){let s=new Map,o=new Map,a=new Map;for(let t of n.events){let r=s.get(t.runId);if(!r){let d=Array.isArray(t.attributes?.command)?t.attributes.command.filter(e=>typeof e=="string"):[];r={runId:t.runId,...t.parentRunId?{parentRunId:t.parentRunId}:{},...Number.isInteger(Number(t.attributes?.pid))&&Number(t.attributes?.pid)>0?{pid:Number(t.attributes?.pid)}:{},...t.origin?{origin:t.origin}:{},command:d,status:t.status,startedAt:t.timestamp,updatedAt:t.timestamp,blocks:[],edges:[],touches:[],artifacts:[],warnings:[]},s.set(t.runId,r),o.set(t.runId,new Map),a.set(t.runId,new Map);}if(r.updatedAt=t.timestamp,t.kind.startsWith("run.")){if(r.status=t.status,t.kind==="run.started"&&Array.isArray(t.attributes?.command)){let e=t.attributes?.command;r.command=e.filter(i=>typeof i=="string");}let d=Number(t.attributes?.pid);t.kind==="run.started"&&Number.isInteger(d)&&d>0&&(r.pid=d),t.origin&&(r.origin=t.origin),t.durationMs!==void 0&&(r.durationMs=t.durationMs);}if(t.blockId&&t.kind.startsWith("block.")){let d=o.get(t.runId),e=d.get(t.blockId),i=Number(t.attributes?.order),p=e?.attempt??0,c=t.kind==="block.planned"||t.kind==="block.skipped"&&p===0?void 0:t.kind==="block.started"&&e?.status!=="running"?p+1:Math.max(1,p),u=t.attempt??c,l=[...e?.attempts??[]];if(u!==void 0){let g=l.findIndex(B=>B.attempt===u),v=g>=0?l[g]:void 0,b={attempt:u,status:t.status,startedAt:v?.startedAt??t.timestamp,updatedAt:t.timestamp,...t.progress?{progress:t.progress}:v?.progress?{progress:v.progress}:{},...t.durationMs!==void 0?{durationMs:t.durationMs}:v?.durationMs!==void 0?{durationMs:v.durationMs}:{}};g>=0?l[g]=b:l.push(b);}d.set(t.blockId,{id:t.blockId,label:t.kind==="block.planned"||!e?t.message||t.blockId:e.label,status:t.status,order:Number.isFinite(i)?i:e?.order??d.size+1,...t.parentSpanId?{parentId:t.parentSpanId}:e?.parentId?{parentId:e.parentId}:{},...t.progress?{progress:t.progress}:e?.progress?{progress:e.progress}:{},...t.durationMs!==void 0?{durationMs:t.durationMs}:e?.durationMs!==void 0?{durationMs:e.durationMs}:{},...typeof t.attributes?.layoutHint=="string"?{layoutHint:t.attributes.layoutHint}:e?.layoutHint?{layoutHint:e.layoutHint}:{},...typeof t.attributes?.group=="string"?{group:t.attributes.group}:e?.group?{group:e.group}:{},updatedAt:t.timestamp,...u!==void 0?{attempt:u}:e?.attempt?{attempt:e.attempt}:{},attempts:l});}if(t.kind==="edge.declared"&&t.edge){let d=a.get(t.runId),e=Number(t.attributes?.order);d.set(t.edge.id,{id:t.edge.id,fromBlockId:t.edge.fromBlockId,toBlockId:t.edge.toBlockId,kind:t.edge.kind,status:"planned",order:Number.isFinite(e)?e:d.size+1,updatedAt:t.timestamp});}(t.kind==="touch.observed"||t.kind==="touch.planned")&&(r.touches.push({locator:t.target?.locator??t.message,...t.target?.operation?{operation:t.target.operation}:{},at:t.timestamp}),r.touches=r.touches.slice(-20)),t.kind==="artifact.published"&&(r.artifacts.push({locator:t.target?.locator??t.message,at:t.timestamp}),r.artifacts=r.artifacts.slice(-20)),t.kind==="warning.detected"&&(r.warnings.push(t.message),r.warnings=r.warnings.slice(-20));}for(let[t,r]of s){r.blocks=[...o.get(t)?.values()??[]].sort((e,i)=>e.order-i.order||e.id.localeCompare(i.id));let d=o.get(t)??new Map;r.edges=[...a.get(t)?.values()??[]].map(e=>({...e,status:W(e,d,r.status),updatedAt:d.get(e.toBlockId)?.updatedAt??d.get(e.fromBlockId)?.updatedAt??e.updatedAt})).sort((e,i)=>e.order-i.order||e.id.localeCompare(i.id));}return {schemaVersion:_,generatedAt:new Date().toISOString(),scope:n.resolvedScope.scope,runs:[...s.values()].sort((t,r)=>r.updatedAt.localeCompare(t.updatedAt)),diagnostics:[...n.diagnostics??[]]}}function Q(n){let s=Math.max(0,Math.min(n.events.length,Math.floor(n.eventCount)));return f({resolvedScope:n.resolvedScope,events:n.events.slice(0,s),diagnostics:n.diagnostics})}function P(n){try{return process.kill(n,0),true}catch(s){return s.code==="EPERM"}}function x(n,s=P){return {...n,runs:n.runs.map(o=>{if(o.status!=="running"||!o.pid||s(o.pid))return o;let a=Date.parse(o.updatedAt),t=Date.parse(o.startedAt);return {...o,status:"cancelled",orphaned:true,durationMs:Number.isFinite(a)&&Number.isFinite(t)?Math.max(0,a-t):o.durationMs,blocks:o.blocks.map(r=>({...r,status:r.status==="running"?"cancelled":r.status==="planned"?"skipped":r.status,attempts:r.attempts.map((d,e,i)=>e===i.length-1&&d.status==="running"?{...d,status:"cancelled"}:d)})),edges:o.edges.map(r=>({...r,status:r.status==="running"?"cancelled":r.status==="planned"?"skipped":r.status}))}})}}function H(n){let s=[];try{s=m.readdirSync(n.stateHome,{withFileTypes:true}).filter(e=>e.isDirectory()).flatMap(e=>{let i=y.join(n.stateHome,e.name,"runs");try{return [{path:i,mtimeMs:m.statSync(i).mtimeMs}]}catch{return []}}).sort((e,i)=>i.mtimeMs-e.mtimeMs).slice(0,Math.min(200,Math.max(16,n.maxScopes*4)));}catch(e){e.code!=="ENOENT"&&n.diagnostics.push(e instanceof Error?e.message:String(e));}let o=s.flatMap(e=>{try{return m.readdirSync(e.path,{withFileTypes:true}).filter(i=>i.isFile()&&i.name.endsWith(".ndjson")&&(!n.runId||i.name===`${n.runId}.ndjson`)).map(i=>{let p=y.join(e.path,i.name);return {filePath:p,mtimeMs:m.statSync(p).mtimeMs}})}catch{return []}}).sort((e,i)=>i.mtimeMs-e.mtimeMs).slice(0,Math.max(n.maxRuns*4,n.maxScopes*2)),a=new Map;for(let e of o)for(let i of R(e.filePath,n.diagnostics))a.has(i.eventId)||a.set(i.eventId,i);let t=[...a.values()].sort((e,i)=>e.timestamp.localeCompare(i.timestamp)||e.sequence-i.sequence),r=[...new Set([...t].reverse().map(e=>e.runId))].slice(0,n.maxRuns),d=new Set(r);return t.filter(e=>d.has(e.runId))}function X(n={}){let s=[],o=Math.max(1,Math.min(100,n.maxRuns??12)),a=Math.max(1,Math.min(50,n.maxScopes??12)),t=H({stateHome:d(n.env),runId:n.runId,maxRuns:o,maxScopes:a,diagnostics:s}),r=Math.max(100,Math.min(5e5,n.maxEvents??5e4));t=t.slice(-r);let d$1=new Map;for(let i of t){let p=d$1.get(i.scope.id)??{scope:i.scope,events:[]};p.events.push(i),d$1.set(i.scope.id,p);}let e=[...d$1.values()].map(i=>x(f({resolvedScope:{scope:i.scope},events:i.events}))).sort((i,p)=>(p.runs[0]?.updatedAt??"").localeCompare(i.runs[0]?.updatedAt??"")||i.scope.label.localeCompare(p.scope.label)).slice(0,a);return {schemaVersion:T,generatedAt:new Date().toISOString(),scopes:e,diagnostics:s}}function Z(n={}){let s=O(n);return x(f({resolvedScope:s.resolvedScope,events:s.events,diagnostics:s.diagnostics}))}function tt(n={}){let s=e(n.targetPath??process.cwd(),{env:n.env}),o=y.join(s.statePath,"runs");return i(o,{maxRuns:n.maxRuns,maxAgeDays:n.maxAgeDays})}var L=new Set(["planned","running"]),j="workspace-activity-board.v1";function $(n){return L.has(n)}function F(n){return n.command.length>0?`workspai ${n.command.join(" ")}`:`run ${n.runId.slice(0,8)}`}function J(n){return n.slice(1).map((s,o)=>{let a=n[o];return {id:`inferred:${a.id}->${s.id}`,fromBlockId:a.id,toBlockId:s.id,kind:s.layoutHint==="gate"?"gate":s.layoutHint==="sink"?"handoff":"sequence",status:D(a.status,s.status),order:o+1,updatedAt:s.updatedAt,inferred:true}})}function D(n,s){return s!=="planned"?s:n==="succeeded"||n==="warned"?"running":n==="failed"||n==="blocked"||n==="cancelled"?n:"planned"}function Y(n,s,o){let a=[...n.blocks].sort((e,i)=>e.order-i.order||e.id.localeCompare(i.id)),t=a.some(e=>e.parentId),r=a.filter(e=>!t||!!e.parentId).map(e=>({...e,root:!e.parentId})),d=n.edges.length>0?n.edges.map(e=>({...e,inferred:false})):J(r);return {run:n,commandLabel:F(n),active:n.status==="running",nodes:r,edges:d,activeBlockCount:r.filter(e=>e.status==="running").length,warningCount:n.warnings.length+r.filter(e=>e.status==="warned").length,scope:s,locationLabel:n.origin&&(n.origin.label!==s.label||o.originLabel!==n.origin.label)?`${o.scopeLabel}/${o.originLabel}`:o.scopeLabel}}function st(n,s={}){let o=Math.max(1,s.maxRuns??6),a=n.schemaVersion==="workspace-activity-monitor-fleet.v1",t=a?n.scopes:[n],r=new Map,d=new Map;for(let c of t){let u=r.get(c.scope.label)??new Set;u.add(c.scope.id),r.set(c.scope.label,u);for(let l of c.runs){if(!l.origin)continue;let g=`${c.scope.id}\0${l.origin.label}`,v=d.get(g)??new Set;v.add(l.origin.id),d.set(g,v);}}let e=t.flatMap(c=>c.runs.map(u=>{let l=(r.get(c.scope.label)?.size??0)>1?`${c.scope.label}#${c.scope.id.slice(-4)}`:c.scope.label,g=u.origin?`${c.scope.id}\0${u.origin.label}`:void 0,v=u.origin?(d.get(g??"")?.size??0)>1?`${u.origin.label}#${u.origin.id.slice(-4)}`:u.origin.label:void 0;return Y(u,c.scope,{scopeLabel:l,originLabel:v})})).sort((c,u)=>c.active!==u.active?c.active?-1:1:u.run.updatedAt.localeCompare(c.run.updatedAt)),i=(s.activeOnly?e.filter(c=>c.active):e).slice(0,o),p=i.find(c=>c.run.runId===s.selectedRunId)?.run.runId??i.find(c=>c.active)?.run.runId??i[0]?.run.runId;return {schemaVersion:j,scopeLabel:a?"Global activity":t[0]?.scope.label??"activity",generatedAt:n.generatedAt,activeRunCount:e.filter(c=>c.active).length,healthyRunCount:e.filter(c=>c.run.status==="succeeded").length,warningRunCount:e.filter(c=>c.run.status==="warned"||c.warningCount>0).length,failedRunCount:e.filter(c=>c.run.status==="failed").length,...p?{selectedRunId:p}:{},runs:i,diagnostics:a?[...n.diagnostics,...t.flatMap(c=>c.diagnostics)]:n.diagnostics,global:a,scopeCount:t.length}}function it(n,s,o){return n.edges.find(a=>a.fromBlockId===s&&a.toBlockId===o)}function rt(n){return n.runs.map(s=>s.run.runId)}function ot(n){return n.runs.some(s=>s.active||s.nodes.some(o=>$(o.status))||s.edges.some(o=>o.status==="running"))}export{_ as a,T as b,O as c,Q as d,X as e,Z as f,tt as g,j as h,st as i,it as j,rt as k,ot as l};
@@ -1 +0,0 @@
1
- export{a as WORKSPACE_GRAPH_TOKEN_EFFICIENCY_SCHEMA_VERSION,b as buildWorkspaceGraphTokenEfficiencyReport}from'./chunk-2RPFCBS4.js';
@@ -1 +0,0 @@
1
- export{a as readWorkspaceKnowledgeGraphSnapshot}from'./chunk-ENZPM52J.js';
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-Y35VLVF6.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-OCNPOYMA.js';