@vibeapi/api-helper 0.0.187 → 0.0.189
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 +46 -4
- package/dist/client-config.snapshot.json +46 -4
- package/dist/lib/codex-sessions.js +1 -1
- package/dist/lib/command.d.ts +2 -0
- package/dist/lib/command.js +1 -1
- package/dist/lib/model-registry.d.ts +11 -0
- package/dist/lib/model-registry.js +1 -1
- package/dist/lib/persistent-env.d.ts +6 -0
- package/dist/lib/persistent-env.js +1 -1
- package/dist/lib/tool-auto-upgrade.d.ts +29 -0
- package/dist/lib/tool-auto-upgrade.js +1 -0
- package/dist/lib/tools/antigravity.js +1 -1
- package/dist/lib/tools/tool-installs.d.ts +8 -0
- package/dist/lib/tools/tool-installs.js +1 -1
- package/dist/models.json +15 -2
- package/models.json +15 -2
- package/package.json +1 -1
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"groups": [
|
|
16
16
|
"Claude 官方特供版"
|
|
17
17
|
],
|
|
18
|
-
"hint": "支持 Fable,完美缓存,只能在 Claude Code、IDE 官方插件和桌面端中使用",
|
|
18
|
+
"hint": "其他模型照常能用;Claude 支持 Fable,完美缓存,只能在 Claude Code、IDE 官方插件和桌面端中使用",
|
|
19
19
|
"id": "claude-special",
|
|
20
|
-
"label": "
|
|
20
|
+
"label": "Claude 用官方版"
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
},
|
|
@@ -2118,6 +2118,47 @@
|
|
|
2118
2118
|
"name": "Gemini 4 Carbon",
|
|
2119
2119
|
"recommended": false
|
|
2120
2120
|
},
|
|
2121
|
+
{
|
|
2122
|
+
"capabilities": {
|
|
2123
|
+
"contextWindowTokens": 1048576,
|
|
2124
|
+
"functionCall": true,
|
|
2125
|
+
"imageOutput": false,
|
|
2126
|
+
"inputModalities": [
|
|
2127
|
+
"text",
|
|
2128
|
+
"image",
|
|
2129
|
+
"video",
|
|
2130
|
+
"audio"
|
|
2131
|
+
],
|
|
2132
|
+
"knowledgeCutoff": "2026-03-31",
|
|
2133
|
+
"maxOutput": 65536,
|
|
2134
|
+
"outputModalities": [
|
|
2135
|
+
"text"
|
|
2136
|
+
],
|
|
2137
|
+
"reasoning": true,
|
|
2138
|
+
"reasoningEfforts": [
|
|
2139
|
+
"low",
|
|
2140
|
+
"medium",
|
|
2141
|
+
"high",
|
|
2142
|
+
"xhigh"
|
|
2143
|
+
],
|
|
2144
|
+
"structuredOutput": true,
|
|
2145
|
+
"video": true,
|
|
2146
|
+
"vision": true
|
|
2147
|
+
},
|
|
2148
|
+
"context_window": 1048576,
|
|
2149
|
+
"description": "100 万上下文 | 复杂编码 | Agent 任务",
|
|
2150
|
+
"endpoint_types": [
|
|
2151
|
+
"gemini",
|
|
2152
|
+
"openai"
|
|
2153
|
+
],
|
|
2154
|
+
"group": "",
|
|
2155
|
+
"group_name": "",
|
|
2156
|
+
"hidden": false,
|
|
2157
|
+
"id": "gemini-4-neon",
|
|
2158
|
+
"max_output_tokens": 65536,
|
|
2159
|
+
"name": "Gemini 4 Neon",
|
|
2160
|
+
"recommended": false
|
|
2161
|
+
},
|
|
2121
2162
|
{
|
|
2122
2163
|
"capabilities": {
|
|
2123
2164
|
"contextWindowTokens": 1048576,
|
|
@@ -2400,7 +2441,7 @@
|
|
|
2400
2441
|
"tool": "gemini"
|
|
2401
2442
|
}
|
|
2402
2443
|
],
|
|
2403
|
-
"revision": "2026-11-
|
|
2444
|
+
"revision": "2026-11-22T14:14:16Z-12",
|
|
2404
2445
|
"schema": 1,
|
|
2405
2446
|
"tools": {
|
|
2406
2447
|
"claude": {
|
|
@@ -2422,6 +2463,7 @@
|
|
|
2422
2463
|
"gemini-4-argon",
|
|
2423
2464
|
"gemini-4-carbon-medium",
|
|
2424
2465
|
"gemini-4-hydrogen",
|
|
2466
|
+
"gemini-4-neon",
|
|
2425
2467
|
"gemini-3.8-flash",
|
|
2426
2468
|
"gemini-3.7-flash",
|
|
2427
2469
|
"gemini-3.6-flash",
|
|
@@ -2500,7 +2542,7 @@
|
|
|
2500
2542
|
},
|
|
2501
2543
|
"tool_min_versions": {
|
|
2502
2544
|
"agy": "1.3.5",
|
|
2503
|
-
"claude-code": "2.1.
|
|
2545
|
+
"claude-code": "2.1.321",
|
|
2504
2546
|
"claude-desktop": "2.2553.0",
|
|
2505
2547
|
"codex": "0.122.0"
|
|
2506
2548
|
}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"groups": [
|
|
16
16
|
"Claude 官方特供版"
|
|
17
17
|
],
|
|
18
|
-
"hint": "支持 Fable,完美缓存,只能在 Claude Code、IDE 官方插件和桌面端中使用",
|
|
18
|
+
"hint": "其他模型照常能用;Claude 支持 Fable,完美缓存,只能在 Claude Code、IDE 官方插件和桌面端中使用",
|
|
19
19
|
"id": "claude-special",
|
|
20
|
-
"label": "
|
|
20
|
+
"label": "Claude 用官方版"
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
},
|
|
@@ -2118,6 +2118,47 @@
|
|
|
2118
2118
|
"name": "Gemini 4 Carbon",
|
|
2119
2119
|
"recommended": false
|
|
2120
2120
|
},
|
|
2121
|
+
{
|
|
2122
|
+
"capabilities": {
|
|
2123
|
+
"contextWindowTokens": 1048576,
|
|
2124
|
+
"functionCall": true,
|
|
2125
|
+
"imageOutput": false,
|
|
2126
|
+
"inputModalities": [
|
|
2127
|
+
"text",
|
|
2128
|
+
"image",
|
|
2129
|
+
"video",
|
|
2130
|
+
"audio"
|
|
2131
|
+
],
|
|
2132
|
+
"knowledgeCutoff": "2026-03-31",
|
|
2133
|
+
"maxOutput": 65536,
|
|
2134
|
+
"outputModalities": [
|
|
2135
|
+
"text"
|
|
2136
|
+
],
|
|
2137
|
+
"reasoning": true,
|
|
2138
|
+
"reasoningEfforts": [
|
|
2139
|
+
"low",
|
|
2140
|
+
"medium",
|
|
2141
|
+
"high",
|
|
2142
|
+
"xhigh"
|
|
2143
|
+
],
|
|
2144
|
+
"structuredOutput": true,
|
|
2145
|
+
"video": true,
|
|
2146
|
+
"vision": true
|
|
2147
|
+
},
|
|
2148
|
+
"context_window": 1048576,
|
|
2149
|
+
"description": "100 万上下文 | 复杂编码 | Agent 任务",
|
|
2150
|
+
"endpoint_types": [
|
|
2151
|
+
"gemini",
|
|
2152
|
+
"openai"
|
|
2153
|
+
],
|
|
2154
|
+
"group": "",
|
|
2155
|
+
"group_name": "",
|
|
2156
|
+
"hidden": false,
|
|
2157
|
+
"id": "gemini-4-neon",
|
|
2158
|
+
"max_output_tokens": 65536,
|
|
2159
|
+
"name": "Gemini 4 Neon",
|
|
2160
|
+
"recommended": false
|
|
2161
|
+
},
|
|
2121
2162
|
{
|
|
2122
2163
|
"capabilities": {
|
|
2123
2164
|
"contextWindowTokens": 1048576,
|
|
@@ -2400,7 +2441,7 @@
|
|
|
2400
2441
|
"tool": "gemini"
|
|
2401
2442
|
}
|
|
2402
2443
|
],
|
|
2403
|
-
"revision": "2026-11-
|
|
2444
|
+
"revision": "2026-11-22T14:14:16Z-12",
|
|
2404
2445
|
"schema": 1,
|
|
2405
2446
|
"tools": {
|
|
2406
2447
|
"claude": {
|
|
@@ -2422,6 +2463,7 @@
|
|
|
2422
2463
|
"gemini-4-argon",
|
|
2423
2464
|
"gemini-4-carbon-medium",
|
|
2424
2465
|
"gemini-4-hydrogen",
|
|
2466
|
+
"gemini-4-neon",
|
|
2425
2467
|
"gemini-3.8-flash",
|
|
2426
2468
|
"gemini-3.7-flash",
|
|
2427
2469
|
"gemini-3.6-flash",
|
|
@@ -2500,7 +2542,7 @@
|
|
|
2500
2542
|
},
|
|
2501
2543
|
"tool_min_versions": {
|
|
2502
2544
|
"agy": "1.3.5",
|
|
2503
|
-
"claude-code": "2.1.
|
|
2545
|
+
"claude-code": "2.1.321",
|
|
2504
2546
|
"claude-desktop": "2.2553.0",
|
|
2505
2547
|
"codex": "0.122.0"
|
|
2506
2548
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawnSync as t}from"child_process";import{closeSync as e,copyFileSync as
|
|
1
|
+
import{spawnSync as t}from"child_process";import{closeSync as e,copyFileSync as r,createReadStream as o,createWriteStream as n,existsSync as s,mkdirSync as i,openSync as c,readFileSync as a,readSync as f,readdirSync as l,realpathSync as p,renameSync as u,statSync as d,utimesSync as m}from"fs";import{basename as h,join as g,resolve as b}from"path";import{pipeline as y}from"stream/promises";import*as E from"@iarna/toml";import{codexHome as S,toolHome as v}from"./tools/types.js";import{atomicWriteFile as x}from"./tools/backup.js";import{CLI_NAME as _}from"./brand.js";import{powerShellEnv as w}from"./powershell-env.js";export{S as codexHome};export function currentCodexProvider(){try{const t=E.parse(a(g(S(),"config.toml"),"utf-8"));return"string"==typeof t.model_provider&&t.model_provider.trim()?t.model_provider.trim():"openai"}catch{return"openai"}}let O=()=>{if("win32"===process.platform)return`${t("powershell.exe",["-NoProfile","-NonInteractive","-Command","(Get-Process -Name codex -ErrorAction SilentlyContinue).Id"],{encoding:"utf-8",windowsHide:!0,env:w()}).stdout??""}`.split(/\s+/).filter(Boolean).map(Number);const e=process.getuid?.(),r=`${t("pgrep",["-x","-i",...void 0===e?[]:["-u",String(e)],"codex"],{encoding:"utf-8"}).stdout??""}`.split(/\s+/).filter(Boolean).map(Number);if("linux"!==process.platform)return r;const o=N(S());return r.filter(t=>{let e;try{e=a(`/proc/${t}/environ`,"utf-8")}catch{return!0}const r=new Map(e.split("\0").map(t=>[t.slice(0,t.indexOf("=")),t.slice(t.indexOf("=")+1)])),n=r.get("CODEX_HOME")?.trim()||(r.get("HOME")?g(r.get("HOME"),".codex"):null);return null===n||N(n)===o})};function N(t){try{return p(t)}catch{return t}}export function setCodexProcessCheckForTests(t){O=t}export function runningCodexPids(){try{return O()}catch{return[]}}function $(t){const r=c(t,"r");try{const t=[],e=Buffer.alloc(65536);for(;;){const o=f(r,e,0,e.length,null);if(o<=0)break;const n=e.subarray(0,o).indexOf(10);if(n>=0){t.push(Buffer.from(e.subarray(0,n)));break}t.push(Buffer.from(e.subarray(0,o)))}return Buffer.concat(t).toString("utf-8")}finally{e(r)}}async function M(t,e,r){const{atime:s,mtime:i}=d(t),c=`${t}.${_}-tmp`,a=n(c);a.write(e),await y(o(t,{start:r}),a),u(c,t),m(t,s,i)}export function codexSqliteHome(){const t=S();try{const e=E.parse(a(g(t,"config.toml"),"utf-8")),r="string"==typeof e.sqlite_home?e.sqlite_home.trim():"";if(r)return"~"===r||r.startsWith("~/")?g(v(),r.slice(1)):b(t,r)}catch{}const e=process.env.CODEX_SQLITE_HOME?.trim();return e?b(e):t}function D(){const t=codexSqliteHome();if(!s(t))return null;const e=l(t).map(t=>/^state_(\d+)\.sqlite$/.exec(t)).filter(t=>!!t).sort((t,e)=>Number(e[1])-Number(t[1]));return e.length>0?g(t,e[0][0]):null}const T={threads:"id",local_thread_catalog:"thread_id"};function A(){const t=g(codexSqliteHome(),"sqlite");return s(t)?l(t).filter(t=>/\.(db|sqlite3?)$/.test(t)).map(e=>g(t,e)).sort():[]}function q(t,e,r){const o=function(t,e){return new Set(t.prepare(`PRAGMA table_info(${e})`).all().map(t=>String(t.name)))}(t,e),n=T[e];if(!o.has(n)||!o.has("model_provider"))return null;const s=o.has("host_id")?" AND host_id = 'local'":"";return t.prepare(`SELECT ${n} AS id, model_provider AS "from" FROM ${e} WHERE COALESCE(model_provider, '') NOT IN ('', ?)${s}`).all(r).map(t=>({id:String(t.id),from:String(t.from)}))}export class SessionMoveError extends Error{backupDir;constructor(t,e){super(t instanceof Error?t.message:String(t)),this.name="SessionMoveError",this.backupDir=e}}function B(t){try{t.exec("ROLLBACK")}catch{}}async function C(t){try{return function(){const t=process.emitWarning.bind(process);if(process.emitWarning.quietSqlite)return;const e=(e,...r)=>{const o=e instanceof Error?e.message:String(e);"ExperimentalWarning"===(e instanceof Error?e.name:"string"==typeof r[0]?r[0]:r[0]?.type)&&/SQLite/i.test(o)||t(e,...r)};e.quietSqlite=!0,process.emitWarning=e}(),new((await import("node:sqlite")).DatabaseSync)(t)}catch(t){return`node:sqlite unavailable (Node ${process.versions.node}; needs 22.13+): ${t instanceof Error?t.message:String(t)}`}}export const NO_STATE_DB="no state DB";export async function moveSessionsToProvider(t,e={}){const o=function(){const t=[],e=r=>{if(s(r))for(const o of l(r,{withFileTypes:!0})){const n=g(r,o.name);o.isDirectory()?e(n):o.isFile()&&o.name.endsWith(".jsonl")&&t.push(n)}};return e(g(S(),"sessions")),e(g(S(),"archived_sessions")),t}(),n=[];for(const e of o){let r,o;try{r=$(e)}catch{continue}try{o=JSON.parse(r)}catch{continue}const s=o.payload?.model_provider;"session_meta"===o.type&&"string"==typeof s&&s!==t&&(o.payload.model_provider=t,n.push({file:e,from:s,line:JSON.stringify(o),length:Buffer.byteLength(r,"utf-8")}))}const c=[D(),...A()].filter(t=>!!t);let a=c.length>0?null:NO_STATE_DB;const f=[];for(const e of c){const r=await C(e);if("string"==typeof r){a=r;break}const o=[];try{for(const n of Object.keys(T)){const s=q(r,n,t);s&&s.length>0&&o.push({db:e,table:n,rows:s})}}catch{}f.push({path:e,db:r,tables:o})}const p=f.flatMap(t=>t.tables),u=new Set(p.flatMap(t=>t.rows.map(t=>t.id))),d={target:t,scanned:o.length,moved:n.map(({file:t,from:e})=>({file:t,from:e})),dbRows:u.size,dbSkipped:a,backupDir:null},m=()=>f.forEach(t=>t.db.close());if(e.dryRun||0===n.length&&0===p.length)return m(),d;const b=g(S(),"backups",`${_}-sessions-${(new Date).toISOString().replace(/[:.]/g,"-")}`);i(b,{recursive:!0}),f.forEach(({path:t,tables:e},o)=>{if(0!==e.length)for(const e of["","-wal","-shm"])s(t+e)&&r(t+e,g(b,`${o}-${h(t)}${e}`))});const y={target:t,moved:d.moved,tables:p};x(g(b,"manifest.json"),JSON.stringify(y,null,2)+"\n");const E=f.filter(t=>t.tables.length>0),v=[];try{for(const{db:t}of E)t.exec("BEGIN IMMEDIATE"),v.push(t);for(const t of n)await M(t.file,t.line,t.length);for(const{db:e,tables:r}of E)for(const{table:o,rows:n}of r){const r=e.prepare(`UPDATE ${o} SET model_provider = ? WHERE ${T[o]} = ? AND model_provider = ?`);for(const{id:e,from:o}of n)r.run(t,e,o)}for(;v.length>0;)v.shift().exec("COMMIT")}catch(t){throw v.forEach(B),m(),new SessionMoveError(t,b)}return m(),d.backupDir=b,d}export async function undoSessionMove(t){const e=JSON.parse(a(g(t,"manifest.json"),"utf-8"));let r=0;for(const{file:t,from:o}of e.moved){if(!s(t))continue;const e=$(t),n=JSON.parse(e);n.payload&&(n.payload.model_provider=o,await M(t,JSON.stringify(n),Buffer.byteLength(e,"utf-8")),r+=1)}const o=e.tables??(e.db&&e.threads?[{db:e.db,table:"threads",rows:e.threads}]:[]),n=new Set;for(const{db:t,table:r,rows:i}of o){if(!s(t)||0===i.length||!T[r])continue;const o=await C(t);if("string"==typeof o)continue;const c=[];try{o.exec("BEGIN IMMEDIATE");const t=o.prepare(`UPDATE ${r} SET model_provider = ? WHERE ${T[r]} = ? AND model_provider = ?`);for(const{id:r,from:o}of i)Number(t.run(o,r,e.target).changes)>0&&c.push(r);o.exec("COMMIT")}catch(t){throw B(o),o.close(),t}o.close(),c.forEach(t=>n.add(t))}return{files:r,dbRows:n.size}}
|
package/dist/lib/command.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare class Command {
|
|
|
13
13
|
*/
|
|
14
14
|
private preflightArgs;
|
|
15
15
|
execute(args: string[]): Promise<void>;
|
|
16
|
+
/** The detached process `startToolAutoUpgrade` starts: nobody watches its output and nothing may prompt. */
|
|
17
|
+
private runAutoUpgradeWorker;
|
|
16
18
|
/** `--dry-run` on a command that would write anyway: refuse before anything runs. */
|
|
17
19
|
private rejectUnsupportedDryRun;
|
|
18
20
|
private rejectUnknownCommand;
|
package/dist/lib/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i18n as
|
|
1
|
+
import{i18n as r,detectSystemLang as o}from"./i18n.js";import{configManager as n}from"./config.js";import{runModelRefresh as t}from"./model-refresh.js";import{AUTO_UPGRADE_WORKER_ARG as e,runToolAutoUpgradeRound as i,startToolAutoUpgrade as s}from"./tool-auto-upgrade.js";import{refreshClientConfig as a}from"./client-config-sync.js";import{normalizeBaseUrl as m}from"./gateway-addresses.js";import c from"chalk";import{setRuntimeOptions as l,detectColorPreferenceFromEnv as d,isDryRun as u}from"./runtime-options.js";import{runStartupUpdate as p}from"./auto-update.js";import{buildProgram as g}from"./program.js";import{firstCommandWord as f,isHelpRequest as h,renderHelpTopic as y}from"./cli-help.js";import{reportCliError as w,usageError as _,CliError as j,EXIT_CODES as k}from"./errors.js";import{brandEnv as v,CLI_NAME as C}from"./brand.js";import{dryRunUnsupportedCommand as x}from"./dry-run.js";import{flushTelemetry as A,installClientHeaders as O,lastFailureReason as b,maskSecrets as U,setTelemetryCommand as D,track as M,watchConsoleErrors as E}from"./telemetry.js";export{buildProgram}from"./program.js";const R=new Set(["setup","init","auth","enter","config"]);export class Command{program;configuring=!1;constructor(){const t=n.isLangChosen()?n.getLang():o();r.loadFromConfig(t),this.program=g()}preflightArgs(r){const o=o=>r.includes(o),t=!o("--no-color")&&d();if(l({nonInteractive:o("--non-interactive"),json:o("--json"),yes:o("--yes")||o("-y"),dryRun:o("--dry-run"),color:t}),t||(c.level=0),this.configuring=!1,h(r))return;let e;for(let o=0;o<r.length;o+=1){const n=r[o];"--base"===n&&r[o+1]?(e=r[o+1],o+=1):n.startsWith("--base=")&&(e=n.slice(7))}const i=f(r),s=void 0===i&&!["--version","-v"].some(o);this.configuring=s||void 0!==i&&R.has(i),e&&n.setBaseUrl(m(e)??e,this.configuring&&!o("--dry-run"))}async execute(r){const o=Date.now();let n=!1;if(r[0]!==e)try{if(this.preflightArgs(r),O(),!h(r)&&!["--version","-v"].some(o=>r.includes(o))){D(f(r)??"wizard");const o=v("INSTALLER_NOTE")?.trim();M("command","start",{detail:{args:r.filter(r=>r.startsWith("-")&&!/key/i.test(r)),...o?{installer:U(o).slice(0,400)}:{}}}),n=!0,E()}if("help"===r[0]&&r[1]){const o=y(r[1]);if(o)return void process.stdout.write(o)}if(this.rejectUnknownCommand(r),!h(r)){if(u()&&this.rejectUnsupportedDryRun(r),(await p(r)).handled)return;this.configuring&&await a({timeoutMs:5e3}),await t(r),s(r)}if(await this.program.parseAsync(r,{from:"user"}),n){const r=Boolean(process.exitCode)&&0!==process.exitCode,n=Number(process.exitCode)===k.cancelled;M("command",n?"cancel":r?"fail":"ok",{duration_ms:Date.now()-o,...r?{error:b(),detail:{exit_code:process.exitCode}}:{}})}}catch(t){if("commander.helpDisplayed"===t?.code||"commander.version"===t?.code)return;const e=this.normalizeCommanderError(t,r),i=w(e);if(n){const r=e instanceof j?`${e.type}${e.subtype?"/"+e.subtype:""}`:void 0;M("command",130===i?"cancel":"fail",{duration_ms:Date.now()-o,error:e,detail:{exit_code:i,...r?{type:r}:{}}})}}finally{n&&await A()}else await this.runAutoUpgradeWorker()}async runAutoUpgradeWorker(){l({nonInteractive:!0,json:!1,yes:!1,dryRun:!1,color:!1}),c.level=0,O(),D("auto-upgrade");try{await i()}catch(r){M("auto-upgrade","fail",{error:r})}finally{await A()}}rejectUnsupportedDryRun(o){const n=x(o);if(null!==n)throw _(r.t("runtime.dry_run_unsupported",{command:n,cli:C}),r.t("runtime.dry_run_unsupported_hint",{cli:C}),"dry_run_unsupported")}rejectUnknownCommand(o){const n=f(o);if(!n||"help"===n)return;if(this.program.commands.some(r=>r.name()===n))return;const t=this.suggestCommand(n),e=t?r.t("cli.unknown_hint_suggestion",{command:t}):r.t("cli.unknown_hint");throw _(r.t("cli.error_unknown",{command:n}),e,"unknown_command")}suggestCommand(r){const o=(r,o)=>{const n=Array.from({length:o.length+1},(r,o)=>o);for(let t=1;t<=r.length;t+=1){let e=n[0];n[0]=t;for(let i=1;i<=o.length;i+=1){const s=n[i];n[i]=Math.min(n[i]+1,n[i-1]+1,e+(r[t-1]===o[i-1]?0:1)),e=s}}return n[o.length]};return this.program.commands.map(r=>r.name()).map(n=>({name:n,score:o(r,n)})).filter(({score:o})=>o<=Math.max(2,Math.floor(r.length/2))).sort((r,o)=>r.score-o.score)[0]?.name}normalizeCommanderError(o,n){if(o instanceof j)return o;const t=o?.code,e=o instanceof Error?o.message:String(o);if("commander.unknownOption"===t||"commander.missingArgument"===t||"commander.missingMandatoryOption"===t||"commander.invalidArgument"===t){const o=f(n),i=/'([^']+)'/.exec(e)?.[1]??"",s="commander.unknownOption"===t?"cli.err_unknown_option":"commander.missingArgument"===t?"cli.err_missing_argument":"commander.missingMandatoryOption"===t?"cli.err_missing_option":null,a="commander.unknownOption"===t?this.gluedOption(i):void 0,m=U(i),c=a?r.t("cli.err_glued_option",{name:m,option:a}):s&&i?r.t(s,{name:m}):U(e.replace(/^error:\s*/,""));return _(c,o?r.t("cli.unknown_option_hint",{command:o}):r.t("cli.unknown_option_hint_root"),t)}return o}gluedOption(r){const o=new Set,n=r=>{for(const n of r.options)n.long&&o.add(n.long);for(const o of r.commands)n(o)};return n(this.program),[...o].filter(o=>r.length>o.length&&r.startsWith(o)).sort((r,o)=>o.length-r.length)[0]}getProgram(){return this.program}}
|
|
@@ -97,6 +97,16 @@ export interface ModelRegistryData {
|
|
|
97
97
|
agy?: Partial<AgyRules>;
|
|
98
98
|
/** Oldest tool release vibecli's written config works with (tool id → semver). */
|
|
99
99
|
toolMinVersions?: Record<string, string>;
|
|
100
|
+
/** Installed command-line tools vibecli keeps up to date in the background (see tool-auto-upgrade.ts). */
|
|
101
|
+
autoUpgrade?: Partial<AutoUpgradeRules>;
|
|
102
|
+
}
|
|
103
|
+
export interface AutoUpgradeRules {
|
|
104
|
+
/** Tool ids; empty stops background upgrades (ships with the next release, which customers get at their next command). */
|
|
105
|
+
tools: string[];
|
|
106
|
+
/** At most one background round per this many hours. */
|
|
107
|
+
intervalHours: number;
|
|
108
|
+
/** A release this fresh is left for a later round: same-day fixes often replace a bad build. */
|
|
109
|
+
minAgeHours: number;
|
|
100
110
|
}
|
|
101
111
|
/** One address the gateway answers on (another domain or route to the same site). */
|
|
102
112
|
export interface GatewayAddress {
|
|
@@ -134,4 +144,5 @@ export declare function getAgyRules(): AgyRules;
|
|
|
134
144
|
/** Compare dotted numeric versions (`2.1.9` < `2.1.10`); missing parts count as 0. */
|
|
135
145
|
export declare function compareVersions(a: string, b: string): number;
|
|
136
146
|
export declare function getToolMinVersion(toolName: string): string | null;
|
|
147
|
+
export declare function getAutoUpgradeRules(): AutoUpgradeRules;
|
|
137
148
|
export declare function reloadRegistry(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,join as o}from"path";import{fileURLToPath as t}from"url";import{existsSync as
|
|
1
|
+
import{dirname as e,join as o}from"path";import{fileURLToPath as t}from"url";import{existsSync as r,readFileSync as n}from"fs";import{currentClientConfig as l,usableClientSection as s}from"./client-config.js";import{brand as a}from"./brand.js";const i=e(t(import.meta.url)),u=(e=[],o=[])=>[...new Set([...e,...o])];export function overlayClientSection(e,o){if(!o)return e;const t={...e.retiredDefaultModels??{}};for(const[e,r]of Object.entries(o.retiredDefaultModels??{}))t[e]=u(t[e],r);return{...e,defaultModels:{...e.defaultModels,...o.defaultModels??{}},retiredDefaultModels:t,toolDefaults:{...e.toolDefaults??{},...o.toolDefaults??{}},claudeCode:o.tierChains?{...e.claudeCode??{},tierChains:{...e.claudeCode?.tierChains??{},...o.tierChains}}:e.claudeCode,claudeDesktop:o.oneMillionFallback?{...e.claudeDesktop??{},oneMillionFallback:[...o.oneMillionFallback]}:e.claudeDesktop,gatewayModels:o.retiredModels?{...e.gatewayModels??{},retired:u(e.gatewayModels?.retired,o.retiredModels)}:e.gatewayModels,toolMinVersions:{...e.toolMinVersions??{},...o.toolMinVersions??{}},agy:o.agyModels?{...e.agy??{},gatewayModels:[...o.agyModels]}:e.agy}}let d=null;function c(){return d||(d=overlayClientSection(function(){const e=[o(i,"..","..","models.json"),o(i,"..","models.json"),o(i,"models.json")];for(const o of e)if(r(o))return JSON.parse(n(o,"utf-8"));throw new Error(`models.json not found, searched: ${e.join(", ")}`)}(),s(l()?.config))),d}export function getDefaultModels(){return{...c().defaultModels}}export function isRetiredDefaultModel(e,o){return c().retiredDefaultModels?.[e]?.includes(o)??!1}export function getRetiredDefaultModelIds(){return[...new Set(Object.values(c().retiredDefaultModels??{}).flat())]}export function getDefaultToolModel(){return c().defaultToolModel?.trim()||"gpt-5.5"}export function getToolDefaultModel(e){const o=c().toolDefaults;return o&&Object.prototype.hasOwnProperty.call(o,e)?(o[e]??"").trim():getDefaultToolModel()}export function getToolMenuModels(e){return[...c().toolMenuModels?.[e]??[]]}export function getPresets(){return[...c().presets]}export function resolvePreset(e){return e.models?{...e.models}:e.model?{haiku:e.model,sonnet:e.model,opus:e.model,reasoning:e.model}:getDefaultModels()}export function getClaudeCodeTierChains(){const e=c().claudeCode?.tierChains??{};return Object.fromEntries(Object.entries(e).map(([e,o])=>[e,[...o]]))}export function getClaudeDesktopRules(){const e=c().claudeDesktop??{};return{oneMillionFallback:[...e.oneMillionFallback??[]],oneMillionExclusions:(e.oneMillionExclusions??[]).map(e=>({...e,models:[...e.models]}))}}export function getGatewayModelRules(){const e=c().gatewayModels??{};return{autoCompactRatio:e.autoCompactRatio??.8,models:(e.models??[]).map(e=>({...e})),retired:[...e.retired??[]]}}export function getBuiltinGatewayAddresses(){return a().gatewayAddresses.map(e=>({...e}))}export function getCodexRules(){return{standardContextWindow:c().codex?.standardContextWindow??272e3}}export function getAgyRules(){return{gatewayModels:[...c().agy?.gatewayModels??[]]}}export function compareVersions(e,o){const t=e.split(".").map(e=>parseInt(e,10)||0),r=o.split(".").map(e=>parseInt(e,10)||0);for(let e=0;e<Math.max(t.length,r.length);e++){const o=(t[e]??0)-(r[e]??0);if(0!==o)return o}return 0}export function getToolMinVersion(e){return c().toolMinVersions?.[e]?.trim()||null}export function getAutoUpgradeRules(){const e=c().autoUpgrade??{};return{tools:Array.isArray(e.tools)?e.tools.filter(e=>"string"==typeof e):[],intervalHours:"number"==typeof e.intervalHours&&e.intervalHours>0?e.intervalHours:24,minAgeHours:"number"==typeof e.minAgeHours&&e.minAgeHours>=0?e.minAgeHours:6}}export function reloadRegistry(){d=null}
|
|
@@ -14,4 +14,10 @@ export declare function writePersistentEnv(id: string, envFile: string, vars: Re
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function removePersistentEnv(id: string, envFile: string, names: readonly string[]): void;
|
|
16
16
|
/** 读回 env 文件里的变量;文件不存在或没有内容时为空对象。 */
|
|
17
|
+
/**
|
|
18
|
+
* env 文件里的值是不是都已生效:Unix 由 rc 行加载文件,文件即生效;Windows 工具读的是用户环境变量,
|
|
19
|
+
* 要逐个核对注册表里的值与文件一致。只比文件判断「已是最新」会让一次没写进注册表的旧值一直留着
|
|
20
|
+
* (11-21 客户 Windows 机器:文件已有 gemini-4-neon,用户环境变量还是旧菜单,refresh 一直报已是最新)。
|
|
21
|
+
*/
|
|
22
|
+
export declare function persistentEnvApplied(envFile: string): boolean;
|
|
17
23
|
export declare function readPersistentEnvFile(envFile: string): Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{chmodSync as t,existsSync as n,readFileSync as
|
|
1
|
+
import{chmodSync as t,existsSync as n,readFileSync as e,realpathSync as o,unlinkSync as r}from"fs";import{join as s}from"path";import{logger as i}from"../utils/logger.js";import{getShellRcFilePath as c}from"./env-cleanup.js";import{broadcastEnvChange as f,deleteWindowsEnv as p,readWindowsEnv as u,setUserEnv as l}from"./windows-env.js";import{atomicWriteFile as m,backupBeforeWrite as a}from"./tools/backup.js";import{toolHome as $}from"./tools/types.js";import{CLI_NAME as d}from"./brand.js";const h=t=>`# ${d}:${t}`;function v(){const t=$(),e=new Set,o=c();o&&e.add(o);for(const o of[".zshrc",".bashrc"]){const r=s(t,o);n(r)&&e.add(r)}return[...e]}function j(t,n,e){const o=`"${function(t){const n=$();return t.startsWith(n+"/")?`$HOME/${t.slice(n.length+1)}`:t}(n)}"`;return t.endsWith(".fish")?`test -f ${o}; and source ${o} ${h(e)}`:`[ -f ${o} ] && . ${o} ${h(e)}`}function E(t,e){const r=n(t)?o(t):t;a(r),m(r,e)}function w(t,n){return t.split("\n").filter(t=>!t.trimEnd().endsWith(h(n))).join("\n")}function b(t,n){if(/['\r\n]/.test(n))throw new Error(`${t} contains a quote or newline and cannot be written to a shell env file`)}export function writePersistentEnv(o,r,s){for(const[t,n]of Object.entries(s))b(t,n);const i=Object.entries(s).map(([t,n])=>`export ${t}='${n}'`).join("\n");a(r),m(r,`# Written by ${d}. Loaded from your shell profile.\n${i}\n`,384),t(r,384);for(const[t,n]of Object.entries(s))process.env[t]=n;if("win32"===process.platform){for(const[t,n]of Object.entries(s))l(t,n);return f(),{rcFiles:[]}}const c=[];for(const t of v()){const s=n(t)?e(t,"utf-8"):"",i=j(t,r,o);if(s.split("\n").some(t=>t.trimEnd()===i)){c.push(t);continue}const f=w(s,o).replace(/\n*$/,"");E(t,`${f?f+"\n\n":""}${i}\n`),c.push(t)}return{rcFiles:c}}export function removePersistentEnv(t,o,s){const c=readPersistentEnvFile(o);let l=!1;if("win32"===process.platform){let t=!1;for(const n of s)if(void 0!==c[n]&&u("user",n)===c[n])try{p("user",n),t=!0}catch(t){l=!0,i.logError("persistentEnv.remove",t)}t&&f()}else for(const o of v()){if(!n(o))continue;const r=e(o,"utf-8"),s=w(r,t);s!==r&&E(o,s)}!l&&n(o)&&(a(o),r(o))}export function persistentEnvApplied(t){return"win32"!==process.platform||Object.entries(readPersistentEnvFile(t)).every(([t,n])=>u("user",t)===n)}export function readPersistentEnvFile(t){const o={};if(!n(t))return o;for(const n of e(t,"utf-8").split("\n")){const t=n.match(/^export ([A-Z_][A-Z0-9_]*)='([^']*)'$/);t&&(o[t[1]]=t[2])}return o}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ToolInstall, type ToolInstallSpec } from './tools/tool-installs.js';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps the installed command-line tools (models.json → autoUpgrade.tools) up to date without the
|
|
4
|
+
* customer running `vibecli upgrade` (用户 2026-11-22 定). A command starts a detached worker at
|
|
5
|
+
* most once a day; the worker upgrades each installed tool that is behind the mirror's latest
|
|
6
|
+
* release through `upgradeTool` (vendor updater, then our mirror). The command itself never waits.
|
|
7
|
+
* Not installed tools stay uninstalled; desktop apps keep their own rules (app-update.ts).
|
|
8
|
+
* A release younger than `minAgeHours` waits for a later round; on Windows a tool whose program
|
|
9
|
+
* is running waits too (its .exe is locked and replacing it would break the open session).
|
|
10
|
+
*/
|
|
11
|
+
/** First argument of the worker process. */
|
|
12
|
+
export declare const AUTO_UPGRADE_WORKER_ARG = "__tool-auto-upgrade";
|
|
13
|
+
export type AutoUpgradeOutcome = 'upgraded' | 'failed' | 'current' | 'not_installed' | 'too_new' | 'running' | 'offline' | 'unknown_version';
|
|
14
|
+
export declare function shouldSkipToolAutoUpgrade(args: string[], env?: NodeJS.ProcessEnv): boolean;
|
|
15
|
+
export declare function setAutoUpgradeSpawnerForTests(fn: ((env: NodeJS.ProcessEnv) => void) | null): void;
|
|
16
|
+
/** Startup hook: starts the background worker when a round is due. Never fails or delays the command. */
|
|
17
|
+
export declare function startToolAutoUpgrade(args: string[], options?: {
|
|
18
|
+
env?: NodeJS.ProcessEnv;
|
|
19
|
+
now?: number;
|
|
20
|
+
}): boolean;
|
|
21
|
+
export declare function setRunningCheckForTests(fn: ((spec: ToolInstallSpec, installs: ToolInstall[]) => boolean) | null): void;
|
|
22
|
+
/** One round over the configured tools; returns what happened to each and when the next round is due. */
|
|
23
|
+
export declare function runToolAutoUpgradeRound(options?: {
|
|
24
|
+
env?: NodeJS.ProcessEnv;
|
|
25
|
+
now?: () => number;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
results: Record<string, AutoUpgradeOutcome>;
|
|
28
|
+
nextAt: number;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as o,spawnSync as t}from"child_process";import{readFileSync as e}from"fs";import{dirname as r,join as n}from"path";import{brandEnvName as s}from"./brand.js";import{isHelpRequest as i}from"./cli-help.js";import{installBlocker as l}from"./components.js";import{compareVersions as a,getAutoUpgradeRules as u}from"./model-registry.js";import{powerShellEnv as p}from"./powershell-env.js";import{resolveUpdateCachePath as c,isNpxExecution as f}from"./auto-update.js";import{track as d}from"./telemetry.js";import{upgradeTool as m}from"./tool-upgrade.js";import{atomicWriteFile as g}from"./tools/backup.js";import{getAdapter as h}from"./tools/registry.js";import{findInstalls as _,forgetInstalls as v,latestRelease as w}from"./tools/tool-installs.js";import{logger as A}from"../utils/logger.js";export const AUTO_UPGRADE_WORKER_ARG="__tool-auto-upgrade";const j=36e5,U=new Set(["upgrade","update","install","completion","logs","__tool-auto-upgrade"]),y=["--json","--dry-run","--help","-h","--version","-v"];function x(o){return n(r(c(o)),"tool-auto-upgrade.json")}function E(o,t,e){try{g(o,JSON.stringify({next_at:t,...e?{results:e}:{}})+"\n")}catch(o){A.logError("toolAutoUpgrade: state",o)}}export function shouldSkipToolAutoUpgrade(o,t=process.env){if("1"===t[s("DISABLE_TOOL_AUTO_UPGRADE")]||t.CI)return!0;if(y.some(t=>o.includes(t))||i(o))return!0;const e=o.find(o=>!o.startsWith("-"));return!(void 0===e||!U.has(e))||f(t)||null!==l(t)||0===u().tools.length}let S=t=>{const e=process.argv[1];if(!e)return;const r=o(process.execPath,[e,"__tool-auto-upgrade"],{detached:!0,stdio:"ignore",windowsHide:!0,env:t});r.on("error",o=>A.logError("toolAutoUpgrade: spawn",o)),r.unref()};export function setAutoUpgradeSpawnerForTests(o){S=o??(o=>{})}export function startToolAutoUpgrade(o,t={}){const r=t.env??process.env,n=t.now??Date.now();try{if(shouldSkipToolAutoUpgrade(o,r))return!1;const t=x(r);return!(n<function(o,t){try{const r=JSON.parse(e(o,"utf-8")).next_at;return"number"==typeof r&&r-t<=744*j?r:0}catch{return 0}}(t,n)||(E(t,n+u().intervalHours*j),S(r),0))}catch(o){return A.logError("toolAutoUpgrade: start",o),!1}}let T=(o,e)=>{if("win32"!==process.platform)return!1;const r=`${t("powershell.exe",["-NoProfile","-NonInteractive","-Command",`(Get-Process -Name '${o.command}' -ErrorAction SilentlyContinue) | ForEach-Object { if ($_.Path) { $_.Path } else { '?' } }`],{encoding:"utf-8",windowsHide:!0,timeout:2e4,env:p()}).stdout??""}`.split(/\r?\n/).map(o=>o.trim().toLowerCase()).filter(Boolean),n=new Set(e.map(o=>o.path.toLowerCase()));return r.some(o=>"?"===o||n.has(o))};export function setRunningCheckForTests(o){T=o??(()=>!1)}export async function runToolAutoUpgradeRound(o={}){const t=o.env??process.env,e=o.now??Date.now,r=u(),n={};let s=e()+r.intervalHours*j;const i=o=>{s=Math.min(s,o)};for(const o of r.tools){const t=h(o)?.installSpec;if(!t)continue;v();const s=_(t),l=s[0]?.version??null,u=s.length>0&&l?await w(t):null;let p;if(0===s.length)p="not_installed";else if(l)if(u)if(a(l,u.version)>=0)p="current";else if(e()-u.publishedAt<r.minAgeHours*j)p="too_new";else if(T(t,s))p="running";else{const r=e();d(`auto-upgrade:${o}`,"start",{detail:{from:l,to:u.version}});try{await m(o)}catch(t){A.logError(`toolAutoUpgrade(${o})`,t)}v();const n=_(t)[0]?.version??null;p=n&&a(n,l)>0?"upgraded":"failed",d(`auto-upgrade:${o}`,"upgraded"===p?"ok":"fail",{duration_ms:e()-r,detail:{from:l,to:u.version,after:n}})}else p="offline";else p="unknown_version";"offline"!==p&&"running"!==p||i(e()+72e5),"too_new"===p&&u&&i(u.publishedAt+r.minAgeHours*j),"upgraded"!==p&&"failed"!==p&&"not_installed"!==p&&"current"!==p&&d(`auto-upgrade:${o}`,"skip",{detail:{reason:p,from:l,latest:u?.version}}),n[o]=p}return E(x(t),s,n),{results:n,nextAt:s}}
|
|
@@ -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{
|
|
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{persistentEnvApplied as s,readPersistentEnvFile as c,removePersistentEnv as u,writePersistentEnv as p}from"../persistent-env.js";import{backupBeforeWrite as m,atomicWriteFile as d}from"./backup.js";import{findInstalls as g,mirrorInstallCommand as y}from"./tool-installs.js";import{toolHome as f}from"./types.js";import{brand as h,PROVIDER_KEY as v}from"../brand.js";const A="agy",_="AGY_LLM_GATEWAY_URL",E="AGY_LLM_GATEWAY_API_KEY",j="AGY_LLM_GATEWAY_MODELS",w=["GEMINI_API_KEY","GOOGLE_GEMINI_BASE_URL"],K="gemini",b=()=>n(f(),".gemini","antigravity-cli"),I=()=>n(b(),"settings.json"),P=()=>n(b(),`${v}.env`),M=()=>n(f(),".antigravity","settings.json"),G=h().installMirror?.agy,L={command:"agy",native:{binDir:"win32"===process.platform?["AppData","Local","agy","bin"]:[".local","bin"],updateArgs:["update"],dataDirs:[]},...G?{mirrorScript:{sh:`${G}/install.sh`,ps1:`${G}/install.ps1`}}:{}};function $(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function C(t,n){if(!r(t))return{};const o=e(t,"utf-8");if(!o.trim())return{};try{const t=JSON.parse(o);if(!$(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 N=()=>C(I(),"~/.gemini/antigravity-cli/settings.json"),S=()=>C(M(),"~/.antigravity/settings.json");function Y(r,e,n){m(r),d(r,JSON.stringify(e,null,2)+"\n",n),void 0!==n&&t(r,n)}function x(t){return(t||"").replace(/\/+$/,"").replace(/\/v1(beta)?$/,"")}const k=/-(minimal|low|medium|high|xhigh|max)$/;function O(t){const r=a().gatewayModels,e=t?r.filter(r=>t.models.includes(r)||t.models.includes(r.replace(k,""))):[];return e.length>0?e:r}function U(t){const r=t.replace(/-preview$/,""),e=k.exec(r)?.[1];return e?`${i(r.replace(k,""))} (${e[0].toUpperCase()}${e.slice(1)})`:i(r)}function D(t){const r=t.gateway;return $(r)&&!0===r.enabled&&"string"==typeof r.apiKey&&r.apiKey.trim()&&"string"==typeof r.url?{url:r.url,apiKey:r.apiKey}:null}function R(t){const r=t.models;return $(r)&&Array.isArray(r.list)?r.list.map(t=>$(t)&&"string"==typeof t.modelId?t.modelId:"").filter(Boolean):[]}function T(){try{if(N().modelProvider!==K)return null}catch{return null}const t=c(P()),r=t.GEMINI_API_KEY;return r&&r.trim()?{apiKey:r,url:t.GOOGLE_GEMINI_BASE_URL??""}:null}function B(t){const r=c(P());return r[_]===t.url&&r[E]===t.apiKey}function W(t,r,e){const n=N(),o=S();o.gateway={...$(o.gateway)?o.gateway:{},enabled:!0,url:r,apiKey:t,wireProtocol:"genai"},o.models={...$(o.models)?o.models:{},defaultModelId:e[0],list:e.map(t=>({modelId:t,displayName:U(t),supportsThinking:!0}))},Y(M(),o,384),w.some(t=>void 0!==c(P())[t])&&u(A,P(),w);const i=p(A,P(),{[_]:r,[E]:t,[j]:e.join(",")}).rcFiles;for(const t of w)delete process.env[t];return n.modelProvider===K&&(delete n.modelProvider,Y(I(),n)),i}let J=null,F=null;export const antigravityAdapter={name:"agy",displayName:"Antigravity CLI",command:"agy",installCommand:y(L),installSpec:L,configPath:M(),wantsModelCatalog:!0,loadPrivateConfig(t){N(),S();const r=O(t.catalog);J=W(t.apiKey,x(t.baseUrl),r),F=r},unloadPrivateConfig(){try{const t=S();D(t)&&(delete t.gateway,delete t.models,Y(M(),t,384))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}try{const t=N();t.modelProvider===K&&(delete t.modelProvider,Y(I(),t))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}u(A,P(),[_,E,j,...w])},detectCurrentConfig(){try{const t=D(S());if(t)return{apiKey:t.apiKey}}catch{return{apiKey:null}}return{apiKey:T()?.apiKey??null}},listedModels(){try{const t=S(),r=D(t);if(r)return B(r)?R(t):[]}catch{return null}return T()?[]:null},refreshModelMenu(t){const r=S(),e=D(r)??T();if(!e)return;const n=O(t.catalog),o=e.url||x(t.baseUrl),i=D(r);null!==i&&B(i)&&R(r).join(",")===n.join(",")&&c(P())[j]===n.join(",")&&s(P())&&null===T()||W(e.apiKey,o,n)},getConfig(){try{return S()}catch(t){return l.logError("antigravityAdapter.getConfig",t),null}},applyNotes(){const t=[];if(F&&F.length>0){const r=F.map(U);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===J||0===g(L).length||t.push({kind:"action",text:o.t("tools.agy.open_new_terminal")}),t},backupPaths:()=>[M(),I(),P()],forceResetPaths:()=>[P()]};
|
|
@@ -66,6 +66,14 @@ export declare function npmMirrorInstallCommand(spec: ToolInstallSpec, version?:
|
|
|
66
66
|
* arm64 only). Those take npmjs.org's `latest`, else the newest stable version on the mirror.
|
|
67
67
|
*/
|
|
68
68
|
export declare function npmMirrorVersion(spec: ToolInstallSpec): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* The newest stable release on npmmirror and when it was published, or null when the mirror can't
|
|
71
|
+
* be reached. Small requests only: the full package document of Codex is 20 MB.
|
|
72
|
+
*/
|
|
73
|
+
export declare function latestRelease(spec: ToolInstallSpec): Promise<{
|
|
74
|
+
version: string;
|
|
75
|
+
publishedAt: number;
|
|
76
|
+
} | null>;
|
|
69
77
|
/** The China-reachable install command: our install script when there is one, otherwise npm from npmmirror. */
|
|
70
78
|
export declare function mirrorInstallCommand(spec: ToolInstallSpec): string;
|
|
71
79
|
export declare function npmUninstallCommand(spec: ToolInstallSpec): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawnSync as t}from"child_process";import{existsSync as n,realpathSync as r,statSync as e}from"fs";import{delimiter as o,dirname as s,isAbsolute as i,join as a}from"path";import{i18n as c}from"../i18n.js";import{toolHome as
|
|
1
|
+
import{spawnSync as t}from"child_process";import{existsSync as n,realpathSync as r,statSync as e}from"fs";import{delimiter as o,dirname as s,isAbsolute as i,join as a}from"path";import{i18n as c}from"../i18n.js";import{toolHome as l}from"./types.js";import{brand as p}from"../brand.js";export const NPM_MIRROR="https://registry.npmmirror.com";export function brandInstallScripts(t){const n=p().installMirror?.scripts;return n?{sh:`${n}/${t}.sh`,ps1:`${n}/${t}.ps1`}:void 0}export function npmMirrorInstallCommand(t,n="latest"){return`npm install -g ${t.npmPackage}@${n} --registry=${NPM_MIRROR}`}const m=/^(\d+)\.(\d+)\.(\d+)$/;function u(t,n){const r=m.exec(t).slice(1).map(Number),e=m.exec(n).slice(1).map(Number);for(let o=0;o<3;o++)if(r[o]!==e[o])return r[o]>e[o]?t:n;return t}async function f(t,n,r){const e=await fetch(t,{signal:AbortSignal.timeout(n),headers:r});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}export async function npmMirrorVersion(t){if(!t.npmPackage||!t.npmMirrorTagStale)return"latest";let n=d.get(t.npmPackage);return n||d.set(t.npmPackage,n=async function(t){try{const{version:n}=await f(`https://registry.npmjs.org/${t}/latest`,1e4);if("string"==typeof n&&m.test(n))return n}catch{}try{const n=await f(`${NPM_MIRROR}/${t}`,2e4,{accept:"application/vnd.npm.install-v1+json"}),r=Object.keys(n.versions??{}).filter(t=>m.test(t));if(r.length)return r.reduce(u)}catch{}return"latest"}(t.npmPackage)),n}const d=new Map;export async function latestRelease(t){if(!t.npmPackage)return null;try{const n=t.npmMirrorTagStale?await npmMirrorVersion(t):"latest";if("latest"!==n&&!m.test(n))return null;let r;try{r=await f(`${NPM_MIRROR}/${t.npmPackage}/${n}`,15e3)}catch(t){if("latest"===n)throw t;return{version:n,publishedAt:0}}return"string"==typeof r.version&&m.test(r.version)?{version:r.version,publishedAt:"number"==typeof r.publish_time?r.publish_time:0}:null}catch{return null}}export function mirrorInstallCommand(t){if(t.mirrorScript){if("win32"!==process.platform)return`curl -fsSL ${t.mirrorScript.sh} | sh`;const n=`$env:TEMP\\${t.command}-install.ps1`;return`irm ${t.mirrorScript.ps1} -OutFile "${n}"; powershell -NoProfile -ExecutionPolicy Bypass -File "${n}"`}return t.npmPackage?npmMirrorInstallCommand(t):""}export function npmUninstallCommand(t){return`npm uninstall -g ${t.npmPackage}`}export function installLabel(t){return c.t("upgrade.install_label",{kind:c.t(`upgrade.kind.${t.kind}`),version:t.version??"?",path:t.path})}let h=n=>{const r={encoding:"utf-8",timeout:1e4,windowsHide:!0,stdio:["ignore","pipe","pipe"]};return`${(/\.cmd$/i.test(n)?t(`"${n}" --version`,{...r,shell:!0}):t(n,["--version"],r)).stdout??""}`};const g=new Map;export function setVersionRunnerForTests(t){h=t,g.clear(),d.clear()}export function forgetInstalls(){g.clear()}function $(t,n){return"win32"===process.platform?t.toLowerCase()===n.toLowerCase():t===n}function v(t){try{return e(t).isFile()}catch{return!1}}function w(t,e){if(t.native&&$(s(e),a(l(),...t.native.binDir)))return"native";const o=t.npmPackage?a("node_modules",...t.npmPackage.split("/")):null;if(o&&n(a(s(e),o)))return"npm";let i=e;try{i=r(e)}catch{return"other"}return o&&i.includes(o)?"npm":/[\\/](Cellar|Caskroom)[\\/]/.test(i)?"brew":"other"}export function findInstalls(t){const n=g.get(t.command);if(n)return n;const e="win32"===process.platform?[`${t.command}.exe`,`${t.command}.cmd`]:[t.command],s=new Set,c=[];for(const n of(process.env.PATH??"").split(o))if(n&&i(n))for(const o of e){const e=a(n,o);if(!v(e))continue;let i=e;try{i=r(e)}catch{}const l="win32"===process.platform?i.toLowerCase():i;if(s.has(l))continue;s.add(l);const p=h(e).match(/(\d+)\.(\d+)\.(\d+)/);c.push({path:e,kind:w(t,e),version:p?p[0]:null})}return g.set(t.command,c),c}export function findInstallsIncludingNative(t){const n=findInstalls(t).map(t=>({...t,onPath:!0}));if(!t.native)return n;const r=a(l(),...t.native.binDir),e="win32"===process.platform?[`${t.command}.exe`]:[t.command];for(const t of e){const e=a(r,t);if(!v(e)||n.some(t=>$(t.path,e)))continue;const o=h(e).match(/(\d+)\.(\d+)\.(\d+)/);n.push({path:e,kind:"native",version:o?o[0]:null,onPath:!1})}return n}
|
package/dist/models.json
CHANGED
|
@@ -59,7 +59,14 @@
|
|
|
59
59
|
"opus": ["claude-opus-5-5", "claude-opus-5", "claude-opus-4-8", "claude-opus-4-7", "claude-opus-4-6"],
|
|
60
60
|
"sonnet": ["claude-sonnet-5", "claude-sonnet-4-6"],
|
|
61
61
|
"haiku": ["claude-haiku-4-5-20251001"],
|
|
62
|
-
"fable": [
|
|
62
|
+
"fable": [
|
|
63
|
+
"claude-fable-5-2",
|
|
64
|
+
"claude-fable-5-1",
|
|
65
|
+
"claude-fable-5",
|
|
66
|
+
"claude-opus-5-5",
|
|
67
|
+
"claude-opus-5",
|
|
68
|
+
"claude-opus-4-8"
|
|
69
|
+
]
|
|
63
70
|
}
|
|
64
71
|
},
|
|
65
72
|
"claudeDesktop": {
|
|
@@ -289,15 +296,21 @@
|
|
|
289
296
|
"gemini-4-argon",
|
|
290
297
|
"gemini-4-carbon-medium",
|
|
291
298
|
"gemini-4-hydrogen",
|
|
299
|
+
"gemini-4-neon",
|
|
292
300
|
"gemini-3.8-flash",
|
|
293
301
|
"gemini-3.7-flash",
|
|
294
302
|
"gemini-3.6-flash",
|
|
295
303
|
"gemini-3.1-pro-preview"
|
|
296
304
|
]
|
|
297
305
|
},
|
|
306
|
+
"autoUpgrade": {
|
|
307
|
+
"tools": ["claude-code", "codex", "grok"],
|
|
308
|
+
"intervalHours": 24,
|
|
309
|
+
"minAgeHours": 6
|
|
310
|
+
},
|
|
298
311
|
"toolMinVersions": {
|
|
299
312
|
"codex": "0.122.0",
|
|
300
|
-
"claude-code": "2.1.
|
|
313
|
+
"claude-code": "2.1.321",
|
|
301
314
|
"claude-desktop": "2.2553.0",
|
|
302
315
|
"agy": "1.3.5"
|
|
303
316
|
}
|
package/models.json
CHANGED
|
@@ -59,7 +59,14 @@
|
|
|
59
59
|
"opus": ["claude-opus-5-5", "claude-opus-5", "claude-opus-4-8", "claude-opus-4-7", "claude-opus-4-6"],
|
|
60
60
|
"sonnet": ["claude-sonnet-5", "claude-sonnet-4-6"],
|
|
61
61
|
"haiku": ["claude-haiku-4-5-20251001"],
|
|
62
|
-
"fable": [
|
|
62
|
+
"fable": [
|
|
63
|
+
"claude-fable-5-2",
|
|
64
|
+
"claude-fable-5-1",
|
|
65
|
+
"claude-fable-5",
|
|
66
|
+
"claude-opus-5-5",
|
|
67
|
+
"claude-opus-5",
|
|
68
|
+
"claude-opus-4-8"
|
|
69
|
+
]
|
|
63
70
|
}
|
|
64
71
|
},
|
|
65
72
|
"claudeDesktop": {
|
|
@@ -289,15 +296,21 @@
|
|
|
289
296
|
"gemini-4-argon",
|
|
290
297
|
"gemini-4-carbon-medium",
|
|
291
298
|
"gemini-4-hydrogen",
|
|
299
|
+
"gemini-4-neon",
|
|
292
300
|
"gemini-3.8-flash",
|
|
293
301
|
"gemini-3.7-flash",
|
|
294
302
|
"gemini-3.6-flash",
|
|
295
303
|
"gemini-3.1-pro-preview"
|
|
296
304
|
]
|
|
297
305
|
},
|
|
306
|
+
"autoUpgrade": {
|
|
307
|
+
"tools": ["claude-code", "codex", "grok"],
|
|
308
|
+
"intervalHours": 24,
|
|
309
|
+
"minAgeHours": 6
|
|
310
|
+
},
|
|
298
311
|
"toolMinVersions": {
|
|
299
312
|
"codex": "0.122.0",
|
|
300
|
-
"claude-code": "2.1.
|
|
313
|
+
"claude-code": "2.1.321",
|
|
301
314
|
"claude-desktop": "2.2553.0",
|
|
302
315
|
"agy": "1.3.5"
|
|
303
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/api-helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.189",
|
|
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",
|