quantex-cli 0.2.0-beta.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +10 -3
  2. package/dist/{agents-Cg2x6brN.mjs → agents-bx8y3kRS.mjs} +1 -1
  3. package/dist/capabilities-C4rAD7sw.mjs +1 -0
  4. package/dist/{capabilities-Dkyd5hrV.mjs → capabilities-KKT-gyc8.mjs} +1 -1
  5. package/dist/cli.mjs +1 -1
  6. package/dist/{color-CF4ehKUl.mjs → color-BbKp9aSG.mjs} +2 -2
  7. package/dist/{commands-CKuqTEkr.mjs → commands-CJquInVH.mjs} +1 -1
  8. package/dist/commands-v1Sz-UYE.mjs +1 -0
  9. package/dist/{config-D0cPL-ix.mjs → config-D2XKUMhE.mjs} +1 -1
  10. package/dist/doctor-D59eSvXO.mjs +3 -0
  11. package/dist/ensure-B4-KmDVN.mjs +1 -0
  12. package/dist/{ensure-Cvf-8-n0.mjs → ensure-BceOwwrn.mjs} +1 -1
  13. package/dist/index.d.mts +11 -0
  14. package/dist/index.mjs +2 -2
  15. package/dist/{info-3MqHrr4N.mjs → info-DuDumnqd.mjs} +1 -1
  16. package/dist/inspect-C8CfhNED.mjs +1 -0
  17. package/dist/{inspect-BHGlz5A1.mjs → inspect-DIZiG8De.mjs} +1 -1
  18. package/dist/{install-QQpwK2rQ.mjs → install-CdmFxCHJ.mjs} +1 -1
  19. package/dist/{list-BJywaXiW.mjs → list-B-Uy3llF.mjs} +1 -1
  20. package/dist/resolve-B_IU5vbb.mjs +1 -0
  21. package/dist/resolve-CpAvaM7V.mjs +1 -0
  22. package/dist/schema-Ckf19SIa.mjs +3 -0
  23. package/dist/schema-CvjJUAJb.mjs +1 -0
  24. package/dist/{uninstall-N-5ZN8Tc.mjs → uninstall-PDslmq45.mjs} +1 -1
  25. package/dist/{update-ZiDKOhEi.mjs → update-BG44eiCz.mjs} +1 -1
  26. package/dist/{update-HZYbpJC4.mjs → update-DHOTks91.mjs} +1 -1
  27. package/dist/{upgrade-D8yzBpQE.mjs → upgrade-D9rsTwGk.mjs} +1 -1
  28. package/dist/{user-output-CD2TwTgx.mjs → user-output-DFxUPA-p.mjs} +1 -1
  29. package/package.json +5 -3
  30. package/dist/capabilities-vy9Inf27.mjs +0 -1
  31. package/dist/commands-DtcSnSaJ.mjs +0 -1
  32. package/dist/doctor-CGC_rb1Q.mjs +0 -3
  33. package/dist/ensure-CStAVrjX.mjs +0 -1
  34. package/dist/inspect-DhCrMcba.mjs +0 -1
  35. package/dist/resolve-DvNJvsuk.mjs +0 -1
  36. package/dist/resolve-IGzIxnAM.mjs +0 -1
  37. package/dist/schema-C0s9VtcC.mjs +0 -3
  38. package/dist/schema-rIhsKHEK.mjs +0 -1
package/README.md CHANGED
@@ -15,8 +15,8 @@
15
15
 
16
16
  ## 设计文档
17
17
 
18
- - [Human + Agent 双模 CLI 设计](./HUMAN_AGENT_DUAL_MODE_CLI.md)
19
- - [Human + Agent 双模 CLI Implementation Checklist / Issue Backlog](./HUMAN_AGENT_DUAL_MODE_CLI_IMPLEMENTATION_BACKLOG.md)
18
+ - [Human + Agent 双模 CLI 设计](./docs/archive/legacy-root-notes/HUMAN_AGENT_DUAL_MODE_CLI.md)
19
+ - [Human + Agent 双模 CLI Implementation Checklist / Issue Backlog](./docs/archive/legacy-root-notes/HUMAN_AGENT_DUAL_MODE_CLI_IMPLEMENTATION_BACKLOG.md)
20
20
 
21
21
  ## Project Memory
22
22
 
@@ -30,7 +30,14 @@
30
30
  - [autonomy/README.md](./autonomy/README.md)
31
31
  - [openspec/README.md](./openspec/README.md)
32
32
 
