@vibeapi/cli 0.0.172 → 0.0.174
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/client-config.snapshot.json +43 -1
- package/dist/client-config.snapshot.json +43 -1
- package/dist/lib/tool-manager.js +1 -1
- package/dist/lib/tool-upgrade.d.ts +10 -0
- package/dist/lib/tool-upgrade.js +1 -1
- package/dist/lib/tools/antigravity.js +1 -1
- package/dist/lib/windows-security.d.ts +9 -0
- package/dist/lib/windows-security.js +1 -0
- package/dist/models.json +1 -0
- package/models.json +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"revision": "2026-11-
|
|
3
|
+
"revision": "2026-11-11T08:32:41Z-17",
|
|
4
4
|
"min_client_version": "",
|
|
5
5
|
"upgrade_message": "",
|
|
6
6
|
"defaults": {
|
|
@@ -1843,6 +1843,47 @@
|
|
|
1843
1843
|
"recommended": false,
|
|
1844
1844
|
"hidden": false,
|
|
1845
1845
|
"context_window": 1048576,
|
|
1846
|
+
"max_output_tokens": 65536,
|
|
1847
|
+
"capabilities": {
|
|
1848
|
+
"functionCall": true,
|
|
1849
|
+
"vision": true,
|
|
1850
|
+
"reasoning": true,
|
|
1851
|
+
"imageOutput": false,
|
|
1852
|
+
"video": true,
|
|
1853
|
+
"structuredOutput": true,
|
|
1854
|
+
"contextWindowTokens": 1048576,
|
|
1855
|
+
"maxOutput": 65536,
|
|
1856
|
+
"inputModalities": [
|
|
1857
|
+
"text",
|
|
1858
|
+
"image",
|
|
1859
|
+
"video",
|
|
1860
|
+
"audio"
|
|
1861
|
+
],
|
|
1862
|
+
"outputModalities": [
|
|
1863
|
+
"text"
|
|
1864
|
+
],
|
|
1865
|
+
"knowledgeCutoff": "2026-03-31",
|
|
1866
|
+
"reasoningEfforts": [
|
|
1867
|
+
"low",
|
|
1868
|
+
"medium",
|
|
1869
|
+
"high"
|
|
1870
|
+
]
|
|
1871
|
+
},
|
|
1872
|
+
"endpoint_types": [
|
|
1873
|
+
"gemini",
|
|
1874
|
+
"openai"
|
|
1875
|
+
]
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
"id": "gemini-4-carbon",
|
|
1879
|
+
"name": "Gemini 4 Carbon",
|
|
1880
|
+
"description": "100 万上下文 | 前沿推理 | 长程 Agent",
|
|
1881
|
+
"group": "",
|
|
1882
|
+
"group_name": "",
|
|
1883
|
+
"recommended": false,
|
|
1884
|
+
"hidden": false,
|
|
1885
|
+
"context_window": 1048576,
|
|
1886
|
+
"max_output_tokens": 65536,
|
|
1846
1887
|
"capabilities": {
|
|
1847
1888
|
"functionCall": true,
|
|
1848
1889
|
"vision": true,
|
|
@@ -2162,6 +2203,7 @@
|
|
|
2162
2203
|
},
|
|
2163
2204
|
"agy_models": [
|
|
2164
2205
|
"gemini-4-argon",
|
|
2206
|
+
"gemini-4-carbon-medium",
|
|
2165
2207
|
"gemini-3.8-flash",
|
|
2166
2208
|
"gemini-3.7-flash",
|
|
2167
2209
|
"gemini-3.6-flash",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"revision": "2026-11-
|
|
3
|
+
"revision": "2026-11-11T08:32:41Z-17",
|
|
4
4
|
"min_client_version": "",
|
|
5
5
|
"upgrade_message": "",
|
|
6
6
|
"defaults": {
|
|
@@ -1843,6 +1843,47 @@
|
|
|
1843
1843
|
"recommended": false,
|
|
1844
1844
|
"hidden": false,
|
|
1845
1845
|
"context_window": 1048576,
|
|
1846
|
+
"max_output_tokens": 65536,
|
|
1847
|
+
"capabilities": {
|
|
1848
|
+
"functionCall": true,
|
|
1849
|
+
"vision": true,
|
|
1850
|
+
"reasoning": true,
|
|
1851
|
+
"imageOutput": false,
|
|
1852
|
+
"video": true,
|
|
1853
|
+
"structuredOutput": true,
|
|
1854
|
+
"contextWindowTokens": 1048576,
|
|
1855
|
+
"maxOutput": 65536,
|
|
1856
|
+
"inputModalities": [
|
|
1857
|
+
"text",
|
|
1858
|
+
"image",
|
|
1859
|
+
"video",
|
|
1860
|
+
"audio"
|
|
1861
|
+
],
|
|
1862
|
+
"outputModalities": [
|
|
1863
|
+
"text"
|
|
1864
|
+
],
|
|
1865
|
+
"knowledgeCutoff": "2026-03-31",
|
|
1866
|
+
"reasoningEfforts": [
|
|
1867
|
+
"low",
|
|
1868
|
+
"medium",
|
|
1869
|
+
"high"
|
|
1870
|
+
]
|
|
1871
|
+
},
|
|
1872
|
+
"endpoint_types": [
|
|
1873
|
+
"gemini",
|
|
1874
|
+
"openai"
|
|
1875
|
+
]
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
"id": "gemini-4-carbon",
|
|
1879
|
+
"name": "Gemini 4 Carbon",
|
|
1880
|
+
"description": "100 万上下文 | 前沿推理 | 长程 Agent",
|
|
1881
|
+
"group": "",
|
|
1882
|
+
"group_name": "",
|
|
1883
|
+
"recommended": false,
|
|
1884
|
+
"hidden": false,
|
|
1885
|
+
"context_window": 1048576,
|
|
1886
|
+
"max_output_tokens": 65536,
|
|
1846
1887
|
"capabilities": {
|
|
1847
1888
|
"functionCall": true,
|
|
1848
1889
|
"vision": true,
|
|
@@ -2162,6 +2203,7 @@
|
|
|
2162
2203
|
},
|
|
2163
2204
|
"agy_models": [
|
|
2164
2205
|
"gemini-4-argon",
|
|
2206
|
+
"gemini-4-carbon-medium",
|
|
2165
2207
|
"gemini-3.8-flash",
|
|
2166
2208
|
"gemini-3.7-flash",
|
|
2167
2209
|
"gemini-3.6-flash",
|
package/dist/lib/tool-manager.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as o,spawnSync as t}from"child_process";import{i18n as n}from"./i18n.js";import e from"inquirer";import r from"chalk";import{canPrompt as i,shouldAutoConfirm as l}from"./runtime-options.js";import{logger as a}from"../utils/logger.js";import{configManager as s,savedApiKeys as c}from"./config.js";import{getAdapter as d,listAdapters as p,TOOL_ADAPTERS as u}from"./tools/registry.js";import{backupBeforeWrite as m,listBackups as f,restoreBackup as g}from"./tools/backup.js";import{existsSync as h,rmSync as w}from"fs";import{dirname as y,join as P}from"path";import{toolHome as
|
|
1
|
+
import{execSync as o,spawnSync as t}from"child_process";import{i18n as n}from"./i18n.js";import e from"inquirer";import r from"chalk";import{canPrompt as i,shouldAutoConfirm as l}from"./runtime-options.js";import{logger as a}from"../utils/logger.js";import{configManager as s,savedApiKeys as c}from"./config.js";import{getAdapter as d,listAdapters as p,TOOL_ADAPTERS as u}from"./tools/registry.js";import{backupBeforeWrite as m,listBackups as f,restoreBackup as g}from"./tools/backup.js";import{existsSync as h,rmSync as w}from"fs";import{dirname as y,join as P}from"path";import{toolHome as $}from"./tools/types.js";import{stringWidth as v}from"../utils/string-width.js";import{resolveModelCatalog as k}from"./model-catalog.js";import{compareVersions as T,getToolMinVersion as C}from"./model-registry.js";import{findInstalls as E,forgetInstalls as O,installLabel as _,mirrorInstallCommand as S,npmMirrorInstallCommand as N,npmMirrorVersion as j}from"./tools/tool-installs.js";import{failureContext as M,lastCommandExit as U,lastCommandOutput as b,mirrorInstall as x}from"./tool-upgrade.js";import{upgradeApp as I}from"./app-update.js";import{CLI_NAME as R}from"./brand.js";import{track as F,trackStep as L}from"./telemetry.js";import{addUserPathDir as V,broadcastEnvChange as D}from"./windows-env.js";export{T as compareVersions};function z(o){const t=u[o];return{name:t.name,command:t.command,installCommand:t.installCommand,configPath:t.configPath,displayName:t.displayName,...t.hidden?{hidden:!0}:{},...t.isInstalled?{gui:!0}:{}}}export const SUPPORTED_TOOLS=Object.fromEntries(Object.keys(u).map(o=>[o,z(o)]));export class ToolManager{static instance;constructor(){}static getInstance(){return ToolManager.instance||(ToolManager.instance=new ToolManager),ToolManager.instance}isToolInstalled(o){if(!SUPPORTED_TOOLS[o])return!1;const t=d(o);if(t?.isInstalled)try{return t.isInstalled()}catch{return!1}return this.isOnPath(o)||null!==this.nativeLauncher(o)}isOnPath(t){const n=SUPPORTED_TOOLS[t];if(!n)return!1;try{const t="win32"===process.platform?`where ${n.command}`:`which ${n.command}`;return o(t,{stdio:"pipe"}),!0}catch{return!1}}nativeLauncher(o){const t=d(o),n=t?.installSpec?.native?.binDir;if(!t||!n)return null;const e="win32"===process.platform?`${t.command}.exe`:t.command,r=P($(),...n,e);return h(r)?r:null}ensureNativeOnPath(o){if("win32"!==process.platform||this.isOnPath(o))return null;const t=this.nativeLauncher(o);if(!t)return null;const n=y(t);try{if(!V(n))return null}catch(t){return a.logError(`ensureNativeOnPath: ${o}`,t),null}return D(),process.env.Path=`${process.env.Path??""};${n}`,n}async installTool(o){return L(`install:${o}`,()=>this.installToolNow(o))}async installToolNow(t){const a=SUPPORTED_TOOLS[t];if(!a)throw new Error(`Unknown tool: ${t}`);const s=d(t)?.appInstaller;if(s&&!s.blocker()){const o=await I(t,{install:!0});if("failed"===o.result||"unavailable"===o.result)throw new Error(`Failed to install ${a.displayName}`);return}const c=d(t)?.installSpec;if(c&&(c.mirrorScript||c.npmPackage)){const o=S(c);if(await x(c)){if(O(),this.isToolInstalled(t))return void console.log(r.green("√ "+n.t("wizard.tool_installed")));F(`install-script:${c.command}`,"fail",{error:b()||"(no output)",detail:{reason:"not_found_after_ok",...U(),...M()}})}throw console.log(r.red("× "+n.t("wizard.install_failed"))),console.log(r.yellow(" ! "+n.t("install.manual_command",{tool:a.displayName,command:o}))),c.mirrorScript&&c.npmPackage&&console.log(r.yellow(" ! "+n.t("install.manual_npm",{command:N(c,await j(c))}))),new Error(`Failed to install ${a.displayName}`)}const p=a.installCommand;console.log(r.gray("$ ")+r.white(p));try{return o(p,{stdio:"inherit"}),O(),void console.log(r.green("√ "+n.t("wizard.tool_installed")))}catch(o){if(console.log(r.red("× "+n.t("wizard.install_failed"))),!/EACCES|EPERM|permission denied/i.test(`${o?.message??""}${o?.stderr??""}`)&&243!==o?.status&&!p.startsWith("npm "))throw new Error(`Failed to install ${a.displayName}: ${o}`);console.log(r.yellow(" ! "+("win32"===process.platform?n.t("install.permission_windows",{command:p}):n.t("install.permission_unix",{command:p}))))}const{action:u}=!i()||l()?{action:"continue"}:await e.prompt([{type:"list",name:"action",message:n.t("install.what_next"),choices:[{name:n.t("install.installed_continue"),value:"continue"},{name:n.t("install.cancel_install"),value:"cancel"}]}]);if("cancel"===u)throw new Error(n.t("install.user_cancelled"));if(O(),!this.isToolInstalled(t))throw console.log(r.red("× "+n.t("install.still_not_installed",{tool:a.displayName}))),new Error(`${a.displayName} is not installed`);console.log(r.green("√ "+n.t("install.verified_success",{tool:a.displayName})))}getToolConfig(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);try{return t.getConfig()}catch(t){return a.warn(`Failed to read config for ${o}:`,t),a.logError(`ToolManager.getToolConfig(${o})`,t),null}}updateToolConfig(o,t){const n=d(o);if(!n)throw new Error(`Unknown tool: ${o}`);if(!n.updateConfig)throw new Error(`Tool ${o} does not support raw config updates`);n.updateConfig(t)}forceResetConfig(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);const n=t.forceResetPaths?t.forceResetPaths():this.backupPathsFor(t),e=[];for(const o of n)h(o)&&(m(o),w(o,{force:!0}),e.push(o));return e}loadPrivateConfig(o,t,n,e,r={}){const i=d(o);if(!i)throw new Error(`Unknown tool: ${o}`);r.force&&this.forceResetConfig(o),i.loadPrivateConfig({apiKey:t,baseUrl:s.getBaseUrl(),models:n,settings:s.getToolSettings(o),...e?{catalog:e}:{},...r.takeOver?{takeOver:!0}:{}})}async applyPrivateConfig(o,t,n,e={}){const r=this.installedVersion(o);return L(`apply:${o}`,()=>this.applyPrivateConfigNow(o,t,n,e),{...r?{tool_version:r}:{},...e.force?{force:!0}:{}})}async applyPrivateConfigNow(o,t,n,e){const r=d(o);if(!r)throw new Error(`Unknown tool: ${o}`);const i=r.wantsModelCatalog?await k(t):null,{force:l,takeOver:a}=e;l||a?this.loadPrivateConfig(o,t,n,i??void 0,{force:l,takeOver:a}):i?this.loadPrivateConfig(o,t,n,i):this.loadPrivateConfig(o,t,n)}applyNotes(o){const t=d(o);if(!t)return[];const e=[];try{t.applyNotes&&e.push(...t.applyNotes())}catch(t){a.logError(`ToolManager.applyNotes(${o})`,t)}const r=this.outdatedVersion(o);if(r){e.push({kind:"action",text:n.t("tools.version_outdated",{current:r.current,min:r.min,upgrade:t.installSpec?`${R} upgrade ${o}`:t.upgradeCommand||t.installCommand})});for(const o of t.upgradeHints?.(r.min)??[])e.push({kind:"action",text:o})}const i=t.installSpec?E(t.installSpec):[];return i.length>1&&e.push({kind:"action",text:n.t("upgrade.duplicates_note",{count:String(i.length),active:_(i[0]),others:i.slice(1).map(_).join("、"),tool:o})}),e}printApplied(o,t=16){const n=SUPPORTED_TOOLS[o]?.displayName??o,e=this.applyNotes(o);for(const o of e.filter(o=>"detail"===o.kind))a.record(`${n}: ${o.text}`);const i=e.filter(o=>"summary"===o.kind).map(o=>o.text).join(";"),l=" ".repeat(Math.max(1,t-v(n)));console.log(r.green("√ "+n)+(i?l+i:""));for(const o of e.filter(o=>"action"===o.kind))console.log(r.yellow(" ! "+o.text))}installedVersion(o){const n=d(o);if(!n)return null;if(n.installSpec)return E(n.installSpec)[0]?.version??null;if(n.installedVersion)try{return n.installedVersion()}catch(t){return a.logError(`ToolManager.installedVersion(${o})`,t),null}if(n.isInstalled)return null;try{const o={encoding:"utf-8",timeout:1e4,windowsHide:!0,stdio:["ignore","pipe","pipe"]},e=`${("win32"===process.platform?t(`${n.command} --version`,{...o,shell:!0}):t(n.command,["--version"],o)).stdout??""}`.match(/(\d+)\.(\d+)\.(\d+)/);return e?e[0]:null}catch{return null}}outdatedVersion(o){const t=C(o);if(!t)return null;const n=this.installedVersion(o);return n&&T(n,t)<0?{current:n,min:t}:null}unloadPrivateConfig(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);try{t.unloadPrivateConfig({savedKeys:c()}),F(`remove:${o}`,"ok")}catch(t){throw F(`remove:${o}`,"fail",{error:t}),t}let e=[];try{e=t.unloadNotes?.()??[]}catch(t){a.logError(`ToolManager.unloadNotes(${o})`,t)}return e.length>0?e:[{kind:"action",text:n.t("config.reopen_hint",{tool:t.displayName})}]}async clearPinnedModels(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);if(s.setToolModel(o,null),!t.clearPinnedModels)return[];const n=s.getApiKeyForTool(o),e=t.wantsModelCatalog&&n?await k(n):null;return t.clearPinnedModels(e??void 0)}supportsClearPinnedModels(o){return Boolean(d(o)?.clearPinnedModels)}holdsOurConfig(o){const t=d(o);if(!t)return!1;const n=c();return t.holdsOurConfig?t.holdsOurConfig(n):Boolean(t.detectCurrentConfig().apiKey)}detectCurrentConfig(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);return t.detectCurrentConfig()}backupPathsFor(o){return o.backupPaths?o.backupPaths():[o.configPath]}listToolBackups(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);return this.backupPathsFor(t).map(o=>({file:o,backups:f(o)}))}restorePrivateConfig(o){const t=d(o);if(!t)throw new Error(`Unknown tool: ${o}`);return this.backupPathsFor(t).map(o=>({file:o,result:g(o)}))}getInstalledTools(){return Object.keys(SUPPORTED_TOOLS).filter(o=>this.isToolInstalled(o))}getSupportedTools(){return p().filter(o=>!o.hidden).map(o=>z(o.name))}isGitInstalled(){try{const t="win32"===process.platform?"where git":"which git";return o(t,{stdio:"pipe"}),!0}catch{return!1}}}export const toolManager=ToolManager.getInstance();
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { type ToolInstallSpec } from './tools/tool-installs.js';
|
|
2
2
|
/** How the last runCommand ended (for the support events and the fallback message). */
|
|
3
3
|
export type RunOutcome = 'ok' | 'fail' | 'timeout' | 'stalled';
|
|
4
|
+
/** How the last command's process ended: its exit code, the signal that ended it, or why it couldn't start. */
|
|
5
|
+
export interface CommandExit {
|
|
6
|
+
exit_code?: number | null;
|
|
7
|
+
signal?: string | null;
|
|
8
|
+
spawn_error?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The exit of the last runCommand, for the support events. */
|
|
11
|
+
export declare function lastCommandExit(): CommandExit;
|
|
4
12
|
/** Last lines of the output, ANSI colors and progress-bar redraws removed. */
|
|
5
13
|
export declare function outputTail(text: string): string;
|
|
6
14
|
/** What the last watched command printed last, cleaned up (empty when it printed nothing). */
|
|
@@ -28,6 +36,8 @@ export declare function setUpgradeRunnerForTests(fake: (command: string, args: s
|
|
|
28
36
|
* PowerShell / curl don't).
|
|
29
37
|
*/
|
|
30
38
|
export declare function mirrorInstall(spec: ToolInstallSpec): Promise<boolean>;
|
|
39
|
+
/** What else a failed install's event carries: the security software on Windows (it ends installers silently). */
|
|
40
|
+
export declare function failureContext(): Record<string, unknown>;
|
|
31
41
|
/**
|
|
32
42
|
* `vibecli upgrade <tool>`: upgrade the copy PATH runs the way it was installed
|
|
33
43
|
* (vendor updater / npm via npmmirror / Homebrew). When the vendor updater
|
package/dist/lib/tool-upgrade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as t,spawnSync as e}from"child_process";import{rmSync as o}from"fs";import{join as r}from"path";import n from"chalk";import i from"inquirer";import{i18n as s}from"./i18n.js";import{logger as a}from"../utils/logger.js";import{compareVersions as l,getToolMinVersion as c}from"./model-registry.js";import{getAdapter as p}from"./tools/registry.js";import{findInstalls as u,findInstallsIncludingNative as m,forgetInstalls as d,installLabel as g,npmMirrorInstallCommand as f,npmMirrorVersion as w,npmUninstallCommand as h}from"./tools/tool-installs.js";import{toolHome as y}from"./tools/types.js";import{isJsonMode as v,isNonInteractive as _,shouldAutoConfirm as k}from"./runtime-options.js";import{track as b}from"./telemetry.js";import{isWindowsPowerShell as
|
|
1
|
+
import{spawn as t,spawnSync as e}from"child_process";import{rmSync as o}from"fs";import{join as r}from"path";import n from"chalk";import i from"inquirer";import{i18n as s}from"./i18n.js";import{logger as a}from"../utils/logger.js";import{compareVersions as l,getToolMinVersion as c}from"./model-registry.js";import{getAdapter as p}from"./tools/registry.js";import{findInstalls as u,findInstallsIncludingNative as m,forgetInstalls as d,installLabel as g,npmMirrorInstallCommand as f,npmMirrorVersion as w,npmUninstallCommand as h}from"./tools/tool-installs.js";import{toolHome as y}from"./tools/types.js";import{isJsonMode as v,isNonInteractive as _,shouldAutoConfirm as k}from"./runtime-options.js";import{maskSecrets as x,track as b}from"./telemetry.js";import{windowsSecurityProducts as $}from"./windows-security.js";import{isWindowsPowerShell as j,powerShellEnv as T}from"./powershell-env.js";let E="ok",C={};export function lastCommandExit(){return C}let M="";const S=t=>{M=(M+t.toString("utf-8")).slice(-3e3)};export function outputTail(t){return t.replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").split(/\r?\n/).map(t=>t.split("\r").pop().trimEnd()).filter(Boolean).join("\n").slice(-1500)}export function lastCommandOutput(){return outputTail(M)}let D=async(t,o,r={})=>(console.log(n.gray("$ ")+[t,...o].join(" ")),M="",C={},E=r.idleMs?await runWatched(t,o,r):function(t,o,r){const n=P(t)?e(I(t,o),{stdio:U(),shell:!0,timeout:r}):e(t,o,{stdio:U(),timeout:r,env:O(t)});return n.error&&a.logError(`upgrade: ${t}`,n.error),C={exit_code:n.status,signal:n.signal,...n.error?{spawn_error:String(n.error.message)}:{}},"ETIMEDOUT"===n.error?.code?"timeout":0===n.status?"ok":"fail"}(t,o,r.timeoutMs),"ok"===E);const P=t=>"win32"===process.platform&&!/\.exe$/i.test(t),O=t=>j(t)?T():process.env,I=(t,e)=>[t,...e].map(t=>/\s/.test(t)?`"${t}"`:t).join(" "),U=()=>["inherit",v()?2:"inherit","inherit"];export function runWatched(e,o,r){return new Promise(n=>{const i=r.env?{...O(e),...r.env}:O(e),s=P(e)?t(I(e,o),{stdio:["inherit","pipe","pipe"],shell:!0,env:i}):t(e,o,{stdio:["inherit","pipe","pipe"],env:i});let l;const c=t=>{l=t,s.kill()};let p;const u=()=>{clearTimeout(p),r.idleMs&&(p=setTimeout(()=>c("stalled"),r.idleMs))},m=r.timeoutMs?setTimeout(()=>c("timeout"),r.timeoutMs):void 0;u(),s.stdout?.on("data",t=>{(v()?process.stderr:process.stdout).write(t),S(t),u()}),s.stderr?.on("data",t=>{process.stderr.write(t),S(t),u()});const d=t=>{clearTimeout(p),clearTimeout(m),n(t)};s.on("error",t=>{a.logError(`upgrade: ${e}`,t),C={...C,spawn_error:String(t.message)},d(l??"fail")}),s.on("close",(t,e)=>{C={...C,exit_code:t,signal:e},l&&(v()?process.stderr:process.stdout).write("\n"),d(l??(0===t?"ok":"fail"))})})}export function setUpgradeRunnerForTests(t){D=async(e,o,r)=>{const n=await t(e,o,r);return E="string"==typeof n?n:n?"ok":"fail","ok"===E}}const A={ok:"install.script_failed_npm",fail:"install.script_failed_npm",stalled:"install.script_stalled_npm",timeout:"install.script_timeout_npm"};export async function mirrorInstall(t){if(!t.mirrorScript)return B(t);console.log(n.gray(s.t("install.downloading")));const e=`install-script:${t.command}`,o=Date.now();b(e,"start");const r={idleMs:18e4,timeoutMs:36e5},i="win32"===process.platform?await D("powershell.exe",["-NoProfile","-ExecutionPolicy","Bypass","-Command",`irm ${t.mirrorScript.ps1} -TimeoutSec 30 | iex`],r):await D("sh",["-c",`script=$(curl -fsSL --connect-timeout 15 --max-time 60 ${t.mirrorScript.sh}) && printf '%s\\n' "$script" | sh`],r),a=E;return b(e,"stalled"===a?"timeout":a,{duration_ms:Date.now()-o,detail:{..."stalled"===a||"timeout"===a?{reason:a}:{},...lastCommandExit(),..."ok"===a?{output:x(lastCommandOutput())}:{},..."ok"!==a?failureContext():{}},..."ok"!==a&&lastCommandOutput()?{error:lastCommandOutput()}:{}}),i||!t.npmPackage?i:(console.log(n.yellow(" ! "+s.t(A[a],{minutes:String(3)}))),b(e,"fallback"),B(t))}export function failureContext(){const t=$();return t.length?{security:t}:{}}async function B(t){const e=f(t,await w(t)),[o,...r]=e.split(" "),i=`install-npm:${t.command}`,a=Date.now();b(i,"start");const l=await D(o,r);return b(i,l?"ok":"fail",{duration_ms:Date.now()-a,detail:{...lastCommandExit(),...l?{}:failureContext()}}),l||"win32"===process.platform||console.log(n.yellow(" ! "+s.t("upgrade.npm_permission",{command:e}))),l}async function N(t,e){switch(e.kind){case"npm":t.npmPackage&&await D("npm",["uninstall","-g",t.npmPackage]);break;case"brew":t.brew&&await D("brew",["uninstall",t.brew]);break;case"native":try{o(e.path,{force:!0});for(const e of t.native?.dataDirs??[])o(r(y(),...e),{recursive:!0,force:!0})}catch(t){a.logError("upgrade: remove native copy",t)}break;default:return!1}return d(),!u(t).some(t=>t.path===e.path)}function W(t,e){switch(e.kind){case"npm":return h(t);case"brew":return`brew uninstall ${t.brew}`;case"native":return s.t("upgrade.delete_paths",{paths:[e.path,...(t.native?.dataDirs??[]).map(t=>r(y(),...t))].join("、")});default:return s.t("upgrade.delete_paths",{paths:e.path})}}export async function upgradeTool(t){const e=Date.now();b(`upgrade:${t}`,"start");try{const o=await async function(t){const e=p(t),o=e?.installSpec;if(!e||!o)throw new Error(s.t("upgrade.unsupported",{tool:t}));const r=e.displayName;d();const f=u(o);if(console.log(n.bold(`\n${r}`)),0===f.length)console.log(s.t("upgrade.not_installed_installing",{tool:r})),await mirrorInstall(o);else{const t=f[0];console.log(n.gray(" "+s.t("upgrade.current",{copy:g(t)})));const e=await async function(t,e){switch(e.kind){case"native":return D(e.path,t.native?.updateArgs??["update"],{timeoutMs:t.native?.updateTimeoutMs});case"npm":return B(t);case"brew":return!!t.brew&&D("brew",["upgrade",t.brew]);default:return!1}}(o,t);e||"other"!==t.kind?e||"npm"===t.kind||"native"===t.kind&&await async function(t){const e=t.native?.mirrorUpdate;if(!e)return!1;console.log(n.yellow(" ! "+s.t("upgrade.native_mirror_trying")));try{const{version:t,manifestVerified:o}=await e();return console.log(n.green(" √ "+s.t(o?"upgrade.native_mirror_done_verified":"upgrade.native_mirror_done",{version:t}))),!0}catch(t){return a.logError("upgrade: native mirror",t),console.log(n.yellow(" ! "+s.t("upgrade.native_mirror_failed",{reason:t instanceof Error?t.message:String(t)}))),!1}}(o)||(console.log(n.yellow(" ! "+s.t("upgrade.fallback_mirror"))),await mirrorInstall(o)):console.log(n.yellow(" ! "+s.t("upgrade.unknown_install",{path:t.path})))}d(),await async function(t,e){const o=u(t);if(o.length<2)return;const r=function(t){return t.reduce((t,e)=>e.version&&(!t.version||l(e.version,t.version)>0)?e:t)}(o),a=o.filter(t=>t!==r);console.log(n.yellow(" ! "+s.t("upgrade.duplicates",{tool:e,keep:g(r),others:a.map(g).join("、")})));let c=k();c||_()||!process.stdin.isTTY||(c=(await i.prompt([{type:"confirm",name:"remove",message:s.t("upgrade.confirm_remove"),default:!0}])).remove);for(const e of a)c&&await N(t,e)?console.log(n.green(" √ "+s.t("upgrade.removed",{copy:g(e)}))):console.log(n.yellow(" ! "+s.t("upgrade.remove_by_hand",{how:W(t,e)})))}(o,r),d();const w=m(o)[0];if(!w)return console.log(n.red(" × "+s.t("upgrade.still_missing",{tool:r}))),!1;w.onPath||console.log(n.gray(" "+s.t("components.new_terminal")));const h=c(t);if(h&&w.version&&l(w.version,h)<0){console.log(n.yellow(" ! "+s.t("upgrade.still_old",{copy:g(w),min:h})));for(const t of e.upgradeHints?.(h)??[])console.log(n.yellow(" ! "+t));return!1}return console.log(n.green(" √ "+s.t("upgrade.done",{copy:g(w)}))),!0}(t);return b(`upgrade:${t}`,o?"ok":"fail",{duration_ms:Date.now()-e}),o}catch(o){throw b(`upgrade:${t}`,"fail",{duration_ms:Date.now()-e,error:o}),o}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{chmodSync as t,existsSync as r,readFileSync as e}from"fs";import{join as n}from"path";import{i18n as o}from"../i18n.js";import{prettyModelName as i}from"../gateway-models.js";import{getAgyRules as a}from"../model-registry.js";import{logger as l}from"../../utils/logger.js";import{readPersistentEnvFile as s,removePersistentEnv as c,writePersistentEnv as u}from"../persistent-env.js";import{backupBeforeWrite as p,atomicWriteFile as
|
|
1
|
+
import{chmodSync as t,existsSync as r,readFileSync as e}from"fs";import{join as n}from"path";import{i18n as o}from"../i18n.js";import{prettyModelName as i}from"../gateway-models.js";import{getAgyRules as a}from"../model-registry.js";import{logger as l}from"../../utils/logger.js";import{readPersistentEnvFile as s,removePersistentEnv as c,writePersistentEnv as u}from"../persistent-env.js";import{backupBeforeWrite as p,atomicWriteFile as m}from"./backup.js";import{findInstalls as d,mirrorInstallCommand as g}from"./tool-installs.js";import{toolHome as y}from"./types.js";import{brand as f,PROVIDER_KEY as h}from"../brand.js";const v="agy",A="AGY_LLM_GATEWAY_URL",_="AGY_LLM_GATEWAY_API_KEY",E="AGY_LLM_GATEWAY_MODELS",j=["GEMINI_API_KEY","GOOGLE_GEMINI_BASE_URL"],w="gemini",K=()=>n(y(),".gemini","antigravity-cli"),b=()=>n(K(),"settings.json"),I=()=>n(K(),`${h}.env`),P=()=>n(y(),".antigravity","settings.json"),M=f().installMirror?.agy,G={command:"agy",native:{binDir:"win32"===process.platform?["AppData","Local","agy","bin"]:[".local","bin"],updateArgs:["update"],dataDirs:[]},...M?{mirrorScript:{sh:`${M}/install.sh`,ps1:`${M}/install.ps1`}}:{}};function L(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function $(t,n){if(!r(t))return{};const o=e(t,"utf-8");if(!o.trim())return{};try{const t=JSON.parse(o);if(!L(t))throw new Error(`${n} root must be an object`);return t}catch(t){throw new Error(`Existing ${n} cannot be parsed; back it up and fix it first: ${t instanceof Error?t.message:String(t)}`)}}const C=()=>$(b(),"~/.gemini/antigravity-cli/settings.json"),N=()=>$(P(),"~/.antigravity/settings.json");function S(r,e,n){p(r),m(r,JSON.stringify(e,null,2)+"\n",n),void 0!==n&&t(r,n)}function Y(t){return(t||"").replace(/\/+$/,"").replace(/\/v1(beta)?$/,"")}const x=/-(minimal|low|medium|high|xhigh|max)$/;function k(t){const r=a().gatewayModels,e=t?r.filter(r=>t.models.includes(r)||t.models.includes(r.replace(x,""))):[];return e.length>0?e:r}function O(t){const r=t.replace(/-preview$/,""),e=x.exec(r)?.[1];return e?`${i(r.replace(x,""))} (${e[0].toUpperCase()}${e.slice(1)})`:i(r)}function U(t){const r=t.gateway;return L(r)&&!0===r.enabled&&"string"==typeof r.apiKey&&r.apiKey.trim()&&"string"==typeof r.url?{url:r.url,apiKey:r.apiKey}:null}function D(t){const r=t.models;return L(r)&&Array.isArray(r.list)?r.list.map(t=>L(t)&&"string"==typeof t.modelId?t.modelId:"").filter(Boolean):[]}function R(){try{if(C().modelProvider!==w)return null}catch{return null}const t=s(I()),r=t.GEMINI_API_KEY;return r&&r.trim()?{apiKey:r,url:t.GOOGLE_GEMINI_BASE_URL??""}:null}function T(t){const r=s(I());return r[A]===t.url&&r[_]===t.apiKey}function B(t,r,e){const n=C(),o=N();o.gateway={...L(o.gateway)?o.gateway:{},enabled:!0,url:r,apiKey:t,wireProtocol:"genai"},o.models={...L(o.models)?o.models:{},defaultModelId:e[0],list:e.map(t=>({modelId:t,displayName:O(t),supportsThinking:!0}))},S(P(),o,384),j.some(t=>void 0!==s(I())[t])&&c(v,I(),j);const i=u(v,I(),{[A]:r,[_]:t,[E]:e.join(",")}).rcFiles;for(const t of j)delete process.env[t];return n.modelProvider===w&&(delete n.modelProvider,S(b(),n)),i}let W=null,J=null;export const antigravityAdapter={name:"agy",displayName:"Antigravity CLI",command:"agy",installCommand:g(G),installSpec:G,configPath:P(),wantsModelCatalog:!0,loadPrivateConfig(t){C(),N();const r=k(t.catalog);W=B(t.apiKey,Y(t.baseUrl),r),J=r},unloadPrivateConfig(){try{const t=N();U(t)&&(delete t.gateway,delete t.models,S(P(),t,384))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}try{const t=C();t.modelProvider===w&&(delete t.modelProvider,S(b(),t))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}c(v,I(),[A,_,E,...j])},detectCurrentConfig(){try{const t=U(N());if(t)return{apiKey:t.apiKey}}catch{return{apiKey:null}}return{apiKey:R()?.apiKey??null}},listedModels(){try{const t=N(),r=U(t);if(r)return T(r)?D(t):[]}catch{return null}return R()?[]:null},refreshModelMenu(t){const r=N(),e=U(r)??R();if(!e)return;const n=k(t.catalog),o=e.url||Y(t.baseUrl),i=U(r);null!==i&&T(i)&&D(r).join(",")===n.join(",")&&s(I())[E]===n.join(",")&&null===R()||B(e.apiKey,o,n)},getConfig(){try{return N()}catch(t){return l.logError("antigravityAdapter.getConfig",t),null}},applyNotes(){const t=[];if(J&&J.length>0){const r=J.map(O);t.push({kind:"summary",text:o.t("tools.agy.menu_written",{count:String(r.length),list:r.join(o.t("tools.grok.list_separator")),default:r[0]})})}return null===W||0===d(G).length||t.push({kind:"action",text:o.t("tools.agy.open_new_terminal")}),t},backupPaths:()=>[P(),b(),I()],forceResetPaths:()=>[I()]};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antivirus products Windows Security Center knows about (display names), for the support event of a failed install.
|
|
3
|
+
* 11-12 a customer's PowerShell was ended mid-install with exit code 0 and no output, twice; only asking him showed
|
|
4
|
+
* 360 安全卫士. Best effort: at most 8 s, once per process, [] off Windows or when the query fails (Windows Server has
|
|
5
|
+
* no SecurityCenter2).
|
|
6
|
+
*/
|
|
7
|
+
export declare function windowsSecurityProducts(): string[];
|
|
8
|
+
/** Tests reset the cache. */
|
|
9
|
+
export declare function resetWindowsSecurityForTests(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawnSync as e}from"child_process";import{powerShellEnv as t}from"./powershell-env.js";let o;export function windowsSecurityProducts(){if("win32"!==process.platform)return[];if(o)return o;o=[];try{const r=e("powershell.exe",["-NoProfile","-NonInteractive","-Command","[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct | ForEach-Object { $_.displayName }"],{encoding:"utf-8",timeout:8e3,env:t(),windowsHide:!0});o=String(r.stdout??"").split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(0,10)}catch{}return o}export function resetWindowsSecurityForTests(){o=void 0}
|
package/dist/models.json
CHANGED
package/models.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.174",
|
|
4
4
|
"description": "CLI tool for managing AI coding assistants (Claude Code, Codex, OpenClaw, Hermes, AtomCode, Grok Build) with one unified config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|