quantex-cli 0.26.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dist/{agents-CMkLsOPA.mjs → agents-RFc5BDHs.mjs} +1 -1
  4. package/dist/{capabilities-qsoTR0q_.mjs → capabilities-5--AYhRe.mjs} +1 -1
  5. package/dist/capabilities-rry5ZK1R.mjs +1 -0
  6. package/dist/cli.mjs +1 -1
  7. package/dist/{color-ChvF_SAo.mjs → color-BjsL_hvq.mjs} +2 -2
  8. package/dist/{commands-Bc5FD_Iq.mjs → commands-XGZQbCkS.mjs} +1 -1
  9. package/dist/commands-cDGqmjd7.mjs +1 -0
  10. package/dist/{config-Jtw7uDrr.mjs → config-t0R0Mv01.mjs} +1 -1
  11. package/dist/{detect-C9Mnu6HP.mjs → detect-C-llI1gs.mjs} +1 -1
  12. package/dist/{doctor-k5nm7p2Q.mjs → doctor-CVAcacpJ.mjs} +1 -1
  13. package/dist/ensure-BblqXICK.mjs +1 -0
  14. package/dist/{ensure-DDXjblHQ.mjs → ensure-PcmmwgM_.mjs} +1 -1
  15. package/dist/index.d.mts +2 -1
  16. package/dist/index.mjs +2 -2
  17. package/dist/{info-zIXjpak-.mjs → info-D7pP264B.mjs} +1 -1
  18. package/dist/{inspect-C1i137bS.mjs → inspect-Blp-Ypr2.mjs} +1 -1
  19. package/dist/inspect-DBjdBmAV.mjs +1 -0
  20. package/dist/install-XYi-6TpB.mjs +1 -0
  21. package/dist/{list-DGPf3ofK.mjs → list-Okv_jJrm.mjs} +1 -1
  22. package/dist/resolve-B9bzClte.mjs +1 -0
  23. package/dist/{resolve-Cgwj-fj5.mjs → resolve-BtGd-SR3.mjs} +1 -1
  24. package/dist/schema-CxrGfAJi.mjs +1 -0
  25. package/dist/{schema-Hlu23n9-.mjs → schema-Dlq9AKfh.mjs} +1 -1
  26. package/dist/{uninstall-C8P8gg5e.mjs → uninstall-DxOgxrj4.mjs} +1 -1
  27. package/dist/{update-BofH1LoM.mjs → update-C16VUYlh.mjs} +1 -1
  28. package/dist/{update-CZwVKNs1.mjs → update-DTQR_h0V.mjs} +1 -1
  29. package/dist/{upgrade-YyJe59oG.mjs → upgrade-B3BA1_Mb.mjs} +1 -1
  30. package/dist/{user-output-B5Ah0_tJ.mjs → user-output-W4VzwJV2.mjs} +1 -1
  31. package/package.json +1 -1
  32. package/dist/capabilities-BTyTa3uI.mjs +0 -1
  33. package/dist/commands-D-nJHGj2.mjs +0 -1
  34. package/dist/ensure-BsoUqDdw.mjs +0 -1
  35. package/dist/inspect-DXh09zXt.mjs +0 -1
  36. package/dist/install-B7r9UqBe.mjs +0 -1
  37. package/dist/resolve-DXdGh9T8.mjs +0 -1
  38. package/dist/schema-CSnPjYhJ.mjs +0 -1
package/README.md CHANGED
@@ -203,6 +203,7 @@ Note: `qtx upgrade` follows the registry actually used by the current Bun/npm se
203
203
  | Kiro CLI | `qtx kiro` | Amazon's AI coding agent CLI |
204
204
  | MiMoCode | `qtx mimo` | Xiaomi's terminal-native AI coding assistant CLI |
205
205
  | Mistral Vibe | `qtx vibe` | Mistral's open-source CLI coding assistant |
206
+ | OpenClaw | `qtx openclaw` | OpenClaw's open-source AI agent runtime CLI |
206
207
  | OpenHands CLI | `qtx openhands` | OpenHands' open-source software development agent CLI |
207
208
  | OpenCode | `qtx opencode` | Open-source AI coding CLI |
208
209
  | oh-my-pi (OMP) | `qtx omp` | oh-my-pi coding agent CLI |
package/README.zh-CN.md CHANGED
@@ -203,6 +203,7 @@ qtx upgrade --channel beta
203
203
  | Kiro CLI | `qtx kiro` | Amazon AI 编程 Agent CLI |
204
204
  | MiMoCode | `qtx mimo` | 小米终端原生 AI 编程助手 CLI |
205
205
  | Mistral Vibe | `qtx vibe` | Mistral 开源终端编程助手 |
206
+ | OpenClaw | `qtx openclaw` | OpenClaw 开源 AI Agent 运行时 CLI |
206
207
  | OpenHands CLI | `qtx openhands` | OpenHands 开源软件开发 Agent CLI |
207
208
  | OpenCode | `qtx opencode` | 开源 AI 编程 CLI |
208
209
  | oh-my-pi (OMP) | `qtx omp` | oh-my-pi coding agent CLI |
