quantex-cli 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents-CnYYCDb7.mjs +1 -0
- package/dist/{capabilities-DxM-S9ji.mjs → capabilities-CAUhP-es.mjs} +1 -1
- package/dist/capabilities-DPL8TsyN.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/color-B925pi3Z.mjs +6 -0
- package/dist/commands-B2HMm2Vz.mjs +1 -0
- package/dist/{commands-BgbYCaOu.mjs → commands-Du_EIpHh.mjs} +1 -1
- package/dist/{config-D6L6s0Ev.mjs → config-C6o_6cRz.mjs} +1 -1
- package/dist/{detect-CbeZTzuf.mjs → detect-CiNZbP5B.mjs} +1 -1
- package/dist/{doctor-BOONCNHd.mjs → doctor-vFlAhtFb.mjs} +2 -2
- package/dist/ensure-Cp6qFFrm.mjs +1 -0
- package/dist/ensure-n7U6mdIT.mjs +1 -0
- package/dist/index.mjs +2 -2
- package/dist/{info-BKPVjgqL.mjs → info-DMf4F9TW.mjs} +1 -1
- package/dist/{inspect-uCNo6sQt.mjs → inspect-BnVRjLLq.mjs} +1 -1
- package/dist/inspect-poLZ5HNX.mjs +1 -0
- package/dist/install-BEjGhkyG.mjs +1 -0
- package/dist/{list-DZnchakW.mjs → list-CnGbencC.mjs} +1 -1
- package/dist/resolve-BHKE62J1.mjs +1 -0
- package/dist/{resolve-C-TyEJ_4.mjs → resolve-BYb5ILgM.mjs} +1 -1
- package/dist/schema-CG-NycSn.mjs +1 -0
- package/dist/schema-CwlLtHgc.mjs +3 -0
- package/dist/{uninstall-DP34Ana8.mjs → uninstall-i-Fqd_qb.mjs} +1 -1
- package/dist/{update-DEkIOHRN.mjs → update-CV__icQK.mjs} +1 -1
- package/dist/{update-64M0nuUG.mjs → update-Cbd5IUV4.mjs} +1 -1
- package/dist/{upgrade-DIP9aiNB.mjs → upgrade-DBcABFlf.mjs} +1 -1
- package/dist/{user-output-DVnD2WHo.mjs → user-output-DO6eTEpK.mjs} +1 -1
- package/package.json +1 -1
- package/dist/agents-ONdRhmua.mjs +0 -1
- package/dist/capabilities-CLXPzjYt.mjs +0 -1
- package/dist/color-CCa8Z1Vv.mjs +0 -6
- package/dist/commands-CdCyEqay.mjs +0 -1
- package/dist/ensure-BwxOEjb5.mjs +0 -1
- package/dist/ensure-DXxpX7Wd.mjs +0 -1
- package/dist/inspect-Cd0B2aC2.mjs +0 -1
- package/dist/install-m3Q1QBtd.mjs +0 -1
- package/dist/resolve-DVCT_Qs8.mjs +0 -1
- package/dist/schema-BwnU4o2E.mjs +0 -3
- package/dist/schema-HU67udth.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,l as n,n as r,o as i,r as a,s as o,t as s,u as ee}from"./detect-CiNZbP5B.mjs";import{$ as c,B as te,G as l,K as u,M as ne,O as d,P as f,R as re,V as ie,Y as p,_ as ae,b as oe,d as se,f as ce,g as m,h,m as le,p as ue,v as de,y as fe,z as pe}from"./color-B925pi3Z.mjs";import me from"node:process";const he={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},cargo:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},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 g(e){return he[e]}function _(e){return g(e).lifecycle===`managed`}function v(e){return g(e).lifecycle}function y(e){return g(e).canUpdate}function ge(e){return g(e).canUninstall}function b(e){return g(e).canLookupLatestVersion}function x(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function S(e,t){if(t.packageName)return t.packageName;if(t.type===`cargo`)return e.packages?.cargo;if(t.type===`bun`||t.type===`npm`)return e.packages?.npm}function C(e){return e?y(e.installType):!1}function w(e,t){return C(t)||!!e.selfUpdate}function _e(e){return!!e&&b(e.installType)}function ve(e){return e.length>0&&e.every(e=>b(e.type))}function ye(e){return _(e.type)?`${v(e.type)}/${e.type}${x(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function be(e){return e?_(e.installType)?`managed via ${e.installType}${x(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function xe(e,t){let n=N({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function Se(e,t){if(t.type===`bun`){let n=S(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=S(e,t);return n?`npm i -g ${n}`:``}if(t.type===`brew`)return t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``;if(t.type===`cargo`){let n=S(e,t);return n?[`cargo`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}return t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function Ce(e,t,n){if(t)return _e(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!ve(n)))return e.packages.npm}function T(e,t){let n=E(t);if(n){let t=e.find(e=>e.type===n);if(t)return t}if(e.length!==1)return;let[r]=e;if(!(r.type!==`script`&&r.type!==`binary`))return r}function E(e){if(!e)return;let t=e.replaceAll(`\\`,`/`);if(t.includes(`/.bun/bin/`)||t.includes(`/.bun/install/global/`))return`bun`;if(t.includes(`/node_modules/.bin/`)||t.includes(`/node_modules/`))return`npm`}function D(e){if(e.installedState&&_(e.installedState.installType))return e.installedState.installType;for(let t of e.methods)if(_(t.type)&&y(t.type))return t.type}const O={strategy:`managed`,canHandle:e=>!!D(e),getManagedInstallerType:e=>D(e)},k={strategy:`self-update`,canHandle:e=>!C(e.installedState)&&!!e.agent.selfUpdate},A={strategy:`manual-hint`,canHandle:()=>!0},j=[O,k,A];function M(e){return j.find(t=>t.canHandle(e))??A}function N(e){return M(e).strategy}function we(e){return w(e.agent,e.installedState)}async function P(e){let t=s(),n=typeof e==`function`?e(t):e;try{return me.platform===`win32`?await u(l([`powershell.exe`,`-Command`,n]))===0:await u(l([`sh`,`-c`,n]))===0}catch{return!1}}function Te(e){return e===`cask`?[`--cask`]:[]}async function F(e,t,n){try{return await u(l([`brew`,e,...Te(n),t]))===0}catch{return!1}}async function Ee(e,t){return F(`install`,e,t)}async function I(e,t){return F(`upgrade`,e,t)}async function De(e){for(let t of e)if(!await I(t.packageName,t.packageTargetKind))return!1;return!0}async function Oe(e,t){return F(`uninstall`,e,t)}async function L(e,t,n=[]){try{return await u(l([`cargo`,e,t,...n]))===0}catch{return!1}}async function R(e,t){return L(`install`,e,t)}async function z(e,t){return R(e,[`--force`,...t??[]])}async function ke(e){for(let t of e)if(!await z(t.packageName,t.packageInstallArgs))return!1;return!0}async function Ae(e){return L(`uninstall`,e)}async function B(e,t){try{return await u(l([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function je(e){return B(`install`,e)}async function V(e){return B(`upgrade`,e)}async function Me(e){for(let t of e)if(!await V(t.packageName))return!1;return!0}async function Ne(e){return B(`uninstall`,e)}const Pe={brew:{type:`brew`,isAvailable:async()=>a(),install:async(e,t)=>Ee(e,t),uninstall:async(e,t)=>Oe(e,t),update:async(e,t)=>I(e,t),updateMany:async e=>De(e)},bun:{type:`bun`,getInstalledVersion:async e=>m(e),isAvailable:async()=>t(),install:async e=>ae(e),uninstall:async e=>de(e),update:async(e,t,n)=>fe(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>oe(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},cargo:{type:`cargo`,isAvailable:async()=>e(),install:async(e,t,n)=>R(e,n),uninstall:async e=>Ae(e),update:async(e,t,n)=>z(e,n?.packageInstallArgs),updateMany:async e=>ke(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},npm:{type:`npm`,getInstalledVersion:async e=>se(e),isAvailable:async()=>i(),install:async e=>ce(e),uninstall:async e=>ue(e),update:async(e,t,n)=>le(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>h(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>o(),install:async e=>je(e),uninstall:async e=>Ne(e),update:async e=>V(e),updateMany:async e=>Me(e.map(e=>({packageName:e.packageName})))}};function H(e){return Pe[e]}const U={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function Fe(){return(await c()).defaultPackageManager}async function W(){return{npmBunUpdateStrategy:(await c()).npmBunUpdateStrategy}}async function G(e){let t=s(),n=e.platforms[t];if(!n)return[];let r=await Fe();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function K(e,t,n,r,i,a){let o=H(e);return await o.isAvailable()?i===`install`?o.install(t,r,n):i===`update`?o.update(t,r,{npmBunUpdateStrategy:a,packageInstallArgs:n}):o.uninstall(t,r):!1}async function q(e,t,n,r){if(_(t.type)){let i=S(e,t);return i?K(t.type,i,t.packageInstallArgs,t.packageTargetKind,n,r):!1}return n===`update`&&!y(t.type)||!t.command?!1:P(t.command)}async function J(e,t,n){return _(e.installType)?e.packageName?K(e.installType,e.packageName,e.packageInstallArgs,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:P(e.command)}async function Ie(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await P(e.join(` `)))return!0;return!1}async function Y(e,t){let n={agentName:e.name,installType:t.type,packageName:S(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return t.packageInstallArgs?.length&&(n.packageInstallArgs=t.packageInstallArgs),await f(n),n}async function Le(e,t){return p(U,async()=>Y(e,t))}async function Re(e){return p(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 ze(e,t){return p(U,async()=>{let{npmBunUpdateStrategy:n}=await W(),r=await G(e);if(t&&await J(t,`update`,n))return await f(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 Ie(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 Be(e,t){return p(U,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}:${e.packageInstallArgs?.join(` `)??``}`,e])).values()],r=H(e);return await r.isAvailable()?r.updateMany(n,await W()):!1})}async function X(e,t,n){let r=H(e);if(r.getInstalledVersion&&await r.isAvailable())return r.getInstalledVersion(t,n)}async function Ve(e){return p(U,async()=>{let t=await d(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,i]=await Promise.all([G(e),d(e.name),r(e.binaryName)]),[a,o,s]=await Promise.all([i?He(e,n):Promise.resolve(void 0),i?re(e.binaryName):Promise.resolve(void 0),Ue(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:i,installedVersion:a,latestVersion:s,binaryPath:o,resolvedBinaryPath:await ie(o),sourceLabel:be(n),updateLabel:xe(e,n),lifecycle:n?v(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function He(e,t){if(t&&_(t.installType)&&t.packageName){let e=await X(t.installType,t.packageName,t.packageTargetKind);if(e)return e}return pe(e.binaryName,e.versionProbe)}async function Ue(e,t,n){let r=Ce(e,t,n);if(r)return te(r)}function $(e){return n(e)}async function We(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function Ge(){return Q(ee())}export{ge as C,_ as D,g as E,b as S,v as T,w as _,Q as a,T as b,Le as c,Be as d,H as f,M as g,N as h,Z as i,Ve as l,we as m,$ as n,G as o,j as p,We as r,Re as s,Ge as t,ze as u,Se as v,y as w,S as x,ye as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,r,s as i,t as a,u as o}from"./detect-
|
|
1
|
+
import{a as e,i as t,o as n,r,s as i,t as a,u as o}from"./detect-CiNZbP5B.mjs";import{a as s,r as c,s as l,t as u}from"./color-B925pi3Z.mjs";import d from"node:process";async function f(){let[u,f,h,g,_,v]=await Promise.all([t(),n(),r(),e(),i(),l()]);return s(c({action:`capabilities`,data:{agents:o().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:v.canAutoUpdate,timeout:!0},installers:{brew:{available:h,reason:h?void 0:p(`brew`)},bun:{available:u,reason:u?void 0:p(`bun`)},npm:{available:f,reason:f?void 0:p(`npm`)},cargo:{available:g,reason:g?void 0:p(`cargo`)},winget:{available:_,reason:_?void 0:p(`winget`)}},outputModes:[`human`,`json`,`ndjson`],platform:{arch:d.arch,os:a()}},target:{kind:`system`,name:`capabilities`}}),m)}function p(e){return e===`winget`&&d.platform!==`win32`||e===`brew`&&d.platform===`win32`?`not-on-platform`:`not-found`}function m(e){e.data&&(console.log(u.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(u.bold(`
|
|
4
4
|
Installers:`)),console.log(` bun: ${h(e.data.installers.bun)}`),console.log(` npm: ${h(e.data.installers.npm)}`),console.log(` brew: ${h(e.data.installers.brew)}`),console.log(` cargo: ${h(e.data.installers.cargo)}`),console.log(` winget: ${h(e.data.installers.winget)}`),console.log(u.bold(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./capabilities-CAUhP-es.mjs";export{e as capabilitiesCommand};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{r as e,s as t,v as n,y as r}from"./agents-ONdRhmua.mjs";import{l as i}from"./detect-CbeZTzuf.mjs";import{F as a,K as o,M as s,O as c,X as l,a as u,at as d,i as f,it as p,j as m,n as h,ot as g,q as _,r as v,rt as y,s as b,st as x,t as S,z as ee}from"./color-CCa8Z1Vv.mjs";import{a as te,i as C,n as w,o as T,r as E,t as ne}from"./user-output-DVnD2WHo.mjs";import{n as D,t as O}from"./errors-DCtNasuC.mjs";import k from"node:process";import{mkdir as A,readFile as re,rm as ie,writeFile as ae}from"node:fs/promises";import{join as j}from"node:path";import{program as M}from"commander";import oe from"prompts";function N(){return j(l(),`idempotency`)}function P(e){return j(N(),`${L(e)}.json`)}async function F(e){try{let t=JSON.parse(await re(P(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await ie(P(e),{force:!0});return}return t}catch{return}}async function I(e,t){await A(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 ae(P(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function L(e){return e.replace(/[^\w.-]/g,`_`)}const R=new Set([`doctor`,`upgrade`]);async function z(e){if(!e.ok||R.has(e.action))return;let t=p();if(t.outputMode!==`human`||t.quiet)return;let n=await b();if(!n.latestVersion||!c(n.latestVersion,n.currentVersion))return;let r=await ee(),i=Date.now();if(B(r.updateNoticeVersion,r.updateNoticeAt,n.latestVersion,i))return;let a=n.canAutoUpdate?"Run `quantex upgrade`.":"Run `quantex doctor` for source-specific update steps.";C(S.yellow(`Quantex CLI ${n.latestVersion} is available (current ${n.currentVersion}). ${a}`)),await o(n.latestVersion,new Date(i).toISOString())}function B(e,t,n,r){if(!e||!t||e!==n)return!1;let i=Date.parse(t);return Number.isNaN(i)?!1:r-i<864e5}async function V(e){let t=await W(e.action,e.target);if(t)return t;let n=p().timeoutMs;if(n===void 0)return K(e,()=>e.run().then(t=>H(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{y(),f({action:e.action,data:{reason:`timeout`,timeoutMs:n},target:e.target,type:`cancelled`},{force:!0}),t(u(h({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:n},message:`Command timed out after ${n}ms.`},target:e.target}),U,{force:!0}))},n)});return await K(e,async()=>{let n=await Promise.race([e.run(),t]);return r!==void 0&&(clearTimeout(r),r=void 0),H(e.action,e.target,n)})}finally{r&&clearTimeout(r)}}async function H(e,t,n){let r=await G(e,t,n);try{await z({action:e,ok:r.ok})}catch{}return r}function U(e){e.error&&console.error(S.red(e.error.message))}async function W(e,t){let n=p();if(!n.idempotencyKey)return;let r=await F(n.idempotencyKey);if(!r)return;if(r.action!==e)return u(h({action:e,error:{code:`INVALID_ARGUMENT`,details:{existingAction:r.action,idempotencyKey:n.idempotencyKey},message:`Idempotency key ${n.idempotencyKey} was already used for ${r.action}.`},target:t}),U,{force:!0});let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return u(i,U,{force:!0}),i}async function G(e,t,n){let r=p();return r.idempotencyKey&&await I(r.idempotencyKey,{action:e,result:n,target:t}),n}async function K(e,t){let n;try{let r=new Promise(t=>{let r=n=>{y(),f({action:e.action,data:{reason:`signal`,signal:n},target:e.target,type:`cancelled`},{force:!0}),t(u(h({action:e.action,error:{code:`CANCELLED`,details:{signal:n},message:`Command cancelled by ${n}.`},target:e.target}),U,{force:!0}))},i=()=>r(`SIGINT`),a=()=>r(`SIGTERM`);k.once(`SIGINT`,i),k.once(`SIGTERM`,a),n=()=>{k.off(`SIGINT`,i),k.off(`SIGTERM`,a)}});return await Promise.race([t(),r])}finally{n?.()}}async function q(t,n,r={}){let i=await e(t);if(!i)return Y({agent:{name:t},errorCode:`AGENT_NOT_FOUND`,errorMessage:`Unknown agent: ${t}`,execution:{args:n,installPolicy:r.install??`prompt`,installed:!1,interactive:!1,launched:!1}}),O(`AGENT_NOT_FOUND`);let{agent:a,inspection:o}=i,s=r.nonInteractive?!1:p().interactive,c=r.assumeYes??ne(),l=r.dryRun??w(),u=r.install??`prompt`;if(!o.inPath){if(u===`never`)return Y({agent:{binaryName:a.binaryName,displayName:a.displayName,name:a.name},errorCode:`AGENT_NOT_INSTALLED`,errorMessage:`${a.displayName} is not installed.`,execution:{args:n,installGuidance:J(a,o.methods,n),installPolicy:u,installed:!1,interactive:s,launched:!1}}),O(`AGENT_NOT_INSTALLED`);if(u===`if-missing`||u===`always`){if(l?T(S.cyan(`Dry run: would install ${a.displayName}.`)):C(S.cyan(`Installing ${a.displayName}...`)),!(await X(a,l)).success)return E(S.red(`Failed to install ${a.displayName}.`)),1}else if(s){if(!(c||l?{install:!0}:await oe({type:`confirm`,name:`install`,message:`${a.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return te(S.yellow(`Installation cancelled.`)),1;if(l?T(S.cyan(`Dry run: would install ${a.displayName}.`)):C(S.cyan(`Installing ${a.displayName}...`)),!(await X(a,l)).success)return E(S.red(`Failed to install ${a.displayName}.`)),1}else return Y({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:J(a,o.methods,n),installPolicy:u,installed:!1,interactive:s,launched:!1}}),O(`INTERACTION_REQUIRED`)}if(l)return se({agent:{binaryName:a.binaryName,displayName:a.displayName,name:a.name},execution:{args:n,installPolicy:u,installed:!0,interactive:s,launched:!1},message:`Dry run: would run ${[a.binaryName,...n].join(` `)}`}),0;try{return await ce(m([a.binaryName,...n]),a.displayName)}catch(e){return E(S.red(`Failed to launch ${a.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}function J(e,t,i){return{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:t.map(t=>({command:n(e,t),label:r(t),type:t.type})).filter(e=>e.command),suggestedAction:`rerun-with-install-policy`,suggestedEnsureCommand:`quantex ensure ${e.name}`,suggestedExecCommand:[`quantex`,`exec`,e.name,`--install`,`if-missing`,`--`,...i].join(` `)}}function Y(e){if(p().outputMode===`human`){E(S.red(e.errorMessage));let t=e.execution.installGuidance;t&&(T(S.dim(`Try: ${t.suggestedEnsureCommand}`)),T(S.dim(`Or: ${t.suggestedExecCommand}`)));return}u(h({action:`exec`,data:{agent:e.agent,execution:e.execution},error:{code:e.errorCode,details:e.execution.installGuidance,message:e.errorMessage},target:{kind:`agent`,name:e.agent.name}}),()=>{})}function se(e){if(p().outputMode===`human`){T(S.cyan(e.message));return}u(v({action:`exec`,data:{agent:e.agent,execution:e.execution},target:{kind:`agent`,name:e.agent.name}}),()=>{})}async function X(e,n=w()){if(n)return{success:!0};try{return await t(e)}catch(t){return _(t)?(E(S.red(t.message)),{success:!1}):(E(S.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function ce(e,t){let{timeoutMs:n}=p(),r,i;try{let a=new Promise(e=>{let n=n=>{y(),E(S.red(`${t} was cancelled by ${n}.`)),e(O(`CANCELLED`))},i=()=>n(`SIGINT`),a=()=>n(`SIGTERM`);k.once(`SIGINT`,i),k.once(`SIGTERM`,a),r=()=>{k.off(`SIGINT`,i),k.off(`SIGTERM`,a)}}),o=n===void 0?void 0:new Promise(e=>{i=setTimeout(()=>{y(),E(S.red(`${t} timed out after ${n}ms.`)),e(O(`TIMEOUT`))},n)});return await Promise.race([s(e),a,...o?[o]:[]])}finally{i&&clearTimeout(i),r?.()}}M.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(a()),M.hook(`preAction`,(e,t)=>{try{x(g(t.optsWithGlobals()))}catch(e){console.log(S.red(e instanceof Error?e.message:String(e))),k.exit(2)}}),M.hook(`postAction`,()=>{d()}),M.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-HU67udth.mjs`);k.exitCode=await $({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),M.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-CdCyEqay.mjs`);k.exitCode=await $({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),M.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-CLXPzjYt.mjs`);k.exitCode=await $({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),M.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-Cd0B2aC2.mjs`);k.exitCode=await $({action:`inspect`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`resolve <agent>`).description(`解析 agent 可执行入口`).action(async e=>{let{resolveCommand:t}=await import(`./resolve-DVCT_Qs8.mjs`);k.exitCode=await $({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`install <agents...>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-m3Q1QBtd.mjs`);k.exitCode=await $({action:`install`,run:()=>t(e),target:e.length===1?{kind:`agent`,name:e[0]}:{kind:`agent`}})}),M.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-DXxpX7Wd.mjs`);k.exitCode=await $({action:`ensure`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.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(S.red(`Unknown install policy: ${i}`)),k.exitCode=2;return}let a=ue(r);k.exitCode=await q(e,a.length>0?a:t,{install:i,nonInteractive:r.optsWithGlobals().nonInteractive})}),M.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-DEkIOHRN.mjs`);k.exitCode=await $({action:`update`,run:()=>n(e,t.all??!1),target:{kind:`agent`,name:e}})}),M.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-DP34Ana8.mjs`);k.exitCode=await $({action:`uninstall`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-DZnchakW.mjs`);k.exitCode=await $({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),M.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-BKPVjgqL.mjs`);k.exitCode=await $({action:`info`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.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-D6L6s0Ev.mjs`);k.exitCode=await $({action:`config`,run:()=>r(e,t,n),target:{kind:`config`,name:t}})}),M.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-DIP9aiNB.mjs`);k.exitCode=await $({action:`upgrade`,run:()=>t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1}),target:{kind:`self`,name:`quantex`}})}),M.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-BOONCNHd.mjs`);k.exitCode=await $({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const le=new Set([...M.commands.map(e=>e.name()),...M.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),Z=Q(k.argv.slice(2),le);if(Z?.error&&(console.log(S.red(Z.error)),k.exit(2)),Z&&i(Z.agentName)){try{x(g({color:Z.color,dryRun:Z.dryRun,idempotencyKey:Z.idempotencyKey,logLevel:Z.logLevel,noCache:Z.noCache,nonInteractive:Z.nonInteractive,quiet:Z.quiet,refresh:Z.refresh,runId:Z.runId,timeout:Z.timeout,yes:Z.yes}))}catch(e){console.log(S.red(e instanceof Error?e.message:String(e))),k.exit(2)}try{let e=await q(Z.agentName,Z.agentArgs,{assumeYes:Z.yes,dryRun:Z.dryRun,nonInteractive:Z.nonInteractive});k.exit(e)}finally{d()}}M.parse();function ue(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function Q(e,t){let n=k.stdin.isTTY===!1||k.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 D(await V(e))}export{};
|
|
2
|
+
import{r as e,s as t,v as n,y as r}from"./agents-CnYYCDb7.mjs";import{l as i}from"./detect-CiNZbP5B.mjs";import{G as a,H as o,I as s,J as c,K as l,T as u,X as d,a as f,at as p,i as m,it as h,k as g,n as _,ot as v,r as ee,rt as y,s as te,st as b,t as x}from"./color-B925pi3Z.mjs";import{a as S,i as C,n as w,o as T,r as E,t as ne}from"./user-output-DO6eTEpK.mjs";import{n as re,t as D}from"./errors-DCtNasuC.mjs";import O from"node:process";import{mkdir as k,readFile as A,rm as ie,writeFile as ae}from"node:fs/promises";import{join as j}from"node:path";import{program as M}from"commander";import oe from"prompts";function N(){return j(d(),`idempotency`)}function P(e){return j(N(),`${L(e)}.json`)}async function F(e){try{let t=JSON.parse(await A(P(e),`utf8`));if(Date.parse(t.expiresAt)<=Date.now()){await ie(P(e),{force:!0});return}return t}catch{return}}async function I(e,t){await k(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 ae(P(e),`${JSON.stringify(i,null,2)}\n`,`utf8`)}function L(e){return e.replace(/[^\w.-]/g,`_`)}const R=new Set([`doctor`,`upgrade`]);async function z(e){if(!e.ok||R.has(e.action))return;let t=h();if(t.outputMode!==`human`||t.quiet)return;let n=await te();if(!n.latestVersion||!o(n.latestVersion,n.currentVersion))return;let r=await g(),i=Date.now();if(B(r.updateNoticeVersion,r.updateNoticeAt,n.latestVersion,i))return;let a=n.canAutoUpdate?"Run `quantex upgrade`.":"Run `quantex doctor` for source-specific update steps.";C(x.yellow(`Quantex CLI ${n.latestVersion} is available (current ${n.currentVersion}). ${a}`)),await s(n.latestVersion,new Date(i).toISOString())}function B(e,t,n,r){if(!e||!t||e!==n)return!1;let i=Date.parse(t);return Number.isNaN(i)?!1:r-i<864e5}async function V(e){let t=await W(e.action,e.target);if(t)return t;let n=h().timeoutMs;if(n===void 0)return K(e,()=>e.run().then(t=>H(e.action,e.target,t)));let r;try{let t=new Promise(t=>{r=setTimeout(()=>{y(),m({action:e.action,data:{reason:`timeout`,timeoutMs:n},target:e.target,type:`cancelled`},{force:!0}),t(f(_({action:e.action,error:{code:`TIMEOUT`,details:{timeoutMs:n},message:`Command timed out after ${n}ms.`},target:e.target}),U,{force:!0}))},n)});return await K(e,async()=>{let n=await Promise.race([e.run(),t]);return r!==void 0&&(clearTimeout(r),r=void 0),H(e.action,e.target,n)})}finally{r&&clearTimeout(r)}}async function H(e,t,n){let r=await G(e,t,n);try{await z({action:e,ok:r.ok})}catch{}return r}function U(e){e.error&&console.error(x.red(e.error.message))}async function W(e,t){let n=h();if(!n.idempotencyKey)return;let r=await F(n.idempotencyKey);if(!r)return;if(r.action!==e)return f(_({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}),U,{force:!0});let i={...r.result,meta:{...r.result.meta,mode:n.outputMode,runId:n.runId,timestamp:new Date().toISOString()}};return f(i,U,{force:!0}),i}async function G(e,t,n){let r=h();return r.idempotencyKey&&await I(r.idempotencyKey,{action:e,result:n,target:t}),n}async function K(e,t){let n;try{let r=new Promise(t=>{let r=n=>{y(),m({action:e.action,data:{reason:`signal`,signal:n},target:e.target,type:`cancelled`},{force:!0}),t(f(_({action:e.action,error:{code:`CANCELLED`,details:{signal:n},message:`Command cancelled by ${n}.`},target:e.target}),U,{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 q(t,n,r={}){let i=await e(t);if(!i)return Y({agent:{name:t},errorCode:`AGENT_NOT_FOUND`,errorMessage:`Unknown agent: ${t}`,execution:{args:n,installPolicy:r.install??`prompt`,installed:!1,interactive:!1,launched:!1}}),D(`AGENT_NOT_FOUND`);let{agent:o,inspection:s}=i,c=r.nonInteractive?!1:h().interactive,l=r.assumeYes??ne(),u=r.dryRun??w(),d=r.install??`prompt`;if(!s.inPath){if(d===`never`)return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`AGENT_NOT_INSTALLED`,errorMessage:`${o.displayName} is not installed.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`AGENT_NOT_INSTALLED`);if(d===`if-missing`||d===`always`){if(u?T(x.cyan(`Dry run: would install ${o.displayName}.`)):C(x.cyan(`Installing ${o.displayName}...`)),!(await X(o,u)).success)return E(x.red(`Failed to install ${o.displayName}.`)),1}else if(c){if(!(l||u?{install:!0}:await oe({type:`confirm`,name:`install`,message:`${o.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return S(x.yellow(`Installation cancelled.`)),1;if(u?T(x.cyan(`Dry run: would install ${o.displayName}.`)):C(x.cyan(`Installing ${o.displayName}...`)),!(await X(o,u)).success)return E(x.red(`Failed to install ${o.displayName}.`)),1}else return Y({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},errorCode:`INTERACTION_REQUIRED`,errorMessage:`${o.displayName} is not installed and interactive installation is disabled.`,execution:{args:n,installGuidance:J(o,s.methods,n),installPolicy:d,installed:!1,interactive:c,launched:!1}}),D(`INTERACTION_REQUIRED`)}if(u)return se({agent:{binaryName:o.binaryName,displayName:o.displayName,name:o.name},execution:{args:n,installPolicy:d,installed:!0,interactive:c,launched:!1},message:`Dry run: would run ${[o.binaryName,...n].join(` `)}`}),0;try{return await ce(a([o.binaryName,...n]),o.displayName)}catch(e){return E(x.red(`Failed to launch ${o.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}function J(e,t,i){return{docsRef:`skills/quantex-cli/references/command-recipes.md`,installMethods:t.map(t=>({command:n(e,t),label:r(t),type:t.type})).filter(e=>e.command),suggestedAction:`rerun-with-install-policy`,suggestedEnsureCommand:`quantex ensure ${e.name}`,suggestedExecCommand:[`quantex`,`exec`,e.name,`--install`,`if-missing`,`--`,...i].join(` `)}}function Y(e){if(h().outputMode===`human`){E(x.red(e.errorMessage));let t=e.execution.installGuidance;t&&(T(x.dim(`Try: ${t.suggestedEnsureCommand}`)),T(x.dim(`Or: ${t.suggestedExecCommand}`)));return}f(_({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 se(e){if(h().outputMode===`human`){T(x.cyan(e.message));return}f(ee({action:`exec`,data:{agent:e.agent,execution:e.execution},target:{kind:`agent`,name:e.agent.name}}),()=>{})}async function X(e,n=w()){if(n)return{success:!0};try{return await t(e)}catch(t){return c(t)?(E(x.red(t.message)),{success:!1}):(E(x.red(`Failed to install ${e.displayName}: ${t instanceof Error?t.message:String(t)}`)),{success:!1})}}async function ce(e,t){let{timeoutMs:n}=h(),r,i;try{let a=new Promise(e=>{let n=n=>{y(),E(x.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)}}),o=n===void 0?void 0:new Promise(e=>{i=setTimeout(()=>{y(),E(x.red(`${t} timed out after ${n}ms.`)),e(D(`TIMEOUT`))},n)});return await Promise.race([l(e),a,...o?[o]:[]])}finally{i&&clearTimeout(i),r?.()}}M.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(u()),M.hook(`preAction`,(e,t)=>{try{b(v(t.optsWithGlobals()))}catch(e){console.log(x.red(e instanceof Error?e.message:String(e))),O.exit(2)}}),M.hook(`postAction`,()=>{p()}),M.command(`schema`).argument(`[command]`,`Optional command name`).description(`查看结构化输出 schema`).action(async e=>{let{schemaCommand:t}=await import(`./schema-CG-NycSn.mjs`);O.exitCode=await $({action:`schema`,run:()=>t(e),target:{kind:`system`,name:`schema`}})}),M.command(`commands`).description(`查看命令目录与稳定能力`).action(async()=>{let{commandsCommand:e}=await import(`./commands-B2HMm2Vz.mjs`);O.exitCode=await $({action:`commands`,run:()=>e(),target:{kind:`system`,name:`commands`}})}),M.command(`capabilities`).description(`查看当前环境与 surface 能力`).action(async()=>{let{capabilitiesCommand:e}=await import(`./capabilities-DPL8TsyN.mjs`);O.exitCode=await $({action:`capabilities`,run:()=>e(),target:{kind:`system`,name:`capabilities`}})}),M.command(`inspect <agent>`).description(`查看 agent 结构化状态`).action(async e=>{let{inspectCommand:t}=await import(`./inspect-poLZ5HNX.mjs`);O.exitCode=await $({action:`inspect`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`resolve <agent>`).description(`解析 agent 可执行入口`).action(async e=>{let{resolveCommand:t}=await import(`./resolve-BHKE62J1.mjs`);O.exitCode=await $({action:`resolve`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`install <agents...>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-BEjGhkyG.mjs`);O.exitCode=await $({action:`install`,run:()=>t(e),target:e.length===1?{kind:`agent`,name:e[0]}:{kind:`agent`}})}),M.command(`ensure <agent>`).description(`确保指定 agent 已安装`).action(async e=>{let{ensureCommand:t}=await import(`./ensure-Cp6qFFrm.mjs`);O.exitCode=await $({action:`ensure`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.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(x.red(`Unknown install policy: ${i}`)),O.exitCode=2;return}let a=ue(r);O.exitCode=await q(e,a.length>0?a:t,{install:i,nonInteractive:r.optsWithGlobals().nonInteractive})}),M.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-CV__icQK.mjs`);O.exitCode=await $({action:`update`,run:()=>n(e,t.all??!1),target:{kind:`agent`,name:e}})}),M.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-i-Fqd_qb.mjs`);O.exitCode=await $({action:`uninstall`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-CnGbencC.mjs`);O.exitCode=await $({action:`list`,run:()=>e(),target:{kind:`system`,name:`agents`}})}),M.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-DMf4F9TW.mjs`);O.exitCode=await $({action:`info`,run:()=>t(e),target:{kind:`agent`,name:e}})}),M.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-C6o_6cRz.mjs`);O.exitCode=await $({action:`config`,run:()=>r(e,t,n),target:{kind:`config`,name:t}})}),M.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-DBcABFlf.mjs`);O.exitCode=await $({action:`upgrade`,run:()=>t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1}),target:{kind:`self`,name:`quantex`}})}),M.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-vFlAhtFb.mjs`);O.exitCode=await $({action:`doctor`,run:()=>e(),target:{kind:`system`,name:`doctor`}})});const le=new Set([...M.commands.map(e=>e.name()),...M.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]),Z=Q(O.argv.slice(2),le);if(Z?.error&&(console.log(x.red(Z.error)),O.exit(2)),Z&&i(Z.agentName)){try{b(v({color:Z.color,dryRun:Z.dryRun,idempotencyKey:Z.idempotencyKey,logLevel:Z.logLevel,noCache:Z.noCache,nonInteractive:Z.nonInteractive,quiet:Z.quiet,refresh:Z.refresh,runId:Z.runId,timeout:Z.timeout,yes:Z.yes}))}catch(e){console.log(x.red(e instanceof Error?e.message:String(e))),O.exit(2)}try{let e=await q(Z.agentName,Z.agentArgs,{assumeYes:Z.yes,dryRun:Z.dryRun,nonInteractive:Z.nonInteractive});O.exit(e)}finally{p()}}M.parse();function ue(e){let t=e.processedArgs.at(-1);return Array.isArray(t)?t:e.args.slice(1)}function Q(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 re(await V(e))}export{};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createHash as e,randomUUID as t}from"node:crypto";import n from"node:process";import{existsSync as r,mkdirSync as i,writeFileSync as a}from"node:fs";import{chmod as o,mkdir as s,mkdtemp as c,readFile as l,realpath as u,rename as d,rm as f,stat as p,writeFile as m}from"node:fs/promises";import{basename as h,dirname as g,join as _}from"node:path";import{homedir as ee}from"node:os";import{spawn as te}from"node:child_process";import{text as ne}from"node:stream/consumers";import{fileURLToPath as re}from"node:url";import{Buffer as ie}from"node:buffer";import ae from"picocolors";function oe(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,y=new Set;function b(){return v??=fe(),v}function se(e){y=new Set,v={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function ce(){v=void 0,y=new Set}function x(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:oe(e.timeout),c=pe(e.color),l=me(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 le(){v&&(v.cancelled=!0)}function ue(){le();for(let e of y)e();y.clear()}function S(e){return y.add(e),()=>{y.delete(e)}}function de(e){let t=b();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 fe(){return x()}function pe(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 me(e){if(e===void 0||e===`info`)return`info`;if(e===`silent`||e===`error`||e===`warn`||e===`debug`)return e;throw Error(`Invalid log level: ${e}`)}const he=`https://registry.npmjs.org`;function C(e){if(e)try{return new URL(e.trim()).toString().replace(/\/+$/,``)}catch{return}}function ge(e,t,n){return`${C(n)}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}const _e={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,selfUpdateRegistry:void 0,versionCacheTtlHours:6};function w(){return _(n.env.HOME||n.env.USERPROFILE||ee(),`.quantex`)}function T(){return _(w(),`config.json`)}async function E(){let e={..._e,...await be()};return{...e,defaultPackageManager:e.defaultPackageManager===`npm`?`npm`:`bun`,networkRetries:D(e.networkRetries,2),networkTimeoutMs:D(e.networkTimeoutMs,1e4),npmBunUpdateStrategy:e.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:e.selfUpdateChannel===`beta`?`beta`:`stable`,selfUpdateRegistry:typeof e.selfUpdateRegistry==`string`?C(e.selfUpdateRegistry):void 0,versionCacheTtlHours:D(e.versionCacheTtlHours,6)}}function ve(e){return e===`latest-major`||e===`respect-semver`}async function ye(e){await s(w(),{recursive:!0}),await m(T(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function be(){try{let e=await l(T(),`utf8`),t=JSON.parse(e);return xe(t)?t:{}}catch{return{}}}function D(e,t){if(typeof e==`number`&&Number.isInteger(e)&&e>0)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isInteger(t)&&t>0)return t}return t}function xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}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 Se(e){return e instanceof O}function Ce(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 _(w(),`locks`,...r,i)}async function k(e){let t=Ce(e.scope);return await s(g(t),{recursive:!0}),await we(e.resource,t),async()=>{await f(t,{force:!0,recursive:!0})}}async function we(e,t){try{i(t,{recursive:!1}),Te(t);return}catch(e){if(!Ae(e))throw e}if(!await Ee(t))throw new O(e,t);try{i(t,{recursive:!1}),Te(t)}catch(n){throw Ae(n)?new O(e,t):n}}function Te(e){a(_(e,`owner.json`),`${JSON.stringify({pid:n.pid,createdAt:new Date().toISOString()})}\n`,`utf8`)}async function Ee(e){let t;try{t=await De(e)}catch{return!1}return t&&ke(t.pid)?!1:(await f(e,{force:!0,recursive:!0}),!0)}async function De(e){let t=Date.now()+100;for(;Date.now()<t;){let t=await Oe(e);if(t)return t;await new Promise(e=>setTimeout(e,2))}return await Oe(e)}async function Oe(e){try{let t=await l(_(e,`owner.json`),`utf8`),n=JSON.parse(t);return typeof n.pid==`number`&&Number.isInteger(n.pid)&&n.pid>0?{pid:n.pid}:void 0}catch(e){if(je(e))return;throw e}}function ke(e){try{return n.kill(e,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}}function Ae(e){return typeof e==`object`&&!!e&&`code`in e&&e.code===`EEXIST`}function je(e){let t=typeof e==`object`&&e&&`code`in e?e.code:void 0;return t===`ENOENT`||t===`ENOTDIR`}async function Me(e,t){let n=await k(e);try{return await t()}finally{await n()}}async function Ne(){try{return await k({resource:`self upgrade`,scope:[`self-upgrade`]})}catch(e){if(Se(e))return;throw e}}const A=`quantex-cli`,j=`https://github.com/Drswith/quantex-cli`,Pe=`0.17.1`;function M(e,t={}){if(b().outputMode===`human`){let n=P(e,{...t,stdio:[`inherit`,`inherit`,`inherit`]});return{cleanup:S(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.resolve(),proc:n}}let n=P(e,{...t,stdio:[`ignore`,`pipe`,`pipe`]});return{cleanup:S(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.all([Fe(n.stdout),Fe(n.stderr)]).then(()=>void 0),proc:n}}async function N(e){try{let t=await e.proc.exited;return await e.outputDrained,t}finally{e.cleanup()}}function P(e,t={}){let n=Re();if(n)return ze(e,t,n);let[r,...i]=e;if(!r)throw Error(`spawnCommand requires a non-empty command array.`);let a=te(r,i,{...t,shell:t.shell??Le(r)});return{get exitCode(){return a.exitCode},stderr:a.stderr,stdout:a.stdout,exited:Ie(a),kill:a.kill.bind(a),unref:()=>a.unref()}}async function F(e){let[t,n,r]=await Promise.all([I(e.stdout),I(e.stderr),e.exited]);return{exitCode:r,stderr:n,stdout:t}}async function Fe(e){if(!e)return;let t=await I(e);t&&n.stderr.write(t)}async function Ie(e){return new Promise((t,n)=>{e.once(`error`,n),e.once(`close`,e=>{t(typeof e==`number`?e:1)})})}async function I(e){return e?typeof e==`string`?e:typeof e.getReader==`function`?new Response(e).text():ne(e):``}function Le(e){return n.platform!==`win32`||e.includes(`/`)||e.includes(`\\`)?!1:!/\.[a-z0-9]+$/i.test(e)}function Re(){let e=globalThis.Bun?.spawn;return typeof e==`function`?e:void 0}function ze(e,t,n){let r=n([...e],t);return{get exitCode(){return r.exitCode},stderr:r.stderr,stdout:r.stdout,exited:r.exited.then(()=>typeof r.exitCode==`number`?r.exitCode:1),kill:e=>r.kill?.(e)??!1,unref:()=>r.unref?.()}}async function L(e,t){let n=await Be(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function Be(e,t,n=`text`){let r=await E(),i=r.versionCacheTtlHours*60*60*1e3,a=b().cacheMode,o=a===`no-cache`?{entries:{}}:await He(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return R(s,i),s.body;let l=await Ve(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&R(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await Ue(o),Ge(c,c+i),s.body;if(!l.ok)return s&&R(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&R(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 Ue(o)),Ge(c,c+i),u}async function Ve(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 He(){try{return JSON.parse(await l(We(),`utf8`))}catch{return{entries:{}}}}async function Ue(e){await s(_(w(),`cache`),{recursive:!0}),await m(We(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function We(){return _(w(),`cache`,`versions.json`)}function R(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);de({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function Ge(e,t){de({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}const Ke=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function qe(e,t){if(t)return t(e);let n=e.trim().split(`
|
|
2
|
+
`)[0],r=n.match(Ke);return r?r[1]:n||void 0}function Je(e,t){let n=Ze(e),r=Ze(t);if(!(!n||!r)){for(let e=0;e<3;e+=1){let t=n.core[e]-r.core[e];if(t!==0)return t>0?1:-1}return Qe(n.prerelease,r.prerelease)}}function z(e,t){return Je(e,t)===1}async function B(e,t){let n=t?.command??[e,`--version`];try{let{exitCode:e,stdout:r}=await F(P(n));return e===0?qe(r,t?.parser):void 0}catch{return}}async function V(e,t=`latest`,n={}){try{let r=C(n.registry)??`https://registry.npmjs.org`;return(await L(ge(e,t,r),`npm:${r}:${e}:${t}`))?.version}catch{return}}async function Ye(e){try{let{exitCode:t,stdout:r}=await F(P([n.platform===`win32`?`where`:`which`,e]));return t===0?r.trim().split(`
|
|
3
|
+
`)[0]:void 0}catch{return}}async function Xe(e){if(e)try{return await u(e)}catch{return e}}function Ze(e){let t=e.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9a-z.-]+))?$/i);if(t)return{core:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]?t[4].split(`.`):[]}}function Qe(e,t){if(e.length===0&&t.length===0)return 0;if(e.length===0)return 1;if(t.length===0)return-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r+=1){let n=e[r],i=t[r];if(n===void 0)return-1;if(i===void 0)return 1;if(n===i)continue;let a=/^\d+$/.test(n),o=/^\d+$/.test(i);return a&&o?Number(n)>Number(i)?1:-1:a?-1:o||n>i?1:-1}return 0}const $e={installedAgents:{},self:{}};function H(){return _(w(),`state.json`)}async function U(){return st()}async function et(e){let t=await k({resource:`state`,scope:[`state`]});try{await dt(e)}finally{await t()}}async function tt(e){return(await U()).installedAgents[e]}async function nt(e){await W(t=>{t.installedAgents[e.agentName]=e})}async function rt(e){await W(t=>{delete t.installedAgents[e]})}async function it(){return(await U()).self}async function at(e){await W(t=>{t.self.installSource=e})}async function ot(e,t){await W(n=>{n.self.updateNoticeVersion=e,n.self.updateNoticeAt=t})}async function st(){try{let e=JSON.parse(await l(H(),`utf8`)),t=ct(e.self);return{installedAgents:e.installedAgents??{},self:t}}catch{return{...$e}}}function ct(e){if(!ut(e))return{};let t={...e};return lt(e.installSource)?t.installSource=e.installSource:delete t.installSource,typeof e.updateNoticeAt==`string`?t.updateNoticeAt=e.updateNoticeAt:delete t.updateNoticeAt,typeof e.updateNoticeVersion==`string`?t.updateNoticeVersion=e.updateNoticeVersion:delete t.updateNoticeVersion,t}function lt(e){return e===`binary`||e===`bun`||e===`npm`||e===`source`||e===`unknown`}function ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function dt(e){await s(w(),{recursive:!0}),await m(H(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function W(e){let t=await k({resource:`state`,scope:[`state`]});try{let t=await st();await e(t),await dt(t)}finally{await t()}}function ft(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function G(e=n.execPath){if(h(ft(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 pt(e=n.execPath){let t=G(e);if(t)return`${j}/releases/latest/download/${t}`}function mt(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 ht(e){let t=await L(await gt(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function gt(e){if(e===`stable`)return`${j}/releases/latest/download/manifest.json`;let t=(await _t(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 _t(e){let t=yt();if(!t)throw Error(`Failed to resolve the GitHub repository slug for Quantex releases.`);let n=await L(`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 vt(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 yt(){return j.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const bt=A,xt=`/node_modules/${bt}`;async function St(e){let t=await Tt(),r=n.execPath,i=t.foundPackageJson?K(t.packageRoot):K(``,r),a=await wt((await it()).installSource,i),o=await E(),s=mt(e?.updateChannel,o.selfUpdateChannel);return{canAutoUpdate:Ct(a),currentVersion:t.version||`0.17.1`,executablePath:r,installSource:a,packageRoot:t.packageRoot,updateChannel:s}}function Ct(e){return e===`binary`||e===`bun`||e===`npm`}async function wt(e,t){return t!==`unknown`&&e!==t?(await at(t),t):e??t}function K(e,t=n.execPath){let r=Dt(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(xt)?`npm`:r?`source`:Ot(t)?`binary`:`unknown`}async function Tt(e=import.meta.url){let t=kt(e),n=g(t);for(;;){let e=_(n,`package.json`),t=await Et(e);if(t?.name===bt)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.17.1`};let r=g(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:_(g(t),`package.json`),packageRoot:g(t),version:Pe}}function q(){return Pe}async function Et(e){try{return JSON.parse(await l(e,`utf8`))}catch{return}}function Dt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function Ot(e){let t=h(Dt(e));return t!==`bun`&&t!==`bun.exe`}function kt(e){try{return re(e)}catch{return n.execPath}}async function At(e,t,r=n.env,i=n.cwd()){if(e!==`bun`&&e!==`npm`)return;let a=C(r.QTX_SELF_UPDATE_REGISTRY);return a?{isOverride:!0,registry:a,source:`quantex-env`}:t.selfUpdateRegistry?{isOverride:!0,registry:t.selfUpdateRegistry,source:`quantex-config`}:await jt(e,r,i)||{isOverride:!1,registry:he,source:`fallback`}}async function jt(e,t,n){if(e===`bun`){let e=Mt(t,[`BUN_CONFIG_REGISTRY`,`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(e)return{isOverride:!1,registry:e,source:`bun-env`};let r=await Nt(n,t);if(r)return{isOverride:!1,registry:r,source:`bunfig`}}let r=Mt(t,[`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(r)return{isOverride:!1,registry:r,source:`npm-env`};let i=await Ft(n,t);if(i)return{isOverride:!1,registry:i,source:`npmrc`}}function Mt(e,t){for(let n of t){let t=C(e[n]);if(t)return t}}async function Nt(e,t){let n=Rt(t),i=t.XDG_CONFIG_HOME,a=Lt(e,`bunfig.toml`),o=[_(n,`.bunfig.toml`),i?_(i,`.bunfig.toml`):void 0];if(a){let e=await Pt(a);if(e)return e}for(let e of o){if(!e||!r(e))continue;let t=await Pt(e);if(t)return t}}async function Pt(e){try{return zt(await l(e,`utf8`))}catch{return}}async function Ft(e,t){let n=Rt(t),i=Lt(e,`.npmrc`),a=_(n,`.npmrc`);if(i){let e=await It(i);if(e)return e}if(r(a))return It(a)}async function It(e){try{let t=(await l(e,`utf8`)).split(`
|
|
4
|
+
`).map(e=>e.trim());for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n||n.startsWith(`#`)||n.startsWith(`;`))continue;let r=n.match(/^registry\s*=\s*(.+)$/);if(!r?.[1])continue;let i=C(r[1]);if(i)return i}}catch{}}function Lt(e,t){let n=e;for(;;){let e=_(n,t);if(r(e))return e;let i=g(n);if(i===n)return;n=i}}function Rt(e){return e.HOME||e.USERPROFILE||ee()}function zt(e){let t=Bt(e,[/(?:^|\n)\s*install\.registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\.registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}[\s\S]*?\}/]);if(t)return C(t);let n=e.match(/(?:^|\n)\s*\[install\]\s*\n([\s\S]*?)(?=\n\s*\[[^\]]+\]|\s*$)/)?.[1];if(n)return C(Bt(n,[/(?:^|\n)\s*registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/]))}function Bt(e,t){for(let n of t){let t=e.match(n)?.[1];if(t)return t}}async function Vt(e){let t=await E();if(e.installSource===`binary`)try{let t=await ht(e.updateChannel),n=vt(t,e.executablePath);return n?{binaryAsset:n,targetVersion:t.version}:{resolutionError:{detail:{channel:e.updateChannel},kind:`unsupported`,message:`No binary asset is available for the current platform on the ${e.updateChannel} channel.`}}}catch{return{resolutionError:{kind:`network`,message:`Failed to resolve the ${e.updateChannel} release manifest.`}}}let n=e.updateChannel===`beta`?`beta`:`latest`,r=await V(A,n,{registry:he});if(e.installSource===`bun`||e.installSource===`npm`){let i=await At(e.installSource,t);return{managedRegistry:i?.registry,managedRegistryIsOverride:i?.isOverride??!1,packageTag:n,targetVersion:await V(A,n,{registry:i?.registry}),upstreamLatestVersion:r,verificationCommand:qt(e.packageRoot)}}return{packageTag:n,targetVersion:r,upstreamLatestVersion:r}}async function J(e){let t=e?.facts??await St({updateChannel:e?.updateChannel}),n=e?.target??await Vt(t),r=n.targetVersion?z(n.targetVersion,t.currentVersion):!1;return{facts:t,status:Gt(t,n,r),target:n,updateAvailable:r}}function Ht(e){return{canAutoUpdate:e.facts.canAutoUpdate,currentVersion:e.facts.currentVersion,executablePath:e.facts.executablePath,installSource:e.facts.installSource,latestVersion:e.target.targetVersion,managedRegistry:e.target.managedRegistry,managedRegistryIsOverride:e.target.managedRegistryIsOverride,packageRoot:e.facts.packageRoot,recommendedUpgradeCommand:e.facts.canAutoUpdate?`quantex upgrade`:void 0,upstreamLatestVersion:e.target.upstreamLatestVersion,updateChannel:e.facts.updateChannel}}async function Ut(e,t){if(!t.success||e.facts.installSource!==`bun`&&e.facts.installSource!==`npm`)return t;let n=await Kt(e);if(!n)return{error:{kind:`verify`,message:`Managed self-upgrade finished but Quantex could not verify the installed version afterwards.`},installSource:e.facts.installSource,success:!1};let r=t.newVersion??e.target.targetVersion;return r&&n!==r?{error:{detail:{expectedVersion:r,observedVersion:n},kind:`verify`,message:`Managed self-upgrade installed version ${n}, but expected ${r}.`},installSource:e.facts.installSource,success:!1}:!r&&n===e.facts.currentVersion&&e.target.targetVersion!==void 0?{error:{detail:{observedVersion:n},kind:`verify`,message:`Managed self-upgrade completed without changing the installed Quantex version.`},installSource:e.facts.installSource,success:!1}:{...t,newVersion:n}}function Wt(e){let t={canAutoUpdate:e.canAutoUpdate,currentVersion:e.currentVersion,executablePath:e.executablePath,installSource:e.installSource,packageRoot:e.packageRoot,updateChannel:e.updateChannel},n={managedRegistry:e.managedRegistry,managedRegistryIsOverride:e.managedRegistryIsOverride,packageTag:e.updateChannel===`beta`?`beta`:`latest`,targetVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion,verificationCommand:qt(e.packageRoot)},r=e.latestVersion?z(e.latestVersion,e.currentVersion):!1;return{facts:t,status:Gt(t,n,r),target:n,updateAvailable:r}}function Gt(e,t,n){return e.canAutoUpdate?t.targetVersion&&!n?`up-to-date`:t.targetVersion?`update-available`:`check-unavailable`:`manual-required`}async function Kt(e){if(e.target.verificationCommand){let t=await B(e.facts.executablePath,{command:e.target.verificationCommand});if(t)return t}return B(e.facts.executablePath)}function qt(e){if(e)return[n.execPath,_(e,`dist`,`cli.mjs`),`--version`]}async function Jt(e,t,r,i){let a;try{a=await fetch(e)}catch(t){return X(`network`,`Failed to download ${e}.`,t)}if(!a.ok)return X(`network`,`Failed to download ${e}: HTTP ${a.status}.`);let s=await c(_(g(t),`.quantex-upgrade-`)),l=_(s,h(t)),u=`${t}.bak`,p=!1;try{let c=ie.from(await a.arrayBuffer()),h=await Yt(t),g=tn(c);if(g!==nn(r))return X(`checksum`,`Checksum mismatch for ${e}. Expected ${nn(r)}, got ${g}.`);if(await m(l,c),n.platform===`win32`)return Xt(l,t,u,s,i);await o(l,h),await f(u,{force:!0}),await d(t,u),p=!0,await d(l,t);let _=await en(t,i);return _.success?(p=!1,await f(u,{force:!0}),{success:!0}):(await $t(u,t),p=!1,_)}catch(e){if(p){try{await $t(u,t)}catch{}p=!1}return X(Qt(e),`Failed to replace the current Quantex binary.`,e)}finally{n.platform!==`win32`&&await f(s,{recursive:!0,force:!0})}}async function Yt(e){try{return(await p(e)).mode&511}catch{return 493}}function Xt(e,t,r,i,a){try{return P([`powershell.exe`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-WindowStyle`,`Hidden`,`-Command`,Zt(e,t,r,i,n.pid,a)],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0}).unref(),{success:!0}}catch(e){return X(`locked`,`Failed to schedule Windows binary replacement.`,e)}}function Zt(e,t,n,r,i,a){let o=Y(e),s=Y(t),c=Y(n),l=Y(r),u=Y(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 Y(e){return e.replaceAll(`'`,`''`)}function X(e,t,n){return{error:{detail:n,kind:e,message:t},success:!1}}function Qt(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 $t(e,t){await f(t,{force:!0}),await d(e,t)}async function en(e,t){if(!t)return{success:!0};try{let{exitCode:n,stdout:r}=await F(P([e,`--version`],{stdio:[`ignore`,`pipe`,`ignore`]}));return n===0?r.includes(t)?{success:!0}:X(`verify`,`The upgraded Quantex binary reported an unexpected version during verification.`):X(`verify`,`The upgraded Quantex binary exited with code ${n} during verification.`)}catch(e){return X(`verify`,`Failed to execute the upgraded Quantex binary for verification.`,e)}}function tn(t){return e(`sha256`).update(t).digest(`hex`)}function nn(e){return e.trim().toLowerCase()}const rn={source:`binary`,canHandle:e=>an(e)===`binary`,getRecoveryHint:(e,t)=>{let n=t?.error?.detail&&typeof t.error.detail==`object`&&`downloadUrl`in t.error.detail?String(t.error.detail.downloadUrl):pt(e.executablePath);if(n)return t?.error?.kind===`locked`?`close other qtx processes and retry, or download and replace the binary from ${n}`:t?.error?.kind===`permission`?`check write permission for the current binary path, or download and replace the binary from ${n}`:t?.error?.kind===`network`?`check network access and retry, or download and replace the binary from ${n}`:`download and replace the binary from ${n}`},async upgrade(e){let t=e.target.binaryAsset;if(!t)return{error:e.target.resolutionError??{kind:`unsupported`,message:`No release artifact is available for the current platform and architecture.`},installSource:e.facts.installSource,success:!1};let n=await Jt(t.downloadUrl,e.facts.executablePath,t.checksum,e.target.targetVersion??`latest`);return{...!n.success&&n.error?{...n,error:{...n.error,detail:{...typeof n.error.detail==`object`&&n.error.detail?n.error.detail:{},downloadUrl:t.downloadUrl}}}:n,installSource:e.facts.installSource,newVersion:n.success?e.target.targetVersion:void 0}}};function an(e){return`facts`in e?e.facts.installSource:e.installSource}async function Z(e,t,n){try{let r=t?`${e}@${t}`:e,i=C(n);return await Q([`bun`,`add`,`-g`,...i?[`--registry`,i]:[],r],[e])}catch{return!1}}async function on(e,t=`latest-major`,n=`latest`,r){try{let i=n===`latest`?e:`${e}@${n}`,a=C(r);return await Q([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...a?[`--registry`,a]:[],i],[e])}catch{return!1}}async function sn(e,t=`latest-major`){if(e.length===0)return!0;try{return await Q([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function cn(e){try{return await N(M([`bun`,`remove`,`-g`,e]))===0}catch{return!1}}async function ln(e){try{let{exitCode:t,stdout:n}=await F(P([`bun`,`pm`,`-g`,`ls`],{stdio:mn()}));return t===0?un(n,e):void 0}catch{return}}function un(e,t){let n=`${t}@`;for(let t of e.split(`
|
|
5
|
+
`)){let e=t.trim().split(/\s+/).at(-1);if(!e?.startsWith(n))continue;let r=e.slice(n.length);if(r)return r}}async function Q(e,t){return await N(M(e))===0?dn(t):!1}async function dn(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await fn();if(!n)return!0;let r=pn(n),i=t.filter(e=>r.has(e));return i.length===0?!0:await N(M([`bun`,`pm`,`-g`,`trust`,...i]))===0}async function fn(){try{let{exitCode:e,stdout:t}=await F(P([`bun`,`pm`,`-g`,`untrusted`],{stdio:mn()}));return e===0?t:void 0}catch{return}}function pn(e){let t=new Set;for(let n of e.split(`
|
|
6
|
+
`)){let e=n.replaceAll(`\\`,`/`).match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function mn(){return[`ignore`,`pipe`,`ignore`]}const hn={source:`bun`,canHandle:e=>gn(e)===`bun`,getRecoveryHint:e=>`bun add -g ${A}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await Z(A,e.target.packageTag??(e.facts.updateChannel===`beta`?`beta`:`latest`),e.target.managedRegistry);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${A} through Bun.`},installSource:e.facts.installSource,newVersion:t?e.target.targetVersion:void 0,success:t}}};function gn(e){return`facts`in e?e.facts.installSource:e.installSource}async function _n(e,t,n){try{let r=t?`${e}@${t}`:e,i=C(n);return await N(M([`npm`,`install`,`-g`,r,...i?[`--registry`,i]:[]]))===0}catch{return!1}}async function vn(e,t=`latest-major`,n=`latest`,r){try{let i=C(r);return await N(M(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@${n}`,...i?[`--registry`,i]:[]]:[`npm`,`update`,`-g`,e,...i?[`--registry`,i]:[]]))===0}catch{return!1}}async function yn(e,t=`latest-major`){if(e.length===0)return!0;try{return await N(M(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e]))===0}catch{return!1}}async function bn(e){try{return await N(M([`npm`,`uninstall`,`-g`,e]))===0}catch{return!1}}async function xn(e){try{let{exitCode:t,stdout:n}=await F(P([`npm`,`list`,`-g`,`--depth=0`,`--json`],{stdio:[`ignore`,`pipe`,`ignore`]}));return t===0?Sn(n,e):void 0}catch{return}}function Sn(e,t){let n=JSON.parse(e).dependencies?.[t]?.version;return typeof n==`string`?n:void 0}const Cn={source:`npm`,canHandle:e=>wn(e)===`npm`,getRecoveryHint:e=>`npm install -g ${A}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await _n(A,e.target.packageTag??(e.facts.updateChannel===`beta`?`beta`:`latest`),e.target.managedRegistry);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${A} through npm.`},installSource:e.facts.installSource,newVersion:t?e.target.targetVersion:void 0,success:t}}};function wn(e){return`facts`in e?e.facts.installSource:e.installSource}const Tn={source:`source`,canHandle:e=>{let t=`facts`in e?e.facts.installSource:e.installSource;return t===`source`||t===`unknown`},getRecoveryHint:()=>void 0,async upgrade(e){return{error:{kind:`unsupported`,message:`Install source "${e.facts.installSource}" does not support auto-update.`},installSource:e.facts.installSource,success:!1}}},En=[hn,Cn,rn,Tn];function $(e){return En.find(t=>t.canHandle(e))??Tn}function Dn(e,t,n=`stable`){return $({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n})}function On(e,t,n=`stable`,r){return r?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:Dn(e,t,n).getRecoveryHint({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n},r)}function kn(e,t){return t?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:$(e).getRecoveryHint(e,t)}async function An(e){return Ht(await J({updateChannel:e?.updateChannel}))}async function jn(e){let t=await Nn(e),n=await Ne();if(!n)return{error:{kind:`locked`,message:`Another qtx upgrade is already running.`},installSource:t.facts.installSource,success:!1};try{return Ut(t,await $(t).upgrade(t))}finally{await n()}}function Mn(e,t=n.execPath){return On(e,t)}async function Nn(e){return e?`facts`in e?e:e.installSource===`binary`?J({facts:{canAutoUpdate:e.canAutoUpdate,currentVersion:e.currentVersion,executablePath:e.executablePath,installSource:e.installSource,packageRoot:e.packageRoot,updateChannel:e.updateChannel}}):Wt(e):J()}function Pn(e){return Rn({...e,error:null,ok:!0})}function Fn(e){return Rn({...e,ok:!1})}function In(e,t,n={}){let r=b();return r.cancelled&&!n.force||(r.outputMode===`json`?console.log(JSON.stringify(e,null,2)):r.outputMode===`ndjson`?Bn({action:e.action,data:e,target:e.target,type:`result`}):t(e)),e}function Ln(e,t={}){let n=b();if(!(n.cancelled&&!t.force)&&n.outputMode===`ndjson`)return Bn(e)}function Rn(e){let t=b();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:q()},ok:e.ok,target:e.target,warnings:e.warnings??[]}}function zn(e){let t=b();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:q()},target:e.target,type:e.type}}function Bn(e){let t=zn(e);return console.log(JSON.stringify(t)),t}const{createColors:Vn,isColorSupported:Hn}=ae;function Un(){let e=b().colorMode??`auto`;return Vn(e===`always`?!0:e===`never`?!1:Hn)}const Wn=new Proxy({},{get(e,t){let n=Un(),r=n[t];return typeof r==`function`?r.bind(n):r}});export{E as $,H as A,V as B,Ct as C,pt as D,G as E,at as F,M as G,z as H,ot as I,Se as J,N as K,Je as L,rt as M,et as N,tt as O,nt as P,ve as Q,Ye as R,J as S,q as T,F as U,Xe as V,P as W,w as X,Me as Y,T as Z,Z as _,In as a,ce as at,sn as b,jn as c,xn as d,ye as et,_n as f,ln as g,yn as h,Ln as i,b as it,U as j,it as k,On as l,vn as m,Fn as n,C as nt,Mn as o,x as ot,bn as p,A as q,Pn as r,ue as rt,An as s,se as st,Wn as t,_e as tt,kn as u,cn as v,K as w,Ht as x,on as y,B as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./commands-Du_EIpHh.mjs";export{e as commandsCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,r as t,t as n}from"./color-
|
|
1
|
+
import{a as e,r as t,t as n}from"./color-B925pi3Z.mjs";const r=[{flags:[`--json`,`--output`,`--non-interactive`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`capabilities`,outputSchemaRef:`#/commands/capabilities`,stability:`stable`,summary:`Return environment and surface capabilities`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`commands`,outputSchemaRef:`#/commands/commands`,stability:`stable`,summary:`Return the stable command catalog`},{flags:[`get`,`set`,`reset`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`config`,outputSchemaRef:`#/commands/config`,stability:`stable`,summary:`Read and modify Quantex configuration`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`doctor`,outputSchemaRef:`#/commands/doctor`,stability:`stable`,summary:`Diagnose the current environment and installed tools`},{flags:[`--install`,`--non-interactive`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--output`],name:`exec`,outputSchemaRef:`#/commands/exec`,stability:`stable`,summary:`Run an agent with explicit install policy`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`ensure`,outputSchemaRef:`#/commands/ensure`,stability:`stable`,summary:`Ensure an agent is installed`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`info`,outputSchemaRef:`#/commands/info`,stability:`stable`,summary:`Show human-friendly agent details`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`inspect`,outputSchemaRef:`#/commands/inspect`,stability:`stable`,summary:`Return structured agent state`},{flags:[`--json`,`--output`,`--yes`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`install`,outputSchemaRef:`#/commands/install`,stability:`stable`,summary:`Install one or more agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`list`,outputSchemaRef:`#/commands/list`,stability:`stable`,summary:`List supported agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--refresh`,`--no-cache`,`--timeout`],name:`resolve`,outputSchemaRef:`#/commands/resolve`,stability:`stable`,summary:`Resolve an agent executable entrypoint`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--timeout`],name:`schema`,outputSchemaRef:`#/commands/schema`,stability:`stable`,summary:`Return structured output schemas`},{flags:[`--all`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`update`,outputSchemaRef:`#/commands/update`,stability:`stable`,summary:`Update one or all agents`},{flags:[`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--timeout`,`--idempotency-key`],name:`uninstall`,outputSchemaRef:`#/commands/uninstall`,stability:`stable`,summary:`Uninstall an agent`},{flags:[`--check`,`--channel`,`--json`,`--output`,`--quiet`,`--color`,`--log-level`,`--dry-run`,`--refresh`,`--no-cache`,`--timeout`,`--idempotency-key`],name:`upgrade`,outputSchemaRef:`#/commands/upgrade`,stability:`stable`,summary:`Upgrade Quantex CLI itself`}];async function i(){return e(t({action:`commands`,data:{commands:r},target:{kind:`system`,name:`commands`}}),a)}function a(e){if(e.data){console.log(n.bold(`
|
|
2
2
|
Quantex Commands
|
|
3
3
|
`));for(let t of e.data.commands){let e=t.flags.length>0?n.dim(` [${t.flags.join(`, `)}]`):``;console.log(` ${n.cyan(t.name)}${e}`),console.log(` ${t.summary}`),console.log(` ${n.dim(t.outputSchemaRef)}`)}console.log()}}export{i as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as e,Q as t,a as n,et as r,n as i,nt as a,r as o,t as s,tt as c}from"./color-
|
|
1
|
+
import{$ as e,Q as t,a as n,et as r,n as i,nt as a,r as o,t as s,tt as c}from"./color-B925pi3Z.mjs";async function l(s,l,d){if(!s)return n(o({action:`config`,data:{action:`list`,config:await e()},target:{kind:`config`}}),u);switch(s){case`get`:{if(!l)return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify a key`},target:{kind:`config`}}),u);let t=(await e())[l];return n(o({action:`config`,data:{action:`get`,key:l,value:typeof t==`number`||typeof t==`string`?t:void 0},target:{kind:`config`,name:l}}),u)}case`set`:{if(!l||d===void 0)return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`Please specify both key and value`},target:{kind:`config`}}),u);if(l===`defaultPackageManager`&&d!==`bun`&&d!==`npm`)return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`defaultPackageManager must be bun or npm`},target:{kind:`config`,name:l}}),u);if(l===`npmBunUpdateStrategy`&&!t(d))return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`npmBunUpdateStrategy must be latest-major or respect-semver`},target:{kind:`config`,name:l}}),u);if(l===`selfUpdateChannel`&&d!==`stable`&&d!==`beta`)return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateChannel must be stable or beta`},target:{kind:`config`,name:l}}),u);if(l===`selfUpdateRegistry`&&!a(d))return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`selfUpdateRegistry must be a valid absolute URL`},target:{kind:`config`,name:l}}),u);if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(l)){let e=Number.parseInt(d,10);if(!Number.isInteger(e)||e<=0)return n(i({action:`config`,error:{code:`INVALID_ARGUMENT`,message:`${l} must be a positive integer`},target:{kind:`config`,name:l}}),u);d=`${e}`}let s={};try{s=await e()}catch{}return s[l]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(l)?Number.parseInt(d,10):l===`selfUpdateRegistry`?a(d):d,await r(s),n(o({action:`config`,data:{action:`set`,key:l,value:s[l]},target:{kind:`config`,name:l}}),u)}case`reset`:return await r(c),n(o({action:`config`,data:{action:`reset`,config:c},target:{kind:`config`}}),u);default:return n(i({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`}]}),u)}}function u(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{l as configCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,k as t}from"./color-CCa8Z1Vv.mjs";import n from"node:process";function r(e){return{packageName:e,type:`bun`}}function i(e){return{packageName:e,type:`npm`}}function a(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function o(e,t){return{packageInstallArgs:t,packageName:e,type:`cargo`}}function s(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function c(e){return{command:e,type:`script`}}function l(e){return{command:e,type:`binary`}}const u={name:`amp`,displayName:`Amp`,homepage:`https://ampcode.com/`,packages:{npm:`@sourcegraph/amp`},binaryName:`amp`,selfUpdate:{command:[`amp`,`update`]},versionProbe:{command:[`amp`,`version`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},d={name:`auggie`,displayName:`Auggie CLI`,homepage:`https://docs.augmentcode.com/cli/overview`,packages:{npm:`@augmentcode/auggie`},binaryName:`auggie`,selfUpdate:{command:[`auggie`,`upgrade`]},versionProbe:{command:[`auggie`,`--version`]},platforms:{macos:[r(),i()],linux:[r(),i()]}},f={name:`autohand`,lookupAliases:[`autohand-cli`],displayName:`Autohand Code CLI`,homepage:`https://autohand.ai/cli/`,packages:{npm:`autohand-cli`},binaryName:`autohand`,versionProbe:{command:[`autohand`,`--version`]},platforms:{windows:[c(`iwr -useb https://autohand.ai/install.ps1 | iex`)],macos:[c(`curl -fsSL https://autohand.ai/install.sh | bash`)],linux:[c(`curl -fsSL https://autohand.ai/install.sh | bash`)]}},p={name:`claude`,displayName:`Claude Code`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,selfUpdate:{command:[`claude`,`update`],fallbackCommands:[[`claude`,`upgrade`]]},platforms:{windows:[r(),i(),c(`irm https://claude.ai/install.ps1 | iex`),s(`Anthropic.ClaudeCode`)],macos:[r(),i(),c(`curl -fsSL https://claude.ai/install.sh | bash`),a(`claude-code`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://claude.ai/install.sh | bash`),a(`claude-code`,`cask`)]}},m={name:`codebuddy`,lookupAliases:[`codebuddy-code`],displayName:`CodeBuddy Code`,homepage:`https://www.codebuddy.cn/docs/cli/installation`,packages:{npm:`@tencent-ai/codebuddy-code`},binaryName:`codebuddy`,selfUpdate:{command:[`codebuddy`,`update`]},versionProbe:{command:[`codebuddy`,`--version`]},platforms:{windows:[r(),i(),c(`irm https://www.codebuddy.cn/cli/install.ps1 | iex`)],macos:[r(),i(),c(`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`),a(`Tencent-CodeBuddy/tap/codebuddy-code`)],linux:[r(),i(),c(`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`),a(`Tencent-CodeBuddy/tap/codebuddy-code`)]}},h={name:`codex`,displayName:`Codex CLI`,homepage:`https://developers.openai.com/codex/cli`,packages:{npm:`@openai/codex`},binaryName:`codex`,selfUpdate:{command:[`codex`,`--upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i(),a(`codex`)],linux:[r(),i(),a(`codex`)]}},g={name:`copilot`,displayName:`GitHub Copilot CLI`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[s(`GitHub.Copilot`)],macos:[r(),i(),c(`curl -fsSL https://gh.io/copilot-install | bash`),a(`copilot-cli`)],linux:[r(),i(),c(`curl -fsSL https://gh.io/copilot-install | bash`),a(`copilot-cli`)]}},_={name:`crush`,displayName:`Crush`,homepage:`https://github.com/charmbracelet/crush`,packages:{npm:`@charmland/crush`},binaryName:`crush`,selfUpdate:{command:[`crush`,`update`]},versionProbe:{command:[`crush`,`--version`]},platforms:{windows:[r(),i(),s(`charmbracelet.crush`)],macos:[r(),i(),a(`charmbracelet/tap/crush`)],linux:[r(),i(),a(`charmbracelet/tap/crush`)]}},v={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,selfUpdate:{command:[`agent`,`update`]},versionProbe:{command:[`agent`,`--version`]},platforms:{windows:[c(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[c(`curl https://cursor.com/install -fsS | bash`)],linux:[c(`curl https://cursor.com/install -fsS | bash`)]}},y={name:`deepseek`,lookupAliases:[`deepseek-tui`],displayName:`DeepSeek TUI`,homepage:`https://github.com/Hmbown/DeepSeek-TUI`,packages:{cargo:`deepseek-tui-cli`,npm:`deepseek-tui`},binaryName:`deepseek`,selfUpdate:{command:[`deepseek`,`update`]},versionProbe:{command:[`deepseek`,`--version`]},platforms:{windows:[i(),o(void 0,[`--locked`])],macos:[i(),o(void 0,[`--locked`])],linux:[i(),o(void 0,[`--locked`])]}},b={name:`devin`,displayName:`Devin for Terminal`,homepage:`https://cli.devin.ai/`,binaryName:`devin`,selfUpdate:{command:[`devin`,`update`]},versionProbe:{command:[`devin`,`version`]},platforms:{windows:[c(`irm https://static.devin.ai/cli/setup.ps1 | iex`)],macos:[c(`curl -fsSL https://cli.devin.ai/install.sh | bash`)],linux:[c(`curl -fsSL https://cli.devin.ai/install.sh | bash`)]}},x={name:`droid`,displayName:`Droid`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,selfUpdate:{command:[`droid`,`update`]},platforms:{windows:[r(),i(),c(`irm https://app.factory.ai/cli/windows | iex`)],macos:[r(),i(),c(`curl -fsSL https://app.factory.ai/cli | sh`),a(`droid`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://app.factory.ai/cli | sh`),a(`droid`,`cask`)]}},S={name:`forgecode`,lookupAliases:[`forge`],displayName:`ForgeCode`,homepage:`https://forgecode.dev`,packages:{npm:`forgecode`},binaryName:`forge`,selfUpdate:{command:[`forge`,`update`]},versionProbe:{command:[`forge`,`--version`]},platforms:{windows:[r(),i(),c(`irm https://forgecode.dev/cli | iex`)],macos:[r(),i(),c(`curl -fsSL https://forgecode.dev/cli | sh`)],linux:[r(),i(),c(`curl -fsSL https://forgecode.dev/cli | sh`)]}},C={name:`gemini`,displayName:`Gemini CLI`,homepage:`https://google-gemini.github.io/gemini-cli/docs/`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[r(),i()],macos:[r(),i(),a(`gemini-cli`)],linux:[r(),i(),a(`gemini-cli`)]}},w={name:`goose`,displayName:`Goose`,homepage:`https://github.com/aaif-goose/goose`,binaryName:`goose`,selfUpdate:{command:[`goose`,`update`]},versionProbe:{command:[`goose`,`--version`]},platforms:{windows:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),c(`Invoke-WebRequest -Uri "https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1" -OutFile "download_cli.ps1"; ./download_cli.ps1`)],macos:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),a(`block-goose-cli`)],linux:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),a(`block-goose-cli`)]}},T={name:`jcode`,displayName:`JCode`,homepage:`https://github.com/1jehuang/jcode`,binaryName:`jcode`,versionProbe:{command:[`jcode`,`--version`]},platforms:{windows:[c(`irm https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.ps1 | iex`)],macos:[a(`1jehuang/jcode/jcode`),c(`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`)],linux:[c(`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`)]}},E={name:`junie`,displayName:`Junie CLI`,homepage:`https://junie.jetbrains.com/docs/junie-cli.html`,packages:{npm:`@jetbrains/junie`},binaryName:`junie`,versionProbe:{command:[`junie`,`--version`]},platforms:{windows:[r(),i(),c(`iex (irm 'https://junie.jetbrains.com/install.ps1')`)],macos:[r(),i(),c(`curl -fsSL https://junie.jetbrains.com/install.sh | bash`),a(`jetbrains-junie/junie/junie`)],linux:[r(),i(),c(`curl -fsSL https://junie.jetbrains.com/install.sh | bash`),a(`jetbrains-junie/junie/junie`)]}},D={name:`kilo`,displayName:`Kilo CLI`,homepage:`https://kilo.ai/docs/cli`,packages:{npm:`@kilocode/cli`},binaryName:`kilo`,selfUpdate:{command:[`kilo`,`upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},O={name:`kimi`,lookupAliases:[`kimi-code`,`kimi-cli`],displayName:`Kimi Code`,homepage:`https://moonshotai.github.io/kimi-cli/`,binaryName:`kimi`,selfUpdate:{command:[`uv`,`tool`,`upgrade`,`kimi-cli`,`--no-cache`]},versionProbe:{command:[`kimi`,`--version`]},platforms:{windows:[c(`irm https://code.kimi.com/install.ps1 | iex`)],macos:[c(`curl -LsSf https://code.kimi.com/install.sh | bash`)],linux:[c(`curl -LsSf https://code.kimi.com/install.sh | bash`)]}},k={name:`kiro`,lookupAliases:[`kiro-cli`],displayName:`Kiro CLI`,homepage:`https://kiro.dev/cli/`,binaryName:`kiro-cli`,versionProbe:{command:[`kiro-cli`,`--version`]},platforms:{windows:[c(`irm 'https://cli.kiro.dev/install.ps1' | iex`)],macos:[c(`curl -fsSL https://cli.kiro.dev/install | bash`)],linux:[c(`curl -fsSL https://cli.kiro.dev/install | bash`)]}},A={name:`opencode`,displayName:`OpenCode`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,selfUpdate:{command:[`opencode`,`upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i(),c(`curl -fsSL https://opencode.ai/install | bash`),a(`anomalyco/tap/opencode`)],linux:[r(),i(),c(`curl -fsSL https://opencode.ai/install | bash`),a(`anomalyco/tap/opencode`)]}},j={name:`openhands`,displayName:`OpenHands CLI`,homepage:`https://docs.openhands.dev/openhands/usage/cli/installation`,binaryName:`openhands`,selfUpdate:{command:[`uv`,`tool`,`upgrade`,`openhands`,`--python`,`3.12`]},versionProbe:{command:[`openhands`,`--version`]},platforms:{macos:[l(`uv tool install openhands --python 3.12`),c(`curl -fsSL https://install.openhands.dev/install.sh | sh`)],linux:[l(`uv tool install openhands --python 3.12`),c(`curl -fsSL https://install.openhands.dev/install.sh | sh`)]}},M={name:`pi`,displayName:`Pi`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,selfUpdate:{command:[`pi`,`update`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},N={name:`qoder`,lookupAliases:[`qodercli`],displayName:`Qoder CLI`,homepage:`https://docs.qoder.com/cli/quick-start`,packages:{npm:`@qoder-ai/qodercli`},binaryName:`qodercli`,selfUpdate:{command:[`qodercli`,`update`]},platforms:{windows:[r(),i()],macos:[r(),i(),c(`curl -fsSL https://qoder.com/install | bash`),a(`qoderai/qoder/qodercli`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://qoder.com/install | bash`),a(`qoderai/qoder/qodercli`,`cask`)]}},P={name:`qwen`,displayName:`Qwen Code`,homepage:`https://qwenlm.github.io/qwen-code-docs/`,packages:{npm:`@qwen-code/qwen-code`},binaryName:`qwen`,platforms:{windows:[c(`curl -fsSL -o %TEMP%\\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\\install-qwen.bat`),r(),i()],macos:[c(`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`),r(),i(),a(`qwen-code`)],linux:[c(`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`),r(),i(),a(`qwen-code`)]}},F={name:`reasonix`,lookupAliases:[`deepseek-reasonix`],displayName:`Reasonix`,homepage:`https://github.com/esengine/DeepSeek-Reasonix`,packages:{npm:`reasonix`},binaryName:`reasonix`,selfUpdate:{command:[`reasonix`,`update`]},versionProbe:{command:[`reasonix`,`--version`]},platforms:{windows:[i()],macos:[i()],linux:[i()]}},I={name:`vibe`,lookupAliases:[`mistral-vibe`],displayName:`Mistral Vibe`,homepage:`https://docs.mistral.ai/mistral-vibe/terminal/install`,binaryName:`vibe`,versionProbe:{command:[`vibe`,`--version`]},platforms:{windows:[l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)],macos:[c(`curl -LsSf https://mistral.ai/vibe/install.sh | bash`),l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)],linux:[c(`curl -LsSf https://mistral.ai/vibe/install.sh | bash`),l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)]}},L={name:`vtcode`,displayName:`VTCode`,homepage:`https://github.com/vinhnx/vtcode`,packages:{cargo:`vtcode`},binaryName:`vtcode`,selfUpdate:{command:[`vtcode`,`update`]},versionProbe:{command:[`vtcode`,`--version`]},platforms:{windows:[c(`irm https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.ps1 | iex`),o()],macos:[c(`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`),o(),a(`vtcode`)],linux:[c(`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`),o(),a(`vtcode`)]}},R=[d,f,u,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,j,A,M,N,P,F,I,L];function z(){return R}function B(e){return R.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function V(e){return B(e)}function H(){switch(n.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function U(n){try{let{exitCode:r}=await t(e([n,`--version`]));return r===0}catch{return!1}}async function W(){return U(`bun`)}async function G(){return U(`npm`)}async function K(){return U(`brew`)}async function q(){return U(`cargo`)}async function J(){return U(`winget`)}async function Y(r){try{let{exitCode:i}=await t(e([n.platform===`win32`?`where`:`which`,r]));return i===0}catch{return!1}}export{f as A,b as C,h as D,g as E,m as O,x as S,v as T,A as _,q as a,T as b,B as c,L as d,I as f,j as g,M as h,W as i,p as k,V as l,N as m,Y as n,G as o,F as p,K as r,J as s,H as t,z as u,D as v,y as w,C as x,E as y};
|
|
1
|
+
import{U as e,W as t}from"./color-B925pi3Z.mjs";import n from"node:process";function r(e){return{packageName:e,type:`bun`}}function i(e){return{packageName:e,type:`npm`}}function a(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function o(e,t){return{packageInstallArgs:t,packageName:e,type:`cargo`}}function s(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function c(e){return{command:e,type:`script`}}function l(e){return{command:e,type:`binary`}}const u={name:`amp`,displayName:`Amp`,homepage:`https://ampcode.com/`,packages:{npm:`@sourcegraph/amp`},binaryName:`amp`,selfUpdate:{command:[`amp`,`update`]},versionProbe:{command:[`amp`,`version`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},d={name:`auggie`,displayName:`Auggie CLI`,homepage:`https://docs.augmentcode.com/cli/overview`,packages:{npm:`@augmentcode/auggie`},binaryName:`auggie`,selfUpdate:{command:[`auggie`,`upgrade`]},versionProbe:{command:[`auggie`,`--version`]},platforms:{macos:[r(),i()],linux:[r(),i()]}},f={name:`autohand`,lookupAliases:[`autohand-cli`],displayName:`Autohand Code CLI`,homepage:`https://autohand.ai/cli/`,packages:{npm:`autohand-cli`},binaryName:`autohand`,versionProbe:{command:[`autohand`,`--version`]},platforms:{windows:[c(`iwr -useb https://autohand.ai/install.ps1 | iex`)],macos:[c(`curl -fsSL https://autohand.ai/install.sh | bash`)],linux:[c(`curl -fsSL https://autohand.ai/install.sh | bash`)]}},p={name:`claude`,displayName:`Claude Code`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,selfUpdate:{command:[`claude`,`update`],fallbackCommands:[[`claude`,`upgrade`]]},platforms:{windows:[r(),i(),c(`irm https://claude.ai/install.ps1 | iex`),s(`Anthropic.ClaudeCode`)],macos:[r(),i(),c(`curl -fsSL https://claude.ai/install.sh | bash`),a(`claude-code`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://claude.ai/install.sh | bash`),a(`claude-code`,`cask`)]}},m={name:`codebuddy`,lookupAliases:[`codebuddy-code`],displayName:`CodeBuddy Code`,homepage:`https://www.codebuddy.cn/docs/cli/installation`,packages:{npm:`@tencent-ai/codebuddy-code`},binaryName:`codebuddy`,selfUpdate:{command:[`codebuddy`,`update`]},versionProbe:{command:[`codebuddy`,`--version`]},platforms:{windows:[r(),i(),c(`irm https://www.codebuddy.cn/cli/install.ps1 | iex`)],macos:[r(),i(),c(`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`),a(`Tencent-CodeBuddy/tap/codebuddy-code`)],linux:[r(),i(),c(`curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash`),a(`Tencent-CodeBuddy/tap/codebuddy-code`)]}},h={name:`codex`,displayName:`Codex CLI`,homepage:`https://developers.openai.com/codex/cli`,packages:{npm:`@openai/codex`},binaryName:`codex`,selfUpdate:{command:[`codex`,`--upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i(),a(`codex`)],linux:[r(),i(),a(`codex`)]}},g={name:`copilot`,displayName:`GitHub Copilot CLI`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[s(`GitHub.Copilot`)],macos:[r(),i(),c(`curl -fsSL https://gh.io/copilot-install | bash`),a(`copilot-cli`)],linux:[r(),i(),c(`curl -fsSL https://gh.io/copilot-install | bash`),a(`copilot-cli`)]}},_={name:`crush`,displayName:`Crush`,homepage:`https://github.com/charmbracelet/crush`,packages:{npm:`@charmland/crush`},binaryName:`crush`,selfUpdate:{command:[`crush`,`update`]},versionProbe:{command:[`crush`,`--version`]},platforms:{windows:[r(),i(),s(`charmbracelet.crush`)],macos:[r(),i(),a(`charmbracelet/tap/crush`)],linux:[r(),i(),a(`charmbracelet/tap/crush`)]}},v={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,selfUpdate:{command:[`agent`,`update`]},versionProbe:{command:[`agent`,`--version`]},platforms:{windows:[c(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[c(`curl https://cursor.com/install -fsS | bash`)],linux:[c(`curl https://cursor.com/install -fsS | bash`)]}},y={name:`deepseek`,lookupAliases:[`deepseek-tui`],displayName:`DeepSeek TUI`,homepage:`https://github.com/Hmbown/DeepSeek-TUI`,packages:{cargo:`deepseek-tui-cli`,npm:`deepseek-tui`},binaryName:`deepseek`,selfUpdate:{command:[`deepseek`,`update`]},versionProbe:{command:[`deepseek`,`--version`]},platforms:{windows:[i(),o(void 0,[`--locked`])],macos:[i(),o(void 0,[`--locked`])],linux:[i(),o(void 0,[`--locked`])]}},b={name:`devin`,displayName:`Devin for Terminal`,homepage:`https://cli.devin.ai/`,binaryName:`devin`,selfUpdate:{command:[`devin`,`update`]},versionProbe:{command:[`devin`,`version`]},platforms:{windows:[c(`irm https://static.devin.ai/cli/setup.ps1 | iex`)],macos:[c(`curl -fsSL https://cli.devin.ai/install.sh | bash`)],linux:[c(`curl -fsSL https://cli.devin.ai/install.sh | bash`)]}},x={name:`droid`,displayName:`Droid`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,selfUpdate:{command:[`droid`,`update`]},platforms:{windows:[r(),i(),c(`irm https://app.factory.ai/cli/windows | iex`)],macos:[r(),i(),c(`curl -fsSL https://app.factory.ai/cli | sh`),a(`droid`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://app.factory.ai/cli | sh`),a(`droid`,`cask`)]}},S={name:`forgecode`,lookupAliases:[`forge`],displayName:`ForgeCode`,homepage:`https://forgecode.dev`,packages:{npm:`forgecode`},binaryName:`forge`,selfUpdate:{command:[`forge`,`update`]},versionProbe:{command:[`forge`,`--version`]},platforms:{windows:[r(),i(),c(`irm https://forgecode.dev/cli | iex`)],macos:[r(),i(),c(`curl -fsSL https://forgecode.dev/cli | sh`)],linux:[r(),i(),c(`curl -fsSL https://forgecode.dev/cli | sh`)]}},C={name:`gemini`,displayName:`Gemini CLI`,homepage:`https://google-gemini.github.io/gemini-cli/docs/`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[r(),i()],macos:[r(),i(),a(`gemini-cli`)],linux:[r(),i(),a(`gemini-cli`)]}},w={name:`goose`,displayName:`Goose`,homepage:`https://github.com/aaif-goose/goose`,binaryName:`goose`,selfUpdate:{command:[`goose`,`update`]},versionProbe:{command:[`goose`,`--version`]},platforms:{windows:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),c(`Invoke-WebRequest -Uri "https://raw.githubusercontent.com/aaif-goose/goose/main/download_cli.ps1" -OutFile "download_cli.ps1"; ./download_cli.ps1`)],macos:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),a(`block-goose-cli`)],linux:[c(`curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash`),a(`block-goose-cli`)]}},T={name:`jcode`,displayName:`JCode`,homepage:`https://github.com/1jehuang/jcode`,binaryName:`jcode`,versionProbe:{command:[`jcode`,`--version`]},platforms:{windows:[c(`irm https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.ps1 | iex`)],macos:[a(`1jehuang/jcode/jcode`),c(`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`)],linux:[c(`curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash`)]}},E={name:`junie`,displayName:`Junie CLI`,homepage:`https://junie.jetbrains.com/docs/junie-cli.html`,packages:{npm:`@jetbrains/junie`},binaryName:`junie`,versionProbe:{command:[`junie`,`--version`]},platforms:{windows:[r(),i(),c(`iex (irm 'https://junie.jetbrains.com/install.ps1')`)],macos:[r(),i(),c(`curl -fsSL https://junie.jetbrains.com/install.sh | bash`),a(`jetbrains-junie/junie/junie`)],linux:[r(),i(),c(`curl -fsSL https://junie.jetbrains.com/install.sh | bash`),a(`jetbrains-junie/junie/junie`)]}},D={name:`kilo`,displayName:`Kilo CLI`,homepage:`https://kilo.ai/docs/cli`,packages:{npm:`@kilocode/cli`},binaryName:`kilo`,selfUpdate:{command:[`kilo`,`upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},O={name:`kimi`,lookupAliases:[`kimi-code`,`kimi-cli`],displayName:`Kimi Code`,homepage:`https://moonshotai.github.io/kimi-cli/`,binaryName:`kimi`,selfUpdate:{command:[`uv`,`tool`,`upgrade`,`kimi-cli`,`--no-cache`]},versionProbe:{command:[`kimi`,`--version`]},platforms:{windows:[c(`irm https://code.kimi.com/install.ps1 | iex`)],macos:[c(`curl -LsSf https://code.kimi.com/install.sh | bash`)],linux:[c(`curl -LsSf https://code.kimi.com/install.sh | bash`)]}},k={name:`kiro`,lookupAliases:[`kiro-cli`],displayName:`Kiro CLI`,homepage:`https://kiro.dev/cli/`,binaryName:`kiro-cli`,versionProbe:{command:[`kiro-cli`,`--version`]},platforms:{windows:[c(`irm 'https://cli.kiro.dev/install.ps1' | iex`)],macos:[c(`curl -fsSL https://cli.kiro.dev/install | bash`)],linux:[c(`curl -fsSL https://cli.kiro.dev/install | bash`)]}},A={name:`opencode`,displayName:`OpenCode`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,selfUpdate:{command:[`opencode`,`upgrade`]},platforms:{windows:[r(),i()],macos:[r(),i(),c(`curl -fsSL https://opencode.ai/install | bash`),a(`anomalyco/tap/opencode`)],linux:[r(),i(),c(`curl -fsSL https://opencode.ai/install | bash`),a(`anomalyco/tap/opencode`)]}},j={name:`openhands`,displayName:`OpenHands CLI`,homepage:`https://docs.openhands.dev/openhands/usage/cli/installation`,binaryName:`openhands`,selfUpdate:{command:[`uv`,`tool`,`upgrade`,`openhands`,`--python`,`3.12`]},versionProbe:{command:[`openhands`,`--version`]},platforms:{macos:[l(`uv tool install openhands --python 3.12`),c(`curl -fsSL https://install.openhands.dev/install.sh | sh`)],linux:[l(`uv tool install openhands --python 3.12`),c(`curl -fsSL https://install.openhands.dev/install.sh | sh`)]}},M={name:`pi`,displayName:`Pi`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,selfUpdate:{command:[`pi`,`update`]},platforms:{windows:[r(),i()],macos:[r(),i()],linux:[r(),i()]}},N={name:`qoder`,lookupAliases:[`qodercli`],displayName:`Qoder CLI`,homepage:`https://docs.qoder.com/cli/quick-start`,packages:{npm:`@qoder-ai/qodercli`},binaryName:`qodercli`,selfUpdate:{command:[`qodercli`,`update`]},platforms:{windows:[r(),i()],macos:[r(),i(),c(`curl -fsSL https://qoder.com/install | bash`),a(`qoderai/qoder/qodercli`,`cask`)],linux:[r(),i(),c(`curl -fsSL https://qoder.com/install | bash`),a(`qoderai/qoder/qodercli`,`cask`)]}},P={name:`qwen`,displayName:`Qwen Code`,homepage:`https://qwenlm.github.io/qwen-code-docs/`,packages:{npm:`@qwen-code/qwen-code`},binaryName:`qwen`,platforms:{windows:[c(`curl -fsSL -o %TEMP%\\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\\install-qwen.bat`),r(),i()],macos:[c(`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`),r(),i(),a(`qwen-code`)],linux:[c(`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh | bash`),r(),i(),a(`qwen-code`)]}},F={name:`reasonix`,lookupAliases:[`deepseek-reasonix`],displayName:`Reasonix`,homepage:`https://github.com/esengine/DeepSeek-Reasonix`,packages:{npm:`reasonix`},binaryName:`reasonix`,selfUpdate:{command:[`reasonix`,`update`]},versionProbe:{command:[`reasonix`,`--version`]},platforms:{windows:[i()],macos:[i()],linux:[i()]}},I={name:`vibe`,lookupAliases:[`mistral-vibe`],displayName:`Mistral Vibe`,homepage:`https://docs.mistral.ai/mistral-vibe/terminal/install`,binaryName:`vibe`,versionProbe:{command:[`vibe`,`--version`]},platforms:{windows:[l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)],macos:[c(`curl -LsSf https://mistral.ai/vibe/install.sh | bash`),l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)],linux:[c(`curl -LsSf https://mistral.ai/vibe/install.sh | bash`),l(`uv tool install mistral-vibe`),l(`pip install mistral-vibe`)]}},L={name:`vtcode`,displayName:`VTCode`,homepage:`https://github.com/vinhnx/vtcode`,packages:{cargo:`vtcode`},binaryName:`vtcode`,selfUpdate:{command:[`vtcode`,`update`]},versionProbe:{command:[`vtcode`,`--version`]},platforms:{windows:[c(`irm https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.ps1 | iex`),o()],macos:[c(`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`),o(),a(`vtcode`)],linux:[c(`curl -fsSL https://raw.githubusercontent.com/vinhnx/vtcode/main/scripts/install.sh | bash`),o(),a(`vtcode`)]}},R=[d,f,u,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,j,A,M,N,P,F,I,L];function z(){return R}function B(e){return R.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function V(e){return B(e)}function H(){switch(n.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function U(n){try{let{exitCode:r}=await e(t([n,`--version`]));return r===0}catch{return!1}}async function W(){return U(`bun`)}async function G(){return U(`npm`)}async function K(){return U(`brew`)}async function q(){return U(`cargo`)}async function J(){return U(`winget`)}async function Y(r){try{let{exitCode:i}=await e(t([n.platform===`win32`?`where`:`which`,r]));return i===0}catch{return!1}}export{f as A,b as C,h as D,g as E,m as O,x as S,v as T,A as _,q as a,T as b,B as c,L as d,I as f,j as g,M as h,W as i,p as k,V as l,N as m,Y as n,G as o,F as p,K as r,J as s,H as t,z as u,D as v,y as w,C as x,E as y};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{t as n}from"./agents-
|
|
1
|
+
import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{t as n}from"./agents-CnYYCDb7.mjs";import{a as r,i,o as a,r as o,s}from"./detect-CiNZbP5B.mjs";import{H as c,a as l,q as u,r as d,s as f,t as p,u as m}from"./color-B925pi3Z.mjs";async function h(){let u=await i(),p=await a(),h=await o(),v=await r(),y=await s(),b=await f(),x=b.latestVersion?c(b.latestVersion,b.currentVersion):!1,S=await n(),C=S.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})),w=[],T=`docs/runbooks/quantex-troubleshooting.md`,E=`docs/runbooks/release-and-self-upgrade-debugging.md`;if(!u&&!p&&!h&&!v&&!y&&w.push({blocking:!0,category:`installers`,code:`NO_MANAGED_INSTALLER`,docsRef:T,message:`No managed installer found. Install bun, npm, brew, cargo, or winget before relying on managed lifecycle operations.`,severity:`warning`,subject:{kind:`system`},suggestedAction:`restore-managed-installer`,suggestedCommands:[]}),(b.installSource===`bun`&&!u||b.installSource===`npm`&&!p)&&w.push({blocking:!0,category:`self`,code:`SELF_INSTALLER_MISSING`,docsRef:E,message:`Quantex CLI is tracked as a ${b.installSource} install, but ${b.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:_(b.installSource,b.updateChannel)}),b.canAutoUpdate||w.push({blocking:!1,category:`self`,code:`SELF_AUTO_UPDATE_UNAVAILABLE`,docsRef:E,message:`Quantex CLI cannot auto-update from install source "${b.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:[]}),x&&b.recommendedUpgradeCommand){let e=m(b);w.push({blocking:!1,category:`self`,code:`SELF_UPDATE_AVAILABLE`,docsRef:E,message:e?`Quantex CLI ${b.currentVersion} is behind ${b.latestVersion}. Run ${b.recommendedUpgradeCommand} or follow: ${e}`:`Quantex CLI ${b.currentVersion} is behind ${b.latestVersion}. Run ${b.recommendedUpgradeCommand}.`,severity:`warning`,subject:{kind:`self`,name:`quantex`},suggestedAction:`run-self-upgrade`,suggestedCommands:[b.recommendedUpgradeCommand]})}for(let n of S.filter(e=>e.inPath)){if(n.installedState||w.push({blocking:!1,category:`agent`,code:`AGENT_UNTRACKED_IN_PATH`,docsRef:T,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);w.push({blocking:!1,category:`agent`,code:`AGENT_MANUAL_UPDATE_REQUIRED`,docsRef:T,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 l(d({action:`doctor`,data:{agents:C,issues:w,installers:{brew:h,bun:u,cargo:v,npm:p,winget:y},self:{canAutoUpdate:b.canAutoUpdate,currentVersion:b.currentVersion,installSource:b.installSource,latestVersion:b.latestVersion,outdated:!!x,recoveryHint:x?m(b):void 0}},target:{kind:`system`,name:`doctor`}}),g)}function g(e){if(e.data){if(console.log(p.bold(`
|
|
2
2
|
Quantex CLI Environment Check
|
|
3
|
-
`)),console.log(p.bold(`Managed Installers:`)),console.log(` Bun: ${e.data.installers.bun?p.green(`available`):p.red(`not found`)}`),console.log(` npm: ${e.data.installers.npm?p.green(`available`):p.red(`not found`)}`),console.log(` brew: ${e.data.installers.brew?p.green(`available`):p.red(`not found`)}`),console.log(` cargo: ${e.data.installers.cargo?p.green(`available`):p.red(`not found`)}`),console.log(` winget:${e.data.installers.winget?p.green(`available`):p.red(`not found`)}`),console.log(`\n${p.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?p.green(`supported`):p.yellow(`unsupported`)}`),e.data.self.latestVersion&&console.log(` Latest: ${e.data.self.latestVersion}${e.data.self.outdated?p.yellow(` (update available)`):``}`),e.data.self.recoveryHint&&console.log(` Recovery: ${e.data.self.recoveryHint}`),console.log(`\n${p.bold(`Installed Agents:`)}`),e.data.agents.length===0)console.log(p.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?p.yellow(` (update available: ${t.latestVersion})`):``}`);if(console.log(`\n${p.bold(`Issues:`)}`),e.data.issues.length===0)console.log(p.green(` No issues found.`));else for(let t of e.data.issues)console.log(p.yellow(` - ${t.message}`)),t.suggestedCommands.length>0&&console.log(p.dim(` Next: ${t.suggestedCommands.join(` | `)}`));console.log()}}function _(e,t){let n=t===`beta`?`beta`:`latest`;return e===`bun`?[`bun add -g ${
|
|
3
|
+
`)),console.log(p.bold(`Managed Installers:`)),console.log(` Bun: ${e.data.installers.bun?p.green(`available`):p.red(`not found`)}`),console.log(` npm: ${e.data.installers.npm?p.green(`available`):p.red(`not found`)}`),console.log(` brew: ${e.data.installers.brew?p.green(`available`):p.red(`not found`)}`),console.log(` cargo: ${e.data.installers.cargo?p.green(`available`):p.red(`not found`)}`),console.log(` winget:${e.data.installers.winget?p.green(`available`):p.red(`not found`)}`),console.log(`\n${p.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?p.green(`supported`):p.yellow(`unsupported`)}`),e.data.self.latestVersion&&console.log(` Latest: ${e.data.self.latestVersion}${e.data.self.outdated?p.yellow(` (update available)`):``}`),e.data.self.recoveryHint&&console.log(` Recovery: ${e.data.self.recoveryHint}`),console.log(`\n${p.bold(`Installed Agents:`)}`),e.data.agents.length===0)console.log(p.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?p.yellow(` (update available: ${t.latestVersion})`):``}`);if(console.log(`\n${p.bold(`Issues:`)}`),e.data.issues.length===0)console.log(p.green(` No issues found.`));else for(let t of e.data.issues)console.log(p.yellow(` - ${t.message}`)),t.suggestedCommands.length>0&&console.log(p.dim(` Next: ${t.suggestedCommands.join(` | `)}`));console.log()}}function _(e,t){let n=t===`beta`?`beta`:`latest`;return e===`bun`?[`bun add -g ${u}@${n}`]:e===`npm`?[`npm install -g ${u}@${n}`]:[]}export{h as doctorCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ensure-n7U6mdIT.mjs";export{e as ensureCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,c as t,r as n,s as r}from"./agents-CnYYCDb7.mjs";import{J as i,a,i as o,n as s,r as c,t as l}from"./color-B925pi3Z.mjs";import{t as u}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-DO6eTEpK.mjs";async function h(l){let d=await n(l);if(!d)return a(s({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:l},message:`Unknown agent: ${l}`},target:{kind:`agent`,name:l}}),g);let{agent:f,inspection:m}=d;if(m.inPath){if(m.installedState)return a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]}),g);let n=e(m.methods,m.resolvedBinaryPath??m.binaryPath);if(n){if(p())return a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]}),g);o({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});try{let e=await t(f,n);return a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}),g)}catch(e){if(i(e))return a(s({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:f.name})}),g);throw e}}return a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]}),g)}if(p())return a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]}),g);o({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});let h;try{h=await r(f)}catch(e){if(i(e))return a(s({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:f.name})}),g);throw e}return h.success?a(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}),g):a(s({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}}),g)}function g(e){if(e.error){m(l.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(l.green(t.message));continue}if(t.code===`DRY_RUN`){d(l.cyan(t.message));continue}d(l.yellow(t.message))}return}if(e.data.changed){f(l.cyan(`Installing ${e.data.agent.displayName}...`)),f(l.green(`${e.data.agent.displayName} is now installed.`));return}f(l.green(`${e.data.agent.displayName} is already installed.`))}}export{h as t};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{C as n,D as r,E as i,S as a,T as ee,a as te,d as ne,f as re,g as ie,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 _}from"./agents-
|
|
2
|
-
`)}\n`}function Ye(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 Xe(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 Ze(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);let n=new Set(e.assets.map(e=>e.name));for(let e of qe)if(!n.has(e))throw Error(`manifest.json is missing required release asset: ${e}.`);for(let n of e.assets){let e=t.get(n.name);if(!e)throw Error(`manifest.json references ${n.name}, but it is missing from SHA256SUMS.txt.`);if(n.checksum!==e)throw Error(`manifest.json checksum mismatch for ${n.name}.`);if(!Z(n.name))throw Error(`manifest.json contains an invalid binary asset name: ${n.name}.`)}}async function Qe(e,t){try{let n=await le(
|
|
1
|
+
import{n as e,t}from"./messages-qcLhD-Gc.mjs";import{C as n,D as r,E as i,S as a,T as ee,a as te,d as ne,f as re,g as ie,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 _}from"./agents-CnYYCDb7.mjs";import{A as v,C as y,D as b,E as x,O as S,S as C,T as w,_ as T,b as E,c as D,d as O,f as k,g as A,h as j,i as M,k as N,l as P,m as F,n as I,o as L,p as R,t as z,u as B,v as V,w as H,x as U,y as W}from"./detect-CiNZbP5B.mjs";import{$ as G,A as K,B as q,C as J,D as Y,E as ae,F as oe,G as se,I as ce,K as le,M as ue,N as de,O as fe,P as pe,R as me,T as he,X as ge,Z as _e,a as ve,at as ye,c as be,et as xe,it as Se,j as Ce,k as we,l as Te,n as Ee,o as De,ot as Oe,r as ke,s as Ae,st as je,u as Me,w as Ne,z as Pe}from"./color-B925pi3Z.mjs";import{t as Fe}from"./capabilities-CAUhP-es.mjs";import{t as Ie}from"./commands-Du_EIpHh.mjs";import{t as Le}from"./ensure-n7U6mdIT.mjs";import{t as Re}from"./inspect-BnVRjLLq.mjs";import{t as ze}from"./resolve-BYb5ILgM.mjs";import{n as Be,t as Ve}from"./schema-CwlLtHgc.mjs";import{n as He,t as Ue}from"./errors-DCtNasuC.mjs";import{a as We,i as X,n as Ge,t as Ke}from"./update-Cbd5IUV4.mjs";const qe=[`quantex-darwin-arm64`,`quantex-darwin-x64`,`quantex-linux-arm64`,`quantex-linux-x64`,`quantex-windows-x64.exe`];function Je(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
|
|
2
|
+
`)}\n`}function Ye(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 Xe(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 Ze(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);let n=new Set(e.assets.map(e=>e.name));for(let e of qe)if(!n.has(e))throw Error(`manifest.json is missing required release asset: ${e}.`);for(let n of e.assets){let e=t.get(n.name);if(!e)throw Error(`manifest.json references ${n.name}, but it is missing from SHA256SUMS.txt.`);if(n.checksum!==e)throw Error(`manifest.json checksum mismatch for ${n.name}.`);if(!Z(n.name))throw Error(`manifest.json contains an invalid binary asset name: ${n.name}.`)}}async function Qe(e,t){try{let n=await le(se([e,...t]));return{success:n===0,exitCode:n}}catch{return{success:!1,exitCode:1}}}export{f as agentUpdateProviders,v as autohand,J as canAutoUpdateSelf,a as canLookupLatestVersionForInstallType,l as canResolveAgentUpdate,n as canUninstallInstallType,_ as canUpdateInstallType,Fe as capabilitiesCommand,N as claude,S as codebuddy,b as codex,Ie as commandsCommand,x as copilot,Ee as createErrorResult,Xe as createReleaseManifest,ke as createSuccessResult,X as createUpdatePlan,w as cursor,H as deepseek,Ne as detectSelfInstallSource,y as devin,C as droid,ve as emitCommandResult,Le as ensureCommand,Qe as execCommand,Je as formatChecksums,U as gemini,D as getAgentByLookupName,P as getAgentByNameOrAlias,t as getAgentUpdateFailureHint,o as getAgentUpdateStrategy,B as getAllAgents,me as getBinaryPath,ae as getBinaryReleaseAssetName,Y as getBinaryReleaseDownloadUrl,Se as getCliContext,ge as getConfigDir,_e as getConfigFilePath,Ue as getExitCodeForError,He as getExitCodeForResult,ee as getInstallLifecycle,fe as getInstalledAgentState,Pe as getInstalledVersion,i as getInstallerCapabilities,q as getLatestVersion,re as getManagedInstaller,e as getManualAgentUpdateMessage,De as getManualSelfUpgradeCommand,d as getOrderedInstallMethods,z as getPlatform,Ve as getSchemaCatalog,we as getSelfState,Te as getSelfUpgradeRecoveryHint,Me as getSelfUpgradeRecoveryHintForInspection,he as getSelfVersion,Ke as getSingleAgentUpdateStatus,K as getStateFilePath,s as inspectAgent,te as inspectAllAgents,Re as inspectCommand,h as inspectRegisteredAgents,Ae as inspectSelf,m as installAgent,I as isBinaryInPath,M as isBunAvailable,We as isInspectionUpdateAvailable,r as isManagedInstallType,L as isNpmAvailable,E as jcode,W as junie,V as kilo,G as loadConfig,Ce as loadState,Q as normalizeRepositoryUrl,T as opencode,A as openhands,Z as parseBinaryTarget,Ye as parseChecksums,j as pi,Ge as planAgentUpdates,F as qoder,R as reasonix,ue as removeInstalledAgentState,ye as resetCliContext,u as resolveAgent,p as resolveAgentInspection,ie as resolveAgentUpdateProvider,Oe as resolveCliContext,ze as resolveCommand,$ as resolveReleaseChannel,xe as saveConfig,de as saveState,Be as schemaCommand,je as setCliContext,pe as setInstalledAgentState,oe as setSelfInstallSource,ce as setSelfUpdateNoticeState,c as uninstallAgent,g as updateAgent,ne as updateAgentsByType,be as upgradeSelf,Ze as validateReleaseManifest,k as vibe,O as vtcode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,v as t,y as n}from"./agents-
|
|
1
|
+
import{r as e,v as t,y as n}from"./agents-CnYYCDb7.mjs";import{a as r,n as i,r as a,t as o}from"./color-B925pi3Z.mjs";async function s(o){let s=await e(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,displayName:l.displayName,installMethods:u.methods.map(e=>({command:t(l,e),label:n(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(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(` 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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e,v as t,y as n}from"./agents-
|
|
1
|
+
import{r as e,v as t,y as n}from"./agents-CnYYCDb7.mjs";import{a as r,n as i,r as a,t as o}from"./color-B925pi3Z.mjs";async function s(o){let s=await e(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,displayName:l.displayName,installMethods:u.methods.map(e=>({command:t(l,e),label:n(e),type:e.type})),name:l.name,packageName:l.packages?.npm,selfUpdateCommands:d},capabilities:{canAutoInstall:u.methods.length>0,canAutoUninstall:u.inPath&&u.lifecycle===`managed`,canRun:u.inPath,canSelfUpdate:d.length>0},inspection:{binaryPath:u.binaryPath,installed:u.inPath,installedVersion:u.installedVersion,latestVersion:u.latestVersion,lifecycle:u.lifecycle,sourceLabel:u.inPath?u.sourceLabel:void 0,updateLabel:u.updateLabel}},target:{kind:`agent`,name:l.name}}),c)}function c(e){if(e.error){console.log(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(` 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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./inspect-BnVRjLLq.mjs";export{e as inspectCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,c as t,r as n,s as r}from"./agents-CnYYCDb7.mjs";import{J as i,a,i as o,n as s,r as c,t as l}from"./color-B925pi3Z.mjs";import{t as u}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-DO6eTEpK.mjs";async function h(e){let t=Array.isArray(e)?e:[e];if(t.length<=1)return a(await g(t[0],{emitStartedEvent:!0}),S);o({action:`install`,data:{scope:`batch`},target:{kind:`agent`},type:`started`});let n=[];for(let e of t){let t=v(e,await g(e));n.push(t),o({action:`install`,data:t,target:{kind:`agent`,name:t.agent.name},type:`progress`})}let r={results:n,scope:`batch`,summary:b(n)};return a(n.some(e=>!e.ok)?s({action:`install`,data:r,error:x(n),target:{kind:`agent`}}):c({action:`install`,data:r,target:{kind:`agent`}}),C)}async function g(a,o={}){let l=await n(a);if(!l)return s({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:a},message:`Unknown agent: ${a}`},target:{kind:`agent`,name:a}});let{agent:d,inspection:f}=l;if(f.inPath){if(f.installedState)return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${d.displayName} is already installed.`}]});let n=e(f.methods,f.resolvedBinaryPath??f.binaryPath);if(n){if(p())return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${d.displayName} install in Quantex state.`}]});_(d,o.emitStartedEvent);try{let e=await t(d,n);return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${d.displayName} is already installed. Quantex is now tracking the existing install.`}]})}catch(e){if(i(e))return s({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:d.name})});throw e}}return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${d.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]})}if(p())return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},target:{kind:`agent`,name:d.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${d.displayName}.`}]});_(d,o.emitStartedEvent);let m;try{m=await r(d)}catch(e){if(i(e))return s({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:d.name})});throw e}return m.success?c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!0,installState:m.installedState?{installType:m.installedState.installType,packageName:m.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:d.name}}):s({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${d.displayName}.`},target:{kind:`agent`,name:d.name}})}function _(e,t=!1){t&&o({action:`install`,data:{agent:{displayName:e.displayName,name:e.name}},target:{kind:`agent`,name:e.name},type:`started`})}function v(e,t){let n=t.data,r=t.warnings.map(e=>({code:e.code,message:e.message}));return{agent:n?.agent??{displayName:e,name:t.target?.name??e},changed:n?.changed??!1,error:t.error?{code:t.error.code,message:t.error.message}:void 0,input:e,installState:n?.installState,installed:n?.installed??!1,ok:t.ok,status:y(t),warnings:r}}function y(e){return e.ok?e.warnings.some(e=>e.code===`TRACKED_EXISTING_INSTALL`)?`tracked-existing-install`:e.warnings.some(e=>e.code===`UNTRACKED_EXISTING_INSTALL`)?`untracked-existing-install`:e.warnings.some(e=>e.code===`ALREADY_INSTALLED`)?`already-installed`:e.warnings.some(e=>e.code===`DRY_RUN`)?`planned`:`installed`:e.error?.code===`RESOURCE_LOCKED`?`locked`:`failed`}function b(e){let t={alreadyInstalled:0,failed:0,installed:0,locked:0,planned:0,trackedExistingInstall:0,untrackedExistingInstall:0};for(let n of e)switch(n.status){case`already-installed`:t.alreadyInstalled+=1;break;case`failed`:t.failed+=1;break;case`installed`:t.installed+=1;break;case`locked`:t.locked+=1;break;case`planned`:t.planned+=1;break;case`tracked-existing-install`:t.trackedExistingInstall+=1;break;case`untracked-existing-install`:t.untrackedExistingInstall+=1;break}return t}function x(e){let t=e.filter(e=>!e.ok),n=new Set(t.map(e=>e.error?.code));return n.size===1&&n.has(`RESOURCE_LOCKED`)?{code:`RESOURCE_LOCKED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents could not be installed because another Quantex process is already using the agent lifecycle lock.`}:{code:`INSTALL_FAILED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents failed to install.`}}function S(e){if(e.error){m(l.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(l.green(t.message));continue}if(t.code===`DRY_RUN`){d(l.cyan(t.message));continue}d(l.yellow(t.message))}return}f(l.cyan(`Installing ${e.data.agent.displayName}...`)),f(l.green(`${e.data.agent.displayName} installed successfully!`))}}function C(e){if(!e.data){e.error&&m(l.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`installed`:f(l.cyan(`Installing ${t.agent.displayName}...`)),f(l.green(`${t.agent.displayName} installed successfully!`));break;case`tracked-existing-install`:f(l.green(w(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`already-installed`:case`untracked-existing-install`:d(l.yellow(w(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`planned`:d(l.cyan(w(t.warnings,`Dry run: would install ${t.agent.displayName}.`)));break;case`locked`:d(l.yellow(t.error?.message??`Another quantex process is already installing ${t.agent.displayName}.`));break;case`failed`:m(l.red(t.error?.message??`Failed to install ${t.agent.displayName}.`));break}T(e.data.summary)}function w(e,t){return e[0]?.message??t}function T(e){let t=[e.installed?`installed ${e.installed}`:void 0,e.alreadyInstalled?`already installed ${e.alreadyInstalled}`:void 0,e.trackedExistingInstall?`tracked existing ${e.trackedExistingInstall}`:void 0,e.untrackedExistingInstall?`untracked existing ${e.untrackedExistingInstall}`:void 0,e.failed?`failed ${e.failed}`:void 0,e.locked?`locked ${e.locked}`:void 0,e.planned?`planned ${e.planned}`:void 0].filter(Boolean);t.length>0&&f(l.bold(`Summary: ${t.join(`, `)}`))}export{h as installCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./agents-
|
|
1
|
+
import{t as e}from"./agents-CnYYCDb7.mjs";import{a as t,r as n,t as r}from"./color-B925pi3Z.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-BYb5ILgM.mjs";export{e as resolveCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,v as t,y as n}from"./agents-
|
|
1
|
+
import{r as e,v as t,y as n}from"./agents-CnYYCDb7.mjs";import{a as r,n as i,r as a,t as o}from"./color-B925pi3Z.mjs";async function s(o){let s=await e(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 e=u.methods.map(e=>({command:t(l,e),label:n(e),type:e.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:e,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:e,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 @@
|
|
|
1
|
+
import{n as e}from"./schema-CwlLtHgc.mjs";export{e as schemaCommand};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./color-B925pi3Z.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`},cargo:{type:`boolean`},npm:{type:`boolean`},winget:{type:`boolean`}},required:[`brew`,`bun`,`cargo`,`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`},results:{items:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},error:{type:`object`},input:{type:`string`},installState:{type:`object`},installed:{type:`boolean`},ok:{type:`boolean`},status:{type:`string`},warnings:{items:{type:`object`},type:`array`}},required:[`agent`,`changed`,`input`,`installed`,`ok`,`status`,`warnings`],type:`object`},type:`array`},scope:{type:`string`},summary:{type:`object`}},type:`object`},description:`Install result for one or more agents`,envelopeSchema:i,name:`install`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`}},required:[`agent`,`changed`,`installed`],type:`object`},description:`Ensure result for an agent`,envelopeSchema:i,name:`ensure`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},capabilities:{type:`object`},inspection:{type:`object`}},required:[`agent`,`capabilities`,`inspection`],type:`object`},description:`Structured inspection result for an agent`,envelopeSchema:i,name:`inspect`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},resolution:{additionalProperties:!1,properties:{binaryPath:{type:`string`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`],type:`object`},installed:{type:`boolean`},installSource:{type:`string`},installedVersion:{type:`string`},lifecycle:{type:`string`},sourceLabel:{type:`string`},suggestedLaunchCommand:{items:{type:`string`},type:`array`}},required:[`binaryPath`,`installed`,`installSource`,`lifecycle`,`sourceLabel`,`suggestedLaunchCommand`],type:`object`}},required:[`agent`,`resolution`],type:`object`},description:`Resolved executable entrypoint for an agent`,envelopeSchema:i,name:`resolve`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{dataSchema:{type:`object`},description:{type:`string`},envelopeSchema:{type:`object`},name:{type:`string`},ndjsonEventSchema:{type:`object`}},required:[`dataSchema`,`description`,`envelopeSchema`,`name`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Structured schema catalog`,envelopeSchema:i,name:`schema`,ndjsonEventSchema:a}];async function 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 +1 @@
|
|
|
1
|
-
import{l as e,n as t}from"./agents-
|
|
1
|
+
import{l as e,n as t}from"./agents-CnYYCDb7.mjs";import{J as n,O as r,a as i,n as a,r as o,t as s}from"./color-B925pi3Z.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-DO6eTEpK.mjs";async function p(s){let l=t(s);if(!l)return i(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 r(l.name)?i(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):i(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 i(a({action:`uninstall`,data:{agent:{displayName:l.displayName,name:l.name},changed:!1},...c(e,{kind:`agent`,name:l.name})}),m);throw e}return i(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,r as t,t as n}from"./messages-qcLhD-Gc.mjs";import{_ as r,d as i,h as a,n as o,u as s,w as c}from"./agents-
|
|
1
|
+
import{n as e,r as t,t as n}from"./messages-qcLhD-Gc.mjs";import{_ as r,d as i,h as a,n as o,u as s,w as c}from"./agents-CnYYCDb7.mjs";import{J as l,a as u,i as d,n as f,r as p,t as m,z as h}from"./color-B925pi3Z.mjs";import{a as g,i as _,n as v,r as y}from"./user-output-DO6eTEpK.mjs";import{n as b,r as x}from"./update-Cbd5IUV4.mjs";async function S(e,t){if(t)return C();if(!e)return u(f({action:`update`,error:{code:`INVALID_ARGUMENT`,message:`Please specify an agent name or use --all flag`},target:{kind:`agent`}}),A);let n=o(e);return n?w(n):u(f({action:`update`,error:{code:`AGENT_NOT_FOUND`,details:{input:e},message:`Unknown agent: ${e}`},target:{kind:`agent`,name:e}}),A)}async function C(){d({action:`update`,data:{scope:`all`},target:{kind:`agent`},type:`started`});let e=await T(await b());return e.hasFailures?u(f({action:`update`,data:{results:e.results,scope:`all`},error:{code:`UPDATE_FAILED`,message:`One or more agents failed to update.`},target:{kind:`agent`}}),A):u(p({action:`update`,data:{results:e.results,scope:`all`},target:{kind:`agent`}}),A)}async function w(e){d({action:`update`,data:{agent:e.name,scope:`single`},target:{kind:`agent`,name:e.name},type:`started`});let{inspection:t,plan:n}=await x(e);if(!t.inPath)return u(f({action:`update`,error:{code:`AGENT_NOT_INSTALLED`,message:`${e.displayName} is not installed.`},target:{kind:`agent`,name:e.name}}),A);let r=await T(n),i=k(r.results);return i?u(f({action:`update`,data:{results:r.results,scope:`single`},error:{code:`RESOURCE_LOCKED`,details:i.resource?{resource:i.resource}:void 0,message:i.message??`Another quantex process is already updating ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):r.hasFailures?u(f({action:`update`,data:{results:r.results,scope:`single`},error:{code:`UPDATE_FAILED`,message:`Failed to update ${e.displayName}.`},target:{kind:`agent`,name:e.name}}),A):u(p({action:`update`,data:{results:r.results,scope:`single`},target:{kind:`agent`,name:e.name}}),A)}async function T(n){let r=[];for(let e of n.upToDate)E(r,{displayName:e.agent.displayName,installedVersion:e.installedVersion,latestVersion:e.latestVersion,name:e.agent.name,status:`up-to-date`});for(let t of n.skippedManualCheck)E(r,{displayName:t.agent.displayName,message:e(t.agent),name:t.agent.name,status:`manual-required`});for(let e of n.untrackedInPath)E(r,{displayName:e.agent.displayName,message:t(e.agent),name:e.agent.name,status:`manual-required`});for(let e of n.grouped){let t=await D(e.type,e.packages,e.updates);for(let e of t)E(r,e)}for(let e of n.manual)E(r,await O(e.agent,e.state,e.inspection.methods,e.inspection));return{hasFailures:r.some(e=>e.status===`failed`||e.status===`locked`),results:r}}function E(e,t){e.push(t),d({action:`update`,data:t,target:{kind:`agent`,name:t.name},type:`progress`})}async function D(e,t,n){if(n.length===0)return[];if(v())return n.map(({agent:t,inspection:n,strategy:r})=>({displayName:t.displayName,installedVersion:n.installedVersion,latestVersion:n.latestVersion,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:r===`managed`?`managed/${e}`:r}));try{return await i(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})=>O(e,n,t.methods,t)))}catch(t){if(!l(t))throw t;return n.map(({agent:n,inspection:r,strategy:i})=>({displayName:n.displayName,installedVersion:r.installedVersion,latestVersion:r.latestVersion,message:t.message,name:n.name,resource:t.resource,status:`locked`,strategy:i===`managed`?`managed/${e}`:i}))}}async function O(t,i,o,u){let d=o??u?.methods??[],f=a({agent:t,installedState:i,methods:d}),p=u?.installedVersion,m=u?.latestVersion;if(f===`manual-hint`&&!r(t,i)&&!d.some(e=>c(e.type)))return{displayName:t.displayName,installedVersion:p,latestVersion:m,message:e(t),name:t.name,status:`manual-required`,strategy:f};if(v())return{displayName:t.displayName,installedVersion:p,latestVersion:m,message:`Dry run: would update ${t.displayName}.`,name:t.name,status:`planned`,strategy:f};let g;try{g=await s(t,i)}catch(e){if(l(e))return{displayName:t.displayName,installedVersion:p,latestVersion:m,message:e.message,name:t.name,resource:e.resource,status:`locked`,strategy:f};throw e}if(g.success){if(f===`self-update`){let e=await h(t.binaryName,t.versionProbe);if(p&&e)return e===p?{displayName:t.displayName,installedVersion:e,latestVersion:e,name:t.name,status:`up-to-date`,strategy:f}:{displayName:t.displayName,installedVersion:p,latestVersion:e,name:t.name,status:`updated`,strategy:f}}return{displayName:t.displayName,installedVersion:p,latestVersion:m,name:t.name,status:`updated`,strategy:f}}return{displayName:t.displayName,hint:n(t,f),installedVersion:p,latestVersion:m,name:t.name,status:`failed`,strategy:f}}function k(e){if(e.length===1)return e[0]?.status===`locked`?e[0]:void 0}function A(e){if(!e.data){e.error&&y(m.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`up-to-date`:_(m.green(`${t.displayName} is up to date (${t.installedVersion??`unknown`})`));break;case`manual-required`:g(m.yellow(`${t.displayName}: manual action required.`)),t.message&&g(m.cyan(`Next step: ${t.message}`));break;case`planned`:g(m.cyan(`Would update ${t.displayName}${t.strategy?` via ${t.strategy}`:``}${j(t.installedVersion,t.latestVersion)}`));break;case`updated`:_(m.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),_(m.green(`${t.displayName} updated successfully!`));break;case`failed`:_(m.cyan(`Updating ${t.displayName}${t.strategy?` via ${t.strategy}`:``}...${j(t.installedVersion,t.latestVersion)}`)),y(m.red(`Failed to update ${t.displayName}.`)),t.hint&&g(m.cyan(`Next step: ${t.hint}`));break;case`locked`:g(m.yellow(t.message??`Another quantex process is already updating ${t.displayName}.`));break}e.data.results.length>1&&M(e.data.results),!e.data.results.length&&e.error&&y(m.red(e.error.message))}function j(e,t){return e?` (${e} -> ${t??`latest`})`:``}function M(e){let t={failed:0,locked:0,manualRequired:0,planned:0,upToDate:0,updated:0};for(let n of e)switch(n.status){case`up-to-date`:t.upToDate+=1;break;case`manual-required`:t.manualRequired+=1;break;case`planned`:t.planned+=1;break;case`updated`:t.updated+=1;break;case`failed`:t.failed+=1;break;case`locked`:t.locked+=1;break}let n=[t.updated?`updated ${t.updated}`:void 0,t.upToDate?`up to date ${t.upToDate}`:void 0,t.manualRequired?`manual ${t.manualRequired}`:void 0,t.failed?`failed ${t.failed}`:void 0,t.locked?`locked ${t.locked}`:void 0,t.planned?`planned ${t.planned}`:void 0].filter(Boolean);n.length>0&&_(m.bold(`Summary: ${n.join(`, `)}`))}export{S as updateCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,g as t,i as n,t as r,x as i}from"./agents-
|
|
1
|
+
import{_ as e,g as t,i as n,t as r,x as i}from"./agents-CnYYCDb7.mjs";function a(e,n={}){let r={bun:[],npm:[],brew:[],cargo:[],winget:[]},i=[],a=[],c=[],l=[];for(let u of e){if(!u.inPath)continue;if(n.skipUntrackedInPath&&!u.installedState){c.push(u);continue}if(s(u)){a.push(u);continue}if(!o(u)){l.push(u);continue}let e=t({agent:u.agent,installedState:u.installedState,methods:u.methods}),d=e.strategy===`managed`?e.getManagedInstallerType?.({agent:u.agent,installedState:u.installedState,methods:u.methods}):void 0;if(d){let e={inspection:u,installerType:d,strategy:`grouped`};r[d].push(e);continue}i.push({inspection:u,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...r.bun,...r.npm,...r.brew,...r.cargo,...r.winget,...i],grouped:r,manual:i,skippedManualCheck:a,untrackedInPath:c,upToDate:l}}function o(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function s(t){return!t.latestVersion&&!e(t.agent,t.installedState)}const c=[`bun`,`npm`,`brew`,`cargo`,`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(),{skipUntrackedInPath:!0})}async function d(e){let t=await n(e);return{inspection:t,plan:f([t])}}function f(e,t={}){let n=a(e,t),r=c.map(e=>p(e,n.grouped[e])).filter(e=>e!==void 0);return{entries:n.entries.map(e=>m(e.inspection)),grouped:r,manual:n.manual.map(e=>m(e.inspection)),skippedManualCheck:n.skippedManualCheck,untrackedInPath:n.untrackedInPath,upToDate:n.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,packageInstallArgs:t.packageInstallArgs,packageTargetKind:t.packageTargetKind};let a=n.find(e=>e.type===r);if(!a)return;let o=i(e,a);if(o)return{packageName:o,packageInstallArgs:a.packageInstallArgs,packageTargetKind:a.packageTargetKind}}export{o as a,a as i,u as n,d as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as e,S as t,a as n,c as r,n as i,r as a,t as o,u as s,x as c}from"./color-B925pi3Z.mjs";import{a as l,i as u,n as d,r as f}from"./user-output-DO6eTEpK.mjs";async function p(e={}){let o=await t({updateChannel:e.channel}),l=c(o),u=d(),f=h(l),p=_(l);if(o.status===`up-to-date`)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`up-to-date`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(e.check||u)return o.status===`update-available`?n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`update-available`},exitCode:e.check?1:void 0,target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[],...u?[{code:`DRY_RUN`,message:`Dry run: would upgrade Quantex CLI.`}]:[]]}),m):n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,status:`check-unavailable`},error:{code:`NETWORK_ERROR`,message:`Unable to determine the latest Quantex CLI version.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);if(o.status===`manual-required`){let e=s(l);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:e,status:`manual-required`},error:{code:`MANUAL_ACTION_REQUIRED`,message:`Quantex CLI cannot auto-update from the current install source: ${l.installSource}.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m)}let g=await r(o);if(g.success)return n(a({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,status:`updated`},target:{kind:`self`,name:`quantex`},warnings:[...f,...p?[p]:[]]}),m);let v=s(l,g);return n(i({action:`upgrade`,data:{canAutoUpdate:l.canAutoUpdate,channel:l.updateChannel,currentVersion:l.currentVersion,installSource:l.installSource,latestVersion:l.latestVersion,recoveryHint:v,status:`manual-required`},error:{code:`UPGRADE_FAILED`,details:g.error?.kind?{kind:g.error.kind}:void 0,message:g.error?.message??`Failed to upgrade Quantex CLI.`},target:{kind:`self`,name:`quantex`},warnings:[...f,...v?[{code:`MANUAL_RECOVERY`,message:`Manual recovery: ${v}`}]:[]]}),m)}function m(e){if(!e.data){e.error&&f(o.red(e.error.message));return}if(e.data.status===`up-to-date`){u(o.green(`Quantex CLI is already up to date (${e.data.currentVersion}).`)),g(e.warnings);return}if(e.data.status===`update-available`){let t=e.warnings.some(e=>e.message.includes(`Dry run`))?`Dry run: `:``;l(o.yellow(`${t}Update available for Quantex CLI: ${e.data.currentVersion} -> ${e.data.latestVersion} (${e.data.channel}).`)),g(e.warnings);return}if(e.data.status===`check-unavailable`){e.error&&l(o.yellow(e.error.message)),g(e.warnings);return}if(e.data.status===`manual-required`&&e.error?.code===`MANUAL_ACTION_REQUIRED`){l(o.yellow(e.error.message)),e.data.recoveryHint&&l(o.cyan(`Next step: ${e.data.recoveryHint}`));return}let t=e.data.latestVersion?` (${e.data.currentVersion} -> ${e.data.latestVersion})`:` (${e.data.currentVersion})`;if(u(o.cyan(`Upgrading Quantex CLI...${t}`)),!e.error){u(o.green(`Quantex CLI upgraded successfully.`)),g(e.warnings);return}f(o.red(`Failed to upgrade Quantex CLI.`)),l(o.yellow(`Reason: ${e.error.message}`));for(let t of e.warnings)l(o.cyan(t.message.replace(/^Manual recovery:/,`Next step:`)))}function h(e){return!e.latestVersion||!e.upstreamLatestVersion||e.latestVersion===e.upstreamLatestVersion||e.installSource!==`bun`&&e.installSource!==`npm`?[]:[{code:`MIRROR_LAG`,details:{installableLatestVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion},message:`The selected registry currently installs ${e.latestVersion}, while upstream npm has ${e.upstreamLatestVersion}. Retry later or set selfUpdateRegistry / QTX_SELF_UPDATE_REGISTRY to another registry if you need the upstream release now.`}]}function g(e){for(let t of e)t.code===`DRY_RUN`||t.code===`MANUAL_RECOVERY`||l(o.yellow(t.message))}function _(t){if(!t.latestVersion)return;let n=e(t.latestVersion,t.currentVersion);if(!(n===void 0||n>=0))return{code:`STALE_LATEST_VERSION`,details:{currentVersion:t.currentVersion,latestVersion:t.latestVersion},message:`The resolved latest version ${t.latestVersion} is older than the installed Quantex CLI ${t.currentVersion}. Quantex will not downgrade; retry with --refresh or --no-cache if you need a fresh check.`}}export{p as upgradeCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{it as e}from"./color-
|
|
1
|
+
import{it as e}from"./color-B925pi3Z.mjs";import t from"node:process";const n={debug:4,error:1,info:3,silent:0,warn:2};function r(e){o(`info`)&&t.stdout.write(`${e}\n`)}function i(e){o(`warn`)&&t.stdout.write(`${e}\n`)}function a(e){o(`error`)&&t.stdout.write(`${e}\n`)}function o(t){let r=e();return r.outputMode===`human`?r.quiet&&t===`info`?!1:n[r.logLevel??`info`]>=n[t]:!0}function s(){return!!e().assumeYes}function c(){return!!e().dryRun}function l(e){t.stdout.write(`${e}\n`)}export{i as a,r as i,c as n,l as o,a as r,s as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quantex-cli",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "A unified lifecycle CLI for installing, inspecting, updating, uninstalling, and launching popular AI coding assistants",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/Drswith/quantex-cli#readme",
|
package/dist/agents-ONdRhmua.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./detect-CbeZTzuf.mjs";import{$ as l,D as ee,E as te,H as ne,J as u,M as d,R as f,T as re,W as p,_ as ie,b as ae,d as oe,f as se,g as ce,h as m,j as h,m as le,p as ue,v as de,w as fe,y as pe}from"./color-CCa8Z1Vv.mjs";import me from"node:process";const he={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},cargo:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},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 g(e){return he[e]}function _(e){return g(e).lifecycle===`managed`}function v(e){return g(e).lifecycle}function y(e){return g(e).canUpdate}function ge(e){return g(e).canUninstall}function b(e){return g(e).canLookupLatestVersion}function x(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function S(e,t){if(t.packageName)return t.packageName;if(t.type===`cargo`)return e.packages?.cargo;if(t.type===`bun`||t.type===`npm`)return e.packages?.npm}function C(e){return e?y(e.installType):!1}function w(e,t){return C(t)||!!e.selfUpdate}function _e(e){return!!e&&b(e.installType)}function ve(e){return e.length>0&&e.every(e=>b(e.type))}function ye(e){return _(e.type)?`${v(e.type)}/${e.type}${x(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function be(e){return e?_(e.installType)?`managed via ${e.installType}${x(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function xe(e,t){let n=N({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function Se(e,t){if(t.type===`bun`){let n=S(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=S(e,t);return n?`npm i -g ${n}`:``}if(t.type===`brew`)return t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``;if(t.type===`cargo`){let n=S(e,t);return n?[`cargo`,`install`,n,...t.packageInstallArgs??[]].join(` `):``}return t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function Ce(e,t,n){if(t)return _e(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!ve(n)))return e.packages.npm}function T(e,t){let n=E(t);if(n){let t=e.find(e=>e.type===n);if(t)return t}if(e.length!==1)return;let[r]=e;if(!(r.type!==`script`&&r.type!==`binary`))return r}function E(e){if(!e)return;let t=e.replaceAll(`\\`,`/`);if(t.includes(`/.bun/bin/`)||t.includes(`/.bun/install/global/`))return`bun`;if(t.includes(`/node_modules/.bin/`)||t.includes(`/node_modules/`))return`npm`}function D(e){if(e.installedState&&_(e.installedState.installType))return e.installedState.installType;for(let t of e.methods)if(_(t.type)&&y(t.type))return t.type}const O={strategy:`managed`,canHandle:e=>!!D(e),getManagedInstallerType:e=>D(e)},k={strategy:`self-update`,canHandle:e=>!C(e.installedState)&&!!e.agent.selfUpdate},A={strategy:`manual-hint`,canHandle:()=>!0},j=[O,k,A];function M(e){return j.find(t=>t.canHandle(e))??A}function N(e){return M(e).strategy}function we(e){return w(e.agent,e.installedState)}async function P(e){let t=s(),n=typeof e==`function`?e(t):e;try{return me.platform===`win32`?await d(h([`powershell.exe`,`-Command`,n]))===0:await d(h([`sh`,`-c`,n]))===0}catch{return!1}}function Te(e){return e===`cask`?[`--cask`]:[]}async function F(e,t,n){try{return await d(h([`brew`,e,...Te(n),t]))===0}catch{return!1}}async function Ee(e,t){return F(`install`,e,t)}async function I(e,t){return F(`upgrade`,e,t)}async function De(e){for(let t of e)if(!await I(t.packageName,t.packageTargetKind))return!1;return!0}async function Oe(e,t){return F(`uninstall`,e,t)}async function L(e,t,n=[]){try{return await d(h([`cargo`,e,t,...n]))===0}catch{return!1}}async function R(e,t){return L(`install`,e,t)}async function z(e,t){return R(e,[`--force`,...t??[]])}async function ke(e){for(let t of e)if(!await z(t.packageName,t.packageInstallArgs))return!1;return!0}async function Ae(e){return L(`uninstall`,e)}async function B(e,t){try{return await d(h([`winget`,e,`--id`,t,`-e`]))===0}catch{return!1}}async function je(e){return B(`install`,e)}async function V(e){return B(`upgrade`,e)}async function Me(e){for(let t of e)if(!await V(t.packageName))return!1;return!0}async function Ne(e){return B(`uninstall`,e)}const Pe={brew:{type:`brew`,isAvailable:async()=>a(),install:async(e,t)=>Ee(e,t),uninstall:async(e,t)=>Oe(e,t),update:async(e,t)=>I(e,t),updateMany:async e=>De(e)},bun:{type:`bun`,getInstalledVersion:async e=>ce(e),isAvailable:async()=>t(),install:async e=>ie(e),uninstall:async e=>de(e),update:async(e,t,n)=>pe(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>ae(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},cargo:{type:`cargo`,isAvailable:async()=>e(),install:async(e,t,n)=>R(e,n),uninstall:async e=>Ae(e),update:async(e,t,n)=>z(e,n?.packageInstallArgs),updateMany:async e=>ke(e.map(e=>({packageInstallArgs:e.packageInstallArgs,packageName:e.packageName})))},npm:{type:`npm`,getInstalledVersion:async e=>oe(e),isAvailable:async()=>i(),install:async e=>se(e),uninstall:async e=>ue(e),update:async(e,t,n)=>le(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>m(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>o(),install:async e=>je(e),uninstall:async e=>Ne(e),update:async e=>V(e),updateMany:async e=>Me(e.map(e=>({packageName:e.packageName})))}};function H(e){return Pe[e]}const U={resource:`agent lifecycle`,scope:[`agent-lifecycle`]};async function Fe(){return(await l()).defaultPackageManager}async function W(){return{npmBunUpdateStrategy:(await l()).npmBunUpdateStrategy}}async function G(e){let t=s(),n=e.platforms[t];if(!n)return[];let r=await Fe();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function K(e,t,n,r,i,a){let o=H(e);return await o.isAvailable()?i===`install`?o.install(t,r,n):i===`update`?o.update(t,r,{npmBunUpdateStrategy:a,packageInstallArgs:n}):o.uninstall(t,r):!1}async function q(e,t,n,r){if(_(t.type)){let i=S(e,t);return i?K(t.type,i,t.packageInstallArgs,t.packageTargetKind,n,r):!1}return n===`update`&&!y(t.type)||!t.command?!1:P(t.command)}async function J(e,t,n){return _(e.installType)?e.packageName?K(e.installType,e.packageName,e.packageInstallArgs,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:P(e.command)}async function Ie(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await P(e.join(` `)))return!0;return!1}async function Y(e,t){let n={agentName:e.name,installType:t.type,packageName:S(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return t.packageInstallArgs?.length&&(n.packageInstallArgs=t.packageInstallArgs),await p(n),n}async function Le(e,t){return u(U,async()=>Y(e,t))}async function Re(e){return u(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 ze(e,t){return u(U,async()=>{let{npmBunUpdateStrategy:n}=await W(),r=await G(e);if(t&&await J(t,`update`,n))return await p(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 Ie(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 Be(e,t){return u(U,async()=>{let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}:${e.packageInstallArgs?.join(` `)??``}`,e])).values()],r=H(e);return await r.isAvailable()?r.updateMany(n,await W()):!1})}async function X(e,t,n){let r=H(e);if(r.getInstalledVersion&&await r.isAvailable())return r.getInstalledVersion(t,n)}async function Ve(e){return u(U,async()=>{let t=await f(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,i]=await Promise.all([G(e),f(e.name),r(e.binaryName)]),[a,o,s]=await Promise.all([i?He(e,n):Promise.resolve(void 0),i?fe(e.binaryName):Promise.resolve(void 0),Ue(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:i,installedVersion:a,latestVersion:s,binaryPath:o,resolvedBinaryPath:await ee(o),sourceLabel:be(n),updateLabel:xe(e,n),lifecycle:n?v(n.installType):`unmanaged`}}async function Q(e){return Promise.all(e.map(Z))}async function He(e,t){if(t&&_(t.installType)&&t.packageName){let e=await X(t.installType,t.packageName,t.packageTargetKind);if(e)return e}return re(e.binaryName,e.versionProbe)}async function Ue(e,t,n){let r=Ce(e,t,n);if(r)return te(r)}function $(e){return n(e)}async function We(e){let t=$(e);if(t)return{agent:t,inspection:await Z(t)}}async function Ge(){return Q(c())}export{ge as C,_ as D,g as E,b as S,v as T,w as _,Q as a,T as b,Le as c,Be as d,H as f,M as g,N as h,Z as i,Ve as l,we as m,$ as n,G as o,j as p,We as r,Re as s,Ge as t,ze as u,Se as v,y as w,S as x,ye as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./capabilities-DxM-S9ji.mjs";export{e as capabilitiesCommand};
|
package/dist/color-CCa8Z1Vv.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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,realpath as s,rename as c,rm as l,stat as u,writeFile as d}from"node:fs/promises";import{basename as f,dirname as p,join as m}from"node:path";import{fileURLToPath as h}from"node:url";import{homedir as g}from"node:os";import{existsSync as _,mkdirSync as ee,writeFileSync as te}from"node:fs";import{spawn as ne}from"node:child_process";import{text as re}from"node:stream/consumers";import{Buffer as ie}from"node:buffer";import ae from"picocolors";function oe(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,y=new Set;function b(){return v??=me(),v}function se(e){y=new Set,v={...e,cacheMode:e.cacheMode??`default`,cancelled:e.cancelled??!1}}function ce(){v=void 0,y=new Set}function le(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:oe(e.timeout),c=he(e.color),l=ge(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 ue(){v&&(v.cancelled=!0)}function de(){ue();for(let e of y)e();y.clear()}function fe(e){return y.add(e),()=>{y.delete(e)}}function pe(e){let t=b();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 me(){return le()}function he(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 ge(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 _e=`https://registry.npmjs.org`;function x(e){if(e)try{return new URL(e.trim()).toString().replace(/\/+$/,``)}catch{return}}function ve(e,t,n){return`${x(n)}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}const ye={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,selfUpdateRegistry:void 0,versionCacheTtlHours:6};function S(){return m(n.env.HOME||n.env.USERPROFILE||g(),`.quantex`)}function C(){return m(S(),`config.json`)}async function w(){let e={...ye,...await Se()};return{...e,defaultPackageManager:e.defaultPackageManager===`npm`?`npm`:`bun`,networkRetries:T(e.networkRetries,2),networkTimeoutMs:T(e.networkTimeoutMs,1e4),npmBunUpdateStrategy:e.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:e.selfUpdateChannel===`beta`?`beta`:`stable`,selfUpdateRegistry:typeof e.selfUpdateRegistry==`string`?x(e.selfUpdateRegistry):void 0,versionCacheTtlHours:T(e.versionCacheTtlHours,6)}}function be(e){return e===`latest-major`||e===`respect-semver`}async function xe(e){await i(S(),{recursive:!0}),await d(C(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function Se(){try{let e=await o(C(),`utf8`),t=JSON.parse(e);return Ce(t)?t:{}}catch{return{}}}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}function Ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const E=`quantex-cli`,D=`https://github.com/Drswith/quantex-cli`,we=`0.17.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 Te(e){return e instanceof O}function Ee(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 m(S(),`locks`,...r,i)}async function k(e){let t=Ee(e.scope);return await i(p(t),{recursive:!0}),await De(e.resource,t),async()=>{await l(t,{force:!0,recursive:!0})}}async function De(e,t){try{ee(t,{recursive:!1}),Oe(t);return}catch(e){if(!Ne(e))throw e}if(!await ke(t))throw new O(e,t);try{ee(t,{recursive:!1}),Oe(t)}catch(n){throw Ne(n)?new O(e,t):n}}function Oe(e){te(m(e,`owner.json`),`${JSON.stringify({pid:n.pid,createdAt:new Date().toISOString()})}\n`,`utf8`)}async function ke(e){let t=await Ae(e);return t&&Me(t.pid)?!1:(await l(e,{force:!0,recursive:!0}),!0)}async function Ae(e){let t=Date.now()+100;for(;Date.now()<t;){let t=await je(e);if(t)return t;await new Promise(e=>setTimeout(e,2))}return await je(e)}async function je(e){try{let t=JSON.parse(await o(m(e,`owner.json`),`utf8`));return typeof t.pid==`number`&&Number.isInteger(t.pid)&&t.pid>0?{pid:t.pid}:void 0}catch{return}}function Me(e){try{return n.kill(e,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}}function Ne(e){return typeof e==`object`&&!!e&&`code`in e&&e.code===`EEXIST`}async function Pe(e,t){let n=await k(e);try{return await t()}finally{await n()}}const Fe={installedAgents:{},self:{}};function A(){return m(S(),`state.json`)}async function j(){return Ue()}async function Ie(e){let t=await k({resource:`state`,scope:[`state`]});try{await qe(e)}finally{await t()}}async function Le(e){return(await j()).installedAgents[e]}async function Re(e){await M(t=>{t.installedAgents[e.agentName]=e})}async function ze(e){await M(t=>{delete t.installedAgents[e]})}async function Be(){return(await j()).self}async function Ve(e){await M(t=>{t.self.installSource=e})}async function He(e,t){await M(n=>{n.self.updateNoticeVersion=e,n.self.updateNoticeAt=t})}async function Ue(){try{let e=JSON.parse(await o(A(),`utf8`)),t=We(e.self);return{installedAgents:e.installedAgents??{},self:t}}catch{return{...Fe}}}function We(e){if(!Ke(e))return{};let t={...e};return Ge(e.installSource)?t.installSource=e.installSource:delete t.installSource,typeof e.updateNoticeAt==`string`?t.updateNoticeAt=e.updateNoticeAt:delete t.updateNoticeAt,typeof e.updateNoticeVersion==`string`?t.updateNoticeVersion=e.updateNoticeVersion:delete t.updateNoticeVersion,t}function Ge(e){return e===`binary`||e===`bun`||e===`npm`||e===`source`||e===`unknown`}function Ke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function qe(e){await i(S(),{recursive:!0}),await d(A(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}async function M(e){let t=await k({resource:`state`,scope:[`state`]});try{let t=await Ue();await e(t),await qe(t)}finally{await t()}}async function N(e,t){let n=await Je(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function Je(e,t,n=`text`){let r=await w(),i=r.versionCacheTtlHours*60*60*1e3,a=b().cacheMode,o=a===`no-cache`?{entries:{}}:await Xe(),s=o.entries[t],c=Date.now();if(a===`default`&&s&&s.expiresAt>c)return P(s,i),s.body;let l=await Ye(e,{headers:a!==`no-cache`&&s?.etag?{"If-None-Match":s.etag}:void 0,retries:r.networkRetries,timeoutMs:r.networkTimeoutMs});if(!l)return s&&P(s,i),s?.body;if(l.status===304&&s)return o.entries[t]={...s,expiresAt:c+i,fetchedAt:c},a!==`no-cache`&&await Ze(o),$e(c,c+i),s.body;if(!l.ok)return s&&P(s,i),s?.body;let u=await l.text();if(n===`json`)try{JSON.parse(u)}catch{return s&&P(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 Ze(o)),$e(c,c+i),u}async function Ye(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 Xe(){try{return JSON.parse(await o(Qe(),`utf8`))}catch{return{entries:{}}}}async function Ze(e){await i(m(S(),`cache`),{recursive:!0}),await d(Qe(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function Qe(){return m(S(),`cache`,`versions.json`)}function P(e,t){let n=e.fetchedAt??Math.max(0,e.expiresAt-t);pe({fetchedAt:new Date(n).toISOString(),source:`cache`,staleAfter:new Date(e.expiresAt).toISOString()})}function $e(e,t){pe({fetchedAt:new Date(e).toISOString(),source:`network`,staleAfter:new Date(t).toISOString()})}function et(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function F(e=n.execPath){if(f(et(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 I(e=n.execPath){let t=F(e);if(t)return`${D}/releases/latest/download/${t}`}function tt(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 nt(e){let t=await N(await rt(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function rt(e){if(e===`stable`)return`${D}/releases/latest/download/manifest.json`;let t=(await it(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 it(e){let t=ot();if(!t)throw Error(`Failed to resolve the GitHub repository slug for Quantex releases.`);let n=await N(`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 at(e,t=n.execPath){let r=n.platform,i=n.arch===`arm64`?`arm64`:`x64`,a=F(t);return e.assets.find(e=>e.platform===r&&e.arch===i&&(!a||e.name===a))}function ot(){return D.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const L=E,st=`/node_modules/${L}`;async function ct(e){let t=await dt(),r=n.execPath,i=t.foundPackageJson?R(t.packageRoot):R(``,r),a=await ut((await Be()).installSource,i),o=await w(),s=tt(e?.updateChannel,o.selfUpdateChannel);return{canAutoUpdate:lt(a),currentVersion:t.version||`0.17.0`,executablePath:r,installSource:a,packageRoot:t.packageRoot,updateChannel:s}}function lt(e){return e===`binary`||e===`bun`||e===`npm`}async function ut(e,t){return t!==`unknown`&&e!==t?(await Ve(t),t):e??t}function R(e,t=n.execPath){let r=pt(e);return r.includes(`/.bun/install/global/`)?`bun`:r.includes(st)?`npm`:r?`source`:mt(t)?`binary`:`unknown`}async function dt(e=import.meta.url){let t=ht(e),n=p(t);for(;;){let e=m(n,`package.json`),t=await ft(e);if(t?.name===L)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.17.0`};let r=p(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:m(p(t),`package.json`),packageRoot:p(t),version:we}}function z(){return we}async function ft(e){try{return JSON.parse(await o(e,`utf8`))}catch{return}}function pt(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function mt(e){let t=f(pt(e));return t!==`bun`&&t!==`bun.exe`}function ht(e){try{return h(e)}catch{return n.execPath}}async function gt(){try{return await k({resource:`self upgrade`,scope:[`self-upgrade`]})}catch(e){if(Te(e))return;throw e}}function B(e,t={}){if(b().outputMode===`human`){let n=H(e,{...t,stdio:[`inherit`,`inherit`,`inherit`]});return{cleanup:fe(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.resolve(),proc:n}}let n=H(e,{...t,stdio:[`ignore`,`pipe`,`pipe`]});return{cleanup:fe(()=>n.kill?.(`SIGTERM`)),outputDrained:Promise.all([_t(n.stdout),_t(n.stderr)]).then(()=>void 0),proc:n}}async function V(e){try{let t=await e.proc.exited;return await e.outputDrained,t}finally{e.cleanup()}}function H(e,t={}){let n=bt();if(n)return xt(e,t,n);let[r,...i]=e;if(!r)throw Error(`spawnCommand requires a non-empty command array.`);let a=ne(r,i,{...t,shell:t.shell??yt(r)});return{get exitCode(){return a.exitCode},stderr:a.stderr,stdout:a.stdout,exited:vt(a),kill:a.kill.bind(a),unref:()=>a.unref()}}async function U(e){let[t,n,r]=await Promise.all([W(e.stdout),W(e.stderr),e.exited]);return{exitCode:r,stderr:n,stdout:t}}async function _t(e){if(!e)return;let t=await W(e);t&&n.stderr.write(t)}async function vt(e){return new Promise((t,n)=>{e.once(`error`,n),e.once(`close`,e=>{t(typeof e==`number`?e:1)})})}async function W(e){return e?typeof e==`string`?e:typeof e.getReader==`function`?new Response(e).text():re(e):``}function yt(e){return n.platform!==`win32`||e.includes(`/`)||e.includes(`\\`)?!1:!/\.[a-z0-9]+$/i.test(e)}function bt(){let e=globalThis.Bun?.spawn;return typeof e==`function`?e:void 0}function xt(e,t,n){let r=n([...e],t);return{get exitCode(){return r.exitCode},stderr:r.stderr,stdout:r.stdout,exited:r.exited.then(()=>typeof r.exitCode==`number`?r.exitCode:1),kill:e=>r.kill?.(e)??!1,unref:()=>r.unref?.()}}const St=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function Ct(e,t){if(t)return t(e);let n=e.trim().split(`
|
|
2
|
-
`)[0],r=n.match(St);return r?r[1]:n||void 0}function wt(e,t){let n=Dt(e),r=Dt(t);if(!(!n||!r)){for(let e=0;e<3;e+=1){let t=n.core[e]-r.core[e];if(t!==0)return t>0?1:-1}return Ot(n.prerelease,r.prerelease)}}function G(e,t){return wt(e,t)===1}async function K(e,t){let n=t?.command??[e,`--version`];try{let{exitCode:e,stdout:r}=await U(H(n));return e===0?Ct(r,t?.parser):void 0}catch{return}}async function q(e,t=`latest`,n={}){try{let r=x(n.registry)??`https://registry.npmjs.org`;return(await N(ve(e,t,r),`npm:${r}:${e}:${t}`))?.version}catch{return}}async function Tt(e){try{let{exitCode:t,stdout:r}=await U(H([n.platform===`win32`?`where`:`which`,e]));return t===0?r.trim().split(`
|
|
3
|
-
`)[0]:void 0}catch{return}}async function Et(e){if(e)try{return await s(e)}catch{return e}}function Dt(e){let t=e.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9a-z.-]+))?$/i);if(t)return{core:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]?t[4].split(`.`):[]}}function Ot(e,t){if(e.length===0&&t.length===0)return 0;if(e.length===0)return 1;if(t.length===0)return-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r+=1){let n=e[r],i=t[r];if(n===void 0)return-1;if(i===void 0)return 1;if(n===i)continue;let a=/^\d+$/.test(n),o=/^\d+$/.test(i);return a&&o?Number(n)>Number(i)?1:-1:a?-1:o||n>i?1:-1}return 0}async function kt(e,t,r=n.env,i=n.cwd()){if(e!==`bun`&&e!==`npm`)return;let a=x(r.QTX_SELF_UPDATE_REGISTRY);return a?{isOverride:!0,registry:a,source:`quantex-env`}:t.selfUpdateRegistry?{isOverride:!0,registry:t.selfUpdateRegistry,source:`quantex-config`}:await At(e,r,i)||{isOverride:!1,registry:_e,source:`fallback`}}async function At(e,t,n){if(e===`bun`){let e=jt(t,[`BUN_CONFIG_REGISTRY`,`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(e)return{isOverride:!1,registry:e,source:`bun-env`};let r=await Mt(n,t);if(r)return{isOverride:!1,registry:r,source:`bunfig`}}let r=jt(t,[`NPM_CONFIG_REGISTRY`,`npm_config_registry`]);if(r)return{isOverride:!1,registry:r,source:`npm-env`};let i=await Pt(n,t);if(i)return{isOverride:!1,registry:i,source:`npmrc`}}function jt(e,t){for(let n of t){let t=x(e[n]);if(t)return t}}async function Mt(e,t){let n=Lt(t),r=t.XDG_CONFIG_HOME,i=It(e,`bunfig.toml`),a=[m(n,`.bunfig.toml`),r?m(r,`.bunfig.toml`):void 0];if(i){let e=await Nt(i);if(e)return e}for(let e of a){if(!e||!_(e))continue;let t=await Nt(e);if(t)return t}}async function Nt(e){try{return Rt(await o(e,`utf8`))}catch{return}}async function Pt(e,t){let n=Lt(t),r=It(e,`.npmrc`),i=m(n,`.npmrc`);if(r){let e=await Ft(r);if(e)return e}if(_(i))return Ft(i)}async function Ft(e){try{let t=(await o(e,`utf8`)).split(`
|
|
4
|
-
`).map(e=>e.trim());for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n||n.startsWith(`#`)||n.startsWith(`;`))continue;let r=n.match(/^registry\s*=\s*(.+)$/);if(!r?.[1])continue;let i=x(r[1]);if(i)return i}}catch{}}function It(e,t){let n=e;for(;;){let e=m(n,t);if(_(e))return e;let r=p(n);if(r===n)return;n=r}}function Lt(e){return e.HOME||e.USERPROFILE||g()}function Rt(e){let t=zt(e,[/(?:^|\n)\s*install\.registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\.registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}/,/(?:^|\n)\s*install\s*=\s*\{[\s\S]*?\bregistry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["'][\s\S]*?\}[\s\S]*?\}/]);if(t)return x(t);let n=e.match(/(?:^|\n)\s*\[install\]\s*\n([\s\S]*?)(?=\n\s*\[[^\]]+\]|\s*$)/)?.[1];if(n)return x(zt(n,[/(?:^|\n)\s*registry\s*=\s*["']([^"'#\n]+)["']/,/(?:^|\n)\s*registry\s*=\s*\{\s*url\s*=\s*["']([^"'#\n]+)["']/]))}function zt(e,t){for(let n of t){let t=e.match(n)?.[1];if(t)return t}}async function Bt(e){let t=await w();if(e.installSource===`binary`)try{let t=await nt(e.updateChannel),n=at(t,e.executablePath);return n?{binaryAsset:n,targetVersion:t.version}:{resolutionError:{detail:{channel:e.updateChannel},kind:`unsupported`,message:`No binary asset is available for the current platform on the ${e.updateChannel} channel.`}}}catch{return{resolutionError:{kind:`network`,message:`Failed to resolve the ${e.updateChannel} release manifest.`}}}let n=e.updateChannel===`beta`?`beta`:`latest`,r=await q(E,n,{registry:_e});if(e.installSource===`bun`||e.installSource===`npm`){let i=await kt(e.installSource,t);return{managedRegistry:i?.registry,managedRegistryIsOverride:i?.isOverride??!1,packageTag:n,targetVersion:await q(E,n,{registry:i?.registry}),upstreamLatestVersion:r,verificationCommand:Kt(e.packageRoot)}}return{packageTag:n,targetVersion:r,upstreamLatestVersion:r}}async function J(e){let t=e?.facts??await ct({updateChannel:e?.updateChannel}),n=e?.target??await Bt(t),r=n.targetVersion?G(n.targetVersion,t.currentVersion):!1;return{facts:t,status:Wt(t,n,r),target:n,updateAvailable:r}}function Vt(e){return{canAutoUpdate:e.facts.canAutoUpdate,currentVersion:e.facts.currentVersion,executablePath:e.facts.executablePath,installSource:e.facts.installSource,latestVersion:e.target.targetVersion,managedRegistry:e.target.managedRegistry,managedRegistryIsOverride:e.target.managedRegistryIsOverride,packageRoot:e.facts.packageRoot,recommendedUpgradeCommand:e.facts.canAutoUpdate?`quantex upgrade`:void 0,upstreamLatestVersion:e.target.upstreamLatestVersion,updateChannel:e.facts.updateChannel}}async function Ht(e,t){if(!t.success||e.facts.installSource!==`bun`&&e.facts.installSource!==`npm`)return t;let n=await Gt(e);if(!n)return{error:{kind:`verify`,message:`Managed self-upgrade finished but Quantex could not verify the installed version afterwards.`},installSource:e.facts.installSource,success:!1};let r=t.newVersion??e.target.targetVersion;return r&&n!==r?{error:{detail:{expectedVersion:r,observedVersion:n},kind:`verify`,message:`Managed self-upgrade installed version ${n}, but expected ${r}.`},installSource:e.facts.installSource,success:!1}:!r&&n===e.facts.currentVersion&&e.target.targetVersion!==void 0?{error:{detail:{observedVersion:n},kind:`verify`,message:`Managed self-upgrade completed without changing the installed Quantex version.`},installSource:e.facts.installSource,success:!1}:{...t,newVersion:n}}function Ut(e){let t={canAutoUpdate:e.canAutoUpdate,currentVersion:e.currentVersion,executablePath:e.executablePath,installSource:e.installSource,packageRoot:e.packageRoot,updateChannel:e.updateChannel},n={managedRegistry:e.managedRegistry,managedRegistryIsOverride:e.managedRegistryIsOverride,packageTag:e.updateChannel===`beta`?`beta`:`latest`,targetVersion:e.latestVersion,upstreamLatestVersion:e.upstreamLatestVersion,verificationCommand:Kt(e.packageRoot)},r=e.latestVersion?G(e.latestVersion,e.currentVersion):!1;return{facts:t,status:Wt(t,n,r),target:n,updateAvailable:r}}function Wt(e,t,n){return e.canAutoUpdate?t.targetVersion&&!n?`up-to-date`:t.targetVersion?`update-available`:`check-unavailable`:`manual-required`}async function Gt(e){if(e.target.verificationCommand){let t=await K(e.facts.executablePath,{command:e.target.verificationCommand});if(t)return t}return K(e.facts.executablePath)}function Kt(e){if(e)return[n.execPath,m(e,`dist`,`cli.mjs`),`--version`]}async function qt(e,t,i,o){let s;try{s=await fetch(e)}catch(t){return X(`network`,`Failed to download ${e}.`,t)}if(!s.ok)return X(`network`,`Failed to download ${e}: HTTP ${s.status}.`);let u=await a(m(p(t),`.quantex-upgrade-`)),h=m(u,f(t)),g=`${t}.bak`,_=!1;try{let a=ie.from(await s.arrayBuffer()),f=await Jt(t),p=en(a);if(p!==tn(i))return X(`checksum`,`Checksum mismatch for ${e}. Expected ${tn(i)}, got ${p}.`);if(await d(h,a),n.platform===`win32`)return Yt(h,t,g,u,o);await r(h,f),await l(g,{force:!0}),await c(t,g),_=!0,await c(h,t);let m=await $t(t,o);return m.success?(_=!1,await l(g,{force:!0}),{success:!0}):(await Qt(g,t),_=!1,m)}catch(e){if(_){try{await Qt(g,t)}catch{}_=!1}return X(Zt(e),`Failed to replace the current Quantex binary.`,e)}finally{n.platform!==`win32`&&await l(u,{recursive:!0,force:!0})}}async function Jt(e){try{return(await u(e)).mode&511}catch{return 493}}function Yt(e,t,r,i,a){try{return H([`powershell.exe`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-WindowStyle`,`Hidden`,`-Command`,Xt(e,t,r,i,n.pid,a)],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0}).unref(),{success:!0}}catch(e){return X(`locked`,`Failed to schedule Windows binary replacement.`,e)}}function Xt(e,t,n,r,i,a){let o=Y(e),s=Y(t),c=Y(n),l=Y(r),u=Y(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 Y(e){return e.replaceAll(`'`,`''`)}function X(e,t,n){return{error:{detail:n,kind:e,message:t},success:!1}}function Zt(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 Qt(e,t){await l(t,{force:!0}),await c(e,t)}async function $t(e,t){if(!t)return{success:!0};try{let{exitCode:n,stdout:r}=await U(H([e,`--version`],{stdio:[`ignore`,`pipe`,`ignore`]}));return n===0?r.includes(t)?{success:!0}:X(`verify`,`The upgraded Quantex binary reported an unexpected version during verification.`):X(`verify`,`The upgraded Quantex binary exited with code ${n} during verification.`)}catch(e){return X(`verify`,`Failed to execute the upgraded Quantex binary for verification.`,e)}}function en(t){return e(`sha256`).update(t).digest(`hex`)}function tn(e){return e.trim().toLowerCase()}const nn={source:`binary`,canHandle:e=>rn(e)===`binary`,getRecoveryHint:(e,t)=>{let n=t?.error?.detail&&typeof t.error.detail==`object`&&`downloadUrl`in t.error.detail?String(t.error.detail.downloadUrl):I(e.executablePath);if(n)return t?.error?.kind===`locked`?`close other qtx processes and retry, or download and replace the binary from ${n}`:t?.error?.kind===`permission`?`check write permission for the current binary path, or download and replace the binary from ${n}`:t?.error?.kind===`network`?`check network access and retry, or download and replace the binary from ${n}`:`download and replace the binary from ${n}`},async upgrade(e){let t=e.target.binaryAsset;if(!t)return{error:e.target.resolutionError??{kind:`unsupported`,message:`No release artifact is available for the current platform and architecture.`},installSource:e.facts.installSource,success:!1};let n=await qt(t.downloadUrl,e.facts.executablePath,t.checksum,e.target.targetVersion??`latest`);return{...!n.success&&n.error?{...n,error:{...n.error,detail:{...typeof n.error.detail==`object`&&n.error.detail?n.error.detail:{},downloadUrl:t.downloadUrl}}}:n,installSource:e.facts.installSource,newVersion:n.success?e.target.targetVersion:void 0}}};function rn(e){return`facts`in e?e.facts.installSource:e.installSource}async function Z(e,t,n){try{let r=t?`${e}@${t}`:e,i=x(n);return await Q([`bun`,`add`,`-g`,...i?[`--registry`,i]:[],r],[e])}catch{return!1}}async function an(e,t=`latest-major`,n=`latest`,r){try{let i=n===`latest`?e:`${e}@${n}`,a=x(r);return await Q([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...a?[`--registry`,a]:[],i],[e])}catch{return!1}}async function on(e,t=`latest-major`){if(e.length===0)return!0;try{return await Q([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function sn(e){try{return await V(B([`bun`,`remove`,`-g`,e]))===0}catch{return!1}}async function cn(e){try{let{exitCode:t,stdout:n}=await U(H([`bun`,`pm`,`-g`,`ls`],{stdio:pn()}));return t===0?ln(n,e):void 0}catch{return}}function ln(e,t){let n=`${t}@`;for(let t of e.split(`
|
|
5
|
-
`)){let e=t.trim().split(/\s+/).at(-1);if(!e?.startsWith(n))continue;let r=e.slice(n.length);if(r)return r}}async function Q(e,t){return await V(B(e))===0?un(t):!1}async function un(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await dn();if(!n)return!0;let r=fn(n),i=t.filter(e=>r.has(e));return i.length===0?!0:await V(B([`bun`,`pm`,`-g`,`trust`,...i]))===0}async function dn(){try{let{exitCode:e,stdout:t}=await U(H([`bun`,`pm`,`-g`,`untrusted`],{stdio:pn()}));return e===0?t:void 0}catch{return}}function fn(e){let t=new Set;for(let n of e.split(`
|
|
6
|
-
`)){let e=n.replaceAll(`\\`,`/`).match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function pn(){return[`ignore`,`pipe`,`ignore`]}const mn={source:`bun`,canHandle:e=>hn(e)===`bun`,getRecoveryHint:e=>`bun add -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await Z(E,e.target.packageTag??(e.facts.updateChannel===`beta`?`beta`:`latest`),e.target.managedRegistry);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through Bun.`},installSource:e.facts.installSource,newVersion:t?e.target.targetVersion:void 0,success:t}}};function hn(e){return`facts`in e?e.facts.installSource:e.installSource}async function gn(e,t,n){try{let r=t?`${e}@${t}`:e,i=x(n);return await V(B([`npm`,`install`,`-g`,r,...i?[`--registry`,i]:[]]))===0}catch{return!1}}async function _n(e,t=`latest-major`,n=`latest`,r){try{let i=x(r);return await V(B(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@${n}`,...i?[`--registry`,i]:[]]:[`npm`,`update`,`-g`,e,...i?[`--registry`,i]:[]]))===0}catch{return!1}}async function vn(e,t=`latest-major`){if(e.length===0)return!0;try{return await V(B(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e]))===0}catch{return!1}}async function yn(e){try{return await V(B([`npm`,`uninstall`,`-g`,e]))===0}catch{return!1}}async function bn(e){try{let{exitCode:t,stdout:n}=await U(H([`npm`,`list`,`-g`,`--depth=0`,`--json`],{stdio:[`ignore`,`pipe`,`ignore`]}));return t===0?xn(n,e):void 0}catch{return}}function xn(e,t){let n=JSON.parse(e).dependencies?.[t]?.version;return typeof n==`string`?n:void 0}const Sn={source:`npm`,canHandle:e=>Cn(e)===`npm`,getRecoveryHint:e=>`npm install -g ${E}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await gn(E,e.target.packageTag??(e.facts.updateChannel===`beta`?`beta`:`latest`),e.target.managedRegistry);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${E} through npm.`},installSource:e.facts.installSource,newVersion:t?e.target.targetVersion:void 0,success:t}}};function Cn(e){return`facts`in e?e.facts.installSource:e.installSource}const wn={source:`source`,canHandle:e=>{let t=`facts`in e?e.facts.installSource:e.installSource;return t===`source`||t===`unknown`},getRecoveryHint:()=>void 0,async upgrade(e){return{error:{kind:`unsupported`,message:`Install source "${e.facts.installSource}" does not support auto-update.`},installSource:e.facts.installSource,success:!1}}},Tn=[mn,Sn,nn,wn];function $(e){return Tn.find(t=>t.canHandle(e))??wn}function En(e,t,n=`stable`){return $({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n})}function Dn(e,t,n=`stable`,r){return r?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:En(e,t,n).getRecoveryHint({canAutoUpdate:e===`binary`||e===`bun`||e===`npm`,currentVersion:``,executablePath:t,installSource:e,packageRoot:``,updateChannel:n},r)}function On(e,t){return t?.error?.kind===`locked`?`another qtx upgrade is already running; wait for it to finish and retry`:$(e).getRecoveryHint(e,t)}async function kn(e){return Vt(await J({updateChannel:e?.updateChannel}))}async function An(e){let t=await Mn(e),n=await gt();if(!n)return{error:{kind:`locked`,message:`Another qtx upgrade is already running.`},installSource:t.facts.installSource,success:!1};try{return Ht(t,await $(t).upgrade(t))}finally{await n()}}function jn(e,t=n.execPath){return Dn(e,t)}async function Mn(e){return e?`facts`in e?e:e.installSource===`binary`?J({facts:{canAutoUpdate:e.canAutoUpdate,currentVersion:e.currentVersion,executablePath:e.executablePath,installSource:e.installSource,packageRoot:e.packageRoot,updateChannel:e.updateChannel}}):Ut(e):J()}function Nn(e){return Ln({...e,error:null,ok:!0})}function Pn(e){return Ln({...e,ok:!1})}function Fn(e,t,n={}){let r=b();return r.cancelled&&!n.force||(r.outputMode===`json`?console.log(JSON.stringify(e,null,2)):r.outputMode===`ndjson`?zn({action:e.action,data:e,target:e.target,type:`result`}):t(e)),e}function In(e,t={}){let n=b();if(!(n.cancelled&&!t.force)&&n.outputMode===`ndjson`)return zn(e)}function Ln(e){let t=b();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:z()},ok:e.ok,target:e.target,warnings:e.warnings??[]}}function Rn(e){let t=b();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:z()},target:e.target,type:e.type}}function zn(e){let t=Rn(e);return console.log(JSON.stringify(t)),t}const{createColors:Bn,isColorSupported:Vn}=ae;function Hn(){let e=b().colorMode??`auto`;return Bn(e===`always`?!0:e===`never`?!1:Vn)}const Un=new Proxy({},{get(e,t){let n=Hn(),r=n[t];return typeof r==`function`?r.bind(n):r}});export{w as $,H as A,A as B,wt as C,Et as D,q as E,z as F,Ve as G,ze as H,F as I,Pe as J,He as K,I as L,V as M,lt as N,G as O,R as P,be as Q,Le as R,J as S,K as T,Ie as U,j as V,Re as W,S as X,E as Y,C as Z,Z as _,Fn as a,ce as at,on as b,An as c,bn as d,xe as et,gn as f,cn as g,vn as h,In as i,b as it,B as j,U as k,Dn as l,_n as m,Pn as n,x as nt,jn as o,le as ot,yn as p,Te as q,Nn as r,de as rt,kn as s,se as st,Un as t,ye as tt,On as u,sn as v,Tt as w,Vt as x,an as y,Be as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./commands-BgbYCaOu.mjs";export{e as commandsCommand};
|
package/dist/ensure-BwxOEjb5.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,c as t,r as n,s as r}from"./agents-ONdRhmua.mjs";import{a as i,i as a,n as o,q as s,r as c,t as l}from"./color-CCa8Z1Vv.mjs";import{t as u}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-DVnD2WHo.mjs";async function h(l){let d=await n(l);if(!d)return i(o({action:`ensure`,error:{code:`AGENT_NOT_FOUND`,details:{input:l},message:`Unknown agent: ${l}`},target:{kind:`agent`,name:l}}),g);let{agent:f,inspection:m}=d;if(m.inPath){if(m.installedState)return i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${f.displayName} is already installed.`}]}),g);let n=e(m.methods,m.resolvedBinaryPath??m.binaryPath);if(n){if(p())return i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${f.displayName} install in Quantex state.`}]}),g);a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});try{let e=await t(f,n);return i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed. Quantex is now tracking the existing install.`}]}),g)}catch(e){if(s(e))return i(o({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:f.name})}),g);throw e}}return i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!0},target:{kind:`agent`,name:f.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${f.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]}),g)}if(p())return i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},target:{kind:`agent`,name:f.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${f.displayName}.`}]}),g);a({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name}},target:{kind:`agent`,name:f.name},type:`started`});let h;try{h=await r(f)}catch(e){if(s(e))return i(o({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:f.name})}),g);throw e}return h.success?i(c({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!0,installState:h.installedState?{installType:h.installedState.installType,packageName:h.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:f.name}}),g):i(o({action:`ensure`,data:{agent:{displayName:f.displayName,name:f.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${f.displayName}.`},target:{kind:`agent`,name:f.name}}),g)}function g(e){if(e.error){m(l.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(l.green(t.message));continue}if(t.code===`DRY_RUN`){d(l.cyan(t.message));continue}d(l.yellow(t.message))}return}if(e.data.changed){f(l.cyan(`Installing ${e.data.agent.displayName}...`)),f(l.green(`${e.data.agent.displayName} is now installed.`));return}f(l.green(`${e.data.agent.displayName} is already installed.`))}}export{h as t};
|
package/dist/ensure-DXxpX7Wd.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ensure-BwxOEjb5.mjs";export{e as ensureCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./inspect-uCNo6sQt.mjs";export{e as inspectCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,c as t,r as n,s as r}from"./agents-ONdRhmua.mjs";import{a as i,i as a,n as o,q as s,r as c,t as l}from"./color-CCa8Z1Vv.mjs";import{t as u}from"./lifecycle-errors-D7JpbOsK.mjs";import{a as d,i as f,n as p,r as m}from"./user-output-DVnD2WHo.mjs";async function h(e){let t=Array.isArray(e)?e:[e];if(t.length<=1)return i(await g(t[0],{emitStartedEvent:!0}),S);a({action:`install`,data:{scope:`batch`},target:{kind:`agent`},type:`started`});let n=[];for(let e of t){let t=v(e,await g(e));n.push(t),a({action:`install`,data:t,target:{kind:`agent`,name:t.agent.name},type:`progress`})}let r={results:n,scope:`batch`,summary:b(n)};return i(n.some(e=>!e.ok)?o({action:`install`,data:r,error:x(n),target:{kind:`agent`}}):c({action:`install`,data:r,target:{kind:`agent`}}),C)}async function g(i,a={}){let l=await n(i);if(!l)return o({action:`install`,error:{code:`AGENT_NOT_FOUND`,details:{input:i},message:`Unknown agent: ${i}`},target:{kind:`agent`,name:i}});let{agent:d,inspection:f}=l;if(f.inPath){if(f.installedState)return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`ALREADY_INSTALLED`,message:`${d.displayName} is already installed.`}]});let n=e(f.methods,f.resolvedBinaryPath??f.binaryPath);if(n){if(p())return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would record the existing ${d.displayName} install in Quantex state.`}]});_(d,a.emitStartedEvent);try{let e=await t(d,n);return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!0,installState:{installType:e.installType,packageName:e.packageName},installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`TRACKED_EXISTING_INSTALL`,message:`${d.displayName} is already installed. Quantex is now tracking the existing install.`}]})}catch(e){if(s(e))return o({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},...u(e,{kind:`agent`,name:d.name})});throw e}}return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!0},target:{kind:`agent`,name:d.name},warnings:[{code:`UNTRACKED_EXISTING_INSTALL`,message:`${d.displayName} is already installed but not tracked by Quantex. Quantex could not safely determine the supported install source, so the existing install remains unmanaged.`}]})}if(p())return c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},target:{kind:`agent`,name:d.name},warnings:[{code:`DRY_RUN`,message:`Dry run: would install ${d.displayName}.`}]});_(d,a.emitStartedEvent);let m;try{m=await r(d)}catch(e){if(s(e))return o({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},...u(e,{kind:`agent`,name:d.name})});throw e}return m.success?c({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!0,installState:m.installedState?{installType:m.installedState.installType,packageName:m.installedState.packageName}:void 0,installed:!0},target:{kind:`agent`,name:d.name}}):o({action:`install`,data:{agent:{displayName:d.displayName,name:d.name},changed:!1,installed:!1},error:{code:`INSTALL_FAILED`,message:`Failed to install ${d.displayName}.`},target:{kind:`agent`,name:d.name}})}function _(e,t=!1){t&&a({action:`install`,data:{agent:{displayName:e.displayName,name:e.name}},target:{kind:`agent`,name:e.name},type:`started`})}function v(e,t){let n=t.data,r=t.warnings.map(e=>({code:e.code,message:e.message}));return{agent:n?.agent??{displayName:e,name:t.target?.name??e},changed:n?.changed??!1,error:t.error?{code:t.error.code,message:t.error.message}:void 0,input:e,installState:n?.installState,installed:n?.installed??!1,ok:t.ok,status:y(t),warnings:r}}function y(e){return e.ok?e.warnings.some(e=>e.code===`TRACKED_EXISTING_INSTALL`)?`tracked-existing-install`:e.warnings.some(e=>e.code===`UNTRACKED_EXISTING_INSTALL`)?`untracked-existing-install`:e.warnings.some(e=>e.code===`ALREADY_INSTALLED`)?`already-installed`:e.warnings.some(e=>e.code===`DRY_RUN`)?`planned`:`installed`:e.error?.code===`RESOURCE_LOCKED`?`locked`:`failed`}function b(e){let t={alreadyInstalled:0,failed:0,installed:0,locked:0,planned:0,trackedExistingInstall:0,untrackedExistingInstall:0};for(let n of e)switch(n.status){case`already-installed`:t.alreadyInstalled+=1;break;case`failed`:t.failed+=1;break;case`installed`:t.installed+=1;break;case`locked`:t.locked+=1;break;case`planned`:t.planned+=1;break;case`tracked-existing-install`:t.trackedExistingInstall+=1;break;case`untracked-existing-install`:t.untrackedExistingInstall+=1;break}return t}function x(e){let t=e.filter(e=>!e.ok),n=new Set(t.map(e=>e.error?.code));return n.size===1&&n.has(`RESOURCE_LOCKED`)?{code:`RESOURCE_LOCKED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents could not be installed because another Quantex process is already using the agent lifecycle lock.`}:{code:`INSTALL_FAILED`,details:{failedAgents:t.map(e=>e.input)},message:`One or more agents failed to install.`}}function S(e){if(e.error){m(l.red(e.error.message));return}if(e.data){if(e.warnings.length>0){for(let t of e.warnings){if(t.code===`TRACKED_EXISTING_INSTALL`){f(l.green(t.message));continue}if(t.code===`DRY_RUN`){d(l.cyan(t.message));continue}d(l.yellow(t.message))}return}f(l.cyan(`Installing ${e.data.agent.displayName}...`)),f(l.green(`${e.data.agent.displayName} installed successfully!`))}}function C(e){if(!e.data){e.error&&m(l.red(e.error.message));return}for(let t of e.data.results)switch(t.status){case`installed`:f(l.cyan(`Installing ${t.agent.displayName}...`)),f(l.green(`${t.agent.displayName} installed successfully!`));break;case`tracked-existing-install`:f(l.green(w(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`already-installed`:case`untracked-existing-install`:d(l.yellow(w(t.warnings,`${t.agent.displayName} is already installed.`)));break;case`planned`:d(l.cyan(w(t.warnings,`Dry run: would install ${t.agent.displayName}.`)));break;case`locked`:d(l.yellow(t.error?.message??`Another quantex process is already installing ${t.agent.displayName}.`));break;case`failed`:m(l.red(t.error?.message??`Failed to install ${t.agent.displayName}.`));break}T(e.data.summary)}function w(e,t){return e[0]?.message??t}function T(e){let t=[e.installed?`installed ${e.installed}`:void 0,e.alreadyInstalled?`already installed ${e.alreadyInstalled}`:void 0,e.trackedExistingInstall?`tracked existing ${e.trackedExistingInstall}`:void 0,e.untrackedExistingInstall?`untracked existing ${e.untrackedExistingInstall}`:void 0,e.failed?`failed ${e.failed}`:void 0,e.locked?`locked ${e.locked}`:void 0,e.planned?`planned ${e.planned}`:void 0].filter(Boolean);t.length>0&&f(l.bold(`Summary: ${t.join(`, `)}`))}export{h as installCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./resolve-C-TyEJ_4.mjs";export{e as resolveCommand};
|
package/dist/schema-BwnU4o2E.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,r as n,t as r}from"./color-CCa8Z1Vv.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`},results:{items:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},error:{type:`object`},input:{type:`string`},installState:{type:`object`},installed:{type:`boolean`},ok:{type:`boolean`},status:{type:`string`},warnings:{items:{type:`object`},type:`array`}},required:[`agent`,`changed`,`input`,`installed`,`ok`,`status`,`warnings`],type:`object`},type:`array`},scope:{type:`string`},summary:{type:`object`}},type:`object`},description:`Install result for one or more agents`,envelopeSchema:i,name:`install`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},changed:{type:`boolean`},installState:{type:`object`},installed:{type:`boolean`}},required:[`agent`,`changed`,`installed`],type:`object`},description:`Ensure result for an agent`,envelopeSchema:i,name:`ensure`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},capabilities:{type:`object`},inspection:{type:`object`}},required:[`agent`,`capabilities`,`inspection`],type:`object`},description:`Structured inspection result for an agent`,envelopeSchema:i,name:`inspect`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{agent:{type:`object`},resolution:{additionalProperties:!1,properties:{binaryPath:{type:`string`},installGuidance:{additionalProperties:!1,properties:{docsRef:{type:`string`},installMethods:{items:{additionalProperties:!1,properties:{command:{type:`string`},label:{type:`string`},type:{type:`string`}},required:[`command`,`label`,`type`],type:`object`},type:`array`},suggestedAction:{type:`string`},suggestedEnsureCommand:{type:`string`}},required:[`docsRef`,`installMethods`,`suggestedAction`,`suggestedEnsureCommand`],type:`object`},installed:{type:`boolean`},installSource:{type:`string`},installedVersion:{type:`string`},lifecycle:{type:`string`},sourceLabel:{type:`string`},suggestedLaunchCommand:{items:{type:`string`},type:`array`}},required:[`binaryPath`,`installed`,`installSource`,`lifecycle`,`sourceLabel`,`suggestedLaunchCommand`],type:`object`}},required:[`agent`,`resolution`],type:`object`},description:`Resolved executable entrypoint for an agent`,envelopeSchema:i,name:`resolve`,ndjsonEventSchema:a},{dataSchema:{additionalProperties:!1,properties:{commands:{items:{additionalProperties:!1,properties:{dataSchema:{type:`object`},description:{type:`string`},envelopeSchema:{type:`object`},name:{type:`string`},ndjsonEventSchema:{type:`object`}},required:[`dataSchema`,`description`,`envelopeSchema`,`name`],type:`object`},type:`array`}},required:[`commands`],type:`object`},description:`Structured schema catalog`,envelopeSchema:i,name:`schema`,ndjsonEventSchema:a}];async function 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};
|
package/dist/schema-HU67udth.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./schema-BwnU4o2E.mjs";export{e as schemaCommand};
|