workspai 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/contracts/agent-customization-pack.v1.json +4 -2
- package/contracts/analyze-last-run.v1.json +9 -1
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +113 -0
- package/contracts/extension-cli-compatibility.v1.json +2 -0
- package/contracts/published-contract-catalog.v1.json +10 -0
- package/contracts/runtime-command-surface.v1.json +47 -2
- package/contracts/workspace-activity-event.v1.json +132 -0
- package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
- package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
- package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
- package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
- package/dist/analyze-UJQWGNM2.js +1 -0
- package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
- package/dist/autopilot-release-U6F4M2BQ.js +1 -0
- package/dist/capabilities-command-XUKPO25Z.js +1 -0
- package/dist/chunk-2LIVMG5C.js +2 -0
- package/dist/{chunk-XGE2FDI4.js → chunk-2PACEMNE.js} +1 -1
- package/dist/chunk-334J2KIP.js +7 -0
- package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
- package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
- package/dist/chunk-4XEH3WNV.js +13 -0
- package/dist/chunk-5OA33JH2.js +2 -0
- package/dist/chunk-5TY74LLW.js +2 -0
- package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
- package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
- package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
- package/dist/chunk-6UNATTB7.js +1 -0
- package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
- package/dist/chunk-7FF5EOIO.js +2 -0
- package/dist/{chunk-D5YJOQYK.js → chunk-AP4PV6WJ.js} +1 -1
- package/dist/chunk-AXUA7PFV.js +2 -0
- package/dist/chunk-B4IVVTMQ.js +2 -0
- package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
- package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
- package/dist/chunk-DUBOKZMA.js +49 -0
- package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
- package/dist/{chunk-2RL6RRT2.js → chunk-EHH4SKVH.js} +50 -50
- package/dist/chunk-EP4CUWOO.js +9 -0
- package/dist/chunk-FY4X2VOE.js +39 -0
- package/dist/chunk-GAYK3WGV.js +2 -0
- package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
- package/dist/{chunk-YN5X2FTP.js → chunk-H7MRINGP.js} +1 -1
- package/dist/chunk-HJLGXFMK.js +1 -0
- package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
- package/dist/{chunk-HDNATYW7.js → chunk-IIFFEEMX.js} +1 -1
- package/dist/chunk-IVF6NEHS.js +1 -0
- package/dist/chunk-JC4XSU7G.js +1 -0
- package/dist/chunk-JRP6WP5C.js +681 -0
- package/dist/chunk-JZJBA2V2.js +1 -0
- package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
- package/dist/chunk-L5Q2S5GY.js +3 -0
- package/dist/chunk-LPCZHKD5.js +1 -0
- package/dist/chunk-MZ7U4BIQ.js +157 -0
- package/dist/chunk-NMXGSVMD.js +1 -0
- package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
- package/dist/chunk-O37UBRMX.js +4 -0
- package/dist/chunk-OI2VOU6S.js +1 -0
- package/dist/chunk-PD7Y6HIM.js +2 -0
- package/dist/chunk-PJPS7CNH.js +1 -0
- package/dist/chunk-QGAPGZPL.js +97 -0
- package/dist/chunk-R2M5OJOK.js +5 -0
- package/dist/chunk-SX6A656X.js +1 -0
- package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
- package/dist/chunk-TTHO4MFC.js +2 -0
- package/dist/chunk-U5ENEDJA.js +7 -0
- package/dist/chunk-UOCERSAN.js +1 -0
- package/dist/chunk-UPIPSSXY.js +1 -0
- package/dist/chunk-UTV4DTNM.js +1 -0
- package/dist/chunk-VA5VSOBL.js +2 -0
- package/dist/chunk-VQOWB26M.js +12 -0
- package/dist/chunk-VQZ5PI5J.js +1 -0
- package/dist/chunk-WTWRSEOW.js +1 -0
- package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
- package/dist/{chunk-YYQEWAES.js → chunk-XQFWUM2P.js} +1 -1
- package/dist/chunk-XWKGZRHN.js +1 -0
- package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
- package/dist/chunk-ZQH2I5RQ.js +1 -0
- package/dist/{create-ALT2ME6H.js → create-SOLLXXAB.js} +1 -1
- package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
- package/dist/{doctor-RW4R3O5C.js → doctor-NQ5PUCUP.js} +1 -1
- package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
- package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-IPNY7KNR.js} +1 -1
- package/dist/goal-pack-2WV3EA4Y.js +1 -0
- package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
- package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +170 -170
- package/dist/live-command-Q6E45N7S.js +18 -0
- package/dist/{pipeline-U4N2DVD7.js → pipeline-MIMENSI7.js} +1 -1
- package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
- package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
- package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
- package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
- package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
- package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
- package/dist/verified-goal-46JWNCDY.js +1 -0
- package/dist/{workspace-HGUZWNAB.js → workspace-KO37XHF6.js} +1 -1
- package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-32FIJQBH.js} +1 -1
- package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
- package/dist/{workspace-context-4WIWFW26.js → workspace-context-JKRPX775.js} +1 -1
- package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-4T3NYNK5.js} +1 -1
- package/dist/workspace-explain-MOGL4GEA.js +1 -0
- package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
- package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
- package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-GHWO3BZU.js} +1 -1
- package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-PTVS47NJ.js} +1 -1
- package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
- package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
- package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-PJIPTXL3.js} +1 -1
- package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
- package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
- package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
- package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
- package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-VANN7RCA.js} +1 -1
- package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
- package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
- package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
- package/dist/workspace-model-VSVKLX7M.js +1 -0
- package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
- package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
- package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
- package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
- package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
- package/dist/workspace-run-3BXKTLVL.js +1 -0
- package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-EJCSOBIK.js} +1 -1
- package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-JTIFBF4Z.js} +1 -1
- package/docs/SETUP.md +10 -0
- package/docs/agent-entry.md +22 -7
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +41 -7
- package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
- package/docs/contracts/README.md +4 -3
- package/docs/real-world-qualification.md +19 -3
- package/docs/workspace-knowledge-graph.md +95 -27
- package/docs/workspace-live-activity.md +199 -0
- package/docs/workspace-operations.md +32 -9
- package/package.json +1 -1
- package/dist/analyze-5PDVWECJ.js +0 -1
- package/dist/autopilot-release-JVIJCTKX.js +0 -1
- package/dist/capabilities-command-LHM3XIS6.js +0 -1
- package/dist/chunk-2647BYBC.js +0 -1
- package/dist/chunk-27UR373Z.js +0 -1
- package/dist/chunk-2C5ZBVBI.js +0 -2
- package/dist/chunk-6JWNDWOA.js +0 -1
- package/dist/chunk-CCDGHPEJ.js +0 -2
- package/dist/chunk-DFG33SBR.js +0 -2
- package/dist/chunk-FY4IIAIF.js +0 -1
- package/dist/chunk-HEZZ72V4.js +0 -94
- package/dist/chunk-HN7P4T3B.js +0 -681
- package/dist/chunk-ILIBOMYL.js +0 -1
- package/dist/chunk-J7QYANXK.js +0 -8
- package/dist/chunk-JD3A5QM6.js +0 -2
- package/dist/chunk-JQLJBK5N.js +0 -1
- package/dist/chunk-KLSSPJTV.js +0 -1
- package/dist/chunk-L22EABIC.js +0 -7
- package/dist/chunk-MDTI3UEB.js +0 -1
- package/dist/chunk-MOSXTVPU.js +0 -1
- package/dist/chunk-MYJQGGIU.js +0 -5
- package/dist/chunk-NOV6723U.js +0 -1
- package/dist/chunk-NYEAMMUL.js +0 -1
- package/dist/chunk-NZ3WZYD5.js +0 -1
- package/dist/chunk-O5B2L3R2.js +0 -1
- package/dist/chunk-OWB5KWSS.js +0 -13
- package/dist/chunk-P5PSZQPB.js +0 -2
- package/dist/chunk-QI3HG6IG.js +0 -144
- package/dist/chunk-SWGSFLTC.js +0 -1
- package/dist/chunk-THIOE2PB.js +0 -2
- package/dist/chunk-U5FCQTVL.js +0 -4
- package/dist/chunk-UXEO5QCF.js +0 -33
- package/dist/chunk-VR6XMUF3.js +0 -2
- package/dist/chunk-VVJK5NFY.js +0 -2
- package/dist/chunk-VXKWWX7S.js +0 -8
- package/dist/chunk-W322YDHS.js +0 -49
- package/dist/chunk-WPRLXKWC.js +0 -8
- package/dist/chunk-Y5YAP4F3.js +0 -2
- package/dist/chunk-YOCN7GF4.js +0 -1
- package/dist/goal-pack-YWPI43QL.js +0 -1
- package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
- package/dist/verified-goal-WM34TTGE.js +0 -1
- package/dist/workspace-explain-TE2LGOAV.js +0 -1
- package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
- package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
- package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
- package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
- package/dist/workspace-model-ZL6WCICX.js +0 -1
- package/dist/workspace-repair-engine-NX7I632M.js +0 -3
- package/dist/workspace-run-6GT5OBQ5.js +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {e,i,d,a,b,c}from'./chunk-UTV4DTNM.js';import _ from'path';import B from'fs';var kt=64*1024,Et=1024*1024;function Jt(t){if(!t||typeof t!="object")return false;let e=t;return e.schemaVersion===a&&typeof e.eventId=="string"&&typeof e.runId=="string"&&Number.isInteger(e.sequence)&&Number(e.sequence)>0&&typeof e.timestamp=="string"&&!!e.scope&&typeof e.scope?.id=="string"&&typeof e.scope?.label=="string"&&["ephemeral-project","project","workspace"].includes(String(e.scope?.kind))&&typeof e.scope?.portable=="boolean"&&b.includes(e.kind)&&c.includes(e.status)&&(e.attempt===void 0||Number.isInteger(e.attempt)&&e.attempt>0)&&(e.origin===void 0||typeof e.origin.id=="string"&&typeof e.origin.label=="string"&&["project","workspace-root"].includes(e.origin.kind))&&typeof e.message=="string"}function Ct(t,e){try{let r=B.statSync(t).size,o;if(r<=kt+Et)o=B.readFileSync(t,"utf8");else {let n=B.openSync(t,"r");try{let s=Buffer.allocUnsafe(kt),a=Buffer.allocUnsafe(Et),i=B.readSync(n,s,0,s.length,0),c=Math.max(0,r-a.length),d=B.readSync(n,a,0,a.length,c),u=s.subarray(0,i).toString("utf8"),l=a.subarray(0,d).toString("utf8"),p=l.indexOf(`
|
|
2
|
+
`),f=p>=0?l.slice(p+1):"";o=`${u.endsWith(`
|
|
3
|
+
`)?u:`${u}
|
|
4
|
+
`}${f}`,e.push(`Bounded replay window applied to ${_.basename(t)}.`);}finally{B.closeSync(n);}}return o.split(/\r?\n/).filter(Boolean).flatMap(n=>{try{let s=JSON.parse(n);return Jt(s)?[s]:[]}catch{return e.push(`Ignored an incomplete activity record in ${_.basename(t)}.`),[]}})}catch(r){return e.push(`Unable to read ${_.basename(t)}: ${r instanceof Error?r.message:String(r)}`),[]}}function Kt(t,e,r){let o=e.get(t.fromBlockId),n=e.get(t.toBlockId);return !o||!n?"planned":n.status!=="planned"?n.status:r!=="running"&&r!=="planned"?"skipped":o.status==="succeeded"||o.status==="warned"?"running":o.status==="failed"?"failed":o.status==="blocked"?"blocked":o.status==="cancelled"?"cancelled":"planned"}function gt(t){let e$1=e(t.targetPath??process.cwd(),{env:t.env}),r=[],o=_.join(e$1.statePath,"runs"),n=[];try{n=B.readdirSync(o,{withFileTypes:true}).filter(i=>i.isFile()&&i.name.endsWith(".ndjson")).map(i=>{let c=_.join(o,i.name);return {name:i.name,mtimeMs:B.statSync(c).mtimeMs}}).sort((i,c)=>c.mtimeMs-i.mtimeMs);}catch(i){i.code!=="ENOENT"&&r.push(i instanceof Error?i.message:String(i));}t.runId&&(n=n.filter(i=>i.name===`${t.runId}.ndjson`)),n=n.slice(0,Math.max(1,t.maxRuns??25));let s=n.flatMap(i=>Ct(_.join(o,i.name),r)).sort((i,c)=>i.timestamp.localeCompare(c.timestamp)||i.sequence-c.sequence),a=Math.max(100,t.maxEvents??2e4);return {resolvedScope:e$1,events:s.slice(-a),diagnostics:r}}function yt(t){let e=new Map,r=new Map,o=new Map;for(let n of t.events){let s=e.get(n.runId);if(!s){let a=Array.isArray(n.attributes?.command)?n.attributes.command.filter(i=>typeof i=="string"):[];s={runId:n.runId,...n.parentRunId?{parentRunId:n.parentRunId}:{},...Number.isInteger(Number(n.attributes?.pid))&&Number(n.attributes?.pid)>0?{pid:Number(n.attributes?.pid)}:{},...n.origin?{origin:n.origin}:{},command:a,status:n.status,startedAt:n.timestamp,updatedAt:n.timestamp,blocks:[],edges:[],touches:[],artifacts:[],warnings:[]},e.set(n.runId,s),r.set(n.runId,new Map),o.set(n.runId,new Map);}if(s.updatedAt=n.timestamp,n.kind.startsWith("run.")){if(s.status=n.status,n.kind==="run.started"&&Array.isArray(n.attributes?.command)){let i=n.attributes?.command;s.command=i.filter(c=>typeof c=="string");}let a=Number(n.attributes?.pid);n.kind==="run.started"&&Number.isInteger(a)&&a>0&&(s.pid=a),n.origin&&(s.origin=n.origin),n.durationMs!==void 0&&(s.durationMs=n.durationMs);}if(n.blockId&&n.kind.startsWith("block.")){let a=r.get(n.runId),i=a.get(n.blockId),c=Number(n.attributes?.order),d=i?.attempt??0,u=n.kind==="block.planned"||n.kind==="block.skipped"&&d===0?void 0:n.kind==="block.started"&&i?.status!=="running"?d+1:Math.max(1,d),l=n.attempt??u,p=[...i?.attempts??[]];if(l!==void 0){let f=p.findIndex(h=>h.attempt===l),m=f>=0?p[f]:void 0,v={attempt:l,status:n.status,startedAt:m?.startedAt??n.timestamp,updatedAt:n.timestamp,...n.progress?{progress:n.progress}:m?.progress?{progress:m.progress}:{},...n.durationMs!==void 0?{durationMs:n.durationMs}:m?.durationMs!==void 0?{durationMs:m.durationMs}:{}};f>=0?p[f]=v:p.push(v);}a.set(n.blockId,{id:n.blockId,label:n.kind==="block.planned"||!i?n.message||n.blockId:i.label,status:n.status,order:Number.isFinite(c)?c:i?.order??a.size+1,...n.parentSpanId?{parentId:n.parentSpanId}:i?.parentId?{parentId:i.parentId}:{},...n.progress?{progress:n.progress}:i?.progress?{progress:i.progress}:{},...n.durationMs!==void 0?{durationMs:n.durationMs}:i?.durationMs!==void 0?{durationMs:i.durationMs}:{},...typeof n.attributes?.layoutHint=="string"?{layoutHint:n.attributes.layoutHint}:i?.layoutHint?{layoutHint:i.layoutHint}:{},...typeof n.attributes?.group=="string"?{group:n.attributes.group}:i?.group?{group:i.group}:{},updatedAt:n.timestamp,...l!==void 0?{attempt:l}:i?.attempt?{attempt:i.attempt}:{},attempts:p});}if(n.kind==="edge.declared"&&n.edge){let a=o.get(n.runId),i=Number(n.attributes?.order);a.set(n.edge.id,{id:n.edge.id,fromBlockId:n.edge.fromBlockId,toBlockId:n.edge.toBlockId,kind:n.edge.kind,status:"planned",order:Number.isFinite(i)?i:a.size+1,updatedAt:n.timestamp});}(n.kind==="touch.observed"||n.kind==="touch.planned")&&(s.touches.push({locator:n.target?.locator??n.message,...n.target?.operation?{operation:n.target.operation}:{},at:n.timestamp}),s.touches=s.touches.slice(-20)),n.kind==="artifact.published"&&(s.artifacts.push({locator:n.target?.locator??n.message,at:n.timestamp}),s.artifacts=s.artifacts.slice(-20)),n.kind==="warning.detected"&&(s.warnings.push(n.message),s.warnings=s.warnings.slice(-20));}for(let[n,s]of e){s.blocks=[...r.get(n)?.values()??[]].sort((i,c)=>i.order-c.order||i.id.localeCompare(c.id));let a=r.get(n)??new Map;s.edges=[...o.get(n)?.values()??[]].map(i=>({...i,status:Kt(i,a,s.status),updatedAt:a.get(i.toBlockId)?.updatedAt??a.get(i.fromBlockId)?.updatedAt??i.updatedAt})).sort((i,c)=>i.order-c.order||i.id.localeCompare(c.id));}return {schemaVersion:"workspace-activity-monitor-snapshot.v1",generatedAt:new Date().toISOString(),scope:t.resolvedScope.scope,runs:[...e.values()].sort((n,s)=>s.updatedAt.localeCompare(n.updatedAt)),diagnostics:[...t.diagnostics??[]]}}function Tt(t){let e=Math.max(0,Math.min(t.events.length,Math.floor(t.eventCount)));return yt({resolvedScope:t.resolvedScope,events:t.events.slice(0,e),diagnostics:t.diagnostics})}function Xt(t){try{return process.kill(t,0),true}catch(e){return e.code==="EPERM"}}function Bt(t,e=Xt){return {...t,runs:t.runs.map(r=>{if(r.status!=="running"||!r.pid||e(r.pid))return r;let o=Date.parse(r.updatedAt),n=Date.parse(r.startedAt);return {...r,status:"cancelled",orphaned:true,durationMs:Number.isFinite(o)&&Number.isFinite(n)?Math.max(0,o-n):r.durationMs,blocks:r.blocks.map(s=>({...s,status:s.status==="running"?"cancelled":s.status==="planned"?"skipped":s.status,attempts:s.attempts.map((a,i,c)=>i===c.length-1&&a.status==="running"?{...a,status:"cancelled"}:a)})),edges:r.edges.map(s=>({...s,status:s.status==="running"?"cancelled":s.status==="planned"?"skipped":s.status}))}})}}function Qt(t){let e=[];try{e=B.readdirSync(t.stateHome,{withFileTypes:true}).filter(i=>i.isDirectory()).flatMap(i=>{let c=_.join(t.stateHome,i.name,"runs");try{return [{path:c,mtimeMs:B.statSync(c).mtimeMs}]}catch{return []}}).sort((i,c)=>c.mtimeMs-i.mtimeMs).slice(0,Math.min(200,Math.max(16,t.maxScopes*4)));}catch(i){i.code!=="ENOENT"&&t.diagnostics.push(i instanceof Error?i.message:String(i));}let r=e.flatMap(i=>{try{return B.readdirSync(i.path,{withFileTypes:true}).filter(c=>c.isFile()&&c.name.endsWith(".ndjson")&&(!t.runId||c.name===`${t.runId}.ndjson`)).map(c=>{let d=_.join(i.path,c.name);return {filePath:d,mtimeMs:B.statSync(d).mtimeMs}})}catch{return []}}).sort((i,c)=>c.mtimeMs-i.mtimeMs).slice(0,Math.max(t.maxRuns*4,t.maxScopes*2)),o=new Map;for(let i of r)for(let c of Ct(i.filePath,t.diagnostics))o.has(c.eventId)||o.set(c.eventId,c);let n=[...o.values()].sort((i,c)=>i.timestamp.localeCompare(c.timestamp)||i.sequence-c.sequence),s=[...new Set([...n].reverse().map(i=>i.runId))].slice(0,t.maxRuns),a=new Set(s);return n.filter(i=>a.has(i.runId))}function Lt(t={}){let e=[],r=Math.max(1,Math.min(100,t.maxRuns??12)),o=Math.max(1,Math.min(50,t.maxScopes??12)),n=Qt({stateHome:d(t.env),runId:t.runId,maxRuns:r,maxScopes:o,diagnostics:e}),s=Math.max(100,Math.min(5e5,t.maxEvents??5e4));n=n.slice(-s);let a=new Map;for(let c of n){let d=a.get(c.scope.id)??{scope:c.scope,events:[]};d.events.push(c),a.set(c.scope.id,d);}let i=[...a.values()].map(c=>Bt(yt({resolvedScope:{scope:c.scope},events:c.events}))).sort((c,d)=>(d.runs[0]?.updatedAt??"").localeCompare(c.runs[0]?.updatedAt??"")||c.scope.label.localeCompare(d.scope.label)).slice(0,o);return {schemaVersion:"workspace-activity-monitor-fleet.v1",generatedAt:new Date().toISOString(),scopes:i,diagnostics:e}}function Pt(t={}){let e=gt(t);return Bt(yt({resolvedScope:e.resolvedScope,events:e.events,diagnostics:e.diagnostics}))}function Ot(t={}){let e$1=e(t.targetPath??process.cwd(),{env:t.env}),r=_.join(e$1.statePath,"runs");return i(r,{maxRuns:t.maxRuns,maxAgeDays:t.maxAgeDays})}var Zt=new Set(["planned","running"]);function te(t){return Zt.has(t)}function ee(t){return t.command.length>0?`workspai ${t.command.join(" ")}`:`run ${t.runId.slice(0,8)}`}function ne(t){return t.slice(1).map((e,r)=>{let o=t[r];return {id:`inferred:${o.id}->${e.id}`,fromBlockId:o.id,toBlockId:e.id,kind:e.layoutHint==="gate"?"gate":e.layoutHint==="sink"?"handoff":"sequence",status:re(o.status,e.status),order:r+1,updatedAt:e.updatedAt,inferred:true}})}function re(t,e){return e!=="planned"?e:t==="succeeded"||t==="warned"?"running":t==="failed"||t==="blocked"||t==="cancelled"?t:"planned"}function ie(t,e,r){let o=[...t.blocks].sort((i,c)=>i.order-c.order||i.id.localeCompare(c.id)),n=o.some(i=>i.parentId),s=o.filter(i=>!n||!!i.parentId).map(i=>({...i,root:!i.parentId})),a=t.edges.length>0?t.edges.map(i=>({...i,inferred:false})):ne(s);return {run:t,commandLabel:ee(t),active:t.status==="running",nodes:s,edges:a,activeBlockCount:s.filter(i=>i.status==="running").length,warningCount:t.warnings.length+s.filter(i=>i.status==="warned").length,scope:e,locationLabel:t.origin&&(t.origin.label!==e.label||r.originLabel!==t.origin.label)?`${r.scopeLabel}/${r.originLabel}`:r.scopeLabel}}function D(t,e={}){let r=Math.max(1,e.maxRuns??6),o=t.schemaVersion==="workspace-activity-monitor-fleet.v1",n=o?t.scopes:[t],s=new Map,a=new Map;for(let u of n){let l=s.get(u.scope.label)??new Set;l.add(u.scope.id),s.set(u.scope.label,l);for(let p of u.runs){if(!p.origin)continue;let f=`${u.scope.id}\0${p.origin.label}`,m=a.get(f)??new Set;m.add(p.origin.id),a.set(f,m);}}let i=n.flatMap(u=>u.runs.map(l=>{let p=(s.get(u.scope.label)?.size??0)>1?`${u.scope.label}#${u.scope.id.slice(-4)}`:u.scope.label,f=l.origin?`${u.scope.id}\0${l.origin.label}`:void 0,m=l.origin?(a.get(f??"")?.size??0)>1?`${l.origin.label}#${l.origin.id.slice(-4)}`:l.origin.label:void 0;return ie(l,u.scope,{scopeLabel:p,originLabel:m})})).sort((u,l)=>u.active!==l.active?u.active?-1:1:l.run.updatedAt.localeCompare(u.run.updatedAt)),c=(e.activeOnly?i.filter(u=>u.active):i).slice(0,r),d=c.find(u=>u.run.runId===e.selectedRunId)?.run.runId??c.find(u=>u.active)?.run.runId??c[0]?.run.runId;return {scopeLabel:o?"Global activity":n[0]?.scope.label??"activity",generatedAt:t.generatedAt,activeRunCount:i.filter(u=>u.active).length,healthyRunCount:i.filter(u=>u.run.status==="succeeded").length,warningRunCount:i.filter(u=>u.run.status==="warned"||u.warningCount>0).length,failedRunCount:i.filter(u=>u.run.status==="failed").length,...d?{selectedRunId:d}:{},runs:c,diagnostics:o?[...t.diagnostics,...n.flatMap(u=>u.diagnostics)]:t.diagnostics,global:o,scopeCount:n.length}}function F(t,e,r){return t.edges.find(o=>o.fromBlockId===e&&o.toBlockId===r)}function Nt(t){return t.runs.map(e=>e.run.runId)}function Wt(t){return t.runs.some(e=>e.active||e.nodes.some(r=>te(r.status))||e.edges.some(r=>r.status==="running"))}var P={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",brightCyan:"\x1B[96m",green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m",magenta:"\x1B[35m"},oe={planned:"\u25CB",running:"\u25C9",succeeded:"\u2713",warned:"!",blocked:"\u2298",failed:"\xD7",cancelled:"\xD7",skipped:"\u2013","rolled-back":"\u21B6"},se={planned:"o",running:"*",succeeded:"+",warned:"!",blocked:"#",failed:"x",cancelled:"x",skipped:"-","rolled-back":"~"};function ht(t){return t.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g,"")}function L(t){return ht(t).replace(/[\u0000-\u001f\u007f-\u009f]/g," ")}function N(t){return [...ht(t)].length}function W(t,e){let r=L(t),o=[...r];return o.length<=e?r:e<=0?"":e===1?"\u2026":`${o.slice(0,e-1).join("")}\u2026`}function x(t,e){return N(t)<=e?t:W(ht(t),e)}function ae(t,e){return t==="running"?e%2===0?P.brightCyan:P.cyan:t==="succeeded"?P.green:t==="warned"||t==="blocked"?P.yellow:t==="failed"||t==="cancelled"?P.red:t==="rolled-back"?P.magenta:P.dim}function O(t,e,r,o){return r?`${ae(e,o)}${t}${P.reset}`:t}function X(t,e){return e?`${P.bold}${P.brightCyan}${t}${P.reset}`:t}function U(t,e){return (e?se:oe)[t]}function ot(t,e){let r=t.durationMs??Math.max(0,e-Date.parse(t.startedAt));if(r<1e3)return `${r}ms`;let o=Math.floor(r/1e3);if(o<60)return `${o}s`;let n=Math.floor(o/60);return n<60?`${n}m ${o%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function H(t){let e=t.progress;return e?e.percent!==void 0?`${Math.round(e.percent)}%`:e.completed!==void 0&&e.total!==void 0?`${e.completed}/${e.total}`:e.iteration!==void 0&&e.iterations!==void 0?`${e.iteration}/${e.iterations}`:"":""}function Q(t,e){return t.attempt&&t.attempt>1?`${e?"R":"\u21BB"}${t.attempt}`:""}function jt(t,e,r){let o=N(t),n=N(e);return o+n+1>r?x(`${t} ${e}`,r):`${t}${" ".repeat(r-o-n)}${e}`}var st={planned:"QUEUE",running:"RUN",succeeded:"DONE",warned:"WARN",blocked:"BLOCK",failed:"FAIL",cancelled:"STOP",skipped:"SKIP","rolled-back":"ROLL"};function it(t,e,r,o){return o?"+":r?{left:"\u252B",right:"\u2523",top:"\u253B",bottom:"\u2533"}[t]:e==="planned"||e==="skipped"?{left:"\u2524",right:"\u251C",top:"\u2534",bottom:"\u252C"}[t]:{left:"\u2525",right:"\u251D",top:"\u2537",bottom:"\u252F"}[t]}function ce(t,e,r){let o=W(e,Math.max(3,Math.floor(r*.6))),n=Math.max(0,r-N(o)-(o?1:0)),s=W(t,n);return `${s}${" ".repeat(Math.max(0,r-N(s)-N(o)))}${o}`}function Vt(t,e,r,o,n){let s=Array.from({length:Math.max(0,o-2)},()=>r);return n&&s.length>0&&(s[Math.floor(s.length/2)]=n),`${t}${s.join("")}${e}`}function de(t,e,r,o){let n=t.status==="running",s=r.ascii?{topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|"}:n?{topLeft:"\u250F",topRight:"\u2513",bottomLeft:"\u2517",bottomRight:"\u251B",horizontal:"\u2501",vertical:"\u2503"}:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502"},a=H(t),i=Q(t,r.ascii),c=[st[t.status],i,a].filter(Boolean).join(" "),d=Vt(s.topLeft,s.topRight,s.horizontal,e,o.top?it("top",o.top,n,r.ascii):void 0),u=`${o.left?it("left",o.left,n,r.ascii):s.vertical}${ce(L(t.label),c,e-2)}${o.right?it("right",o.right,n,r.ascii):s.vertical}`,l=Vt(s.bottomLeft,s.bottomRight,s.horizontal,e,o.bottom?it("bottom",o.bottom,n,r.ascii):void 0);return [d,u,l].map(p=>O(p,t.status,r.color,r.frame))}function ue(t,e,r,o,n,s){let a=Math.max(2,s),i=n?"-":"\u2501",c=n?".":"\u2504";if(t==="running"&&o){let d=n?"=":"\u254D",u=Array.from({length:a},()=>i),l=r%a;return u[e==="right"?l:a-l-1]=d,u.join("")}return t==="planned"||t==="skipped"?c.repeat(a):t==="blocked"||t==="warned"?(n?"~":"\u2505").repeat(a):t==="failed"||t==="cancelled"?(n?"=":"\u254D").repeat(a):i.repeat(a)}function _t(t,e,r,o=7){return t?O(ue(t.status,e,r.frame,r.motion,r.ascii,o),t.status,r.color,r.frame):" ".repeat(o)}function le(t,e,r,o){let n=t?.status??"planned",s=n==="running"&&o.motion,a=n==="planned"||n==="skipped"?o.ascii?":":"\u250A":n==="blocked"||n==="warned"?o.ascii?"~":"\u250B":o.ascii?"|":"\u2503",i=o.ascii?":":"\u254F";return [s&&o.frame%2===0?i:a,s&&o.frame%2===1?i:a].map(d=>O(`${" ".repeat(Math.max(0,e))}${d}`.padEnd(r),n,o.color,o.frame))}function pe(t,e,r){let o=e>=132?9:7,n=t.nodes.length<=2?Math.min(32,e):e>=132?19:e>=100?17:15,s=Math.max(1,Math.floor((e+o)/(n+o))),a=[];for(let c=0;c<t.nodes.length;c+=s)a.push(t.nodes.slice(c,c+s));let i=[];return a.forEach((c,d)=>{let u=d%2===0?"right":"left",l=u==="right"?c:[...c].reverse(),p=a[d+1],f=a[d-1],m=f?F(t,f.at(-1)?.id??"",c[0]?.id??""):void 0,v=p?F(t,c.at(-1)?.id??"",p[0]?.id??""):void 0,h=(y,S)=>u==="right"?F(t,y.id,S.id):F(t,S.id,y.id),E=l.map((y,S)=>{let b=S>0?h(l[S-1],y):void 0,M=S<l.length-1?h(y,l[S+1]):void 0;return de(y,n,r,{...b?{left:b.status}:{},...M?{right:M.status}:{},...m&&y.id===c[0]?.id?{top:m.status}:{},...v&&y.id===c.at(-1)?.id?{bottom:v.status}:{}})});for(let y=0;y<3;y+=1){let S="";l.forEach((b,M)=>{if(S+=E[M][y],M>=l.length-1)return;if(y!==1){S+=" ".repeat(o);return}let k=l[M+1],$=u==="right"?F(t,b.id,k.id):F(t,k.id,b.id);S+=_t($,u,r,o);}),i.push(x(S,e));}if(!p)return;let I=v,w=l.length*n+(l.length-1)*o,T=u==="right"?Math.max(0,w-Math.ceil(n/2)):Math.floor(n/2);i.push(...le(I,T,e,r));}),i}function me(t,e){let r=H(t),o=Q(t,e.ascii),n=`${U(t.status,e.ascii)} ${L(t.label)}${o?` ${o}`:""}${r?` ${r}`:""}`;return O(`[${n}]`,t.status,e.color,e.frame)}function fe(t,e,r,o){if(t.nodes.length===0)return [];let n=[],s="",a=0;for(let[i,c]of t.nodes.entries()){let d=me(c,o),u=t.nodes[i-1],l=u?F(t,u.id,c.id):void 0,p=u?_t(l,"right",o,7):"",f=`${s?p:""}${d}`;if(s&&N(s)+N(f)>e){if(n.push(x(s,e)),n.length>=r)break;s=`${o.ascii?"> ":"\u21B3 "}${d}`;}else s+=f;a=i+1;}if(n.length<r&&s&&n.push(x(s,e)),a<t.nodes.length&&n.length>0){let i=` \u2026 +${t.nodes.length-a}`;n[n.length-1]=x(`${n.at(-1)}${i}`,e);}return n.slice(0,r)}function ge(t,e,r,o){if(t.length===0)return;let n=e>=130?3:e>=92?2:1,s=t.slice(0,n),a="ALSO ACTIVE ",i=s.map(d=>{let u=W(d.commandLabel.replace(/^workspai\s+/,""),24),l=o?`${W(d.locationLabel,20)} \xB7 `:"";return O(`[${U("running",r.ascii)} ${l}${u} \xB7 ${d.run.runId.slice(0,8)}]`,"running",r.color,r.frame)}),c=t.length-s.length;return x(`${a}${i.join(" ")}${c>0?` +${c}`:""}`,e)}function ye(t){let e=t.map(r=>r.status);for(let r of ["failed","cancelled","blocked","warned","running"])if(e.includes(r))return r;return e.length>0&&e.every(r=>r==="succeeded")?"succeeded":e.some(r=>r==="succeeded")?"running":e[0]??"planned"}function he(t,e,r){let o=[...new Set(t.nodes.map(a=>a.group).filter(Boolean))];if(o.length<2)return;let n=r.ascii?" > ":" \u2501 ",s=o.map((a,i)=>{let c=ye(t.nodes.filter(d=>d.group===a));return O(`${String(i+1).padStart(2,"0")} ${W(a,14)}`,c,r.color,r.frame)});return x(`PHASES ${s.join(n)}`,e)}function Dt(t){return [...t.nodes].reverse().find(e=>e.status==="running")??[...t.nodes].reverse().find(e=>["failed","blocked","warned","cancelled"].includes(e.status))??[...t.nodes].sort((e,r)=>r.updatedAt.localeCompare(e.updatedAt))[0]}function ve(t){if(t<1e3)return `${t}ms`;let e=Math.floor(t/1e3);if(e<60)return `${e}s`;let r=Math.floor(e/60);return r<60?`${r}m ${e%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function be(t,e,r,o){let n=Dt(t);if(!n||e<24)return [];let s=o.ascii?"-":"\u2500",a=o.ascii?"|":"\u2502",i=e-2,c=n.attempt??0,d=n.attempts.at(-1)?.startedAt??n.updatedAt,u=n.durationMs??(n.status==="running"?Math.max(0,r-Date.parse(d)):void 0),l=[X("INSPECT",o.color),L(n.label),"",`STATE ${st[n.status]}`,`PHASE ${n.group??"GENERAL"}`,`ATTEMPT ${c>0?`${c}/${Math.max(c,n.attempts.length)}`:"\u2014"}`,`PROGRESS ${H(n)||"\u2014"}`,`ELAPSED ${u===void 0?"\u2014":ve(u)}`,"",`TOUCHES ${t.run.touches.length}`,`ARTIFACTS ${t.run.artifacts.length}`,`WARNINGS ${t.warningCount}`],p=o.ascii?{tl:"+",tr:"+",bl:"+",br:"+"}:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518"};return [`${p.tl}${s.repeat(i)}${p.tr}`,...l.map(f=>{let m=x(f,i);return `${a}${m}${" ".repeat(Math.max(0,i-N(m)))}${a}`}),`${p.bl}${s.repeat(i)}${p.br}`]}function Ae(t,e,r,o=3){return Array.from({length:Math.max(t.length,e.length)},(n,s)=>{let a=x(t[s]??"",r);return `${a}${" ".repeat(Math.max(0,r-N(a))+o)}${e[s]??""}`})}function $e(t,e,r,o,n){let s=[...t.runs.filter(p=>p.active),...t.runs.filter(p=>!p.active&&p.run.runId===e)].filter((p,f,m)=>m.findIndex(v=>v.run.runId===p.run.runId)===f);if(s.length===0)return [];let a=s.slice(0,r>=110?4:2),i=Math.max(12,Math.min(28,Math.floor(r*.24))),c=Math.max(14,Math.min(30,Math.floor(r*.27))),d=Math.max(10,Math.min(20,Math.floor(r*.18))),u=`FLEET ${"LOCATION".padEnd(i)} ${"COMMAND".padEnd(c)} ${"ACTIVE BLOCK".padEnd(d)} STATE`,l=[X(x(u,r),n.color)];for(let p of a){let f=Dt(p),m=p.run.runId===e?n.ascii?">":"\u25C6":" ",v=p.commandLabel.replace(/^workspai\s+/,""),h=`${m} ${W(p.locationLabel,i).padEnd(i)} ${W(v,c).padEnd(c)} ${W(f?.label??"\u2014",d).padEnd(d)} ${st[p.run.status]} \xB7 ${ot(p.run,o)}`;l.push(O(x(h,r),p.run.status,n.color,n.frame));}return s.length>a.length&&l.push(x(` +${s.length-a.length} more runs`,r)),l}function xe(t,e,r,o,n,s){let a=n.ascii?">":"\u25C6",i=s?`${W(t.locationLabel,28)} `:"",c=`RUN ${t.run.runId.slice(0,8).toUpperCase()} ${i}${L(t.commandLabel)}`,d=t.warningCount>0?` \xB7 !${t.warningCount}`:"",u=`${st[t.run.status]} \xB7 ${ot(t.run,o)}${d}`,l=O(jt(c,u,Math.max(0,r-2)),t.run.status,n.color,n.frame);return `${X(a,n.color)} ${l}`}function Se(t,e,r){let o=[x(`Workspai Live | ${L(t.scopeLabel)} | ${t.activeRunCount} active | ${t.failedRunCount} failed`,e)];t.runs.length===0&&o.push("WAITING");for(let n of t.runs){o.push(x(`RUN ${n.run.status.toUpperCase()} | ${L(n.commandLabel)} | ${n.run.runId.slice(0,8)} | ${ot(n.run,r)}`,e));for(let s of n.nodes)o.push(x(` BLOCK ${s.status.toUpperCase()} | ${L(s.label)}${Q(s,true)?` | ATTEMPT ${s.attempt}`:""}${H(s)?` | ${H(s)}`:""}`,e));}return o.join(`
|
|
5
|
+
`)}function Y(t,e={}){if(e.classic)return Me(t,e);let r=Math.max(20,e.width??process.stdout.columns??100),o=Math.max(1,e.height??process.stdout.rows??28),n=e.now??Date.now(),s=e.frame??0,a=e.ascii??(process.env.WORKSPAI_LIVE_ASCII==="1"||process.env.TERM==="dumb"),i=e.color??(process.stdout.isTTY&&process.env.NO_COLOR===void 0&&process.env.TERM!=="dumb"),c=e.motion??(process.env.WORKSPAI_LIVE_REDUCED_MOTION!=="1"&&process.env.CI!=="true"),d=D(t,{selectedRunId:e.selectedRunId,activeOnly:e.activeOnly,maxRuns:e.maxRuns});if(e.accessible)return Se(d,r,n);let u={ascii:a,color:i,frame:s,motion:c},l=X("WORKSPAI LIVE",i),p=x(L(d.scopeLabel),Math.max(8,Math.floor(r/3))),m=`${d.global?`${d.scopeCount} SCOPES `:""}${U("running",a)} ${d.activeRunCount} ACTIVE ${U("succeeded",a)} ${d.healthyRunCount} ${U("warned",a)} ${d.warningRunCount} ${U("failed",a)} ${d.failedRunCount}`,v=a?"-".repeat(r):"\u2501".repeat(r),h=[jt(`${l} ${p}`,m,r),O(v,"planned",i,s)],E=x(e.replay?`${e.replay.paused?"PAUSED":"PLAY"} ${e.replay.index}/${e.replay.total} \xB7 ${e.replay.speed}x SPACE PLAY/PAUSE ${a?"<>":"\u2190\u2192"} STEP Q CLOSE`:`${a?"^v":"\u2191\u2193"} SELECT ENTER FOCUS I INSPECT F ACTIVE Q CLOSE`,r),I=e.interactive?o>=8?[O(v,"planned",i,s),E]:o>=3?[E]:[]:[];if(d.runs.length===0)h.push("",X(`${a?"*":"\u25C7"} WAITING FOR WORKSPAI ACTIVITY`,i));else {let w=d.runs.find(J=>J.run.runId===d.selectedRunId)??d.runs[0],T=e.focused?[]:d.runs.filter(J=>J.run.runId!==w.run.runId&&J.active);d.global&&!e.focused&&h.push(...$e(d,w.run.runId,r,n,u)),h.push(xe(w,true,r,n,u,d.global));let y=e.inspector!==false&&r>=132,S=y?Math.min(34,Math.floor(r*.25)):0,b=y?r-S-3:r,M=he(w,b,u),k=[...M?[M]:[],...pe(w,b,u)],$=y?be(w,S,n,u):[],tt=y?Ae(k,$,b):k,G=ge(T,r,u,d.global),et=G&&!d.global?1:0,q=Math.max(0,o-I.length-h.length-et),j=r>=72&&o>=14&&tt.length<=q;G&&!d.global&&h.length+I.length<o&&h.push(G),h.push(...j?tt:q>0?fe(w,r,Math.min(3,q),u):[]);}return d.diagnostics.length>0&&h.length+I.length<o&&h.push(O(`! ${d.diagnostics.length} DIAGNOSTIC`,"warned",i,s)),h.push(...I),h.slice(0,o).map(w=>x(w,r)).join(`
|
|
6
|
+
`)}function Me(t,e={}){let r=Math.max(20,e.width??process.stdout.columns??100),o=e.now??Date.now(),n=e.ascii??false,s=D(t,{maxRuns:e.maxRuns}),a=s.runs.map(d=>d.run),i=s.activeRunCount,c=[x(`Workspai Live \xB7 ${L(s.scopeLabel)} \xB7 ${i} active run${i===1?"":"s"}`,r),(n?"-":"\u2500").repeat(Math.min(r,100))];a.length===0&&c.push("Waiting for Workspai commands in this project or workspace\u2026");for(let[d,u]of a.entries()){d>0&&c.push("");let l=L(u.command.length>0?`workspai ${u.command.join(" ")}`:u.runId);c.push(x(`${U(u.status,n)} ${l} \xB7 ${u.runId.slice(0,8)} \xB7 ${ot(u,o)}`,r));for(let p of u.blocks.slice(0,18))c.push(x(` ${U(p.status,n)} ${L(p.label)}${Q(p,n)?` ${Q(p,n)}`:""}${H(p)?` ${H(p)}`:""}`,r));}return c.join(`
|
|
7
|
+
`)}var Ut={github:{width:1280,height:720},linkedin:{width:1200,height:627},x:{width:1600,height:900},square:{width:1080,height:1080},wide:{width:1600,height:900}},we={obsidian:{background:"#070b12",surface:"#0d1420",surfaceRaised:"#121c2b",grid:"#1d2a3b",text:"#edf6ff",muted:"#8090a5",cyan:"#20d9ff",green:"#27e0a3",yellow:"#f4d35e",red:"#ff667d",violet:"#b89cff"},light:{background:"#f4f7fb",surface:"#ffffff",surfaceRaised:"#eef3f9",grid:"#d9e2ee",text:"#102033",muted:"#617187",cyan:"#007fa3",green:"#087f5b",yellow:"#a16a00",red:"#c92a42",violet:"#6741d9"},mono:{background:"#080808",surface:"#111111",surfaceRaised:"#181818",grid:"#303030",text:"#f4f4f4",muted:"#9a9a9a",cyan:"#f4f4f4",green:"#d8d8d8",yellow:"#bdbdbd",red:"#ffffff",violet:"#c9c9c9"}};function V(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g," ")}function ct(t,e){let r=[...t];return r.length<=e?t:`${r.slice(0,e-1).join("")}\u2026`}function Z(t,e){return t==="running"?e.cyan:t==="succeeded"?e.green:t==="warned"||t==="blocked"?e.yellow:t==="failed"||t==="cancelled"?e.red:t==="rolled-back"?e.violet:e.muted}function bt(t){return {planned:"QUEUE",running:"RUNNING",succeeded:"COMPLETE",warned:"WARNING",blocked:"BLOCKED",failed:"FAILED",cancelled:"CANCELLED",skipped:"SKIPPED","rolled-back":"ROLLED BACK"}[t]}function Re(t){if(t<1e3)return `${t}ms`;let e=Math.floor(t/1e3);if(e<60)return `${e}s`;let r=Math.floor(e/60);return r<60?`${r}m ${e%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function Ft(t){return t.progress?.percent!==void 0?`${Math.round(t.progress.percent)}%`:t.progress?.completed!==void 0&&t.progress.total!==void 0?`${t.progress.completed}/${t.progress.total}`:""}function Ie(t){return [...t].reverse().find(e=>e.status==="running")??[...t].reverse().find(e=>["failed","blocked","warned"].includes(e.status))??[...t].sort((e,r)=>r.updatedAt.localeCompare(e.updatedAt))[0]}function ke(t,e){if(!e)return `workspai ${t.join(" ")}`.trim();let r=t[0]?.match(/^[a-z][a-z0-9-]*$/i)?.[0]??"command",n=new Set(["workspace","doctor","goal","graph","model","context"]).has(r)?t[1]?.match(/^[a-z][a-z0-9-]*$/i)?.[0]:void 0;return `workspai ${[r,n].filter(Boolean).join(" ")}`}function Ee(t,e={}){let r=e.preset??"github",o=e.theme??"obsidian",{width:n,height:s}=Ut[r],a=we[o],i=D(t,{selectedRunId:e.runId,maxRuns:50}),c=i.runs.find(g=>g.run.runId===i.selectedRunId)??i.runs[0],d=e.now??Date.parse(t.generatedAt),u=Math.round(n*.045),l=28,p=Math.max(250,Math.round(n*.24)),f=n-u*2-p-l,m=u,v=m+f+l,h=184,E=s-54,I=30,w=34,T=Math.max(2,Math.min(5,Math.floor((f+I)/180))),y=Math.floor((f-I*(T-1))/T),S=Math.max(1,Math.ceil((c?.nodes.length??0)/T)),b=Math.max(48,Math.min(64,Math.floor((E-h-w*(S-1))/S))),M=[...new Set(c?.nodes.map(g=>g.group).filter(Boolean)??[])],k=new Map;c?.nodes.forEach((g,A)=>{let R=Math.floor(A/T),C=A%T,z=R%2===0?C:T-C-1;k.set(g.id,{x:m+z*(y+I),y:h+R*(b+w)});});let $=c?Ie(c.nodes):void 0,tt=e.redact?"workspace / project":i.scopeLabel,G=e.redact?"workspace / project":c?.locationLabel,et=c?ke(c.run.command,e.redact===true):"Waiting for activity",q=c?c.run.durationMs??Math.max(0,d-Date.parse(c.run.startedAt)):0,j=[`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${s}" viewBox="0 0 ${n} ${s}" role="img" aria-labelledby="title description">`,'<title id="title">Workspai Live execution board</title>',`<desc id="description">${V(et)} execution graph with ${c?.nodes.length??0} blocks.</desc>`,"<defs>",`<pattern id="grid" width="28" height="28" patternUnits="userSpaceOnUse"><path d="M 28 0 L 0 0 0 28" fill="none" stroke="${a.grid}" stroke-width="1" opacity="0.28"/></pattern>`,...["planned","running","succeeded","warned","blocked","failed","cancelled","skipped","rolled-back"].map(g=>`<marker id="arrow-${g}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="${Z(g,a)}"/></marker>`),'<filter id="glow"><feGaussianBlur stdDeviation="3" result="blur"/><feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge></filter>',"</defs>",`<rect width="${n}" height="${s}" fill="${a.background}"/>`,`<rect width="${n}" height="${s}" fill="url(#grid)"/>`,`<text x="${u}" y="58" fill="${a.cyan}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="17" font-weight="700" letter-spacing="2">WORKSPAI LIVE</text>`,`<text x="${u}" y="91" fill="${a.text}" font-family="Inter,ui-sans-serif,system-ui,sans-serif" font-size="27" font-weight="650">${V(ct(et,62))}</text>`,`<text x="${u}" y="118" fill="${a.muted}" font-family="Inter,ui-sans-serif,system-ui,sans-serif" font-size="14">${V(ct(G??tt,72))}</text>`,`<text x="${n-u}" y="61" text-anchor="end" fill="${c?Z(c.run.status,a):a.muted}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="14" font-weight="700">${c?bt(c.run.status):"STANDBY"} \xB7 ${Re(q)}</text>`,`<line x1="${u}" y1="143" x2="${n-u}" y2="143" stroke="${a.grid}" stroke-width="2"/>`];if(M.length>1){let g=Math.min(132,Math.floor((f-12*(M.length-1))/M.length));M.forEach((A,R)=>{let C=m+R*(g+12);j.push(`<rect x="${C}" y="156" width="${g}" height="20" rx="10" fill="${a.surfaceRaised}" stroke="${a.grid}"/>`,`<text x="${C+g/2}" y="170" text-anchor="middle" fill="${a.muted}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="10" font-weight="700" letter-spacing="1">${V(A)}</text>`);});}for(let g of c?.edges??[]){let A=k.get(g.fromBlockId),R=k.get(g.toBlockId);if(!A||!R)continue;let C=A.x+y/2,z=A.y+b/2,dt=R.x+y/2,$t=R.y+b/2,K=Math.abs($t-z)<2,ut=K?dt>C?A.x+y:A.x:C,lt=K?z:A.y+b,pt=K?dt>C?R.x:R.x+y:dt,mt=K?$t:R.y,xt=(lt+mt)/2,Gt=K?`M ${ut} ${lt} L ${pt} ${mt}`:`M ${ut} ${lt} L ${ut} ${xt} L ${pt} ${xt} L ${pt} ${mt}`,qt=Z(g.status,a);j.push(`<path d="${Gt}" fill="none" stroke="${qt}" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" ${g.status==="planned"?'stroke-dasharray="5 7"':""} marker-end="url(#arrow-${g.status})" opacity="${g.status==="planned"?"0.55":"0.9"}"/>`);}for(let g of c?.nodes??[]){let A=k.get(g.id);if(!A)continue;let R=Z(g.status,a),C=g.attempt&&g.attempt>1?` \xB7 R${g.attempt}`:"",z=Ft(g);j.push(`<g${g.status==="running"?' filter="url(#glow)"':""}>`,`<rect x="${A.x}" y="${A.y}" width="${y}" height="${b}" rx="8" fill="${a.surface}" stroke="${R}" stroke-width="${g.status==="running"?3:1.5}"/>`,`<rect x="${A.x}" y="${A.y}" width="4" height="${b}" rx="2" fill="${R}"/>`,`<text x="${A.x+15}" y="${A.y+25}" fill="${a.text}" font-family="Inter,ui-sans-serif,system-ui,sans-serif" font-size="13" font-weight="650">${V(ct(g.label,Math.max(10,Math.floor(y/8))))}</text>`,`<text x="${A.x+15}" y="${A.y+45}" fill="${R}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="10" font-weight="700">${bt(g.status)}${V(C)}${z?` \xB7 ${V(z)}`:""}</text>`,"</g>");}return j.push(`<rect x="${v}" y="156" width="${p}" height="${Math.max(250,s-210)}" rx="12" fill="${a.surface}" stroke="${a.grid}" stroke-width="1.5"/>`,`<text x="${v+24}" y="191" fill="${a.cyan}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="12" font-weight="700" letter-spacing="1.5">INSPECT</text>`,`<text x="${v+24}" y="224" fill="${a.text}" font-family="Inter,ui-sans-serif,system-ui,sans-serif" font-size="19" font-weight="650">${V(ct($?.label??"No active block",24))}</text>`),[["STATE",$?bt($.status):"STANDBY"],["PHASE",$?.group??"GENERAL"],["ATTEMPT",$?.attempt?String($.attempt):"\u2014"],["PROGRESS",$&&Ft($)||"\u2014"],["TOUCHES",String(c?.run.touches.length??0)],["ARTIFACTS",String(c?.run.artifacts.length??0)],["WARNINGS",String(c?.warningCount??0)]].forEach(([g,A],R)=>{let C=273+R*45;j.push(`<text x="${v+24}" y="${C}" fill="${a.muted}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="10" font-weight="700" letter-spacing="1">${g}</text>`,`<text x="${v+p-24}" y="${C}" text-anchor="end" fill="${g==="STATE"&&$?Z($.status,a):a.text}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="12" font-weight="700">${V(A)}</text>`);}),j.push(`<text x="${u}" y="${s-24}" fill="${a.muted}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="10" letter-spacing="1">EVENT-DRIVEN \xB7 DETERMINISTIC \xB7 LOCAL-FIRST</text>`,`<text x="${n-u}" y="${s-24}" text-anchor="end" fill="${a.muted}" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="10">${e.redact?"PRODUCT-SAFE CAPTURE":V(c?.run.runId.slice(0,8).toUpperCase()??"NO RUN")}</text>`,"</svg>"),`${j.join(`
|
|
8
|
+
`)}
|
|
9
|
+
`}function zt(t,e){let r=e.preset??"github",o=_.resolve(e.outputPath);if(_.extname(o).toLowerCase()!==".svg")throw new Error("Activity capture output must use the .svg extension.");B.mkdirSync(_.dirname(o),{recursive:true,mode:448});let n=Ee(t,e),s=`${o}.${process.pid}.tmp`;try{B.writeFileSync(s,n,{encoding:"utf8",mode:384}),B.renameSync(s,o);}finally{try{B.unlinkSync(s);}catch(a){if(a.code!=="ENOENT")throw a}}return {outputPath:o,...Ut[r],bytes:Buffer.byteLength(n)}}function Te(t){return JSON.stringify(t.schemaVersion==="workspace-activity-monitor-fleet.v1"?{...t,generatedAt:"",scopes:t.scopes.map(e=>({...e,generatedAt:""}))}:{...t,generatedAt:""})}function Yt(t,e,r={}){let o=Math.max(1,r.height??process.stdout.rows??28),n=e.split(`
|
|
10
|
+
`).slice(0,o),s=Math.min(o,Math.max(t.length,n.length)),a=r.force?"\x1B[2J":"",i=r.force===true;for(let c=0;c<s;c+=1){let d=n[c]??"";!r.force&&t[c]===d||(i=true,a+=`\x1B[${c+1};1H\x1B[2K${d}`);}return i&&(a+=`\x1B[${Math.min(o,n.length+1)};1H`),{output:a,lines:n}}function Be(t,e,r){return Nt(D(t,{selectedRunId:e.selectedRunId,activeOnly:e.activeOnly,maxRuns:r}))}function At(t,e,r){let o=D(t,{selectedRunId:e.selectionPinned?e.selectedRunId:void 0,activeOnly:e.activeOnly,maxRuns:r});e.selectedRunId=o.selectedRunId;}function Ht(t,e,r,o){let n=Be(e,r,o);if(n.length===0)return;let s=Math.max(0,n.indexOf(r.selectedRunId??""));r.selectedRunId=n[(s+t+n.length)%n.length],r.selectionPinned=true,r.dirty=true;}function Le(t){let e=process.stdin;if(!e.isTTY||typeof e.setRawMode!="function")return null;let r=e.isRaw,o=e.isPaused(),n=s=>{let a=s.toString();if(a===""||a.toLowerCase()==="q"){t.stop();return}if(a==="\x1B[A"||a==="\x1B[D"||a.toLowerCase()==="k"){Ht(-1,t.snapshot(),t.state,t.maxRuns);return}if(a==="\x1B[B"||a==="\x1B[C"||a.toLowerCase()==="j"){Ht(1,t.snapshot(),t.state,t.maxRuns);return}if(a==="\r"||a===`
|
|
11
|
+
`){t.state.focused=!t.state.focused,t.state.focused&&(t.state.selectionPinned=true),t.state.dirty=true;return}if(a.toLowerCase()==="f"){t.state.activeOnly=!t.state.activeOnly,At(t.snapshot(),t.state,t.maxRuns),t.state.dirty=true;return}(a===" "||a.toLowerCase()==="i")&&(t.state.inspector=!t.state.inspector,t.state.dirty=true);};return e.setRawMode(true),e.resume(),e.on("data",n),()=>{e.removeListener("data",n),e.setRawMode(r===true),o&&e.pause();}}async function Pe(t){let e=gt({targetPath:t.targetPath,runId:t.runId,maxRuns:t.maxRuns});if(e.events.length===0)throw new Error(`No activity journal found for run ${t.runId}.`);let r=f=>Tt({resolvedScope:e.resolvedScope,events:e.events,eventCount:f+1,diagnostics:e.diagnostics}),o=r(e.events.length-1);if(t.options.once||t.options.json||t.options.accessible||t.options.classic||!process.stdout.isTTY||!process.stdin.isTTY)return process.stdout.write(t.options.json?`${JSON.stringify(o,null,2)}
|
|
12
|
+
`:`${Y(o,{width:process.stdout.columns,height:process.stdout.rows,maxRuns:t.maxRuns,selectedRunId:t.runId,color:t.options.color,motion:false,ascii:t.options.ascii,accessible:t.options.accessible,classic:t.options.classic})}
|
|
13
|
+
`),o;let n=0,s=false,a=false,i=true,c=[],d=process.stdin,u=d.isRaw,l=d.isPaused(),p=f=>{let m=f.toString();m===""||m.toLowerCase()==="q"?a=true:m===" "?s=!s:m==="\x1B[C"||m==="."?(n=Math.min(e.events.length-1,n+1),s=true):(m==="\x1B[D"||m===",")&&(n=Math.max(0,n-1),s=true),i=true;};d.setRawMode(true),d.resume(),d.on("data",p),process.stdout.write("\x1B[?1049h\x1B[?25l");try{for(;!a;){n>=e.events.length-1&&!s&&(s=true,i=true);let f=r(n);if(i){let E=Y(f,{width:process.stdout.columns,height:process.stdout.rows,maxRuns:t.maxRuns,selectedRunId:t.runId,focused:true,frame:n,color:t.options.color,motion:t.options.motion,ascii:t.options.ascii,accessible:t.options.accessible,classic:t.options.classic,inspector:true,interactive:true,replay:{index:n+1,total:e.events.length,paused:s,speed:t.speed}}),I=Yt(c,E,{force:c.length===0,height:process.stdout.rows});I.output&&process.stdout.write(I.output),c=I.lines,i=false;}if(s||n>=e.events.length-1){s=n>=e.events.length-1?true:s,await new Promise(E=>setTimeout(E,50));continue}let m=Date.parse(e.events[n]?.timestamp??""),v=Date.parse(e.events[n+1]?.timestamp??""),h=Math.max(30,Math.min(1e3,(v-m)/t.speed||30));await new Promise(E=>setTimeout(E,h)),n+=1,i=true;}}finally{d.removeListener("data",p),d.setRawMode(u===true),l&&d.pause(),process.stdout.write("\x1B[0m\x1B[?25h\x1B[?1049l");}return r(n)}async function rn(t){let e=_.resolve(t.targetPath??process.cwd()),r=Math.max(1,Math.min(50,t.maxRuns??6)),o=Math.max(1,Math.min(50,t.maxScopes??12)),n=Math.max(100,Math.min(5e3,t.refreshMs??250)),s=Math.max(.25,Math.min(64,t.replaySpeed??4));if(t.replayRunId){if(t.global)throw new Error("--replay cannot be combined with --global.");return Pe({targetPath:e,runId:t.replayRunId,speed:s,maxRuns:r,options:t})}t.global||Ot({targetPath:e});let a=()=>t.global?Lt({runId:t.runId,maxRuns:r,maxScopes:o}):Pt({targetPath:e,runId:t.runId,maxRuns:r}),i=a(),c=!!(process.stdout.isTTY&&process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&!t.json&&!t.accessible),d={selectedRunId:t.runId,selectionPinned:!!t.runId,focused:!!t.runId,activeOnly:false,inspector:true,dirty:true},u=0,l=()=>({width:process.stdout.columns,height:process.stdout.rows,maxRuns:r,selectedRunId:d.selectedRunId,focused:d.focused,activeOnly:d.activeOnly,frame:u,color:t.color,motion:t.motion,ascii:t.ascii,accessible:t.accessible,classic:t.classic,interactive:c,inspector:d.inspector});if(At(i,d,r),t.capturePath){let b=zt(i,{outputPath:t.capturePath,runId:d.selectedRunId,preset:t.capturePreset,theme:t.captureTheme,redact:t.captureRedact});return process.stdout.write(`${JSON.stringify({kind:"workspai.live.capture",...b},null,t.json?2:0)}
|
|
14
|
+
`),i}if(t.once)return t.json?process.stdout.write(`${JSON.stringify(i,null,2)}
|
|
15
|
+
`):process.stdout.write(`${Y(i,l())}
|
|
16
|
+
`),i;let p=false,f,m=()=>{p=true,f?.();},v=b=>new Promise(M=>{let k=setTimeout(()=>{f=void 0,M();},b);f=()=>{clearTimeout(k),f=void 0,M();};});process.once("SIGINT",m),process.once("SIGTERM",m);let h=true,E=()=>{h=true,d.dirty=true;};process.stdout.on("resize",E);let I=c?Le({snapshot:()=>i,state:d,maxRuns:r,stop:m}):null;c&&process.stdout.write("\x1B[?1049h\x1B[?25l");let w="",T=[],y=0,S=c&&t.motion!==false&&process.env.WORKSPAI_LIVE_REDUCED_MOTION!=="1"&&process.env.CI!=="true";try{for(;!p;){let b=Date.now();if((y===0||b-y>=n)&&(i=a(),At(i,d,r),y=b,d.dirty=true),c){let k=Y(i,l()),$=Yt(T,k,{force:h,height:process.stdout.rows});$.output&&process.stdout.write($.output),T=$.lines,h=false,d.dirty=false,u+=1;}else {let k=JSON.stringify(i),$=Te(i);$!==w&&(process.stdout.write(t.json?`${k}
|
|
17
|
+
`:`${Y(i,l())}
|
|
18
|
+
`),w=$);}let M=S&&Wt(D(i,{selectedRunId:d.selectedRunId,activeOnly:d.activeOnly,maxRuns:r}));p||await v(M?Math.min(n,125):n);}}finally{I?.(),process.removeListener("SIGINT",m),process.removeListener("SIGTERM",m),process.stdout.removeListener("resize",E),c&&process.stdout.write("\x1B[0m\x1B[?25h\x1B[?1049l");}return i}export{Te as activitySnapshotComparisonKey,Yt as renderActivityScreenDiff,rn as runLiveCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-IIFFEEMX.js';import {r}from'./chunk-QGAPGZPL.js';import {a as a$2}from'./chunk-EP4CUWOO.js';import {c as c$1}from'./chunk-LPCWROQ3.js';import {a as a$3}from'./chunk-O37UBRMX.js';import {g}from'./chunk-EHH4SKVH.js';import {f,e as e$1}from'./chunk-SX6A656X.js';import {a}from'./chunk-HLWDIIWL.js';import {c as c$3}from'./chunk-X7FYEKLI.js';import {d as d$1,a as a$1,e as e$2}from'./chunk-GAYK3WGV.js';import {e,i,h}from'./chunk-6UNATTB7.js';import c$2 from'chalk';import d from'path';import G from'fs-extra';function L(s){return s===0?"pass":s===2?"warn":"fail"}async function _(s){try{let a=G.readJsonSync(s),i=a.policyProfile,t=c$3(a).filter(n=>n.status==="blocking").map(n=>`${n.projectName}: ${n.message}`);return {policyProfile:typeof i?.name=="string"?i.name:void 0,blockers:[...new Set(t)].slice(0,12)}}catch{return {blockers:[]}}}function j(s){return s.some(a=>a.status==="fail")?"blocked":s.some(a=>a.status==="warn")?"needs-attention":"ready"}function V(s,a){if(a)return 3;let i=s.some(n=>n.status==="fail"),t=s.some(n=>n.status==="warn");return i?1:t?2:0}function K(s,a){return s===2&&!a?0:s}async function J(s){let a=await g(s,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-4T3NYNK5.js');await t({workspacePath:s}),i=true;}catch{i=false;}return {sync:a,contractSynced:i}}async function U(s={}){let a$4=d.resolve(s.workspacePath??process.cwd()),i$1=a(a$4);if(!i$1)throw new Error("No Workspai workspace found in current directory or parents");let t=[],n=[],u=false,m,w,g,h$1=Date.now();try{let{sync:e,contractSynced:r}=await J(i$1),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:o,durationMs:Date.now()-h$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${r?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||n.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){u=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-h$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),n.push("workspace sync stage failed");}let P=Date.now();try{let e$1=await r({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),r$1=L(e$1),o=await d$1(i$1,e.doctor)??a$1(i$1,e.doctor),l=await _(o);t.push({name:"doctor",status:r$1,durationMs:Date.now()-P,summary:r$1==="pass"?"doctor workspace passed":r$1==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e$1,evidencePath:o,policyProfile:l.policyProfile,blockers:l.blockers}),r$1==="fail"?n.push(...l.blockers.length>0?l.blockers.map(O=>`doctor: ${O}`):["doctor workspace gate failed"]):r$1==="warn"&&n.push("doctor workspace reported warnings");}catch(e){u=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-P,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),n.push("doctor workspace stage failed");}if(s.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let r=await a$2({workspacePath:i$1,json:true,strict:s.strict===true});m=d.isAbsolute(r.enterpriseControls.evidencePath)?r.enterpriseControls.evidencePath:d.join(i$1,r.enterpriseControls.evidencePath);let o=r.summary.verdict==="blocked"?"fail":r.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${r.summary.verdict} (score ${r.summary.score}/100)`,evidencePath:m}),o==="fail"?n.push("analyze reported blocked verdict"):o==="warn"&&n.push("analyze reported needs-attention verdict");}catch(r){u=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${r instanceof Error?r.message:String(r)}`}),n.push("analyze stage failed");}}let k=Date.now();try{let e=await a$3({startPath:i$1,writeReport:true,skipVerify:s.skipVerify===true});w=e.evidencePath;let r=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:r,durationMs:Date.now()-k,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),r==="fail"?n.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):r==="warn"&&n.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){u=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-k,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),n.push("readiness stage failed");}if(s.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),r=s.autopilotMode??"audit";try{let o=await c({workspacePath:i$1,mode:r,json:true,skipPipelineStages:true});g=o.artifacts.reportPath;let l=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:l,durationMs:Date.now()-e,summary:`autopilot ${r}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:g}),l!=="pass"&&n.push(...o.blockingReasons.slice(0,5));}catch(o){u=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),n.push("autopilot release stage failed");}}let N=j(t),S=V(t,u),I=d.join(i$1,i.pipelineLastRun),p={schemaVersion:h.pipelineLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:i$1,summary:{verdict:N,exitCode:S,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(n)],artifacts:{reportPath:I,analyzeEvidencePath:m,readinessEvidencePath:w,autopilotEvidencePath:g}};if(s.writeReport!==false){let e=f(p,{commandId:"workspacePipeline",exitCode:S,generatedAt:p.generatedAt,blockers:p.blockingReasons,runId:e$1()});await e$2(i$1,i.pipelineLastRun,e);}if(s.writeReport!==false&&s.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-32FIJQBH.js'),r=await e({workspacePath:i$1,write:true,refreshContext:true,strict:false});p.agentGrounding={indexPath:r.indexPath,writtenFiles:r.writtenFiles,blockers:r.blockers};}catch{}return p}async function ue(s){let a;try{a=await U(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify(c$1({operation:"pipeline",code:"pipeline.failed",message:n}),null,2)):console.log(c$2.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(a,null,2));else {console.log(c$2.bold.cyan(`
|
|
2
2
|
\u{1F517} Workspai Governance Pipeline
|
|
3
3
|
`)),console.log(c$2.bold(`Workspace: ${c$2.cyan(d.basename(a.workspacePath))}`)),console.log(c$2.gray(`Path: ${a.workspacePath}`)),console.log(c$2.white(`Verdict: ${a.summary.verdict} Exit: ${a.summary.exitCode} (${a.summary.stagesPassed} pass / ${a.summary.stagesWarn} warn / ${a.summary.stagesFailed} fail)`));for(let t of a.stages){let n=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}: ${n} ${t.summary}`);}if(a.blockingReasons.length>0){console.log(c$2.bold(`
|
|
4
4
|
Blocking reasons:`));for(let t of a.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${t}`));}console.log(c$2.gray(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as AGENT_BOOTSTRAP_RECEIPT_SCHEMA_VERSION,f as AGENT_ENTRY_HOST_IDS,g as PROJECT_AGENT_ADAPTER_ENTRY_FILES,b as PROJECT_AGENT_ENTRY_RELATIVE_PATH,a as PROJECT_AGENT_ENTRY_SCHEMA_VERSION,e as WORKSPAI_AGENT_ENTRY_END,d as WORKSPAI_AGENT_ENTRY_START,j as buildAgentBootstrapReceipt,i as buildProjectAgentEntryManifest,h as normalizeAgentEntryHost}from'./chunk-
|
|
1
|
+
export{c as AGENT_BOOTSTRAP_RECEIPT_SCHEMA_VERSION,f as AGENT_ENTRY_HOST_IDS,g as PROJECT_AGENT_ADAPTER_ENTRY_FILES,b as PROJECT_AGENT_ENTRY_RELATIVE_PATH,a as PROJECT_AGENT_ENTRY_SCHEMA_VERSION,e as WORKSPAI_AGENT_ENTRY_END,d as WORKSPAI_AGENT_ENTRY_START,j as buildAgentBootstrapReceipt,i as buildProjectAgentEntryManifest,h as normalizeAgentEntryHost}from'./chunk-TTHO4MFC.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as PROJECT_CONTEXT_AGENT_SCHEMA_VERSION,c as PROJECT_GROUNDING_MODE_VALUES,g as PROJECT_PORTABLE_GROUNDING_SKILL_PATH,e as WORKSPAI_PROJECT_GROUNDING_END,d as WORKSPAI_PROJECT_GROUNDING_START,f as WORKSPAI_PROJECT_SKILL_MARKER,i as buildProjectContextAgent,j as resolveProjectPortableSkillTransactionPaths,m as resolveWorkspaceProjectLensTargets,h as selectBoundedProjectLensEntities,k as syncProjectIntelligenceLens,l as syncWorkspaceProjectLenses}from'./chunk-MZ7U4BIQ.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as PROJECT_TEST_COVERAGE_ARTIFACT,a as PROJECT_TEST_COVERAGE_SCHEMA,d as collectProjectTestCoverage,c as inspectProjectTestCoverageCapability}from'./chunk-
|
|
1
|
+
export{b as PROJECT_TEST_COVERAGE_ARTIFACT,a as PROJECT_TEST_COVERAGE_SCHEMA,d as collectProjectTestCoverage,c as inspectProjectTestCoverageCapability}from'./chunk-WTWRSEOW.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-FY4X2VOE.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-IBJEQHJR.js';import {h as h$1}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-IBJEQHJR.js';import {h as h$1}from'./chunk-TABXSDTR.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import t from'path';import d from'chalk';import {execa}from'execa';var f="3000";function w(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")||"axum-api"}function k(e,i){return `[package]
|
|
2
2
|
name = "${e}"
|
|
3
3
|
version = "0.1.0"
|
|
4
4
|
edition = "2021"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,c}from'./chunk-IBJEQHJR.js';import {h as h$1}from'./chunk-
|
|
1
|
+
import {b,c}from'./chunk-IBJEQHJR.js';import {h as h$1}from'./chunk-TABXSDTR.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">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-OI2VOU6S.js';import {d as d$1}from'./chunk-WTWRSEOW.js';import {a as a$2}from'./chunk-R2M5OJOK.js';import {a as a$1}from'./chunk-O37UBRMX.js';import {q as q$1}from'./chunk-PJPS7CNH.js';import {a as a$3}from'./chunk-GR6442P7.js';import {e as e$1,d}from'./chunk-GAYK3WGV.js';import {a}from'./chunk-AFIFZTOY.js';import {e,f}from'./chunk-6UNATTB7.js';import {createHash}from'crypto';import u from'path';import v from'fs-extra';var W="workspai.verified-goal.v1",A=f.verifiedGoalStatus,V=e.verifiedGoalStatus,J="contracts/workspace-intelligence/verified-goal.v1.json",$="contracts/workspace-intelligence/verified-goal-status.v1.json";function H(e,t,a){if(t.kind==="workspace")return true;let r=u.resolve(e,a.path);return t.kind==="project"?a.name===t.projectName||r===u.resolve(t.projectPath):t.projects.some(i=>i.projectName===a.name||u.resolve(i.projectPath)===r)}function x(e){return Array.isArray(e)?`[${e.map(x).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${x(a)}`).join(",")}}`:JSON.stringify(e)}function K(e){return createHash("sha256").update(x(e)).digest("hex")}var ae=["package.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","pyproject.toml","requirements.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","gradle.lockfile","packages.lock.json","Directory.Packages.props","composer.json","composer.lock","Gemfile","Gemfile.lock","mix.exs","mix.lock","deps.edn","project.clj","build.sbt"],re=new Set(ae.map(e=>e.toLowerCase())),se=new Set([".git",".hg",".svn",".workspai",".venv","venv",".tox",".mypy_cache",".pytest_cache","__pycache__","node_modules","vendor","pods","dist","build","out","target","bin","obj","coverage",".coverage",".next",".nuxt",".svelte-kit"]),F=1e5;function ne(e){return re.has(e.toLowerCase())||/\.(?:csproj|fsproj|vbproj)$/i.test(e)}async function ie(e){let t=[e],a=[],r=0;for(;t.length>0;){let i=t.shift();if(i===void 0)break;let o=await v.readdir(i,{withFileTypes:true});if(o.sort((n,s)=>n.name.localeCompare(s.name)),r+=o.length,r>F)throw new Error(`Dependency safety baseline exceeded ${F} filesystem entries under ${e}. Narrow the project boundary before creating this goal.`);for(let n of o){let s=u.join(i,n.name);if(n.isDirectory()){!se.has(n.name.toLowerCase())&&!a$3(n.name)&&t.push(s);continue}n.isFile()&&ne(n.name)&&a.push(s);}}return a}function oe(e){return /^(?:package\.json|package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/i.test(e)?"node":/^(?:pyproject\.toml|requirements\.txt|Pipfile(?:\.lock)?|poetry\.lock|uv\.lock)$/i.test(e)?"python":/^go\.(?:mod|sum)$/i.test(e)?"go":/^Cargo\.(?:toml|lock)$/i.test(e)?"rust":/^(?:pom\.xml|build\.gradle(?:\.kts)?|gradle\.lockfile)$/i.test(e)?"jvm":/^(?:Directory\.Packages\.props|packages\.lock\.json)$/i.test(e)?"dotnet":/^composer\.(?:json|lock)$/i.test(e)?"php":/^Gemfile(?:\.lock)?$/i.test(e)?"ruby":/^mix\.(?:exs|lock)$/i.test(e)?"elixir":/^(?:deps\.edn|project\.clj)$/i.test(e)?"clojure":/^build\.sbt$/i.test(e)?"scala":/\.(?:csproj|fsproj|vbproj)$/i.test(e)?"dotnet":"unknown"}function z(e){try{let t=JSON.parse(e),a={};for(let r of ["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let i=t[r];if(!(!i||typeof i!="object"||Array.isArray(i)))for(let[o,n]of Object.entries(i))typeof n=="string"&&(a[`${r}:${o}`]=n);}return a}catch{return}}async function U(e,t){let r=(await q$1({workspacePath:e,includeAbsolutePaths:true})).projects.filter(o=>H(e,t,o)),i=new Map;for(let o of r){let n=u.resolve(e,o.path),s=await ie(n);for(let c of s){let g=u.basename(c),f=await v.readFile(c,"utf8"),p=u.relative(e,c).split(u.sep).join("/");i.set(p,{path:p,ecosystem:oe(g),sha256:createHash("sha256").update(f).digest("hex"),...g==="package.json"?{dependencies:z(f)??{}}:{}});}}return {manifests:[...i.values()].sort((o,n)=>o.path.localeCompare(n.path))}}function O(e){let a=e.replace(/^(?:workspace:|npm:[^@]+@)/,"").match(/(?:^|[^\d])(\d+)(?:\.\d+)?(?:\.\d+)?/);return a?Number(a[1]):null}function S(e){return /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|poetry\.lock|uv\.lock|Pipfile\.lock|go\.sum|Cargo\.lock|gradle\.lockfile|packages\.lock\.json|composer\.lock|Gemfile\.lock|mix\.lock)$/i.test(e)}async function ce(e){let t=e.dependencySafetyBaseline;if(!t)return k({id:"change-policy",label:"Change safety policy",status:"missing",expected:"dependency manifest safety baseline",actual:"baseline unavailable"});let a=[],r=await U(e.workspace.path,e.scope),i=new Map(r.manifests.map(s=>[s.path,s])),o=new Map(t.manifests.map(s=>[s.path,s])),n=new Set;for(let s of t.manifests){let c=i.get(s.path);(!c||c.sha256!==s.sha256)&&n.add(s.path);}for(let s of r.manifests)o.has(s.path)||n.add(s.path);for(let s of r.manifests)!o.has(s.path)&&!S(s.path)&&a.push(`${s.path} was added after the safety baseline`);for(let s of t.manifests){let c=i.get(s.path);if(!c){a.push(`${s.path} was removed`);continue}if(c.sha256===s.sha256)continue;if(s.dependencies){let p=await v.readFile(u.join(e.workspace.path,s.path),"utf8"),m=z(p);if(!m){a.push(`${s.path} is not valid dependency JSON`);continue}for(let[d,l]of Object.entries(s.dependencies)){let h=m[d];if(!h){a.push(`${d.replace(/^[^:]+:/,"")} was removed`);continue}if(h===l)continue;let G=O(l),R=O(h);(G===null||R===null||G!==R||/(?:latest|\*)/i.test(h))&&a.push(`${d.replace(/^[^:]+:/,"")} changed outside its proven major range (${l} \u2192 ${h})`);}continue}if(S(s.path))continue;let g=u.posix.dirname(s.path);[...i.values()].some(p=>{let m=u.posix.dirname(p.path);return p.ecosystem===s.ecosystem&&(m===g||g.startsWith(`${m}/`))&&S(p.path)&&n.has(p.path)})||a.push(`${s.path} changed without a matching reconciled ${s.ecosystem} lockfile`);}return k({id:"change-policy",label:"Change safety policy",status:a.length===0?"passed":"blocked",expected:"no force, removal, unbounded, or major dependency changes",actual:a.length===0?"manifest changes are within proven bounds":a.join("; ")})}function E(e,t){if(!/^[a-z0-9][a-z0-9._-]{7,95}$/i.test(t))throw new Error(`Invalid verified goal id: ${t}`);let a=u.join(e,".workspai","goals",t);return {directory:a,goal:u.join(a,"goal.json"),status:u.join(a,"status.json"),latestReport:u.join(e,V)}}function le(e){return {workspacePath:u.resolve(e.workspace.path),kind:e.kind,scope:e.scope,target:e.criteria.kind==="test-coverage"?e.criteria.minimumPercent:null,...e.criteria.kind==="test-coverage"&&e.criteria.runtime?{runtime:e.criteria.runtime}:{},constraints:e.constraints}}async function C(e,t){await v.ensureDir(u.dirname(e));let a=`${e}.${process.pid}.${Date.now()}.tmp`;await v.writeJson(a,t,{spaces:2}),await v.rename(a,e);}async function ue(e,t){let a=t?.trim();if(!a||a==="workspace")return {scope:{kind:"workspace"}};let r=a.startsWith("projects:")?"projects:":a.startsWith("project:")&&a.slice(8).includes(",")?"project:":null,i=a.startsWith("project:")?a.slice(8).trim():r?a.slice(r.length).trim():a;if(!i)throw new Error("Project goal scope must name a project.");let o=await q$1({workspacePath:e,includeAbsolutePaths:true});if(r){let g=i.split(",").map(p=>p.trim()).filter(Boolean);if(g.length<2||new Set(g).size!==g.length)throw new Error("A project-set goal scope must name at least two unique projects.");return {scope:{kind:"project-set",projects:g.map(p=>{let m=o.projects.filter(d=>d.name===p||d.path===p);if(m.length!==1)throw new Error(m.length===0?`Project goal scope was not found: ${p}`:`Project goal scope is ambiguous: ${p}`);return m[0]}).map(p=>({projectName:p.name,projectPath:u.resolve(e,p.path)})).sort((p,m)=>p.projectName.localeCompare(m.projectName))}}}let n=o.projects.filter(g=>{let f=u.resolve(e,g.path);return g.name===i||g.path===i||f===u.resolve(i)});if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found: ${i}`:`Project goal scope is ambiguous: ${i}`);let s=n[0],c=u.resolve(e,s.path);return {project:s,scope:{kind:"project",projectName:s.name,projectPath:c}}}function Y(e,t,a){return e===null?"unavailable":a==="minimum"?e>=t?"satisfied":"unsatisfied":e<=t?"satisfied":"unsatisfied"}async function X(e){if(!e)return null;try{let t=await v.readJson(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function de(e){return Array.isArray(e.projects)?e.projects.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):e.project&&typeof e.project=="object"&&!Array.isArray(e.project)?[e.project]:[]}function pe(e){let t=e.dependencyAudit;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}async function Q(e$1,t){let a=await d(e$1,e.doctor),r=await X(a);if(!r)return {measuredAt:new Date().toISOString(),value:null,target:0,unit:"blocking-vulnerabilities",status:"unavailable",evidencePaths:[],message:"Fresh Doctor dependency evidence is not available."};let i=de(r).filter(c=>{if(t.kind==="workspace")return true;let g=typeof c.name=="string"?c.name:typeof c.projectName=="string"?c.projectName:"",f=typeof c.path=="string"?u.resolve(c.path):typeof c.projectPath=="string"?u.resolve(c.projectPath):"";return t.kind==="project"?g===t.projectName||f===u.resolve(t.projectPath):t.projects.some(p=>p.projectName===g||u.resolve(p.projectPath)===f)}),o=i.map(pe).filter(c=>c!==null),n=o.map(c=>c.blockingFindingCount).filter(c=>Number.isInteger(c)&&Number(c)>=0),s=i.length>0&&n.length===i.length?n.reduce((c,g)=>c+g,0):null;return {measuredAt:(()=>{let c=o.map(g=>g.generatedAt).filter(g=>typeof g=="string").sort();return c[c.length-1]??new Date().toISOString()})(),value:s,target:0,unit:"blocking-vulnerabilities",status:Y(s,0,"maximum"),evidencePaths:a?[a]:[],message:s===null?"Doctor did not publish complete dependency audit counts for the selected scope.":`${s} blocking dependency vulnerability finding(s) remain.`}}async function Z(e){let t=await a$1({startPath:e,writeReport:false}),a=t.gates.filter(i=>i.status==="pass").length,r=t.gates.length;return {measuredAt:t.generatedAt,value:a,target:r,unit:"gates",status:t.overallStatus==="pass"?"satisfied":"unsatisfied",evidencePaths:[...new Set(t.gates.map(i=>i.evidencePath).filter(i=>typeof i=="string"))],message:t.overallStatus==="pass"?"All release readiness gates pass.":`${r-a} release readiness gate(s) still require work.`}}async function B(e){let t=await d$1({projectPath:e.projectPath,target:e.target,run:e.run,runtime:e.runtime}),r=t.metrics[t.target.metric]?.percent??null;return {executionStatus:t.status,measurement:{measuredAt:t.generatedAt,value:r,target:e.target,unit:"percent",status:Y(r,e.target,"minimum"),evidencePaths:[t.artifactPaths.project],message:t.status==="failed"?"The runtime-native coverage test command failed.":r===null?"Machine-readable coverage evidence is unavailable.":`${t.target.metric} coverage is ${r}% (target ${e.target}%).`}}}async function ee(e){if(e.scope.kind==="project"){if(!e.scope.projectPath)throw new Error("Coverage goal project scope does not have a project path.");return B({projectPath:e.scope.projectPath,target:e.target,run:e.run,runtime:e.runtime})}let t=await q$1({workspacePath:e.workspacePath,includeAbsolutePaths:true});if(t.projects.length===0)return {executionStatus:"unavailable",measurement:{measuredAt:new Date().toISOString(),value:null,target:e.target,unit:"percent",status:"unavailable",evidencePaths:[],message:"The workspace does not contain a registered project to measure."}};let a=t.projects.filter(l=>H(e.workspacePath,e.scope,l)),r=e.runtime,i=r?a.filter(l=>l.runtimeCandidates.includes(r)):a;if(i.length===0)return {executionStatus:"unavailable",measurement:{measuredAt:new Date().toISOString(),value:null,target:e.target,unit:"percent",status:"unavailable",evidencePaths:[],message:`The selected scope does not contain the ${e.runtime} coverage runtime.`}};let o=[];for(let l of i)o.push({projectName:l.name,result:await B({projectPath:u.resolve(e.workspacePath,l.path),target:e.target,run:e.run,runtime:e.runtime})});let n=o.filter(l=>l.result.executionStatus==="failed"),s=o.filter(l=>l.result.measurement.status==="unavailable"),c=o.filter(l=>l.result.measurement.status==="unsatisfied"),g=o.map(l=>l.result.measurement.value).filter(l=>l!==null),f=g.length===o.length&&g.length>0?Math.min(...g):null,p=n.length>0?"failed":s.length>0?"unavailable":c.length>0?"below-target":"passed",m=o.map(l=>l.result.measurement.measuredAt).sort(),d=[...n.map(l=>`${l.projectName}: coverage command failed`),...s.map(l=>`${l.projectName}: coverage unavailable`),...c.map(l=>`${l.projectName}: ${l.result.measurement.value??"unknown"}%`)];return {executionStatus:p,measurement:{measuredAt:m[m.length-1]??new Date().toISOString(),value:f,target:e.target,unit:"percent",status:p==="passed"?"satisfied":p==="below-target"?"unsatisfied":"unavailable",evidencePaths:[...new Set(o.flatMap(l=>l.result.measurement.evidencePaths))],message:p==="passed"?`Every registered project has at least ${e.target}% test coverage.`:`Workspace coverage is not verified: ${d.join("; ")}.`}}}function ge(e){let t=e.scope.kind==="project"?`project ${e.scope.projectName??"selected project"}`:e.scope.kind==="project-set"?`projects ${e.scope.projects.map(a=>a.projectName).join(", ")}`:"workspace";return e.kind==="release-readiness"?`Prepare the ${t} for release.`:e.kind==="dependency-security"?`Resolve blocking dependency vulnerabilities in the ${t} without unsafe changes.`:`Raise ${e.runtime?`${e.runtime} `:""}${t} test coverage to ${e.target??80}% without breaking its build.`}function me(e,t,a){return e==="release-readiness"?{kind:e,readiness:"pass",workspaceVerify:"ready"}:e==="dependency-security"?{kind:e,maximumBlockingVulnerabilities:0,requireFreshAudit:true}:{kind:e,metric:"auto",minimumPercent:t,...a?{runtime:a}:{}}}async function fe(e){return e.kind==="release-readiness"?Z(e.workspacePath):e.kind==="dependency-security"?Q(e.workspacePath,e.scope):(await ee({workspacePath:e.workspacePath,scope:e.scope,target:e.target,run:false,runtime:e.runtime})).measurement}async function Ee(e){let t=u.resolve(e.workspacePath),a$1=Math.max(0,Math.min(100,Math.round(e.target??80))),{scope:r}=await ue(t,e.scope),i={workspacePath:u.resolve(t),kind:e.kind,scope:r,target:e.kind==="test-coverage"?a$1:null,...e.kind==="test-coverage"&&e.runtime?{runtime:e.runtime}:{},constraints:{allowBreakingChanges:e.allowBreakingChanges===true,allowForce:e.allowForce===true,requireBuild:e.requireBuild!==false,requireTests:e.requireTests!==false}},o=K(i),n=`goal-${e.kind}-${o.slice(0,16)}`,s=E(t,n);if(await v.pathExists(s.goal)){let{goal:m,status:d}=await te(t,n);if(m.fingerprint===o)return {goal:m,status:d,resumed:d.state!=="verified"}}let c=new Date().toISOString(),g=await fe({workspacePath:t,kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),f={schemaVersion:W,id:n,fingerprint:o,createdAt:c,updatedAt:c,workspace:{name:u.basename(t),path:t},scope:r,kind:e.kind,summary:ge({kind:e.kind,scope:r,target:a$1,runtime:e.runtime}),constraints:i.constraints,criteria:me(e.kind,a$1,e.runtime),baseline:g,...e.kind==="dependency-security"?{dependencySafetyBaseline:await U(t,r)}:{},artifactPaths:{goal:s.goal,status:s.status,latestReport:s.latestReport}},p={schemaVersion:A,goalId:n,goalFingerprint:o,workspacePath:t,updatedAt:c,state:"planned",attempt:0,progress:g,checks:[],blockingReasons:[],evidencePaths:g.evidencePaths,nextActions:e.kind==="test-coverage"?["Add focused tests for the lowest-coverage source paths.","Run verified goal checks."]:e.kind==="dependency-security"?["Inspect the fresh project dependency audit.","Apply only compatible non-force dependency repairs.","Reconcile the lockfile, test, build, and verify again."]:["Inspect the current remediation plan and failing release gates.","Repair the next causal blocker, then verify again."],artifactPath:s.status};return a(f,J,"Verified goal"),a(p,$,"Verified goal status"),await C(s.goal,f),await C(s.status,p),await e$1(t,V,p),{goal:f,status:p,resumed:false}}async function te(e,t){let a$1=E(u.resolve(e),t),r=await v.readJson(a$1.goal),i=await v.readJson(a$1.status);a(r,J,"Verified goal"),a(i,$,"Verified goal status");let o=u.resolve(e),n=u.resolve(r.artifactPaths.goal)===u.resolve(a$1.goal)&&u.resolve(r.artifactPaths.status)===u.resolve(a$1.status)&&u.resolve(r.artifactPaths.latestReport)===u.resolve(a$1.latestReport);if(r.schemaVersion!==W||i.schemaVersion!==A||r.id!==i.goalId||r.fingerprint!==i.goalFingerprint||r.fingerprint!==K(le(r))||u.resolve(r.workspace.path)!==o||u.resolve(i.workspacePath)!==o||!n)throw new Error(`Verified goal artifacts are inconsistent: ${t}`);return {goal:r,status:i}}function k(e){return {...e,message:e.message??`${e.label}: ${e.actual}; expected ${e.expected}.`}}async function q(e){let t=[],a=e.goal.scope.kind==="project"?[`project:${e.goal.scope.projectName}`]:e.goal.scope.kind==="project-set"?e.goal.scope.projects.map(r=>`project:${r.projectName}`):[void 0];for(let r of ["test","build"]){if(r==="test"&&e.includeTests===false)continue;if(!(r==="test"?e.goal.constraints.requireTests:e.goal.constraints.requireBuild)){t.push(k({id:r,label:`${r} validation`,status:"skipped",expected:"not required",actual:"skipped by goal contract"}));continue}if(!e.run){t.push(k({id:r,label:`${r} validation`,status:"missing",expected:"fresh passed evidence",actual:"execution disabled"}));continue}let o=false;for(let n of a){let s=await a$2({workspacePath:e.goal.workspace.path,stage:r,scope:n,parallel:false,continueOnError:false,strict:true,json:true,enforceGates:false}),c=n?.replace(/^project:/,"");if(t.push(k({id:c?`${r}:${c}`:r,label:c?`${r} validation \xB7 ${c}`:`${r} validation`,status:s.summary.exitCode===0?"passed":"failed",expected:"exit 0",actual:`exit ${s.summary.exitCode}`,evidencePath:u.join(e.goal.workspace.path,".workspai","reports","workspace-run-last.json")})),s.summary.exitCode!==0){o=true;break}}if(o)break}return t}async function Ge(e$2){let t=u.resolve(e$2.workspacePath),{goal:a$1,status:r}=await te(t,e$2.goalId),i=e$2.run!==false,o=[],n;if(i&&e$2.runIntelligence!==false){let d=await c({workspacePath:t,strict:true,agent:"generic"}),l=d.exitCode===0||d.exitCode===2,h=a$1.kind==="release-readiness";o.push(k({id:"workspace-intelligence-chain",label:"Workspace Intelligence chain",status:d.exitCode===0||d.exitCode===2&&!h?"passed":d.exitCode===2?"blocked":"failed",expected:"passed",actual:d.exitCode===2&&l&&!h?`${d.status}; canonical evidence refreshed for goal-scoped verification`:d.status,evidencePath:u.join(t,e.intelligenceRun)}));}if(a$1.kind==="release-readiness"){n=await Z(t),o.push(k({id:"release-readiness",label:"Release readiness",status:n.status==="satisfied"?"passed":"blocked",expected:"all gates pass",actual:n.message,evidencePath:u.join(t,e.readiness)}));let d$1=await d(t,e.verify),l=await X(d$1),h=l?.summary&&typeof l.summary=="object"&&!Array.isArray(l.summary)?String(l.summary.verdict??"missing"):"missing";o.push(k({id:"workspace-verify",label:"Workspace verification",status:h==="ready"?"passed":h==="missing"?"missing":"blocked",expected:"ready",actual:h,evidencePath:u.join(t,e.verify)}));}else if(a$1.kind==="dependency-security")n=await Q(t,a$1.scope),o.push(k({id:"dependency-audit",label:"Dependency security audit",status:n.status==="satisfied"?"passed":n.status==="unavailable"?"missing":"blocked",expected:"0 blocking vulnerabilities",actual:n.message,evidencePath:n.evidencePaths[0]})),o.push(a$1.constraints.allowBreakingChanges||a$1.constraints.allowForce?k({id:"change-policy",label:"Change safety policy",status:"blocked",expected:"breaking and force changes disabled",actual:`allowBreakingChanges=${a$1.constraints.allowBreakingChanges}, allowForce=${a$1.constraints.allowForce}`}):await ce(a$1)),n.status==="satisfied"&&o.push(...await q({goal:a$1,run:i}));else {let d=a$1.criteria.kind==="test-coverage"?a$1.criteria.minimumPercent:a$1.baseline.target;if(d===null)throw new Error("Coverage goal does not have a valid target.");let l=await ee({workspacePath:t,scope:a$1.scope,target:d,run:i,runtime:a$1.criteria.kind==="test-coverage"?a$1.criteria.runtime:void 0});n=l.measurement,o.push(k({id:"coverage",label:"Test coverage",status:n.status==="satisfied"?"passed":n.status==="unavailable"?"missing":"blocked",expected:`at least ${d}%`,actual:n.message,evidencePath:n.evidencePaths[0]})),o.push(k({id:"test",label:"Coverage test execution",status:l.executionStatus==="failed"?"failed":l.executionStatus==="unavailable"?"missing":"passed",expected:"runtime-native coverage test command completed",actual:l.executionStatus==="failed"?"coverage test command failed":l.executionStatus==="unavailable"?"coverage execution evidence unavailable":"coverage evidence produced by the test runner",evidencePath:n.evidencePaths[0]})),n.status==="satisfied"&&o.push(...await q({goal:a$1,run:i,includeTests:false}));}let s=o.filter(d=>d.status==="blocked"||d.status==="failed"||d.status==="missing").map(d=>d.message),c$1=[...new Set([...n.evidencePaths,...o.map(d=>d.evidencePath).filter(d=>typeof d=="string")])],g=n.status==="satisfied"&&o.every(d=>d.status==="passed"||d.status==="skipped"),f=E(t,a$1.id),p=g?[]:a$1.kind==="test-coverage"?["Inspect low-coverage files from the coverage artifact.","Add focused tests and verify again."]:a$1.kind==="dependency-security"?["Use fresh audit candidates and compatible package-manager repairs.","Reconcile lockfiles before running verified goal checks again."]:["Repair the first blocking readiness gate and verify the goal again."],m={schemaVersion:A,goalId:a$1.id,goalFingerprint:a$1.fingerprint,workspacePath:t,updatedAt:new Date().toISOString(),state:g?"verified":o.some(d=>d.status==="failed")?"failed":"blocked",attempt:r.attempt+1,progress:n,checks:o,blockingReasons:s,evidencePaths:c$1,nextActions:p,artifactPath:f.status};return a(m,$,"Verified goal status"),await C(f.status,m),await e$1(t,V,m),m}export{V as VERIFIED_GOAL_LAST_RUN_REPORT_PATH,W as VERIFIED_GOAL_SCHEMA_VERSION,A as VERIFIED_GOAL_STATUS_SCHEMA_VERSION,Ee as planVerifiedGoal,te as readVerifiedGoal,Ge as verifyVerifiedGoal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as captureWorkspaceRegistrationStrict,k as createProject,j as createWorkspace,m as createWorkspaceShareBundle,l as listWorkspaces,a as normalizeWorkspaceEntry,i as registerProjectInWorkspace,h as registerProjectInWorkspaceStrict,f as registerWorkspace,b as registerWorkspaceStrict,d as restoreWorkspaceRegistrationStrict,g as syncWorkspaceProjects,e as unregisterWorkspaceStrict}from'./chunk-
|
|
1
|
+
export{c as captureWorkspaceRegistrationStrict,k as createProject,j as createWorkspace,m as createWorkspaceShareBundle,l as listWorkspaces,a as normalizeWorkspaceEntry,i as registerProjectInWorkspace,h as registerProjectInWorkspaceStrict,f as registerWorkspace,b as registerWorkspaceStrict,d as restoreWorkspaceRegistrationStrict,g as syncWorkspaceProjects,e as unregisterWorkspaceStrict}from'./chunk-EHH4SKVH.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,e as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_REPORTS_INDEX_PATH,d as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildCanonicalAgentReportReadOrder,j as buildWorkspaceAgentReportsIndex,k as parseAgentGroundingTargets,l as syncWorkspaceAgentGrounding}from'./chunk-
|
|
1
|
+
export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,e as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_REPORTS_INDEX_PATH,d as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildCanonicalAgentReportReadOrder,j as buildWorkspaceAgentReportsIndex,k as parseAgentGroundingTargets,l as syncWorkspaceAgentGrounding}from'./chunk-DUBOKZMA.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,L as LEGACY_COPILOT_GROUNDING_SKILL_PATH,x as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,N as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,m as LEGACY_CURSOR_GROUNDING_RULE_PATH,T as LEGACY_MCP_DESIGN_REPORT_PATH,V as LEGACY_VSCODE_AGENT_HOOKS_PATH,K as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,w as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,M as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,j as WORKSPAI_CURSOR_DIAGNOSE_RULE_PATH,i as WORKSPAI_CURSOR_EVIDENCE_RULE_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,l as WORKSPAI_CURSOR_RELEASE_RULE_PATH,k as WORKSPAI_CURSOR_REPAIR_RULE_PATH,S as WORKSPAI_MCP_DESIGN_REPORT_PATH,U as WORKSPAI_VSCODE_AGENT_HOOKS_PATH,n as WORKSPAI_WINDSURF_RULES_PATH}from'./chunk-H5RJCS5E.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as WORKSPACE_ARCHIVE_KIND,e as WORKSPACE_ARCHIVE_MANIFEST_PATH,h as assertSafeRemoteArchiveUrl,o as doctorWorkspaceArchive,l as exportWorkspaceArchive,p as hydrateWorkspaceArchive,m as inspectWorkspaceArchive,g as isPrivateAddress,j as isSafeArchiveEntryName,i as sanitizeWorkspaceArchiveName,k as shouldExcludeWorkspaceArchivePath,n as verifyWorkspaceArchive}from'./chunk-
|
|
1
|
+
export{f as WORKSPACE_ARCHIVE_KIND,e as WORKSPACE_ARCHIVE_MANIFEST_PATH,h as assertSafeRemoteArchiveUrl,o as doctorWorkspaceArchive,l as exportWorkspaceArchive,p as hydrateWorkspaceArchive,m as inspectWorkspaceArchive,g as isPrivateAddress,j as isSafeArchiveEntryName,i as sanitizeWorkspaceArchiveName,k as shouldExcludeWorkspaceArchivePath,n as verifyWorkspaceArchive}from'./chunk-6JX56VAL.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-
|
|
1
|
+
export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-PD7Y6HIM.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as WORKSPACE_CONTRACT_PATH,i as WORKSPACE_CONTRACT_SCHEMA_VERSION,h as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,j as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,k as WorkspaceContractVerificationError,m as buildWorkspaceContract,q as buildWorkspaceContractGraph,l as discoverProjectJsonFiles,p as readWorkspaceContract,o as syncWorkspaceContract,r as verifyWorkspaceContract,n as writeWorkspaceContract,s as writeWorkspaceContractVerifyEvidence}from'./chunk-
|
|
1
|
+
export{g as WORKSPACE_CONTRACT_PATH,i as WORKSPACE_CONTRACT_SCHEMA_VERSION,h as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,j as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,k as WorkspaceContractVerificationError,m as buildWorkspaceContract,q as buildWorkspaceContractGraph,l as discoverProjectJsonFiles,p as readWorkspaceContract,o as syncWorkspaceContract,r as verifyWorkspaceContract,n as writeWorkspaceContract,s as writeWorkspaceContractVerifyEvidence}from'./chunk-7FF5EOIO.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-4XEH3WNV.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-H5RJCS5E.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-VA5VSOBL.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-D4UHRJAP.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-H5RJCS5E.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-L5CCIIF2.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 {c as c$1}from'./chunk-
|
|
1
|
+
import {c as c$1}from'./chunk-JRP6WP5C.js';import {a}from'./chunk-2LIVMG5C.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 c$1(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-QVSJKKTX.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-VQOWB26M.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c}from'./chunk-EWZZUQBR.js';import g from'crypto';import H from'path';var M="workspace-graph-stream.v1";function w(o){return c({...o,generatedAt:"<ignored>",proofs:o.proofs.map(s=>({...s,observedAt:"<ignored>"}))})}function f(o){return "observedAt"in o?{...o,observedAt:"<ignored>"}:o}function u(o,s){let e=new Map(o.map(r=>[r.id,r])),a=new Map(s.map(r=>[r.id,r])),i=s.filter(r=>!e.has(r.id)),p=s.filter(r=>{let t=e.get(r.id);return t?c(f(t))!==c(f(r)):false}),d=o.filter(r=>!a.has(r.id)).map(r=>r.id);return {added:i,updated:p,removed:d}}function E(o,s){let e=new Map(o.map(a=>[a.id,a]));return s.filter(a=>{let i=e.get(a.id);return !i||c(i)!==c(a)})}function I(o){return a(o,"contracts/workspace-intelligence/workspace-graph-stream.v1.json","Workspace graph stream event"),o}var R=class{previous=null;revision=0;generation=0;workspaceId;sessionId;now;nextCorrelationId;constructor(s){this.workspaceId=`workspace:${g.createHash("sha256").update(H.resolve(s.workspacePath)).digest("hex")}`,this.sessionId=s.sessionId??g.randomUUID(),this.now=s.now??(()=>new Date),this.nextCorrelationId=s.correlationId??(()=>g.randomUUID());}publish(s,e){b(e,s);let a=this.now().toISOString(),i=d(s),p=w(e),d$1=this.nextCorrelationId(),r={schemaVersion:M,workspaceId:this.workspaceId,sessionId:this.sessionId,generation:this.generation,modelHash:i,graphHash:p,generatedAt:a,causationId:d$1,correlationId:d$1};if(!this.previous){let S=I({...r,type:"graph.snapshot",revision:this.revision,payload:{graph:e,reason:"initial"}});return this.previous=e,S}let t=this.previous,W=this.revision,b$1=t.source.hash,y=w(t);this.revision+=1,this.generation+=1;let c$1=u(t.entities,e.entities),h=u(t.relations,e.relations),l=u(t.proofs,e.proofs),G=c(t.quality)!==c(e.quality),A=I({...r,generation:this.generation,type:"graph.delta",baseRevision:W,baseModelHash:b$1,baseGraphHash:y,revision:this.revision,payload:{entitiesAdded:c$1.added,entitiesUpdated:c$1.updated,entitiesRemoved:c$1.removed,relationsAdded:h.added,relationsUpdated:h.updated,relationsRemoved:h.removed,proofsAdded:l.added,proofsUpdated:l.updated,proofsRemoved:l.removed,providersUpdated:E(t.providers,e.providers),quality:G?e.quality:null,diagnostics:e.diagnostics}});return this.previous=e,A}};export{M as WORKSPACE_GRAPH_STREAM_SCHEMA_VERSION,R as WorkspaceGraphStreamPublisher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_GRAPH_TOKEN_EFFICIENCY_SCHEMA_VERSION,b as buildWorkspaceGraphTokenEfficiencyReport}from'./chunk-H7MRINGP.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-L5CCIIF2.js';
|
|
@@ -1 +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,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,i as isGitDiffSource,h as migrateLegacyWorkspaceModelSnapshot,j as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-
|
|
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,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,i as isGitDiffSource,h as migrateLegacyWorkspaceModelSnapshot,j as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-VA5VSOBL.js';export{d as hashWorkspaceModel}from'./chunk-EWZZUQBR.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1,b as b$1,c,d as d$1}from'./chunk-
|
|
1
|
+
import {a as a$1,b as b$1,c,d as d$1}from'./chunk-5U4L6VF2.js';import {a}from'./chunk-AFIFZTOY.js';import {e}from'./chunk-6UNATTB7.js';import d from'crypto';import s from'path';import {open,unlink,stat}from'fs/promises';import u from'fs-extra';var k=e.evaluationLive,O=e.evaluationLastRun,W="contracts/workspace-intelligence/model-usage-event.v1.json",E="contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",P="contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json",_=3e4,N=100,b=25;function C(){return {modelCalls:0,toolCalls:0,tokenSources:{providerReported:0,tokenizerCounted:0,estimated:0,unavailable:0},tokens:{input:0,output:0,cachedInput:0,reasoning:0,observedTotal:0},latencyMs:0,costs:[],outcome:{status:"unknown",verified:false,blockersResolved:0},efficiency:{tokensPerVerifiedOutcome:null,noProgressDecisions:0,repeatedArtifactReads:0}}}function m(t){return t??0}function S(t){let e=C(),a=new Map,n=new Map;for(let o of t){if(o.kind==="model-call"){e.modelCalls+=1;let r={"provider-reported":"providerReported","tokenizer-counted":"tokenizerCounted",estimated:"estimated",unavailable:"unavailable"}[o.modelCall.source];if(e.tokenSources[r]+=1,e.tokens.input+=m(o.modelCall.inputTokens),e.tokens.output+=m(o.modelCall.outputTokens),e.tokens.cachedInput+=m(o.modelCall.cachedInputTokens),e.tokens.reasoning+=m(o.modelCall.reasoningTokens),e.latencyMs+=o.modelCall.latencyMs??0,o.modelCall.cost){let i=o.modelCall.cost.currency.toUpperCase(),l=n.get(i)??{currency:i,amount:0,providerReported:0,estimated:0};l.amount+=o.modelCall.cost.amount,o.modelCall.cost.source==="provider-reported"?l.providerReported+=o.modelCall.cost.amount:l.estimated+=o.modelCall.cost.amount,n.set(i,l);}continue}if(o.kind==="tool-call"){e.toolCalls+=1,e.latencyMs+=o.toolCall.durationMs??0,!o.toolCall.changedSource&&o.toolCall.result==="passed"&&(e.efficiency.noProgressDecisions+=1),o.toolCall.artifact&&a.set(o.toolCall.artifact,(a.get(o.toolCall.artifact)??0)+1);continue}o.kind==="outcome"&&(e.outcome={status:o.outcome.status,verified:o.outcome.verified,blockersResolved:o.outcome.blockersResolved});}return e.tokens.observedTotal=e.tokens.input+e.tokens.output,e.costs=[...n.values()].map(o=>({...o,amount:Number(o.amount.toFixed(8)),providerReported:Number(o.providerReported.toFixed(8)),estimated:Number(o.estimated.toFixed(8))})).sort((o,r)=>o.currency.localeCompare(r.currency)),e.efficiency.repeatedArtifactReads=[...a.values()].reduce((o,r)=>o+Math.max(0,r-1),0),e.efficiency.tokensPerVerifiedOutcome=e.outcome.verified&&e.outcome.status==="passed"?e.tokens.observedTotal:null,e}function x(t,e=new Date){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Evaluation event must be a JSON object.");let a$2=t,n={...a$2,schemaVersion:a$1,eventId:typeof a$2.eventId=="string"&&a$2.eventId.trim()?a$2.eventId.trim():d.randomUUID(),recordedAt:typeof a$2.recordedAt=="string"&&a$2.recordedAt.trim()?a$2.recordedAt:e.toISOString()};a(n,W,"workspace evaluation event");let o={"model-call":"modelCall","tool-call":"toolCall",outcome:"outcome",milestone:"milestone"}[n.kind],r=["modelCall","toolCall","outcome","milestone"].filter(i=>a$2[i]!==void 0);if(r.length!==1||r[0]!==o)throw new Error(`Evaluation event kind ${n.kind} requires only ${o}.`);if(n.kind==="model-call"&&n.modelCall.source!=="unavailable"&&n.modelCall.inputTokens===null&&n.modelCall.outputTokens===null)throw new Error("Measured model calls require at least one input or output token count.");return n}function J(t){let e=t.now??new Date,a$1=s.resolve(t.workspacePath),n={schemaVersion:b$1,runId:t.runId??d.randomUUID(),sessionId:t.sessionId??d.randomUUID(),status:"live",startedAt:e.toISOString(),updatedAt:e.toISOString(),workspace:{name:t.workspaceName?.trim()||s.basename(a$1),path:a$1},configuration:{taskId:t.taskId.trim(),strategy:t.strategy??"workspace-intelligence",...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.temperature!==void 0?{temperature:t.temperature}:{},...t.baselineRunId?{baselineRunId:t.baselineRunId}:{}},methodology:{id:"provider-usage-and-verified-outcome.v1",claimBoundary:"Provider-reported and tokenizer-counted values are measured; estimated values remain explicitly labelled. Verified task success is required before reporting tokens per successful outcome."},events:[],summary:C()};return a(n,E,"workspace evaluation"),n}async function L(t,e){await u.ensureDir(s.dirname(t));let a=`${t}.${process.pid}.${d.randomUUID()}.tmp`;try{await u.writeJson(a,e,{spaces:2}),await u.rename(a,t);}finally{await u.remove(a).catch(()=>{});}}async function A(t,e){let a=s.join(s.resolve(t),`${k}.lock`);await u.ensureDir(s.dirname(a));for(let n=0;n<N;n+=1)try{let o=await open(a,"wx");try{return await o.writeFile(JSON.stringify({pid:process.pid,acquiredAt:new Date().toISOString()})),await e()}finally{await o.close(),await unlink(a).catch(()=>{});}}catch(o){if(o.code!=="EEXIST")throw o;let i=await stat(a).catch(()=>null);if(i&&Date.now()-i.mtimeMs>_){await unlink(a).catch(()=>{});continue}await new Promise(l=>setTimeout(l,b));}throw new Error("Timed out waiting for the workspace evaluation writer lock.")}async function v(t,e,a$1=k){let n=s.join(s.resolve(t),a$1);return a(e,E,a$1),await L(n,e),n}async function T(t,e=k){let a$1=s.isAbsolute(e)?e:s.join(s.resolve(t),e),n=await u.readJson(a$1);return a(n,E,a$1),n}async function G(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath);if(e.status!=="live")throw new Error(`Evaluation ${e.runId} is ${e.status}; initialize a new run.`);let a=x(t.payload,t.now);if(e.events.some(o=>o.eventId===a.eventId))return e;let n={...e,updatedAt:(t.now??new Date).toISOString(),events:[...e.events,a],summary:S([...e.events,a])};return await v(t.workspacePath,n),n})}async function H(t){return A(t.workspacePath,async()=>{let e=await T(t.workspacePath),a=(t.now??new Date).toISOString(),n={...e,status:t.status??"completed",updatedAt:a,completedAt:a,summary:S(e.events)},o=await v(t.workspacePath,n,O);return await v(t.workspacePath,n),{report:n,outputPath:o}})}function q(t,e){let a$1=t.summary.tokens.observedTotal,n=e.summary.tokens.observedTotal,o=a$1-n,r={schemaVersion:c,generatedAt:new Date().toISOString(),taskAligned:t.configuration.taskId===e.configuration.taskId,current:{runId:t.runId,strategy:t.configuration.strategy,tokens:a$1,verified:t.summary.outcome.verified,status:t.summary.outcome.status},baseline:{runId:e.runId,strategy:e.configuration.strategy,tokens:n,verified:e.summary.outcome.verified,status:e.summary.outcome.status},delta:{tokens:o,reductionPercent:n===0?null:Number((-o/n*100).toFixed(2)),modelCalls:t.summary.modelCalls-e.summary.modelCalls,toolCalls:t.summary.toolCalls-e.summary.toolCalls,latencyMs:Number((t.summary.latencyMs-e.summary.latencyMs).toFixed(2))},comparableOutcome:t.summary.outcome.verified&&e.summary.outcome.verified&&t.summary.outcome.status===e.summary.outcome.status};return a(r,P,"workspace evaluation comparison"),r}function B(){if(d$1.length!==4)throw new Error("Model usage source taxonomy is incomplete.")}export{O as WORKSPACE_EVALUATION_LAST_RUN_PATH,k as WORKSPACE_EVALUATION_LIVE_PATH,G as appendWorkspaceEvaluationEvent,B as assertWorkspaceEvaluationSourceTaxonomy,q as compareWorkspaceEvaluations,J as createWorkspaceEvaluation,H as finalizeWorkspaceEvaluation,x as normalizeWorkspaceEvaluationEvent,T as readWorkspaceEvaluation,S as summarizeWorkspaceEvaluation,v as writeWorkspaceEvaluation};
|
package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-M47QR3JM.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,b as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,c as runWorkspaceIntelligenceChain}from'./chunk-
|
|
1
|
+
export{a as WORKSPACE_INTELLIGENCE_RUN_REPORT_PATH,b as WORKSPACE_INTELLIGENCE_RUN_SCHEMA_VERSION,c as runWorkspaceIntelligenceChain}from'./chunk-OI2VOU6S.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{j as WORKSPACE_INTELLIGENCE_ADDITIONAL_PRODUCERS,e as WORKSPACE_INTELLIGENCE_ARTIFACTS,f as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMAS,g as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMA_CONTRACTS,k as WORKSPACE_INTELLIGENCE_COMMAND_SIGNATURES,o as WORKSPACE_INTELLIGENCE_PREFLIGHT_ARTIFACTS,n as WORKSPACE_INTELLIGENCE_PREFLIGHT_IDS,l as WORKSPACE_INTELLIGENCE_ROOT_COMMANDS,p as WORKSPACE_INTELLIGENCE_RUNTIME_STEPS,m as WORKSPACE_INTELLIGENCE_STEP_IDS,i as WORKSPACE_SUPPLEMENTAL_ARTIFACTS,h as WORKSPACE_SUPPLEMENTAL_ARTIFACT_CONTRACTS,q as workspaceIntelligenceRuntimeStep}from'./chunk-
|
|
1
|
+
export{j as WORKSPACE_INTELLIGENCE_ADDITIONAL_PRODUCERS,e as WORKSPACE_INTELLIGENCE_ARTIFACTS,f as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMAS,g as WORKSPACE_INTELLIGENCE_ARTIFACT_SCHEMA_CONTRACTS,k as WORKSPACE_INTELLIGENCE_COMMAND_SIGNATURES,o as WORKSPACE_INTELLIGENCE_PREFLIGHT_ARTIFACTS,n as WORKSPACE_INTELLIGENCE_PREFLIGHT_IDS,l as WORKSPACE_INTELLIGENCE_ROOT_COMMANDS,p as WORKSPACE_INTELLIGENCE_RUNTIME_STEPS,m as WORKSPACE_INTELLIGENCE_STEP_IDS,i as WORKSPACE_SUPPLEMENTAL_ARTIFACTS,h as WORKSPACE_SUPPLEMENTAL_ARTIFACT_CONTRACTS,q as workspaceIntelligenceRuntimeStep}from'./chunk-6UNATTB7.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_KNOWLEDGE_GRAPH_REPORT_PATH,b as assertWorkspaceKnowledgeGraphSourceBinding,e as buildWorkspaceKnowledgeGraph,c as computeWorkspaceKnowledgeGraphInputFingerprint,f as knowledgeEntityId,d as workspaceKnowledgeGraphInputsMatchLiveState}from'./chunk-VQOWB26M.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as WORKSPACE_KNOWLEDGE_CONFIDENCE_LEVELS,d as WORKSPACE_KNOWLEDGE_DERIVATIONS,b as WORKSPACE_KNOWLEDGE_ENTITY_KINDS,g as WORKSPACE_KNOWLEDGE_FRESHNESS_LEVELS,a as WORKSPACE_KNOWLEDGE_GRAPH_SCHEMA_VERSION,c as WORKSPACE_KNOWLEDGE_RELATION_KINDS,e as WORKSPACE_KNOWLEDGE_TRUST_LEVELS}from'./chunk-
|
|
1
|
+
export{f as WORKSPACE_KNOWLEDGE_CONFIDENCE_LEVELS,d as WORKSPACE_KNOWLEDGE_DERIVATIONS,b as WORKSPACE_KNOWLEDGE_ENTITY_KINDS,g as WORKSPACE_KNOWLEDGE_FRESHNESS_LEVELS,a as WORKSPACE_KNOWLEDGE_GRAPH_SCHEMA_VERSION,c as WORKSPACE_KNOWLEDGE_RELATION_KINDS,e as WORKSPACE_KNOWLEDGE_TRUST_LEVELS}from'./chunk-AP4PV6WJ.js';
|
|
@@ -1 +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-
|
|
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-JC4XSU7G.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as readWorkspaceKnowledgeGraphSnapshot}from'./chunk-UPIPSSXY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-
|
|
1
|
+
export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-2LIVMG5C.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b}from'./chunk-4XEH3WNV.js';import {d,c as c$2,f as f$1,e as e$2}from'./chunk-JC4XSU7G.js';import {c as c$1,e as e$1}from'./chunk-D4UHRJAP.js';import {c as c$3,b as b$3}from'./chunk-H5RJCS5E.js';import {b as b$2}from'./chunk-PD7Y6HIM.js';import {d as d$2}from'./chunk-UOCERSAN.js';import {b as b$1}from'./chunk-VQOWB26M.js';import {l}from'./chunk-PJPS7CNH.js';import {h}from'./chunk-7FF5EOIO.js';import {d as d$1}from'./chunk-GAYK3WGV.js';import {a}from'./chunk-AFIFZTOY.js';import {e,g as g$1}from'./chunk-6UNATTB7.js';import {w}from'./chunk-VQZ5PI5J.js';import k from'path';import F from'readline';import R from'fs-extra';var D=e.agentIndex,U=new Map(Object.keys(e).flatMap(e$1=>{let t=g$1[e$1];return t?[[e[e$1],t]]:[]}));function z(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 B={type:"object",properties:{data:true,error:{type:"object",properties:{code:{type:"string"},message:{type:"string"}},required:["code","message"],additionalProperties:false}},oneOf:[{required:["data"]},{required:["error"]}],additionalProperties:false},X={readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},K=[{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:"getWorkspaceEvaluation",description:"Read the live or finalized provenance-aware model usage and verified-outcome report",inputSchema:{type:"object",properties:{live:{type:"boolean",description:"Read the live report instead of the finalized last-run report"}}}},{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"},projectId:{type:"string",description:"Optional canonical project id 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>"}}}}].map(e=>({...e,title:e.name.replace(/([a-z])([A-Z])/g,"$1 $2"),inputSchema:{...e.inputSchema,additionalProperties:false},outputSchema:B,annotations:X}));function Y(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!k.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function c(e$1,t){if(!Y(t))throw new Error(`Unsafe artifact path: ${t}`);let n=await d$1(e$1,t)??k.join(e$1,t);if(!await R.pathExists(n))return null;let r=await R.readJson(n),o=w(t),p=U.get(o);if(p&&a(r,p,`MCP artifact ${o}`),o===e.knowledgeGraph){let s=k.join(e$1,l);if(!await R.pathExists(s))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let u=await R.readJson(s);b$1(r,u);}return r}async function Z(e){let t=[],n=new Set,o=((await c(e,d$2))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$2,reasons:o});for(let i of o)n.add(i);}let p=await c(e,c$3);if(e$1(p)){let i=(p.blockingReasons??[]).filter(l=>typeof l=="string"&&l.trim().length>0);if(i.length>0){t.push({artifact:c$3,reasons:i});for(let l of i)n.add(l);}}let s=await c(e,h),u=(s?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(u.length>0||String(s?.status??"").toLowerCase()==="failed"){let i=u.length>0?u:["Workspace contract verification failed"];t.push({artifact:h,reasons:i});for(let l of i)n.add(l);}return {blockingReasons:[...n],sources:t}}async function V(e$3,t,n){switch(t){case "getWorkspaceModel":return c(e$3,l);case "getWorkspaceKnowledgeGraph":return c(e$3,e.knowledgeGraph);case "getWorkspaceEvaluation":return c(e$3,n.live===true?e.evaluationLive:e.evaluationLastRun);case "queryWorkspaceEntities":{let r=await c(e$3,e.knowledgeGraph);if(!r)return null;let o=String(n.kind??"").trim();return {schemaVersion:r.schemaVersion,generatedAt:r.generatedAt,entities:e$2(r,o||void 0)}}case "searchWorkspaceGraph":{let r=await c(e$3,e.knowledgeGraph);if(!r)return null;let o=typeof n.limit=="number"?n.limit:Number(n.limit??12);return f$1(r,{query:String(n.query??""),...typeof n.kind=="string"&&n.kind.trim()?{kind:n.kind.trim()}:{},...typeof n.projectId=="string"&&n.projectId.trim()?{projectId:n.projectId.trim()}:{},limit:Number.isFinite(o)?o:12,projection:"agent"})}case "getWorkspaceGraphEvidence":{let r=await c(e$3,e.knowledgeGraph);return r?c$2(r,String(n.query??"")):null}case "findWorkspaceGraphPath":{let r=await c(e$3,e.knowledgeGraph);return r?d(r,String(n.from??""),String(n.to??"")):null}case "getEvidenceIndex":return c(e$3,D);case "getBlockers":return Z(e$3);case "getSafeCommands":return {safeCommands:(await c(e$3,b$2))?.safeCommands??[]};case "getProjectContext":{let r=await c(e$3,b$2);if(!r)return null;let o=String(n.project??"").trim(),p=r.scope?.activeProject??void 0,s=o||p,u=Array.isArray(r.projects)?r.projects:[],i=s&&u.find(l=>typeof l.name=="string"&&l.name.toLowerCase()===s.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:i??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(n.relativePath??"").trim();return c(e$3,r)}case "listOperationalSkills":return c(e$3,b$3);case "getWorkspaceExplain":{let r=String(n.target??"release-blocked").trim(),o=c$1(r);if(!o)throw new Error(`Invalid explain target: ${r}`);let p=await c(e$3,c$3);return e$1(p)&&z(p.target,o)?p:b({workspacePath:e$3,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}var $="2026-07-28",H=["2024-11-05","2025-03-26","2025-06-18","2025-11-25"],J={name:"workspai-workspace-mcp",version:"1.0.0"};function Q(e){let t=e.params?._meta;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t["io.modelcontextprotocol/protocolVersion"];return typeof n=="string"?n:void 0}function ee(e,t){return !t||!e||typeof e!="object"||Array.isArray(e)?e:{...e,_meta:{...e._meta??{},"io.modelcontextprotocol/serverInfo":J}}}function f(e,t,n=false){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:ee(t,n)})}
|
|
2
|
+
`);}function g(e,t,n=-32e3){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:n,message:t}})}
|
|
3
|
+
`);}function te(e){let t={data:e};return {content:[{type:"text",text:JSON.stringify(t,null,2)}],structuredContent:t,isError:false}}function j(e,t){return {content:[{type:"text",text:t}],structuredContent:{error:{code:e,message:t}},isError:true}}function ne(e,t){for(let n of e.inputSchema.required??[])if(!(n in t))return `Missing required argument: ${n}`;for(let[n,r]of Object.entries(t)){let o=e.inputSchema.properties[n];if(!o)return `Unknown argument for ${e.name}: ${n}`;if(o.type==="string"&&typeof r!="string")return `Argument ${n} must be a string`;if(o.type==="boolean"&&typeof r!="boolean")return `Argument ${n} must be a boolean`;if(o.type==="integer"&&(!Number.isInteger(r)||typeof r!="number"))return `Argument ${n} must be an integer`;if(typeof r=="number"){if(typeof o.minimum=="number"&&r<o.minimum)return `Argument ${n} must be at least ${o.minimum}`;if(typeof o.maximum=="number"&&r>o.maximum)return `Argument ${n} must be at most ${o.maximum}`}}return null}async function Se(e){let t=k.resolve(e.workspacePath),n=F.createInterface({input:process.stdin,terminal:false});for await(let r of n){let o=r.trim();if(!o)continue;let p;try{p=JSON.parse(o);}catch{g(null,"Invalid JSON-RPC request",-32700);continue}let{id:s,method:u,params:i}=p,l=Q(p)===$;try{if(u==="server/discover"){f(s,{resultType:"complete",supportedVersions:[$],capabilities:{tools:{listChanged:false}},instructions:"Use bounded Workspai graph search before requesting complete workspace artifacts."},true);continue}if(u==="initialize"){let a=typeof i?.protocolVersion=="string"?i.protocolVersion:void 0,y=H.includes(a)?a:H.at(-1);f(s,{protocolVersion:y,capabilities:{tools:{listChanged:false}},serverInfo:J});continue}if(u==="notifications/initialized")continue;if(u==="tools/list"){f(s,{tools:K.map(a=>({name:a.name,title:a.title,description:a.description,inputSchema:a.inputSchema,outputSchema:a.outputSchema,annotations:a.annotations}))},l);continue}if(u==="tools/call"){let a=String(i?.name??""),y=K.find(m=>m.name===a);if(!y){g(s,`Unknown tool: ${a}`,-32602);continue}if(i?.arguments!==void 0&&(!i.arguments||typeof i.arguments!="object"||Array.isArray(i.arguments))){g(s,"Tool arguments must be an object",-32602);continue}let O=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},_=ne(y,O);if(_){f(s,j("invalid_arguments",_),l);continue}try{let m=await V(t,a,O);f(s,m==null?j("artifact_not_found",`${a} returned no current workspace data`):te(m),l);}catch(m){f(s,j("tool_execution_failed",m instanceof Error?m.message:String(m)),l);}continue}g(s,`Unsupported method: ${u??"unknown"}`,-32601);}catch(a){g(s,a instanceof Error?a.message:String(a));}}}async function Ee(e,t,n={}){return V(k.resolve(e),t,n)}export{K as WORKSPACE_MCP_READ_TOOLS,Ee as invokeMcpToolForTest,Se as runWorkspaceMcpServe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{l as WORKSPACE_MODEL_REPORT_PATH,k as WORKSPACE_MODEL_SCHEMA_VERSION,q as buildWorkspaceModel,r as buildWorkspaceModelCached,p as buildWorkspaceModelFacts,s as buildWorkspaceModelIncremental,n as createWorkspaceModelBuildProvenance,o as validateWorkspaceModelStrict,m as workspaceModelProjectTopology,t as writeWorkspaceModel}from'./chunk-PJPS7CNH.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-
|
|
1
|
+
export{b as finalizeWorkspaceOnboarding,a as syncWorkspaceConsumerArtifacts}from'./chunk-IVF6NEHS.js';
|
package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b}from'./chunk-
|
|
1
|
+
import {a,b}from'./chunk-2LIVMG5C.js';import {t,q}from'./chunk-VQZ5PI5J.js';import l from'fs-extra';function c(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async function m(n,e,o){let s=(await Promise.all(t(n,e).map(async r=>({candidate:r,exists:await l.pathExists(r)})))).find(({exists:r})=>r)?.candidate;if(!s)return false;let t$1=q(n,e),a=c(await l.readJson(s));return await l.outputJson(t$1,o(a),{spaces:2}),await l.appendFile(t$1,`
|
|
2
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-C4S22E6S.js';import {h as h$1}from'./chunk-GAYK3WGV.js';import g from'path';import i from'fs-extra';var l="README.md",h="<!-- workspai:workspace-intelligence:start -->",c="<!-- workspai:workspace-intelligence:end -->",m={minimal:"A lightweight workspace boundary that adds runtimes only when you need them.","node-only":"A Node.js-focused workspace with shared evidence and agent grounding.","python-only":"A Python-focused workspace with shared evidence and agent grounding.","go-only":"A Go-focused workspace with shared evidence and agent grounding.","java-only":"A Java-focused workspace with shared evidence and agent grounding.","dotnet-only":"A .NET-focused workspace with shared evidence and agent grounding.",polyglot:"A multi-runtime workspace for projects that share contracts, evidence, and agents.",enterprise:"A governed multi-runtime workspace with the complete evidence, policy, and agent surface."};function w(e){return e?.trim()||"minimal"}async function u(e){let n=g.join(e,".workspai","workspace.json");return await i.pathExists(n)?await i.readJson(n).catch(()=>({})):{}}function f(e){let n=e.engine;if(!n)return;if(n.python_core?.status==="skipped")return "Optional Python engine: not installed";if(n.python_version)return `Optional Python engine: Python ${n.python_version} via ${n.install_method||"local environment"}`}function y(e){let n=w(e.profile),r=b$1().presentations.standard.nodes.map(s=>s.label).join(" \u2192 "),a=e.projectCount===1?"project":"projects",t=m[n]??"A governed workspace with shared evidence for developers, tools, CI, IDEs, and AI agents.";return `${h}
|
|
2
2
|
# ${e.workspaceName}
|
|
3
3
|
|
|
4
4
|
This is a **Workspai Workspace Intelligence** workspace. It gives every registered project one shared, evidence-backed view for developers, CI, IDEs, and AI agents.
|
|
@@ -74,4 +74,4 @@ ${c}`}function v(e){return e.includes("# Workspai Workspace")&&e.includes("This
|
|
|
74
74
|
`:"")}`.trimEnd()}if(!e.trim()||v(e))return n;let a=n.replace(/^# .+$/m,"## Workspace Intelligence");return `${e.trimEnd()}
|
|
75
75
|
|
|
76
76
|
${a}`}async function b(e){let n=await u(e.workspacePath),o=y({workspaceName:e.workspaceName,profile:e.profile,projectCount:e.projectCount,engineSummary:f(n)}),r=g.join(e.workspacePath,l),a=await i.pathExists(r)?await i.readFile(r,"utf-8"):"",t=`${j(a,o)}
|
|
77
|
-
`;return t!==a&&await
|
|
77
|
+
`;return t!==a&&await h$1(e.workspacePath,l,t),r}export{c as WORKSPACE_README_MANAGED_END,h as WORKSPACE_README_MANAGED_START,l as WORKSPACE_README_PATH,y as renderWorkspaceReadmeManagedBlock,b as syncWorkspaceReadme};
|
package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-QVSJKKTX.js}
RENAMED
|
@@ -1 +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-
|
|
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-ZQH2I5RQ.js';
|