@@ -1 +1 @@
1
- import{At as e,Ct as t,Dt as n,Et as r,F as i,H as a,J as o,K as s,L as c,Ot as ee,Q as l,S as te,U as ne,V as re,W as ie,Y as u,_ as ae,b as oe,bt as se,d as ce,f as le,g as ue,h as de,j as d,lt as f,m as fe,p as pe,q as p,rt as m,v as me,wt as h,x as he,xt as ge,y as _e}from"./color-ChvF_SAo.mjs";import{a as ve,c as ye,d as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as g,u as ke}from"./detect-C9Mnu6HP.mjs";import Ae from"node:process";async function _(e){let t=g(),n=typeof e==`function`?e(t):e;try{return Ae.platform===`win32`?await u(o([`powershell.exe`,`-Command`,n]))===0:await u(o([`sh`,`-c`,n]))===0}catch{return!1}}function je(e){return e===`cask`?[`--cask`]:[]}async function v(e,t,n){try{return await u(o([`brew`,e,...je(n),t]))===0}catch{return!1}}async function Me(e,t){return v(`install`,e,t)}async function y(e,t){return v(`upgrade`,e,t)}async function Ne(e){for(let t of e)if(!await y(t.packageName,t.packageTargetKind))return!1;return!0}async function b(e,t){return v(`uninstall`,e,t)}async function x(e,t,n=[]){try{return await u(o([`cargo`,e,t,...n]))===0}catch{return!1}}async function S(e,t){return x(`install`,e,t)}async function C(e,t){return S(e,[`--force`,...t??[]])}async function Pe(e){for(let t of e)if(!await C(t.packageName,t.packageInstallArgs))return!1;return!0}async function Fe(e){return x(`uninstall`,e)}async function w(e,t=[],n={}){let r=[`deno`,`install`,`--global`];n.force&&r.push(`--force`),r.push(...t,e);try{return await u(o(r))===0}catch{return!1}}async function Ie(e,t){return w(e,t)}async function T(e,t){return w(e,t,{force:!0})}async function Le(e){for(let t of e)if(!await T(t.packageName,t.packageInstallArgs))return!1;return!0}async function Re(e){try{return await u(o([`deno`,`uninstall`,`--global`,e]))===0}catch{return!1}}async function E(e,t=!1){try{return await u(o([`mise`,`use`,`--global`,...t?[`--force`]:[],e]))===0}catch{return!1}}async function ze(e){return E(e)}async function D(e){return E(e,!0)}async function Be(e){for(let t of e)if(!await D(t.packageName))return!1;return!0}async function Ve(e){try{return await u(o([`mise`,`unuse`,`--global`,e]))===0}catch{return!1}}async function O(e){try{let{stdout:t}=await s(p([`mise`,`ls`,`--installed`,`--json`,e],{stdio:[`ignore`,`pipe`,`ignore`]}));if(!t.trim())return{presence:`unknown`};try{let n=JSON.parse(t);if(!A(n))return{presence:`unknown`};let r=k(n,e),i=r?n[r]:void 0;if(!Array.isArray(i)||i.length===0)return{presence:`absent`};let a=We(t,e);return a?{presence:`present`,version:a}:{presence:`present`}}catch{return{presence:`unknown`}}}catch{return{presence:`unknown`}}}async function He(e){return(await O(e)).presence}async function Ue(e){return(await O(e)).version}function We(e,t){try{let n=JSON.parse(e);if(!A(n))return;let r=k(n,t),i=r?n[r]:void 0;if(!Array.isArray(i))return;for(let e of i)if(A(e)&&typeof e.version==`string`&&e.version.length>0)return e.version;return}catch{return}}function k(e,t){if(Array.isArray(e[t]))return t;let n=t.split(`:`).pop()?.split(`/`).pop();if(n)return Object.keys(e).find(t=>t===n&&Array.isArray(e[t]))}function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let j=null;async function Ge(){if(j)return j;for(let e of[[`pip`],[`pip3`],[`python`,`-m`,`pip`],[`python3`,`-m`,`pip`]])try{let{exitCode:t}=await s(p([...e,`--version`]));if(t===0)return j=e,e}catch{}return j=[`pip`],j}async function M(e){try{return await u(o([...await Ge(),...e]))===0}catch{return!1}}async function Ke(e){return M([`install`,e])}async function N(e){return M([`install`,`--upgrade`,e])}async function qe(e){if(e.length===0)return!0;for(let t of e)if(!await N(t.packageName))return!1;return!0}async function Je(e){return M([`uninstall`,`-y`,e])}async function P(e,t,n=[]){try{return await u(o([`uv`,`tool`,e,t,...n]))===0}catch{return!1}}async function Ye(e,t){return P(`install`,e,t)}async function F(e,t){return P(`upgrade`,e,t)}async function Xe(e){for(let t of e)if(!await F(t.packageName,t.packageInstallArgs))return!1;return!0}async function Ze(e){try{return await u(o([`uv`,`tool`,`uninstall`,e]))===0}catch{return!1}}async function I(e){try{let{stdout:t}=await s(p([`uv`,`tool`,`list`],{stdio:[`ignore`,`pipe`,`ignore`]}));if(!t.trim())return{presence:`unknown`};let n=tt(t,e);return n?{presence:`present`,version:n}:et(t)?{presence:`absent`}:{presence:`unknown`}}catch{return{presence:`unknown`}}}async function Qe(e){return(await I(e)).presence}async function $e(e){return(await I(e)).version}function et(e){return e.split(/\r?\n/).some(e=>/^\S+\s+v[^\s]+/.test(e.trim()))}function tt(e,t){let n=L(t);for(let t of e.split(/\r?\n/)){let e=t.trim(),r=/^(\S+)\s+v([^\s]+)/.exec(e);if(!r)continue;let[,i,a]=r;if(L(i)===n)return a}}function L(e){return e.toLowerCase().replaceAll(/[-_.]+/g,`-`)}async function R(e,t){try{return await u(o([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function nt(e){return R(`install`,e)}async function z(e){return R(`upgrade`,e)}async function rt(e){for(let t of e)if(!await z(t.packageName))return!1;return!0}async function it(e){return R(`uninstall`,e)}const at={brew:{type:`brew`,isAvailable:async()=>De(),install:async(e,t)=>Me(e,t),uninstall:async(e,t)=>b(e,t),update:async(e,t)=>y(e,t),updateMany:async e=>Ne(e)},bun:{type:`bun`,getInstalledVersion:async e=>ae(e),probePackagePresence:async e=>_e(e),isAvailable:async()=>xe(),install:async e=>me(e),uninstall:async e=>oe(e),update:async(e,t,n)=>he(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>te(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},cargo:{type:`cargo`,isAvailable:async()=>ve(),install:async(e,t,n)=>S(e,n),uninstall:async e=>Fe(e),update:async(e,t,n)=>C(e,n?.packageInstallArgs),updateMany:async e=>Pe(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},deno:{type:`deno`,isAvailable:async()=>Te(),install:async(e,t,n)=>Ie(e,n),uninstall:async(e,t,n)=>Re(n?.binaryName??e),update:async(e,t,n)=>T(e,n?.packageInstallArgs),updateMany:async e=>Le(e.map(e=>({binaryName:e.binaryName,packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},mise:{type:`mise`,getInstalledVersion:async e=>Ue(e),probePackagePresence:async e=>He(e),isAvailable:async()=>Oe(),install:async e=>ze(e),uninstall:async e=>Ve(e),update:async e=>D(e),updateMany:async e=>Be(e.map(e=>({packageName:e.packageName})))},npm:{type:`npm`,getInstalledVersion:async e=>ce(e),probePackagePresence:async e=>pe(e),isAvailable:async()=>ye(),install:async e=>le(e),uninstall:async e=>fe(e),update:async(e,t,n)=>de(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>ue(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},pip:{type:`pip`,isAvailable:async()=>Se(),install:async e=>Ke(e),uninstall:async e=>Je(e),update:async e=>N(e),updateMany:async e=>qe(e.map(e=>({packageName:e.packageName})))},uv:{type:`uv`,getInstalledVersion:async e=>$e(e),probePackagePresence:async e=>Qe(e),isAvailable:async()=>ke(),install:async(e,t,n)=>Ye(e,n),uninstall:async e=>Ze(e),update:async(e,t,n)=>F(e,n?.packageInstallArgs),updateMany:async e=>Xe(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},winget:{type:`winget`,isAvailable:async()=>be(),install:async e=>nt(e),uninstall:async e=>it(e),update:async e=>z(e),updateMany:async e=>rt(e.map(e=>({packageName:e.packageName})))}};function B(e){return at[e]}const V={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function ot(){return(await m()).defaultPackageManager}async function H(){return{npmBunUpdateStrategy:(await m()).npmBunUpdateStrategy}}async function U(e){let t=g(),n=e.platforms[t];if(!n)return[];let r=await ot();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function W(e,t,n,r,i,a,o){let s=B(e);return await s.isAvailable()?a===`install`?s.install(t,i,r):a===`update`?s.update(t,i,{binaryName:n,npmBunUpdateStrategy:o,packageInstallArgs:r}):s.uninstall(t,i,{binaryName:n}):!1}async function G(t,r,i,a){if(e(r.type)){let e=h(t,r);return e?W(r.type,e,r.binaryName??t.binaryName,r.packageInstallArgs,r.packageTargetKind,i,a):!1}return i===`update`&&!n(r.type)||!r.command?!1:_(r.command)}function K(t,n){if(t.packageName)return t.packageName;if(!(!n||!e(t.installType)))return h(n,{type:t.installType})}async function q(t,n,r){if(e(t.installType)){let e=K(t,r?.agent);return e?W(t.installType,e,t.binaryName,t.packageInstallArgs,t.packageTargetKind,n,r?.updateStrategy):!1}return n!==`install`||!t.command?!1:_(t.command)}async function J(t,n){if(!e(n.type))return;let r=h(t,n);r&&await W(n.type,r,n.binaryName??t.binaryName,n.packageInstallArgs,n.packageTargetKind,`uninstall`)}async function st(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await _(e.join(` `)))return!0;return!1}function ct(e,t){let n={agentName:e.name,installType:t.type,packageName:h(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0},r=t.binaryName??(t.type===`deno`?e.binaryName:void 0);return r&&(n.binaryName=r),t.packageInstallArgs?.length&&(n.packageInstallArgs=t.packageInstallArgs),n}async function Y(e,t){if(f().cancelled)return null;let n=ct(e,t);return f().cancelled?null:(await c(n),f().cancelled?(await i(e.name),null):n)}async function X(e,t){return l(V,async()=>Y(e,t))}async function lt(e){return l(V,async()=>{let t=await U(e);for(let n of t){if(f().cancelled)return{success:!1};if(await G(e,n,`install`)){if(f().cancelled)return await J(e,n),{success:!1};try{let t=await Y(e,n);return t?{success:!0,installedState:t}:(await J(e,n),{success:!1})}catch(t){throw await J(e,n),t}}if(f().cancelled)return await J(e,n),{success:!1}}return{success:!1}})}async function ut(t,n){return l(V,async()=>{let{npmBunUpdateStrategy:r}=await H(),i=await U(t),a=n&&e(n.installType)?K(n,t):void 0;if(n&&await q(n,`update`,{agent:t,updateStrategy:r}))return f().cancelled||(await c(n),f().cancelled)?{success:!1}:{success:!0,installedState:n};if(!n){for(let e of i)if(await G(t,e,`update`,r)){let n=await Y(t,e);return n?{success:!0,installedState:n}:{success:!1}}}return(!n||!e(n.installType)||a)&&await st(t)?{success:!0}:{success:!1}})}async function dt(e,t){return l(V,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}:${e.packageInstallArgs?.join(` `)??``}`,e])).values()];if(n.length===0)return!1;let r=B(e);return await r.isAvailable()?r.updateMany(n,await H()):!1})}async function ft(e,t,n){let r=B(e);if(r.getInstalledVersion&&await r.isAvailable())return r.getInstalledVersion(t,n)}async function pt(t,n){if(!e(t.installType))return!1;let r=B(t.installType);if(!r.getInstalledVersion||!await r.isAvailable())return!1;let i=K(t,n);return i?r.probePackagePresence?await r.probePackagePresence(i,t.packageTargetKind)===`absent`:await r.getInstalledVersion(i,t.packageTargetKind)===void 0:!1}async function mt(e){return l(V,async()=>{let t=await d(e.name);return t&&(!r(t.installType)||await q(t,`uninstall`,{agent:e})||await pt(t,e))?(await i(e.name),!0):!1})}async function Z(e){let[t,n,r]=await Promise.all([U(e),d(e.name),we(e.binaryName)]),[i,a,o]=await Promise.all([r?ht(e,n):Promise.resolve(void 0),r?re(e.binaryName):Promise.resolve(void 0),gt(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,resolvedBinaryPath:await ie(a),sourceLabel:se(n),updateLabel:ge(e,n),lifecycle:n?ee(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function ht(t,n){if(n&&e(n.installType)&&n.packageName){let e=await ft(n.installType,n.packageName,n.packageTargetKind);if(e)return e}return a(t.binaryName,t.versionProbe)}async function gt(e,n,r){let i=t(e,n,r);if(i)return ne(i)}function $(e){return Ee(e)}async function _t(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function vt(){return Q(Ce())}export{Q as a,X as c,dt as d,B as f,Z as i,mt as l,$ as n,U as o,_t as r,lt as s,vt as t,ut as u};
1
+ import{At as e,Ct as t,Dt as n,Et as r,F as i,H as a,J as o,K as s,L as c,Ot as ee,Q as l,S as te,U as ne,V as re,W as ie,Y as u,_ as ae,b as oe,bt as se,d as ce,f as le,g as ue,h as de,j as d,lt as f,m as fe,p as pe,q as p,rt as m,v as me,wt as h,x as he,xt as ge,y as _e}from"./color-BjsL_hvq.mjs";import{a as ve,c as ye,d as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as g,u as ke}from"./detect-C-llI1gs.mjs";import Ae from"node:process";async function _(e){let t=g(),n=typeof e==`function`?e(t):e;try{return Ae.platform===`win32`?await u(o([`powershell.exe`,`-Command`,n]))===0:await u(o([`sh`,`-c`,n]))===0}catch{return!1}}function je(e){return e===`cask`?[`--cask`]:[]}async function v(e,t,n){try{return await u(o([`brew`,e,...je(n),t]))===0}catch{return!1}}async function Me(e,t){return v(`install`,e,t)}async function y(e,t){return v(`upgrade`,e,t)}async function Ne(e){for(let t of e)if(!await y(t.packageName,t.packageTargetKind))return!1;return!0}async function b(e,t){return v(`uninstall`,e,t)}async function x(e,t,n=[]){try{return await u(o([`cargo`,e,t,...n]))===0}catch{return!1}}async function S(e,t){return x(`install`,e,t)}async function C(e,t){return S(e,[`--force`,...t??[]])}async function Pe(e){for(let t of e)if(!await C(t.packageName,t.packageInstallArgs))return!1;return!0}async function Fe(e){return x(`uninstall`,e)}async function w(e,t=[],n={}){let r=[`deno`,`install`,`--global`];n.force&&r.push(`--force`),r.push(...t,e);try{return await u(o(r))===0}catch{return!1}}async function Ie(e,t){return w(e,t)}async function T(e,t){return w(e,t,{force:!0})}async function Le(e){for(let t of e)if(!await T(t.packageName,t.packageInstallArgs))return!1;return!0}async function Re(e){try{return await u(o([`deno`,`uninstall`,`--global`,e]))===0}catch{return!1}}async function E(e,t=!1){try{return await u(o([`mise`,`use`,`--global`,...t?[`--force`]:[],e]))===0}catch{return!1}}async function ze(e){return E(e)}async function D(e){return E(e,!0)}async function Be(e){for(let t of e)if(!await D(t.packageName))return!1;return!0}async function Ve(e){try{return await u(o([`mise`,`unuse`,`--global`,e]))===0}catch{return!1}}async function O(e){try{let{stdout:t}=await s(p([`mise`,`ls`,`--installed`,`--json`,e],{stdio:[`ignore`,`pipe`,`ignore`]}));if(!t.trim())return{presence:`unknown`};try{let n=JSON.parse(t);if(!A(n))return{presence:`unknown`};let r=k(n,e),i=r?n[r]:void 0;if(!Array.isArray(i)||i.length===0)return{presence:`absent`};let a=We(t,e);return a?{presence:`present`,version:a}:{presence:`present`}}catch{return{presence:`unknown`}}}catch{return{presence:`unknown`}}}async function He(e){return(await O(e)).presence}async function Ue(e){return(await O(e)).version}function We(e,t){try{let n=JSON.parse(e);if(!A(n))return;let r=k(n,t),i=r?n[r]:void 0;if(!Array.isArray(i))return;for(let e of i)if(A(e)&&typeof e.version==`string`&&e.version.length>0)return e.version;return}catch{return}}function k(e,t){if(Array.isArray(e[t]))return t;let n=t.split(`:`).pop()?.split(`/`).pop();if(n)return Object.keys(e).find(t=>t===n&&Array.isArray(e[t]))}function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let j=null;async function Ge(){if(j)return j;for(let e of[[`pip`],[`pip3`],[`python`,`-m`,`pip`],[`python3`,`-m`,`pip`]])try{let{exitCode:t}=await s(p([...e,`--version`]));if(t===0)return j=e,e}catch{}return j=[`pip`],j}async function M(e){try{return await u(o([...await Ge(),...e]))===0}catch{return!1}}async function Ke(e){return M([`install`,e])}async function N(e){return M([`install`,`--upgrade`,e])}async function qe(e){if(e.length===0)return!0;for(let t of e)if(!await N(t.packageName))return!1;return!0}async function Je(e){return M([`uninstall`,`-y`,e])}async function P(e,t,n=[]){try{return await u(o([`uv`,`tool`,e,t,...n]))===0}catch{return!1}}async function Ye(e,t){return P(`install`,e,t)}async function F(e,t){return P(`upgrade`,e,t)}async function Xe(e){for(let t of e)if(!await F(t.packageName,t.packageInstallArgs))return!1;return!0}async function Ze(e){try{return await u(o([`uv`,`tool`,`uninstall`,e]))===0}catch{return!1}}async function I(e){try{let{stdout:t}=await s(p([`uv`,`tool`,`list`],{stdio:[`ignore`,`pipe`,`ignore`]}));if(!t.trim())return{presence:`unknown`};let n=tt(t,e);return n?{presence:`present`,version:n}:et(t)?{presence:`absent`}:{presence:`unknown`}}catch{return{presence:`unknown`}}}async function Qe(e){return(await I(e)).presence}async function $e(e){return(await I(e)).version}function et(e){return e.split(/\r?\n/).some(e=>/^\S+\s+v[^\s]+/.test(e.trim()))}function tt(e,t){let n=L(t);for(let t of e.split(/\r?\n/)){let e=t.trim(),r=/^(\S+)\s+v([^\s]+)/.exec(e);if(!r)continue;let[,i,a]=r;if(L(i)===n)return a}}function L(e){return e.toLowerCase().replaceAll(/[-_.]+/g,`-`)}async function R(e,t){try{return await u(o([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function nt(e){return R(`install`,e)}async function z(e){return R(`upgrade`,e)}async function rt(e){for(let t of e)if(!await z(t.packageName))return!1;return!0}async function it(e){return R(`uninstall`,e)}const at={brew:{type:`brew`,isAvailable:async()=>De(),install:async(e,t)=>Me(e,t),uninstall:async(e,t)=>b(e,t),update:async(e,t)=>y(e,t),updateMany:async e=>Ne(e)},bun:{type:`bun`,getInstalledVersion:async e=>ae(e),probePackagePresence:async e=>_e(e),isAvailable:async()=>xe(),install:async e=>me(e),uninstall:async e=>oe(e),update:async(e,t,n)=>he(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>te(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},cargo:{type:`cargo`,isAvailable:async()=>ve(),install:async(e,t,n)=>S(e,n),uninstall:async e=>Fe(e),update:async(e,t,n)=>C(e,n?.packageInstallArgs),updateMany:async e=>Pe(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},deno:{type:`deno`,isAvailable:async()=>Te(),install:async(e,t,n)=>Ie(e,n),uninstall:async(e,t,n)=>Re(n?.binaryName??e),update:async(e,t,n)=>T(e,n?.packageInstallArgs),updateMany:async e=>Le(e.map(e=>({binaryName:e.binaryName,packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},mise:{type:`mise`,getInstalledVersion:async e=>Ue(e),probePackagePresence:async e=>He(e),isAvailable:async()=>Oe(),install:async e=>ze(e),uninstall:async e=>Ve(e),update:async e=>D(e),updateMany:async e=>Be(e.map(e=>({packageName:e.packageName})))},npm:{type:`npm`,getInstalledVersion:async e=>ce(e),probePackagePresence:async e=>pe(e),isAvailable:async()=>ye(),install:async e=>le(e),uninstall:async e=>fe(e),update:async(e,t,n)=>de(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>ue(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},pip:{type:`pip`,isAvailable:async()=>Se(),install:async e=>Ke(e),uninstall:async e=>Je(e),update:async e=>N(e),updateMany:async e=>qe(e.map(e=>({packageName:e.packageName})))},uv:{type:`uv`,getInstalledVersion:async e=>$e(e),probePackagePresence:async e=>Qe(e),isAvailable:async()=>ke(),install:async(e,t,n)=>Ye(e,n),uninstall:async e=>Ze(e),update:async(e,t,n)=>F(e,n?.packageInstallArgs),updateMany:async e=>Xe(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},winget:{type:`winget`,isAvailable:async()=>be(),install:async e=>nt(e),uninstall:async e=>it(e),update:async e=>z(e),updateMany:async e=>rt(e.map(e=>({packageName:e.packageName})))}};function B(e){return at[e]}const V={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function ot(){return(await m()).defaultPackageManager}async function H(){return{npmBunUpdateStrategy:(await m()).npmBunUpdateStrategy}}async function U(e){let t=g(),n=e.platforms[t];if(!n)return[];let r=await ot();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function W(e,t,n,r,i,a,o){let s=B(e);return await s.isAvailable()?a===`install`?s.install(t,i,r):a===`update`?s.update(t,i,{binaryName:n,npmBunUpdateStrategy:o,packageInstallArgs:r}):s.uninstall(t,i,{binaryName:n}):!1}async function G(t,r,i,a){if(e(r.type)){let e=h(t,r);return e?W(r.type,e,r.binaryName??t.binaryName,r.packageInstallArgs,r.packageTargetKind,i,a):!1}return i===`update`&&!n(r.type)||!r.command?!1:_(r.command)}function K(t,n){if(t.packageName)return t.packageName;if(!(!n||!e(t.installType)))return h(n,{type:t.installType})}async function q(t,n,r){if(e(t.installType)){let e=K(t,r?.agent);return e?W(t.installType,e,t.binaryName,t.packageInstallArgs,t.packageTargetKind,n,r?.updateStrategy):!1}return n!==`install`||!t.command?!1:_(t.command)}async function J(t,n){if(!e(n.type))return;let r=h(t,n);r&&await W(n.type,r,n.binaryName??t.binaryName,n.packageInstallArgs,n.packageTargetKind,`uninstall`)}async function st(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await _(e.join(` `)))return!0;return!1}function ct(e,t){let n={agentName:e.name,installType:t.type,packageName:h(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0},r=t.binaryName??(t.type===`deno`?e.binaryName:void 0);return r&&(n.binaryName=r),t.packageInstallArgs?.length&&(n.packageInstallArgs=t.packageInstallArgs),n}async function Y(e,t){if(f().cancelled)return null;let n=ct(e,t);return f().cancelled?null:(await c(n),f().cancelled?(await i(e.name),null):n)}async function X(e,t){return l(V,async()=>Y(e,t))}async function lt(e){return l(V,async()=>{let t=await U(e);for(let n of t){if(f().cancelled)return{success:!1};if(await G(e,n,`install`)){if(f().cancelled)return await J(e,n),{success:!1};try{let t=await Y(e,n);return t?{success:!0,installedState:t}:(await J(e,n),{success:!1})}catch(t){throw await J(e,n),t}}if(f().cancelled)return await J(e,n),{success:!1}}return{success:!1}})}async function ut(t,n){return l(V,async()=>{let{npmBunUpdateStrategy:r}=await H(),i=await U(t),a=n&&e(n.installType)?K(n,t):void 0;if(n&&await q(n,`update`,{agent:t,updateStrategy:r}))return f().cancelled||(await c(n),f().cancelled)?{success:!1}:{success:!0,installedState:n};if(!n){for(let e of i)if(await G(t,e,`update`,r)){let n=await Y(t,e);return n?{success:!0,installedState:n}:{success:!1}}}return(!n||!e(n.installType)||a)&&await st(t)?{success:!0}:{success:!1}})}async function dt(e,t){return l(V,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}:${e.packageInstallArgs?.join(` `)??``}`,e])).values()];if(n.length===0)return!1;let r=B(e);return await r.isAvailable()?r.updateMany(n,await H()):!1})}async function ft(e,t,n){let r=B(e);if(r.getInstalledVersion&&await r.isAvailable())return r.getInstalledVersion(t,n)}async function pt(t,n){if(!e(t.installType))return!1;let r=B(t.installType);if(!r.getInstalledVersion||!await r.isAvailable())return!1;let i=K(t,n);return i?r.probePackagePresence?await r.probePackagePresence(i,t.packageTargetKind)===`absent`:await r.getInstalledVersion(i,t.packageTargetKind)===void 0:!1}async function mt(e){return l(V,async()=>{let t=await d(e.name);return t&&(!r(t.installType)||await q(t,`uninstall`,{agent:e})||await pt(t,e))?(await i(e.name),!0):!1})}async function Z(e){let[t,n,r]=await Promise.all([U(e),d(e.name),we(e.binaryName)]),[i,a,o]=await Promise.all([r?ht(e,n):Promise.resolve(void 0),r?re(e.binaryName):Promise.resolve(void 0),gt(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,resolvedBinaryPath:await ie(a),sourceLabel:se(n),updateLabel:ge(e,n),lifecycle:n?ee(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function ht(t,n){if(n&&e(n.installType)&&n.packageName){let e=await ft(n.installType,n.packageName,n.packageTargetKind);if(e)return e}return a(t.binaryName,t.versionProbe)}async function gt(e,n,r){let i=t(e,n,r);if(i)return ne(i)}function $(e){return Ee(e)}async function _t(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function vt(){return Q(Ce())}export{Q as a,X as c,dt as d,B as f,Z as i,mt as l,$ as n,U as o,_t as r,lt as s,vt as t,ut as u};
@@ -1,4 +1,4 @@
1
- import{a as e,r as t,s as n,t as r}from"./color-ChvF_SAo.mjs";import{a as i,c as a,d as o,i as s,l as c,m as l,o as u,r as d,s as f,t as p,u as m}from"./detect-C9Mnu6HP.mjs";import h from"node:process";async function g(){let[r,g,y,b,x,S,C,w,T,E]=await Promise.all([s(),a(),d(),i(),u(),f(),c(),m(),o(),n()]);return e(t({action:`capabilities`,data:{agents:l().map(e=>e.name),features:{assumeYes:!0,cacheBypass:!0,cacheRefresh:!0,channels:[`stable`,`beta`],colorModes:[`auto`,`always`,`never`],dryRun:!0,execInstallPolicies:[`never`,`if-missing`,`always`],freshnessMetadata:!0,idempotencyKey:!0,logLevels:[`silent`,`error`,`warn`,`info`,`debug`],quietLogs:!0,selfUpgrade:E.canAutoUpdate,timeout:!0},installers:{brew:{available:y,reason:y?void 0:_(`brew`)},bun:{available:r,reason:r?void 0:_(`bun`)},cargo:{available:b,reason:b?void 0:_(`cargo`)},deno:{available:x,reason:x?void 0:_(`deno`)},mise:{available:S,reason:S?void 0:_(`mise`)},npm:{available:g,reason:g?void 0:_(`npm`)},pip:{available:C,reason:C?void 0:_(`pip`)},uv:{available:w,reason:w?void 0:_(`uv`)},winget:{available:T,reason:T?void 0:_(`winget`)}},outputModes:[`human`,`json`,`ndjson`],platform:{arch:h.arch,os:p()}},target:{kind:`system`,name:`capabilities`}}),v)}function _(e){return e===`winget`&&h.platform!==`win32`||e===`brew`&&h.platform===`win32`?`not-on-platform`:`not-found`}function v(e){e.data&&(console.log(r.bold(`
1
+ import{a as e,r as t,s as n,t as r}from"./color-BjsL_hvq.mjs";import{a as i,c as a,d as o,i as s,l as c,m as l,o as u,r as d,s as f,t as p,u as m}from"./detect-C-llI1gs.mjs";import h from"node:process";async function g(){let[r,g,y,b,x,S,C,w,T,E]=await Promise.all([s(),a(),d(),i(),u(),f(),c(),m(),o(),n()]);return e(t({action:`capabilities`,data:{agents:l().map(e=>e.name),features:{assumeYes:!0,cacheBypass:!0,cacheRefresh:!0,channels:[`stable`,`beta`],colorModes:[`auto`,`always`,`never`],dryRun:!0,execInstallPolicies:[`never`,`if-missing`,`always`],freshnessMetadata:!0,idempotencyKey:!0,logLevels:[`silent`,`error`,`warn`,`info`,`debug`],quietLogs:!0,selfUpgrade:E.canAutoUpdate,timeout:!0},installers:{brew:{available:y,reason:y?void 0:_(`brew`)},bun:{available:r,reason:r?void 0:_(`bun`)},cargo:{available:b,reason:b?void 0:_(`cargo`)},deno:{available:x,reason:x?void 0:_(`deno`)},mise:{available:S,reason:S?void 0:_(`mise`)},npm:{available:g,reason:g?void 0:_(`npm`)},pip:{available:C,reason:C?void 0:_(`pip`)},uv:{available:w,reason:w?void 0:_(`uv`)},winget:{available:T,reason:T?void 0:_(`winget`)}},outputModes:[`human`,`json`,`ndjson`],platform:{arch:h.arch,os:p()}},target:{kind:`system`,name:`capabilities`}}),v)}function _(e){return e===`winget`&&h.platform!==`win32`||e===`brew`&&h.platform===`win32`?`not-on-platform`:`not-found`}function v(e){e.data&&(console.log(r.bold(`
2
2
  Quantex Capabilities
3
3
  `)),console.log(` Platform: ${e.data.platform.os}/${e.data.platform.arch}`),console.log(` Output Modes: ${e.data.outputModes.join(`, `)}`),console.log(` Agents: ${e.data.agents.join(`, `)}`),console.log(r.bold(`
4
4
  Installers:`)),console.log(` bun: ${y(e.data.installers.bun)}`),console.log(` npm: ${y(e.data.installers.npm)}`),console.log(` brew: ${y(e.data.installers.brew)}`),console.log(` cargo: ${y(e.data.installers.cargo)}`),console.log(` deno: ${y(e.data.installers.deno)}`),console.log(` mise: ${y(e.data.installers.mise)}`),console.log(` pip: ${y(e.data.installers.pip)}`),console.log(` uv: ${y(e.data.installers.uv)}`),console.log(` winget: ${y(e.data.installers.winget)}`),console.log(r.bold(`
@@ -0,0 +1 @@
1
+ import{t as e}from"./capabilities-5--AYhRe.mjs";export{e as capabilitiesCommand};
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{$ as e,A as t,D as n,G as r,J as i,M as a,N as o,Y as s,Z as c,a as l,ct as u,dt as d,ft as f,i as p,lt as m,n as h,r as g,s as _,st as v,t as y,ut as b,vt as ee,yt as te,z as ne}from"./color-ChvF_SAo.mjs";import{p as re}from"./detect-C9Mnu6HP.mjs";import{r as x,s as ie}from"./agents-CMkLsOPA.mjs";import{n as S}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as ae,i as C,n as w,o as T,r as E,t as oe}from"./user-output-B5Ah0_tJ.mjs";import{n as se,t as D}from"./errors-BzXIrX6h.mjs";import{createHash as ce}from"node:crypto";import O from"node:process";import{mkdir as le,readFile as k,rm as ue,writeFile as de}from"node:fs/promises";import{join as A}from"node:path";import{program as j}from"commander";import fe from"prompts";function M(){return A(e(),`idempotency`)}function N(e){return A(M(),`${I(e)}.json`)}async function P(e){try{let t=JSON.parse(await k(N(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await ue(N(e),{force:!0});return}return t}catch{return}}async function F(e,t){await le(M(),{recursive:!0});let n=new Date().toISOString(),r=new Date(Date.now()+864e5).toISOString(),i={action:t.action,createdAt:n,expiresAt:r,result:t.result,target:t.target};await de(N(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function I(e){return ce(`sha256`).update(e,`utf8`).digest(`hex`)}const L=new Set([`doctor`,`upgrade`]);async function R(e){if(!e.ok||L.has(e.action))return;let t=m();if(t.outputMode!==`human`||t.quiet)return;let n=await _();if(!n.latestVersion||!r(n.latestVersion,n.currentVersion))return;let i=await a(),o=Date.now();if(z(i.updateNoticeVersion,i.updateNoticeAt,n.latestVersion,o))return;let s=n.canAutoUpdate?"Run `quantex upgrade`.":"Run `quantex doctor` for source-specific update steps.";C(y.yellow(`Quantex CLI ${n.latestVersion} is available (current ${n.currentVersion}). ${s}`)),await ne(n.latestVersion,new Date(o).toISOString())}function z(e,t,n,r){if(!e||!t||e!==n)return!1;let i=Date.parse(t);return Number.isNaN(i)?!1:r-i<864e5}function B(e,t){return e===void 0&&t===void 0?!0:e===void 0||t===void 0||e.kind!==t.kind||e.kind===`agent`&&(!e.name||!t.name)?!1:e.name===t.name}function V(e){return e.warnings.some(e=>e.code===`DRY_RUN`)}const pe=new Set([`install`,`ensure`,`update`]),me=new Set([`uninstall`]);function he(e){if(!(e?.kind!==`agent`||!e.name))return e.name.split(`,`).map(e=>e.trim()).filter(Boolean)}async function ge(e){if(!e.result.ok)return!0;let t=he(e.target);if(!t||t.length===0)return!0;if(pe.has(e.action)){for(let e of t)if(!(await x(e))?.inspection.inPath)return!1;return!0}if(me.has(e.action)){for(let e of t)if((await x(e))?.inspection.inPath)return!1;return!0}return!0}async function _e(e){try{return await ve(e)}catch(n){if(n instanceof t)return ye(e,n);throw n}}async function ve(e){let t=await be(e.action,e.target);if(t)return t;let n=m().timeoutMs;if(n===void 0)return G(e,()=>e.run().then(t=>U(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{t(K(e,n))},n)});return await G(e,async()=>{let i=Ce(e.run,()=>t),a=await Promise.race([i,t]);return!a.ok&&a.error?.code===`TIMEOUT`&&(a=await Se(i,n)??await Te(e,n)),r!==void 0&&(clearTimeout(r),r=void 0),U(e.action,e.target,a)})}finally{r&&clearTimeout(r)}}async function ye(e,t){return l(h({action:e.action,...S(t,o(),e.target)}),H)}function H(e){e.error&&console.error(y.red(e.error.message))}async function U(e,t,n){let r=await xe(e,t,n);try{await R({action:e,ok:r.ok})}catch{}return r}function W(e){e.error&&console.error(y.red(e.error.message))}async function be(e,t){let n=m();if(!n.idempotencyKey)return;let r=await P(n.idempotencyKey);if(!r)return;if(r.action!==e)return l(h({action:e,error:{code:`INVALID_ARGUMENT`,details:{existingAction:r.action,idempotencyKey:n.idempotencyKey},message:`Idempotency key ${n.idempotencyKey} was already used for ${r.action}.`},target:t}),W,{force:!0});if(!B(r.target,t)||V(r.result)||!await ge(r))return;let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return l(i,W,{force:!0}),i}async function xe(e,t,n){let r=m();return r.idempotencyKey&&n.ok&&!r.dryRun&&!V(n)&&await F(r.idempotencyKey,{action:e,result:n,target:t}),n}async function G(e,t){let n,r;try{let i=new Promise(t=>{let i=r=>{n??=Ee(e,r),n.then(t)},a=()=>i(`SIGINT`),o=()=>i(`SIGTERM`);O.once(`SIGINT`,a),O.once(`SIGTERM`,o),r=()=>{O.off(`SIGINT`,a),O.off(`SIGTERM`,o)}});return await Promise.race([we(t,()=>n),i])}finally{r?.()}}async function Se(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Ce(e,t){try{return await e()}catch(e){if(m().cancelled)return t();throw e}}async function we(e,t){try{let n=await e(),r=t();return m().cancelled&&r?r:n}catch(e){let n=t();if(m().cancelled&&n)return n;throw e}}function K(e,t){return h({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:t},message:`Command timed out after ${t}ms.`},target:e.target})}async function Te(e,t){return await v(),p({action:e.action,data:{reason:`timeout`,timeoutMs:t},target:e.target,type:`cancelled`},{force:!0}),l(K(e,t),W,{force:!0})}async function Ee(e,t){return await v(),p({action:e.action,data:{reason:`signal`,signal:t},target:e.target,type:`cancelled`},{force:!0}),l(h({action:e.action,error:{code:`CANCELLED`,details:{signal:t},message:`Command cancelled by ${t}.`},target:e.target}),W,{force:!0})}async function q(e,n,r={}){let a;try{a=await x(e)}catch(n){if(n instanceof t)return De(e,n),D(`STATE_READ_ERROR`);throw n}if(!a)return Y({agent:{name:e},errorCode:`AGENT_NOT_FOUND`,errorMessage:`Unknown agent: ${e}`,execution:{args:n,installPolicy:r.install??`prompt`,installed:!1,interactive:!1,launched:!1}}),D(`AGENT_NOT_FOUND`);let{agent:o,inspection:s}=a,c=r.nonInteractive?!1:m().interactive,l=r.assumeYes??oe(),u=r.dryRun??w(),d=r.install??`prompt`;if(!s.inPath){if(d===`never`)return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`AGENT_NOT_INSTALLED`,errorMessage:`${o.displayName} is not installed.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`AGENT_NOT_INSTALLED`);if(d===`if-missing`||d===`always`){u?T(y.cyan(`Dry run: would install ${o.displayName}.`)):C(y.cyan(`Installing ${o.displayName}...`));let e=await X(o,u);if(e===`timeout`)return D(`TIMEOUT`);if(!e.success)return E(y.red(`Failed to install ${o.displayName}.`)),1}else if(c){if(!(l||u?{install:!0}:await fe({type:`confirm`,name:`install`,message:`${o.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return ae(y.yellow(`Installation cancelled.`)),1;u?T(y.cyan(`Dry run: would install ${o.displayName}.`)):C(y.cyan(`Installing ${o.displayName}...`));let e=await X(o,u);if(e===`timeout`)return D(`TIMEOUT`);if(!e.success)return E(y.red(`Failed to install ${o.displayName}.`)),1}else return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`INTERACTION_REQUIRED`,errorMessage:`${o.displayName} is not installed and interactive installation is disabled.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`INTERACTION_REQUIRED`)}if(u)return Oe({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},execution:{args:n,installPolicy:d,installed:!0,interactive:c,launched:!1},message:`Dry run: would run ${[o.binaryName,...n].join(` `)}`}),0;try{return await Ae(i([o.binaryName,...n]),o.displayName)}catch(e){return E(y.red(`Failed to launch ${o.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}function J(e,t,n){return{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:t.map(t=>({command:ee(e,t),label:te(t),type:t.type})).filter(e=>e.command),suggestedAction:`rerun-with-install-policy`,suggestedEnsureCommand:`quantex ensure ${e.name}`,suggestedExecCommand:[`quantex`,`exec`,e.name,`--install`,`if-missing`,`--`,...n].join(` `)}}function De(e,t){let n=S(t,o(),{kind:`agent`,name:e});if(m().outputMode===`human`){E(y.red(n.error.message));return}l(h({action:`exec`,...n}),()=>{})}function Y(e){if(m().outputMode===`human`){E(y.red(e.errorMessage));let t=e.execution.installGuidance;t&&(T(y.dim(`Try: ${t.suggestedEnsureCommand}`)),T(y.dim(`Or: ${t.suggestedExecCommand}`)));return}l(h({action:`exec`,data:{agent:e.agent,execution:e.execution},error:{code:e.errorCode,details:e.execution.installGuidance,message:e.errorMessage},target:{kind:`agent`,name:e.agent.name}}),()=>{})}function Oe(e){if(m().outputMode===`human`){T(y.cyan(e.message));return}l(g({action:`exec`,data:{agent:e.agent,execution:e.execution},target:{kind:`agent`,name:e.agent.name}}),()=>{})}async function X(e,t=w()){let{timeoutMs:n}=m();if(n===void 0)return Z(e,t);let r,i=Z(e,t);try{let t=new Promise(e=>{r=setTimeout(()=>{e(`timeout`)},n)}),a=await Promise.race([i,t]);if(a===`timeout`){let t=await ke(i,n);return t?.success?(u(),t):t||(await v(),E(y.red(`Installing ${e.displayName} timed out after ${n}ms.`)),`timeout`)}return m().cancelled&&a.success&&u(),a}finally{r&&clearTimeout(r)}}async function ke(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Z(e,t=w()){if(t)return{success:!0};try{return await ie(e)}catch(t){return c(t)?(E(y.red(t.message)),{success:!1}):(E(y.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function Ae(e,t){let{timeoutMs:n}=m(),r,i,a;try{let o=new Promise(e=>{let n=n=>{r??=(async()=>(await v(),E(y.red(`${t} was cancelled by ${n}.`)),D(`CANCELLED`)))(),r.then(e)},a=()=>n(`SIGINT`),o=()=>n(`SIGTERM`);O.once(`SIGINT`,a),O.once(`SIGTERM`,o),i=()=>{O.off(`SIGINT`,a),O.off(`SIGTERM`,o)}}),s=Me(e,()=>r);if(n===void 0)return await Promise.race([s,o]);let c=new Promise(e=>{a=setTimeout(()=>{e(`timeout`)},n)}),l=await Promise.race([s,o,c]);if(l===`timeout`){let e=await je(s,n);return e===void 0?(r??=(async()=>(await v(),E(y.red(`${t} timed out after ${n}ms.`)),D(`TIMEOUT`)))(),await r):(u(),e)}return l}finally{a&&clearTimeout(a),i?.()}}async function je(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Me(e,t){try{let n=await s(e),r=t();return m().cancelled&&r?r:n}catch(e){let n=t();if(m().cancelled&&n)return n;throw e}}j.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).option(`--json`,`Output structured JSON`).option(`--output <mode>`,`Output mode: human, json, or ndjson`).option(`--non-interactive`,`Disable interactive prompts and confirmations`).option(`--yes`,`Automatically accept safe default confirmations`).option(`--quiet`,`Suppress non-essential human logs`).option(`--color <mode>`,`Color mode: auto, always, or never`).option(`--log-level <level>`,`Log level: silent, error, warn, info, or debug`).option(`--dry-run`,`Show what would happen without making changes`).option(`--refresh`,`Refresh cached version metadata before returning results`).option(`--no-cache`,`Bypass the local version cache for this command`).option(`--run-id <id>`,`Attach a run id to structured output and logs`).option(`--idempotency-key <key>`,`Deduplicate repeated mutating requests by client-supplied key`).option(`--timeout <duration>`,`Abort a command after the given duration, e.g. 500ms, 30s, 5m`).version(n()),j.hook(`preAction`,(e,t)=>{try{f(d(t.optsWithGlobals()))}catch(e){console.log(y.red(e instanceof Error?e.message:String(e))),O.exit(2)}}),j.hook(`postAction`,()=>{b()}),j.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-CSnPjYhJ.mjs`);O.exitCode=await $({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),j.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-D-nJHGj2.mjs`);O.exitCode=await $({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),j.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-BTyTa3uI.mjs`);O.exitCode=await $({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),j.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-DXh09zXt.mjs`);O.exitCode=await $({action:`inspect`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`resolve <agent>`).description(`解析 agent 可执行入口`).action(async e=>{let{resolveCommand:t}=await import(`./resolve-DXdGh9T8.mjs`);O.exitCode=await $({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`install <agents...>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-B7r9UqBe.mjs`);O.exitCode=await $({action:`install`,run:()=>t(e),target:e.length===1?{kind:`agent`,name:e[0]}:{kind:`agent`,name:[...e].sort().join(`,`)}})}),j.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-BsoUqDdw.mjs`);O.exitCode=await $({action:`ensure`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`exec <agent>`).description(`以显式策略启动 agent`).allowUnknownOption().option(`--install <policy>`,`Install policy: never, if-missing, always`,`never`).argument(`[args...]`,`Arguments passed through to the agent`).action(async(e,t,n,r)=>{let i=n.install;if(i!==`never`&&i!==`if-missing`&&i!==`always`){console.log(y.red(`Unknown install policy: ${i}`)),O.exitCode=2;return}let a=Pe(r);O.exitCode=await q(e,a.length>0?a:t,{install:i,nonInteractive:r.optsWithGlobals().nonInteractive})}),j.command(`update`).argument(`[agent]`,`Agent name or alias`).option(`--all`,`更新所有已安装的 agent`).alias(`u`).description(`更新指定 agent`).action(async(e,t)=>{let{updateCommand:n}=await import(`./update-BofH1LoM.mjs`);O.exitCode=await $({action:`update`,run:()=>n(e,t.all??!1),target:{kind:`agent`,name:e}})}),j.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-C8P8gg5e.mjs`);O.exitCode=await $({action:`uninstall`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-DGPf3ofK.mjs`);O.exitCode=await $({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),j.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-zIXjpak-.mjs`);O.exitCode=await $({action:`info`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`config`).argument(`[action]`,`Action: get, set, reset`).argument(`[key]`,`Config key`).argument(`[value]`,`Config value`).description(`配置管理`).action(async(e,t,n)=>{let{configCommand:r}=await import(`./config-Jtw7uDrr.mjs`);O.exitCode=await $({action:`config`,run:()=>r(e,t,n),target:{kind:`config`,name:t}})}),j.command(`upgrade`).description(`升级 Quantex CLI`).option(`--channel <channel>`,`Update channel: stable or beta`).option(`--check`,`Only check whether an update is available`).action(async e=>{let{upgradeCommand:t}=await import(`./upgrade-YyJe59oG.mjs`);O.exitCode=await $({action:`upgrade`,run:()=>t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1}),target:{kind:`self`,name:`quantex`}})}),j.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-k5nm7p2Q.mjs`);O.exitCode=await $({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const Ne=new Set([...j.commands.map(e=>e.name()),...j.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),Q=Fe(O.argv.slice(2),Ne);if(Q?.error&&(console.log(y.red(Q.error)),O.exit(2)),Q&&re(Q.agentName)){try{f(d({color:Q.color,dryRun:Q.dryRun,idempotencyKey:Q.idempotencyKey,logLevel:Q.logLevel,noCache:Q.noCache,nonInteractive:Q.nonInteractive,quiet:Q.quiet,refresh:Q.refresh,runId:Q.runId,timeout:Q.timeout,yes:Q.yes}))}catch(e){console.log(y.red(e instanceof Error?e.message:String(e))),O.exit(2)}try{let e=await q(Q.agentName,Q.agentArgs,{assumeYes:Q.yes,dryRun:Q.dryRun,nonInteractive:Q.nonInteractive});O.exit(e)}finally{b()}}j.parse();function Pe(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function Fe(e,t){let n=O.stdin.isTTY===!1||O.stdout.isTTY===!1,r,i=!1,a=0,o,s=!1,c,l=!1,u=!1,d,f=!1,p=!1,m,h,g=!1;for(;a<e.length;){let _=e[a];if(_===`--json`){s=!0,a+=1;continue}if(_===`--output`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--output requires a value`};d=t,a+=2;continue}if(_===`--non-interactive`){u=!0,a+=1;continue}if(_===`--yes`){g=!0,a+=1;continue}if(_===`--quiet`){f=!0,a+=1;continue}if(_===`--color`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--color requires a value`};r=t,a+=2;continue}if(_===`--log-level`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--log-level requires a value`};c=t,a+=2;continue}if(_===`--dry-run`){i=!0,a+=1;continue}if(_===`--refresh`){p=!0,a+=1;continue}if(_===`--no-cache`){l=!0,a+=1;continue}if(_===`--idempotency-key`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--idempotency-key requires a value`};o=t,a+=2;continue}if(_===`--run-id`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--run-id requires a value`};m=t,a+=2;continue}if(_===`--timeout`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--timeout requires a value`};h=t,a+=2;continue}return _.startsWith(`-`)||t.has(_)?void 0:s||d===`json`||d===`ndjson`||n&&d!==`human`?{agentArgs:[],agentName:``,error:`Structured output is not supported for shortcut agent execution yet. Use a management command instead.`}:{agentArgs:e.slice(a+1),agentName:_,color:r,dryRun:i,idempotencyKey:o,logLevel:c,noCache:l,nonInteractive:u,quiet:f,refresh:p,runId:m,timeout:h,yes:g}}}async function $(e){return se(await _e(e))}export{};
2
+ import{$ as e,A as t,D as n,G as r,J as i,M as a,N as o,Y as s,Z as c,a as l,ct as u,dt as d,ft as f,i as p,lt as m,n as h,r as g,s as _,st as v,t as y,ut as b,vt as ee,yt as te,z as ne}from"./color-BjsL_hvq.mjs";import{p as re}from"./detect-C-llI1gs.mjs";import{r as x,s as ie}from"./agents-RFc5BDHs.mjs";import{n as S}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as ae,i as C,n as w,o as T,r as E,t as oe}from"./user-output-W4VzwJV2.mjs";import{n as se,t as D}from"./errors-BzXIrX6h.mjs";import{createHash as ce}from"node:crypto";import O from"node:process";import{mkdir as le,readFile as k,rm as ue,writeFile as de}from"node:fs/promises";import{join as A}from"node:path";import{program as j}from"commander";import fe from"prompts";function M(){return A(e(),`idempotency`)}function N(e){return A(M(),`${I(e)}.json`)}async function P(e){try{let t=JSON.parse(await k(N(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await ue(N(e),{force:!0});return}return t}catch{return}}async function F(e,t){await le(M(),{recursive:!0});let n=new Date().toISOString(),r=new Date(Date.now()+864e5).toISOString(),i={action:t.action,createdAt:n,expiresAt:r,result:t.result,target:t.target};await de(N(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function I(e){return ce(`sha256`).update(e,`utf8`).digest(`hex`)}const L=new Set([`doctor`,`upgrade`]);async function R(e){if(!e.ok||L.has(e.action))return;let t=m();if(t.outputMode!==`human`||t.quiet)return;let n=await _();if(!n.latestVersion||!r(n.latestVersion,n.currentVersion))return;let i=await a(),o=Date.now();if(z(i.updateNoticeVersion,i.updateNoticeAt,n.latestVersion,o))return;let s=n.canAutoUpdate?"Run `quantex upgrade`.":"Run `quantex doctor` for source-specific update steps.";C(y.yellow(`Quantex CLI ${n.latestVersion} is available (current ${n.currentVersion}). ${s}`)),await ne(n.latestVersion,new Date(o).toISOString())}function z(e,t,n,r){if(!e||!t||e!==n)return!1;let i=Date.parse(t);return Number.isNaN(i)?!1:r-i<864e5}function B(e,t){return e===void 0&&t===void 0?!0:e===void 0||t===void 0||e.kind!==t.kind||e.kind===`agent`&&(!e.name||!t.name)?!1:e.name===t.name}function V(e){return e.warnings.some(e=>e.code===`DRY_RUN`)}const pe=new Set([`install`,`ensure`,`update`]),me=new Set([`uninstall`]);function he(e){if(!(e?.kind!==`agent`||!e.name))return e.name.split(`,`).map(e=>e.trim()).filter(Boolean)}async function ge(e){if(!e.result.ok)return!0;let t=he(e.target);if(!t||t.length===0)return!0;if(pe.has(e.action)){for(let e of t)if(!(await x(e))?.inspection.inPath)return!1;return!0}if(me.has(e.action)){for(let e of t)if((await x(e))?.inspection.inPath)return!1;return!0}return!0}async function _e(e){try{return await ve(e)}catch(n){if(n instanceof t)return ye(e,n);throw n}}async function ve(e){let t=await be(e.action,e.target);if(t)return t;let n=m().timeoutMs;if(n===void 0)return G(e,()=>e.run().then(t=>U(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{t(K(e,n))},n)});return await G(e,async()=>{let i=Ce(e.run,()=>t),a=await Promise.race([i,t]);return!a.ok&&a.error?.code===`TIMEOUT`&&(a=await Se(i,n)??await Te(e,n)),r!==void 0&&(clearTimeout(r),r=void 0),U(e.action,e.target,a)})}finally{r&&clearTimeout(r)}}async function ye(e,t){return l(h({action:e.action,...S(t,o(),e.target)}),H)}function H(e){e.error&&console.error(y.red(e.error.message))}async function U(e,t,n){let r=await xe(e,t,n);try{await R({action:e,ok:r.ok})}catch{}return r}function W(e){e.error&&console.error(y.red(e.error.message))}async function be(e,t){let n=m();if(!n.idempotencyKey)return;let r=await P(n.idempotencyKey);if(!r)return;if(r.action!==e)return l(h({action:e,error:{code:`INVALID_ARGUMENT`,details:{existingAction:r.action,idempotencyKey:n.idempotencyKey},message:`Idempotency key ${n.idempotencyKey} was already used for ${r.action}.`},target:t}),W,{force:!0});if(!B(r.target,t)||V(r.result)||!await ge(r))return;let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return l(i,W,{force:!0}),i}async function xe(e,t,n){let r=m();return r.idempotencyKey&&n.ok&&!r.dryRun&&!V(n)&&await F(r.idempotencyKey,{action:e,result:n,target:t}),n}async function G(e,t){let n,r;try{let i=new Promise(t=>{let i=r=>{n??=Ee(e,r),n.then(t)},a=()=>i(`SIGINT`),o=()=>i(`SIGTERM`);O.once(`SIGINT`,a),O.once(`SIGTERM`,o),r=()=>{O.off(`SIGINT`,a),O.off(`SIGTERM`,o)}});return await Promise.race([we(t,()=>n),i])}finally{r?.()}}async function Se(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Ce(e,t){try{return await e()}catch(e){if(m().cancelled)return t();throw e}}async function we(e,t){try{let n=await e(),r=t();return m().cancelled&&r?r:n}catch(e){let n=t();if(m().cancelled&&n)return n;throw e}}function K(e,t){return h({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:t},message:`Command timed out after ${t}ms.`},target:e.target})}async function Te(e,t){return await v(),p({action:e.action,data:{reason:`timeout`,timeoutMs:t},target:e.target,type:`cancelled`},{force:!0}),l(K(e,t),W,{force:!0})}async function Ee(e,t){return await v(),p({action:e.action,data:{reason:`signal`,signal:t},target:e.target,type:`cancelled`},{force:!0}),l(h({action:e.action,error:{code:`CANCELLED`,details:{signal:t},message:`Command cancelled by ${t}.`},target:e.target}),W,{force:!0})}async function q(e,n,r={}){let a;try{a=await x(e)}catch(n){if(n instanceof t)return De(e,n),D(`STATE_READ_ERROR`);throw n}if(!a)return Y({agent:{name:e},errorCode:`AGENT_NOT_FOUND`,errorMessage:`Unknown agent: ${e}`,execution:{args:n,installPolicy:r.install??`prompt`,installed:!1,interactive:!1,launched:!1}}),D(`AGENT_NOT_FOUND`);let{agent:o,inspection:s}=a,c=r.nonInteractive?!1:m().interactive,l=r.assumeYes??oe(),u=r.dryRun??w(),d=r.install??`prompt`;if(!s.inPath){if(d===`never`)return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`AGENT_NOT_INSTALLED`,errorMessage:`${o.displayName} is not installed.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`AGENT_NOT_INSTALLED`);if(d===`if-missing`||d===`always`){u?T(y.cyan(`Dry run: would install ${o.displayName}.`)):C(y.cyan(`Installing ${o.displayName}...`));let e=await X(o,u);if(e===`timeout`)return D(`TIMEOUT`);if(!e.success)return E(y.red(`Failed to install ${o.displayName}.`)),1}else if(c){if(!(l||u?{install:!0}:await fe({type:`confirm`,name:`install`,message:`${o.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return ae(y.yellow(`Installation cancelled.`)),1;u?T(y.cyan(`Dry run: would install ${o.displayName}.`)):C(y.cyan(`Installing ${o.displayName}...`));let e=await X(o,u);if(e===`timeout`)return D(`TIMEOUT`);if(!e.success)return E(y.red(`Failed to install ${o.displayName}.`)),1}else return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`INTERACTION_REQUIRED`,errorMessage:`${o.displayName} is not installed and interactive installation is disabled.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`INTERACTION_REQUIRED`)}if(u)return Oe({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},execution:{args:n,installPolicy:d,installed:!0,interactive:c,launched:!1},message:`Dry run: would run ${[o.binaryName,...n].join(` `)}`}),0;try{return await Ae(i([o.binaryName,...n]),o.displayName)}catch(e){return E(y.red(`Failed to launch ${o.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}function J(e,t,n){return{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:t.map(t=>({command:ee(e,t),label:te(t),type:t.type})).filter(e=>e.command),suggestedAction:`rerun-with-install-policy`,suggestedEnsureCommand:`quantex ensure ${e.name}`,suggestedExecCommand:[`quantex`,`exec`,e.name,`--install`,`if-missing`,`--`,...n].join(` `)}}function De(e,t){let n=S(t,o(),{kind:`agent`,name:e});if(m().outputMode===`human`){E(y.red(n.error.message));return}l(h({action:`exec`,...n}),()=>{})}function Y(e){if(m().outputMode===`human`){E(y.red(e.errorMessage));let t=e.execution.installGuidance;t&&(T(y.dim(`Try: ${t.suggestedEnsureCommand}`)),T(y.dim(`Or: ${t.suggestedExecCommand}`)));return}l(h({action:`exec`,data:{agent:e.agent,execution:e.execution},error:{code:e.errorCode,details:e.execution.installGuidance,message:e.errorMessage},target:{kind:`agent`,name:e.agent.name}}),()=>{})}function Oe(e){if(m().outputMode===`human`){T(y.cyan(e.message));return}l(g({action:`exec`,data:{agent:e.agent,execution:e.execution},target:{kind:`agent`,name:e.agent.name}}),()=>{})}async function X(e,t=w()){let{timeoutMs:n}=m();if(n===void 0)return Z(e,t);let r,i=Z(e,t);try{let t=new Promise(e=>{r=setTimeout(()=>{e(`timeout`)},n)}),a=await Promise.race([i,t]);if(a===`timeout`){let t=await ke(i,n);return t?.success?(u(),t):t||(await v(),E(y.red(`Installing ${e.displayName} timed out after ${n}ms.`)),`timeout`)}return m().cancelled&&a.success&&u(),a}finally{r&&clearTimeout(r)}}async function ke(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Z(e,t=w()){if(t)return{success:!0};try{return await ie(e)}catch(t){return c(t)?(E(y.red(t.message)),{success:!1}):(E(y.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function Ae(e,t){let{timeoutMs:n}=m(),r,i,a;try{let o=new Promise(e=>{let n=n=>{r??=(async()=>(await v(),E(y.red(`${t} was cancelled by ${n}.`)),D(`CANCELLED`)))(),r.then(e)},a=()=>n(`SIGINT`),o=()=>n(`SIGTERM`);O.once(`SIGINT`,a),O.once(`SIGTERM`,o),i=()=>{O.off(`SIGINT`,a),O.off(`SIGTERM`,o)}}),s=Me(e,()=>r);if(n===void 0)return await Promise.race([s,o]);let c=new Promise(e=>{a=setTimeout(()=>{e(`timeout`)},n)}),l=await Promise.race([s,o,c]);if(l===`timeout`){let e=await je(s,n);return e===void 0?(r??=(async()=>(await v(),E(y.red(`${t} timed out after ${n}ms.`)),D(`TIMEOUT`)))(),await r):(u(),e)}return l}finally{a&&clearTimeout(a),i?.()}}async function je(e,t){let n=Math.min(t,250);return await Promise.race([e,new Promise(e=>{setTimeout(()=>e(void 0),n)})])}async function Me(e,t){try{let n=await s(e),r=t();return m().cancelled&&r?r:n}catch(e){let n=t();if(m().cancelled&&n)return n;throw e}}j.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).option(`--json`,`Output structured JSON`).option(`--output <mode>`,`Output mode: human, json, or ndjson`).option(`--non-interactive`,`Disable interactive prompts and confirmations`).option(`--yes`,`Automatically accept safe default confirmations`).option(`--quiet`,`Suppress non-essential human logs`).option(`--color <mode>`,`Color mode: auto, always, or never`).option(`--log-level <level>`,`Log level: silent, error, warn, info, or debug`).option(`--dry-run`,`Show what would happen without making changes`).option(`--refresh`,`Refresh cached version metadata before returning results`).option(`--no-cache`,`Bypass the local version cache for this command`).option(`--run-id <id>`,`Attach a run id to structured output and logs`).option(`--idempotency-key <key>`,`Deduplicate repeated mutating requests by client-supplied key`).option(`--timeout <duration>`,`Abort a command after the given duration, e.g. 500ms, 30s, 5m`).version(n()),j.hook(`preAction`,(e,t)=>{try{f(d(t.optsWithGlobals()))}catch(e){console.log(y.red(e instanceof Error?e.message:String(e))),O.exit(2)}}),j.hook(`postAction`,()=>{b()}),j.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-CxrGfAJi.mjs`);O.exitCode=await $({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),j.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-cDGqmjd7.mjs`);O.exitCode=await $({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),j.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-rry5ZK1R.mjs`);O.exitCode=await $({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),j.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-DBjdBmAV.mjs`);O.exitCode=await $({action:`inspect`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`resolve <agent>`).description(`解析 agent 可执行入口`).action(async e=>{let{resolveCommand:t}=await import(`./resolve-B9bzClte.mjs`);O.exitCode=await $({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`install <agents...>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-XYi-6TpB.mjs`);O.exitCode=await $({action:`install`,run:()=>t(e),target:e.length===1?{kind:`agent`,name:e[0]}:{kind:`agent`,name:[...e].sort().join(`,`)}})}),j.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-BblqXICK.mjs`);O.exitCode=await $({action:`ensure`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`exec <agent>`).description(`以显式策略启动 agent`).allowUnknownOption().option(`--install <policy>`,`Install policy: never, if-missing, always`,`never`).argument(`[args...]`,`Arguments passed through to the agent`).action(async(e,t,n,r)=>{let i=n.install;if(i!==`never`&&i!==`if-missing`&&i!==`always`){console.log(y.red(`Unknown install policy: ${i}`)),O.exitCode=2;return}let a=Pe(r);O.exitCode=await q(e,a.length>0?a:t,{install:i,nonInteractive:r.optsWithGlobals().nonInteractive})}),j.command(`update`).argument(`[agent]`,`Agent name or alias`).option(`--all`,`更新所有已安装的 agent`).alias(`u`).description(`更新指定 agent`).action(async(e,t)=>{let{updateCommand:n}=await import(`./update-C16VUYlh.mjs`);O.exitCode=await $({action:`update`,run:()=>n(e,t.all??!1),target:{kind:`agent`,name:e}})}),j.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-DxOgxrj4.mjs`);O.exitCode=await $({action:`uninstall`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-Okv_jJrm.mjs`);O.exitCode=await $({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),j.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-D7pP264B.mjs`);O.exitCode=await $({action:`info`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`config`).argument(`[action]`,`Action: get, set, reset`).argument(`[key]`,`Config key`).argument(`[value]`,`Config value`).description(`配置管理`).action(async(e,t,n)=>{let{configCommand:r}=await import(`./config-t0R0Mv01.mjs`);O.exitCode=await $({action:`config`,run:()=>r(e,t,n),target:{kind:`config`,name:t}})}),j.command(`upgrade`).description(`升级 Quantex CLI`).option(`--channel <channel>`,`Update channel: stable or beta`).option(`--check`,`Only check whether an update is available`).action(async e=>{let{upgradeCommand:t}=await import(`./upgrade-B3BA1_Mb.mjs`);O.exitCode=await $({action:`upgrade`,run:()=>t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1}),target:{kind:`self`,name:`quantex`}})}),j.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-CVAcacpJ.mjs`);O.exitCode=await $({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const Ne=new Set([...j.commands.map(e=>e.name()),...j.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),Q=Fe(O.argv.slice(2),Ne);if(Q?.error&&(console.log(y.red(Q.error)),O.exit(2)),Q&&re(Q.agentName)){try{f(d({color:Q.color,dryRun:Q.dryRun,idempotencyKey:Q.idempotencyKey,logLevel:Q.logLevel,noCache:Q.noCache,nonInteractive:Q.nonInteractive,quiet:Q.quiet,refresh:Q.refresh,runId:Q.runId,timeout:Q.timeout,yes:Q.yes}))}catch(e){console.log(y.red(e instanceof Error?e.message:String(e))),O.exit(2)}try{let e=await q(Q.agentName,Q.agentArgs,{assumeYes:Q.yes,dryRun:Q.dryRun,nonInteractive:Q.nonInteractive});O.exit(e)}finally{b()}}j.parse();function Pe(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function Fe(e,t){let n=O.stdin.isTTY===!1||O.stdout.isTTY===!1,r,i=!1,a=0,o,s=!1,c,l=!1,u=!1,d,f=!1,p=!1,m,h,g=!1;for(;a<e.length;){let _=e[a];if(_===`--json`){s=!0,a+=1;continue}if(_===`--output`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--output requires a value`};d=t,a+=2;continue}if(_===`--non-interactive`){u=!0,a+=1;continue}if(_===`--yes`){g=!0,a+=1;continue}if(_===`--quiet`){f=!0,a+=1;continue}if(_===`--color`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--color requires a value`};r=t,a+=2;continue}if(_===`--log-level`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--log-level requires a value`};c=t,a+=2;continue}if(_===`--dry-run`){i=!0,a+=1;continue}if(_===`--refresh`){p=!0,a+=1;continue}if(_===`--no-cache`){l=!0,a+=1;continue}if(_===`--idempotency-key`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--idempotency-key requires a value`};o=t,a+=2;continue}if(_===`--run-id`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--run-id requires a value`};m=t,a+=2;continue}if(_===`--timeout`){let t=e[a+1];if(!t)return{agentArgs:[],agentName:``,error:`--timeout requires a value`};h=t,a+=2;continue}return _.startsWith(`-`)||t.has(_)?void 0:s||d===`json`||d===`ndjson`||n&&d!==`human`?{agentArgs:[],agentName:``,error:`Structured output is not supported for shortcut agent execution yet. Use a management command instead.`}:{agentArgs:e.slice(a+1),agentName:_,color:r,dryRun:i,idempotencyKey:o,logLevel:c,noCache:l,nonInteractive:u,quiet:f,refresh:p,runId:m,timeout:h,yes:g}}}async function $(e){return se(await _e(e))}export{};
@@ -1,6 +1,6 @@
1
- import{createHash as e,randomUUID as t}from"node:crypto";import n from"node:process";import{existsSync as r,mkdirSync as i,writeFileSync as a}from"node:fs";import{chmod as o,mkdir as s,mkdtemp as c,readFile as l,realpath as u,rename as d,rm as f,stat as p,writeFile as m}from"node:fs/promises";import{basename as h,dirname as g,join as _,win32 as v}from"node:path";import{homedir as ee}from"node:os";import{spawn as te}from"node:child_process";import{text as ne}from"node:stream/consumers";import{fileURLToPath as re}from"node:url";import{Buffer as ie}from"node:buffer";import ae from"picocolors";const oe={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},cargo:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},deno:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},mise:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},npm:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},pip:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},uv:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},script:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},winget:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`}};function y(e){return oe[e]}function b(e){return y(e).lifecycle===`managed`}function se(e){return y(e).lifecycle}function x(e){return y(e).canUpdate}function ce(e){return y(e).canUninstall}function le(e){return y(e).canLookupLatestVersion}function ue(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function S(e,t){if(t.packageName)return t.packageName;if(t.type===`cargo`)return e.packages?.cargo;if(t.type===`deno`)return e.packages?.deno;if(t.type===`mise`)return e.packages?.mise;if(t.type===`pip`)return e.packages?.pip;if(t.type===`uv`)return e.packages?.uv;if(t.type===`bun`||t.type===`npm`)return e.packages?.npm}function de(e){return e?x(e.installType):!1}function fe(e,t){return de(t)||!!e.selfUpdate}function pe(e){return!!e&&le(e.installType)}function me(e){return e.length>0&&e.every(e=>le(e.type))}function he(e){return b(e.type)?`${se(e.type)}/${e.type}${ue(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function ge(e){return e?b(e.installType)?`managed via ${e.installType}${ue(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function _e(e,t){let n=Oe({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function ve(e,t){if(t.type===`bun`){let n=S(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=S(e,t);return n?`npm i -g ${n}`:``}if(t.type===`brew`)return t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``;if(t.type===`cargo`){let n=S(e,t);return n?[`cargo`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}if(t.type===`deno`){let n=S(e,t);return n?[`deno`,`install`,`--global`,...t.packageInstallArgs??[],n].join(` `):``}if(t.type===`mise`){let n=S(e,t);return n?`mise use --global ${n}`:``}if(t.type===`pip`){let n=S(e,t);return n?`pip install ${n}`:``}if(t.type===`uv`){let n=S(e,t);return n?[`uv`,`tool`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}return t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function ye(e,t,n){if(t)return pe(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!me(n)))return e.packages.npm}function be(e,t){let n=xe(t);if(n){let t=e.find(e=>e.type===n);if(t)return t}if(e.length!==1)return;let[r]=e;if(!(r.type!==`script`&&r.type!==`binary`))return r}function xe(e){if(!e)return;let t=e.replaceAll(`\\`,`/`);if(t.includes(`/.bun/bin/`)||t.includes(`/.bun/install/global/`))return`bun`;if(t.includes(`/.local/share/mise/shims/`)||t.includes(`/.mise/shims/`))return`mise`;if(t.includes(`/node_modules/.bin/`)||t.includes(`/node_modules/`))return`npm`}function Se(e){if(e.installedState)return b(e.installedState.installType)?e.installedState.installType:void 0;for(let t of e.methods)if(b(t.type)&&x(t.type))return t.type}const Ce={strategy:`managed`,canHandle:e=>!!Se(e),getManagedInstallerType:e=>Se(e)},we={strategy:`self-update`,canHandle:e=>!de(e.installedState)&&!!e.agent.selfUpdate},Te={strategy:`manual-hint`,canHandle:()=>!0},Ee=[Ce,we,Te];function De(e){return Ee.find(t=>t.canHandle(e))??Te}function Oe(e){return De(e).strategy}function ke(e){return fe(e.agent,e.installedState)}function Ae(e){let t=e.trim().match(/^(\d+)(ms|[smh])?$/);if(!t)return;let n=Number.parseInt(t[1],10),r=t[2]??`ms`;if(Number.isFinite(n))switch(r){case`ms`:return n;case`s`:return n*1e3;case`m`:return n*60*1e3;case`h`:return n*60*60*1e3;default:return}}let C,w=new Set;function T(){return C??=ze(),C}function je(e){w=new Set,C={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function Me(){C=void 0,w=new Set}function Ne(e={}){let r=n.stdin.isTTY!==!1,i=n.stdout.isTTY!==!1,a=!r||!i,o=e.json||e.output===`json`?`json`:e.output===`ndjson`?`ndjson`:e.output===`human`?`human`:a?`json`:`human`,s=e.timeout===void 0?void 0:Ae(e.timeout),c=Be(e.color),l=Ve(e.logLevel);if(e.timeout!==void 0&&s===void 0)throw Error(`Invalid timeout value: ${e.timeout}`);if(e.refresh&&e.noCache)throw Error(`Cannot combine --refresh with --no-cache.`);return{assumeYes:e.yes,cacheMode:e.noCache?`no-cache`:e.refresh?`refresh`:`default`,cancelled:!1,colorMode:c,dryRun:e.dryRun,idempotencyKey:e.idempotencyKey,interactive:!e.nonInteractive&&!a&&r&&i,logLevel:l,outputMode:o,quiet:e.quiet,runId:e.runId??n.env.QUANTEX_RUN_ID??t(),timeoutMs:s}}function Pe(){C&&(C.cancelled=!0)}function Fe(){C&&(C.cancelled=!1)}async function Ie(){Pe();let e=[...w];w.clear(),await Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}function Le(e){return w.add(e),()=>{w.delete(e)}}function Re(e){let t=T();if(!t.freshness){t.freshness=e;return}t.freshness={fetchedAt:t.freshness.fetchedAt<=e.fetchedAt?t.freshness.fetchedAt:e.fetchedAt,source:t.freshness.source===`network`&&e.source===`network`?`network`:`cache`,staleAfter:t.freshness.staleAfter<=e.staleAfter?t.freshness.staleAfter:e.staleAfter}}function ze(){return Ne()}function Be(e){if(e===void 0||e===`auto`)return`auto`;if(e===`always`)return`always`;if(e===`never`)return`never`;throw Error(`Invalid color mode: ${e}`)}function Ve(e){if(e===void 0||e===`info`)return`info`;if(e===`silent`||e===`error`||e===`warn`||e===`debug`)return e;throw Error(`Invalid log level: ${e}`)}const He=`https://registry.npmjs.org`;function E(e){if(e)try{return new URL(e.trim()).toString().replace(/\/+$/,``)}catch{return}}function Ue(e,t,n){return`${E(n)}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}const We={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,selfUpdateRegistry:void 0,versionCacheTtlHours:6};function D(){return _(n.env.HOME||n.env.USERPROFILE||ee(),`.quantex`)}function O(){return _(D(),`config.json`)}async function k(){let e={...We,...await Je()};return{...e,defaultPackageManager:Ge(e.defaultPackageManager)?e.defaultPackageManager:`bun`,networkRetries:A(e.networkRetries,2),networkTimeoutMs:A(e.networkTimeoutMs,1e4),npmBunUpdateStrategy:e.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:e.selfUpdateChannel===`beta`?`beta`:`stable`,selfUpdateRegistry:typeof e.selfUpdateRegistry==`string`?E(e.selfUpdateRegistry):void 0,versionCacheTtlHours:A(e.versionCacheTtlHours,6)}}function Ge(e){return e===`bun`||e===`mise`||e===`npm`}function Ke(e){return e===`latest-major`||e===`respect-semver`}async function qe(e){await s(D(),{recursive:!0}),await m(O(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function Je(){try{let e=await l(O(),`utf8`),t=JSON.parse(e);return Ye(t)?t:{}}catch{return{}}}function A(e,t){if(typeof e==`number`&&Number.isInteger(e)&&e>0)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isInteger(t)&&t>0)return t}return t}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Xe=class extends Error{lockPath;resource;constructor(e,t){super(`Another quantex process is already using the ${e} lock.`),this.name=`ResourceLockError`,this.lockPath=t,this.resource=e}};function Ze(e){return e instanceof Xe}function Qe(e){let t=e.map(e=>e.trim().replaceAll(/[^\w.-]+/g,`-`).replaceAll(/-+/g,`-`).replaceAll(/^-|-$/g,``)).filter(Boolean),n=t.length>0?t:[`default`],r=n.slice(0,-1),i=`${n.at(-1)}.lock`;return _(D(),`locks`,...r,i)}async function j(e){let t=Qe(e.scope);return await s(g(t),{recursive:!0}),await $e(e.resource,t),async()=>{await f(t,{force:!0,recursive:!0})}}async function $e(e,t){try{i(t,{recursive:!1}),et(t);return}catch(e){if(!at(e))throw e}if(!await tt(t))throw new Xe(e,t);try{i(t,{recursive:!1}),et(t)}catch(n){throw at(n)?new Xe(e,t):n}}function et(e){a(_(e,`owner.json`),`${JSON.stringify({pid:n.pid,createdAt:new Date().toISOString()})}\n`,`utf8`)}async function tt(e){let t;try{t=await nt(e)}catch{return!1}return t&&it(t.pid)?!1:(await f(e,{force:!0,recursive:!0}),!0)}async function nt(e){let t=Date.now()+100;for(;Date.now()<t;){let t=await rt(e);if(t)return t;await new Promise(e=>setTimeout(e,2))}return await rt(e)}async function rt(e){try{let t=await l(_(e,`owner.json`),`utf8`),n=JSON.parse(t);return typeof n.pid==`number`&&Number.isInteger(n.pid)&&n.pid>0?{pid:n.pid}:void 0}catch(e){if(ot(e))return;throw e}}function it(e){try{return n.kill(e,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}}function at(e){return typeof e==`object`&&!!e&&`code`in e&&e.code===`EEXIST`}function ot(e){let t=typeof e==`object`&&e&&`code`in e?e.code:void 0;return t===`ENOENT`||t===`ENOTDIR`}async function st(e,t){let n=await j(e);try{return await t()}finally{await n()}}async function ct(){try{return await j({resource:`self upgrade`,scope:[`self-upgrade`]})}catch(e){if(Ze(e))return;throw e}}const M=`quantex-cli`,lt=`https://github.com/Drswith/quantex-cli`,ut=`0.26.0`;function N(e,t={}){if(T().outputMode===`human`){let n=F(e,{...t,stdio:[`inherit`,`inherit`,`inherit`]});return{cleanup:Le(()=>gt(n)),outputDrained:Promise.resolve(),proc:n}}let n=F(e,{...t,stdio:[`ignore`,`pipe`,`pipe`]});return{cleanup:Le(()=>gt(n)),outputDrained:Promise.all([dt(n.stdout),dt(n.stderr)]).then(()=>void 0),proc:n}}async function P(e){let t=T();try{let n=await e.proc.exited;return await e.outputDrained,t.cancelled?1:n}finally{e.cleanup()}}function F(e,t={}){let n=mt();if(n)return ht(e,t,n);let[r,...i]=e;if(!r)throw Error(`spawnCommand requires a non-empty command array.`);let a=te(r,i,{...t,shell:t.shell??pt(r)});return{get exitCode(){return a.exitCode},pid:a.pid,stderr:a.stderr,stdout:a.stdout,exited:ft(a),kill:a.kill.bind(a),unref:()=>a.unref()}}async function I(e){let[t,n,r]=await Promise.all([L(e.stdout),L(e.stderr),e.exited]);return{exitCode:r,stderr:n,stdout:t}}async function dt(e){if(!e)return;let t=await L(e);t&&n.stderr.write(t)}async function ft(e){return new Promise((t,n)=>{e.once(`error`,n),e.once(`close`,e=>{t(typeof e==`number`?e:1)})})}async function L(e){return e?typeof e==`string`?e:typeof e.getReader==`function`?new Response(e).text():ne(e):``}function pt(e){return n.platform!==`win32`||e.includes(`/`)||e.includes(`\\`)?!1:!/\.[a-z0-9]+$/i.test(e)}function mt(){let e=globalThis.Bun?.spawn;return typeof e==`function`?e:void 0}function ht(e,t,n){let r=n([...e],t);return{get exitCode(){return r.exitCode},pid:r.pid,stderr:r.stderr,stdout:r.stdout,exited:r.exited.then(()=>typeof r.exitCode==`number`?r.exitCode:1),kill:e=>r.kill?.(e)??!1,unref:()=>r.unref?.()}}async function gt(e){n.platform===`win32`&&e.pid!==void 0&&await vt(_t(e.pid),2e3);try{e.kill?.(`SIGTERM`)}catch{}await vt(e.exited.then(()=>void 0).catch(()=>void 0),2e3)}async function _t(e){await new Promise(t=>{let n=te(`taskkill.exe`,[`/PID`,String(e),`/T`,`/F`],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0});n.once(`error`,()=>t()),n.once(`close`,()=>t())})}async function vt(e,t){let n;try{await Promise.race([e,new Promise(e=>{n=setTimeout(e,t)})])}finally{n&&clearTimeout(n)}}async function R(e,t){let n=await yt(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function yt(e,t,n=`text`){let r=await k(),i=r.versionCacheTtlHours*60*60*1e3,a=T().cacheMode,o=a===`no-cache`?{entries:{}}:await xt(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return z(s,i),s.body;let l=await bt(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&z(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await St(o),wt(c,c+i),s.body;if(!l.ok)return s&&z(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&z(s,i),s?.body}let d={body:u,etag:l.headers.get(`etag`)??void 0,expiresAt:c+i,fetchedAt:c};return a!==`no-cache`&&(o.entries[t]=d,await St(o)),wt(c,c+i),u}async function bt(e,t){for(let n=0;n<=t.retries;n++){let r=new AbortController,i=setTimeout(()=>r.abort(),t.timeoutMs);try{return await fetch(e,{headers:t.headers,signal:r.signal})}catch{if(n===t.retries)return}finally{clearTimeout(i)}}}async function xt(){try{return JSON.parse(await l(Ct(),`utf8`))}catch{return{entries:{}}}}async function St(e){await s(_(D(),`cache`),{recursive:!0}),await m(Ct(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function Ct(){return _(D(),`cache`,`versions.json`)}function z(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);Re({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function wt(e,t){Re({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}const Tt=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function Et(e,t){if(t)return t(e);let n=e.trim().split(`
1
+ import{createHash as e,randomUUID as t}from"node:crypto";import n from"node:process";import{existsSync as r,mkdirSync as i,writeFileSync as a}from"node:fs";import{chmod as o,mkdir as s,mkdtemp as c,readFile as l,realpath as u,rename as d,rm as f,stat as p,writeFile as m}from"node:fs/promises";import{basename as h,dirname as g,join as _,win32 as v}from"node:path";import{homedir as ee}from"node:os";import{spawn as te}from"node:child_process";import{text as ne}from"node:stream/consumers";import{fileURLToPath as re}from"node:url";import{Buffer as ie}from"node:buffer";import ae from"picocolors";const oe={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},cargo:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},deno:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},mise:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},npm:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},pip:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},uv:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},script:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},winget:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`}};function y(e){return oe[e]}function b(e){return y(e).lifecycle===`managed`}function se(e){return y(e).lifecycle}function x(e){return y(e).canUpdate}function ce(e){return y(e).canUninstall}function le(e){return y(e).canLookupLatestVersion}function ue(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function S(e,t){if(t.packageName)return t.packageName;if(t.type===`cargo`)return e.packages?.cargo;if(t.type===`deno`)return e.packages?.deno;if(t.type===`mise`)return e.packages?.mise;if(t.type===`pip`)return e.packages?.pip;if(t.type===`uv`)return e.packages?.uv;if(t.type===`bun`||t.type===`npm`)return e.packages?.npm}function de(e){return e?x(e.installType):!1}function fe(e,t){return de(t)||!!e.selfUpdate}function pe(e){return!!e&&le(e.installType)}function me(e){return e.length>0&&e.every(e=>le(e.type))}function he(e){return b(e.type)?`${se(e.type)}/${e.type}${ue(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function ge(e){return e?b(e.installType)?`managed via ${e.installType}${ue(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function _e(e,t){let n=Oe({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function ve(e,t){if(t.type===`bun`){let n=S(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=S(e,t);return n?`npm i -g ${n}`:``}if(t.type===`brew`)return t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``;if(t.type===`cargo`){let n=S(e,t);return n?[`cargo`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}if(t.type===`deno`){let n=S(e,t);return n?[`deno`,`install`,`--global`,...t.packageInstallArgs??[],n].join(` `):``}if(t.type===`mise`){let n=S(e,t);return n?`mise use --global ${n}`:``}if(t.type===`pip`){let n=S(e,t);return n?`pip install ${n}`:``}if(t.type===`uv`){let n=S(e,t);return n?[`uv`,`tool`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}return t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function ye(e,t,n){if(t)return pe(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!me(n)))return e.packages.npm}function be(e,t){let n=xe(t);if(n){let t=e.find(e=>e.type===n);if(t)return t}if(e.length!==1)return;let[r]=e;if(!(r.type!==`script`&&r.type!==`binary`))return r}function xe(e){if(!e)return;let t=e.replaceAll(`\\`,`/`);if(t.includes(`/.bun/bin/`)||t.includes(`/.bun/install/global/`))return`bun`;if(t.includes(`/.local/share/mise/shims/`)||t.includes(`/.mise/shims/`))return`mise`;if(t.includes(`/node_modules/.bin/`)||t.includes(`/node_modules/`))return`npm`}function Se(e){if(e.installedState)return b(e.installedState.installType)?e.installedState.installType:void 0;for(let t of e.methods)if(b(t.type)&&x(t.type))return t.type}const Ce={strategy:`managed`,canHandle:e=>!!Se(e),getManagedInstallerType:e=>Se(e)},we={strategy:`self-update`,canHandle:e=>!de(e.installedState)&&!!e.agent.selfUpdate},Te={strategy:`manual-hint`,canHandle:()=>!0},Ee=[Ce,we,Te];function De(e){return Ee.find(t=>t.canHandle(e))??Te}function Oe(e){return De(e).strategy}function ke(e){return fe(e.agent,e.installedState)}function Ae(e){let t=e.trim().match(/^(\d+)(ms|[smh])?$/);if(!t)return;let n=Number.parseInt(t[1],10),r=t[2]??`ms`;if(Number.isFinite(n))switch(r){case`ms`:return n;case`s`:return n*1e3;case`m`:return n*60*1e3;case`h`:return n*60*60*1e3;default:return}}let C,w=new Set;function T(){return C??=ze(),C}function je(e){w=new Set,C={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function Me(){C=void 0,w=new Set}function Ne(e={}){let r=n.stdin.isTTY!==!1,i=n.stdout.isTTY!==!1,a=!r||!i,o=e.json||e.output===`json`?`json`:e.output===`ndjson`?`ndjson`:e.output===`human`?`human`:a?`json`:`human`,s=e.timeout===void 0?void 0:Ae(e.timeout),c=Be(e.color),l=Ve(e.logLevel);if(e.timeout!==void 0&&s===void 0)throw Error(`Invalid timeout value: ${e.timeout}`);if(e.refresh&&e.noCache)throw Error(`Cannot combine --refresh with --no-cache.`);return{assumeYes:e.yes,cacheMode:e.noCache?`no-cache`:e.refresh?`refresh`:`default`,cancelled:!1,colorMode:c,dryRun:e.dryRun,idempotencyKey:e.idempotencyKey,interactive:!e.nonInteractive&&!a&&r&&i,logLevel:l,outputMode:o,quiet:e.quiet,runId:e.runId??n.env.QUANTEX_RUN_ID??t(),timeoutMs:s}}function Pe(){C&&(C.cancelled=!0)}function Fe(){C&&(C.cancelled=!1)}async function Ie(){Pe();let e=[...w];w.clear(),await Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}function Le(e){return w.add(e),()=>{w.delete(e)}}function Re(e){let t=T();if(!t.freshness){t.freshness=e;return}t.freshness={fetchedAt:t.freshness.fetchedAt<=e.fetchedAt?t.freshness.fetchedAt:e.fetchedAt,source:t.freshness.source===`network`&&e.source===`network`?`network`:`cache`,staleAfter:t.freshness.staleAfter<=e.staleAfter?t.freshness.staleAfter:e.staleAfter}}function ze(){return Ne()}function Be(e){if(e===void 0||e===`auto`)return`auto`;if(e===`always`)return`always`;if(e===`never`)return`never`;throw Error(`Invalid color mode: ${e}`)}function Ve(e){if(e===void 0||e===`info`)return`info`;if(e===`silent`||e===`error`||e===`warn`||e===`debug`)return e;throw Error(`Invalid log level: ${e}`)}const He=`https://registry.npmjs.org`;function E(e){if(e)try{return new URL(e.trim()).toString().replace(/\/+$/,``)}catch{return}}function Ue(e,t,n){return`${E(n)}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}const We={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,selfUpdateRegistry:void 0,versionCacheTtlHours:6};function D(){return _(n.env.HOME||n.env.USERPROFILE||ee(),`.quantex`)}function O(){return _(D(),`config.json`)}async function k(){let e={...We,...await Je()};return{...e,defaultPackageManager:Ge(e.defaultPackageManager)?e.defaultPackageManager:`bun`,networkRetries:A(e.networkRetries,2),networkTimeoutMs:A(e.networkTimeoutMs,1e4),npmBunUpdateStrategy:e.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:e.selfUpdateChannel===`beta`?`beta`:`stable`,selfUpdateRegistry:typeof e.selfUpdateRegistry==`string`?E(e.selfUpdateRegistry):void 0,versionCacheTtlHours:A(e.versionCacheTtlHours,6)}}function Ge(e){return e===`bun`||e===`mise`||e===`npm`}function Ke(e){return e===`latest-major`||e===`respect-semver`}async function qe(e){await s(D(),{recursive:!0}),await m(O(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function Je(){try{let e=await l(O(),`utf8`),t=JSON.parse(e);return Ye(t)?t:{}}catch{return{}}}function A(e,t){if(typeof e==`number`&&Number.isInteger(e)&&e>0)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isInteger(t)&&t>0)return t}return t}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Xe=class extends Error{lockPath;resource;constructor(e,t){super(`Another quantex process is already using the ${e} lock.`),this.name=`ResourceLockError`,this.lockPath=t,this.resource=e}};function Ze(e){return e instanceof Xe}function Qe(e){let t=e.map(e=>e.trim().replaceAll(/[^\w.-]+/g,`-`).replaceAll(/-+/g,`-`).replaceAll(/^-|-$/g,``)).filter(Boolean),n=t.length>0?t:[`default`],r=n.slice(0,-1),i=`${n.at(-1)}.lock`;return _(D(),`locks`,...r,i)}async function j(e){let t=Qe(e.scope);return await s(g(t),{recursive:!0}),await $e(e.resource,t),async()=>{await f(t,{force:!0,recursive:!0})}}async function $e(e,t){try{i(t,{recursive:!1}),et(t);return}catch(e){if(!at(e))throw e}if(!await tt(t))throw new Xe(e,t);try{i(t,{recursive:!1}),et(t)}catch(n){throw at(n)?new Xe(e,t):n}}function et(e){a(_(e,`owner.json`),`${JSON.stringify({pid:n.pid,createdAt:new Date().toISOString()})}\n`,`utf8`)}async function tt(e){let t;try{t=await nt(e)}catch{return!1}return t&&it(t.pid)?!1:(await f(e,{force:!0,recursive:!0}),!0)}async function nt(e){let t=Date.now()+100;for(;Date.now()<t;){let t=await rt(e);if(t)return t;await new Promise(e=>setTimeout(e,2))}return await rt(e)}async function rt(e){try{let t=await l(_(e,`owner.json`),`utf8`),n=JSON.parse(t);return typeof n.pid==`number`&&Number.isInteger(n.pid)&&n.pid>0?{pid:n.pid}:void 0}catch(e){if(ot(e))return;throw e}}function it(e){try{return n.kill(e,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}}function at(e){return typeof e==`object`&&!!e&&`code`in e&&e.code===`EEXIST`}function ot(e){let t=typeof e==`object`&&e&&`code`in e?e.code:void 0;return t===`ENOENT`||t===`ENOTDIR`}async function st(e,t){let n=await j(e);try{return await t()}finally{await n()}}async function ct(){try{return await j({resource:`self upgrade`,scope:[`self-upgrade`]})}catch(e){if(Ze(e))return;throw e}}const M=`quantex-cli`,lt=`https://github.com/Drswith/quantex-cli`,ut=`0.27.1`;function N(e,t={}){if(T().outputMode===`human`){let n=F(e,{...t,stdio:[`inherit`,`inherit`,`inherit`]});return{cleanup:Le(()=>gt(n)),outputDrained:Promise.resolve(),proc:n}}let n=F(e,{...t,stdio:[`ignore`,`pipe`,`pipe`]});return{cleanup:Le(()=>gt(n)),outputDrained:Promise.all([dt(n.stdout),dt(n.stderr)]).then(()=>void 0),proc:n}}async function P(e){let t=T();try{let n=await e.proc.exited;return await e.outputDrained,t.cancelled?1:n}finally{e.cleanup()}}function F(e,t={}){let n=mt();if(n)return ht(e,t,n);let[r,...i]=e;if(!r)throw Error(`spawnCommand requires a non-empty command array.`);let a=te(r,i,{...t,shell:t.shell??pt(r)});return{get exitCode(){return a.exitCode},pid:a.pid,stderr:a.stderr,stdout:a.stdout,exited:ft(a),kill:a.kill.bind(a),unref:()=>a.unref()}}async function I(e){let[t,n,r]=await Promise.all([L(e.stdout),L(e.stderr),e.exited]);return{exitCode:r,stderr:n,stdout:t}}async function dt(e){if(!e)return;let t=await L(e);t&&n.stderr.write(t)}async function ft(e){return new Promise((t,n)=>{e.once(`error`,n),e.once(`close`,e=>{t(typeof e==`number`?e:1)})})}async function L(e){return e?typeof e==`string`?e:typeof e.getReader==`function`?new Response(e).text():ne(e):``}function pt(e){return n.platform!==`win32`||e.includes(`/`)||e.includes(`\\`)?!1:!/\.[a-z0-9]+$/i.test(e)}function mt(){let e=globalThis.Bun?.spawn;return typeof e==`function`?e:void 0}function ht(e,t,n){let r=n([...e],t);return{get exitCode(){return r.exitCode},pid:r.pid,stderr:r.stderr,stdout:r.stdout,exited:r.exited.then(()=>typeof r.exitCode==`number`?r.exitCode:1),kill:e=>r.kill?.(e)??!1,unref:()=>r.unref?.()}}async function gt(e){n.platform===`win32`&&e.pid!==void 0&&await vt(_t(e.pid),2e3);try{e.kill?.(`SIGTERM`)}catch{}await vt(e.exited.then(()=>void 0).catch(()=>void 0),2e3)}async function _t(e){await new Promise(t=>{let n=te(`taskkill.exe`,[`/PID`,String(e),`/T`,`/F`],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0});n.once(`error`,()=>t()),n.once(`close`,()=>t())})}async function vt(e,t){let n;try{await Promise.race([e,new Promise(e=>{n=setTimeout(e,t)})])}finally{n&&clearTimeout(n)}}async function R(e,t){let n=await yt(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function yt(e,t,n=`text`){let r=await k(),i=r.versionCacheTtlHours*60*60*1e3,a=T().cacheMode,o=a===`no-cache`?{entries:{}}:await xt(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return z(s,i),s.body;let l=await bt(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&z(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await St(o),wt(c,c+i),s.body;if(!l.ok)return s&&z(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&z(s,i),s?.body}let d={body:u,etag:l.headers.get(`etag`)??void 0,expiresAt:c+i,fetchedAt:c};return a!==`no-cache`&&(o.entries[t]=d,await St(o)),wt(c,c+i),u}async function bt(e,t){for(let n=0;n<=t.retries;n++){let r=new AbortController,i=setTimeout(()=>r.abort(),t.timeoutMs);try{return await fetch(e,{headers:t.headers,signal:r.signal})}catch{if(n===t.retries)return}finally{clearTimeout(i)}}}async function xt(){try{return JSON.parse(await l(Ct(),`utf8`))}catch{return{entries:{}}}}async function St(e){await s(_(D(),`cache`),{recursive:!0}),await m(Ct(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function Ct(){return _(D(),`cache`,`versions.json`)}function z(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);Re({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function wt(e,t){Re({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}const Tt=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function Et(e,t){if(t)return t(e);let n=e.trim().split(`
2
2
  `)[0],r=n.match(Tt);return r?r[1]:n||void 0}function Dt(e,t){let n=At(e),r=At(t);if(!(!n||!r)){for(let e=0;e<3;e+=1){let t=n.core[e]-r.core[e];if(t!==0)return t>0?1:-1}return jt(n.prerelease,r.prerelease)}}function B(e,t){return Dt(e,t)===1}async function V(e,t){let n=t?.command??[e,`--version`];try{let{exitCode:e,stdout:r}=await I(F(n));return e===0?Et(r,t?.parser):void 0}catch{return}}async function H(e,t=`latest`,n={}){try{let r=E(n.registry)??`https://registry.npmjs.org`;return(await R(Ue(e,t,r),`npm:${r}:${e}:${t}`))?.version}catch{return}}async function Ot(e){try{let{exitCode:t,stdout:r}=await I(F([n.platform===`win32`?`where`:`which`,e]));return t===0?r.trim().split(`
3
- `)[0]:void 0}catch{return}}async function kt(e){if(e)try{return await u(e)}catch{return e}}function At(e){let t=e.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9a-z.-]+))?$/i);if(t)return{core:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]?t[4].split(`.`):[]}}function jt(e,t){if(e.length===0&&t.length===0)return 0;if(e.length===0)return 1;if(t.length===0)return-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r+=1){let n=e[r],i=t[r];if(n===void 0)return-1;if(i===void 0)return 1;if(n===i)continue;let a=/^\d+$/.test(n),o=/^\d+$/.test(i);return a&&o?Number(n)>Number(i)?1:-1:a?-1:o||n>i?1:-1}return 0}var U=class extends Error{constructor(e,t){super(e,t),this.name=`StateFileError`}};const Mt={installedAgents:{},self:{}};function W(){return _(D(),`state.json`)}async function G(){return Bt()}async function Nt(e){let t=await j({resource:`state`,scope:[`state`]});try{await Yt(e)}finally{await t()}}async function Pt(e){return(await G()).installedAgents[e]}async function Ft(e){await q(t=>{t.installedAgents[e.agentName]=e})}async function It(e){await q(t=>{delete t.installedAgents[e]})}async function Lt(){return(await G()).self}async function Rt(e){await q(t=>{t.self.installSource=e})}async function zt(e,t){await q(n=>{n.self.updateNoticeVersion=e,n.self.updateNoticeAt=t})}async function Bt(){try{let e=JSON.parse(await l(W(),`utf8`));if(!K(e))throw new U(`Failed to read Quantex state file: root value must be an object.`);let t=qt(e.self);return{installedAgents:Ht(e.installedAgents),self:t}}catch(e){if(Xt(e))return{...Mt};throw e instanceof U?e:new U(`Failed to read Quantex state file.`,{cause:e})}}const Vt=new Set([`binary`,`brew`,`bun`,`cargo`,`deno`,`mise`,`npm`,`pip`,`script`,`uv`,`winget`]);function Ht(e){if(e===void 0)return{};if(!K(e))throw new U(`Failed to read Quantex state file: installedAgents must be an object.`);let t={};for(let[n,r]of Object.entries(e))t[n]=Ut(n,r);return t}function Ut(e,t){if(!K(t))throw new U(`Failed to read Quantex state file: installed agent "${e}" must be an object.`);if(typeof t.agentName!=`string`||t.agentName!==e)throw new U(`Failed to read Quantex state file: installed agent "${e}" has an invalid agentName.`);if(!Wt(t.installType))throw new U(`Failed to read Quantex state file: installed agent "${e}" has an invalid installType.`);let n={agentName:e,installType:t.installType};if(typeof t.binaryName==`string`&&(n.binaryName=t.binaryName),Array.isArray(t.packageInstallArgs)&&t.packageInstallArgs.every(Kt)&&(n.packageInstallArgs=t.packageInstallArgs),typeof t.packageName==`string`){if(t.packageName.length===0&&b(t.installType))throw new U(`Failed to read Quantex state file: installed agent "${e}" has an empty packageName.`);n.packageName=t.packageName}return Gt(t.packageTargetKind)&&(n.packageTargetKind=t.packageTargetKind),typeof t.command==`string`&&(n.command=t.command),n}function Wt(e){return typeof e==`string`&&Vt.has(e)}function Gt(e){return e===`package`||e===`cask`||e===`id`}function Kt(e){return typeof e==`string`}function qt(e){if(!K(e))return{};let t={...e};return Jt(e.installSource)?t.installSource=e.installSource:delete t.installSource,typeof e.updateNoticeAt==`string`?t.updateNoticeAt=e.updateNoticeAt:delete t.updateNoticeAt,typeof e.updateNoticeVersion==`string`?t.updateNoticeVersion=e.updateNoticeVersion:delete t.updateNoticeVersion,t}function Jt(e){return e===`binary`||e===`bun`||e===`npm`||e===`source`||e===`unknown`}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Yt(e){await s(D(),{recursive:!0});let t=W(),r=`${t}.tmp-${n.pid}`,i=`${JSON.stringify(e,null,2)}\n`;try{await m(r,i,`utf8`),await d(r,t)}catch(e){throw await f(r,{force:!0}),e}}function Xt(e){let t=typeof e==`object`&&e&&`code`in e?e.code:void 0;return t===`ENOENT`||t===`ENOTDIR`}async function q(e){let t=await j({resource:`state`,scope:[`state`]});try{let t=await Bt();await e(t),await Yt(t)}finally{await t()}}function Zt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function J(e=n.execPath){if(h(Zt(e)).endsWith(`.exe`))return`quantex-windows-x64.exe`;if(n.platform===`darwin`)return n.arch===`arm64`?`quantex-darwin-arm64`:`quantex-darwin-x64`;if(n.platform===`linux`)return n.arch===`arm64`?`quantex-linux-arm64`:`quantex-linux-x64`}function Qt(e=n.execPath){let t=J(e);if(t)return`${lt}/releases/latest/download/${t}`}function $t(e,t,r=n.env){return e||(r.QUANTEX_UPDATE_CHANNEL===`beta`?`beta`:r.QUANTEX_UPDATE_CHANNEL===`stable`?`stable`:t===`beta`?`beta`:`stable`)}async function en(e){let t=await R(await tn(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function tn(e){if(e===`stable`)return`${lt}/releases/latest/download/manifest.json`;let t=(await nn(e)).assets.find(e=>e.name===`manifest.json`);if(!t?.browser_download_url)throw Error(`No manifest.json asset was found for the ${e} release channel.`);return t.browser_download_url}async function nn(e){let t=an();if(!t)throw Error(`Failed to resolve the GitHub repository slug for Quantex releases.`);let n=await R(`https://api.github.com/repos/${t}/releases?per_page=20`,`self:github-releases`);if(!n)throw Error(`Failed to query GitHub releases.`);let r=n.find(t=>e===`beta`?t.prerelease:!t.prerelease);if(!r)throw Error(`No GitHub release was found for the ${e} channel.`);return r}function rn(e,t=n.execPath){let r=n.platform,i=n.arch===`arm64`?`arm64`:`x64`,a=J(t);return e.assets.find(e=>e.platform===r&&e.arch===i&&(!a||e.name===a))}function an(){return lt.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const on=M,sn=`/node_modules/${on}`;async function cn(e){let t=await dn(),r=n.execPath,i=t.foundPackageJson?Y(t.packageRoot):Y(``,r),a=await un((await Lt()).installSource,i),o=await k(),s=$t(e?.updateChannel,o.selfUpdateChannel);return{canAutoUpdate:ln(a),currentVersion:t.version||`0.26.0`,executablePath:r,installSource:a,packageRoot:t.packageRoot,updateChannel:s}}function ln(e){return e===`binary`||e===`bun`||e===`npm`}async function un(e,t){return t!==`unknown`&&e!==t?(await Rt(t),t):e??t}function Y(e,t=n.execPath){let r=pn(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(sn)?`npm`:r?`source`:mn(t)?`binary`:`unknown`}async function dn(e=import.meta.url){let t=hn(e),n=g(t);for(;;){let e=_(n,`package.json`),t=await fn(e);if(t?.name===on)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.26.0`};let r=g(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:_(g(t),`package.json`),packageRoot:g(t),version:ut}}function X(){return ut}async function fn(e){try{return JSON.parse(await l(e,`utf8`))}catch{return}}function pn(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function mn(e){let t=h(pn(e));return t!==`bun`&&t!==`bun.exe`}function hn(e){try{return re(e)}catch{return n.execPath}}async function gn(e,t,r=n.env,i=n.cwd()){if(e!==`bun`&&e!==`npm`)return;let a=E(r.QTX_SELF_UPDATE_REGISTRY);return a?{isOverride:!0,registry:a,source:`quantex-env`}:t.selfUpdateRegistry?{isOverride:!0,registry:t.selfUpdateRegistry,source:`quantex-config`}:await _n(e,r,i)||{isOverride:!1,registry:He,source:`fallback`}}async function _n(e,t,n){if(e===`bun`){let e=vn(t,[`BUN_CONFIG_REGISTRY`,`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(e)return{isOverride:!1,registry:e,source:`bun-env`};let r=await yn(n,t);if(r)return{isOverride:!1,registry:r,source:`bunfig`}}let r=vn(t,[`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(r)return{isOverride:!1,registry:r,source:`npm-env`};let i=await xn(n,t);if(i)return{isOverride:!1,registry:i,source:`npmrc`}}function vn(e,t){for(let n of t){let t=E(e[n]);if(t)return t}}async function yn(e,t){let n=wn(t),i=t.XDG_CONFIG_HOME,a=Cn(e,`bunfig.toml`),o=[_(n,`.bunfig.toml`),i?_(i,`.bunfig.toml`):void 0];if(a){let e=await bn(a);if(e)return e}for(let e of o){if(!e||!r(e))continue;let t=await bn(e);if(t)return t}}async function bn(e){try{return Tn(await l(e,`utf8`))}catch{return}}async function xn(e,t){let n=wn(t),i=Cn(e,`.npmrc`),a=_(n,`.npmrc`);if(i){let e=await Sn(i);if(e)return e}if(r(a))return Sn(a)}async function Sn(e){try{let t=(await l(e,`utf8`)).split(`
3
+ `)[0]:void 0}catch{return}}async function kt(e){if(e)try{return await u(e)}catch{return e}}function At(e){let t=e.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9a-z.-]+))?$/i);if(t)return{core:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]?t[4].split(`.`):[]}}function jt(e,t){if(e.length===0&&t.length===0)return 0;if(e.length===0)return 1;if(t.length===0)return-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r+=1){let n=e[r],i=t[r];if(n===void 0)return-1;if(i===void 0)return 1;if(n===i)continue;let a=/^\d+$/.test(n),o=/^\d+$/.test(i);return a&&o?Number(n)>Number(i)?1:-1:a?-1:o||n>i?1:-1}return 0}var U=class extends Error{constructor(e,t){super(e,t),this.name=`StateFileError`}};const Mt={installedAgents:{},self:{}};function W(){return _(D(),`state.json`)}async function G(){return Bt()}async function Nt(e){let t=await j({resource:`state`,scope:[`state`]});try{await Yt(e)}finally{await t()}}async function Pt(e){return(await G()).installedAgents[e]}async function Ft(e){await q(t=>{t.installedAgents[e.agentName]=e})}async function It(e){await q(t=>{delete t.installedAgents[e]})}async function Lt(){return(await G()).self}async function Rt(e){await q(t=>{t.self.installSource=e})}async function zt(e,t){await q(n=>{n.self.updateNoticeVersion=e,n.self.updateNoticeAt=t})}async function Bt(){try{let e=JSON.parse(await l(W(),`utf8`));if(!K(e))throw new U(`Failed to read Quantex state file: root value must be an object.`);let t=qt(e.self);return{installedAgents:Ht(e.installedAgents),self:t}}catch(e){if(Xt(e))return{...Mt};throw e instanceof U?e:new U(`Failed to read Quantex state file.`,{cause:e})}}const Vt=new Set([`binary`,`brew`,`bun`,`cargo`,`deno`,`mise`,`npm`,`pip`,`script`,`uv`,`winget`]);function Ht(e){if(e===void 0)return{};if(!K(e))throw new U(`Failed to read Quantex state file: installedAgents must be an object.`);let t={};for(let[n,r]of Object.entries(e))t[n]=Ut(n,r);return t}function Ut(e,t){if(!K(t))throw new U(`Failed to read Quantex state file: installed agent "${e}" must be an object.`);if(typeof t.agentName!=`string`||t.agentName!==e)throw new U(`Failed to read Quantex state file: installed agent "${e}" has an invalid agentName.`);if(!Wt(t.installType))throw new U(`Failed to read Quantex state file: installed agent "${e}" has an invalid installType.`);let n={agentName:e,installType:t.installType};if(typeof t.binaryName==`string`&&(n.binaryName=t.binaryName),Array.isArray(t.packageInstallArgs)&&t.packageInstallArgs.every(Kt)&&(n.packageInstallArgs=t.packageInstallArgs),typeof t.packageName==`string`){if(t.packageName.length===0&&b(t.installType))throw new U(`Failed to read Quantex state file: installed agent "${e}" has an empty packageName.`);n.packageName=t.packageName}return Gt(t.packageTargetKind)&&(n.packageTargetKind=t.packageTargetKind),typeof t.command==`string`&&(n.command=t.command),n}function Wt(e){return typeof e==`string`&&Vt.has(e)}function Gt(e){return e===`package`||e===`cask`||e===`id`}function Kt(e){return typeof e==`string`}function qt(e){if(!K(e))return{};let t={...e};return Jt(e.installSource)?t.installSource=e.installSource:delete t.installSource,typeof e.updateNoticeAt==`string`?t.updateNoticeAt=e.updateNoticeAt:delete t.updateNoticeAt,typeof e.updateNoticeVersion==`string`?t.updateNoticeVersion=e.updateNoticeVersion:delete t.updateNoticeVersion,t}function Jt(e){return e===`binary`||e===`bun`||e===`npm`||e===`source`||e===`unknown`}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Yt(e){await s(D(),{recursive:!0});let t=W(),r=`${t}.tmp-${n.pid}`,i=`${JSON.stringify(e,null,2)}\n`;try{await m(r,i,`utf8`),await d(r,t)}catch(e){throw await f(r,{force:!0}),e}}function Xt(e){let t=typeof e==`object`&&e&&`code`in e?e.code:void 0;return t===`ENOENT`||t===`ENOTDIR`}async function q(e){let t=await j({resource:`state`,scope:[`state`]});try{let t=await Bt();await e(t),await Yt(t)}finally{await t()}}function Zt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function J(e=n.execPath){if(h(Zt(e)).endsWith(`.exe`))return`quantex-windows-x64.exe`;if(n.platform===`darwin`)return n.arch===`arm64`?`quantex-darwin-arm64`:`quantex-darwin-x64`;if(n.platform===`linux`)return n.arch===`arm64`?`quantex-linux-arm64`:`quantex-linux-x64`}function Qt(e=n.execPath){let t=J(e);if(t)return`${lt}/releases/latest/download/${t}`}function $t(e,t,r=n.env){return e||(r.QUANTEX_UPDATE_CHANNEL===`beta`?`beta`:r.QUANTEX_UPDATE_CHANNEL===`stable`?`stable`:t===`beta`?`beta`:`stable`)}async function en(e){let t=await R(await tn(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function tn(e){if(e===`stable`)return`${lt}/releases/latest/download/manifest.json`;let t=(await nn(e)).assets.find(e=>e.name===`manifest.json`);if(!t?.browser_download_url)throw Error(`No manifest.json asset was found for the ${e} release channel.`);return t.browser_download_url}async function nn(e){let t=an();if(!t)throw Error(`Failed to resolve the GitHub repository slug for Quantex releases.`);let n=await R(`https://api.github.com/repos/${t}/releases?per_page=20`,`self:github-releases`);if(!n)throw Error(`Failed to query GitHub releases.`);let r=n.find(t=>e===`beta`?t.prerelease:!t.prerelease);if(!r)throw Error(`No GitHub release was found for the ${e} channel.`);return r}function rn(e,t=n.execPath){let r=n.platform,i=n.arch===`arm64`?`arm64`:`x64`,a=J(t);return e.assets.find(e=>e.platform===r&&e.arch===i&&(!a||e.name===a))}function an(){return lt.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const on=M,sn=`/node_modules/${on}`;async function cn(e){let t=await dn(),r=n.execPath,i=t.foundPackageJson?Y(t.packageRoot):Y(``,r),a=await un((await Lt()).installSource,i),o=await k(),s=$t(e?.updateChannel,o.selfUpdateChannel);return{canAutoUpdate:ln(a),currentVersion:t.version||`0.27.1`,executablePath:r,installSource:a,packageRoot:t.packageRoot,updateChannel:s}}function ln(e){return e===`binary`||e===`bun`||e===`npm`}async function un(e,t){return t!==`unknown`&&e!==t?(await Rt(t),t):e??t}function Y(e,t=n.execPath){let r=pn(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(sn)?`npm`:r?`source`:mn(t)?`binary`:`unknown`}async function dn(e=import.meta.url){let t=hn(e),n=g(t);for(;;){let e=_(n,`package.json`),t=await fn(e);if(t?.name===on)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.27.1`};let r=g(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:_(g(t),`package.json`),packageRoot:g(t),version:ut}}function X(){return ut}async function fn(e){try{return JSON.parse(await l(e,`utf8`))}catch{return}}function pn(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function mn(e){let t=h(pn(e));return t!==`bun`&&t!==`bun.exe`}function hn(e){try{return re(e)}catch{return n.execPath}}async function gn(e,t,r=n.env,i=n.cwd()){if(e!==`bun`&&e!==`npm`)return;let a=E(r.QTX_SELF_UPDATE_REGISTRY);return a?{isOverride:!0,registry:a,source:`quantex-env`}:t.selfUpdateRegistry?{isOverride:!0,registry:t.selfUpdateRegistry,source:`quantex-config`}:await _n(e,r,i)||{isOverride:!1,registry:He,source:`fallback`}}async function _n(e,t,n){if(e===`bun`){let e=vn(t,[`BUN_CONFIG_REGISTRY`,`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(e)return{isOverride:!1,registry:e,source:`bun-env`};let r=await yn(n,t);if(r)return{isOverride:!1,registry:r,source:`bunfig`}}let r=vn(t,[`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(r)return{isOverride:!1,registry:r,source:`npm-env`};let i=await xn(n,t);if(i)return{isOverride:!1,registry:i,source:`npmrc`}}function vn(e,t){for(let n of t){let t=E(e[n]);if(t)return t}}async function yn(e,t){let n=wn(t),i=t.XDG_CONFIG_HOME,a=Cn(e,`bunfig.toml`),o=[_(n,`.bunfig.toml`),i?_(i,`.bunfig.toml`):void 0];if(a){let e=await bn(a);if(e)return e}for(let e of o){if(!e||!r(e))continue;let t=await bn(e);if(t)return t}}async function bn(e){try{return Tn(await l(e,`utf8`))}catch{return}}async function xn(e,t){let n=wn(t),i=Cn(e,`.npmrc`),a=_(n,`.npmrc`);if(i){let e=await Sn(i);if(e)return e}if(r(a))return Sn(a)}async function Sn(e){try{let t=(await l(e,`utf8`)).split(`
4
4
  `).map(e=>e.trim());for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n||n.startsWith(`#`)||n.startsWith(`;`))continue;let r=n.match(/^registry\s*=\s*(.+)$/);if(!r?.[1])continue;let i=E(r[1]);if(i)return i}}catch{}}function Cn(e,t){let n=e;for(;;){let e=_(n,t);if(r(e))return e;let i=g(n);if(i===n)return;n=i}}function wn(e){return e.HOME||e.USERPROFILE||ee()}function Tn(e){let t=En(e,[/(?:^|\n)\s*install\.registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\.registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}[\s\S]*?\}/]);if(t)return E(t);let n=e.match(/(?:^|\n)\s*\[install\]\s*\n([\s\S]*?)(?=\n\s*\[[^\]]+\]|\s*$)/)?.[1];if(n)return E(En(n,[/(?:^|\n)\s*registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/]))}function En(e,t){for(let n of t){let t=e.match(n)?.[1];if(t)return t}}async function Dn(e){let t=await k();if(e.installSource===`binary`)try{let t=await en(e.updateChannel),n=rn(t,e.executablePath);return n?{binaryAsset:n,targetVersion:t.version}:{resolutionError:{detail:{channel:e.updateChannel},kind:`unsupported`,message:`No binary asset is available for the current platform on the ${e.updateChannel} channel.`}}}catch{return{resolutionError:{kind:`network`,message:`Failed to resolve the ${e.updateChannel} release manifest.`}}}let n=e.updateChannel===`beta`?`beta`:`latest`,r=await H(M,n,{registry:He});if(e.installSource===`bun`||e.installSource===`npm`){let i=await gn(e.installSource,t);return{managedRegistry:i?.registry,managedRegistryIsOverride:i?.isOverride??!1,packageTag:n,targetVersion:await H(M,n,{registry:i?.registry}),upstreamLatestVersion:r,verificationCommand:Nn(e.packageRoot)}}return{packageTag:n,targetVersion:r,upstreamLatestVersion:r}}async function Z(e){let t=e?.facts??await cn({updateChannel:e?.updateChannel}),n=e?.target??await Dn(t),r=n.targetVersion?B(n.targetVersion,t.currentVersion):!1;return{facts:t,status:jn(t,n,r),target:n,updateAvailable:r}}function On(e){return{canAutoUpdate:e.facts.canAutoUpdate,currentVersion:e.facts.currentVersion,executablePath:e.facts.executablePath,installSource:e.facts.installSource,latestVersion:e.target.targetVersion,managedRegistry:e.target.managedRegistry,managedRegistryIsOverride:e.target.managedRegistryIsOverride,packageRoot:e.facts.packageRoot,recommendedUpgradeCommand:e.facts.canAutoUpdate?`quantex upgrade`:void 0,upstreamLatestVersion:e.target.upstreamLatestVersion,updateChannel:e.facts.updateChannel}}async function kn(e,t){if(!t.success||e.facts.installSource!==`bun`&&e.facts.installSource!==`npm`)return t;let n=await Mn(e);if(!n)return{error:{kind:`verify`,message:`Managed self-upgrade finished but Quantex could not verify the installed version afterwards.`},installSource:e.facts.installSource,success:!1};let r=t.newVersion??e.target.targetVersion;return r&&n!==r?{error:{detail:{expectedVersion:r,observedVersion:n},kind:`verify`,message:`Managed self-upgrade installed version ${n}, but expected ${r}.`},installSource:e.facts.installSource,success:!1}:!r&&n===e.facts.currentVersion&&e.target.targetVersion!==void 0?{error:{detail:{observedVersion:n},kind:`verify`,message:`Managed self-upgrade completed without changing the installed Quantex version.`},installSource:e.facts.installSource,success:!1}:{...t,newVersion:n}}function An(e){let t={canAutoUpdate:e.canAutoUpdate,currentVersion:e.currentVersion,executablePath:e.executablePath,installSource:e.installSource,packageRoot:e.packageRoot,updateChannel:e.updateChannel},n={managedRegistry:e.managedRegistry,managedRegistryIsOverride:e.managedRegistryIsOverride,packageTag:e.updateChannel===`beta`?`beta`:`latest`,targetVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion,verificationCommand:Nn(e.packageRoot)},r=e.latestVersion?B(e.latestVersion,e.currentVersion):!1;return{facts:t,status:jn(t,n,r),target:n,updateAvailable:r}}function jn(e,t,n){return e.canAutoUpdate?t.targetVersion&&!n?`up-to-date`:t.targetVersion?`update-available`:`check-unavailable`:`manual-required`}async function Mn(e){if(e.target.verificationCommand){let t=await V(e.facts.executablePath,{command:e.target.verificationCommand});if(t)return t}return V(e.facts.executablePath)}function Nn(e){if(e)return[n.execPath,_(e,`dist`,`cli.mjs`),`--version`]}async function Pn(e,t,r,i,a=Fn(t)){let s;try{s=await fetch(e)}catch(t){return $(`network`,`Failed to download ${e}.`,t)}if(!s.ok)return $(`network`,`Failed to download ${e}: HTTP ${s.status}.`);let l=await c(_(g(t),`.quantex-upgrade-`)),u=_(l,h(t)),p=`${t}.bak`,v=!1;try{let c=ie.from(await s.arrayBuffer()),h=await In(t),g=Hn(c);if(g!==Un(r))return $(`checksum`,`Checksum mismatch for ${e}. Expected ${Un(r)}, got ${g}.`);if(await m(u,c),n.platform===`win32`)return Ln(u,t,p,l,i,a);await o(u,h),await f(p,{force:!0}),await d(t,p),v=!0,await d(u,t);let _=await Vn(t,i);return _.success?(v=!1,await f(p,{force:!0}),{success:!0}):(await Bn(p,t),v=!1,_)}catch(e){if(v){try{await Bn(p,t)}catch{}v=!1}return $(zn(e),`Failed to replace the current Quantex binary.`,e)}finally{n.platform!==`win32`&&await f(l,{recursive:!0,force:!0})}}function Fn(e){if(n.platform!==`win32`)return;let t=v.basename(e).toLowerCase();if(t===`qtx.exe`)return v.join(v.dirname(e),`quantex.exe`);if(t===`quantex.exe`)return v.join(v.dirname(e),`qtx.exe`)}async function In(e){try{return(await p(e)).mode&511}catch{return 493}}function Ln(e,t,r,i,a,o){try{return F([`powershell.exe`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-WindowStyle`,`Hidden`,`-Command`,Rn(e,t,r,i,n.pid,a,o)],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0}).unref(),{success:!0}}catch(e){return $(`locked`,`Failed to schedule Windows binary replacement.`,e)}}function Rn(e,t,n,r,i,a,o){let s=Q(e),c=Q(t),l=Q(n),u=Q(r),d=Q(a??``),f=Q(o??``);return[`$ErrorActionPreference = 'Stop'`,`$pidToWait = ${i}`,`$tempPath = '${s}'`,`$targetPath = '${c}'`,`$backupPath = '${l}'`,`$tempDir = '${u}'`,`$expectedVersion = '${d}'`,`$peerPath = '${f}'`,`while (Get-Process -Id $pidToWait -ErrorAction SilentlyContinue) { Start-Sleep -Milliseconds 200 }`,`$backupReady = $false`,`for ($attempt = 0; $attempt -lt 50; $attempt++) {`,` try {`,` if (Test-Path -LiteralPath $backupPath) { Remove-Item -LiteralPath $backupPath -Force -ErrorAction SilentlyContinue }`,` Move-Item -LiteralPath $targetPath -Destination $backupPath -Force -ErrorAction Stop`,` $backupReady = $true`,` break`,` }`,` catch {`,` Start-Sleep -Milliseconds 200`,` }`,`}`,`if (-not $backupReady) {`,` Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`,` exit 1`,`}`,`try {`,` Move-Item -LiteralPath $tempPath -Destination $targetPath -Force`,`}`,`catch {`,` if (Test-Path -LiteralPath $backupPath) {`,` Move-Item -LiteralPath $backupPath -Destination $targetPath -Force -ErrorAction SilentlyContinue`,` }`,` Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`,` exit 1`,`}`,`if ($expectedVersion -ne '') {`,` $output = & $targetPath --version 2>$null`,` if ($LASTEXITCODE -ne 0 -or ($output -notmatch [regex]::Escape($expectedVersion))) {`,` Remove-Item -LiteralPath $targetPath -Force -ErrorAction SilentlyContinue`,` Move-Item -LiteralPath $backupPath -Destination $targetPath -Force`,` Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`,` exit 1`,` }`,`}`,`if ($peerPath -ne '') {`,` Copy-Item -LiteralPath $targetPath -Destination $peerPath -Force`,`}`,`Remove-Item -LiteralPath $backupPath -Force -ErrorAction SilentlyContinue`,`Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`].join(`; `)}function Q(e){return e.replaceAll(`'`,`''`)}function $(e,t,n){return{error:{detail:n,kind:e,message:t},success:!1}}function zn(e){let t=typeof e==`object`&&e&&`code`in e?String(e.code):``;return t===`EACCES`||t===`EPERM`?`permission`:t===`EBUSY`?`locked`:`unknown`}async function Bn(e,t){await f(t,{force:!0}),await d(e,t)}async function Vn(e,t){if(!t)return{success:!0};try{let{exitCode:n,stdout:r}=await I(F([e,`--version`],{stdio:[`ignore`,`pipe`,`ignore`]}));return n===0?r.includes(t)?{success:!0}:$(`verify`,`The upgraded Quantex binary reported an unexpected version during verification.`):$(`verify`,`The upgraded Quantex binary exited with code ${n} during verification.`)}catch(e){return $(`verify`,`Failed to execute the upgraded Quantex binary for verification.`,e)}}function Hn(t){return e(`sha256`).update(t).digest(`hex`)}function Un(e){return e.trim().toLowerCase()}const Wn={source:`binary`,canHandle:e=>Gn(e)===`binary`,getRecoveryHint:(e,t)=>{let n=t?.error?.detail&&typeof t.error.detail==`object`&&`downloadUrl`in t.error.detail?String(t.error.detail.downloadUrl):Qt(e.executablePath);if(n)return t?.error?.kind===`locked`?`close other qtx processes and retry, or download and replace the binary from ${n}`:t?.error?.kind===`permission`?`check write permission for the current binary path, or download and replace the binary from ${n}`:t?.error?.kind===`network`?`check network access and retry, or download and replace the binary from ${n}`:`download and replace the binary from ${n}`},async upgrade(e){let t=e.target.binaryAsset;if(!t)return{error:e.target.resolutionError??{kind:`unsupported`,message:`No release artifact is available for the current platform and architecture.`},installSource:e.facts.installSource,success:!1};let n=await Pn(t.downloadUrl,e.facts.executablePath,t.checksum,e.target.targetVersion??`latest`,Fn(e.facts.executablePath));return{...!n.success&&n.error?{...n,error:{...n.error,detail:{...typeof n.error.detail==`object`&&n.error.detail?n.error.detail:{},downloadUrl:t.downloadUrl}}}:n,installSource:e.facts.installSource,newVersion:n.success?e.target.targetVersion:void 0}}};function Gn(e){return`facts`in e?e.facts.installSource:e.installSource}async function Kn(e,t,n){try{let r=t?`${e}@${t}`:e,i=E(n);return await tr([`bun`,`add`,`-g`,...i?[`--registry`,i]:[],r],[e])}catch{return!1}}async function qn(e,t=`latest-major`,n=`latest`,r){try{let i=n===`latest`?e:`${e}@${n}`,a=E(r);return await tr([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...a?[`--registry`,a]:[],i],[e])}catch{return!1}}async function Jn(e,t=`latest-major`){if(e.length===0)return!0;try{return await tr([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function Yn(e){try{return await P(N([`bun`,`remove`,`-g`,e]))===0}catch{return!1}}async function Xn(e){try{let{stdout:t}=await I(F([`bun`,`pm`,`-g`,`ls`],{stdio:or()}));if(!t.trim())return{presence:`unknown`};let n=er(t,e);return n?{presence:`present`,version:n}:$n(t,e)?{presence:`present`}:{presence:`absent`}}catch{return{presence:`unknown`}}}async function Zn(e){return(await Xn(e)).presence}async function Qn(e){return(await Xn(e)).version}function $n(e,t){let n=`${t}@`;return e.split(`
5
5
  `).some(e=>e.trim().split(/\s+/).at(-1)?.startsWith(n))}function er(e,t){let n=`${t}@`;for(let t of e.split(`
6
6
  `)){let e=t.trim().split(/\s+/).at(-1);if(!e?.startsWith(n))continue;let r=e.slice(n.length);if(r)return r}}async function tr(e,t){if(await P(N(e))!==0)return!1;let n=await rr(t);return!n&&e[1]===`add`&&await nr(t),n}async function nr(e){for(let t of new Set(e))try{await P(N([`bun`,`remove`,`-g`,t]))}catch{}}async function rr(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await ir();if(n===void 0)return!1;let r=ar(n),i=t.filter(e=>r.has(e));return i.length===0?!0:await P(N([`bun`,`pm`,`-g`,`trust`,...i]))===0}async function ir(){try{let{exitCode:e,stdout:t}=await I(F([`bun`,`pm`,`-g`,`untrusted`],{stdio:or()}));return e===0?t:void 0}catch{return}}function ar(e){let t=new Set;for(let n of e.split(`
@@ -1,3 +1,3 @@
1
- import{a as e,r as t,t as n}from"./color-ChvF_SAo.mjs";const r=[{flags:[`--json`,`--output`,`--non-interactive`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`capabilities`,outputSchemaRef:`#/commands/capabilities`,stability:`stable`,summary:`Return environment and surface capabilities`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`commands`,outputSchemaRef:`#/commands/commands`,stability:`stable`,summary:`Return the stable command catalog`},{flags:[`get`,`set`,`reset`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`config`,outputSchemaRef:`#/commands/config`,stability:`stable`,summary:`Read and modify Quantex configuration`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`doctor`,outputSchemaRef:`#/commands/doctor`,stability:`stable`,summary:`Diagnose the current environment and installed tools`},{flags:[`--install`,`--non-interactive`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--output`],name:`exec`,outputSchemaRef:`#/commands/exec`,stability:`stable`,summary:`Run an agent with explicit install policy`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`ensure`,outputSchemaRef:`#/commands/ensure`,stability:`stable`,summary:`Ensure an agent is installed`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`info`,outputSchemaRef:`#/commands/info`,stability:`stable`,summary:`Show human-friendly agent details`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`inspect`,outputSchemaRef:`#/commands/inspect`,stability:`stable`,summary:`Return structured agent state`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`install`,outputSchemaRef:`#/commands/install`,stability:`stable`,summary:`Install one or more agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`list`,outputSchemaRef:`#/commands/list`,stability:`stable`,summary:`List supported agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`resolve`,outputSchemaRef:`#/commands/resolve`,stability:`stable`,summary:`Resolve an agent executable entrypoint`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`schema`,outputSchemaRef:`#/commands/schema`,stability:`stable`,summary:`Return structured output schemas`},{flags:[`--all`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`update`,outputSchemaRef:`#/commands/update`,stability:`stable`,summary:`Update one or all agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`uninstall`,outputSchemaRef:`#/commands/uninstall`,stability:`stable`,summary:`Uninstall an agent`},{flags:[`--check`,`--channel`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`upgrade`,outputSchemaRef:`#/commands/upgrade`,stability:`stable`,summary:`Upgrade Quantex CLI itself`}];async function i(){return e(t({action:`commands`,data:{commands:r},target:{kind:`system`,name:`commands`}}),a)}function a(e){if(e.data){console.log(n.bold(`
1
+ import{a as e,r as t,t as n}from"./color-BjsL_hvq.mjs";const r=[{flags:[`--json`,`--output`,`--non-interactive`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`capabilities`,outputSchemaRef:`#/commands/capabilities`,stability:`stable`,summary:`Return environment and surface capabilities`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`commands`,outputSchemaRef:`#/commands/commands`,stability:`stable`,summary:`Return the stable command catalog`},{flags:[`get`,`set`,`reset`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`config`,outputSchemaRef:`#/commands/config`,stability:`stable`,summary:`Read and modify Quantex configuration`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`doctor`,outputSchemaRef:`#/commands/doctor`,stability:`stable`,summary:`Diagnose the current environment and installed tools`},{flags:[`--install`,`--non-interactive`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--output`],name:`exec`,outputSchemaRef:`#/commands/exec`,stability:`stable`,summary:`Run an agent with explicit install policy`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`ensure`,outputSchemaRef:`#/commands/ensure`,stability:`stable`,summary:`Ensure an agent is installed`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`info`,outputSchemaRef:`#/commands/info`,stability:`stable`,summary:`Show human-friendly agent details`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`inspect`,outputSchemaRef:`#/commands/inspect`,stability:`stable`,summary:`Return structured agent state`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`install`,outputSchemaRef:`#/commands/install`,stability:`stable`,summary:`Install one or more agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`list`,outputSchemaRef:`#/commands/list`,stability:`stable`,summary:`List supported agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`resolve`,outputSchemaRef:`#/commands/resolve`,stability:`stable`,summary:`Resolve an agent executable entrypoint`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`schema`,outputSchemaRef:`#/commands/schema`,stability:`stable`,summary:`Return structured output schemas`},{flags:[`--all`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`update`,outputSchemaRef:`#/commands/update`,stability:`stable`,summary:`Update one or all agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`uninstall`,outputSchemaRef:`#/commands/uninstall`,stability:`stable`,summary:`Uninstall an agent`},{flags:[`--check`,`--channel`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`upgrade`,outputSchemaRef:`#/commands/upgrade`,stability:`stable`,summary:`Upgrade Quantex CLI itself`}];async function i(){return e(t({action:`commands`,data:{commands:r},target:{kind:`system`,name:`commands`}}),a)}function a(e){if(e.data){console.log(n.bold(`
2
2
  Quantex Commands
3
3
  `));for(let t of e.data.commands){let e=t.flags.length>0?n.dim(` [${t.flags.join(`, `)}]`):``;console.log(` ${n.cyan(t.name)}${e}`),console.log(` ${t.summary}`),console.log(` ${n.dim(t.outputSchemaRef)}`)}console.log()}}export{i as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./commands-XGZQbCkS.mjs";export{e as commandsCommand};
@@ -1,3 +1,3 @@
1
- import{a as e,at as t,it as n,n as r,nt as i,ot as a,r as o,rt as s,t as c,tt as l}from"./color-ChvF_SAo.mjs";async function u(c,u,f){if(!c)return e(o({action:`config`,data:{action:`list`,config:await s()},target:{kind:`config`}}),d);switch(c){case`get`:{if(!u)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify a key`},target:{kind:`config`}}),d);let t=(await s())[u];return e(o({action:`config`,data:{action:`get`,key:u,value:typeof t==`number`||typeof t==`string`?t:void 0},target:{kind:`config`,name:u}}),d)}case`set`:{if(!u||f===void 0)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify both key and value`},target:{kind:`config`}}),d);if(u===`defaultPackageManager`&&!l(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`defaultPackageManager must be bun, npm, or mise`},target:{kind:`config`,name:u}}),d);if(u===`npmBunUpdateStrategy`&&!i(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`npmBunUpdateStrategy must be latest-major or respect-semver`},target:{kind:`config`,name:u}}),d);if(u===`selfUpdateChannel`&&f!==`stable`&&f!==`beta`)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateChannel must be stable or beta`},target:{kind:`config`,name:u}}),d);if(u===`selfUpdateRegistry`&&!a(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateRegistry must be a valid absolute URL`},target:{kind:`config`,name:u}}),d);if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(u)){let t=Number.parseInt(f,10);if(!Number.isInteger(t)||t<=0)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`${u} must be a positive integer`},target:{kind:`config`,name:u}}),d);f=`${t}`}let t={};try{t=await s()}catch{}return t[u]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(u)?Number.parseInt(f,10):u===`selfUpdateRegistry`?a(f):f,await n(t),e(o({action:`config`,data:{action:`set`,key:u,value:t[u]},target:{kind:`config`,name:u}}),d)}case`reset`:return await n(t),e(o({action:`config`,data:{action:`reset`,config:t},target:{kind:`config`}}),d);default:return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,details:{action:c},message:`Unknown action: ${c}`},target:{kind:`config`},warnings:[{code:`AVAILABLE_ACTIONS`,message:`Available actions: get, set, reset`}]}),d)}}function d(e){if(e.error){console.log(c.red(e.error.message));for(let t of e.warnings)console.log(t.message);return}if(e.data)switch(e.data.action){case`list`:console.log(c.bold(`
1
+ import{a as e,at as t,it as n,n as r,nt as i,ot as a,r as o,rt as s,t as c,tt as l}from"./color-BjsL_hvq.mjs";async function u(c,u,f){if(!c)return e(o({action:`config`,data:{action:`list`,config:await s()},target:{kind:`config`}}),d);switch(c){case`get`:{if(!u)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify a key`},target:{kind:`config`}}),d);let t=(await s())[u];return e(o({action:`config`,data:{action:`get`,key:u,value:typeof t==`number`||typeof t==`string`?t:void 0},target:{kind:`config`,name:u}}),d)}case`set`:{if(!u||f===void 0)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify both key and value`},target:{kind:`config`}}),d);if(u===`defaultPackageManager`&&!l(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`defaultPackageManager must be bun, npm, or mise`},target:{kind:`config`,name:u}}),d);if(u===`npmBunUpdateStrategy`&&!i(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`npmBunUpdateStrategy must be latest-major or respect-semver`},target:{kind:`config`,name:u}}),d);if(u===`selfUpdateChannel`&&f!==`stable`&&f!==`beta`)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateChannel must be stable or beta`},target:{kind:`config`,name:u}}),d);if(u===`selfUpdateRegistry`&&!a(f))return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateRegistry must be a valid absolute URL`},target:{kind:`config`,name:u}}),d);if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(u)){let t=Number.parseInt(f,10);if(!Number.isInteger(t)||t<=0)return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`${u} must be a positive integer`},target:{kind:`config`,name:u}}),d);f=`${t}`}let t={};try{t=await s()}catch{}return t[u]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(u)?Number.parseInt(f,10):u===`selfUpdateRegistry`?a(f):f,await n(t),e(o({action:`config`,data:{action:`set`,key:u,value:t[u]},target:{kind:`config`,name:u}}),d)}case`reset`:return await n(t),e(o({action:`config`,data:{action:`reset`,config:t},target:{kind:`config`}}),d);default:return e(r({action:`config`,error:{code:`INVALID_ARGUMENT`,details:{action:c},message:`Unknown action: ${c}`},target:{kind:`config`},warnings:[{code:`AVAILABLE_ACTIONS`,message:`Available actions: get, set, reset`}]}),d)}}function d(e){if(e.error){console.log(c.red(e.error.message));for(let t of e.warnings)console.log(t.message);return}if(e.data)switch(e.data.action){case`list`:console.log(c.bold(`
2
2
  Current Configuration:
3
3
  `)),console.log(JSON.stringify(e.data.config,null,2)),console.log();break;case`get`:console.log(e.data.value===void 0?c.gray(`(not set)`):String(e.data.value));break;case`set`:console.log(c.green(`Set ${e.data.key} = ${e.data.value}`));break;case`reset`:console.log(c.green(`Configuration reset to defaults.`));break}}export{u as configCommand};
@@ -1 +1 @@
1
- import{K as e,q as t}from"./color-ChvF_SAo.mjs";import{toJSONSchema as n,z as r}from"zod";import i from"node:process";const a=[{name:`amp`,displayName:`Amp`,homepage:`https://ampcode.com/`,packages:{npm:`@sourcegraph/amp`},binaryName:`amp`,selfUpdate:{command:[`amp`,`update`]},versionProbe:{command:[`amp`,`version`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`antigravity`,lookupAliases:[`agy`,`antigravity-cli`],displayName:`Antigravity CLI`,homepage:`https://antigravity.google/product/antigravity-cli`,binaryName:`agy`,selfUpdate:{command:[`agy`,`update`]},versionProbe:{command:[`agy`,`--version`]},platforms:{windows:[{command:`irm https://antigravity.google/cli/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://antigravity.google/cli/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://antigravity.google/cli/install.sh | bash`,type:`script`}]}},{name:`auggie`,displayName:`Auggie CLI`,homepage:`https://docs.augmentcode.com/cli/overview`,packages:{npm:`@augmentcode/auggie`},binaryName:`auggie`,selfUpdate:{command:[`auggie`,`upgrade`]},versionProbe:{command:[`auggie`,`--version`]},platforms:{macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`autohand`,lookupAliases:[`autohand-cli`],displayName:`Autohand Code CLI`,homepage:`https://autohand.ai/cli/`,packages:{npm:`autohand-cli`},binaryName:`autohand`,versionProbe:{command:[`autohand`,`--version`]},platforms:{windows:[{command:`iwr -useb https://autohand.ai/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://autohand.ai/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://autohand.ai/install.sh | bash`,type:`script`}]}},{name:`claude`,displayName:`Claude Code`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,selfUpdate:{command:[`claude`,`update`],fallbackCommands:[[`claude`,`upgrade`]]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://claude.ai/install.ps1 | iex`,type:`script`},{packageName:`Anthropic.ClaudeCode`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://claude.ai/install.sh | bash`,type:`script`},{packageName:`claude-code`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://claude.ai/install.sh | bash`,type:`script`},{packageName:`claude-code`,packageTargetKind:`cask`,type:`brew`}]}},{name:`codebuddy`,lookupAliases:[`codebuddy-code`],displayName:`CodeBuddy Code`,homepage:`https://www.codebuddy.cn/docs/cli/installation`,packages:{npm:`@tencent-ai/codebuddy-code`},binaryName:`codebuddy`,selfUpdate:{command:[`codebuddy`,`update`]},versionProbe:{command:[`codebuddy`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://www.codebuddy.cn/cli/install.ps1 | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`,type:`script`},{packageName:`Tencent-CodeBuddy/tap/codebuddy-code`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`,type:`script`},{packageName:`Tencent-CodeBuddy/tap/codebuddy-code`,type:`brew`}]}},{name:`codewhale`,displayName:`CodeWhale`,homepage:`https://github.com/Hmbown/CodeWhale`,packages:{cargo:`codewhale-cli`,npm:`codewhale`},binaryName:`codewhale`,selfUpdate:{command:[`codewhale`,`update`]},versionProbe:{command:[`codewhale`,`--version`]},platforms:{windows:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}],macos:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}],linux:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}]}},{name:`codex`,displayName:`Codex CLI`,homepage:`https://developers.openai.com/codex/cli`,packages:{mise:`npm:@openai/codex`,npm:`@openai/codex`},binaryName:`codex`,selfUpdate:{command:[`codex`,`--upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`},{type:`mise`}],macos:[{type:`bun`},{type:`npm`},{type:`mise`},{packageName:`codex`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{type:`mise`},{packageName:`codex`,type:`brew`}]}},{name:`copilot`,displayName:`GitHub Copilot CLI`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[{packageName:`GitHub.Copilot`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://gh.io/copilot-install | bash`,type:`script`},{packageName:`copilot-cli`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://gh.io/copilot-install | bash`,type:`script`},{packageName:`copilot-cli`,type:`brew`}]}},{name:`crush`,displayName:`Crush`,homepage:`https://github.com/charmbracelet/crush`,packages:{npm:`@charmland/crush`},binaryName:`crush`,selfUpdate:{command:[`crush`,`update`]},versionProbe:{command:[`crush`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet.crush`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet/tap/crush`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet/tap/crush`,type:`brew`}]}},{name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,selfUpdate:{command:[`agent`,`update`]},versionProbe:{command:[`agent`,`--version`]},platforms:{windows:[{command:`irm 'https://cursor.com/install?win32=true' | iex`,type:`script`}],macos:[{command:`curl https://cursor.com/install -fsS | bash`,type:`script`}],linux:[{command:`curl https://cursor.com/install -fsS | bash`,type:`script`}]}},{name:`deepcode`,displayName:`Deep Code CLI`,homepage:`https://github.com/lessweb/deepcode-cli`,packages:{npm:`@vegamo/deepcode-cli`},binaryName:`deepcode`,versionProbe:{command:[`deepcode`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{type:`npm`}],linux:[{type:`npm`}]}},{name:`devin`,displayName:`Devin for Terminal`,homepage:`https://cli.devin.ai/`,binaryName:`devin`,selfUpdate:{command:[`devin`,`update`]},versionProbe:{command:[`devin`,`version`]},platforms:{windows:[{command:`irm https://static.devin.ai/cli/setup.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://cli.devin.ai/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://cli.devin.ai/install.sh | bash`,type:`script`}]}},{name:`droid`,displayName:`Droid`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,selfUpdate:{command:[`droid`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://app.factory.ai/cli/windows | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://app.factory.ai/cli | sh`,type:`script`},{packageName:`droid`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://app.factory.ai/cli | sh`,type:`script`},{packageName:`droid`,packageTargetKind:`cask`,type:`brew`}]}},{name:`forgecode`,lookupAliases:[`forge`],displayName:`ForgeCode`,homepage:`https://forgecode.dev`,packages:{npm:`forgecode`},binaryName:`forge`,selfUpdate:{command:[`forge`,`update`]},versionProbe:{command:[`forge`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://forgecode.dev/cli | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://forgecode.dev/cli | sh`,type:`script`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://forgecode.dev/cli | sh`,type:`script`}]}},{name:`gemini`,displayName:`Gemini CLI`,homepage:`https://google-gemini.github.io/gemini-cli/docs/`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{packageName:`gemini-cli`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{packageName:`gemini-cli`,type:`brew`}]}},{name:`genie`,displayName:`Genie`,homepage:`https://jsr.io/@nicorio/genie`,packages:{deno:`jsr:@nicorio/genie`},binaryName:`genie`,platforms:{windows:[{packageInstallArgs:[`-A`],type:`deno`}],macos:[{packageInstallArgs:[`-A`],type:`deno`}],linux:[{packageInstallArgs:[`-A`],type:`deno`}]}},{name:`goose`,displayName:`Goose`,homepage:`https://github.com/aaif-goose/goose`,binaryName:`goose`,selfUpdate:{command:[`goose`,`update`]},versionProbe:{command:[`goose`,`--version`]},platforms:{windows:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{command:`Invoke-WebRequest -Uri "https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1" -OutFile "download_cli.ps1"; ./download_cli.ps1`,type:`script`}],macos:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{packageName:`block-goose-cli`,type:`brew`}],linux:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{packageName:`block-goose-cli`,type:`brew`}]}},{name:`hermes`,lookupAliases:[`hermes-agent`],displayName:`Hermes Agent`,homepage:`https://github.com/NousResearch/hermes-agent`,binaryName:`hermes`,selfUpdate:{command:[`hermes`,`update`]},versionProbe:{command:[`hermes`,`--version`]},platforms:{windows:[{command:`iex (irm https://hermes-agent.nousresearch.com/install.ps1)`,type:`script`}],macos:[{command:`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`,type:`script`}]}},{name:`jcode`,displayName:`JCode`,homepage:`https://github.com/1jehuang/jcode`,binaryName:`jcode`,versionProbe:{command:[`jcode`,`--version`]},platforms:{windows:[{command:`irm https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.ps1 | iex`,type:`script`}],macos:[{packageName:`1jehuang/jcode/jcode`,type:`brew`},{command:`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`,type:`script`}]}},{name:`junie`,displayName:`Junie CLI`,homepage:`https://junie.jetbrains.com/docs/junie-cli.html`,packages:{npm:`@jetbrains/junie`},binaryName:`junie`,versionProbe:{command:[`junie`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`iex (irm 'https://junie.jetbrains.com/install.ps1')`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://junie.jetbrains.com/install.sh | bash`,type:`script`},{packageName:`jetbrains-junie/junie/junie`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://junie.jetbrains.com/install.sh | bash`,type:`script`},{packageName:`jetbrains-junie/junie/junie`,type:`brew`}]}},{name:`kilo`,displayName:`Kilo CLI`,homepage:`https://kilo.ai/docs/cli`,packages:{npm:`@kilocode/cli`},binaryName:`kilo`,selfUpdate:{command:[`kilo`,`upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`kimi`,lookupAliases:[`kimi-code`,`kimi-cli`],displayName:`Kimi Code`,homepage:`https://moonshotai.github.io/kimi-code/`,binaryName:`kimi`,packages:{npm:`@moonshot-ai/kimi-code`},selfUpdate:{command:[`kimi`,`upgrade`]},versionProbe:{command:[`kimi`,`--version`]},platforms:{windows:[{command:`irm https://code.kimi.com/kimi-code/install.ps1 | iex`,type:`script`},{type:`npm`}],macos:[{command:`curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash`,type:`script`},{type:`npm`}],linux:[{command:`curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash`,type:`script`},{type:`npm`}]}},{name:`kiro`,lookupAliases:[`kiro-cli`],displayName:`Kiro CLI`,homepage:`https://kiro.dev/cli/`,binaryName:`kiro-cli`,versionProbe:{command:[`kiro-cli`,`--version`]},platforms:{windows:[{command:`irm 'https://cli.kiro.dev/install.ps1' | iex`,type:`script`}],macos:[{command:`curl -fsSL https://cli.kiro.dev/install | bash`,type:`script`}],linux:[{command:`curl -fsSL https://cli.kiro.dev/install | bash`,type:`script`}]}},{name:`mimo`,lookupAliases:[`mimocode`,`mimo-code`],displayName:`MiMoCode`,homepage:`https://github.com/XiaomiMiMo/MiMo-Code`,packages:{npm:`@mimo-ai/cli`},binaryName:`mimo`,versionProbe:{command:[`mimo`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{command:`curl -fsSL https://mimo.xiaomi.com/install | bash`,type:`script`},{type:`npm`}],linux:[{command:`curl -fsSL https://mimo.xiaomi.com/install | bash`,type:`script`},{type:`npm`}]}},{name:`omp`,displayName:`oh-my-pi (OMP)`,homepage:`https://github.com/can1357/oh-my-pi`,packages:{npm:`@oh-my-pi/pi-coding-agent`},binaryName:`omp`,versionProbe:{command:[`omp`,`--version`]},platforms:{windows:[{type:`bun`},{command:`irm https://omp.sh/install.ps1 | iex`,type:`script`}],macos:[{type:`bun`},{command:`curl -fsSL https://omp.sh/install | sh`,type:`script`}],linux:[{type:`bun`},{command:`curl -fsSL https://omp.sh/install | sh`,type:`script`}]}},{name:`opencode`,displayName:`OpenCode`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,selfUpdate:{command:[`opencode`,`upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://opencode.ai/install | bash`,type:`script`},{packageName:`anomalyco/tap/opencode`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://opencode.ai/install | bash`,type:`script`},{packageName:`anomalyco/tap/opencode`,type:`brew`}]}},{name:`openhands`,displayName:`OpenHands CLI`,homepage:`https://docs.openhands.dev/openhands/usage/cli/installation`,binaryName:`openhands`,packages:{uv:`openhands`},selfUpdate:{command:[`uv`,`tool`,`upgrade`,`openhands`,`--python`,`3.12`]},versionProbe:{command:[`openhands`,`--version`]},platforms:{macos:[{packageInstallArgs:[`--python`,`3.12`],type:`uv`},{command:`curl -fsSL https://install.openhands.dev/install.sh | sh`,type:`script`}],linux:[{packageInstallArgs:[`--python`,`3.12`],type:`uv`},{command:`curl -fsSL https://install.openhands.dev/install.sh | sh`,type:`script`}]}},{name:`pi`,displayName:`Pi`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,selfUpdate:{command:[`pi`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`qoder`,lookupAliases:[`qodercli`],displayName:`Qoder CLI`,homepage:`https://docs.qoder.com/cli/quick-start`,packages:{npm:`@qoder-ai/qodercli`},binaryName:`qodercli`,selfUpdate:{command:[`qodercli`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://qoder.com/install | bash`,type:`script`},{packageName:`qoderai/qoder/qodercli`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://qoder.com/install | bash`,type:`script`},{packageName:`qoderai/qoder/qodercli`,packageTargetKind:`cask`,type:`brew`}]}},{name:`qwen`,displayName:`Qwen Code`,homepage:`https://qwenlm.github.io/qwen-code-docs/`,packages:{npm:`@qwen-code/qwen-code`},binaryName:`qwen`,platforms:{windows:[{command:`curl -fsSL -o %TEMP%\\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\\install-qwen.bat`,type:`script`},{type:`bun`},{type:`npm`}],macos:[{command:`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`,type:`script`},{type:`bun`},{type:`npm`},{packageName:`qwen-code`,type:`brew`}],linux:[{command:`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`,type:`script`},{type:`bun`},{type:`npm`},{packageName:`qwen-code`,type:`brew`}]}},{name:`reasonix`,lookupAliases:[`deepseek-reasonix`],displayName:`Reasonix`,homepage:`https://github.com/esengine/DeepSeek-Reasonix`,packages:{npm:`reasonix`},binaryName:`reasonix`,selfUpdate:{command:[`reasonix`,`update`]},versionProbe:{command:[`reasonix`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{type:`npm`}],linux:[{type:`npm`}]}},{name:`vibe`,lookupAliases:[`mistral-vibe`],displayName:`Mistral Vibe`,homepage:`https://docs.mistral.ai/mistral-vibe/terminal/install`,binaryName:`vibe`,packages:{pip:`mistral-vibe`,uv:`mistral-vibe`},versionProbe:{command:[`vibe`,`--version`]},platforms:{windows:[{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}],macos:[{command:`curl -LsSf https://mistral.ai/vibe/install.sh | bash`,type:`script`},{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}],linux:[{command:`curl -LsSf https://mistral.ai/vibe/install.sh | bash`,type:`script`},{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}]}},{name:`vtcode`,displayName:`VTCode`,homepage:`https://github.com/vinhnx/vtcode`,packages:{cargo:`vtcode`},binaryName:`vtcode`,selfUpdate:{command:[`vtcode`,`update`]},versionProbe:{command:[`vtcode`,`--version`]},platforms:{windows:[{type:`cargo`},{command:`irm https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`,type:`script`},{type:`cargo`},{packageName:`vtcode`,type:`brew`}],linux:[{command:`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`,type:`script`},{type:`cargo`},{packageName:`vtcode`,type:`brew`}]}}],o=r.string().min(1),s=r.array(o).min(1);r.enum([`windows`,`macos`,`linux`]);const c=r.enum([`bun`,`npm`,`brew`,`cargo`,`deno`,`mise`,`pip`,`uv`,`winget`]),l=r.enum([`package`,`cask`,`id`]),u={binaryName:o.optional(),packageInstallArgs:r.array(o).min(1).optional(),packageName:o.optional(),packageTargetKind:l.optional()},d=r.object({...u,type:c}).strict(),f=r.object({...u,command:o,type:r.literal(`script`)}).strict(),p=r.object({...u,command:o,type:r.literal(`binary`)}).strict(),m=r.discriminatedUnion(`type`,[d,f,p]),ee=r.object({cargo:o.optional(),deno:o.optional(),mise:o.optional(),npm:o.optional(),pip:o.optional(),uv:o.optional()}).strict().refine(e=>Object.values(e).some(Boolean),{message:`packages must include at least one package identifier`}),te=r.object({command:s,fallbackCommands:r.array(s).min(1).optional(),versionAfter:r.enum([`same-process`,`respawn`]).optional()}).strict(),ne=r.object({command:s.optional()}).strict().refine(e=>e.command!==void 0,{message:`versionProbe must include a serializable command`}),re=r.object({linux:r.array(m).min(1).optional(),macos:r.array(m).min(1).optional(),windows:r.array(m).min(1).optional()}).strict().refine(e=>Object.values(e).some(Boolean),{message:`platforms must include at least one supported platform`}),h=r.object({binaryName:o,displayName:o,homepage:r.url().startsWith(`https://`),lookupAliases:r.array(o).min(1).optional(),name:o.regex(/^[a-z0-9][a-z0-9-]*$/),packages:ee.optional(),platforms:re,selfUpdate:te.optional(),versionProbe:ne.optional()}).strict(),g=r.array(h).min(1),_={...n(g),$id:`https://github.com/Drswith/quantex-cli/schemas/agent-catalog.schema.json`,title:`Quantex Supported Agent Catalog`},v={},y=g.parse(a).map(C),b=new Map(y.map(e=>[e.name,e]));function x(){return y}function S(e){let t=b.get(e);if(!t)throw Error(`Unknown catalog agent: ${e}`);return t}function C(e){let t=v[e.name],n=w(e.versionProbe,t);return{...e,versionProbe:n}}function w(e,t){if(!(!e&&!t?.versionProbeParser))return{...e,...t?.versionProbeParser?{parser:t.versionProbeParser}:{}}}S(`amp`),S(`antigravity`),S(`auggie`);const T=S(`autohand`),E=S(`claude`),D=S(`codebuddy`),O=S(`codewhale`),k=S(`codex`),A=S(`copilot`);S(`crush`);const j=S(`cursor`),M=S(`deepcode`),N=S(`devin`),P=S(`droid`);S(`forgecode`);const F=S(`gemini`),I=S(`genie`);S(`goose`);const L=S(`hermes`),R=S(`jcode`),ie=S(`junie`),z=S(`kilo`);S(`kimi`),S(`kiro`);const B=S(`mimo`),V=S(`omp`),H=S(`opencode`),U=S(`openhands`),W=S(`pi`),G=S(`qoder`);S(`qwen`);const K=S(`reasonix`),q=S(`vibe`),J=S(`vtcode`),Y=x();function ae(){return Y}function X(e){let t=Y.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1));if(t)return t;let n=Z(e);return Y.find(e=>Z(e.displayName)===n)}function oe(e){return X(e)}function Z(e){return e.trim().toLowerCase()}function se(){switch(i.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function Q(n){try{let{exitCode:r}=await e(t([n,`--version`]));return r===0}catch{return!1}}async function ce(){return Q(`bun`)}async function le(){return Q(`npm`)}async function ue(){return Q(`brew`)}async function de(){return Q(`deno`)}async function fe(){return Q(`cargo`)}async function pe(){return Q(`mise`)}async function $(){return Q(`winget`)}async function me(){return await Q(`pip`)||await Q(`pip3`)?!0:ge()}async function he(){return Q(`uv`)}async function ge(){try{let{exitCode:n}=await e(t([`python`,`-m`,`pip`,`--version`]));if(n===0)return!0}catch{}try{let{exitCode:n}=await e(t([`python3`,`-m`,`pip`,`--version`]));return n===0}catch{return!1}}async function _e(n){try{let{exitCode:r}=await e(t([i.platform===`win32`?`where`:`which`,n]));return r===0}catch{return!1}}export{z as A,S as B,N as C,L as D,I as E,W as F,h as H,G as I,K as L,V as M,H as N,R as O,U as P,q as R,M as S,F as T,_ as U,x as V,g as W,D as _,fe as a,A as b,le as c,$ as d,X as f,E as g,T as h,ce as i,B as j,ie as k,me as l,ae as m,_e as n,de as o,oe as p,ue as r,pe as s,se as t,he as u,O as v,P as w,j as x,k as y,J as z};
1
+ import{K as e,q as t}from"./color-BjsL_hvq.mjs";import{toJSONSchema as n,z as r}from"zod";import i from"node:process";const a=[{name:`amp`,displayName:`Amp`,homepage:`https://ampcode.com/`,packages:{npm:`@sourcegraph/amp`},binaryName:`amp`,selfUpdate:{command:[`amp`,`update`]},versionProbe:{command:[`amp`,`version`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`antigravity`,lookupAliases:[`agy`,`antigravity-cli`],displayName:`Antigravity CLI`,homepage:`https://antigravity.google/product/antigravity-cli`,binaryName:`agy`,selfUpdate:{command:[`agy`,`update`]},versionProbe:{command:[`agy`,`--version`]},platforms:{windows:[{command:`irm https://antigravity.google/cli/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://antigravity.google/cli/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://antigravity.google/cli/install.sh | bash`,type:`script`}]}},{name:`auggie`,displayName:`Auggie CLI`,homepage:`https://docs.augmentcode.com/cli/overview`,packages:{npm:`@augmentcode/auggie`},binaryName:`auggie`,selfUpdate:{command:[`auggie`,`upgrade`]},versionProbe:{command:[`auggie`,`--version`]},platforms:{macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`autohand`,lookupAliases:[`autohand-cli`],displayName:`Autohand Code CLI`,homepage:`https://autohand.ai/cli/`,packages:{npm:`autohand-cli`},binaryName:`autohand`,versionProbe:{command:[`autohand`,`--version`]},platforms:{windows:[{command:`iwr -useb https://autohand.ai/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://autohand.ai/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://autohand.ai/install.sh | bash`,type:`script`}]}},{name:`claude`,displayName:`Claude Code`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,selfUpdate:{command:[`claude`,`update`],fallbackCommands:[[`claude`,`upgrade`]]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://claude.ai/install.ps1 | iex`,type:`script`},{packageName:`Anthropic.ClaudeCode`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://claude.ai/install.sh | bash`,type:`script`},{packageName:`claude-code`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://claude.ai/install.sh | bash`,type:`script`},{packageName:`claude-code`,packageTargetKind:`cask`,type:`brew`}]}},{name:`codebuddy`,lookupAliases:[`codebuddy-code`],displayName:`CodeBuddy Code`,homepage:`https://www.codebuddy.cn/docs/cli/installation`,packages:{npm:`@tencent-ai/codebuddy-code`},binaryName:`codebuddy`,selfUpdate:{command:[`codebuddy`,`update`]},versionProbe:{command:[`codebuddy`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://www.codebuddy.cn/cli/install.ps1 | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`,type:`script`},{packageName:`Tencent-CodeBuddy/tap/codebuddy-code`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`,type:`script`},{packageName:`Tencent-CodeBuddy/tap/codebuddy-code`,type:`brew`}]}},{name:`codewhale`,displayName:`CodeWhale`,homepage:`https://github.com/Hmbown/CodeWhale`,packages:{cargo:`codewhale-cli`,npm:`codewhale`},binaryName:`codewhale`,selfUpdate:{command:[`codewhale`,`update`]},versionProbe:{command:[`codewhale`,`--version`]},platforms:{windows:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}],macos:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}],linux:[{type:`npm`},{packageInstallArgs:[`--locked`],type:`cargo`}]}},{name:`codex`,displayName:`Codex CLI`,homepage:`https://developers.openai.com/codex/cli`,packages:{mise:`npm:@openai/codex`,npm:`@openai/codex`},binaryName:`codex`,selfUpdate:{command:[`codex`,`--upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`},{type:`mise`}],macos:[{type:`bun`},{type:`npm`},{type:`mise`},{packageName:`codex`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{type:`mise`},{packageName:`codex`,type:`brew`}]}},{name:`copilot`,displayName:`GitHub Copilot CLI`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[{packageName:`GitHub.Copilot`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://gh.io/copilot-install | bash`,type:`script`},{packageName:`copilot-cli`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://gh.io/copilot-install | bash`,type:`script`},{packageName:`copilot-cli`,type:`brew`}]}},{name:`crush`,displayName:`Crush`,homepage:`https://github.com/charmbracelet/crush`,packages:{npm:`@charmland/crush`},binaryName:`crush`,selfUpdate:{command:[`crush`,`update`]},versionProbe:{command:[`crush`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet.crush`,packageTargetKind:`id`,type:`winget`}],macos:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet/tap/crush`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{packageName:`charmbracelet/tap/crush`,type:`brew`}]}},{name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,selfUpdate:{command:[`agent`,`update`]},versionProbe:{command:[`agent`,`--version`]},platforms:{windows:[{command:`irm 'https://cursor.com/install?win32=true' | iex`,type:`script`}],macos:[{command:`curl https://cursor.com/install -fsS | bash`,type:`script`}],linux:[{command:`curl https://cursor.com/install -fsS | bash`,type:`script`}]}},{name:`deepcode`,displayName:`Deep Code CLI`,homepage:`https://github.com/lessweb/deepcode-cli`,packages:{npm:`@vegamo/deepcode-cli`},binaryName:`deepcode`,versionProbe:{command:[`deepcode`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{type:`npm`}],linux:[{type:`npm`}]}},{name:`devin`,displayName:`Devin for Terminal`,homepage:`https://cli.devin.ai/`,binaryName:`devin`,selfUpdate:{command:[`devin`,`update`]},versionProbe:{command:[`devin`,`version`]},platforms:{windows:[{command:`irm https://static.devin.ai/cli/setup.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://cli.devin.ai/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://cli.devin.ai/install.sh | bash`,type:`script`}]}},{name:`droid`,displayName:`Droid`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,selfUpdate:{command:[`droid`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://app.factory.ai/cli/windows | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://app.factory.ai/cli | sh`,type:`script`},{packageName:`droid`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://app.factory.ai/cli | sh`,type:`script`},{packageName:`droid`,packageTargetKind:`cask`,type:`brew`}]}},{name:`forgecode`,lookupAliases:[`forge`],displayName:`ForgeCode`,homepage:`https://forgecode.dev`,packages:{npm:`forgecode`},binaryName:`forge`,selfUpdate:{command:[`forge`,`update`]},versionProbe:{command:[`forge`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`irm https://forgecode.dev/cli | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://forgecode.dev/cli | sh`,type:`script`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://forgecode.dev/cli | sh`,type:`script`}]}},{name:`gemini`,displayName:`Gemini CLI`,homepage:`https://google-gemini.github.io/gemini-cli/docs/`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{packageName:`gemini-cli`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{packageName:`gemini-cli`,type:`brew`}]}},{name:`genie`,displayName:`Genie`,homepage:`https://jsr.io/@nicorio/genie`,packages:{deno:`jsr:@nicorio/genie`},binaryName:`genie`,platforms:{windows:[{packageInstallArgs:[`-A`],type:`deno`}],macos:[{packageInstallArgs:[`-A`],type:`deno`}],linux:[{packageInstallArgs:[`-A`],type:`deno`}]}},{name:`goose`,displayName:`Goose`,homepage:`https://github.com/aaif-goose/goose`,binaryName:`goose`,selfUpdate:{command:[`goose`,`update`]},versionProbe:{command:[`goose`,`--version`]},platforms:{windows:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{command:`Invoke-WebRequest -Uri "https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1" -OutFile "download_cli.ps1"; ./download_cli.ps1`,type:`script`}],macos:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{packageName:`block-goose-cli`,type:`brew`}],linux:[{command:`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`,type:`script`},{packageName:`block-goose-cli`,type:`brew`}]}},{name:`hermes`,lookupAliases:[`hermes-agent`],displayName:`Hermes Agent`,homepage:`https://github.com/NousResearch/hermes-agent`,binaryName:`hermes`,selfUpdate:{command:[`hermes`,`update`]},versionProbe:{command:[`hermes`,`--version`]},platforms:{windows:[{command:`iex (irm https://hermes-agent.nousresearch.com/install.ps1)`,type:`script`}],macos:[{command:`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`,type:`script`}]}},{name:`jcode`,displayName:`JCode`,homepage:`https://github.com/1jehuang/jcode`,binaryName:`jcode`,versionProbe:{command:[`jcode`,`--version`]},platforms:{windows:[{command:`irm https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.ps1 | iex`,type:`script`}],macos:[{packageName:`1jehuang/jcode/jcode`,type:`brew`},{command:`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`,type:`script`}],linux:[{command:`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`,type:`script`}]}},{name:`junie`,displayName:`Junie CLI`,homepage:`https://junie.jetbrains.com/docs/junie-cli.html`,packages:{npm:`@jetbrains/junie`},binaryName:`junie`,versionProbe:{command:[`junie`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`iex (irm 'https://junie.jetbrains.com/install.ps1')`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://junie.jetbrains.com/install.sh | bash`,type:`script`},{packageName:`jetbrains-junie/junie/junie`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://junie.jetbrains.com/install.sh | bash`,type:`script`},{packageName:`jetbrains-junie/junie/junie`,type:`brew`}]}},{name:`kilo`,displayName:`Kilo CLI`,homepage:`https://kilo.ai/docs/cli`,packages:{npm:`@kilocode/cli`},binaryName:`kilo`,selfUpdate:{command:[`kilo`,`upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`kimi`,lookupAliases:[`kimi-code`,`kimi-cli`],displayName:`Kimi Code`,homepage:`https://moonshotai.github.io/kimi-code/`,binaryName:`kimi`,packages:{npm:`@moonshot-ai/kimi-code`},selfUpdate:{command:[`kimi`,`upgrade`]},versionProbe:{command:[`kimi`,`--version`]},platforms:{windows:[{command:`irm https://code.kimi.com/kimi-code/install.ps1 | iex`,type:`script`},{type:`npm`}],macos:[{command:`curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash`,type:`script`},{type:`npm`}],linux:[{command:`curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash`,type:`script`},{type:`npm`}]}},{name:`kiro`,lookupAliases:[`kiro-cli`],displayName:`Kiro CLI`,homepage:`https://kiro.dev/cli/`,binaryName:`kiro-cli`,versionProbe:{command:[`kiro-cli`,`--version`]},platforms:{windows:[{command:`irm 'https://cli.kiro.dev/install.ps1' | iex`,type:`script`}],macos:[{command:`curl -fsSL https://cli.kiro.dev/install | bash`,type:`script`}],linux:[{command:`curl -fsSL https://cli.kiro.dev/install | bash`,type:`script`}]}},{name:`mimo`,lookupAliases:[`mimocode`,`mimo-code`],displayName:`MiMoCode`,homepage:`https://github.com/XiaomiMiMo/MiMo-Code`,packages:{npm:`@mimo-ai/cli`},binaryName:`mimo`,versionProbe:{command:[`mimo`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{command:`curl -fsSL https://mimo.xiaomi.com/install | bash`,type:`script`},{type:`npm`}],linux:[{command:`curl -fsSL https://mimo.xiaomi.com/install | bash`,type:`script`},{type:`npm`}]}},{name:`omp`,displayName:`oh-my-pi (OMP)`,homepage:`https://github.com/can1357/oh-my-pi`,packages:{npm:`@oh-my-pi/pi-coding-agent`},binaryName:`omp`,versionProbe:{command:[`omp`,`--version`]},platforms:{windows:[{type:`bun`},{command:`irm https://omp.sh/install.ps1 | iex`,type:`script`}],macos:[{type:`bun`},{command:`curl -fsSL https://omp.sh/install | sh`,type:`script`}],linux:[{type:`bun`},{command:`curl -fsSL https://omp.sh/install | sh`,type:`script`}]}},{name:`openclaw`,displayName:`OpenClaw`,homepage:`https://github.com/openclaw/openclaw`,packages:{npm:`openclaw`},binaryName:`openclaw`,selfUpdate:{command:[`openclaw`,`update`]},versionProbe:{command:[`openclaw`,`--version`]},platforms:{windows:[{type:`bun`},{type:`npm`},{command:`iwr -useb https://openclaw.ai/install.ps1 | iex`,type:`script`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://openclaw.ai/install.sh | bash`,type:`script`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://openclaw.ai/install.sh | bash`,type:`script`}]}},{name:`opencode`,displayName:`OpenCode`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,selfUpdate:{command:[`opencode`,`upgrade`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://opencode.ai/install | bash`,type:`script`},{packageName:`anomalyco/tap/opencode`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://opencode.ai/install | bash`,type:`script`},{packageName:`anomalyco/tap/opencode`,type:`brew`}]}},{name:`openhands`,displayName:`OpenHands CLI`,homepage:`https://docs.openhands.dev/openhands/usage/cli/installation`,binaryName:`openhands`,packages:{uv:`openhands`},selfUpdate:{command:[`uv`,`tool`,`upgrade`,`openhands`,`--python`,`3.12`]},versionProbe:{command:[`openhands`,`--version`]},platforms:{macos:[{packageInstallArgs:[`--python`,`3.12`],type:`uv`},{command:`curl -fsSL https://install.openhands.dev/install.sh | sh`,type:`script`}],linux:[{packageInstallArgs:[`--python`,`3.12`],type:`uv`},{command:`curl -fsSL https://install.openhands.dev/install.sh | sh`,type:`script`}]}},{name:`pi`,displayName:`Pi`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,selfUpdate:{command:[`pi`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`}],linux:[{type:`bun`},{type:`npm`}]}},{name:`qoder`,lookupAliases:[`qodercli`],displayName:`Qoder CLI`,homepage:`https://docs.qoder.com/cli/quick-start`,packages:{npm:`@qoder-ai/qodercli`},binaryName:`qodercli`,selfUpdate:{command:[`qodercli`,`update`]},platforms:{windows:[{type:`bun`},{type:`npm`}],macos:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://qoder.com/install | bash`,type:`script`},{packageName:`qoderai/qoder/qodercli`,packageTargetKind:`cask`,type:`brew`}],linux:[{type:`bun`},{type:`npm`},{command:`curl -fsSL https://qoder.com/install | bash`,type:`script`},{packageName:`qoderai/qoder/qodercli`,packageTargetKind:`cask`,type:`brew`}]}},{name:`qwen`,displayName:`Qwen Code`,homepage:`https://qwenlm.github.io/qwen-code-docs/`,packages:{npm:`@qwen-code/qwen-code`},binaryName:`qwen`,platforms:{windows:[{command:`curl -fsSL -o %TEMP%\\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\\install-qwen.bat`,type:`script`},{type:`bun`},{type:`npm`}],macos:[{command:`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`,type:`script`},{type:`bun`},{type:`npm`},{packageName:`qwen-code`,type:`brew`}],linux:[{command:`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`,type:`script`},{type:`bun`},{type:`npm`},{packageName:`qwen-code`,type:`brew`}]}},{name:`reasonix`,lookupAliases:[`deepseek-reasonix`],displayName:`Reasonix`,homepage:`https://github.com/esengine/DeepSeek-Reasonix`,packages:{npm:`reasonix`},binaryName:`reasonix`,selfUpdate:{command:[`reasonix`,`update`]},versionProbe:{command:[`reasonix`,`--version`]},platforms:{windows:[{type:`npm`}],macos:[{type:`npm`}],linux:[{type:`npm`}]}},{name:`vibe`,lookupAliases:[`mistral-vibe`],displayName:`Mistral Vibe`,homepage:`https://docs.mistral.ai/mistral-vibe/terminal/install`,binaryName:`vibe`,packages:{pip:`mistral-vibe`,uv:`mistral-vibe`},versionProbe:{command:[`vibe`,`--version`]},platforms:{windows:[{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}],macos:[{command:`curl -LsSf https://mistral.ai/vibe/install.sh | bash`,type:`script`},{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}],linux:[{command:`curl -LsSf https://mistral.ai/vibe/install.sh | bash`,type:`script`},{packageName:`mistral-vibe`,type:`uv`},{packageName:`mistral-vibe`,type:`pip`}]}},{name:`vtcode`,displayName:`VTCode`,homepage:`https://github.com/vinhnx/vtcode`,packages:{cargo:`vtcode`},binaryName:`vtcode`,selfUpdate:{command:[`vtcode`,`update`]},versionProbe:{command:[`vtcode`,`--version`]},platforms:{windows:[{type:`cargo`},{command:`irm https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.ps1 | iex`,type:`script`}],macos:[{command:`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`,type:`script`},{type:`cargo`},{packageName:`vtcode`,type:`brew`}],linux:[{command:`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`,type:`script`},{type:`cargo`},{packageName:`vtcode`,type:`brew`}]}}],o=r.string().min(1),s=r.array(o).min(1);r.enum([`windows`,`macos`,`linux`]);const ee=r.enum([`bun`,`npm`,`brew`,`cargo`,`deno`,`mise`,`pip`,`uv`,`winget`]),c=r.enum([`package`,`cask`,`id`]),l={binaryName:o.optional(),packageInstallArgs:r.array(o).min(1).optional(),packageName:o.optional(),packageTargetKind:c.optional()},u=r.object({...l,type:ee}).strict(),d=r.object({...l,command:o,type:r.literal(`script`)}).strict(),f=r.object({...l,command:o,type:r.literal(`binary`)}).strict(),p=r.discriminatedUnion(`type`,[u,d,f]),te=r.object({cargo:o.optional(),deno:o.optional(),mise:o.optional(),npm:o.optional(),pip:o.optional(),uv:o.optional()}).strict().refine(e=>Object.values(e).some(Boolean),{message:`packages must include at least one package identifier`}),ne=r.object({command:s,fallbackCommands:r.array(s).min(1).optional(),versionAfter:r.enum([`same-process`,`respawn`]).optional()}).strict(),re=r.object({command:s.optional()}).strict().refine(e=>e.command!==void 0,{message:`versionProbe must include a serializable command`}),ie=r.object({linux:r.array(p).min(1).optional(),macos:r.array(p).min(1).optional(),windows:r.array(p).min(1).optional()}).strict().refine(e=>Object.values(e).some(Boolean),{message:`platforms must include at least one supported platform`}),m=r.object({binaryName:o,displayName:o,homepage:r.url().startsWith(`https://`),lookupAliases:r.array(o).min(1).optional(),name:o.regex(/^[a-z0-9][a-z0-9-]*$/),packages:te.optional(),platforms:ie,selfUpdate:ne.optional(),versionProbe:re.optional()}).strict(),h=r.array(m).min(1),g={...n(h),$id:`https://github.com/Drswith/quantex-cli/schemas/agent-catalog.schema.json`,title:`Quantex Supported Agent Catalog`},_={},v=h.parse(a).map(S),y=new Map(v.map(e=>[e.name,e]));function b(){return v}function x(e){let t=y.get(e);if(!t)throw Error(`Unknown catalog agent: ${e}`);return t}function S(e){let t=_[e.name],n=C(e.versionProbe,t);return{...e,versionProbe:n}}function C(e,t){if(!(!e&&!t?.versionProbeParser))return{...e,...t?.versionProbeParser?{parser:t.versionProbeParser}:{}}}x(`amp`),x(`antigravity`),x(`auggie`);const w=x(`autohand`),T=x(`claude`),E=x(`codebuddy`),D=x(`codewhale`),O=x(`codex`),k=x(`copilot`);x(`crush`);const A=x(`cursor`),j=x(`deepcode`),M=x(`devin`),N=x(`droid`);x(`forgecode`);const P=x(`gemini`),F=x(`genie`);x(`goose`);const I=x(`hermes`),L=x(`jcode`),ae=x(`junie`),R=x(`kilo`);x(`kimi`),x(`kiro`);const z=x(`mimo`),B=x(`omp`),V=x(`openclaw`),H=x(`opencode`),U=x(`openhands`),W=x(`pi`),G=x(`qoder`);x(`qwen`);const K=x(`reasonix`),q=x(`vibe`),J=x(`vtcode`),Y=b();function oe(){return Y}function X(e){let t=Y.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1));if(t)return t;let n=Z(e);return Y.find(e=>Z(e.displayName)===n)}function se(e){return X(e)}function Z(e){return e.trim().toLowerCase()}function ce(){switch(i.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function Q(n){try{let{exitCode:r}=await e(t([n,`--version`]));return r===0}catch{return!1}}async function le(){return Q(`bun`)}async function ue(){return Q(`npm`)}async function de(){return Q(`brew`)}async function fe(){return Q(`deno`)}async function pe(){return Q(`cargo`)}async function $(){return Q(`mise`)}async function me(){return Q(`winget`)}async function he(){return await Q(`pip`)||await Q(`pip3`)?!0:_e()}async function ge(){return Q(`uv`)}async function _e(){try{let{exitCode:n}=await e(t([`python`,`-m`,`pip`,`--version`]));if(n===0)return!0}catch{}try{let{exitCode:n}=await e(t([`python3`,`-m`,`pip`,`--version`]));return n===0}catch{return!1}}async function ve(n){try{let{exitCode:r}=await e(t([i.platform===`win32`?`where`:`which`,n]));return r===0}catch{return!1}}export{R as A,J as B,M as C,I as D,F as E,U as F,h as G,b as H,W as I,G as L,B as M,V as N,L as O,H as P,K as R,j as S,P as T,m as U,x as V,g as W,E as _,pe as a,k as b,ue as c,me as d,X as f,T as g,w as h,le as i,z as j,ae as k,he as l,oe as m,ve as n,fe as o,se as p,de as r,$ as s,ce as t,ge as u,D as v,N as w,A as x,O as y,q as z};
@@ -1,3 +1,3 @@
1
- import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{G as n,X as r,a as i,r as a,s as o,t as s,u as c}from"./color-ChvF_SAo.mjs";import{a as l,c as u,d,i as f,l as p,o as m,r as h,s as g,u as _}from"./detect-C9Mnu6HP.mjs";import{t as v}from"./agents-CMkLsOPA.mjs";async function y(){let r=await f(),s=await u(),y=await h(),S=await l(),C=await m(),w=await g(),T=await p(),E=await _(),D=await d(),O=await o(),k=O.latestVersion?n(O.latestVersion,O.currentVersion):!1,A=await v(),j=A.filter(e=>e.inPath).map(e=>({displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,lifecycle:e.lifecycle,outdated:!!(e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion),sourceLabel:e.sourceLabel})),M=[],N=`docs/runbooks/quantex-troubleshooting.md`,P=`docs/runbooks/release-and-self-upgrade-debugging.md`;if(!r&&!s&&!y&&!S&&!C&&!w&&!T&&!E&&!D&&M.push({blocking:!0,category:`installers`,code:`NO_MANAGED_INSTALLER`,docsRef:N,message:`No managed installer found. Install bun, npm, brew, cargo, deno, mise, pip, uv, or winget before relying on managed lifecycle operations.`,severity:`warning`,subject:{kind:`system`},suggestedAction:`restore-managed-installer`,suggestedCommands:[]}),(O.installSource===`bun`&&!r||O.installSource===`npm`&&!s)&&M.push({blocking:!0,category:`self`,code:`SELF_INSTALLER_MISSING`,docsRef:P,message:`Quantex CLI is tracked as a ${O.installSource} install, but ${O.installSource} is not available in PATH. Reinstall that package manager or reinstall Quantex from a supported source.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`restore-self-installer`,suggestedCommands:x(O.installSource,O.updateChannel)}),O.canAutoUpdate||M.push({blocking:!1,category:`self`,code:`SELF_AUTO_UPDATE_UNAVAILABLE`,docsRef:P,message:`Quantex CLI cannot auto-update from install source "${O.installSource}". Reinstall via bun, npm, or the standalone binary if you want \`quantex upgrade\` support.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`reinstall-self-with-auto-update-source`,suggestedCommands:[]}),k&&O.recommendedUpgradeCommand){let e=c(O);M.push({blocking:!1,category:`self`,code:`SELF_UPDATE_AVAILABLE`,docsRef:P,message:e?`Quantex CLI ${O.currentVersion} is behind ${O.latestVersion}. Run ${O.recommendedUpgradeCommand} or follow: ${e}`:`Quantex CLI ${O.currentVersion} is behind ${O.latestVersion}. Run ${O.recommendedUpgradeCommand}.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`run-self-upgrade`,suggestedCommands:[O.recommendedUpgradeCommand]})}for(let n of A.filter(e=>e.inPath)){if(n.installedState||M.push({blocking:!1,category:`agent`,code:`AGENT_UNTRACKED_IN_PATH`,docsRef:N,message:`${n.agent.displayName} is available in PATH but not tracked as a managed Quantex install. Use \`quantex inspect ${n.agent.name} --json\` to confirm the source, then reinstall through Quantex if you want managed lifecycle operations.`,severity:`warning`,subject:{kind:`agent`,name:n.agent.name},suggestedAction:`inspect-agent-install-source`,suggestedCommands:[`quantex inspect ${n.agent.name} --json`,`quantex install ${n.agent.name}`]}),!(n.installedVersion&&n.latestVersion&&n.installedVersion!==n.latestVersion)||n.lifecycle===`managed`)continue;let r=t(n.agent,n.agent.selfUpdate?`self-update`:`manual-hint`)??e(n.agent);M.push({blocking:!1,category:`agent`,code:`AGENT_MANUAL_UPDATE_REQUIRED`,docsRef:N,message:`${n.agent.displayName} ${n.installedVersion} is behind ${n.latestVersion}, but the current source is ${n.sourceLabel}. ${r}`,severity:`warning`,subject:{kind:`agent`,name:n.agent.name},suggestedAction:n.agent.selfUpdate?`run-agent-self-update`:`follow-manual-agent-update`,suggestedCommands:n.agent.selfUpdate?[n.agent.selfUpdate.command.join(` `)]:[]})}return i(a({action:`doctor`,data:{agents:j,issues:M,installers:{brew:y,bun:r,cargo:S,deno:C,mise:w,npm:s,pip:T,uv:E,winget:D},self:{canAutoUpdate:O.canAutoUpdate,currentVersion:O.currentVersion,installSource:O.installSource,latestVersion:O.latestVersion,outdated:!!k,recoveryHint:k?c(O):void 0}},target:{kind:`system`,name:`doctor`}}),b)}function b(e){if(e.data){if(console.log(s.bold(`
1
+ import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{G as n,X as r,a as i,r as a,s as o,t as s,u as c}from"./color-BjsL_hvq.mjs";import{a as l,c as u,d,i as f,l as p,o as m,r as h,s as g,u as _}from"./detect-C-llI1gs.mjs";import{t as v}from"./agents-RFc5BDHs.mjs";async function y(){let r=await f(),s=await u(),y=await h(),S=await l(),C=await m(),w=await g(),T=await p(),E=await _(),D=await d(),O=await o(),k=O.latestVersion?n(O.latestVersion,O.currentVersion):!1,A=await v(),j=A.filter(e=>e.inPath).map(e=>({displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,lifecycle:e.lifecycle,outdated:!!(e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion),sourceLabel:e.sourceLabel})),M=[],N=`docs/runbooks/quantex-troubleshooting.md`,P=`docs/runbooks/release-and-self-upgrade-debugging.md`;if(!r&&!s&&!y&&!S&&!C&&!w&&!T&&!E&&!D&&M.push({blocking:!0,category:`installers`,code:`NO_MANAGED_INSTALLER`,docsRef:N,message:`No managed installer found. Install bun, npm, brew, cargo, deno, mise, pip, uv, or winget before relying on managed lifecycle operations.`,severity:`warning`,subject:{kind:`system`},suggestedAction:`restore-managed-installer`,suggestedCommands:[]}),(O.installSource===`bun`&&!r||O.installSource===`npm`&&!s)&&M.push({blocking:!0,category:`self`,code:`SELF_INSTALLER_MISSING`,docsRef:P,message:`Quantex CLI is tracked as a ${O.installSource} install, but ${O.installSource} is not available in PATH. Reinstall that package manager or reinstall Quantex from a supported source.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`restore-self-installer`,suggestedCommands:x(O.installSource,O.updateChannel)}),O.canAutoUpdate||M.push({blocking:!1,category:`self`,code:`SELF_AUTO_UPDATE_UNAVAILABLE`,docsRef:P,message:`Quantex CLI cannot auto-update from install source "${O.installSource}". Reinstall via bun, npm, or the standalone binary if you want \`quantex upgrade\` support.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`reinstall-self-with-auto-update-source`,suggestedCommands:[]}),k&&O.recommendedUpgradeCommand){let e=c(O);M.push({blocking:!1,category:`self`,code:`SELF_UPDATE_AVAILABLE`,docsRef:P,message:e?`Quantex CLI ${O.currentVersion} is behind ${O.latestVersion}. Run ${O.recommendedUpgradeCommand} or follow: ${e}`:`Quantex CLI ${O.currentVersion} is behind ${O.latestVersion}. Run ${O.recommendedUpgradeCommand}.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`run-self-upgrade`,suggestedCommands:[O.recommendedUpgradeCommand]})}for(let n of A.filter(e=>e.inPath)){if(n.installedState||M.push({blocking:!1,category:`agent`,code:`AGENT_UNTRACKED_IN_PATH`,docsRef:N,message:`${n.agent.displayName} is available in PATH but not tracked as a managed Quantex install. Use \`quantex inspect ${n.agent.name} --json\` to confirm the source, then reinstall through Quantex if you want managed lifecycle operations.`,severity:`warning`,subject:{kind:`agent`,name:n.agent.name},suggestedAction:`inspect-agent-install-source`,suggestedCommands:[`quantex inspect ${n.agent.name} --json`,`quantex install ${n.agent.name}`]}),!(n.installedVersion&&n.latestVersion&&n.installedVersion!==n.latestVersion)||n.lifecycle===`managed`)continue;let r=t(n.agent,n.agent.selfUpdate?`self-update`:`manual-hint`)??e(n.agent);M.push({blocking:!1,category:`agent`,code:`AGENT_MANUAL_UPDATE_REQUIRED`,docsRef:N,message:`${n.agent.displayName} ${n.installedVersion} is behind ${n.latestVersion}, but the current source is ${n.sourceLabel}. ${r}`,severity:`warning`,subject:{kind:`agent`,name:n.agent.name},suggestedAction:n.agent.selfUpdate?`run-agent-self-update`:`follow-manual-agent-update`,suggestedCommands:n.agent.selfUpdate?[n.agent.selfUpdate.command.join(` `)]:[]})}return i(a({action:`doctor`,data:{agents:j,issues:M,installers:{brew:y,bun:r,cargo:S,deno:C,mise:w,npm:s,pip:T,uv:E,winget:D},self:{canAutoUpdate:O.canAutoUpdate,currentVersion:O.currentVersion,installSource:O.installSource,latestVersion:O.latestVersion,outdated:!!k,recoveryHint:k?c(O):void 0}},target:{kind:`system`,name:`doctor`}}),b)}function b(e){if(e.data){if(console.log(s.bold(`
2
2
  Quantex CLI Environment Check
3
3
  `)),console.log(s.bold(`Managed Installers:`)),console.log(` Bun: ${e.data.installers.bun?s.green(`available`):s.red(`not found`)}`),console.log(` npm: ${e.data.installers.npm?s.green(`available`):s.red(`not found`)}`),console.log(` brew: ${e.data.installers.brew?s.green(`available`):s.red(`not found`)}`),console.log(` cargo: ${e.data.installers.cargo?s.green(`available`):s.red(`not found`)}`),console.log(` deno: ${e.data.installers.deno?s.green(`available`):s.red(`not found`)}`),console.log(` mise: ${e.data.installers.mise?s.green(`available`):s.red(`not found`)}`),console.log(` pip: ${e.data.installers.pip?s.green(`available`):s.red(`not found`)}`),console.log(` uv: ${e.data.installers.uv?s.green(`available`):s.red(`not found`)}`),console.log(` winget:${e.data.installers.winget?s.green(`available`):s.red(`not found`)}`),console.log(`\n${s.bold(`Quantex CLI:`)}`),console.log(` Version: ${e.data.self.currentVersion}`),console.log(` Source: ${e.data.self.installSource}`),console.log(` Auto-update: ${e.data.self.canAutoUpdate?s.green(`supported`):s.yellow(`unsupported`)}`),e.data.self.latestVersion&&console.log(` Latest: ${e.data.self.latestVersion}${e.data.self.outdated?s.yellow(` (update available)`):``}`),e.data.self.recoveryHint&&console.log(` Recovery: ${e.data.self.recoveryHint}`),console.log(`\n${s.bold(`Installed Agents:`)}`),e.data.agents.length===0)console.log(s.dim(` No agents installed`));else for(let t of e.data.agents)console.log(` ${t.displayName}: ${t.installedVersion??`unknown`} [${t.lifecycle}; ${t.sourceLabel}]${t.outdated?s.yellow(` (update available: ${t.latestVersion})`):``}`);if(console.log(`\n${s.bold(`Issues:`)}`),e.data.issues.length===0)console.log(s.green(` No issues found.`));else for(let t of e.data.issues)console.log(s.yellow(` - ${t.message}`)),t.suggestedCommands.length>0&&console.log(s.dim(` Next: ${t.suggestedCommands.join(` | `)}`));console.log()}}function x(e,t){let n=t===`beta`?`beta`:`latest`;return e===`bun`?[`bun add -g ${r}@${n}`]:e===`npm`?[`npm install -g ${r}@${n}`]:[]}export{y as doctorCommand};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ensure-PcmmwgM_.mjs";export{e as ensureCommand};
@@ -1 +1 @@
1
- import{St as e,Z as t,a as n,i as r,n as i,r as a,t as o}from"./color-ChvF_SAo.mjs";import{c as s,r as c,s as l}from"./agents-CMkLsOPA.mjs";import{t as u}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-B5Ah0_tJ.mjs";async function h(o){let d=await c(o);if(!d)return n(i({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),g);let{agent:f,inspection:m}=d;if(m.inPath){if(m.installedState)return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]}),g);let o=e(m.methods,m.resolvedBinaryPath??m.binaryPath);if(o){if(p())return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]}),g);r({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});try{let e=await s(f,o);return n(e?a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}):i({action:`ensure`,error:{code:`CANCELLED`,message:`Ensure was cancelled before tracking could complete.`},target:{kind:`agent`,name:f.name}}),g)}catch(e){if(t(e))return n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:f.name})}),g);throw e}}return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]}),g)}if(p())return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]}),g);r({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});let h;try{h=await l(f)}catch(e){if(t(e))return n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:f.name})}),g);throw e}return h.success?n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}),g):n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}}),g)}function g(e){if(e.error){m(o.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(o.green(t.message));continue}if(t.code===`DRY_RUN`){d(o.cyan(t.message));continue}d(o.yellow(t.message))}return}if(e.data.changed){f(o.cyan(`Installing ${e.data.agent.displayName}...`)),f(o.green(`${e.data.agent.displayName} is now installed.`));return}f(o.green(`${e.data.agent.displayName} is already installed.`))}}export{h as t};
1
+ import{St as e,Z as t,a as n,i as r,n as i,r as a,t as o}from"./color-BjsL_hvq.mjs";import{c as s,r as c,s as l}from"./agents-RFc5BDHs.mjs";import{t as u}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-W4VzwJV2.mjs";async function h(o){let d=await c(o);if(!d)return n(i({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),g);let{agent:f,inspection:m}=d;if(m.inPath){if(m.installedState)return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]}),g);let o=e(m.methods,m.resolvedBinaryPath??m.binaryPath);if(o){if(p())return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]}),g);r({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});try{let e=await s(f,o);return n(e?a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}):i({action:`ensure`,error:{code:`CANCELLED`,message:`Ensure was cancelled before tracking could complete.`},target:{kind:`agent`,name:f.name}}),g)}catch(e){if(t(e))return n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:f.name})}),g);throw e}}return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]}),g)}if(p())return n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]}),g);r({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});let h;try{h=await l(f)}catch(e){if(t(e))return n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:f.name})}),g);throw e}return h.success?n(a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}),g):n(i({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}}),g)}function g(e){if(e.error){m(o.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(o.green(t.message));continue}if(t.code===`DRY_RUN`){d(o.cyan(t.message));continue}d(o.yellow(t.message))}return}if(e.data.changed){f(o.cyan(`Installing ${e.data.agent.displayName}...`)),f(o.green(`${e.data.agent.displayName} is now installed.`));return}f(o.green(`${e.data.agent.displayName} is already installed.`))}}export{h as t};
package/dist/index.d.mts CHANGED
@@ -73,6 +73,7 @@ declare const junie: AgentDefinition;
73
73
  declare const kilo: AgentDefinition;
74
74
  declare const mimo: AgentDefinition;
75
75
  declare const omp: AgentDefinition;
76
+ declare const openclaw: AgentDefinition;
76
77
  declare const opencode: AgentDefinition;
77
78
  declare const openhands: AgentDefinition;
78
79
  declare const pi: AgentDefinition;
@@ -1255,4 +1256,4 @@ declare function getLatestVersion(packageName: string, distTag?: string, options
1255
1256
  }): Promise<string | undefined>;
1256
1257
  declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
1257
1258
  //#endregion
1258
- export { type AgentCatalogData, type AgentCatalogEntry, type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type AgentSelfUpdate, type AgentUpdateContext, type AgentUpdateProvider, type AgentUpdateStrategy, type AgentVersionProbe, type BinaryInstallMethod, type CliContext, type CliContextOptions, type CliErrorCode, type CommandError, type CommandMeta, type CommandResult, type CommandTarget, type CommandWarning, type ExecCommandOptions, type ExecInstallPolicy, type HumanRenderer, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type OutputMode, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ReleaseArtifactTarget, type ReleaseChannel, type ReleaseManifest, type ReleaseManifestAsset, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfState, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, agentCatalogEntrySchema, agentCatalogJsonSchema, agentCatalogSchema, agentUpdateProviders, autohand, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canResolveAgentUpdate, canUninstallInstallType, canUpdateInstallType, capabilitiesCommand, claude, codebuddy, codewhale, codex, commandsCommand, copilot, createErrorResult, createReleaseManifest, createSuccessResult, createUpdatePlan, cursor, deepcode, detectSelfInstallSource, devin, droid, emitCommandResult, ensureCommand, execCommand, formatChecksums, gemini, genie, getAgentByLookupName, getAgentByNameOrAlias, getAgentUpdateFailureHint, getAgentUpdateStrategy, getAllAgents, getBinaryPath, getBinaryReleaseAssetName, getBinaryReleaseDownloadUrl, getCatalogAgent, getCatalogAgents, getCliContext, getConfigDir, getConfigFilePath, getExitCodeForError, getExitCodeForResult, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getManualAgentUpdateMessage, getManualSelfUpgradeCommand, getOrderedInstallMethods, getPlatform, getSchemaCatalog, getSelfState, getSelfUpgradeRecoveryHint, getSelfUpgradeRecoveryHintForInspection, getSelfVersion, getSingleAgentUpdateStatus, getStateFilePath, hermes, inspectAgent, inspectAllAgents, inspectCommand, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isDenoAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, jcode, junie, kilo, loadConfig, loadState, mimo, normalizeRepositoryUrl, omp, opencode, openhands, parseBinaryTarget, parseChecksums, pi, planAgentUpdates, qoder, reasonix, removeInstalledAgentState, resetCliContext, resolveAgent, resolveAgentInspection, resolveAgentUpdateProvider, resolveCliContext, resolveCommand, resolveReleaseChannel, saveConfig, saveState, schemaCommand, setCliContext, setInstalledAgentState, setSelfInstallSource, setSelfUpdateNoticeState, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf, validateReleaseManifest, vibe, vtcode };
1259
+ export { type AgentCatalogData, type AgentCatalogEntry, type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type AgentSelfUpdate, type AgentUpdateContext, type AgentUpdateProvider, type AgentUpdateStrategy, type AgentVersionProbe, type BinaryInstallMethod, type CliContext, type CliContextOptions, type CliErrorCode, type CommandError, type CommandMeta, type CommandResult, type CommandTarget, type CommandWarning, type ExecCommandOptions, type ExecInstallPolicy, type HumanRenderer, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type OutputMode, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ReleaseArtifactTarget, type ReleaseChannel, type ReleaseManifest, type ReleaseManifestAsset, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfState, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, agentCatalogEntrySchema, agentCatalogJsonSchema, agentCatalogSchema, agentUpdateProviders, autohand, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canResolveAgentUpdate, canUninstallInstallType, canUpdateInstallType, capabilitiesCommand, claude, codebuddy, codewhale, codex, commandsCommand, copilot, createErrorResult, createReleaseManifest, createSuccessResult, createUpdatePlan, cursor, deepcode, detectSelfInstallSource, devin, droid, emitCommandResult, ensureCommand, execCommand, formatChecksums, gemini, genie, getAgentByLookupName, getAgentByNameOrAlias, getAgentUpdateFailureHint, getAgentUpdateStrategy, getAllAgents, getBinaryPath, getBinaryReleaseAssetName, getBinaryReleaseDownloadUrl, getCatalogAgent, getCatalogAgents, getCliContext, getConfigDir, getConfigFilePath, getExitCodeForError, getExitCodeForResult, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getManualAgentUpdateMessage, getManualSelfUpgradeCommand, getOrderedInstallMethods, getPlatform, getSchemaCatalog, getSelfState, getSelfUpgradeRecoveryHint, getSelfUpgradeRecoveryHintForInspection, getSelfVersion, getSingleAgentUpdateStatus, getStateFilePath, hermes, inspectAgent, inspectAllAgents, inspectCommand, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isDenoAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, jcode, junie, kilo, loadConfig, loadState, mimo, normalizeRepositoryUrl, omp, openclaw, opencode, openhands, parseBinaryTarget, parseChecksums, pi, planAgentUpdates, qoder, reasonix, removeInstalledAgentState, resetCliContext, resolveAgent, resolveAgentInspection, resolveAgentUpdateProvider, resolveCliContext, resolveCommand, resolveReleaseChannel, saveConfig, saveState, schemaCommand, setCliContext, setInstalledAgentState, setSelfInstallSource, setSelfUpdateNoticeState, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf, validateReleaseManifest, vibe, vtcode };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{$ as n,At as r,D as i,Dt as a,E as ee,Et as te,F as ne,H as re,I as ie,J as o,L as s,M as c,N as l,O as u,Ot as d,P as f,R as p,T as m,Tt as h,U as g,V as _,Y as v,a as y,c as b,dt as x,et as S,ft as C,gt as w,ht as T,it as E,j as D,k as O,kt as k,l as A,lt as j,mt as M,n as N,o as P,pt as F,r as I,rt as L,s as R,u as z,ut as B,z as V}from"./color-ChvF_SAo.mjs";import{A as H,B as U,C as W,D as G,E as K,F as q,H as J,I as Y,L as ae,M as oe,N as se,O as ce,P as le,R as ue,S as de,T as fe,U as pe,V as me,W as he,_ as ge,b as _e,c as ve,f as ye,g as be,h as xe,i as Se,j as Ce,k as we,m as Te,n as Ee,o as De,p as Oe,t as ke,v as Ae,w as je,x as Me,y as Ne,z as Pe}from"./detect-C9Mnu6HP.mjs";import{t as Fe}from"./capabilities-qsoTR0q_.mjs";import{t as Ie}from"./commands-Bc5FD_Iq.mjs";import{a as Le,d as Re,f as ze,i as Be,l as Ve,n as He,o as Ue,r as We,s as Ge,t as Ke,u as qe}from"./agents-CMkLsOPA.mjs";import{t as Je}from"./ensure-DDXjblHQ.mjs";import{t as Ye}from"./inspect-C1i137bS.mjs";import{t as Xe}from"./resolve-Cgwj-fj5.mjs";import{n as Ze,t as X}from"./schema-Hlu23n9-.mjs";import{n as Qe,t as $e}from"./errors-BzXIrX6h.mjs";import{a as et,i as tt,n as nt,t as rt}from"./update-CZwVKNs1.mjs";const it=[`quantex-darwin-arm64`,`quantex-darwin-x64`,`quantex-linux-arm64`,`quantex-linux-x64`,`quantex-windows-x64.exe`];function at(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
2
- `)}\n`}function ot(e){let t=new Map;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let[r,i]=e.split(/\s+/,2),a=i?.replace(/^\*/,``);r&&a&&t.set(a,r)}return t}function Z(e){let t=e.match(/^quantex-(darwin|linux|windows)-(arm64|x64)(?:\.exe)?$/);if(t)return{arch:t[2]===`arm64`?`arm64`:`x64`,platform:t[1]===`windows`?`win32`:t[1]===`darwin`?`darwin`:`linux`}}function Q(e){return e?e.startsWith(`git+`)?e.slice(4).replace(/\.git$/,``):e.startsWith(`git@github.com:`)?e.replace(`git@github.com:`,`https://github.com/`).replace(/\.git$/,``):e.replace(/\.git$/,``):`https://github.com/Drswith/quantex-cli`}function $(e){return e.includes(`beta`)?`beta`:`stable`}function st(e){let t=Q(e.repositoryUrl),n=$(e.version),r=e.files.map(n=>{let r=Z(n.name);if(!r)return;let i=e.checksums.get(n.name);if(!i)throw Error(`Missing checksum entry for ${n.name}.`);return{arch:r.arch,checksum:i,downloadUrl:`${t}/releases/download/v${e.version}/${n.name}`,name:n.name,platform:r.platform,size:n.size}}).filter(e=>e!==void 0).sort((e,t)=>e.name.localeCompare(t.name));if(r.length===0)throw Error(`No release binaries were found when creating manifest.json.`);return{assets:r,channel:n,version:e.version}}function ct(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);let n=new Set(e.assets.map(e=>e.name));for(let e of it)if(!n.has(e))throw Error(`manifest.json is missing required release asset: ${e}.`);for(let n of e.assets){let e=t.get(n.name);if(!e)throw Error(`manifest.json references ${n.name}, but it is missing from SHA256SUMS.txt.`);if(n.checksum!==e)throw Error(`manifest.json checksum mismatch for ${n.name}.`);if(!Z(n.name))throw Error(`manifest.json contains an invalid binary asset name: ${n.name}.`)}}async function lt(e,t){try{let n=await v(o([e,...t]));return{success:n===0,exitCode:n}}catch{return{success:!1,exitCode:1}}}export{J as agentCatalogEntrySchema,pe as agentCatalogJsonSchema,he as agentCatalogSchema,F as agentUpdateProviders,xe as autohand,m as canAutoUpdateSelf,h as canLookupLatestVersionForInstallType,M as canResolveAgentUpdate,te as canUninstallInstallType,a as canUpdateInstallType,Fe as capabilitiesCommand,be as claude,ge as codebuddy,Ae as codewhale,Ne as codex,Ie as commandsCommand,_e as copilot,N as createErrorResult,st as createReleaseManifest,I as createSuccessResult,tt as createUpdatePlan,Me as cursor,de as deepcode,ee as detectSelfInstallSource,W as devin,je as droid,y as emitCommandResult,Je as ensureCommand,lt as execCommand,at as formatChecksums,fe as gemini,K as genie,ye as getAgentByLookupName,Oe as getAgentByNameOrAlias,t as getAgentUpdateFailureHint,T as getAgentUpdateStrategy,Te as getAllAgents,_ as getBinaryPath,u as getBinaryReleaseAssetName,O as getBinaryReleaseDownloadUrl,U as getCatalogAgent,me as getCatalogAgents,j as getCliContext,n as getConfigDir,S as getConfigFilePath,$e as getExitCodeForError,Qe as getExitCodeForResult,d as getInstallLifecycle,D as getInstalledAgentState,re as getInstalledVersion,k as getInstallerCapabilities,g as getLatestVersion,ze as getManagedInstaller,e as getManualAgentUpdateMessage,P as getManualSelfUpgradeCommand,Ue as getOrderedInstallMethods,ke as getPlatform,X as getSchemaCatalog,c as getSelfState,A as getSelfUpgradeRecoveryHint,z as getSelfUpgradeRecoveryHintForInspection,i as getSelfVersion,rt as getSingleAgentUpdateStatus,l as getStateFilePath,G as hermes,Be as inspectAgent,Le as inspectAllAgents,Ye as inspectCommand,Ke as inspectRegisteredAgents,R as inspectSelf,Ge as installAgent,Ee as isBinaryInPath,Se as isBunAvailable,De as isDenoAvailable,et as isInspectionUpdateAvailable,r as isManagedInstallType,ve as isNpmAvailable,ce as jcode,we as junie,H as kilo,L as loadConfig,f as loadState,Ce as mimo,Q as normalizeRepositoryUrl,oe as omp,se as opencode,le as openhands,Z as parseBinaryTarget,ot as parseChecksums,q as pi,nt as planAgentUpdates,Y as qoder,ae as reasonix,ne as removeInstalledAgentState,B as resetCliContext,He as resolveAgent,We as resolveAgentInspection,w as resolveAgentUpdateProvider,x as resolveCliContext,Xe as resolveCommand,$ as resolveReleaseChannel,E as saveConfig,ie as saveState,Ze as schemaCommand,C as setCliContext,s as setInstalledAgentState,p as setSelfInstallSource,V as setSelfUpdateNoticeState,Ve as uninstallAgent,qe as updateAgent,Re as updateAgentsByType,b as upgradeSelf,ct as validateReleaseManifest,ue as vibe,Pe as vtcode};
1
+ import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{$ as n,At as r,D as i,Dt as a,E as ee,Et as te,F as ne,H as re,I as ie,J as o,L as s,M as c,N as l,O as u,Ot as d,P as f,R as p,T as m,Tt as h,U as g,V as _,Y as v,a as y,c as b,dt as x,et as S,ft as C,gt as w,ht as T,it as E,j as D,k as O,kt as k,l as A,lt as j,mt as M,n as N,o as P,pt as F,r as I,rt as L,s as R,u as z,ut as B,z as V}from"./color-BjsL_hvq.mjs";import{A as H,B as U,C as W,D as G,E as K,F as q,G as J,H as Y,I as ae,L as oe,M as se,N as ce,O as le,P as ue,R as de,S as fe,T as pe,U as me,V as he,W as ge,_ as _e,b as ve,c as ye,f as be,g as xe,h as Se,i as Ce,j as we,k as Te,m as Ee,n as De,o as Oe,p as ke,t as Ae,v as je,w as Me,x as Ne,y as Pe,z as Fe}from"./detect-C-llI1gs.mjs";import{t as Ie}from"./capabilities-5--AYhRe.mjs";import{t as Le}from"./commands-XGZQbCkS.mjs";import{a as Re,d as ze,f as Be,i as Ve,l as He,n as Ue,o as We,r as Ge,s as Ke,t as qe,u as Je}from"./agents-RFc5BDHs.mjs";import{t as Ye}from"./ensure-PcmmwgM_.mjs";import{t as Xe}from"./inspect-Blp-Ypr2.mjs";import{t as Ze}from"./resolve-BtGd-SR3.mjs";import{n as X,t as Qe}from"./schema-Dlq9AKfh.mjs";import{n as $e,t as et}from"./errors-BzXIrX6h.mjs";import{a as tt,i as nt,n as rt,t as it}from"./update-DTQR_h0V.mjs";const at=[`quantex-darwin-arm64`,`quantex-darwin-x64`,`quantex-linux-arm64`,`quantex-linux-x64`,`quantex-windows-x64.exe`];function ot(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
2
+ `)}\n`}function st(e){let t=new Map;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let[r,i]=e.split(/\s+/,2),a=i?.replace(/^\*/,``);r&&a&&t.set(a,r)}return t}function Z(e){let t=e.match(/^quantex-(darwin|linux|windows)-(arm64|x64)(?:\.exe)?$/);if(t)return{arch:t[2]===`arm64`?`arm64`:`x64`,platform:t[1]===`windows`?`win32`:t[1]===`darwin`?`darwin`:`linux`}}function Q(e){return e?e.startsWith(`git+`)?e.slice(4).replace(/\.git$/,``):e.startsWith(`git@github.com:`)?e.replace(`git@github.com:`,`https://github.com/`).replace(/\.git$/,``):e.replace(/\.git$/,``):`https://github.com/Drswith/quantex-cli`}function $(e){return e.includes(`beta`)?`beta`:`stable`}function ct(e){let t=Q(e.repositoryUrl),n=$(e.version),r=e.files.map(n=>{let r=Z(n.name);if(!r)return;let i=e.checksums.get(n.name);if(!i)throw Error(`Missing checksum entry for ${n.name}.`);return{arch:r.arch,checksum:i,downloadUrl:`${t}/releases/download/v${e.version}/${n.name}`,name:n.name,platform:r.platform,size:n.size}}).filter(e=>e!==void 0).sort((e,t)=>e.name.localeCompare(t.name));if(r.length===0)throw Error(`No release binaries were found when creating manifest.json.`);return{assets:r,channel:n,version:e.version}}function lt(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);let n=new Set(e.assets.map(e=>e.name));for(let e of at)if(!n.has(e))throw Error(`manifest.json is missing required release asset: ${e}.`);for(let n of e.assets){let e=t.get(n.name);if(!e)throw Error(`manifest.json references ${n.name}, but it is missing from SHA256SUMS.txt.`);if(n.checksum!==e)throw Error(`manifest.json checksum mismatch for ${n.name}.`);if(!Z(n.name))throw Error(`manifest.json contains an invalid binary asset name: ${n.name}.`)}}async function ut(e,t){try{let n=await v(o([e,...t]));return{success:n===0,exitCode:n}}catch{return{success:!1,exitCode:1}}}export{me as agentCatalogEntrySchema,ge as agentCatalogJsonSchema,J as agentCatalogSchema,F as agentUpdateProviders,Se as autohand,m as canAutoUpdateSelf,h as canLookupLatestVersionForInstallType,M as canResolveAgentUpdate,te as canUninstallInstallType,a as canUpdateInstallType,Ie as capabilitiesCommand,xe as claude,_e as codebuddy,je as codewhale,Pe as codex,Le as commandsCommand,ve as copilot,N as createErrorResult,ct as createReleaseManifest,I as createSuccessResult,nt as createUpdatePlan,Ne as cursor,fe as deepcode,ee as detectSelfInstallSource,W as devin,Me as droid,y as emitCommandResult,Ye as ensureCommand,ut as execCommand,ot as formatChecksums,pe as gemini,K as genie,be as getAgentByLookupName,ke as getAgentByNameOrAlias,t as getAgentUpdateFailureHint,T as getAgentUpdateStrategy,Ee as getAllAgents,_ as getBinaryPath,u as getBinaryReleaseAssetName,O as getBinaryReleaseDownloadUrl,he as getCatalogAgent,Y as getCatalogAgents,j as getCliContext,n as getConfigDir,S as getConfigFilePath,et as getExitCodeForError,$e as getExitCodeForResult,d as getInstallLifecycle,D as getInstalledAgentState,re as getInstalledVersion,k as getInstallerCapabilities,g as getLatestVersion,Be as getManagedInstaller,e as getManualAgentUpdateMessage,P as getManualSelfUpgradeCommand,We as getOrderedInstallMethods,Ae as getPlatform,Qe as getSchemaCatalog,c as getSelfState,A as getSelfUpgradeRecoveryHint,z as getSelfUpgradeRecoveryHintForInspection,i as getSelfVersion,it as getSingleAgentUpdateStatus,l as getStateFilePath,G as hermes,Ve as inspectAgent,Re as inspectAllAgents,Xe as inspectCommand,qe as inspectRegisteredAgents,R as inspectSelf,Ke as installAgent,De as isBinaryInPath,Ce as isBunAvailable,Oe as isDenoAvailable,tt as isInspectionUpdateAvailable,r as isManagedInstallType,ye as isNpmAvailable,le as jcode,Te as junie,H as kilo,L as loadConfig,f as loadState,we as mimo,Q as normalizeRepositoryUrl,se as omp,ce as openclaw,ue as opencode,q as openhands,Z as parseBinaryTarget,st as parseChecksums,ae as pi,rt as planAgentUpdates,oe as qoder,de as reasonix,ne as removeInstalledAgentState,B as resetCliContext,Ue as resolveAgent,Ge as resolveAgentInspection,w as resolveAgentUpdateProvider,x as resolveCliContext,Ze as resolveCommand,$ as resolveReleaseChannel,E as saveConfig,ie as saveState,X as schemaCommand,C as setCliContext,s as setInstalledAgentState,p as setSelfInstallSource,V as setSelfUpdateNoticeState,He as uninstallAgent,Je as updateAgent,ze as updateAgentsByType,b as upgradeSelf,lt as validateReleaseManifest,Fe as vibe,U as vtcode};
@@ -1,2 +1,2 @@
1
- import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-ChvF_SAo.mjs";import{r as o}from"./agents-CMkLsOPA.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`info`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return e(n({action:`info`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,displayName:l.displayName,installMethods:u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Update: ${e.data.agent.selfUpdateCommands.join(` || `)||`-`}`),console.log(` Installed: ${e.data.inspection.installed?r.green(`Yes`):r.red(`No`)}`),e.data.inspection.sourceLabel&&console.log(` Source: ${e.data.inspection.sourceLabel}`),e.data.inspection.installed&&console.log(` Lifecycle: ${e.data.inspection.lifecycle}`),e.data.inspection.installedVersion&&console.log(` Version: ${e.data.inspection.installedVersion}`),e.data.inspection.latestVersion&&console.log(` Latest: ${e.data.inspection.latestVersion}`),e.data.inspection.binaryPath&&console.log(` Path: ${e.data.inspection.binaryPath}`),console.log(r.bold(`
1
+ import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-BjsL_hvq.mjs";import{r as o}from"./agents-RFc5BDHs.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`info`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return e(n({action:`info`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,displayName:l.displayName,installMethods:u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Update: ${e.data.agent.selfUpdateCommands.join(` || `)||`-`}`),console.log(` Installed: ${e.data.inspection.installed?r.green(`Yes`):r.red(`No`)}`),e.data.inspection.sourceLabel&&console.log(` Source: ${e.data.inspection.sourceLabel}`),e.data.inspection.installed&&console.log(` Lifecycle: ${e.data.inspection.lifecycle}`),e.data.inspection.installedVersion&&console.log(` Version: ${e.data.inspection.installedVersion}`),e.data.inspection.latestVersion&&console.log(` Latest: ${e.data.inspection.latestVersion}`),e.data.inspection.binaryPath&&console.log(` Path: ${e.data.inspection.binaryPath}`),console.log(r.bold(`
2
2
  Install Methods:`));for(let t of e.data.agent.installMethods)console.log(` ${r.green(`+`)} [${t.label}] ${t.command}`);console.log()}}export{s as infoCommand};
@@ -1,3 +1,3 @@
1
- import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-ChvF_SAo.mjs";import{r as o}from"./agents-CMkLsOPA.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`inspect`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return e(n({action:`inspect`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,displayName:l.displayName,installMethods:u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},capabilities:{canAutoInstall:u.methods.length>0,canAutoUninstall:u.inPath&&u.lifecycle===`managed`,canRun:u.inPath,canSelfUpdate:d.length>0},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0,updateLabel:u.updateLabel}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Installed: ${e.data.inspection.installed?r.green(`Yes`):r.red(`No`)}`),console.log(` Update Mode: ${e.data.inspection.updateLabel}`),console.log(` Self Update: ${e.data.agent.selfUpdateCommands.join(` || `)||`-`}`),e.data.inspection.sourceLabel&&console.log(` Source: ${e.data.inspection.sourceLabel}`),e.data.inspection.installedVersion&&console.log(` Version: ${e.data.inspection.installedVersion}`),e.data.inspection.latestVersion&&console.log(` Latest: ${e.data.inspection.latestVersion}`),e.data.inspection.binaryPath&&console.log(` Path: ${e.data.inspection.binaryPath}`),console.log(r.bold(`
1
+ import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-BjsL_hvq.mjs";import{r as o}from"./agents-RFc5BDHs.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`inspect`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return e(n({action:`inspect`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,displayName:l.displayName,installMethods:u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},capabilities:{canAutoInstall:u.methods.length>0,canAutoUninstall:u.inPath&&u.lifecycle===`managed`,canRun:u.inPath,canSelfUpdate:d.length>0},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0,updateLabel:u.updateLabel}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Installed: ${e.data.inspection.installed?r.green(`Yes`):r.red(`No`)}`),console.log(` Update Mode: ${e.data.inspection.updateLabel}`),console.log(` Self Update: ${e.data.agent.selfUpdateCommands.join(` || `)||`-`}`),e.data.inspection.sourceLabel&&console.log(` Source: ${e.data.inspection.sourceLabel}`),e.data.inspection.installedVersion&&console.log(` Version: ${e.data.inspection.installedVersion}`),e.data.inspection.latestVersion&&console.log(` Latest: ${e.data.inspection.latestVersion}`),e.data.inspection.binaryPath&&console.log(` Path: ${e.data.inspection.binaryPath}`),console.log(r.bold(`
2
2
  Capabilities:`)),console.log(` auto-install: ${e.data.capabilities.canAutoInstall?`yes`:`no`}`),console.log(` self-update: ${e.data.capabilities.canSelfUpdate?`yes`:`no`}`),console.log(` auto-uninstall: ${e.data.capabilities.canAutoUninstall?`yes`:`no`}`),console.log(` runnable: ${e.data.capabilities.canRun?`yes`:`no`}`),console.log(r.bold(`
3
3
  Install Methods:`));for(let t of e.data.agent.installMethods)console.log(` ${r.green(`+`)} [${t.label}] ${t.command}`);console.log()}}export{s as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./inspect-Blp-Ypr2.mjs";export{e as inspectCommand};
@@ -0,0 +1 @@
1
+ import{St as e,Z as t,a as n,i as r,lt as i,n as a,r as o,t as s}from"./color-BjsL_hvq.mjs";import{c,r as l,s as u}from"./agents-RFc5BDHs.mjs";import{t as d}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as f,i as p,n as m,r as h}from"./user-output-W4VzwJV2.mjs";async function g(e){let t=Array.isArray(e)?e:[e];if(t.length<=1)return n(await _(t[0],{emitStartedEvent:!0}),C);r({action:`install`,data:{scope:`batch`},target:{kind:`agent`},type:`started`});let s=[];for(let e of t){if(i().cancelled)break;let t=y(e,await _(e));if(s.push(t),r({action:`install`,data:t,target:{kind:`agent`,name:t.agent.name},type:`progress`}),i().cancelled)break}let c={results:s,scope:`batch`,summary:x(s)};return i().cancelled&&s.length<t.length?n(a({action:`install`,data:c,error:{code:`CANCELLED`,message:`Install was cancelled before all agents could be installed.`},target:{kind:`agent`}}),w):n(s.some(e=>!e.ok)?a({action:`install`,data:c,error:S(s),target:{kind:`agent`}}):o({action:`install`,data:c,target:{kind:`agent`}}),w)}async function _(n,r={}){if(i().cancelled)return a({action:`install`,error:{code:`CANCELLED`,message:`Install was cancelled before it could start.`},target:{kind:`agent`,name:n}});let s=await l(n);if(!s)return a({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:n},message:`Unknown agent: ${n}`},target:{kind:`agent`,name:n}});let{agent:f,inspection:p}=s;if(p.inPath){if(p.installedState)return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]});let n=e(p.methods,p.resolvedBinaryPath??p.binaryPath);if(n){if(m())return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]});v(f,r.emitStartedEvent);try{let e=await c(f,n);return e?o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}):a({action:`install`,error:{code:`CANCELLED`,message:`Install was cancelled before tracking could complete.`},target:{kind:`agent`,name:f.name}})}catch(e){if(t(e))return a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...d(e,{kind:`agent`,name:f.name})});throw e}}return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]})}if(m())return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]});v(f,r.emitStartedEvent);let h;try{h=await u(f)}catch(e){if(t(e))return a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...d(e,{kind:`agent`,name:f.name})});throw e}return h.success?o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}):a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}})}function v(e,t=!1){t&&r({action:`install`,data:{agent:{displayName:e.displayName,name:e.name}},target:{kind:`agent`,name:e.name},type:`started`})}function y(e,t){let n=t.data,r=t.warnings.map(e=>({code:e.code,message:e.message}));return{agent:n?.agent??{displayName:e,name:t.target?.name??e},changed:n?.changed??!1,error:t.error?{code:t.error.code,message:t.error.message}:void 0,input:e,installState:n?.installState,installed:n?.installed??!1,ok:t.ok,status:b(t),warnings:r}}function b(e){return e.ok?e.warnings.some(e=>e.code===`TRACKED_EXISTING_INSTALL`)?`tracked-existing-install`:e.warnings.some(e=>e.code===`UNTRACKED_EXISTING_INSTALL`)?`untracked-existing-install`:e.warnings.some(e=>e.code===`ALREADY_INSTALLED`)?`already-installed`:e.warnings.some(e=>e.code===`DRY_RUN`)?`planned`:`installed`:e.error?.code===`RESOURCE_LOCKED`?`locked`:`failed`}function x(e){let t={alreadyInstalled:0,failed:0,installed:0,locked:0,planned:0,trackedExistingInstall:0,untrackedExistingInstall:0};for(let n of e)switch(n.status){case`already-installed`:t.alreadyInstalled+=1;break;case`failed`:t.failed+=1;break;case`installed`:t.installed+=1;break;case`locked`:t.locked+=1;break;case`planned`:t.planned+=1;break;case`tracked-existing-install`:t.trackedExistingInstall+=1;break;case`untracked-existing-install`:t.untrackedExistingInstall+=1;break}return t}function S(e){let t=e.filter(e=>!e.ok),n=new Set(t.map(e=>e.error?.code));return n.size===1&&n.has(`RESOURCE_LOCKED`)?{code:`RESOURCE_LOCKED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents could not be installed because another Quantex process is already using the agent lifecycle lock.`}:{code:`INSTALL_FAILED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents failed to install.`}}function C(e){if(e.error){h(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){p(s.green(t.message));continue}if(t.code===`DRY_RUN`){f(s.cyan(t.message));continue}f(s.yellow(t.message))}return}p(s.cyan(`Installing ${e.data.agent.displayName}...`)),p(s.green(`${e.data.agent.displayName} installed successfully!`))}}function w(e){if(!e.data){e.error&&h(s.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`installed`:p(s.cyan(`Installing ${t.agent.displayName}...`)),p(s.green(`${t.agent.displayName} installed successfully!`));break;case`tracked-existing-install`:p(s.green(T(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`already-installed`:case`untracked-existing-install`:f(s.yellow(T(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`planned`:f(s.cyan(T(t.warnings,`Dry run: would install ${t.agent.displayName}.`)));break;case`locked`:f(s.yellow(t.error?.message??`Another quantex process is already installing ${t.agent.displayName}.`));break;case`failed`:h(s.red(t.error?.message??`Failed to install ${t.agent.displayName}.`));break}E(e.data.summary)}function T(e,t){return e[0]?.message??t}function E(e){let t=[e.installed?`installed ${e.installed}`:void 0,e.alreadyInstalled?`already installed ${e.alreadyInstalled}`:void 0,e.trackedExistingInstall?`tracked existing ${e.trackedExistingInstall}`:void 0,e.untrackedExistingInstall?`untracked existing ${e.untrackedExistingInstall}`:void 0,e.failed?`failed ${e.failed}`:void 0,e.locked?`locked ${e.locked}`:void 0,e.planned?`planned ${e.planned}`:void 0].filter(Boolean);t.length>0&&p(s.bold(`Summary: ${t.join(`, `)}`))}export{g as installCommand};
@@ -1,3 +1,3 @@
1
- import{a as e,r as t,t as n}from"./color-ChvF_SAo.mjs";import{t as r}from"./agents-CMkLsOPA.mjs";async function i(){return e(t({action:`list`,data:{agents:(await r()).map(e=>({binaryName:e.agent.binaryName,displayName:e.agent.displayName,installed:e.inPath,installedVersion:e.installedVersion,latestVersion:e.latestVersion,lifecycle:e.lifecycle,name:e.agent.name,sourceLabel:e.sourceLabel,updateLabel:e.updateLabel}))},target:{kind:`system`,name:`agents`}}),a)}function a(e){console.log(n.bold(`
1
+ import{a as e,r as t,t as n}from"./color-BjsL_hvq.mjs";import{t as r}from"./agents-RFc5BDHs.mjs";async function i(){return e(t({action:`list`,data:{agents:(await r()).map(e=>({binaryName:e.agent.binaryName,displayName:e.agent.displayName,installed:e.inPath,installedVersion:e.installedVersion,latestVersion:e.latestVersion,lifecycle:e.lifecycle,name:e.agent.name,sourceLabel:e.sourceLabel,updateLabel:e.updateLabel}))},target:{kind:`system`,name:`agents`}}),a)}function a(e){console.log(n.bold(`
2
2
  AI Agents:
3
3
  `));for(let t of e.data?.agents??[]){let e=t.displayName.padEnd(18),r=t.installed?n.green(`installed`):n.gray(`not installed`),i=t.installed?n.dim(t.installedVersion??`unknown version`):``,a=t.installed?n.cyan(t.updateLabel):``,o=t.installed?n.dim(t.sourceLabel):``;console.log(` ${e} ${r} ${i}${a?` ${a}`:``}${o?` ${o}`:``}`)}console.log()}export{i as listCommand};
@@ -0,0 +1 @@
1
+ import{t as e}from"./resolve-BtGd-SR3.mjs";export{e as resolveCommand};
@@ -1 +1 @@
1
- import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-ChvF_SAo.mjs";import{r as o}from"./agents-CMkLsOPA.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`resolve`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s;if(!u.inPath||!u.binaryPath){let n=u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})).filter(e=>e.command);return e(t({action:`resolve`,data:{agent:{binaryName:l.binaryName,displayName:l.displayName,name:l.name},resolution:{binaryPath:``,installGuidance:{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:n,suggestedAction:`ensure-agent-installed`,suggestedEnsureCommand:`quantex ensure ${l.name}`},installed:!1,installSource:`not-installed`,lifecycle:`unmanaged`,sourceLabel:`not installed`,suggestedLaunchCommand:[]}},error:{code:`AGENT_NOT_INSTALLED`,details:{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:n,suggestedAction:`ensure-agent-installed`,suggestedEnsureCommand:`quantex ensure ${l.name}`},message:`${l.displayName} is not installed.`},target:{kind:`agent`,name:l.name}}),c)}return e(n({action:`resolve`,data:{agent:{binaryName:l.binaryName,displayName:l.displayName,name:l.name},resolution:{binaryPath:u.binaryPath,installed:!0,installSource:u.installedState?.installType??`detected-in-path`,installedVersion:u.installedVersion,lifecycle:u.lifecycle,sourceLabel:u.sourceLabel,suggestedLaunchCommand:[u.binaryPath]}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));let t=e.data?.resolution.installGuidance;if(t){console.log(r.dim(`Try: ${t.suggestedEnsureCommand}`));for(let e of t.installMethods)console.log(r.dim(`Install: [${e.label}] ${e.command}`))}return}e.data&&(console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Path: ${e.data.resolution.binaryPath}`),console.log(` Source: ${e.data.resolution.sourceLabel}`),console.log(` Lifecycle: ${e.data.resolution.lifecycle}`),console.log(` Install Type: ${e.data.resolution.installSource}`),e.data.resolution.installedVersion&&console.log(` Version: ${e.data.resolution.installedVersion}`),console.log(` Launch: ${e.data.resolution.suggestedLaunchCommand.join(` `)}`),console.log())}export{s as t};
1
+ import{a as e,n as t,r as n,t as r,vt as i,yt as a}from"./color-BjsL_hvq.mjs";import{r as o}from"./agents-RFc5BDHs.mjs";async function s(r){let s=await o(r);if(!s)return e(t({action:`resolve`,error:{code:`AGENT_NOT_FOUND`,details:{input:r},message:`Unknown agent: ${r}`},target:{kind:`agent`,name:r}}),c);let{agent:l,inspection:u}=s;if(!u.inPath||!u.binaryPath){let n=u.methods.map(e=>({command:i(l,e),label:a(e),type:e.type})).filter(e=>e.command);return e(t({action:`resolve`,data:{agent:{binaryName:l.binaryName,displayName:l.displayName,name:l.name},resolution:{binaryPath:``,installGuidance:{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:n,suggestedAction:`ensure-agent-installed`,suggestedEnsureCommand:`quantex ensure ${l.name}`},installed:!1,installSource:`not-installed`,lifecycle:`unmanaged`,sourceLabel:`not installed`,suggestedLaunchCommand:[]}},error:{code:`AGENT_NOT_INSTALLED`,details:{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:n,suggestedAction:`ensure-agent-installed`,suggestedEnsureCommand:`quantex ensure ${l.name}`},message:`${l.displayName} is not installed.`},target:{kind:`agent`,name:l.name}}),c)}return e(n({action:`resolve`,data:{agent:{binaryName:l.binaryName,displayName:l.displayName,name:l.name},resolution:{binaryPath:u.binaryPath,installed:!0,installSource:u.installedState?.installType??`detected-in-path`,installedVersion:u.installedVersion,lifecycle:u.lifecycle,sourceLabel:u.sourceLabel,suggestedLaunchCommand:[u.binaryPath]}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));let t=e.data?.resolution.installGuidance;if(t){console.log(r.dim(`Try: ${t.suggestedEnsureCommand}`));for(let e of t.installMethods)console.log(r.dim(`Install: [${e.label}] ${e.command}`))}return}e.data&&(console.log(r.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Path: ${e.data.resolution.binaryPath}`),console.log(` Source: ${e.data.resolution.sourceLabel}`),console.log(` Lifecycle: ${e.data.resolution.lifecycle}`),console.log(` Install Type: ${e.data.resolution.installSource}`),e.data.resolution.installedVersion&&console.log(` Version: ${e.data.resolution.installedVersion}`),console.log(` Launch: ${e.data.resolution.suggestedLaunchCommand.join(` `)}`),console.log())}export{s as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./schema-Dlq9AKfh.mjs";export{e as schemaCommand};
@@ -1,3 +1,3 @@
1
- import{a as e,n as t,r as n,t as r}from"./color-ChvF_SAo.mjs";const i={additionalProperties:!1,properties:{action:{type:`string`},data:{type:`object`},error:{additionalProperties:!1,properties:{code:{type:`string`},message:{type:`string`}},required:[`code`,`message`],type:`object`},exitCode:{type:`integer`},meta:{additionalProperties:!1,properties:{mode:{type:`string`},runId:{type:`string`},schemaVersion:{type:`string`},source:{type:`string`},fetchedAt:{type:`string`},staleAfter:{type:`string`},timestamp:{type:`string`},version:{type:`string`}},required:[`mode`,`runId`,`schemaVersion`,`timestamp`,`version`],type:`object`},ok:{type:`boolean`},target:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},warnings:{items:{additionalProperties:!1,properties:{code:{type:`string`},message:{type:`string`}},required:[`code`,`message`],type:`object`},type:`array`}},required:[`action`,`error`,`meta`,`ok`,`warnings`],type:`object`},a={additionalProperties:!1,properties:{action:{type:`string`},data:{type:`object`},meta:{additionalProperties:!1,properties:{mode:{type:`string`},runId:{type:`string`},schemaVersion:{type:`string`},source:{type:`string`},fetchedAt:{type:`string`},staleAfter:{type:`string`},timestamp:{type:`string`},version:{type:`string`}},required:[`mode`,`runId`,`schemaVersion`,`timestamp`,`version`],type:`object`},target:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},type:{type:`string`}},required:[`action`,`meta`,`type`],type:`object`},o={additionalProperties:!1,properties:{available:{type:`boolean`},reason:{type:`string`}},required:[`available`],type:`object`},s={brew:o,bun:o,cargo:o,deno:o,mise:o,npm:o,pip:o,uv:o,winget:o},c=[`brew`,`bun`,`cargo`,`deno`,`mise`,`npm`,`pip`,`uv`,`winget`],l=[{dataSchema:{additionalProperties:!1,properties:{agents:{items:{type:`string`},type:`array`},features:{additionalProperties:!1,properties:{assumeYes:{type:`boolean`},cacheBypass:{type:`boolean`},cacheRefresh:{type:`boolean`},channels:{items:{type:`string`},type:`array`},colorModes:{items:{type:`string`},type:`array`},dryRun:{type:`boolean`},execInstallPolicies:{items:{type:`string`},type:`array`},freshnessMetadata:{type:`boolean`},idempotencyKey:{type:`boolean`},logLevels:{items:{type:`string`},type:`array`},quietLogs:{type:`boolean`},selfUpgrade:{type:`boolean`},timeout:{type:`boolean`}},required:[`assumeYes`,`cacheBypass`,`cacheRefresh`,`channels`,`colorModes`,`dryRun`,`execInstallPolicies`,`freshnessMetadata`,`idempotencyKey`,`logLevels`,`quietLogs`,`selfUpgrade`,`timeout`],type:`object`},installers:{additionalProperties:!1,properties:s,required:c,type:`object`},outputModes:{items:{type:`string`},type:`array`},platform:{additionalProperties:!1,properties:{arch:{type:`string`},os:{type:`string`}},required:[`arch`,`os`],type:`object`}},required:[`agents`,`features`,`installers`,`outputModes`,`platform`],type:`object`},description:`Environment and surface capabilities`,envelopeSchema:i,name:`capabilities`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{flags:{items:{type:`string`},type:`array`},name:{type:`string`},outputSchemaRef:{type:`string`},stability:{type:`string`},summary:{type:`string`}},required:[`flags`,`name`,`outputSchemaRef`,`stability`,`summary`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Stable command catalog`,envelopeSchema:i,name:`commands`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agents:{items:{additionalProperties:!1,properties:{displayName:{type:`string`},installedVersion:{type:`string`},latestVersion:{type:`string`},lifecycle:{type:`string`},outdated:{type:`boolean`},sourceLabel:{type:`string`}},required:[`displayName`,`lifecycle`,`outdated`,`sourceLabel`],type:`object`},type:`array`},installers:{additionalProperties:!1,properties:{brew:{type:`boolean`},bun:{type:`boolean`},cargo:{type:`boolean`},deno:{type:`boolean`},mise:{type:`boolean`},npm:{type:`boolean`},pip:{type:`boolean`},uv:{type:`boolean`},winget:{type:`boolean`}},required:c,type:`object`},issues:{items:{additionalProperties:!1,properties:{blocking:{type:`boolean`},category:{type:`string`},code:{type:`string`},docsRef:{type:`string`},message:{type:`string`},severity:{type:`string`},subject:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},suggestedAction:{type:`string`},suggestedCommands:{items:{type:`string`},type:`array`}},required:[`blocking`,`category`,`code`,`message`,`severity`,`subject`,`suggestedAction`,`suggestedCommands`],type:`object`},type:`array`},self:{additionalProperties:!1,properties:{canAutoUpdate:{type:`boolean`},currentVersion:{type:`string`},installSource:{type:`string`},latestVersion:{type:`string`},outdated:{type:`boolean`},recoveryHint:{type:`string`}},required:[`canAutoUpdate`,`currentVersion`,`installSource`,`outdated`],type:`object`}},required:[`agents`,`installers`,`issues`,`self`],type:`object`},description:`Diagnostic state and remediation guidance for the current environment`,envelopeSchema:i,name:`doctor`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{additionalProperties:!1,properties:{binaryName:{type:`string`},displayName:{type:`string`},name:{type:`string`}},required:[`name`],type:`object`},execution:{additionalProperties:!1,properties:{args:{items:{type:`string`},type:`array`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`},suggestedExecCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`,`suggestedExecCommand`],type:`object`},installPolicy:{type:`string`},installed:{type:`boolean`},interactive:{type:`boolean`},launched:{type:`boolean`}},required:[`args`,`installPolicy`,`installed`,`interactive`,`launched`],type:`object`}},required:[`agent`,`execution`],type:`object`},description:`Preflight contract for managed agent execution`,envelopeSchema:i,name:`exec`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`},results:{items:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},error:{type:`object`},input:{type:`string`},installState:{type:`object`},installed:{type:`boolean`},ok:{type:`boolean`},status:{type:`string`},warnings:{items:{type:`object`},type:`array`}},required:[`agent`,`changed`,`input`,`installed`,`ok`,`status`,`warnings`],type:`object`},type:`array`},scope:{type:`string`},summary:{type:`object`}},type:`object`},description:`Install result for one or more agents`,envelopeSchema:i,name:`install`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`}},required:[`agent`,`changed`,`installed`],type:`object`},description:`Ensure result for an agent`,envelopeSchema:i,name:`ensure`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},capabilities:{type:`object`},inspection:{type:`object`}},required:[`agent`,`capabilities`,`inspection`],type:`object`},description:`Structured inspection result for an agent`,envelopeSchema:i,name:`inspect`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},resolution:{additionalProperties:!1,properties:{binaryPath:{type:`string`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`],type:`object`},installed:{type:`boolean`},installSource:{type:`string`},installedVersion:{type:`string`},lifecycle:{type:`string`},sourceLabel:{type:`string`},suggestedLaunchCommand:{items:{type:`string`},type:`array`}},required:[`binaryPath`,`installed`,`installSource`,`lifecycle`,`sourceLabel`,`suggestedLaunchCommand`],type:`object`}},required:[`agent`,`resolution`],type:`object`},description:`Resolved executable entrypoint for an agent`,envelopeSchema:i,name:`resolve`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{dataSchema:{type:`object`},description:{type:`string`},envelopeSchema:{type:`object`},name:{type:`string`},ndjsonEventSchema:{type:`object`}},required:[`dataSchema`,`description`,`envelopeSchema`,`name`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Structured schema catalog`,envelopeSchema:i,name:`schema`,ndjsonEventSchema:a}];async function u(r){let i=r?l.filter(e=>e.name===r):l;return r&&i.length===0?e(t({action:`schema`,error:{code:`INVALID_ARGUMENT`,details:{command:r},message:`Unknown schema target: ${r}`},target:{kind:`system`,name:`schema`}}),d):e(n({action:`schema`,data:{commands:i},target:{kind:`system`,name:`schema`}}),d)}function d(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`
1
+ import{a as e,n as t,r as n,t as r}from"./color-BjsL_hvq.mjs";const i={additionalProperties:!1,properties:{action:{type:`string`},data:{type:`object`},error:{additionalProperties:!1,properties:{code:{type:`string`},message:{type:`string`}},required:[`code`,`message`],type:`object`},exitCode:{type:`integer`},meta:{additionalProperties:!1,properties:{mode:{type:`string`},runId:{type:`string`},schemaVersion:{type:`string`},source:{type:`string`},fetchedAt:{type:`string`},staleAfter:{type:`string`},timestamp:{type:`string`},version:{type:`string`}},required:[`mode`,`runId`,`schemaVersion`,`timestamp`,`version`],type:`object`},ok:{type:`boolean`},target:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},warnings:{items:{additionalProperties:!1,properties:{code:{type:`string`},message:{type:`string`}},required:[`code`,`message`],type:`object`},type:`array`}},required:[`action`,`error`,`meta`,`ok`,`warnings`],type:`object`},a={additionalProperties:!1,properties:{action:{type:`string`},data:{type:`object`},meta:{additionalProperties:!1,properties:{mode:{type:`string`},runId:{type:`string`},schemaVersion:{type:`string`},source:{type:`string`},fetchedAt:{type:`string`},staleAfter:{type:`string`},timestamp:{type:`string`},version:{type:`string`}},required:[`mode`,`runId`,`schemaVersion`,`timestamp`,`version`],type:`object`},target:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},type:{type:`string`}},required:[`action`,`meta`,`type`],type:`object`},o={additionalProperties:!1,properties:{available:{type:`boolean`},reason:{type:`string`}},required:[`available`],type:`object`},s={brew:o,bun:o,cargo:o,deno:o,mise:o,npm:o,pip:o,uv:o,winget:o},c=[`brew`,`bun`,`cargo`,`deno`,`mise`,`npm`,`pip`,`uv`,`winget`],l=[{dataSchema:{additionalProperties:!1,properties:{agents:{items:{type:`string`},type:`array`},features:{additionalProperties:!1,properties:{assumeYes:{type:`boolean`},cacheBypass:{type:`boolean`},cacheRefresh:{type:`boolean`},channels:{items:{type:`string`},type:`array`},colorModes:{items:{type:`string`},type:`array`},dryRun:{type:`boolean`},execInstallPolicies:{items:{type:`string`},type:`array`},freshnessMetadata:{type:`boolean`},idempotencyKey:{type:`boolean`},logLevels:{items:{type:`string`},type:`array`},quietLogs:{type:`boolean`},selfUpgrade:{type:`boolean`},timeout:{type:`boolean`}},required:[`assumeYes`,`cacheBypass`,`cacheRefresh`,`channels`,`colorModes`,`dryRun`,`execInstallPolicies`,`freshnessMetadata`,`idempotencyKey`,`logLevels`,`quietLogs`,`selfUpgrade`,`timeout`],type:`object`},installers:{additionalProperties:!1,properties:s,required:c,type:`object`},outputModes:{items:{type:`string`},type:`array`},platform:{additionalProperties:!1,properties:{arch:{type:`string`},os:{type:`string`}},required:[`arch`,`os`],type:`object`}},required:[`agents`,`features`,`installers`,`outputModes`,`platform`],type:`object`},description:`Environment and surface capabilities`,envelopeSchema:i,name:`capabilities`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{flags:{items:{type:`string`},type:`array`},name:{type:`string`},outputSchemaRef:{type:`string`},stability:{type:`string`},summary:{type:`string`}},required:[`flags`,`name`,`outputSchemaRef`,`stability`,`summary`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Stable command catalog`,envelopeSchema:i,name:`commands`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agents:{items:{additionalProperties:!1,properties:{displayName:{type:`string`},installedVersion:{type:`string`},latestVersion:{type:`string`},lifecycle:{type:`string`},outdated:{type:`boolean`},sourceLabel:{type:`string`}},required:[`displayName`,`lifecycle`,`outdated`,`sourceLabel`],type:`object`},type:`array`},installers:{additionalProperties:!1,properties:{brew:{type:`boolean`},bun:{type:`boolean`},cargo:{type:`boolean`},deno:{type:`boolean`},mise:{type:`boolean`},npm:{type:`boolean`},pip:{type:`boolean`},uv:{type:`boolean`},winget:{type:`boolean`}},required:c,type:`object`},issues:{items:{additionalProperties:!1,properties:{blocking:{type:`boolean`},category:{type:`string`},code:{type:`string`},docsRef:{type:`string`},message:{type:`string`},severity:{type:`string`},subject:{additionalProperties:!1,properties:{kind:{type:`string`},name:{type:`string`}},required:[`kind`],type:`object`},suggestedAction:{type:`string`},suggestedCommands:{items:{type:`string`},type:`array`}},required:[`blocking`,`category`,`code`,`message`,`severity`,`subject`,`suggestedAction`,`suggestedCommands`],type:`object`},type:`array`},self:{additionalProperties:!1,properties:{canAutoUpdate:{type:`boolean`},currentVersion:{type:`string`},installSource:{type:`string`},latestVersion:{type:`string`},outdated:{type:`boolean`},recoveryHint:{type:`string`}},required:[`canAutoUpdate`,`currentVersion`,`installSource`,`outdated`],type:`object`}},required:[`agents`,`installers`,`issues`,`self`],type:`object`},description:`Diagnostic state and remediation guidance for the current environment`,envelopeSchema:i,name:`doctor`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{additionalProperties:!1,properties:{binaryName:{type:`string`},displayName:{type:`string`},name:{type:`string`}},required:[`name`],type:`object`},execution:{additionalProperties:!1,properties:{args:{items:{type:`string`},type:`array`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`},suggestedExecCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`,`suggestedExecCommand`],type:`object`},installPolicy:{type:`string`},installed:{type:`boolean`},interactive:{type:`boolean`},launched:{type:`boolean`}},required:[`args`,`installPolicy`,`installed`,`interactive`,`launched`],type:`object`}},required:[`agent`,`execution`],type:`object`},description:`Preflight contract for managed agent execution`,envelopeSchema:i,name:`exec`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`},results:{items:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},error:{type:`object`},input:{type:`string`},installState:{type:`object`},installed:{type:`boolean`},ok:{type:`boolean`},status:{type:`string`},warnings:{items:{type:`object`},type:`array`}},required:[`agent`,`changed`,`input`,`installed`,`ok`,`status`,`warnings`],type:`object`},type:`array`},scope:{type:`string`},summary:{type:`object`}},type:`object`},description:`Install result for one or more agents`,envelopeSchema:i,name:`install`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`}},required:[`agent`,`changed`,`installed`],type:`object`},description:`Ensure result for an agent`,envelopeSchema:i,name:`ensure`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},capabilities:{type:`object`},inspection:{type:`object`}},required:[`agent`,`capabilities`,`inspection`],type:`object`},description:`Structured inspection result for an agent`,envelopeSchema:i,name:`inspect`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},resolution:{additionalProperties:!1,properties:{binaryPath:{type:`string`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`],type:`object`},installed:{type:`boolean`},installSource:{type:`string`},installedVersion:{type:`string`},lifecycle:{type:`string`},sourceLabel:{type:`string`},suggestedLaunchCommand:{items:{type:`string`},type:`array`}},required:[`binaryPath`,`installed`,`installSource`,`lifecycle`,`sourceLabel`,`suggestedLaunchCommand`],type:`object`}},required:[`agent`,`resolution`],type:`object`},description:`Resolved executable entrypoint for an agent`,envelopeSchema:i,name:`resolve`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{dataSchema:{type:`object`},description:{type:`string`},envelopeSchema:{type:`object`},name:{type:`string`},ndjsonEventSchema:{type:`object`}},required:[`dataSchema`,`description`,`envelopeSchema`,`name`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Structured schema catalog`,envelopeSchema:i,name:`schema`,ndjsonEventSchema:a}];async function u(r){let i=r?l.filter(e=>e.name===r):l;return r&&i.length===0?e(t({action:`schema`,error:{code:`INVALID_ARGUMENT`,details:{command:r},message:`Unknown schema target: ${r}`},target:{kind:`system`,name:`schema`}}),d):e(n({action:`schema`,data:{commands:i},target:{kind:`system`,name:`schema`}}),d)}function d(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`
2
2
  Quantex Schemas
3
3
  `));for(let t of e.data.commands)console.log(` ${r.cyan(t.name)}`),console.log(` ${t.description}`);console.log()}}function f(){return l}export{u as n,f as t};