33
- 现有根目录下的设计稿、scope 文档和 backlog 文档暂时保留为迁移期参考,映射关系见 [docs/project-memory-migration.md](./docs/project-memory-migration.md)。
33
+ 迁移期遗留文档的归档位置和映射关系见 [docs/project-memory-migration.md](./docs/project-memory-migration.md)。
34
+
35
+ ## Releases
36
+
37
+ Quantex 的 canonical changelog 在 GitHub Releases:
38
+
39
+ - [GitHub Releases](https://github.com/Drswith/quantex-cli/releases)
40
+ - [docs/releases.md](./docs/releases.md)
34
41
 
35
42
  ## Agent Skill
36
43
 
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,t as s}from"./detect-FhBDsvJC.mjs";import{C as c,D as ee,E as te,F as l,H as u,N as ne,O as d,R as f,S as p,_ as re,b as ie,g as ae,h as oe,k as m,m as se,v as ce,x as h,y as g}from"./color-CF4ehKUl.mjs";import _ from"node:process";const v={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`},npm:{canInstall:!0,canLookupLatestVersion:!0,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 v[e]}function b(e){return y(e).lifecycle===`managed`}function x(e){return y(e).lifecycle}function S(e){return y(e).canUpdate}function le(e){return y(e).canUninstall}function C(e){return y(e).canLookupLatestVersion}function w(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function T(e,t){return t.packageName||e.packages?.npm||void 0}function E(e){return e?S(e.installType):!1}function D(e,t){return E(t)||!!e.selfUpdate}function ue(e){return!!e&&C(e.installType)}function de(e){return e.length>0&&e.every(e=>C(e.type))}function fe(e){return b(e.type)?`${x(e.type)}/${e.type}${w(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function pe(e){return e?b(e.installType)?`managed via ${e.installType}${w(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function me(e,t){let n=P({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function he(e,t){if(t.type===`bun`){let n=T(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=T(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function ge(e,t,n){if(t)return ue(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!de(n)))return e.packages.npm}function O(e){if(e.installedState&&b(e.installedState.installType))return e.installedState.installType;for(let t of e.methods)if(b(t.type)&&S(t.type))return t.type}const k={strategy:`managed`,canHandle:e=>!!O(e),getManagedInstallerType:e=>O(e)},A={strategy:`self-update`,canHandle:e=>!E(e.installedState)&&!!e.agent.selfUpdate},j={strategy:`manual-hint`,canHandle:()=>!0},M=[k,A,j];function N(e){return M.find(t=>t.canHandle(e))??j}function P(e){return N(e).strategy}function F(e){return D(e.agent,e.installedState)}async function I(e){let t=s(),n=typeof e==`function`?e(t):e;try{return _.platform===`win32`?await c(p([`powershell.exe`,`-Command`,n]))===0:await c(p([`sh`,`-c`,n]))===0}catch{return!1}}function L(e){return e===`cask`?[`--cask`]:[]}async function R(e,t,n){try{return await c(p([`brew`,e,...L(n),t]))===0}catch{return!1}}async function _e(e,t){return R(`install`,e,t)}async function z(e,t){return R(`upgrade`,e,t)}async function ve(e){for(let t of e)if(!await z(t.packageName,t.packageTargetKind))return!1;return!0}async function ye(e,t){return R(`uninstall`,e,t)}async function B(e,t){try{return await c(p([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function be(e){return B(`install`,e)}async function V(e){return B(`upgrade`,e)}async function xe(e){for(let t of e)if(!await V(t.packageName))return!1;return!0}async function Se(e){return B(`uninstall`,e)}const Ce={brew:{type:`brew`,isAvailable:async()=>o(),install:async(e,t)=>_e(e,t),uninstall:async(e,t)=>ye(e,t),update:async(e,t)=>z(e,t),updateMany:async e=>ve(e)},bun:{type:`bun`,isAvailable:async()=>n(),install:async e=>ce(e),uninstall:async e=>g(e),update:async(e,t,n)=>ie(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>h(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},npm:{type:`npm`,isAvailable:async()=>e(),install:async e=>se(e),uninstall:async e=>oe(e),update:async(e,t,n)=>ae(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>re(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>a(),install:async e=>be(e),uninstall:async e=>Se(e),update:async e=>V(e),updateMany:async e=>xe(e.map(e=>({packageName:e.packageName})))}};function H(e){return Ce[e]}const U={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function we(){return(await u()).defaultPackageManager}async function W(){return{npmBunUpdateStrategy:(await u()).npmBunUpdateStrategy}}async function G(e){let t=s(),n=e.platforms[t];if(!n)return[];let r=await we();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function K(e,t,n,r,i){let a=H(e);return await a.isAvailable()?r===`install`?a.install(t,n):r===`update`?a.update(t,n,{npmBunUpdateStrategy:i}):a.uninstall(t,n):!1}async function q(e,t,n,r){if(b(t.type)){let i=T(e,t);return i?K(t.type,i,t.packageTargetKind,n,r):!1}return n===`update`&&!S(t.type)||!t.command?!1:I(t.command)}async function J(e,t,n){return b(e.installType)?e.packageName?K(e.installType,e.packageName,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:I(e.command)}async function Te(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await I(e.join(` `)))return!0;return!1}async function Y(e,t){let n={agentName:e.name,installType:t.type,packageName:T(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await l(n),n}async function Ee(e){return f(U,async()=>{let t=await G(e);for(let n of t)if(await q(e,n,`install`))return{success:!0,installedState:await Y(e,n)};return{success:!1}})}async function X(e,t){return f(U,async()=>{let{npmBunUpdateStrategy:n}=await W(),r=await G(e);if(t&&await J(t,`update`,n))return await l(t),{success:!0,installedState:t};if(!t){for(let t of r)if(await q(e,t,`update`,n))return{success:!0,installedState:await Y(e,t)}}if(await Te(e))return{success:!0};if(t){for(let t of r)if(await q(e,t,`update`,n))return{success:!0,installedState:await Y(e,t)}}return{success:!1}})}async function De(e,t){return f(U,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=H(e);return await r.isAvailable()?r.updateMany(n,await W()):!1})}async function Oe(e){return f(U,async()=>{let t=await m(e.name);if(!t)return!1;let n=await J(t,`uninstall`);return n&&await ne(e.name),n})}async function Z(e){let[t,n,r]=await Promise.all([G(e),m(e.name),i(e.binaryName)]),[a,o,s]=await Promise.all([r?ee(e.binaryName,e.versionProbe):Promise.resolve(void 0),r?te(e.binaryName):Promise.resolve(void 0),ke(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:a,latestVersion:s,binaryPath:o,sourceLabel:pe(n),updateLabel:me(e,n),lifecycle:n?x(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function ke(e,t,n){let r=ge(e,t,n);if(r)return d(r)}function $(e){return t(e)}async function Ae(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function je(){return Q(r())}export{x as C,S,b as T,he as _,Q as a,C as b,Oe as c,H as d,M as f,D as g,N as h,Z as i,X as l,P as m,$ as n,G as o,F as p,Ae as r,Ee as s,je as t,De as u,fe as v,y as w,le as x,T as y};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,t as s}from"./detect-FhBDsvJC.mjs";import{C as c,D as ee,E as l,F as u,N as te,O as ne,R as d,S as f,U as p,_ as re,b as ie,g as ae,h as oe,k as m,m as se,v as ce,x as h,y as g}from"./color-BbKp9aSG.mjs";import _ from"node:process";const v={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`},npm:{canInstall:!0,canLookupLatestVersion:!0,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 v[e]}function b(e){return y(e).lifecycle===`managed`}function x(e){return y(e).lifecycle}function S(e){return y(e).canUpdate}function le(e){return y(e).canUninstall}function C(e){return y(e).canLookupLatestVersion}function w(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function T(e,t){return t.packageName||e.packages?.npm||void 0}function E(e){return e?S(e.installType):!1}function D(e,t){return E(t)||!!e.selfUpdate}function ue(e){return!!e&&C(e.installType)}function de(e){return e.length>0&&e.every(e=>C(e.type))}function fe(e){return b(e.type)?`${x(e.type)}/${e.type}${w(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function pe(e){return e?b(e.installType)?`managed via ${e.installType}${w(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function me(e,t){let n=P({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function he(e,t){if(t.type===`bun`){let n=T(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=T(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function ge(e,t,n){if(t)return ue(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!de(n)))return e.packages.npm}function O(e){if(e.installedState&&b(e.installedState.installType))return e.installedState.installType;for(let t of e.methods)if(b(t.type)&&S(t.type))return t.type}const k={strategy:`managed`,canHandle:e=>!!O(e),getManagedInstallerType:e=>O(e)},A={strategy:`self-update`,canHandle:e=>!E(e.installedState)&&!!e.agent.selfUpdate},j={strategy:`manual-hint`,canHandle:()=>!0},M=[k,A,j];function N(e){return M.find(t=>t.canHandle(e))??j}function P(e){return N(e).strategy}function F(e){return D(e.agent,e.installedState)}async function I(e){let t=s(),n=typeof e==`function`?e(t):e;try{return _.platform===`win32`?await c(f([`powershell.exe`,`-Command`,n]))===0:await c(f([`sh`,`-c`,n]))===0}catch{return!1}}function L(e){return e===`cask`?[`--cask`]:[]}async function R(e,t,n){try{return await c(f([`brew`,e,...L(n),t]))===0}catch{return!1}}async function _e(e,t){return R(`install`,e,t)}async function z(e,t){return R(`upgrade`,e,t)}async function ve(e){for(let t of e)if(!await z(t.packageName,t.packageTargetKind))return!1;return!0}async function ye(e,t){return R(`uninstall`,e,t)}async function B(e,t){try{return await c(f([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function be(e){return B(`install`,e)}async function V(e){return B(`upgrade`,e)}async function xe(e){for(let t of e)if(!await V(t.packageName))return!1;return!0}async function Se(e){return B(`uninstall`,e)}const Ce={brew:{type:`brew`,isAvailable:async()=>o(),install:async(e,t)=>_e(e,t),uninstall:async(e,t)=>ye(e,t),update:async(e,t)=>z(e,t),updateMany:async e=>ve(e)},bun:{type:`bun`,isAvailable:async()=>n(),install:async e=>ce(e),uninstall:async e=>g(e),update:async(e,t,n)=>ie(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>h(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},npm:{type:`npm`,isAvailable:async()=>e(),install:async e=>se(e),uninstall:async e=>oe(e),update:async(e,t,n)=>ae(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>re(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>a(),install:async e=>be(e),uninstall:async e=>Se(e),update:async e=>V(e),updateMany:async e=>xe(e.map(e=>({packageName:e.packageName})))}};function H(e){return Ce[e]}const U={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function we(){return(await p()).defaultPackageManager}async function W(){return{npmBunUpdateStrategy:(await p()).npmBunUpdateStrategy}}async function G(e){let t=s(),n=e.platforms[t];if(!n)return[];let r=await we();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function K(e,t,n,r,i){let a=H(e);return await a.isAvailable()?r===`install`?a.install(t,n):r===`update`?a.update(t,n,{npmBunUpdateStrategy:i}):a.uninstall(t,n):!1}async function q(e,t,n,r){if(b(t.type)){let i=T(e,t);return i?K(t.type,i,t.packageTargetKind,n,r):!1}return n===`update`&&!S(t.type)||!t.command?!1:I(t.command)}async function J(e,t,n){return b(e.installType)?e.packageName?K(e.installType,e.packageName,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:I(e.command)}async function Te(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await I(e.join(` `)))return!0;return!1}async function Y(e,t){let n={agentName:e.name,installType:t.type,packageName:T(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await u(n),n}async function Ee(e){return d(U,async()=>{let t=await G(e);for(let n of t)if(await q(e,n,`install`))return{success:!0,installedState:await Y(e,n)};return{success:!1}})}async function X(e,t){return d(U,async()=>{let{npmBunUpdateStrategy:n}=await W(),r=await G(e);if(t&&await J(t,`update`,n))return await u(t),{success:!0,installedState:t};if(!t){for(let t of r)if(await q(e,t,`update`,n))return{success:!0,installedState:await Y(e,t)}}if(await Te(e))return{success:!0};if(t){for(let t of r)if(await q(e,t,`update`,n))return{success:!0,installedState:await Y(e,t)}}return{success:!1}})}async function De(e,t){return d(U,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=H(e);return await r.isAvailable()?r.updateMany(n,await W()):!1})}async function Oe(e){return d(U,async()=>{let t=await m(e.name);if(!t)return!1;let n=await J(t,`uninstall`);return n&&await te(e.name),n})}async function Z(e){let[t,n,r]=await Promise.all([G(e),m(e.name),i(e.binaryName)]),[a,o,s]=await Promise.all([r?ee(e.binaryName,e.versionProbe):Promise.resolve(void 0),r?l(e.binaryName):Promise.resolve(void 0),ke(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:a,latestVersion:s,binaryPath:o,sourceLabel:pe(n),updateLabel:me(e,n),lifecycle:n?x(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function ke(e,t,n){let r=ge(e,t,n);if(r)return ne(r)}function $(e){return t(e)}async function Ae(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function je(){return Q(r())}export{x as C,S,b as T,he as _,Q as a,C as b,Oe as c,H as d,M as f,D as g,N as h,Z as i,X as l,P as m,$ as n,G as o,F as p,Ae as r,Ee as s,je as t,De as u,fe as v,y as w,le as x,T as y};
@@ -0,0 +1 @@
1
+ import{t as e}from"./capabilities-KKT-gyc8.mjs";export{e as capabilitiesCommand};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,l as n,o as r,r as i,t as a}from"./detect-FhBDsvJC.mjs";import{a as o,r as s,t as c,u as l}from"./color-CF4ehKUl.mjs";import u from"node:process";async function d(){let[c,d,m,h,g]=await Promise.all([t(),e(),i(),r(),l()]);return o(s({action:`capabilities`,data:{agents:n().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:g.canAutoUpdate,timeout:!0},installers:{brew:{available:m,reason:m?void 0:f(`brew`)},bun:{available:c,reason:c?void 0:f(`bun`)},npm:{available:d,reason:d?void 0:f(`npm`)},winget:{available:h,reason:h?void 0:f(`winget`)}},outputModes:[`human`,`json`,`ndjson`],platform:{arch:u.arch,os:a()}},target:{kind:`system`,name:`capabilities`}}),p)}function f(e){return e===`winget`&&u.platform!==`win32`||e===`brew`&&u.platform===`win32`?`not-on-platform`:`not-found`}function p(e){e.data&&(console.log(c.bold(`
1
+ import{a as e,i as t,l as n,o as r,r as i,t as a}from"./detect-FhBDsvJC.mjs";import{a as o,r as s,t as c,u as l}from"./color-BbKp9aSG.mjs";import u from"node:process";async function d(){let[c,d,m,h,g]=await Promise.all([t(),e(),i(),r(),l()]);return o(s({action:`capabilities`,data:{agents:n().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:g.canAutoUpdate,timeout:!0},installers:{brew:{available:m,reason:m?void 0:f(`brew`)},bun:{available:c,reason:c?void 0:f(`bun`)},npm:{available:d,reason:d?void 0:f(`npm`)},winget:{available:h,reason:h?void 0:f(`winget`)}},outputModes:[`human`,`json`,`ndjson`],platform:{arch:u.arch,os:a()}},target:{kind:`system`,name:`capabilities`}}),p)}function f(e){return e===`winget`&&u.platform!==`win32`||e===`brew`&&u.platform===`win32`?`not-on-platform`:`not-found`}function p(e){e.data&&(console.log(c.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(c.bold(`
4
4
  Installers:`)),console.log(` bun: ${m(e.data.installers.bun)}`),console.log(` npm: ${m(e.data.installers.npm)}`),console.log(` brew: ${m(e.data.installers.brew)}`),console.log(` winget: ${m(e.data.installers.winget)}`),console.log(c.bold(`
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{r as e,s as t}from"./agents-Cg2x6brN.mjs";import{c as n}from"./detect-FhBDsvJC.mjs";import{C as r,G as i,J as a,K as o,L as s,S as c,Y as l,a as u,i as d,l as f,n as p,q as m,t as h,z as g}from"./color-CF4ehKUl.mjs";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./user-output-CD2TwTgx.mjs";import{n as C,t as w}from"./errors-DCtNasuC.mjs";import T from"node:process";import{mkdir as E,readFile as D,rm as O,writeFile as k}from"node:fs/promises";import{join as A}from"node:path";import{program as j}from"commander";import M from"prompts";function N(){return A(g(),`idempotency`)}function P(e){return A(N(),`${L(e)}.json`)}async function F(e){try{let t=JSON.parse(await D(P(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await O(P(e),{force:!0});return}return t}catch{return}}async function I(e,t){await E(N(),{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 k(P(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function L(e){return e.replace(/[^\w.-]/g,`_`)}async function R(e){let t=await B(e.action,e.target);if(t)return t;let n=o().timeoutMs;if(n===void 0)return H(e,()=>e.run().then(t=>V(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{i(),d({action:e.action,data:{reason:`timeout`,timeoutMs:n},target:e.target,type:`cancelled`},{force:!0}),t(u(p({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:n},message:`Command timed out after ${n}ms.`},target:e.target}),z,{force:!0}))},n)});return await H(e,()=>Promise.race([e.run().then(t=>V(e.action,e.target,t)),t]))}finally{r&&clearTimeout(r)}}function z(e){e.error&&console.error(h.red(e.error.message))}async function B(e,t){let n=o();if(!n.idempotencyKey)return;let r=await F(n.idempotencyKey);if(!r)return;if(r.action!==e)return u(p({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}),z,{force:!0});let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return u(i,z,{force:!0}),i}async function V(e,t,n){let r=o();return r.idempotencyKey&&await I(r.idempotencyKey,{action:e,result:n,target:t}),n}async function H(e,t){let n;try{let r=new Promise(t=>{let r=n=>{i(),d({action:e.action,data:{reason:`signal`,signal:n},target:e.target,type:`cancelled`},{force:!0}),t(u(p({action:e.action,error:{code:`CANCELLED`,details:{signal:n},message:`Command cancelled by ${n}.`},target:e.target}),z,{force:!0}))},a=()=>r(`SIGINT`),o=()=>r(`SIGTERM`);T.once(`SIGINT`,a),T.once(`SIGTERM`,o),n=()=>{T.off(`SIGINT`,a),T.off(`SIGTERM`,o)}});return await Promise.race([t(),r])}finally{n?.()}}async function U(t,n,r={}){let i=await e(t);if(!i)return x(h.red(`Unknown agent: ${t}`)),w(`AGENT_NOT_FOUND`);let{agent:a,inspection:s}=i,l=r.nonInteractive?!1:o().interactive,u=r.assumeYes??S(),d=r.dryRun??y(),f=r.install??`prompt`;if(!s.inPath){if(f===`never`)return x(h.red(`${a.displayName} is not installed.`)),w(`AGENT_NOT_INSTALLED`);if(f===`if-missing`||f===`always`){if(d?b(h.cyan(`Dry run: would install ${a.displayName}.`)):v(h.cyan(`Installing ${a.displayName}...`)),!(await W(a,d)).success)return x(h.red(`Failed to install ${a.displayName}.`)),1}else if(l){if(!(u||d?{install:!0}:await M({type:`confirm`,name:`install`,message:`${a.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return _(h.yellow(`Installation cancelled.`)),1;if(d?b(h.cyan(`Dry run: would install ${a.displayName}.`)):v(h.cyan(`Installing ${a.displayName}...`)),!(await W(a,d)).success)return x(h.red(`Failed to install ${a.displayName}.`)),1}else return x(h.red(`${a.displayName} is not installed and interactive installation is disabled.`)),w(`INTERACTION_REQUIRED`)}if(d)return b(h.cyan(`Dry run: would run ${[a.binaryName,...n].join(` `)}`)),0;try{return await G(c([a.binaryName,...n]),a.displayName)}catch(e){return x(h.red(`Failed to launch ${a.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}async function W(e,n=y()){if(n)return{success:!0};try{return await t(e)}catch(t){return s(t)?(x(h.red(t.message)),{success:!1}):(x(h.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function G(e,t){let{timeoutMs:n}=o(),a,s;try{let o=new Promise(e=>{let n=n=>{i(),x(h.red(`${t} was cancelled by ${n}.`)),e(w(`CANCELLED`))},r=()=>n(`SIGINT`),o=()=>n(`SIGTERM`);T.once(`SIGINT`,r),T.once(`SIGTERM`,o),a=()=>{T.off(`SIGINT`,r),T.off(`SIGTERM`,o)}}),c=n===void 0?void 0:new Promise(e=>{s=setTimeout(()=>{i(),x(h.red(`${t} timed out after ${n}ms.`)),e(w(`TIMEOUT`))},n)});return await Promise.race([r(e),o,...c?[c]:[]])}finally{s&&clearTimeout(s),a?.()}}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(f()),j.hook(`preAction`,(e,t)=>{try{l(a(t.optsWithGlobals()))}catch(e){console.log(h.red(e instanceof Error?e.message:String(e))),T.exit(2)}}),j.hook(`postAction`,()=>{m()}),j.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-rIhsKHEK.mjs`);T.exitCode=await X({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),j.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-DtcSnSaJ.mjs`);T.exitCode=await X({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),j.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-vy9Inf27.mjs`);T.exitCode=await X({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),j.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-DhCrMcba.mjs`);T.exitCode=await X({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-DvNJvsuk.mjs`);T.exitCode=await X({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-QQpwK2rQ.mjs`);T.exitCode=await X({action:`install`,run:()=>t(e),target:{kind:`agent`,name:e}})}),j.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-CStAVrjX.mjs`);T.exitCode=await X({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(h.red(`Unknown install policy: ${i}`)),T.exitCode=2;return}let a=J(r);T.exitCode=await U(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-ZiDKOhEi.mjs`);T.exitCode=await X({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-N-5ZN8Tc.mjs`);T.exitCode=await X({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-BJywaXiW.mjs`);T.exitCode=await X({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),j.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-3MqHrr4N.mjs`);T.exitCode=await X({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-D0cPL-ix.mjs`);T.exitCode=await X({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-D8yzBpQE.mjs`);T.exitCode=await X({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-CGC_rb1Q.mjs`);T.exitCode=await X({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const K=new Set([...j.commands.map(e=>e.name()),...j.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),q=Y(T.argv.slice(2),K);if(q?.error&&(console.log(h.red(q.error)),T.exit(2)),q&&n(q.agentName)){try{l(a({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(h.red(e instanceof Error?e.message:String(e))),T.exit(2)}try{let e=await U(q.agentName,q.agentArgs,{assumeYes:q.yes,dryRun:q.dryRun,nonInteractive:q.nonInteractive});T.exit(e)}finally{m()}}j.parse();function J(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function Y(e,t){let n=T.stdin.isTTY===!1||T.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 X(e){return C(await R(e))}export{};
2
+ import{_ as e,r as t,s as n,v as r}from"./agents-bx8y3kRS.mjs";import{c as i}from"./detect-FhBDsvJC.mjs";import{B as a,C as o,J as s,K as c,L as l,S as u,X as d,Y as f,a as p,i as m,l as h,n as g,q as _,r as v,t as y}from"./color-BbKp9aSG.mjs";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./user-output-DFxUPA-p.mjs";import{n as E,t as D}from"./errors-DCtNasuC.mjs";import O from"node:process";import{mkdir as ee,readFile as k,rm as A,writeFile as j}from"node:fs/promises";import{join as M}from"node:path";import{program as N}from"commander";import P from"prompts";function F(){return M(a(),`idempotency`)}function I(e){return M(F(),`${z(e)}.json`)}async function L(e){try{let t=JSON.parse(await k(I(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await A(I(e),{force:!0});return}return t}catch{return}}async function R(e,t){await ee(F(),{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 j(I(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function z(e){return e.replace(/[^\w.-]/g,`_`)}async function B(e){let t=await H(e.action,e.target);if(t)return t;let n=_().timeoutMs;if(n===void 0)return W(e,()=>e.run().then(t=>U(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{c(),m({action:e.action,data:{reason:`timeout`,timeoutMs:n},target:e.target,type:`cancelled`},{force:!0}),t(p(g({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:n},message:`Command timed out after ${n}ms.`},target:e.target}),V,{force:!0}))},n)});return await W(e,()=>Promise.race([e.run().then(t=>U(e.action,e.target,t)),t]))}finally{r&&clearTimeout(r)}}function V(e){e.error&&console.error(y.red(e.error.message))}async function H(e,t){let n=_();if(!n.idempotencyKey)return;let r=await L(n.idempotencyKey);if(!r)return;if(r.action!==e)return p(g({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}),V,{force:!0});let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return p(i,V,{force:!0}),i}async function U(e,t,n){let r=_();return r.idempotencyKey&&await R(r.idempotencyKey,{action:e,result:n,target:t}),n}async function W(e,t){let n;try{let r=new Promise(t=>{let r=n=>{c(),m({action:e.action,data:{reason:`signal`,signal:n},target:e.target,type:`cancelled`},{force:!0}),t(p(g({action:e.action,error:{code:`CANCELLED`,details:{signal:n},message:`Command cancelled by ${n}.`},target:e.target}),V,{force:!0}))},i=()=>r(`SIGINT`),a=()=>r(`SIGTERM`);O.once(`SIGINT`,i),O.once(`SIGTERM`,a),n=()=>{O.off(`SIGINT`,i),O.off(`SIGTERM`,a)}});return await Promise.race([t(),r])}finally{n?.()}}async function G(e,n,r={}){let i=await t(e);if(!i)return q({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:a,inspection:o}=i,s=r.nonInteractive?!1:_().interactive,c=r.assumeYes??T(),l=r.dryRun??S(),d=r.install??`prompt`;if(!o.inPath){if(d===`never`)return q({agent:{binaryName:a.binaryName,displayName:a.displayName,name:a.name},errorCode:`AGENT_NOT_INSTALLED`,errorMessage:`${a.displayName} is not installed.`,execution:{args:n,installGuidance:K(a,o.methods,n),installPolicy:d,installed:!1,interactive:s,launched:!1}}),D(`AGENT_NOT_INSTALLED`);if(d===`if-missing`||d===`always`){if(l?C(y.cyan(`Dry run: would install ${a.displayName}.`)):x(y.cyan(`Installing ${a.displayName}...`)),!(await Y(a,l)).success)return w(y.red(`Failed to install ${a.displayName}.`)),1}else if(s){if(!(c||l?{install:!0}:await P({type:`confirm`,name:`install`,message:`${a.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return b(y.yellow(`Installation cancelled.`)),1;if(l?C(y.cyan(`Dry run: would install ${a.displayName}.`)):x(y.cyan(`Installing ${a.displayName}...`)),!(await Y(a,l)).success)return w(y.red(`Failed to install ${a.displayName}.`)),1}else return q({agent:{binaryName:a.binaryName,displayName:a.displayName,name:a.name},errorCode:`INTERACTION_REQUIRED`,errorMessage:`${a.displayName} is not installed and interactive installation is disabled.`,execution:{args:n,installGuidance:K(a,o.methods,n),installPolicy:d,installed:!1,interactive:s,launched:!1}}),D(`INTERACTION_REQUIRED`)}if(l)return J({agent:{binaryName:a.binaryName,displayName:a.displayName,name:a.name},execution:{args:n,installPolicy:d,installed:!0,interactive:s,launched:!1},message:`Dry run: would run ${[a.binaryName,...n].join(` `)}`}),0;try{return await X(u([a.binaryName,...n]),a.displayName)}catch(e){return w(y.red(`Failed to launch ${a.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}function K(t,n,i){return{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:n.map(n=>({command:e(t,n),label:r(n),type:n.type})).filter(e=>e.command),suggestedAction:`rerun-with-install-policy`,suggestedEnsureCommand:`quantex ensure ${t.name}`,suggestedExecCommand:[`quantex`,`exec`,t.name,`--install`,`if-missing`,`--`,...i].join(` `)}}function q(e){if(_().outputMode===`human`){w(y.red(e.errorMessage));let t=e.execution.installGuidance;t&&(C(y.dim(`Try: ${t.suggestedEnsureCommand}`)),C(y.dim(`Or: ${t.suggestedExecCommand}`)));return}p(g({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 J(e){if(_().outputMode===`human`){C(y.cyan(e.message));return}p(v({action:`exec`,data:{agent:e.agent,execution:e.execution},target:{kind:`agent`,name:e.agent.name}}),()=>{})}async function Y(e,t=S()){if(t)return{success:!0};try{return await n(e)}catch(t){return l(t)?(w(y.red(t.message)),{success:!1}):(w(y.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function X(e,t){let{timeoutMs:n}=_(),r,i;try{let a=new Promise(e=>{let n=n=>{c(),w(y.red(`${t} was cancelled by ${n}.`)),e(D(`CANCELLED`))},i=()=>n(`SIGINT`),a=()=>n(`SIGTERM`);O.once(`SIGINT`,i),O.once(`SIGTERM`,a),r=()=>{O.off(`SIGINT`,i),O.off(`SIGTERM`,a)}}),s=n===void 0?void 0:new Promise(e=>{i=setTimeout(()=>{c(),w(y.red(`${t} timed out after ${n}ms.`)),e(D(`TIMEOUT`))},n)});return await Promise.race([o(e),a,...s?[s]:[]])}finally{i&&clearTimeout(i),r?.()}}N.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(h()),N.hook(`preAction`,(e,t)=>{try{d(f(t.optsWithGlobals()))}catch(e){console.log(y.red(e instanceof Error?e.message:String(e))),O.exit(2)}}),N.hook(`postAction`,()=>{s()}),N.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-CvjJUAJb.mjs`);O.exitCode=await $({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),N.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-v1Sz-UYE.mjs`);O.exitCode=await $({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),N.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-C4rAD7sw.mjs`);O.exitCode=await $({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),N.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-C8CfhNED.mjs`);O.exitCode=await $({action:`inspect`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.command(`resolve <agent>`).description(`解析 agent 可执行入口`).action(async e=>{let{resolveCommand:t}=await import(`./resolve-B_IU5vbb.mjs`);O.exitCode=await $({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-CdmFxCHJ.mjs`);O.exitCode=await $({action:`install`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-B4-KmDVN.mjs`);O.exitCode=await $({action:`ensure`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.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=te(r);O.exitCode=await G(e,a.length>0?a:t,{install:i,nonInteractive:r.optsWithGlobals().nonInteractive})}),N.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-BG44eiCz.mjs`);O.exitCode=await $({action:`update`,run:()=>n(e,t.all??!1),target:{kind:`agent`,name:e}})}),N.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-PDslmq45.mjs`);O.exitCode=await $({action:`uninstall`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-B-Uy3llF.mjs`);O.exitCode=await $({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),N.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-DuDumnqd.mjs`);O.exitCode=await $({action:`info`,run:()=>t(e),target:{kind:`agent`,name:e}})}),N.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-D2XKUMhE.mjs`);O.exitCode=await $({action:`config`,run:()=>r(e,t,n),target:{kind:`config`,name:t}})}),N.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-D9rsTwGk.mjs`);O.exitCode=await $({action:`upgrade`,run:()=>t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1}),target:{kind:`self`,name:`quantex`}})}),N.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-D59eSvXO.mjs`);O.exitCode=await $({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const Z=new Set([...N.commands.map(e=>e.name()),...N.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),Q=ne(O.argv.slice(2),Z);if(Q?.error&&(console.log(y.red(Q.error)),O.exit(2)),Q&&i(Q.agentName)){try{d(f({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 G(Q.agentName,Q.agentArgs,{assumeYes:Q.yes,dryRun:Q.dryRun,nonInteractive:Q.nonInteractive});O.exit(e)}finally{s()}}N.parse();function te(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function ne(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 E(await B(e))}export{};
@@ -1,4 +1,4 @@
1
- import{createHash as e,randomUUID as t}from"node:crypto";import n from"node:process";import{chmod as r,mkdir as i,mkdtemp as a,readFile as o,rename as s,rm as c,stat as l,writeFile as u}from"node:fs/promises";import{basename as d,dirname as f,join as p}from"node:path";import{fileURLToPath as m,pathToFileURL as h}from"node:url";import{homedir as g}from"node:os";import{loadConfig as ee}from"c12";import{Buffer as te}from"node:buffer";import{createColors as ne,isColorSupported as re}from"picocolors";function ie(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 _,v=new Set;function y(){return _??=ue(),_}function ae(e){v=new Set,_={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function oe(){_=void 0,v=new Set}function b(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:ie(e.timeout),c=de(e.color),l=fe(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 se(){_&&(_.cancelled=!0)}function ce(){se();for(let e of v)e();v.clear()}function x(e){return v.add(e),()=>{v.delete(e)}}function le(e){let t=y();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 ue(){return b()}function de(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 fe(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 pe={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,versionCacheTtlHours:6};function S(){return p(n.env.HOME||n.env.USERPROFILE||g(),`.quantex`)}function C(){return p(S(),`config.json`)}async function w(){let{config:e}=await ee({name:`quantex`,defaults:pe,configFile:C(),jiti:{import:async(e,t)=>{if(e.endsWith(`.json`))return JSON.parse(await o(e,`utf8`));let n=await(e.startsWith(`file:`)?import(e):import(h(e).href));return t?.default?n.default??n:n}}}),t=e;return{...t,defaultPackageManager:t.defaultPackageManager===`npm`?`npm`:`bun`,networkRetries:T(t.networkRetries,2),networkTimeoutMs:T(t.networkTimeoutMs,1e4),npmBunUpdateStrategy:t.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:t.selfUpdateChannel===`beta`?`beta`:`stable`,versionCacheTtlHours:T(t.versionCacheTtlHours,6)}}function me(e){return e===`latest-major`||e===`respect-semver`}async function he(e){await i(S(),{recursive:!0}),await Bun.write(C(),`${JSON.stringify(e,null,2)}\n`)}function T(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}const E=`quantex-cli`,D=`https://github.com/Drswith/quantex-cli`,ge=`0.2.0-beta.1`;var O=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 k(e){return e instanceof O}function _e(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 p(S(),`locks`,...r,i)}async function A(e){let t=_e(e.scope);await i(f(t),{recursive:!0});try{await i(t,{recursive:!1})}catch(n){throw typeof n==`object`&&n&&`code`in n&&n.code===`EEXIST`?new O(e.resource,t):n}return async()=>{await c(t,{force:!0,recursive:!0})}}async function ve(e,t){let n=await A(e);try{return await t()}finally{await n()}}const ye={installedAgents:{},self:{}};function j(){return p(S(),`state.json`)}async function M(){return F()}async function be(e){let t=await A({resource:`state`,scope:[`state`]});try{await I(e)}finally{await t()}}async function xe(e){return(await M()).installedAgents[e]}async function Se(e){await L(t=>{t.installedAgents[e.agentName]=e})}async function Ce(e){await L(t=>{delete t.installedAgents[e]})}async function N(){return(await M()).self}async function P(e){await L(t=>{t.self.installSource=e})}async function F(){try{let e=await Bun.file(j()).json();return{installedAgents:e.installedAgents??{},self:e.self??{}}}catch{return{...ye}}}async function I(e){await i(S(),{recursive:!0}),await Bun.write(j(),`${JSON.stringify(e,null,2)}\n`)}async function L(e){let t=await A({resource:`state`,scope:[`state`]});try{let t=await F();await e(t),await I(t)}finally{await t()}}async function R(e,t){let n=await we(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function we(e,t,n=`text`){let r=await w(),i=r.versionCacheTtlHours*60*60*1e3,a=y().cacheMode,o=a===`no-cache`?{entries:{}}:await Ee(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return V(s,i),s.body;let l=await Te(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&V(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await z(o),De(c,c+i),s.body;if(!l.ok)return s&&V(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&V(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 z(o)),De(c,c+i),u}async function Te(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 Ee(){try{return JSON.parse(await o(B(),`utf8`))}catch{return{entries:{}}}}async function z(e){await i(p(S(),`cache`),{recursive:!0}),await u(B(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function B(){return p(S(),`cache`,`versions.json`)}function V(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);le({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function De(e,t){le({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}const Oe=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function ke(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{chmod as r,mkdir as i,mkdtemp as a,readFile as o,rename as s,rm as c,stat as l,writeFile as u}from"node:fs/promises";import{basename as d,dirname as f,join as p}from"node:path";import{fileURLToPath as m,pathToFileURL as h}from"node:url";import{homedir as g}from"node:os";import{loadConfig as ee}from"c12";import{Buffer as te}from"node:buffer";import{createColors as ne,isColorSupported as re}from"picocolors";function ie(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 _,v=new Set;function y(){return _??=ue(),_}function ae(e){v=new Set,_={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function oe(){_=void 0,v=new Set}function b(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:ie(e.timeout),c=de(e.color),l=fe(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 se(){_&&(_.cancelled=!0)}function ce(){se();for(let e of v)e();v.clear()}function x(e){return v.add(e),()=>{v.delete(e)}}function le(e){let t=y();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 ue(){return b()}function de(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 fe(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 pe={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,versionCacheTtlHours:6};function S(){return p(n.env.HOME||n.env.USERPROFILE||g(),`.quantex`)}function C(){return p(S(),`config.json`)}async function w(){let{config:e}=await ee({name:`quantex`,defaults:pe,configFile:C(),jiti:{import:async(e,t)=>{if(e.endsWith(`.json`))return JSON.parse(await o(e,`utf8`));let n=await(e.startsWith(`file:`)?import(e):import(h(e).href));return t?.default?n.default??n:n}}}),t=e;return{...t,defaultPackageManager:t.defaultPackageManager===`npm`?`npm`:`bun`,networkRetries:T(t.networkRetries,2),networkTimeoutMs:T(t.networkTimeoutMs,1e4),npmBunUpdateStrategy:t.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:t.selfUpdateChannel===`beta`?`beta`:`stable`,versionCacheTtlHours:T(t.versionCacheTtlHours,6)}}function me(e){return e===`latest-major`||e===`respect-semver`}async function he(e){await i(S(),{recursive:!0}),await Bun.write(C(),`${JSON.stringify(e,null,2)}\n`)}function T(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}const E=`quantex-cli`,D=`https://github.com/Drswith/quantex-cli`,ge=`0.2.0`;var O=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 k(e){return e instanceof O}function _e(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 p(S(),`locks`,...r,i)}async function A(e){let t=_e(e.scope);await i(f(t),{recursive:!0});try{await i(t,{recursive:!1})}catch(n){throw typeof n==`object`&&n&&`code`in n&&n.code===`EEXIST`?new O(e.resource,t):n}return async()=>{await c(t,{force:!0,recursive:!0})}}async function ve(e,t){let n=await A(e);try{return await t()}finally{await n()}}const ye={installedAgents:{},self:{}};function j(){return p(S(),`state.json`)}async function M(){return F()}async function be(e){let t=await A({resource:`state`,scope:[`state`]});try{await I(e)}finally{await t()}}async function xe(e){return(await M()).installedAgents[e]}async function Se(e){await L(t=>{t.installedAgents[e.agentName]=e})}async function Ce(e){await L(t=>{delete t.installedAgents[e]})}async function N(){return(await M()).self}async function P(e){await L(t=>{t.self.installSource=e})}async function F(){try{let e=await Bun.file(j()).json();return{installedAgents:e.installedAgents??{},self:e.self??{}}}catch{return{...ye}}}async function I(e){await i(S(),{recursive:!0}),await Bun.write(j(),`${JSON.stringify(e,null,2)}\n`)}async function L(e){let t=await A({resource:`state`,scope:[`state`]});try{let t=await F();await e(t),await I(t)}finally{await t()}}async function R(e,t){let n=await we(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function we(e,t,n=`text`){let r=await w(),i=r.versionCacheTtlHours*60*60*1e3,a=y().cacheMode,o=a===`no-cache`?{entries:{}}:await Ee(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return V(s,i),s.body;let l=await Te(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&V(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await z(o),De(c,c+i),s.body;if(!l.ok)return s&&V(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&V(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 z(o)),De(c,c+i),u}async function Te(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 Ee(){try{return JSON.parse(await o(B(),`utf8`))}catch{return{entries:{}}}}async function z(e){await i(p(S(),`cache`),{recursive:!0}),await u(B(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function B(){return p(S(),`cache`,`versions.json`)}function V(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);le({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function De(e,t){le({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}const Oe=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function ke(e,t){if(t)return t(e);let n=e.trim().split(`
2
2
  `)[0],r=n.match(Oe);return r?r[1]:n||void 0}async function Ae(e,t){let n=t?.command??[e,`--version`];try{let e=Bun.spawn(n,{stdout:`pipe`,stderr:`pipe`});return await e.exited,e.exitCode===0?ke(await new Response(e.stdout).text(),t?.parser):void 0}catch{return}}async function je(e,t=`latest`){try{return(await R(`https://registry.npmjs.org/${e}/${t}`,`npm:${e}:${t}`))?.version}catch{return}}async function Me(e){try{let t=n.platform===`win32`?`where`:`which`,r=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await r.exited,r.exitCode===0?(await new Response(r.stdout).text()).trim().split(`
3
3
  `)[0]:void 0}catch{return}}async function Ne(){try{return await A({resource:`self upgrade`,scope:[`self-upgrade`]})}catch(e){if(k(e))return;throw e}}async function Pe(e,t,i,o){let l;try{l=await fetch(e)}catch(t){return U(`network`,`Failed to download ${e}.`,t)}if(!l.ok)return U(`network`,`Failed to download ${e}: HTTP ${l.status}.`);let m=await a(p(f(t),`.quantex-upgrade-`)),h=p(m,d(t)),g=`${t}.bak`;try{let a=te.from(await l.arrayBuffer()),d=await Fe(t),f=Ve(a);if(f!==W(i))return U(`checksum`,`Checksum mismatch for ${e}. Expected ${W(i)}, got ${f}.`);if(await u(h,a),n.platform===`win32`)return Ie(h,t,g,m,o);await r(h,d),await c(g,{force:!0}),await s(t,g),await s(h,t);let p=await Be(t,o);return p.success?(await c(g,{force:!0}),{success:!0}):(await ze(g,t),p)}catch(e){return U(Re(e),`Failed to replace the current Quantex binary.`,e)}finally{n.platform!==`win32`&&await c(m,{recursive:!0,force:!0})}}async function Fe(e){try{return(await l(e)).mode&511}catch{return 493}}function Ie(e,t,r,i,a){try{let o=Le(e,t,r,i,n.pid,a);return Bun.spawn([`powershell.exe`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-WindowStyle`,`Hidden`,`-Command`,o],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0}).unref?.(),{success:!0}}catch(e){return U(`locked`,`Failed to schedule Windows binary replacement.`,e)}}function Le(e,t,n,r,i,a){let o=H(e),s=H(t),c=H(n),l=H(r),u=H(a??``);return[`$pidToWait = ${i}`,`$tempPath = '${o}'`,`$targetPath = '${s}'`,`$backupPath = '${c}'`,`$tempDir = '${l}'`,`$expectedVersion = '${u}'`,`while (Get-Process -Id $pidToWait -ErrorAction SilentlyContinue) { Start-Sleep -Milliseconds 200 }`,`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`,` break`,` }`,` catch {`,` Start-Sleep -Milliseconds 200`,` }`,`}`,`Move-Item -LiteralPath $tempPath -Destination $targetPath -Force`,`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`,` }`,`}`,`Remove-Item -LiteralPath $backupPath -Force -ErrorAction SilentlyContinue`,`Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`].join(`; `)}function H(e){return e.replaceAll(`'`,`''`)}function U(e,t,n){return{error:{detail:n,kind:e,message:t},success:!1}}function Re(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 ze(e,t){await c(t,{force:!0}),await s(e,t)}async function Be(e,t){if(!t)return{success:!0};try{let n=Bun.spawn([e,`--version`],{stdio:[`ignore`,`pipe`,`ignore`]}),r=n.stdout?await new Response(n.stdout).text():``,i=await n.exited;return i===0?r.includes(t)?{success:!0}:U(`verify`,`The upgraded Quantex binary reported an unexpected version during verification.`):U(`verify`,`The upgraded Quantex binary exited with code ${i} during verification.`)}catch(e){return U(`verify`,`Failed to execute the upgraded Quantex binary for verification.`,e)}}function Ve(t){return e(`sha256`).update(t).digest(`hex`)}function W(e){return e.trim().toLowerCase()}function He(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function G(e=n.execPath){if(d(He(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 Ue(e=n.execPath){let t=G(e);if(t)return`${D}/releases/latest/download/${t}`}function We(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 Ge(e){let t=await R(await Ke(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function Ke(e){if(e===`stable`)return`${D}/releases/latest/download/manifest.json`;let t=(await qe(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 qe(e){let t=Ye();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 Je(e,t=n.execPath){let r=n.platform,i=n.arch===`arm64`?`arm64`:`x64`,a=G(t);return e.assets.find(e=>e.platform===r&&e.arch===i&&(!a||e.name===a))}function Ye(){return D.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const Xe={source:`binary`,canHandle:e=>e.installSource===`binary`,getRecoveryHint:(e,t)=>{let n=t?.error?.detail&&typeof t.error.detail==`object`&&`downloadUrl`in t.error.detail?String(t.error.detail.downloadUrl):Ue(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){if(!G(e.executablePath))return{error:{kind:`unsupported`,message:`No release artifact is available for the current platform and architecture.`},installSource:e.installSource,success:!1};let t;try{t=await Ge(e.updateChannel)}catch(t){return{error:{detail:t,kind:`network`,message:`Failed to resolve the ${e.updateChannel} release manifest.`},installSource:e.installSource,success:!1}}let n=Je(t,e.executablePath);if(!n)return{error:{detail:{channel:e.updateChannel},kind:`unsupported`,message:`No binary asset is available for the current platform on the ${e.updateChannel} channel.`},installSource:e.installSource,success:!1};let r=await Pe(n.downloadUrl,e.executablePath,n.checksum,t.version);return{...!r.success&&r.error?{...r,error:{...r.error,detail:{...typeof r.error.detail==`object`&&r.error.detail?r.error.detail:{},downloadUrl:n.downloadUrl}}}:r,installSource:e.installSource,newVersion:r.success?t.version:void 0}}};function K(e,t={}){if(y().outputMode===`human`){let n=Bun.spawn(e,{...t,stdio:[`inherit`,`inherit`,`inherit`]});return{cleanup:x(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.resolve(),proc:n}}let n=Bun.spawn(e,{...t,stdio:[`ignore`,`pipe`,`pipe`]});return{cleanup:x(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.all([Ze(n.stdout),Ze(n.stderr)]).then(()=>{}),proc:n}}async function q(e){try{return await e.proc.exited,await e.outputDrained,e.proc.exitCode??1}finally{e.cleanup()}}async function Ze(e){if(!e)return;let t=await new Response(e).text();t&&n.stderr.write(t)}async function Qe(e){try{return await J([`bun`,`add`,`-g`,e],[e])}catch{return!1}}async function $e(e,t=`latest-major`,n=`latest`){try{let r=n===`latest`?e:`${e}@${n}`;return await J([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],r],[e])}catch{return!1}}async function et(e,t=`latest-major`){if(e.length===0)return!0;try{return await J([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function tt(e){try{return await q(K([`bun`,`remove`,`-g`,e]))===0}catch{return!1}}async function J(e,t){return await q(K(e))===0?nt(t):!1}async function nt(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await rt();if(!n)return!0;let r=it(n),i=t.filter(e=>r.has(e));return i.length===0?!0:await q(K([`bun`,`pm`,`-g`,`trust`,...i]))===0}async function rt(){try{let e=Bun.spawn([`bun`,`pm`,`-g`,`untrusted`],{stdio:at()}),t=await new Response(e.stdout).text();return await e.exited,e.exitCode===0?t:void 0}catch{return}}function it(e){let t=new Set;for(let n of e.split(`
4
- `)){let e=n.match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function at(){return[`ignore`,`pipe`,`ignore`]}const ot={source:`bun`,canHandle:e=>e.installSource===`bun`,getRecoveryHint:e=>`bun add -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await $e(E,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through Bun.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}};async function st(e){try{return await q(K([`npm`,`i`,`-g`,e]))===0}catch{return!1}}async function ct(e,t=`latest-major`,n=`latest`){try{return await q(K(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@${n}`]:[`npm`,`update`,`-g`,e]))===0}catch{return!1}}async function lt(e,t=`latest-major`){if(e.length===0)return!0;try{return await q(K(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e]))===0}catch{return!1}}async function ut(e){try{return await q(K([`npm`,`uninstall`,`-g`,e]))===0}catch{return!1}}const dt={source:`npm`,canHandle:e=>e.installSource===`npm`,getRecoveryHint:e=>`npm install -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await ct(E,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through npm.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}},ft={source:`source`,canHandle:e=>e.installSource===`source`||e.installSource===`unknown`,getRecoveryHint:()=>void 0,async upgrade(e){return{error:{kind:`unsupported`,message:`Install source "${e.installSource}" does not support auto-update.`},installSource:e.installSource,success:!1}}},pt=[ot,dt,Xe,ft];function Y(e){return pt.find(t=>t.canHandle(e))??ft}function mt(e,t,n=`stable`){return Y({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n})}function ht(e,t,n=`stable`,r){return r?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:mt(e,t,n).getRecoveryHint({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n},r)}function gt(e,t){return t?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:Y(e).getRecoveryHint(e,t)}const X=E,_t=`/node_modules/${X}`;async function vt(e){let t=await xt(),r=n.execPath,i=t.foundPackageJson?Q(t.packageRoot):Q(``,r),a=await bt((await N()).installSource,i),o=await w(),s=We(e?.updateChannel,o.selfUpdateChannel),c=await Ct(a,r,s);return{canAutoUpdate:Z(a),currentVersion:t.version||`0.2.0-beta.1`,executablePath:r,installSource:a,latestVersion:c,packageRoot:t.packageRoot,recommendedUpgradeCommand:Z(a)?`quantex upgrade`:void 0,updateChannel:s}}async function yt(e){let t=e??await vt(),n=await Ne();if(!n)return{error:{kind:`locked`,message:`Another qtx upgrade is already running.`},installSource:t.installSource,success:!1};try{return await Y(t).upgrade(t)}finally{await n()}}function Z(e){return e===`binary`||e===`bun`||e===`npm`}async function bt(e,t){return t!==`unknown`&&e!==t?(await P(t),t):e??t}function Q(e,t=n.execPath){let r=Tt(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(_t)?`npm`:r?`source`:Et(t)?`binary`:`unknown`}async function xt(e=import.meta.url){let t=Dt(e),n=f(t);for(;;){let e=p(n,`package.json`),t=await wt(e);if(t?.name===X)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.2.0-beta.1`};let r=f(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:p(f(t),`package.json`),packageRoot:f(t),version:ge}}function $(){return ge}function St(e,t=n.execPath){return ht(e,t)}async function Ct(e,t,n){if(e===`binary`)try{let e=await Ge(n);return Je(e,t)?e.version:void 0}catch{return}return je(X,n===`beta`?`beta`:`latest`)}async function wt(e){try{return JSON.parse(await o(e,`utf8`))}catch{return}}function Tt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function Et(e){let t=d(Tt(e));return t!==`bun`&&t!==`bun.exe`}function Dt(e){try{return m(e)}catch{return n.execPath}}function Ot(e){return Mt({...e,error:null,ok:!0})}function kt(e){return Mt({...e,ok:!1})}function At(e,t,n={}){let r=y();return r.cancelled&&!n.force||(r.outputMode===`json`?console.log(JSON.stringify(e,null,2)):r.outputMode===`ndjson`?Pt({action:e.action,data:e,target:e.target,type:`result`}):t(e)),e}function jt(e,t={}){let n=y();if(!(n.cancelled&&!t.force)&&n.outputMode===`ndjson`)return Pt(e)}function Mt(e){let t=y();return{action:e.action,data:e.data,error:e.error??null,exitCode:e.exitCode,meta:{fetchedAt:t.freshness?.fetchedAt,mode:t.outputMode,runId:t.runId,schemaVersion:`1`,source:t.freshness?.source,staleAfter:t.freshness?.staleAfter,timestamp:new Date().toISOString(),version:$()},ok:e.ok,target:e.target,warnings:e.warnings??[]}}function Nt(e){let t=y();return{action:e.action,data:e.data,meta:{fetchedAt:t.freshness?.fetchedAt,mode:`ndjson`,runId:t.runId,schemaVersion:`1`,source:t.freshness?.source,staleAfter:t.freshness?.staleAfter,timestamp:new Date().toISOString(),version:$()},target:e.target,type:e.type}}function Pt(e){let t=Nt(e);return console.log(JSON.stringify(t)),t}function Ft(){let e=y().colorMode??`auto`;return ne(e===`always`?!0:e===`never`?!1:re)}const It=new Proxy({},{get(e,t){let n=Ft(),r=n[t];return typeof r==`function`?r.bind(n):r}});export{N as A,C as B,q as C,Ae as D,Me as E,Se as F,ce as G,w as H,P as I,b as J,y as K,k as L,M,Ce as N,je as O,be as P,ve as R,K as S,Ue as T,he as U,me as V,pe as W,ae as Y,lt as _,At as a,$e as b,St as c,yt as d,ht as f,ct as g,ut as h,jt as i,j,xe as k,$ as l,st as m,kt as n,Z as o,gt as p,oe as q,Ot as r,Q as s,It as t,vt as u,Qe as v,G as w,et as x,tt as y,S as z};
4
+ `)){let e=n.match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function at(){return[`ignore`,`pipe`,`ignore`]}const ot={source:`bun`,canHandle:e=>e.installSource===`bun`,getRecoveryHint:e=>`bun add -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await $e(E,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through Bun.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}};async function st(e){try{return await q(K([`npm`,`i`,`-g`,e]))===0}catch{return!1}}async function ct(e,t=`latest-major`,n=`latest`){try{return await q(K(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@${n}`]:[`npm`,`update`,`-g`,e]))===0}catch{return!1}}async function lt(e,t=`latest-major`){if(e.length===0)return!0;try{return await q(K(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e]))===0}catch{return!1}}async function ut(e){try{return await q(K([`npm`,`uninstall`,`-g`,e]))===0}catch{return!1}}const dt={source:`npm`,canHandle:e=>e.installSource===`npm`,getRecoveryHint:e=>`npm install -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await ct(E,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through npm.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}},ft={source:`source`,canHandle:e=>e.installSource===`source`||e.installSource===`unknown`,getRecoveryHint:()=>void 0,async upgrade(e){return{error:{kind:`unsupported`,message:`Install source "${e.installSource}" does not support auto-update.`},installSource:e.installSource,success:!1}}},pt=[ot,dt,Xe,ft];function Y(e){return pt.find(t=>t.canHandle(e))??ft}function mt(e,t,n=`stable`){return Y({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n})}function ht(e,t,n=`stable`,r){return r?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:mt(e,t,n).getRecoveryHint({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n},r)}function gt(e,t){return t?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:Y(e).getRecoveryHint(e,t)}const X=E,_t=`/node_modules/${X}`;async function vt(e){let t=await xt(),r=n.execPath,i=t.foundPackageJson?Q(t.packageRoot):Q(``,r),a=await bt((await N()).installSource,i),o=await w(),s=We(e?.updateChannel,o.selfUpdateChannel),c=await Ct(a,r,s);return{canAutoUpdate:Z(a),currentVersion:t.version||`0.2.0`,executablePath:r,installSource:a,latestVersion:c,packageRoot:t.packageRoot,recommendedUpgradeCommand:Z(a)?`quantex upgrade`:void 0,updateChannel:s}}async function yt(e){let t=e??await vt(),n=await Ne();if(!n)return{error:{kind:`locked`,message:`Another qtx upgrade is already running.`},installSource:t.installSource,success:!1};try{return await Y(t).upgrade(t)}finally{await n()}}function Z(e){return e===`binary`||e===`bun`||e===`npm`}async function bt(e,t){return t!==`unknown`&&e!==t?(await P(t),t):e??t}function Q(e,t=n.execPath){let r=Tt(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(_t)?`npm`:r?`source`:Et(t)?`binary`:`unknown`}async function xt(e=import.meta.url){let t=Dt(e),n=f(t);for(;;){let e=p(n,`package.json`),t=await wt(e);if(t?.name===X)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.2.0`};let r=f(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:p(f(t),`package.json`),packageRoot:f(t),version:ge}}function $(){return ge}function St(e,t=n.execPath){return ht(e,t)}async function Ct(e,t,n){if(e===`binary`)try{let e=await Ge(n);return Je(e,t)?e.version:void 0}catch{return}return je(X,n===`beta`?`beta`:`latest`)}async function wt(e){try{return JSON.parse(await o(e,`utf8`))}catch{return}}function Tt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function Et(e){let t=d(Tt(e));return t!==`bun`&&t!==`bun.exe`}function Dt(e){try{return m(e)}catch{return n.execPath}}function Ot(e){return Mt({...e,error:null,ok:!0})}function kt(e){return Mt({...e,ok:!1})}function At(e,t,n={}){let r=y();return r.cancelled&&!n.force||(r.outputMode===`json`?console.log(JSON.stringify(e,null,2)):r.outputMode===`ndjson`?Pt({action:e.action,data:e,target:e.target,type:`result`}):t(e)),e}function jt(e,t={}){let n=y();if(!(n.cancelled&&!t.force)&&n.outputMode===`ndjson`)return Pt(e)}function Mt(e){let t=y();return{action:e.action,data:e.data,error:e.error??null,exitCode:e.exitCode,meta:{fetchedAt:t.freshness?.fetchedAt,mode:t.outputMode,runId:t.runId,schemaVersion:`1`,source:t.freshness?.source,staleAfter:t.freshness?.staleAfter,timestamp:new Date().toISOString(),version:$()},ok:e.ok,target:e.target,warnings:e.warnings??[]}}function Nt(e){let t=y();return{action:e.action,data:e.data,meta:{fetchedAt:t.freshness?.fetchedAt,mode:`ndjson`,runId:t.runId,schemaVersion:`1`,source:t.freshness?.source,staleAfter:t.freshness?.staleAfter,timestamp:new Date().toISOString(),version:$()},target:e.target,type:e.type}}function Pt(e){let t=Nt(e);return console.log(JSON.stringify(t)),t}function Ft(){let e=y().colorMode??`auto`;return ne(e===`always`?!0:e===`never`?!1:re)}const It=new Proxy({},{get(e,t){let n=Ft(),r=n[t];return typeof r==`function`?r.bind(n):r}});export{N as A,S as B,q as C,Ae as D,Me as E,Se as F,pe as G,me as H,P as I,oe as J,ce as K,k as L,M,Ce as N,je as O,be as P,ve as R,K as S,Ue as T,w as U,C as V,he as W,ae as X,b as Y,lt as _,At as a,$e as b,St as c,yt as d,ht as f,ct as g,ut as h,jt as i,j,xe as k,$ as l,st as m,kt as n,Z as o,gt as p,y as q,Ot as r,Q as s,It as t,vt as u,Qe as v,G as w,et as x,tt as y,E as z};
@@ -1,3 +1,3 @@
1
- import{a as e,r as t,t as n}from"./color-CF4ehKUl.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 an agent`},{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-BbKp9aSG.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 an agent`},{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-CJquInVH.mjs";export{e as commandsCommand};
@@ -1,3 +1,3 @@
1
- import{H as e,U as t,V as n,W as r,a as i,n as a,r as o,t as s}from"./color-CF4ehKUl.mjs";async function c(s,c,u){if(!s)return i(o({action:`config`,data:{action:`list`,config:await e()},target:{kind:`config`}}),l);switch(s){case`get`:{if(!c)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify a key`},target:{kind:`config`}}),l);let t=(await e())[c];return i(o({action:`config`,data:{action:`get`,key:c,value:typeof t==`number`||typeof t==`string`?t:void 0},target:{kind:`config`,name:c}}),l)}case`set`:{if(!c||u===void 0)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify both key and value`},target:{kind:`config`}}),l);if(c===`defaultPackageManager`&&u!==`bun`&&u!==`npm`)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`defaultPackageManager must be bun or npm`},target:{kind:`config`,name:c}}),l);if(c===`npmBunUpdateStrategy`&&!n(u))return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`npmBunUpdateStrategy must be latest-major or respect-semver`},target:{kind:`config`,name:c}}),l);if(c===`selfUpdateChannel`&&u!==`stable`&&u!==`beta`)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateChannel must be stable or beta`},target:{kind:`config`,name:c}}),l);if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(c)){let e=Number.parseInt(u,10);if(!Number.isInteger(e)||e<=0)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`${c} must be a positive integer`},target:{kind:`config`,name:c}}),l);u=`${e}`}let r={};try{r=await e()}catch{}return r[c]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(c)?Number.parseInt(u,10):u,await t(r),i(o({action:`config`,data:{action:`set`,key:c,value:r[c]},target:{kind:`config`,name:c}}),l)}case`reset`:return await t(r),i(o({action:`config`,data:{action:`reset`,config:r},target:{kind:`config`}}),l);default:return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,details:{action:s},message:`Unknown action: ${s}`},target:{kind:`config`},warnings:[{code:`AVAILABLE_ACTIONS`,message:`Available actions: get, set, reset`}]}),l)}}function l(e){if(e.error){console.log(s.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(s.bold(`
1
+ import{G as e,H as t,U as n,W as r,a as i,n as a,r as o,t as s}from"./color-BbKp9aSG.mjs";async function c(s,c,u){if(!s)return i(o({action:`config`,data:{action:`list`,config:await n()},target:{kind:`config`}}),l);switch(s){case`get`:{if(!c)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify a key`},target:{kind:`config`}}),l);let e=(await n())[c];return i(o({action:`config`,data:{action:`get`,key:c,value:typeof e==`number`||typeof e==`string`?e:void 0},target:{kind:`config`,name:c}}),l)}case`set`:{if(!c||u===void 0)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify both key and value`},target:{kind:`config`}}),l);if(c===`defaultPackageManager`&&u!==`bun`&&u!==`npm`)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`defaultPackageManager must be bun or npm`},target:{kind:`config`,name:c}}),l);if(c===`npmBunUpdateStrategy`&&!t(u))return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`npmBunUpdateStrategy must be latest-major or respect-semver`},target:{kind:`config`,name:c}}),l);if(c===`selfUpdateChannel`&&u!==`stable`&&u!==`beta`)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateChannel must be stable or beta`},target:{kind:`config`,name:c}}),l);if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(c)){let e=Number.parseInt(u,10);if(!Number.isInteger(e)||e<=0)return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`${c} must be a positive integer`},target:{kind:`config`,name:c}}),l);u=`${e}`}let e={};try{e=await n()}catch{}return e[c]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(c)?Number.parseInt(u,10):u,await r(e),i(o({action:`config`,data:{action:`set`,key:c,value:e[c]},target:{kind:`config`,name:c}}),l)}case`reset`:return await r(e),i(o({action:`config`,data:{action:`reset`,config:e},target:{kind:`config`}}),l);default:return i(a({action:`config`,error:{code:`INVALID_ARGUMENT`,details:{action:s},message:`Unknown action: ${s}`},target:{kind:`config`},warnings:[{code:`AVAILABLE_ACTIONS`,message:`Available actions: get, set, reset`}]}),l)}}function l(e){if(e.error){console.log(s.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(s.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?s.gray(`(not set)`):String(e.data.value));break;case`set`:console.log(s.green(`Set ${e.data.key} = ${e.data.value}`));break;case`reset`:console.log(s.green(`Configuration reset to defaults.`));break}}export{c as configCommand};
@@ -0,0 +1,3 @@
1
+ import{n as e,t}from"./messages-DMxGs5hh.mjs";import{t as n}from"./agents-bx8y3kRS.mjs";import{a as r,i,o as a,r as o}from"./detect-FhBDsvJC.mjs";import{a as s,p as c,r as l,t as u,u as d,z as f}from"./color-BbKp9aSG.mjs";async function p(){let u=await i(),f=await r(),p=await o(),g=await a(),_=await d(),v=_.latestVersion&&_.latestVersion!==_.currentVersion,y=await n(),b=y.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})),x=[],S=`docs/runbooks/quantex-troubleshooting.md`,C=`docs/runbooks/release-and-self-upgrade-debugging.md`;if(!u&&!f&&!p&&!g&&x.push({blocking:!0,category:`installers`,code:`NO_MANAGED_INSTALLER`,docsRef:S,message:`No managed installer found. Install bun, npm, brew, or winget before relying on managed lifecycle operations.`,severity:`warning`,subject:{kind:`system`},suggestedAction:`restore-managed-installer`,suggestedCommands:[]}),(_.installSource===`bun`&&!u||_.installSource===`npm`&&!f)&&x.push({blocking:!0,category:`self`,code:`SELF_INSTALLER_MISSING`,docsRef:C,message:`Quantex CLI is tracked as a ${_.installSource} install, but ${_.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:h(_.installSource,_.updateChannel)}),_.canAutoUpdate||x.push({blocking:!1,category:`self`,code:`SELF_AUTO_UPDATE_UNAVAILABLE`,docsRef:C,message:`Quantex CLI cannot auto-update from install source "${_.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:[]}),v&&_.recommendedUpgradeCommand){let e=c(_);x.push({blocking:!1,category:`self`,code:`SELF_UPDATE_AVAILABLE`,docsRef:C,message:e?`Quantex CLI ${_.currentVersion} is behind ${_.latestVersion}. Run ${_.recommendedUpgradeCommand} or follow: ${e}`:`Quantex CLI ${_.currentVersion} is behind ${_.latestVersion}. Run ${_.recommendedUpgradeCommand}.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`run-self-upgrade`,suggestedCommands:[_.recommendedUpgradeCommand]})}for(let n of y.filter(e=>e.inPath)){if(n.installedState||x.push({blocking:!1,category:`agent`,code:`AGENT_UNTRACKED_IN_PATH`,docsRef:S,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);x.push({blocking:!1,category:`agent`,code:`AGENT_MANUAL_UPDATE_REQUIRED`,docsRef:S,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 s(l({action:`doctor`,data:{agents:b,issues:x,installers:{brew:p,bun:u,npm:f,winget:g},self:{canAutoUpdate:_.canAutoUpdate,currentVersion:_.currentVersion,installSource:_.installSource,latestVersion:_.latestVersion,outdated:!!v,recoveryHint:v?c(_):void 0}},target:{kind:`system`,name:`doctor`}}),m)}function m(e){if(e.data){if(console.log(u.bold(`
2
+ Quantex CLI Environment Check
3
+ `)),console.log(u.bold(`Managed Installers:`)),console.log(` Bun: ${e.data.installers.bun?u.green(`available`):u.red(`not found`)}`),console.log(` npm: ${e.data.installers.npm?u.green(`available`):u.red(`not found`)}`),console.log(` brew: ${e.data.installers.brew?u.green(`available`):u.red(`not found`)}`),console.log(` winget:${e.data.installers.winget?u.green(`available`):u.red(`not found`)}`),console.log(`\n${u.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?u.green(`supported`):u.yellow(`unsupported`)}`),e.data.self.latestVersion&&console.log(` Latest: ${e.data.self.latestVersion}${e.data.self.outdated?u.yellow(` (update available)`):``}`),e.data.self.recoveryHint&&console.log(` Recovery: ${e.data.self.recoveryHint}`),console.log(`\n${u.bold(`Installed Agents:`)}`),e.data.agents.length===0)console.log(u.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?u.yellow(` (update available: ${t.latestVersion})`):``}`);if(console.log(`\n${u.bold(`Issues:`)}`),e.data.issues.length===0)console.log(u.green(` No issues found.`));else for(let t of e.data.issues)console.log(u.yellow(` - ${t.message}`)),t.suggestedCommands.length>0&&console.log(u.dim(` Next: ${t.suggestedCommands.join(` | `)}`));console.log()}}function h(e,t){let n=t===`beta`?`beta`:`latest`;return e===`bun`?[`bun add -g ${f}@${n}`]:e===`npm`?[`npm install -g ${f}@${n}`]:[]}export{p as doctorCommand};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ensure-BceOwwrn.mjs";export{e as ensureCommand};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./agents-Cg2x6brN.mjs";import{L as n,a as r,i,n as a,r as o,t as s}from"./color-CF4ehKUl.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-CD2TwTgx.mjs";async function p(s){let l=await e(s);if(!l)return r(a({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);let{agent:u,inspection:f}=l;if(f.inPath)return r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!0},target:{kind:`agent`,name:u.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${u.displayName} is already installed.`}]}),m);if(d())return r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},target:{kind:`agent`,name:u.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${u.displayName}.`}]}),m);i({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name}},target:{kind:`agent`,name:u.name},type:`started`});let p;try{p=await t(u)}catch(e){if(n(e))return r(a({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},...c(e,{kind:`agent`,name:u.name})}),m);throw e}return p.success?r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!0,installState:p.installedState?{installType:p.installedState.installType,packageName:p.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:u.name}}),m):r(a({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${u.displayName}.`},target:{kind:`agent`,name:u.name}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}if(e.data.changed){u(s.cyan(`Installing ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} is now installed.`));return}u(s.green(`${e.data.agent.displayName} is already installed.`))}}export{p as t};
1
+ import{r as e,s as t}from"./agents-bx8y3kRS.mjs";import{L as n,a as r,i,n as a,r as o,t as s}from"./color-BbKp9aSG.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-DFxUPA-p.mjs";async function p(s){let l=await e(s);if(!l)return r(a({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);let{agent:u,inspection:f}=l;if(f.inPath)return r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!0},target:{kind:`agent`,name:u.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${u.displayName} is already installed.`}]}),m);if(d())return r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},target:{kind:`agent`,name:u.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${u.displayName}.`}]}),m);i({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name}},target:{kind:`agent`,name:u.name},type:`started`});let p;try{p=await t(u)}catch(e){if(n(e))return r(a({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},...c(e,{kind:`agent`,name:u.name})}),m);throw e}return p.success?r(o({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!0,installState:p.installedState?{installType:p.installedState.installType,packageName:p.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:u.name}}),m):r(a({action:`ensure`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${u.displayName}.`},target:{kind:`agent`,name:u.name}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}if(e.data.changed){u(s.cyan(`Installing ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} is now installed.`));return}u(s.green(`${e.data.agent.displayName} is already installed.`))}}export{p as t};
package/dist/index.d.mts CHANGED
@@ -361,6 +361,17 @@ interface ResolveCommandData {
361
361
  };
362
362
  resolution: {
363
363
  binaryPath: string;
364
+ installGuidance?: {
365
+ docsRef: string;
366
+ installMethods: Array<{
367
+ command: string;
368
+ label: string;
369
+ type: string;
370
+ }>;
371
+ suggestedAction: 'ensure-agent-installed';
372
+ suggestedEnsureCommand: string;
373
+ };
374
+ installed: boolean;
364
375
  installSource: string;
365
376
  installedVersion?: string;
366
377
  lifecycle: 'managed' | 'unmanaged';
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./messages-DMxGs5hh.mjs";import{C as n,S as r,T as i,a,b as ee,c as te,d as ne,f as re,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,w as _,x as v}from"./agents-Cg2x6brN.mjs";import{_ as y,a as b,c as x,d as S,f as C,g as w,h as T,i as E,l as D,m as O,n as k,p as A,s as j,t as M,u as N}from"./detect-FhBDsvJC.mjs";import{A as P,B as F,C as I,D as L,E as R,F as z,H as B,I as V,J as H,K as U,M as W,N as G,O as K,P as q,S as J,T as Y,U as ie,Y as ae,a as oe,c as se,d as ce,f as le,j as ue,k as de,l as fe,n as pe,o as me,p as he,q as ge,r as _e,s as ve,u as ye,w as be,z as xe}from"./color-CF4ehKUl.mjs";import{t as Se}from"./capabilities-Dkyd5hrV.mjs";import{t as Ce}from"./commands-CKuqTEkr.mjs";import{t as we}from"./ensure-Cvf-8-n0.mjs";import{t as Te}from"./inspect-BHGlz5A1.mjs";import{t as Ee}from"./resolve-IGzIxnAM.mjs";import{n as De,t as Oe}from"./schema-C0s9VtcC.mjs";import{n as ke,t as Ae}from"./errors-DCtNasuC.mjs";import{a as X,i as je,n as Me,t as Ne}from"./update-HZYbpJC4.mjs";function Pe(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
2
- `)}\n`}function Fe(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 Ie(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 Le(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);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 Re(e,t){try{let n=await I(J([e,...t]));return{success:n===0,exitCode:n}}catch{return{success:!1,exitCode:1}}}export{re as agentUpdateProviders,me as canAutoUpdateSelf,ee as canLookupLatestVersionForInstallType,f as canResolveAgentUpdate,v as canUninstallInstallType,r as canUpdateInstallType,Se as capabilitiesCommand,y as claude,w as codex,Ce as commandsCommand,T as copilot,pe as createErrorResult,Ie as createReleaseManifest,_e as createSuccessResult,je as createUpdatePlan,O as cursor,ve as detectSelfInstallSource,A as droid,oe as emitCommandResult,we as ensureCommand,Re as execCommand,Pe as formatChecksums,C as gemini,j as getAgentByLookupName,x as getAgentByNameOrAlias,t as getAgentUpdateFailureHint,l as getAgentUpdateStrategy,D as getAllAgents,R as getBinaryPath,be as getBinaryReleaseAssetName,Y as getBinaryReleaseDownloadUrl,U as getCliContext,xe as getConfigDir,F as getConfigFilePath,Ae as getExitCodeForError,ke as getExitCodeForResult,n as getInstallLifecycle,de as getInstalledAgentState,L as getInstalledVersion,_ as getInstallerCapabilities,K as getLatestVersion,ne as getManagedInstaller,e as getManualAgentUpdateMessage,se as getManualSelfUpgradeCommand,d as getOrderedInstallMethods,M as getPlatform,Oe as getSchemaCatalog,P as getSelfState,le as getSelfUpgradeRecoveryHint,he as getSelfUpgradeRecoveryHintForInspection,fe as getSelfVersion,Ne as getSingleAgentUpdateStatus,ue as getStateFilePath,s as inspectAgent,a as inspectAllAgents,Te as inspectCommand,h as inspectRegisteredAgents,ye as inspectSelf,m as installAgent,k as isBinaryInPath,E as isBunAvailable,X as isInspectionUpdateAvailable,i as isManagedInstallType,b as isNpmAvailable,B as loadConfig,W as loadState,Q as normalizeRepositoryUrl,S as opencode,Z as parseBinaryTarget,Fe as parseChecksums,N as pi,Me as planAgentUpdates,G as removeInstalledAgentState,ge as resetCliContext,u as resolveAgent,p as resolveAgentInspection,o as resolveAgentUpdateProvider,H as resolveCliContext,Ee as resolveCommand,$ as resolveReleaseChannel,ie as saveConfig,q as saveState,De as schemaCommand,ae as setCliContext,z as setInstalledAgentState,V as setSelfInstallSource,te as uninstallAgent,c as updateAgent,g as updateAgentsByType,ce as upgradeSelf,Le as validateReleaseManifest};
1
+ import{n as e,t}from"./messages-DMxGs5hh.mjs";import{C as n,S as r,T as i,a,b as ee,c as te,d as ne,f as re,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,w as _,x as v}from"./agents-bx8y3kRS.mjs";import{_ as y,a as b,c as x,d as S,f as C,g as w,h as T,i as E,l as D,m as O,n as k,p as A,s as j,t as M,u as N}from"./detect-FhBDsvJC.mjs";import{A as P,B as F,C as I,D as L,E as R,F as z,I as B,J as V,M as H,N as U,O as W,P as G,S as K,T as q,U as J,V as Y,W as ie,X as ae,Y as oe,a as se,c as ce,d as le,f as ue,j as de,k as fe,l as pe,n as me,o as he,p as ge,q as _e,r as ve,s as ye,u as be,w as xe}from"./color-BbKp9aSG.mjs";import{t as Se}from"./capabilities-KKT-gyc8.mjs";import{t as Ce}from"./commands-CJquInVH.mjs";import{t as we}from"./ensure-BceOwwrn.mjs";import{t as Te}from"./inspect-DIZiG8De.mjs";import{t as Ee}from"./resolve-CpAvaM7V.mjs";import{n as De,t as Oe}from"./schema-Ckf19SIa.mjs";import{n as ke,t as Ae}from"./errors-DCtNasuC.mjs";import{a as X,i as je,n as Me,t as Ne}from"./update-DHOTks91.mjs";function Pe(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
2
+ `)}\n`}function Fe(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 Ie(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 Le(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);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 Re(e,t){try{let n=await I(K([e,...t]));return{success:n===0,exitCode:n}}catch{return{success:!1,exitCode:1}}}export{re as agentUpdateProviders,he as canAutoUpdateSelf,ee as canLookupLatestVersionForInstallType,f as canResolveAgentUpdate,v as canUninstallInstallType,r as canUpdateInstallType,Se as capabilitiesCommand,y as claude,w as codex,Ce as commandsCommand,T as copilot,me as createErrorResult,Ie as createReleaseManifest,ve as createSuccessResult,je as createUpdatePlan,O as cursor,ye as detectSelfInstallSource,A as droid,se as emitCommandResult,we as ensureCommand,Re as execCommand,Pe as formatChecksums,C as gemini,j as getAgentByLookupName,x as getAgentByNameOrAlias,t as getAgentUpdateFailureHint,l as getAgentUpdateStrategy,D as getAllAgents,R as getBinaryPath,xe as getBinaryReleaseAssetName,q as getBinaryReleaseDownloadUrl,_e as getCliContext,F as getConfigDir,Y as getConfigFilePath,Ae as getExitCodeForError,ke as getExitCodeForResult,n as getInstallLifecycle,fe as getInstalledAgentState,L as getInstalledVersion,_ as getInstallerCapabilities,W as getLatestVersion,ne as getManagedInstaller,e as getManualAgentUpdateMessage,ce as getManualSelfUpgradeCommand,d as getOrderedInstallMethods,M as getPlatform,Oe as getSchemaCatalog,P as getSelfState,ue as getSelfUpgradeRecoveryHint,ge as getSelfUpgradeRecoveryHintForInspection,pe as getSelfVersion,Ne as getSingleAgentUpdateStatus,de as getStateFilePath,s as inspectAgent,a as inspectAllAgents,Te as inspectCommand,h as inspectRegisteredAgents,be as inspectSelf,m as installAgent,k as isBinaryInPath,E as isBunAvailable,X as isInspectionUpdateAvailable,i as isManagedInstallType,b as isNpmAvailable,J as loadConfig,H as loadState,Q as normalizeRepositoryUrl,S as opencode,Z as parseBinaryTarget,Fe as parseChecksums,N as pi,Me as planAgentUpdates,U as removeInstalledAgentState,V as resetCliContext,u as resolveAgent,p as resolveAgentInspection,o as resolveAgentUpdateProvider,oe as resolveCliContext,Ee as resolveCommand,$ as resolveReleaseChannel,ie as saveConfig,G as saveState,De as schemaCommand,ae as setCliContext,z as setInstalledAgentState,B as setSelfInstallSource,te as uninstallAgent,c as updateAgent,g as updateAgentsByType,le as upgradeSelf,Le as validateReleaseManifest};
@@ -1,2 +1,2 @@
1
- import{_ as e,r as t,v as n}from"./agents-Cg2x6brN.mjs";import{a as r,n as i,r as a,t as o}from"./color-CF4ehKUl.mjs";async function s(o){let s=await t(o);if(!s)return r(i({action:`info`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return r(a({action:`info`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,description:l.description,displayName:l.displayName,installMethods:u.methods.map(t=>({command:e(l,t),label:n(t),type:t.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(o.red(e.error.message));return}if(e.data){console.log(o.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Description: ${e.data.agent.description}`),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?o.green(`Yes`):o.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(o.bold(`
1
+ import{_ as e,r as t,v as n}from"./agents-bx8y3kRS.mjs";import{a as r,n as i,r as a,t as o}from"./color-BbKp9aSG.mjs";async function s(o){let s=await t(o);if(!s)return r(i({action:`info`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return r(a({action:`info`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,description:l.description,displayName:l.displayName,installMethods:u.methods.map(t=>({command:e(l,t),label:n(t),type:t.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(o.red(e.error.message));return}if(e.data){console.log(o.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Description: ${e.data.agent.description}`),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?o.green(`Yes`):o.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(o.bold(`
2
2
  Install Methods:`));for(let t of e.data.agent.installMethods)console.log(` ${o.green(`+`)} [${t.label}] ${t.command}`);console.log()}}export{s as infoCommand};
@@ -0,0 +1 @@
1
+ import{t as e}from"./inspect-DIZiG8De.mjs";export{e as inspectCommand};
@@ -1,3 +1,3 @@
1
- import{_ as e,r as t,v as n}from"./agents-Cg2x6brN.mjs";import{a as r,n as i,r as a,t as o}from"./color-CF4ehKUl.mjs";async function s(o){let s=await t(o);if(!s)return r(i({action:`inspect`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return r(a({action:`inspect`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,description:l.description,displayName:l.displayName,installMethods:u.methods.map(t=>({command:e(l,t),label:n(t),type:t.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(o.red(e.error.message));return}if(e.data){console.log(o.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Description: ${e.data.agent.description}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Installed: ${e.data.inspection.installed?o.green(`Yes`):o.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(o.bold(`
1
+ import{_ as e,r as t,v as n}from"./agents-bx8y3kRS.mjs";import{a as r,n as i,r as a,t as o}from"./color-BbKp9aSG.mjs";async function s(o){let s=await t(o);if(!s)return r(i({action:`inspect`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),c);let{agent:l,inspection:u}=s,d=l.selfUpdate?[l.selfUpdate.command,...l.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)):[];return r(a({action:`inspect`,data:{agent:{aliases:l.lookupAliases??[],binaryName:l.binaryName,description:l.description,displayName:l.displayName,installMethods:u.methods.map(t=>({command:e(l,t),label:n(t),type:t.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(o.red(e.error.message));return}if(e.data){console.log(o.bold(`\n${e.data.agent.displayName}\n`)),console.log(` Name: ${e.data.agent.name}`),console.log(` Aliases: ${e.data.agent.aliases.join(`, `)||`-`}`),console.log(` Description: ${e.data.agent.description}`),console.log(` Package: ${e.data.agent.packageName??`-`}`),console.log(` Binary: ${e.data.agent.binaryName}`),console.log(` Installed: ${e.data.inspection.installed?o.green(`Yes`):o.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(o.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(o.bold(`
3
3
  Install Methods:`));for(let t of e.data.agent.installMethods)console.log(` ${o.green(`+`)} [${t.label}] ${t.command}`);console.log()}}export{s as t};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./agents-Cg2x6brN.mjs";import{L as n,a as r,i,n as a,r as o,t as s}from"./color-CF4ehKUl.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-CD2TwTgx.mjs";async function p(s){let l=await e(s);if(!l)return r(a({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);let{agent:u,inspection:f}=l;if(f.inPath)return r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!0},target:{kind:`agent`,name:u.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${u.displayName} is already installed.`}]}),m);if(d())return r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},target:{kind:`agent`,name:u.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${u.displayName}.`}]}),m);i({action:`install`,data:{agent:{displayName:u.displayName,name:u.name}},target:{kind:`agent`,name:u.name},type:`started`});let p;try{p=await t(u)}catch(e){if(n(e))return r(a({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},...c(e,{kind:`agent`,name:u.name})}),m);throw e}return p.success?r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!0,installState:p.installedState?{installType:p.installedState.installType,packageName:p.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:u.name}}),m):r(a({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${u.displayName}.`},target:{kind:`agent`,name:u.name}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}u(s.cyan(`Installing ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} installed successfully!`))}}export{p as installCommand};
1
+ import{r as e,s as t}from"./agents-bx8y3kRS.mjs";import{L as n,a as r,i,n as a,r as o,t as s}from"./color-BbKp9aSG.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-DFxUPA-p.mjs";async function p(s){let l=await e(s);if(!l)return r(a({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);let{agent:u,inspection:f}=l;if(f.inPath)return r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!0},target:{kind:`agent`,name:u.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${u.displayName} is already installed.`}]}),m);if(d())return r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},target:{kind:`agent`,name:u.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${u.displayName}.`}]}),m);i({action:`install`,data:{agent:{displayName:u.displayName,name:u.name}},target:{kind:`agent`,name:u.name},type:`started`});let p;try{p=await t(u)}catch(e){if(n(e))return r(a({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},...c(e,{kind:`agent`,name:u.name})}),m);throw e}return p.success?r(o({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!0,installState:p.installedState?{installType:p.installedState.installType,packageName:p.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:u.name}}),m):r(a({action:`install`,data:{agent:{displayName:u.displayName,name:u.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${u.displayName}.`},target:{kind:`agent`,name:u.name}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}u(s.cyan(`Installing ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} installed successfully!`))}}export{p as installCommand};
@@ -1,3 +1,3 @@
1
- import{t as e}from"./agents-Cg2x6brN.mjs";import{a as t,r as n,t as r}from"./color-CF4ehKUl.mjs";async function i(){return t(n({action:`list`,data:{agents:(await e()).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(r.bold(`
1
+ import{t as e}from"./agents-bx8y3kRS.mjs";import{a as t,r as n,t as r}from"./color-BbKp9aSG.mjs";async function i(){return t(n({action:`list`,data:{agents:(await e()).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(r.bold(`
2
2
  AI Agents:
3
3
  `));for(let t of e.data?.agents??[]){let e=t.displayName.padEnd(18),n=t.installed?r.green(`installed`):r.gray(`not installed`),i=t.installed?r.dim(t.installedVersion??`unknown version`):``,a=t.installed?r.cyan(t.updateLabel):``,o=t.installed?r.dim(t.sourceLabel):``;console.log(` ${e} ${n} ${i}${a?` ${a}`:``}${o?` ${o}`:``}`)}console.log()}export{i as listCommand};
@@ -0,0 +1 @@
1
+ import{t as e}from"./resolve-CpAvaM7V.mjs";export{e as resolveCommand};
@@ -0,0 +1 @@
1
+ import{_ as e,r as t,v as n}from"./agents-bx8y3kRS.mjs";import{a as r,n as i,r as a,t as o}from"./color-BbKp9aSG.mjs";async function s(o){let s=await t(o);if(!s)return r(i({action:`resolve`,error:{code:`AGENT_NOT_FOUND`,details:{input:o},message:`Unknown agent: ${o}`},target:{kind:`agent`,name:o}}),c);let{agent:l,inspection:u}=s;if(!u.inPath||!u.binaryPath){let t=u.methods.map(t=>({command:e(l,t),label:n(t),type:t.type})).filter(e=>e.command);return r(i({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:t,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:t,suggestedAction:`ensure-agent-installed`,suggestedEnsureCommand:`quantex ensure ${l.name}`},message:`${l.displayName} is not installed.`},target:{kind:`agent`,name:l.name}}),c)}return r(a({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(o.red(e.error.message));let t=e.data?.resolution.installGuidance;if(t){console.log(o.dim(`Try: ${t.suggestedEnsureCommand}`));for(let e of t.installMethods)console.log(o.dim(`Install: [${e.label}] ${e.command}`))}return}e.data&&(console.log(o.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,3 @@
1
+ import{a as e,n as t,r as n,t as r}from"./color-BbKp9aSG.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=[{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:{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`},npm:{type:`boolean`},winget:{type:`boolean`}},required:[`brew`,`bun`,`npm`,`winget`],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`}},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 s(r){let i=r?o.filter(e=>e.name===r):o;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`}}),c):e(n({action:`schema`,data:{commands:i},target:{kind:`system`,name:`schema`}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`
2
+ Quantex Schemas
3
+ `));for(let t of e.data.commands)console.log(` ${r.cyan(t.name)}`),console.log(` ${t.description}`);console.log()}}function l(){return o}export{s as n,l as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./schema-Ckf19SIa.mjs";export{e as schemaCommand};
@@ -1 +1 @@
1
- import{c as e,n as t}from"./agents-Cg2x6brN.mjs";import{L as n,a as r,k as i,n as a,r as o,t as s}from"./color-CF4ehKUl.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-CD2TwTgx.mjs";async function p(s){let l=t(s);if(!l)return r(a({action:`uninstall`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);if(d())return await i(l.name)?r(o({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}.`}]}),m):r(a({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}}),m);let u;try{u=await e(l)}catch(e){if(n(e))return r(a({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},...c(e,{kind:`agent`,name:l.name})}),m);throw e}return r(u?o({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!0},target:{kind:`agent`,name:l.name}}):a({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}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings&&e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}u(s.cyan(`Uninstalling ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} uninstalled successfully!`))}}export{p as uninstallCommand};
1
+ import{c as e,n as t}from"./agents-bx8y3kRS.mjs";import{L as n,a as r,k as i,n as a,r as o,t as s}from"./color-BbKp9aSG.mjs";import{t as c}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-DFxUPA-p.mjs";async function p(s){let l=t(s);if(!l)return r(a({action:`uninstall`,error:{code:`AGENT_NOT_FOUND`,details:{input:s},message:`Unknown agent: ${s}`},target:{kind:`agent`,name:s}}),m);if(d())return await i(l.name)?r(o({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}.`}]}),m):r(a({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}}),m);let u;try{u=await e(l)}catch(e){if(n(e))return r(a({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},...c(e,{kind:`agent`,name:l.name})}),m);throw e}return r(u?o({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!0},target:{kind:`agent`,name:l.name}}):a({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}}),m)}function m(e){if(e.error){f(s.red(e.error.message));return}if(e.data){if(e.warnings&&e.warnings.length>0){for(let t of e.warnings)l(s.yellow(t.message));return}u(s.cyan(`Uninstalling ${e.data.agent.displayName}...`)),u(s.green(`${e.data.agent.displayName} uninstalled successfully!`))}}export{p as uninstallCommand};
@@ -1 +1 @@
1
- import{n as e,t}from"./messages-DMxGs5hh.mjs";import{S as n,g as r,l as i,m as a,n as o,u as s}from"./agents-Cg2x6brN.mjs";import{L as c,a as l,i as u,n as d,r as f,t as p}from"./color-CF4ehKUl.mjs";import{a as m,i as h,n as g,r as _}from"./user-output-CD2TwTgx.mjs";import{n as v,r as y}from"./update-HZYbpJC4.mjs";async function b(e,t){if(t)return x();if(!e)return l(d({action:`update`,error:{code:`INVALID_ARGUMENT`,message:`Please specify an agent name or use --all flag`},target:{kind:`agent`}}),O);let n=o(e);return n?S(n):l(d({action:`update`,error:{code:`AGENT_NOT_FOUND`,details:{input:e},message:`Unknown agent: ${e}`},target:{kind:`agent`,name:e}}),O)}async function x(){u({action:`update`,data:{scope:`all`},target:{kind:`agent`},type:`started`});let e=await C(await v());return e.hasFailures?l(d({action:`update`,data:{results:e.results,scope:`all`},error:{code:`UPDATE_FAILED`,message:`One or more agents failed to update.`},target:{kind:`agent`}}),O):l(f({action:`update`,data:{results:e.results,scope:`all`},target:{kind:`agent`}}),O)}async function S(e){u({action:`update`,data:{agent:e.name,scope:`single`},target:{kind:`agent`,name:e.name},type:`started`});let{inspection:t,plan:n}=await y(e);if(!t.inPath)return l(d({action:`update`,error:{code:`AGENT_NOT_INSTALLED`,message:`${e.displayName} is not installed.`},target:{kind:`agent`,name:e.name}}),O);let r=await C(n),i=D(r.results);return i?l(d({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}}),O):r.hasFailures?l(d({action:`update`,data:{results:r.results,scope:`single`},error:{code:`UPDATE_FAILED`,message:`Failed to update ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),O):l(f({action:`update`,data:{results:r.results,scope:`single`},target:{kind:`agent`,name:e.name}}),O)}async function C(t){let n=[];for(let e of t.upToDate)w(n,{displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,name:e.agent.name,status:`up-to-date`});for(let r of t.skippedManualCheck)w(n,{displayName:r.agent.displayName,message:e(r.agent),name:r.agent.name,status:`manual-required`});for(let e of t.grouped){let t=await T(e.type,e.packages,e.updates);for(let e of t)w(n,e)}for(let e of t.manual)w(n,await E(e.agent,e.state,e.inspection.methods,e.inspection));return{hasFailures:n.some(e=>e.status===`failed`||e.status===`locked`),results:n}}function w(e,t){e.push(t),u({action:`update`,data:t,target:{kind:`agent`,name:t.name},type:`progress`})}async function T(e,t,n){if(n.length===0)return[];if(g())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{return await s(e,t)?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})):await Promise.all(n.map(({agent:e,inspection:t,state:n})=>E(e,n,t.methods,t)))}catch(t){if(!c(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 E(o,s,l,u){let d=l??u?.methods??[],f=a({agent:o,installedState:s,methods:d}),p=u?.installedVersion,m=u?.latestVersion;if(f===`manual-hint`&&!r(o,s)&&!d.some(e=>n(e.type)))return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:e(o),name:o.name,status:`manual-required`,strategy:f};if(g())return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:`Dry run: would update ${o.displayName}.`,name:o.name,status:`planned`,strategy:f};let h;try{h=await i(o,s)}catch(e){if(c(e))return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:e.message,name:o.name,resource:e.resource,status:`locked`,strategy:f};throw e}return h.success?{displayName:o.displayName,installedVersion:p,latestVersion:m,name:o.name,status:`updated`,strategy:f}:{displayName:o.displayName,hint:t(o,f),installedVersion:p,latestVersion:m,name:o.name,status:`failed`,strategy:f}}function D(e){if(e.length===1)return e[0]?.status===`locked`?e[0]:void 0}function O(e){if(!e.data){e.error&&_(p.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`up-to-date`:h(p.green(`${t.displayName} is up to date (${t.installedVersion??`unknown`})`));break;case`manual-required`:m(p.yellow(`${t.displayName}: manual action required.`)),t.message&&m(p.cyan(`Next step: ${t.message}`));break;case`planned`:m(p.cyan(`Would update ${t.displayName}${t.strategy?` via ${t.strategy}`:``}${k(t.installedVersion,t.latestVersion)}`));break;case`updated`:h(p.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${k(t.installedVersion,t.latestVersion)}`)),h(p.green(`${t.displayName} updated successfully!`));break;case`failed`:h(p.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${k(t.installedVersion,t.latestVersion)}`)),_(p.red(`Failed to update ${t.displayName}.`)),t.hint&&m(p.cyan(`Next step: ${t.hint}`));break;case`locked`:m(p.yellow(t.message??`Another quantex process is already updating ${t.displayName}.`));break}e.data.results.length>1&&A(e.data.results),!e.data.results.length&&e.error&&_(p.red(e.error.message))}function k(e,t){return e?` (${e} -> ${t??`latest`})`:``}function A(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&&h(p.bold(`Summary: ${n.join(`, `)}`))}export{b as updateCommand};
1
+ import{n as e,t}from"./messages-DMxGs5hh.mjs";import{S as n,g as r,l as i,m as a,n as o,u as s}from"./agents-bx8y3kRS.mjs";import{L as c,a as l,i as u,n as d,r as f,t as p}from"./color-BbKp9aSG.mjs";import{a as m,i as h,n as g,r as _}from"./user-output-DFxUPA-p.mjs";import{n as v,r as y}from"./update-DHOTks91.mjs";async function b(e,t){if(t)return x();if(!e)return l(d({action:`update`,error:{code:`INVALID_ARGUMENT`,message:`Please specify an agent name or use --all flag`},target:{kind:`agent`}}),O);let n=o(e);return n?S(n):l(d({action:`update`,error:{code:`AGENT_NOT_FOUND`,details:{input:e},message:`Unknown agent: ${e}`},target:{kind:`agent`,name:e}}),O)}async function x(){u({action:`update`,data:{scope:`all`},target:{kind:`agent`},type:`started`});let e=await C(await v());return e.hasFailures?l(d({action:`update`,data:{results:e.results,scope:`all`},error:{code:`UPDATE_FAILED`,message:`One or more agents failed to update.`},target:{kind:`agent`}}),O):l(f({action:`update`,data:{results:e.results,scope:`all`},target:{kind:`agent`}}),O)}async function S(e){u({action:`update`,data:{agent:e.name,scope:`single`},target:{kind:`agent`,name:e.name},type:`started`});let{inspection:t,plan:n}=await y(e);if(!t.inPath)return l(d({action:`update`,error:{code:`AGENT_NOT_INSTALLED`,message:`${e.displayName} is not installed.`},target:{kind:`agent`,name:e.name}}),O);let r=await C(n),i=D(r.results);return i?l(d({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}}),O):r.hasFailures?l(d({action:`update`,data:{results:r.results,scope:`single`},error:{code:`UPDATE_FAILED`,message:`Failed to update ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),O):l(f({action:`update`,data:{results:r.results,scope:`single`},target:{kind:`agent`,name:e.name}}),O)}async function C(t){let n=[];for(let e of t.upToDate)w(n,{displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,name:e.agent.name,status:`up-to-date`});for(let r of t.skippedManualCheck)w(n,{displayName:r.agent.displayName,message:e(r.agent),name:r.agent.name,status:`manual-required`});for(let e of t.grouped){let t=await T(e.type,e.packages,e.updates);for(let e of t)w(n,e)}for(let e of t.manual)w(n,await E(e.agent,e.state,e.inspection.methods,e.inspection));return{hasFailures:n.some(e=>e.status===`failed`||e.status===`locked`),results:n}}function w(e,t){e.push(t),u({action:`update`,data:t,target:{kind:`agent`,name:t.name},type:`progress`})}async function T(e,t,n){if(n.length===0)return[];if(g())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{return await s(e,t)?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})):await Promise.all(n.map(({agent:e,inspection:t,state:n})=>E(e,n,t.methods,t)))}catch(t){if(!c(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 E(o,s,l,u){let d=l??u?.methods??[],f=a({agent:o,installedState:s,methods:d}),p=u?.installedVersion,m=u?.latestVersion;if(f===`manual-hint`&&!r(o,s)&&!d.some(e=>n(e.type)))return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:e(o),name:o.name,status:`manual-required`,strategy:f};if(g())return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:`Dry run: would update ${o.displayName}.`,name:o.name,status:`planned`,strategy:f};let h;try{h=await i(o,s)}catch(e){if(c(e))return{displayName:o.displayName,installedVersion:p,latestVersion:m,message:e.message,name:o.name,resource:e.resource,status:`locked`,strategy:f};throw e}return h.success?{displayName:o.displayName,installedVersion:p,latestVersion:m,name:o.name,status:`updated`,strategy:f}:{displayName:o.displayName,hint:t(o,f),installedVersion:p,latestVersion:m,name:o.name,status:`failed`,strategy:f}}function D(e){if(e.length===1)return e[0]?.status===`locked`?e[0]:void 0}function O(e){if(!e.data){e.error&&_(p.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`up-to-date`:h(p.green(`${t.displayName} is up to date (${t.installedVersion??`unknown`})`));break;case`manual-required`:m(p.yellow(`${t.displayName}: manual action required.`)),t.message&&m(p.cyan(`Next step: ${t.message}`));break;case`planned`:m(p.cyan(`Would update ${t.displayName}${t.strategy?` via ${t.strategy}`:``}${k(t.installedVersion,t.latestVersion)}`));break;case`updated`:h(p.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${k(t.installedVersion,t.latestVersion)}`)),h(p.green(`${t.displayName} updated successfully!`));break;case`failed`:h(p.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${k(t.installedVersion,t.latestVersion)}`)),_(p.red(`Failed to update ${t.displayName}.`)),t.hint&&m(p.cyan(`Next step: ${t.hint}`));break;case`locked`:m(p.yellow(t.message??`Another quantex process is already updating ${t.displayName}.`));break}e.data.results.length>1&&A(e.data.results),!e.data.results.length&&e.error&&_(p.red(e.error.message))}function k(e,t){return e?` (${e} -> ${t??`latest`})`:``}function A(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&&h(p.bold(`Summary: ${n.join(`, `)}`))}export{b as updateCommand};
@@ -1 +1 @@
1
- import{g as e,h as t,i as n,t as r,y as i}from"./agents-Cg2x6brN.mjs";function a(e){let n={bun:[],npm:[],brew:[],winget:[]},r=[],i=[],a=[];for(let c of e){if(!c.inPath)continue;if(s(c)){i.push(c);continue}if(!o(c)){a.push(c);continue}let e=t({agent:c.agent,installedState:c.installedState,methods:c.methods}),l=e.strategy===`managed`?e.getManagedInstallerType?.({agent:c.agent,installedState:c.installedState,methods:c.methods}):void 0;if(l){let e={inspection:c,installerType:l,strategy:`grouped`};n[l].push(e);continue}r.push({inspection:c,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...n.bun,...n.npm,...n.brew,...n.winget,...r],grouped:n,manual:r,skippedManualCheck:i,upToDate:a}}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`,`winget`];async function l(e){let t=await n(e);return{agent:e,inspection:t,updateAvailable:o(t)}}async function u(){return f(await r())}async function d(e){let t=await n(e);return{inspection:t,plan:f([t])}}function f(e){let t=a(e),n=c.map(e=>p(e,t.grouped[e])).filter(e=>e!==void 0);return{entries:t.entries.map(e=>m(e.inspection)),grouped:n,manual:t.manual.map(e=>m(e.inspection)),skippedManualCheck:t.skippedManualCheck,upToDate:t.upToDate}}function p(e,t){if(t.length===0)return;let n=t.map(e=>m(e.inspection));return{type:e,packages:n.flatMap(e=>e.package?.packageName?[e.package]:[]),updates:n}}function m(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?h(e.agent,e.installedState,e.methods,r):void 0,state:e.installedState,strategy:n.strategy}}function h(e,t,n,r){if(t?.packageName&&t.installType===r)return{packageName:t.packageName,packageTargetKind:t.packageTargetKind};let a=n.find(e=>e.type===r);if(!a)return;let o=i(e,a);if(o)return{packageName:o,packageTargetKind:a.packageTargetKind}}export{o as a,a as i,u as n,d as r,l as t};
1
+ import{g as e,h as t,i as n,t as r,y as i}from"./agents-bx8y3kRS.mjs";function a(e){let n={bun:[],npm:[],brew:[],winget:[]},r=[],i=[],a=[];for(let c of e){if(!c.inPath)continue;if(s(c)){i.push(c);continue}if(!o(c)){a.push(c);continue}let e=t({agent:c.agent,installedState:c.installedState,methods:c.methods}),l=e.strategy===`managed`?e.getManagedInstallerType?.({agent:c.agent,installedState:c.installedState,methods:c.methods}):void 0;if(l){let e={inspection:c,installerType:l,strategy:`grouped`};n[l].push(e);continue}r.push({inspection:c,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...n.bun,...n.npm,...n.brew,...n.winget,...r],grouped:n,manual:r,skippedManualCheck:i,upToDate:a}}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`,`winget`];async function l(e){let t=await n(e);return{agent:e,inspection:t,updateAvailable:o(t)}}async function u(){return f(await r())}async function d(e){let t=await n(e);return{inspection:t,plan:f([t])}}function f(e){let t=a(e),n=c.map(e=>p(e,t.grouped[e])).filter(e=>e!==void 0);return{entries:t.entries.map(e=>m(e.inspection)),grouped:n,manual:t.manual.map(e=>m(e.inspection)),skippedManualCheck:t.skippedManualCheck,upToDate:t.upToDate}}function p(e,t){if(t.length===0)return;let n=t.map(e=>m(e.inspection));return{type:e,packages:n.flatMap(e=>e.package?.packageName?[e.package]:[]),updates:n}}function m(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?h(e.agent,e.installedState,e.methods,r):void 0,state:e.installedState,strategy:n.strategy}}function h(e,t,n,r){if(t?.packageName&&t.installType===r)return{packageName:t.packageName,packageTargetKind:t.packageTargetKind};let a=n.find(e=>e.type===r);if(!a)return;let o=i(e,a);if(o)return{packageName:o,packageTargetKind:a.packageTargetKind}}export{o as a,a as i,u as n,d as r,l as t};
@@ -1 +1 @@
1
- import{a as e,d as t,n,p as r,r as i,t as a,u as o}from"./color-CF4ehKUl.mjs";import{a as s,i as c,n as l,r as u}from"./user-output-CD2TwTgx.mjs";async function d(a={}){let s=await o({updateChannel:a.channel}),c=l();if(s.latestVersion&&s.latestVersion===s.currentVersion)return e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`up-to-date`},target:{kind:`self`,name:`quantex`}}),f);if(a.check||c)return s.latestVersion?e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`update-available`},exitCode:a.check?1:void 0,target:{kind:`self`,name:`quantex`},warnings:c?[{code:`DRY_RUN`,message:`Dry run: would upgrade Quantex CLI.`}]:[]}),f):e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,status:`check-unavailable`},error:{code:`NETWORK_ERROR`,message:`Unable to determine the latest Quantex CLI version.`},target:{kind:`self`,name:`quantex`}}),f);if(!s.canAutoUpdate){let t=r(s);return e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,recoveryHint:t,status:`manual-required`},error:{code:`MANUAL_ACTION_REQUIRED`,message:`Quantex CLI cannot auto-update from the current install source: ${s.installSource}.`},target:{kind:`self`,name:`quantex`}}),f)}let u=await t(s);if(u.success)return e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`updated`},target:{kind:`self`,name:`quantex`}}),f);let d=r(s,u);return e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,recoveryHint:d,status:`manual-required`},error:{code:`UPGRADE_FAILED`,details:u.error?.kind?{kind:u.error.kind}:void 0,message:u.error?.message??`Failed to upgrade Quantex CLI.`},target:{kind:`self`,name:`quantex`},warnings:d?[{code:`MANUAL_RECOVERY`,message:`Manual recovery: ${d}`}]:[]}),f)}function f(e){if(!e.data){e.error&&u(a.red(e.error.message));return}if(e.data.status===`up-to-date`){c(a.green(`Quantex CLI is already up to date (${e.data.currentVersion}).`));return}if(e.data.status===`update-available`){let t=e.warnings.some(e=>e.message.includes(`Dry run`))?`Dry run: `:``;s(a.yellow(`${t}Update available for Quantex CLI: ${e.data.currentVersion} -> ${e.data.latestVersion} (${e.data.channel}).`));return}if(e.data.status===`check-unavailable`){e.error&&s(a.yellow(e.error.message));return}if(e.data.status===`manual-required`&&e.error?.code===`MANUAL_ACTION_REQUIRED`){s(a.yellow(e.error.message)),e.data.recoveryHint&&s(a.cyan(`Next step: ${e.data.recoveryHint}`));return}let t=e.data.latestVersion?` (${e.data.currentVersion} -> ${e.data.latestVersion})`:` (${e.data.currentVersion})`;if(c(a.cyan(`Upgrading Quantex CLI...${t}`)),!e.error){c(a.green(`Quantex CLI upgraded successfully.`));return}u(a.red(`Failed to upgrade Quantex CLI.`)),s(a.yellow(`Reason: ${e.error.message}`));for(let t of e.warnings)s(a.cyan(t.message.replace(/^Manual recovery:/,`Next step:`)))}export{d as upgradeCommand};
1
+ import{a as e,d as t,n,p as r,r as i,t as a,u as o}from"./color-BbKp9aSG.mjs";import{a as s,i as c,n as l,r as u}from"./user-output-DFxUPA-p.mjs";async function d(a={}){let s=await o({updateChannel:a.channel}),c=l();if(s.latestVersion&&s.latestVersion===s.currentVersion)return e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`up-to-date`},target:{kind:`self`,name:`quantex`}}),f);if(a.check||c)return s.latestVersion?e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`update-available`},exitCode:a.check?1:void 0,target:{kind:`self`,name:`quantex`},warnings:c?[{code:`DRY_RUN`,message:`Dry run: would upgrade Quantex CLI.`}]:[]}),f):e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,status:`check-unavailable`},error:{code:`NETWORK_ERROR`,message:`Unable to determine the latest Quantex CLI version.`},target:{kind:`self`,name:`quantex`}}),f);if(!s.canAutoUpdate){let t=r(s);return e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,recoveryHint:t,status:`manual-required`},error:{code:`MANUAL_ACTION_REQUIRED`,message:`Quantex CLI cannot auto-update from the current install source: ${s.installSource}.`},target:{kind:`self`,name:`quantex`}}),f)}let u=await t(s);if(u.success)return e(i({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,status:`updated`},target:{kind:`self`,name:`quantex`}}),f);let d=r(s,u);return e(n({action:`upgrade`,data:{canAutoUpdate:s.canAutoUpdate,channel:s.updateChannel,currentVersion:s.currentVersion,installSource:s.installSource,latestVersion:s.latestVersion,recoveryHint:d,status:`manual-required`},error:{code:`UPGRADE_FAILED`,details:u.error?.kind?{kind:u.error.kind}:void 0,message:u.error?.message??`Failed to upgrade Quantex CLI.`},target:{kind:`self`,name:`quantex`},warnings:d?[{code:`MANUAL_RECOVERY`,message:`Manual recovery: ${d}`}]:[]}),f)}function f(e){if(!e.data){e.error&&u(a.red(e.error.message));return}if(e.data.status===`up-to-date`){c(a.green(`Quantex CLI is already up to date (${e.data.currentVersion}).`));return}if(e.data.status===`update-available`){let t=e.warnings.some(e=>e.message.includes(`Dry run`))?`Dry run: `:``;s(a.yellow(`${t}Update available for Quantex CLI: ${e.data.currentVersion} -> ${e.data.latestVersion} (${e.data.channel}).`));return}if(e.data.status===`check-unavailable`){e.error&&s(a.yellow(e.error.message));return}if(e.data.status===`manual-required`&&e.error?.code===`MANUAL_ACTION_REQUIRED`){s(a.yellow(e.error.message)),e.data.recoveryHint&&s(a.cyan(`Next step: ${e.data.recoveryHint}`));return}let t=e.data.latestVersion?` (${e.data.currentVersion} -> ${e.data.latestVersion})`:` (${e.data.currentVersion})`;if(c(a.cyan(`Upgrading Quantex CLI...${t}`)),!e.error){c(a.green(`Quantex CLI upgraded successfully.`));return}u(a.red(`Failed to upgrade Quantex CLI.`)),s(a.yellow(`Reason: ${e.error.message}`));for(let t of e.warnings)s(a.cyan(t.message.replace(/^Manual recovery:/,`Next step:`)))}export{d as upgradeCommand};
@@ -1 +1 @@
1
- import{K as e}from"./color-CF4ehKUl.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{q as e}from"./color-BbKp9aSG.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,7 +1,7 @@
1
1
  {
2
2
  "name": "quantex-cli",
3
3
  "type": "module",
4
- "version": "0.2.0-beta.1",
4
+ "version": "0.2.0",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "description": "统一的 AI Agent CLI 管理工具,支持安装、更新、卸载、查询、快捷启动主流 AI 编程助手",
7
7
  "author": "Drswith <drswith@outlook.com>",
@@ -39,7 +39,7 @@
39
39
  "lint": "eslint",
40
40
  "prepublishOnly": "bun run build",
41
41
  "postinstall": "node scripts/postinstall.cjs",
42
- "release": "bumpp",
42
+ "release:ci": "semantic-release",
43
43
  "release:artifacts": "bun run scripts/write-release-checksums.ts && bun run scripts/generate-release-manifest.ts && bun run scripts/verify-release-artifacts.ts",
44
44
  "release:smoke": "bun run scripts/verify-release-smoke.ts",
45
45
  "task:new": "bun run scripts/new-task.ts",
@@ -57,12 +57,14 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@antfu/eslint-config": "^6.6.1",
60
+ "@semantic-release/exec": "^7.1.0",
61
+ "@semantic-release/npm": "^13.1.5",
60
62
  "@types/bun": "^1.3.11",
61
63
  "@types/node": "^25.0.1",
62
64
  "@types/prompts": "^2.4.9",
63
- "bumpp": "^10.3.2",
64
65
  "eslint": "^9.39.2",
65
66
  "lint-staged": "^16.2.7",
67
+ "semantic-release": "^25.0.3",
66
68
  "simple-git-hooks": "^2.13.1",
67
69
  "tsdown": "^0.21.7",
68
70
  "typescript": "^5.9.3",
@@ -1 +0,0 @@
1
- import{t as e}from"./capabilities-Dkyd5hrV.mjs";export{e as capabilitiesCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./commands-CKuqTEkr.mjs";export{e as commandsCommand};
@@ -1,3 +0,0 @@
1
- import{n as e,t}from"./messages-DMxGs5hh.mjs";import{t as n}from"./agents-Cg2x6brN.mjs";import{a as r,i,o as a,r as o}from"./detect-FhBDsvJC.mjs";import{a as s,p as c,r as l,t as u,u as d}from"./color-CF4ehKUl.mjs";async function f(){let u=await i(),f=await r(),m=await o(),h=await a(),g=await d(),_=g.latestVersion&&g.latestVersion!==g.currentVersion,v=await n(),y=v.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})),b=[];if(!u&&!f&&!m&&!h&&b.push({code:`NO_MANAGED_INSTALLER`,message:`No managed installer found. Install bun, npm, brew, or winget before relying on managed lifecycle operations.`,severity:`warning`}),(g.installSource===`bun`&&!u||g.installSource===`npm`&&!f)&&b.push({code:`SELF_INSTALLER_MISSING`,message:`Quantex CLI is tracked as a ${g.installSource} install, but ${g.installSource} is not available in PATH. Reinstall that package manager or reinstall Quantex from a supported source.`,severity:`warning`}),g.canAutoUpdate||b.push({code:`SELF_AUTO_UPDATE_UNAVAILABLE`,message:`Quantex CLI cannot auto-update from install source "${g.installSource}". Reinstall via bun, npm, or the standalone binary if you want \`quantex upgrade\` support.`,severity:`warning`}),_&&g.recommendedUpgradeCommand){let e=c(g);b.push({code:`SELF_UPDATE_AVAILABLE`,message:e?`Quantex CLI ${g.currentVersion} is behind ${g.latestVersion}. Run ${g.recommendedUpgradeCommand} or follow: ${e}`:`Quantex CLI ${g.currentVersion} is behind ${g.latestVersion}. Run ${g.recommendedUpgradeCommand}.`,severity:`warning`})}for(let n of v.filter(e=>e.inPath)){if(n.installedState||b.push({code:`AGENT_UNTRACKED_IN_PATH`,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`}),!(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);b.push({code:`AGENT_MANUAL_UPDATE_REQUIRED`,message:`${n.agent.displayName} ${n.installedVersion} is behind ${n.latestVersion}, but the current source is ${n.sourceLabel}. ${r}`,severity:`warning`})}return s(l({action:`doctor`,data:{agents:y,issues:b,installers:{brew:m,bun:u,npm:f,winget:h},self:{canAutoUpdate:g.canAutoUpdate,currentVersion:g.currentVersion,installSource:g.installSource,latestVersion:g.latestVersion,outdated:!!_,recoveryHint:_?c(g):void 0}},target:{kind:`system`,name:`doctor`}}),p)}function p(e){if(e.data){if(console.log(u.bold(`
2
- Quantex CLI Environment Check
3
- `)),console.log(u.bold(`Managed Installers:`)),console.log(` Bun: ${e.data.installers.bun?u.green(`available`):u.red(`not found`)}`),console.log(` npm: ${e.data.installers.npm?u.green(`available`):u.red(`not found`)}`),console.log(` brew: ${e.data.installers.brew?u.green(`available`):u.red(`not found`)}`),console.log(` winget:${e.data.installers.winget?u.green(`available`):u.red(`not found`)}`),console.log(`\n${u.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?u.green(`supported`):u.yellow(`unsupported`)}`),e.data.self.latestVersion&&console.log(` Latest: ${e.data.self.latestVersion}${e.data.self.outdated?u.yellow(` (update available)`):``}`),e.data.self.recoveryHint&&console.log(` Recovery: ${e.data.self.recoveryHint}`),console.log(`\n${u.bold(`Installed Agents:`)}`),e.data.agents.length===0)console.log(u.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?u.yellow(` (update available: ${t.latestVersion})`):``}`);if(console.log(`\n${u.bold(`Issues:`)}`),e.data.issues.length===0)console.log(u.green(` No issues found.`));else for(let t of e.data.issues)console.log(u.yellow(` - ${t.message}`));console.log()}}export{f as doctorCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./ensure-Cvf-8-n0.mjs";export{e as ensureCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./inspect-BHGlz5A1.mjs";export{e as inspectCommand};
@@ -1 +0,0 @@
1
- import{t as e}from"./resolve-IGzIxnAM.mjs";export{e as resolveCommand};
@@ -1 +0,0 @@
1
- import{r as e}from"./agents-Cg2x6brN.mjs";import{a as t,n,r,t as i}from"./color-CF4ehKUl.mjs";async function a(i){let a=await e(i);if(!a)return t(n({action:`resolve`,error:{code:`AGENT_NOT_FOUND`,details:{input:i},message:`Unknown agent: ${i}`},target:{kind:`agent`,name:i}}),o);let{agent:s,inspection:c}=a;return!c.inPath||!c.binaryPath?t(n({action:`resolve`,error:{code:`AGENT_NOT_INSTALLED`,message:`${s.displayName} is not installed.`},target:{kind:`agent`,name:s.name}}),o):t(r({action:`resolve`,data:{agent:{binaryName:s.binaryName,displayName:s.displayName,name:s.name},resolution:{binaryPath:c.binaryPath,installSource:c.installedState?.installType??`detected-in-path`,installedVersion:c.installedVersion,lifecycle:c.lifecycle,sourceLabel:c.sourceLabel,suggestedLaunchCommand:[c.binaryPath]}},target:{kind:`agent`,name:s.name}}),o)}function o(e){if(e.error){console.log(i.red(e.error.message));return}e.data&&(console.log(i.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{a as t};
@@ -1,3 +0,0 @@
1
- import{a as e,n as t,r as n,t as r}from"./color-CF4ehKUl.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=[{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:{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:{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:{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 s(r){let i=r?o.filter(e=>e.name===r):o;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`}}),c):e(n({action:`schema`,data:{commands:i},target:{kind:`system`,name:`schema`}}),c)}function c(e){if(e.error){console.log(r.red(e.error.message));return}if(e.data){console.log(r.bold(`
2
- Quantex Schemas
3
- `));for(let t of e.data.commands)console.log(` ${r.cyan(t.name)}`),console.log(` ${t.description}`);console.log()}}function l(){return o}export{s as n,l as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./schema-C0s9VtcC.mjs";export{e as schemaCommand};