@@ -1 +1 @@
1
- import{Z as e,a as t,j as n,n as r,r as i,t as a}from"./color-ChvF_SAo.mjs";import{l as o,n as s}from"./agents-CMkLsOPA.mjs";import{t as c}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-B5Ah0_tJ.mjs";async function p(a){let l=s(a);if(!l)return t(r({action:`uninstall`,error:{code:`AGENT_NOT_FOUND`,details:{input:a},message:`Unknown agent: ${a}`},target:{kind:`agent`,name:a}}),h);if(!await n(l.name))return t(m(a,l),h);if(d())return t(i({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},target:{kind:`agent`,name:l.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would uninstall ${l.displayName}.`}]}),h);let u;try{u=await o(l)}catch(n){if(e(n))return t(r({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},...c(n,{kind:`agent`,name:l.name})}),h);throw n}return t(u?i({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!0},target:{kind:`agent`,name:l.name}}):r({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},error:{code:`UNINSTALL_FAILED`,message:`Failed to uninstall ${l.displayName}.`},target:{kind:`agent`,name:l.name}}),h)}function m(e,t){return r({action:`uninstall`,data:{agent:{displayName:t.displayName,name:t.name},changed:!1},error:{code:`UNINSTALL_UNMANAGED`,details:{canAutoUninstall:!1,displayName:t.displayName,input:e,lifecycle:`unmanaged`,name:t.name},message:`${t.displayName} is not managed by qtx, so qtx cannot auto-uninstall it. Run qtx inspect ${t.name} for details.`},target:{kind:`agent`,name:t.name}})}function h(e){if(e.error){f(a.red(e.error.message));return}if(e.data){if(e.warnings&&e.warnings.length>0){for(let t of e.warnings)l(a.yellow(t.message));return}u(a.cyan(`Uninstalling ${e.data.agent.displayName}...`)),u(a.green(`${e.data.agent.displayName} uninstalled successfully!`))}}export{p as uninstallCommand};
1
+ import{Z as e,a as t,j as n,n as r,r as i,t as a}from"./color-BjsL_hvq.mjs";import{l as o,n as s}from"./agents-RFc5BDHs.mjs";import{t as c}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-W4VzwJV2.mjs";async function p(a){let l=s(a);if(!l)return t(r({action:`uninstall`,error:{code:`AGENT_NOT_FOUND`,details:{input:a},message:`Unknown agent: ${a}`},target:{kind:`agent`,name:a}}),h);if(!await n(l.name))return t(m(a,l),h);if(d())return t(i({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},target:{kind:`agent`,name:l.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would uninstall ${l.displayName}.`}]}),h);let u;try{u=await o(l)}catch(n){if(e(n))return t(r({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},...c(n,{kind:`agent`,name:l.name})}),h);throw n}return t(u?i({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!0},target:{kind:`agent`,name:l.name}}):r({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},error:{code:`UNINSTALL_FAILED`,message:`Failed to uninstall ${l.displayName}.`},target:{kind:`agent`,name:l.name}}),h)}function m(e,t){return r({action:`uninstall`,data:{agent:{displayName:t.displayName,name:t.name},changed:!1},error:{code:`UNINSTALL_UNMANAGED`,details:{canAutoUninstall:!1,displayName:t.displayName,input:e,lifecycle:`unmanaged`,name:t.name},message:`${t.displayName} is not managed by qtx, so qtx cannot auto-uninstall it. Run qtx inspect ${t.name} for details.`},target:{kind:`agent`,name:t.name}})}function h(e){if(e.error){f(a.red(e.error.message));return}if(e.data){if(e.warnings&&e.warnings.length>0){for(let t of e.warnings)l(a.yellow(t.message));return}u(a.cyan(`Uninstalling ${e.data.agent.displayName}...`)),u(a.green(`${e.data.agent.displayName} uninstalled successfully!`))}}export{p as uninstallCommand};
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./messages-qcLhD-Gc.mjs";import{H as r,Z as i,_t as a,a as o,ht as s,i as c,lt as l,n as u,r as d,t as f}from"./color-ChvF_SAo.mjs";import{d as p,n as m,u as h}from"./agents-CMkLsOPA.mjs";import{a as g,i as _,n as v,r as y}from"./user-output-B5Ah0_tJ.mjs";import{n as b,r as x}from"./update-CZwVKNs1.mjs";async function S(e,t){if(t)return C();if(!e)return o(u({action:`update`,error:{code:`INVALID_ARGUMENT`,message:`Please specify an agent name or use --all flag`},target:{kind:`agent`}}),A);let n=m(e);return n?w(n):o(u({action:`update`,error:{code:`AGENT_NOT_FOUND`,details:{input:e},message:`Unknown agent: ${e}`},target:{kind:`agent`,name:e}}),A)}async function C(){c({action:`update`,data:{scope:`all`},target:{kind:`agent`},type:`started`});let e=await T(await b());return l().cancelled?o(u({action:`update`,data:{results:e.results,scope:`all`},error:{code:`CANCELLED`,message:`Update was cancelled before all agents could be updated.`},target:{kind:`agent`}}),A):e.hasFailures?o(u({action:`update`,data:{results:e.results,scope:`all`},error:{code:`UPDATE_FAILED`,message:`One or more agents failed to update.`},target:{kind:`agent`}}),A):o(d({action:`update`,data:{results:e.results,scope:`all`},target:{kind:`agent`}}),A)}async function w(e){c({action:`update`,data:{agent:e.name,scope:`single`},target:{kind:`agent`,name:e.name},type:`started`});let{inspection:t,plan:n}=await x(e);if(!t.inPath)return o(u({action:`update`,error:{code:`AGENT_NOT_INSTALLED`,message:`${e.displayName} is not installed.`},target:{kind:`agent`,name:e.name}}),A);let r=await T(n),i=k(r.results);return i?o(u({action:`update`,data:{results:r.results,scope:`single`},error:{code:`RESOURCE_LOCKED`,details:i.resource?{resource:i.resource}:void 0,message:i.message??`Another quantex process is already updating ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):r.hasFailures?o(u({action:`update`,data:{results:r.results,scope:`single`},error:{code:`UPDATE_FAILED`,message:`Failed to update ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):o(d({action:`update`,data:{results:r.results,scope:`single`},target:{kind:`agent`,name:e.name}}),A)}async function T(n){let r=[];for(let e of n.upToDate)E(r,{displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,name:e.agent.name,status:`up-to-date`});for(let t of n.skippedManualCheck)E(r,{displayName:t.agent.displayName,message:e(t.agent),name:t.agent.name,status:`manual-required`});for(let e of n.untrackedInPath)E(r,{displayName:e.agent.displayName,message:t(e.agent),name:e.agent.name,status:`manual-required`});for(let e of n.grouped){if(l().cancelled)break;let t=await D(e.type,e.packages,e.updates);for(let e of t)E(r,e);if(l().cancelled)break}for(let e of n.manual){if(l().cancelled)break;E(r,await O(e.agent,e.state,e.inspection.methods,e.inspection))}return{hasFailures:r.some(e=>e.status===`failed`||e.status===`locked`),results:r}}function E(e,t){e.push(t),c({action:`update`,data:t,target:{kind:`agent`,name:t.name},type:`progress`})}async function D(e,t,n){if(n.length===0)return[];if(v())return n.map(({agent:t,inspection:n,strategy:r})=>({displayName:t.displayName,installedVersion:n.installedVersion,latestVersion:n.latestVersion,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:r===`managed`?`managed/${e}`:r}));try{if(await p(e,t))return n.map(({agent:t,inspection:n,strategy:r})=>({displayName:t.displayName,installedVersion:n.installedVersion,latestVersion:n.latestVersion,name:t.name,status:`updated`,strategy:r===`managed`?`managed/${e}`:r}));let r=[];for(let{agent:e,inspection:t,state:i}of n){if(l().cancelled)break;r.push(await O(e,i,t.methods,t))}return r}catch(t){if(!i(t))throw t;return n.map(({agent:n,inspection:r,strategy:i})=>({displayName:n.displayName,installedVersion:r.installedVersion,latestVersion:r.latestVersion,message:t.message,name:n.name,resource:t.resource,status:`locked`,strategy:i===`managed`?`managed/${e}`:i}))}}async function O(t,o,c,u){if(l().cancelled)return{displayName:t.displayName,installedVersion:u?.installedVersion,latestVersion:u?.latestVersion,message:`Update was cancelled before it could start.`,name:t.name,status:`failed`};let d=s({agent:t,installedState:o,methods:c??u?.methods??[]}),f=u?.installedVersion,p=u?.latestVersion;if(d===`manual-hint`&&!a(t,o))return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:e(t),name:t.name,status:`manual-required`,strategy:d};if(v())return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:d};let m;try{m=await h(t,o)}catch(e){if(i(e))return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:e.message,name:t.name,resource:e.resource,status:`locked`,strategy:d};throw e}if(m.success){if(d===`self-update`){let e=await r(t.binaryName,t.versionProbe);if(f&&e)return e===f?{displayName:t.displayName,installedVersion:e,latestVersion:e,name:t.name,status:`up-to-date`,strategy:d}:{displayName:t.displayName,installedVersion:f,latestVersion:e,name:t.name,status:`updated`,strategy:d}}return{displayName:t.displayName,installedVersion:f,latestVersion:p,name:t.name,status:`updated`,strategy:d}}return{displayName:t.displayName,hint:n(t,d),installedVersion:f,latestVersion:p,name:t.name,status:`failed`,strategy:d}}function k(e){if(e.length===1)return e[0]?.status===`locked`?e[0]:void 0}function A(e){if(!e.data){e.error&&y(f.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`up-to-date`:_(f.green(`${t.displayName} is up to date (${t.installedVersion??`unknown`})`));break;case`manual-required`:g(f.yellow(`${t.displayName}: manual action required.`)),t.message&&g(f.cyan(`Next step: ${t.message}`));break;case`planned`:g(f.cyan(`Would update ${t.displayName}${t.strategy?` via ${t.strategy}`:``}${j(t.installedVersion,t.latestVersion)}`));break;case`updated`:_(f.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),_(f.green(`${t.displayName} updated successfully!`));break;case`failed`:_(f.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),y(f.red(`Failed to update ${t.displayName}.`)),t.hint&&g(f.cyan(`Next step: ${t.hint}`));break;case`locked`:g(f.yellow(t.message??`Another quantex process is already updating ${t.displayName}.`));break}e.data.results.length>1&&M(e.data.results),!e.data.results.length&&e.error&&y(f.red(e.error.message))}function j(e,t){return e?` (${e} -> ${t??`latest`})`:``}function M(e){let t={failed:0,locked:0,manualRequired:0,planned:0,upToDate:0,updated:0};for(let n of e)switch(n.status){case`up-to-date`:t.upToDate+=1;break;case`manual-required`:t.manualRequired+=1;break;case`planned`:t.planned+=1;break;case`updated`:t.updated+=1;break;case`failed`:t.failed+=1;break;case`locked`:t.locked+=1;break}let n=[t.updated?`updated ${t.updated}`:void 0,t.upToDate?`up to date ${t.upToDate}`:void 0,t.manualRequired?`manual ${t.manualRequired}`:void 0,t.failed?`failed ${t.failed}`:void 0,t.locked?`locked ${t.locked}`:void 0,t.planned?`planned ${t.planned}`:void 0].filter(Boolean);n.length>0&&_(f.bold(`Summary: ${n.join(`, `)}`))}export{S as updateCommand};
1
+ import{n as e,r as t,t as n}from"./messages-qcLhD-Gc.mjs";import{H as r,Z as i,_t as a,a as o,ht as s,i as c,lt as l,n as u,r as d,t as f}from"./color-BjsL_hvq.mjs";import{d as p,n as m,u as h}from"./agents-RFc5BDHs.mjs";import{a as g,i as _,n as v,r as y}from"./user-output-W4VzwJV2.mjs";import{n as b,r as x}from"./update-DTQR_h0V.mjs";async function S(e,t){if(t)return C();if(!e)return o(u({action:`update`,error:{code:`INVALID_ARGUMENT`,message:`Please specify an agent name or use --all flag`},target:{kind:`agent`}}),A);let n=m(e);return n?w(n):o(u({action:`update`,error:{code:`AGENT_NOT_FOUND`,details:{input:e},message:`Unknown agent: ${e}`},target:{kind:`agent`,name:e}}),A)}async function C(){c({action:`update`,data:{scope:`all`},target:{kind:`agent`},type:`started`});let e=await T(await b());return l().cancelled?o(u({action:`update`,data:{results:e.results,scope:`all`},error:{code:`CANCELLED`,message:`Update was cancelled before all agents could be updated.`},target:{kind:`agent`}}),A):e.hasFailures?o(u({action:`update`,data:{results:e.results,scope:`all`},error:{code:`UPDATE_FAILED`,message:`One or more agents failed to update.`},target:{kind:`agent`}}),A):o(d({action:`update`,data:{results:e.results,scope:`all`},target:{kind:`agent`}}),A)}async function w(e){c({action:`update`,data:{agent:e.name,scope:`single`},target:{kind:`agent`,name:e.name},type:`started`});let{inspection:t,plan:n}=await x(e);if(!t.inPath)return o(u({action:`update`,error:{code:`AGENT_NOT_INSTALLED`,message:`${e.displayName} is not installed.`},target:{kind:`agent`,name:e.name}}),A);let r=await T(n),i=k(r.results);return i?o(u({action:`update`,data:{results:r.results,scope:`single`},error:{code:`RESOURCE_LOCKED`,details:i.resource?{resource:i.resource}:void 0,message:i.message??`Another quantex process is already updating ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):r.hasFailures?o(u({action:`update`,data:{results:r.results,scope:`single`},error:{code:`UPDATE_FAILED`,message:`Failed to update ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):o(d({action:`update`,data:{results:r.results,scope:`single`},target:{kind:`agent`,name:e.name}}),A)}async function T(n){let r=[];for(let e of n.upToDate)E(r,{displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,name:e.agent.name,status:`up-to-date`});for(let t of n.skippedManualCheck)E(r,{displayName:t.agent.displayName,message:e(t.agent),name:t.agent.name,status:`manual-required`});for(let e of n.untrackedInPath)E(r,{displayName:e.agent.displayName,message:t(e.agent),name:e.agent.name,status:`manual-required`});for(let e of n.grouped){if(l().cancelled)break;let t=await D(e.type,e.packages,e.updates);for(let e of t)E(r,e);if(l().cancelled)break}for(let e of n.manual){if(l().cancelled)break;E(r,await O(e.agent,e.state,e.inspection.methods,e.inspection))}return{hasFailures:r.some(e=>e.status===`failed`||e.status===`locked`),results:r}}function E(e,t){e.push(t),c({action:`update`,data:t,target:{kind:`agent`,name:t.name},type:`progress`})}async function D(e,t,n){if(n.length===0)return[];if(v())return n.map(({agent:t,inspection:n,strategy:r})=>({displayName:t.displayName,installedVersion:n.installedVersion,latestVersion:n.latestVersion,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:r===`managed`?`managed/${e}`:r}));try{if(await p(e,t))return n.map(({agent:t,inspection:n,strategy:r})=>({displayName:t.displayName,installedVersion:n.installedVersion,latestVersion:n.latestVersion,name:t.name,status:`updated`,strategy:r===`managed`?`managed/${e}`:r}));let r=[];for(let{agent:e,inspection:t,state:i}of n){if(l().cancelled)break;r.push(await O(e,i,t.methods,t))}return r}catch(t){if(!i(t))throw t;return n.map(({agent:n,inspection:r,strategy:i})=>({displayName:n.displayName,installedVersion:r.installedVersion,latestVersion:r.latestVersion,message:t.message,name:n.name,resource:t.resource,status:`locked`,strategy:i===`managed`?`managed/${e}`:i}))}}async function O(t,o,c,u){if(l().cancelled)return{displayName:t.displayName,installedVersion:u?.installedVersion,latestVersion:u?.latestVersion,message:`Update was cancelled before it could start.`,name:t.name,status:`failed`};let d=s({agent:t,installedState:o,methods:c??u?.methods??[]}),f=u?.installedVersion,p=u?.latestVersion;if(d===`manual-hint`&&!a(t,o))return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:e(t),name:t.name,status:`manual-required`,strategy:d};if(v())return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:d};let m;try{m=await h(t,o)}catch(e){if(i(e))return{displayName:t.displayName,installedVersion:f,latestVersion:p,message:e.message,name:t.name,resource:e.resource,status:`locked`,strategy:d};throw e}if(m.success){if(d===`self-update`){let e=await r(t.binaryName,t.versionProbe);if(f&&e)return e===f?{displayName:t.displayName,installedVersion:e,latestVersion:e,name:t.name,status:`up-to-date`,strategy:d}:{displayName:t.displayName,installedVersion:f,latestVersion:e,name:t.name,status:`updated`,strategy:d}}return{displayName:t.displayName,installedVersion:f,latestVersion:p,name:t.name,status:`updated`,strategy:d}}return{displayName:t.displayName,hint:n(t,d),installedVersion:f,latestVersion:p,name:t.name,status:`failed`,strategy:d}}function k(e){if(e.length===1)return e[0]?.status===`locked`?e[0]:void 0}function A(e){if(!e.data){e.error&&y(f.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`up-to-date`:_(f.green(`${t.displayName} is up to date (${t.installedVersion??`unknown`})`));break;case`manual-required`:g(f.yellow(`${t.displayName}: manual action required.`)),t.message&&g(f.cyan(`Next step: ${t.message}`));break;case`planned`:g(f.cyan(`Would update ${t.displayName}${t.strategy?` via ${t.strategy}`:``}${j(t.installedVersion,t.latestVersion)}`));break;case`updated`:_(f.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),_(f.green(`${t.displayName} updated successfully!`));break;case`failed`:_(f.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),y(f.red(`Failed to update ${t.displayName}.`)),t.hint&&g(f.cyan(`Next step: ${t.hint}`));break;case`locked`:g(f.yellow(t.message??`Another quantex process is already updating ${t.displayName}.`));break}e.data.results.length>1&&M(e.data.results),!e.data.results.length&&e.error&&y(f.red(e.error.message))}function j(e,t){return e?` (${e} -> ${t??`latest`})`:``}function M(e){let t={failed:0,locked:0,manualRequired:0,planned:0,upToDate:0,updated:0};for(let n of e)switch(n.status){case`up-to-date`:t.upToDate+=1;break;case`manual-required`:t.manualRequired+=1;break;case`planned`:t.planned+=1;break;case`updated`:t.updated+=1;break;case`failed`:t.failed+=1;break;case`locked`:t.locked+=1;break}let n=[t.updated?`updated ${t.updated}`:void 0,t.upToDate?`up to date ${t.upToDate}`:void 0,t.manualRequired?`manual ${t.manualRequired}`:void 0,t.failed?`failed ${t.failed}`:void 0,t.locked?`locked ${t.locked}`:void 0,t.planned?`planned ${t.planned}`:void 0].filter(Boolean);n.length>0&&_(f.bold(`Summary: ${n.join(`, `)}`))}export{S as updateCommand};
@@ -1 +1 @@
1
- import{_t as e,gt as t,wt as n}from"./color-ChvF_SAo.mjs";import{i as r,t as i}from"./agents-CMkLsOPA.mjs";function a(e,n={}){let r={bun:[],npm:[],brew:[],cargo:[],deno:[],mise:[],pip:[],uv:[],winget:[]},i=[],a=[],c=[],l=[];for(let u of e){if(!u.inPath)continue;if(n.skipUntrackedInPath&&!u.installedState){c.push(u);continue}if(s(u)){a.push(u);continue}if(!o(u)){l.push(u);continue}let e=t({agent:u.agent,installedState:u.installedState,methods:u.methods}),d=e.strategy===`managed`?e.getManagedInstallerType?.({agent:u.agent,installedState:u.installedState,methods:u.methods}):void 0;if(d){let e={inspection:u,installerType:d,strategy:`grouped`};r[d].push(e);continue}i.push({inspection:u,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...r.bun,...r.npm,...r.brew,...r.cargo,...r.deno,...r.mise,...r.pip,...r.uv,...r.winget,...i],grouped:r,manual:i,skippedManualCheck:a,untrackedInPath:c,upToDate:l}}function o(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function s(t){return!t.latestVersion&&!e(t.agent,t.installedState)}const c=[`bun`,`npm`,`brew`,`cargo`,`deno`,`mise`,`pip`,`uv`,`winget`];async function l(e){let t=await r(e);return{agent:e,inspection:t,updateAvailable:o(t)}}async function u(){return f(await i(),{skipUntrackedInPath:!0})}async function d(e){let t=await r(e);return{inspection:t,plan:f([t])}}function f(e,t={}){let n=a(e,t),r=[],i=c.map(e=>p(e,n.grouped[e],r)).filter(e=>e!==void 0);return{entries:n.entries.map(e=>h(e.inspection)),grouped:i,manual:[...r,...n.manual.map(e=>h(e.inspection))],skippedManualCheck:n.skippedManualCheck,untrackedInPath:n.untrackedInPath,upToDate:n.upToDate}}function p(e,t,n){if(t.length===0)return;let r=t.map(e=>h(e.inspection)),i=r.filter(m);if(n.push(...r.filter(e=>!m(e))),i.length!==0)return{type:e,packages:i.map(e=>e.package),updates:i}}function m(e){return!!e.package?.packageName}function h(e){let n=t({agent:e.agent,installedState:e.installedState,methods:e.methods}),r=n.getManagedInstallerType?.({agent:e.agent,installedState:e.installedState,methods:e.methods});return{agent:e.agent,inspection:e,installerType:r,package:r?g(e.agent,e.installedState,e.methods,r):void 0,state:e.installedState,strategy:n.strategy}}function g(e,t,r,i){if(t?.packageName&&t.installType===i)return{packageName:t.packageName,binaryName:i===`deno`?t.binaryName:void 0,packageInstallArgs:t.packageInstallArgs,packageTargetKind:t.packageTargetKind};let a=r.find(e=>e.type===i);if(!a)return;let o=n(e,a);if(o)return{packageName:o,binaryName:a.binaryName??(i===`deno`?e.binaryName:void 0),packageInstallArgs:a.packageInstallArgs,packageTargetKind:a.packageTargetKind}}export{o as a,a as i,u as n,d as r,l as t};
1
+ import{_t as e,gt as t,wt as n}from"./color-BjsL_hvq.mjs";import{i as r,t as i}from"./agents-RFc5BDHs.mjs";function a(e,n={}){let r={bun:[],npm:[],brew:[],cargo:[],deno:[],mise:[],pip:[],uv:[],winget:[]},i=[],a=[],c=[],l=[];for(let u of e){if(!u.inPath)continue;if(n.skipUntrackedInPath&&!u.installedState){c.push(u);continue}if(s(u)){a.push(u);continue}if(!o(u)){l.push(u);continue}let e=t({agent:u.agent,installedState:u.installedState,methods:u.methods}),d=e.strategy===`managed`?e.getManagedInstallerType?.({agent:u.agent,installedState:u.installedState,methods:u.methods}):void 0;if(d){let e={inspection:u,installerType:d,strategy:`grouped`};r[d].push(e);continue}i.push({inspection:u,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...r.bun,...r.npm,...r.brew,...r.cargo,...r.deno,...r.mise,...r.pip,...r.uv,...r.winget,...i],grouped:r,manual:i,skippedManualCheck:a,untrackedInPath:c,upToDate:l}}function o(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function s(t){return!t.latestVersion&&!e(t.agent,t.installedState)}const c=[`bun`,`npm`,`brew`,`cargo`,`deno`,`mise`,`pip`,`uv`,`winget`];async function l(e){let t=await r(e);return{agent:e,inspection:t,updateAvailable:o(t)}}async function u(){return f(await i(),{skipUntrackedInPath:!0})}async function d(e){let t=await r(e);return{inspection:t,plan:f([t])}}function f(e,t={}){let n=a(e,t),r=[],i=c.map(e=>p(e,n.grouped[e],r)).filter(e=>e!==void 0);return{entries:n.entries.map(e=>h(e.inspection)),grouped:i,manual:[...r,...n.manual.map(e=>h(e.inspection))],skippedManualCheck:n.skippedManualCheck,untrackedInPath:n.untrackedInPath,upToDate:n.upToDate}}function p(e,t,n){if(t.length===0)return;let r=t.map(e=>h(e.inspection)),i=r.filter(m);if(n.push(...r.filter(e=>!m(e))),i.length!==0)return{type:e,packages:i.map(e=>e.package),updates:i}}function m(e){return!!e.package?.packageName}function h(e){let n=t({agent:e.agent,installedState:e.installedState,methods:e.methods}),r=n.getManagedInstallerType?.({agent:e.agent,installedState:e.installedState,methods:e.methods});return{agent:e.agent,inspection:e,installerType:r,package:r?g(e.agent,e.installedState,e.methods,r):void 0,state:e.installedState,strategy:n.strategy}}function g(e,t,r,i){if(t?.packageName&&t.installType===i)return{packageName:t.packageName,binaryName:i===`deno`?t.binaryName:void 0,packageInstallArgs:t.packageInstallArgs,packageTargetKind:t.packageTargetKind};let a=r.find(e=>e.type===i);if(!a)return;let o=n(e,a);if(o)return{packageName:o,binaryName:a.binaryName??(i===`deno`?e.binaryName:void 0),packageInstallArgs:a.packageInstallArgs,packageTargetKind:a.packageTargetKind}}export{o as a,a as i,u as n,d as r,l as t};
@@ -1 +1 @@
1
- import{B as e,C as t,a as n,c as r,n as i,r as a,t as o,u as s,w as c}from"./color-ChvF_SAo.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-B5Ah0_tJ.mjs";async function p(e={}){let o=await c({updateChannel:e.channel}),l=t(o),u=d(),f=h(l),p=_(l);if(o.status===`up-to-date`)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`up-to-date`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(e.check||u)return o.status===`update-available`?n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`update-available`},exitCode:e.check?1:void 0,target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[],...u?[{code:`DRY_RUN`,message:`Dry run: would upgrade Quantex CLI.`}]:[]]}),m):n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,status:`check-unavailable`},error:{code:`NETWORK_ERROR`,message:`Unable to determine the latest Quantex CLI version.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(o.status===`manual-required`){let e=s(l);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:e,status:`manual-required`},error:{code:`MANUAL_ACTION_REQUIRED`,message:`Quantex CLI cannot auto-update from the current install source: ${l.installSource}.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m)}let g=await r(o);if(g.success)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`updated`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);let v=s(l,g);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:v,status:`manual-required`},error:{code:`UPGRADE_FAILED`,details:g.error?.kind?{kind:g.error.kind}:void 0,message:g.error?.message??`Failed to upgrade Quantex CLI.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...v?[{code:`MANUAL_RECOVERY`,message:`Manual recovery: ${v}`}]:[]]}),m)}function m(e){if(!e.data){e.error&&f(o.red(e.error.message));return}if(e.data.status===`up-to-date`){u(o.green(`Quantex CLI is already up to date (${e.data.currentVersion}).`)),g(e.warnings);return}if(e.data.status===`update-available`){let t=e.warnings.some(e=>e.message.includes(`Dry run`))?`Dry run: `:``;l(o.yellow(`${t}Update available for Quantex CLI: ${e.data.currentVersion} -> ${e.data.latestVersion} (${e.data.channel}).`)),g(e.warnings);return}if(e.data.status===`check-unavailable`){e.error&&l(o.yellow(e.error.message)),g(e.warnings);return}if(e.data.status===`manual-required`&&e.error?.code===`MANUAL_ACTION_REQUIRED`){l(o.yellow(e.error.message)),e.data.recoveryHint&&l(o.cyan(`Next step: ${e.data.recoveryHint}`));return}let t=e.data.latestVersion?` (${e.data.currentVersion} -> ${e.data.latestVersion})`:` (${e.data.currentVersion})`;if(u(o.cyan(`Upgrading Quantex CLI...${t}`)),!e.error){u(o.green(`Quantex CLI upgraded successfully.`)),g(e.warnings);return}f(o.red(`Failed to upgrade Quantex CLI.`)),l(o.yellow(`Reason: ${e.error.message}`));for(let t of e.warnings)l(o.cyan(t.message.replace(/^Manual recovery:/,`Next step:`)))}function h(e){return!e.latestVersion||!e.upstreamLatestVersion||e.latestVersion===e.upstreamLatestVersion||e.installSource!==`bun`&&e.installSource!==`npm`?[]:[{code:`MIRROR_LAG`,details:{installableLatestVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion},message:`The selected registry currently installs ${e.latestVersion}, while upstream npm has ${e.upstreamLatestVersion}. Retry later or set selfUpdateRegistry / QTX_SELF_UPDATE_REGISTRY to another registry if you need the upstream release now.`}]}function g(e){for(let t of e)t.code===`DRY_RUN`||t.code===`MANUAL_RECOVERY`||l(o.yellow(t.message))}function _(t){if(!t.latestVersion)return;let n=e(t.latestVersion,t.currentVersion);if(!(n===void 0||n>=0))return{code:`STALE_LATEST_VERSION`,details:{currentVersion:t.currentVersion,latestVersion:t.latestVersion},message:`The resolved latest version ${t.latestVersion} is older than the installed Quantex CLI ${t.currentVersion}. Quantex will not downgrade; retry with --refresh or --no-cache if you need a fresh check.`}}export{p as upgradeCommand};
1
+ import{B as e,C as t,a as n,c as r,n as i,r as a,t as o,u as s,w as c}from"./color-BjsL_hvq.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-W4VzwJV2.mjs";async function p(e={}){let o=await c({updateChannel:e.channel}),l=t(o),u=d(),f=h(l),p=_(l);if(o.status===`up-to-date`)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`up-to-date`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(e.check||u)return o.status===`update-available`?n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`update-available`},exitCode:e.check?1:void 0,target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[],...u?[{code:`DRY_RUN`,message:`Dry run: would upgrade Quantex CLI.`}]:[]]}),m):n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,status:`check-unavailable`},error:{code:`NETWORK_ERROR`,message:`Unable to determine the latest Quantex CLI version.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(o.status===`manual-required`){let e=s(l);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:e,status:`manual-required`},error:{code:`MANUAL_ACTION_REQUIRED`,message:`Quantex CLI cannot auto-update from the current install source: ${l.installSource}.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m)}let g=await r(o);if(g.success)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`updated`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);let v=s(l,g);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:v,status:`manual-required`},error:{code:`UPGRADE_FAILED`,details:g.error?.kind?{kind:g.error.kind}:void 0,message:g.error?.message??`Failed to upgrade Quantex CLI.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...v?[{code:`MANUAL_RECOVERY`,message:`Manual recovery: ${v}`}]:[]]}),m)}function m(e){if(!e.data){e.error&&f(o.red(e.error.message));return}if(e.data.status===`up-to-date`){u(o.green(`Quantex CLI is already up to date (${e.data.currentVersion}).`)),g(e.warnings);return}if(e.data.status===`update-available`){let t=e.warnings.some(e=>e.message.includes(`Dry run`))?`Dry run: `:``;l(o.yellow(`${t}Update available for Quantex CLI: ${e.data.currentVersion} -> ${e.data.latestVersion} (${e.data.channel}).`)),g(e.warnings);return}if(e.data.status===`check-unavailable`){e.error&&l(o.yellow(e.error.message)),g(e.warnings);return}if(e.data.status===`manual-required`&&e.error?.code===`MANUAL_ACTION_REQUIRED`){l(o.yellow(e.error.message)),e.data.recoveryHint&&l(o.cyan(`Next step: ${e.data.recoveryHint}`));return}let t=e.data.latestVersion?` (${e.data.currentVersion} -> ${e.data.latestVersion})`:` (${e.data.currentVersion})`;if(u(o.cyan(`Upgrading Quantex CLI...${t}`)),!e.error){u(o.green(`Quantex CLI upgraded successfully.`)),g(e.warnings);return}f(o.red(`Failed to upgrade Quantex CLI.`)),l(o.yellow(`Reason: ${e.error.message}`));for(let t of e.warnings)l(o.cyan(t.message.replace(/^Manual recovery:/,`Next step:`)))}function h(e){return!e.latestVersion||!e.upstreamLatestVersion||e.latestVersion===e.upstreamLatestVersion||e.installSource!==`bun`&&e.installSource!==`npm`?[]:[{code:`MIRROR_LAG`,details:{installableLatestVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion},message:`The selected registry currently installs ${e.latestVersion}, while upstream npm has ${e.upstreamLatestVersion}. Retry later or set selfUpdateRegistry / QTX_SELF_UPDATE_REGISTRY to another registry if you need the upstream release now.`}]}function g(e){for(let t of e)t.code===`DRY_RUN`||t.code===`MANUAL_RECOVERY`||l(o.yellow(t.message))}function _(t){if(!t.latestVersion)return;let n=e(t.latestVersion,t.currentVersion);if(!(n===void 0||n>=0))return{code:`STALE_LATEST_VERSION`,details:{currentVersion:t.currentVersion,latestVersion:t.latestVersion},message:`The resolved latest version ${t.latestVersion} is older than the installed Quantex CLI ${t.currentVersion}. Quantex will not downgrade; retry with --refresh or --no-cache if you need a fresh check.`}}export{p as upgradeCommand};
@@ -1 +1 @@
1
- import{lt as e}from"./color-ChvF_SAo.mjs";import t from"node:process";const n={debug:4,error:1,info:3,silent:0,warn:2};function r(e){o(`info`)&&t.stdout.write(`${e}\n`)}function i(e){o(`warn`)&&t.stdout.write(`${e}\n`)}function a(e){o(`error`)&&t.stdout.write(`${e}\n`)}function o(t){let r=e();return r.outputMode===`human`?r.quiet&&t===`info`?!1:n[r.logLevel??`info`]>=n[t]:!0}function s(){return!!e().assumeYes}function c(){return!!e().dryRun}function l(e){t.stdout.write(`${e}\n`)}export{i as a,r as i,c as n,l as o,a as r,s as t};
1
+ import{lt as e}from"./color-BjsL_hvq.mjs";import t from"node:process";const n={debug:4,error:1,info:3,silent:0,warn:2};function r(e){o(`info`)&&t.stdout.write(`${e}\n`)}function i(e){o(`warn`)&&t.stdout.write(`${e}\n`)}function a(e){o(`error`)&&t.stdout.write(`${e}\n`)}function o(t){let r=e();return r.outputMode===`human`?r.quiet&&t===`info`?!1:n[r.logLevel??`info`]>=n[t]:!0}function s(){return!!e().assumeYes}function c(){return!!e().dryRun}function l(e){t.stdout.write(`${e}\n`)}export{i as a,r as i,c as n,l as o,a as r,s as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantex-cli",
3
- "version": "0.26.0",
3
+ "version": "0.27.1",
4
4
  "description": "Agent-friendly lifecycle CLI for AI coding assistant CLIs: install, inspect, update, uninstall, run, and automate Codex, Claude Code, Gemini, Cursor, OpenCode, and more",
5
5
  "keywords": [
6
6
  "agent-cli",
@@ -1 +0,0 @@
1
- import{t as e}from"./capabilities-qsoTR0q_.mjs";export{e as capabilitiesCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./commands-Bc5FD_Iq.mjs";export{e as commandsCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./ensure-DDXjblHQ.mjs";export{e as ensureCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./inspect-C1i137bS.mjs";export{e as inspectCommand};
@@ -1 +0,0 @@
1
- import{St as e,Z as t,a as n,i as r,lt as i,n as a,r as o,t as s}from"./color-ChvF_SAo.mjs";import{c,r as l,s as u}from"./agents-CMkLsOPA.mjs";import{t as d}from"./lifecycle-errors-BtqYfS-v.mjs";import{a as f,i as p,n as m,r as h}from"./user-output-B5Ah0_tJ.mjs";async function g(e){let t=Array.isArray(e)?e:[e];if(t.length<=1)return n(await _(t[0],{emitStartedEvent:!0}),C);r({action:`install`,data:{scope:`batch`},target:{kind:`agent`},type:`started`});let s=[];for(let e of t){if(i().cancelled)break;let t=y(e,await _(e));if(s.push(t),r({action:`install`,data:t,target:{kind:`agent`,name:t.agent.name},type:`progress`}),i().cancelled)break}let c={results:s,scope:`batch`,summary:x(s)};return n(s.some(e=>!e.ok)?a({action:`install`,data:c,error:S(s),target:{kind:`agent`}}):o({action:`install`,data:c,target:{kind:`agent`}}),w)}async function _(n,r={}){if(i().cancelled)return a({action:`install`,error:{code:`CANCELLED`,message:`Install was cancelled before it could start.`},target:{kind:`agent`,name:n}});let s=await l(n);if(!s)return a({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:n},message:`Unknown agent: ${n}`},target:{kind:`agent`,name:n}});let{agent:f,inspection:p}=s;if(p.inPath){if(p.installedState)return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]});let n=e(p.methods,p.resolvedBinaryPath??p.binaryPath);if(n){if(m())return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]});v(f,r.emitStartedEvent);try{let e=await c(f,n);return e?o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}):a({action:`install`,error:{code:`CANCELLED`,message:`Install was cancelled before tracking could complete.`},target:{kind:`agent`,name:f.name}})}catch(e){if(t(e))return a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...d(e,{kind:`agent`,name:f.name})});throw e}}return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]})}if(m())return o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]});v(f,r.emitStartedEvent);let h;try{h=await u(f)}catch(e){if(t(e))return a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...d(e,{kind:`agent`,name:f.name})});throw e}return h.success?o({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}):a({action:`install`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}})}function v(e,t=!1){t&&r({action:`install`,data:{agent:{displayName:e.displayName,name:e.name}},target:{kind:`agent`,name:e.name},type:`started`})}function y(e,t){let n=t.data,r=t.warnings.map(e=>({code:e.code,message:e.message}));return{agent:n?.agent??{displayName:e,name:t.target?.name??e},changed:n?.changed??!1,error:t.error?{code:t.error.code,message:t.error.message}:void 0,input:e,installState:n?.installState,installed:n?.installed??!1,ok:t.ok,status:b(t),warnings:r}}function b(e){return e.ok?e.warnings.some(e=>e.code===`TRACKED_EXISTING_INSTALL`)?`tracked-existing-install`:e.warnings.some(e=>e.code===`UNTRACKED_EXISTING_INSTALL`)?`untracked-existing-install`:e.warnings.some(e=>e.code===`ALREADY_INSTALLED`)?`already-installed`:e.warnings.some(e=>e.code===`DRY_RUN`)?`planned`:`installed`:e.error?.code===`RESOURCE_LOCKED`?`locked`:`failed`}function x(e){let t={alreadyInstalled:0,failed:0,installed:0,locked:0,planned:0,trackedExistingInstall:0,untrackedExistingInstall:0};for(let n of e)switch(n.status){case`already-installed`:t.alreadyInstalled+=1;break;case`failed`:t.failed+=1;break;case`installed`:t.installed+=1;break;case`locked`:t.locked+=1;break;case`planned`:t.planned+=1;break;case`tracked-existing-install`:t.trackedExistingInstall+=1;break;case`untracked-existing-install`:t.untrackedExistingInstall+=1;break}return t}function S(e){let t=e.filter(e=>!e.ok),n=new Set(t.map(e=>e.error?.code));return n.size===1&&n.has(`RESOURCE_LOCKED`)?{code:`RESOURCE_LOCKED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents could not be installed because another Quantex process is already using the agent lifecycle lock.`}:{code:`INSTALL_FAILED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents failed to install.`}}function C(e){if(e.error){h(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){p(s.green(t.message));continue}if(t.code===`DRY_RUN`){f(s.cyan(t.message));continue}f(s.yellow(t.message))}return}p(s.cyan(`Installing ${e.data.agent.displayName}...`)),p(s.green(`${e.data.agent.displayName} installed successfully!`))}}function w(e){if(!e.data){e.error&&h(s.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`installed`:p(s.cyan(`Installing ${t.agent.displayName}...`)),p(s.green(`${t.agent.displayName} installed successfully!`));break;case`tracked-existing-install`:p(s.green(T(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`already-installed`:case`untracked-existing-install`:f(s.yellow(T(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`planned`:f(s.cyan(T(t.warnings,`Dry run: would install ${t.agent.displayName}.`)));break;case`locked`:f(s.yellow(t.error?.message??`Another quantex process is already installing ${t.agent.displayName}.`));break;case`failed`:h(s.red(t.error?.message??`Failed to install ${t.agent.displayName}.`));break}E(e.data.summary)}function T(e,t){return e[0]?.message??t}function E(e){let t=[e.installed?`installed ${e.installed}`:void 0,e.alreadyInstalled?`already installed ${e.alreadyInstalled}`:void 0,e.trackedExistingInstall?`tracked existing ${e.trackedExistingInstall}`:void 0,e.untrackedExistingInstall?`untracked existing ${e.untrackedExistingInstall}`:void 0,e.failed?`failed ${e.failed}`:void 0,e.locked?`locked ${e.locked}`:void 0,e.planned?`planned ${e.planned}`:void 0].filter(Boolean);t.length>0&&p(s.bold(`Summary: ${t.join(`, `)}`))}export{g as installCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./resolve-Cgwj-fj5.mjs";export{e as resolveCommand};
@@ -1 +0,0 @@
1
- import{n as e}from"./schema-Hlu23n9-.mjs";export{e as schemaCommand};