@vibeapi/api-helper 0.0.188 → 0.0.190

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.
@@ -2441,7 +2441,7 @@
2441
2441
  "tool": "gemini"
2442
2442
  }
2443
2443
  ],
2444
- "revision": "2026-11-21T07:47:09Z-11",
2444
+ "revision": "2026-11-22T14:14:16Z-12",
2445
2445
  "schema": 1,
2446
2446
  "tools": {
2447
2447
  "claude": {
@@ -2542,7 +2542,7 @@
2542
2542
  },
2543
2543
  "tool_min_versions": {
2544
2544
  "agy": "1.3.5",
2545
- "claude-code": "2.1.291",
2545
+ "claude-code": "2.1.321",
2546
2546
  "claude-desktop": "2.2553.0",
2547
2547
  "codex": "0.122.0"
2548
2548
  }
@@ -2441,7 +2441,7 @@
2441
2441
  "tool": "gemini"
2442
2442
  }
2443
2443
  ],
2444
- "revision": "2026-11-21T07:47:09Z-11",
2444
+ "revision": "2026-11-22T14:14:16Z-12",
2445
2445
  "schema": 1,
2446
2446
  "tools": {
2447
2447
  "claude": {
@@ -2542,7 +2542,7 @@
2542
2542
  },
2543
2543
  "tool_min_versions": {
2544
2544
  "agy": "1.3.5",
2545
- "claude-code": "2.1.291",
2545
+ "claude-code": "2.1.321",
2546
2546
  "claude-desktop": "2.2553.0",
2547
2547
  "codex": "0.122.0"
2548
2548
  }
@@ -1 +1 @@
1
- import{spawnSync as t}from"child_process";import{closeSync as e,copyFileSync as o,createReadStream as r,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 _}from"./tools/backup.js";import{CLI_NAME as x}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?.(),o=`${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 o;const r=N(S());return o.filter(t=>{let e;try{e=a(`/proc/${t}/environ`,"utf-8")}catch{return!0}const o=new Map(e.split("\0").map(t=>[t.slice(0,t.indexOf("=")),t.slice(t.indexOf("=")+1)])),n=o.get("CODEX_HOME")?.trim()||(o.get("HOME")?g(o.get("HOME"),".codex"):null);return null===n||N(n)===r})};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 o=c(t,"r");try{const t=[],e=Buffer.alloc(65536);for(;;){const r=f(o,e,0,e.length,null);if(r<=0)break;const n=e.subarray(0,r).indexOf(10);if(n>=0){t.push(Buffer.from(e.subarray(0,n)));break}t.push(Buffer.from(e.subarray(0,r)))}return Buffer.concat(t).toString("utf-8")}finally{e(o)}}async function M(t,e,o){const{atime:s,mtime:i}=d(t),c=`${t}.${x}-tmp`,a=n(c);a.write(e),await y(r(t,{start:o}),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")),o="string"==typeof e.sqlite_home?e.sqlite_home.trim():"";if(o)return"~"===o||o.startsWith("~/")?g(v(),o.slice(1)):b(t,o)}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 B(t,e,o){const r=function(t,e){return new Set(t.prepare(`PRAGMA table_info(${e})`).all().map(t=>String(t.name)))}(t,e),n=T[e];if(!r.has(n)||!r.has("model_provider"))return null;const s=r.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(o).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 C(t){try{t.exec("ROLLBACK")}catch{}}async function I(t){try{return 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 r=function(){const t=[],e=o=>{if(s(o))for(const r of l(o,{withFileTypes:!0})){const n=g(o,r.name);r.isDirectory()?e(n):r.isFile()&&r.name.endsWith(".jsonl")&&t.push(n)}};return e(g(S(),"sessions")),e(g(S(),"archived_sessions")),t}(),n=[];for(const e of r){let o,r;try{o=$(e)}catch{continue}try{r=JSON.parse(o)}catch{continue}const s=r.payload?.model_provider;"session_meta"===r.type&&"string"==typeof s&&s!==t&&(r.payload.model_provider=t,n.push({file:e,from:s,line:JSON.stringify(r),length:Buffer.byteLength(o,"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 o=await I(e);if("string"==typeof o){a=o;break}const r=[];try{for(const n of Object.keys(T)){const s=B(o,n,t);s&&s.length>0&&r.push({db:e,table:n,rows:s})}}catch{}f.push({path:e,db:o,tables:r})}const p=f.flatMap(t=>t.tables),u=new Set(p.flatMap(t=>t.rows.map(t=>t.id))),d={target:t,scanned:r.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",`${x}-sessions-${(new Date).toISOString().replace(/[:.]/g,"-")}`);i(b,{recursive:!0}),f.forEach(({path:t,tables:e},r)=>{if(0!==e.length)for(const e of["","-wal","-shm"])s(t+e)&&o(t+e,g(b,`${r}-${h(t)}${e}`))});const y={target:t,moved:d.moved,tables:p};_(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:o}of E)for(const{table:r,rows:n}of o){const o=e.prepare(`UPDATE ${r} SET model_provider = ? WHERE ${T[r]} = ? AND model_provider = ?`);for(const{id:e,from:r}of n)o.run(t,e,r)}for(;v.length>0;)v.shift().exec("COMMIT")}catch(t){throw v.forEach(C),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 o=0;for(const{file:t,from:r}of e.moved){if(!s(t))continue;const e=$(t),n=JSON.parse(e);n.payload&&(n.payload.model_provider=r,await M(t,JSON.stringify(n),Buffer.byteLength(e,"utf-8")),o+=1)}const r=e.tables??(e.db&&e.threads?[{db:e.db,table:"threads",rows:e.threads}]:[]),n=new Set;for(const{db:t,table:o,rows:i}of r){if(!s(t)||0===i.length||!T[o])continue;const r=await I(t);if("string"==typeof r)continue;const c=[];try{r.exec("BEGIN IMMEDIATE");const t=r.prepare(`UPDATE ${o} SET model_provider = ? WHERE ${T[o]} = ? AND model_provider = ?`);for(const{id:o,from:r}of i)Number(t.run(r,o,e.target).changes)>0&&c.push(o);r.exec("COMMIT")}catch(t){throw C(r),r.close(),t}r.close(),c.forEach(t=>n.add(t))}return{files:o,dbRows:n.size}}
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}}
@@ -0,0 +1,11 @@
1
+ /** Machine setting: the installed version the customer chose to keep (answered "no"). */
2
+ export declare const DECLINED_KEY = "upgrade_declined";
3
+ /**
4
+ * After writing configs: offer to bring each installed command-line tool up to the mirror's latest
5
+ * release, one question per tool showing both versions (用户 2026-11-22 定:升级前要客户确认,
6
+ * 有客户要停在指定版本). Only someone at a terminal is asked; `--yes` and no terminal never upgrade
7
+ * to latest (tools below the minimum version are handled before this, as before). "No" is
8
+ * remembered for that installed version: the customer is not asked again until the version
9
+ * changes, so a pinned version stays pinned. `vibecli upgrade <tool>` upgrades any time.
10
+ */
11
+ export declare function offerLatestUpgrades(tools: string[], skip?: ReadonlySet<string>): Promise<void>;
@@ -0,0 +1 @@
1
+ import t from"chalk";import o from"inquirer";import{CLI_NAME as r}from"./brand.js";import{configManager as e}from"./config.js";import{i18n as n}from"./i18n.js";import{compareVersions as s}from"./model-registry.js";import{canPrompt as l,hasExplicitYes as i}from"./runtime-options.js";import{track as a}from"./telemetry.js";import{upgradeTool as m}from"./tool-upgrade.js";import{getAdapter as f}from"./tools/registry.js";import{findInstalls as c,latestRelease as p}from"./tools/tool-installs.js";import{logger as u}from"../utils/logger.js";export const DECLINED_KEY="upgrade_declined";export async function offerLatestUpgrades(g,d=new Set){if(!l()||i())return;const j=await Promise.all([...new Set(g)].filter(t=>!d.has(t)).map(async t=>{try{const o=f(t),r=o?.installSpec,n=r?c(r)[0]?.version??null:null;if(!o||!r||!n)return null;if(e.getMachineSetting(t,DECLINED_KEY)===n)return null;const l=await p(r);return!l||s(n,l.version)>=0?null:{tool:t,name:o.displayName,current:n,latest:l.version}}catch(o){return u.logError(`offerLatestUpgrades(${t})`,o),null}}));for(const s of j){if(!s)continue;const{ok:l}=await o.prompt([{type:"confirm",name:"ok",default:!0,message:n.t("setup.offer_latest",{tool:s.name,current:s.current,latest:s.latest})}]);a(`offer-latest:${s.tool}`,l?"ok":"skip",{detail:{from:s.current,to:s.latest}}),l?await m(s.tool):(e.setMachineSetting(s.tool,DECLINED_KEY,s.current),console.log(t.gray(" "+n.t("setup.latest_declined",{tool:s.name,current:s.current,command:`${r} upgrade ${s.tool}`}))))}}
@@ -1 +1 @@
1
- import o from"chalk";import t from"inquirer";import{i18n as e}from"./i18n.js";import{canPrompt as n,hasExplicitYes as r}from"./runtime-options.js";import{flushTelemetry as l,track as i}from"./telemetry.js";import{toolManager as a}from"./tool-manager.js";import{getAdapter as s}from"./tools/registry.js";import{upgradeTool as p}from"./tool-upgrade.js";import{appsForTools as c,upgradeApp as f}from"./app-update.js";import{logger as u}from"../utils/logger.js";async function m(o){const{ok:e}=await t.prompt([{type:"confirm",name:"ok",message:o,default:!0}]);return e}export async function runPendingElevations(t){const a=n(),p=r();for(const n of t){const t=s(n)?.pendingElevation?.();if(!t)continue;const r=s(n)?.displayName??n;if(!p&&!a){console.log(o.yellow(" ! "+e.t("setup.elevation_skipped",{tool:r}))),i("elevate-registry","skip",{detail:{tool:n,reason:"no_terminal"}});continue}if(!p&&!await m(t.prompt)){i("elevate-registry","cancel",{detail:{tool:n,reason:"declined"}});continue}console.log(o.gray(" "+e.t("setup.elevation_running")));const c=Date.now();i("elevate-registry","start",{detail:{tool:n,asked:!p}}),await l();const f=t.run();i("elevate-registry",f?"ok":"fail",{duration_ms:Date.now()-c,detail:{tool:n,asked:!p}}),console.log(f?o.green(" √ "+e.t("setup.elevation_done",{tool:r})):o.yellow(" ! "+e.t("setup.elevation_failed",{tool:r})))}}export async function runFollowUps(t){const e=n();for(const n of t){let t,l;try{t=await(s(n)?.followUp?.())}catch(o){u.logError(`postApplyPrompts.followUp(${n})`,o);continue}if(t)if("run"in t&&(r()||e))if(r()||await m(t.prompt)){try{l=await t.run()}catch(e){u.logError(`postApplyPrompts.followUp.run(${n})`,e),i(`follow-up:${n}`,"fail",{error:e}),console.log(o.yellow(" ! "+t.hint));continue}for(const t of l)console.log("action"===t.kind?o.yellow(" ! "+t.text):o.green(" √ "+t.text))}else t.decline();else console.log(o.yellow(" ! "+t.hint))}}export async function postApplyPrompts(t,l={}){const i=new Set;for(const o of l.apps?c(t):[])try{const t=await f(o,{install:l.apps.install,quiet:!0,askBeforeUpgrade:!0});t.upgraded&&t.running&&i.add(o)}catch(t){u.logError(`postApplyPrompts.upgradeApp(${o})`,t)}for(const e of t){const t=await(s(e)?.prepareRuntime?.())??[];for(const e of t)console.log("action"===e.kind?o.yellow(" ! "+e.text):o.green(" √ "+e.text))}await runPendingElevations(t),await runFollowUps(t);const g=n(),d=r(),y=g||d?t.filter(o=>s(o)?.installSpec&&a.outdatedVersion(o)):[];if(y.length>0){const o=y.map(o=>s(o)?.displayName??o).join("、");if(d||await m(e.t("setup.offer_upgrade",{tools:o})))for(const o of y)await p(o)}for(const n of t){const t=s(n);if(i.has(n)||!t?.runningApp?.isRunning())continue;if(d||!g){console.log(o.yellow(" ! "+e.t("setup.reopen_hint",{tool:t.displayName})));continue}if(!await m(e.t("setup.offer_restart",{tool:t.displayName})))continue;const r=t.runningApp.restart();console.log(r?o.green(" √ "+e.t("setup.restarted",{tool:t.displayName})):o.yellow(" ! "+e.t("setup.restart_failed",{tool:t.displayName})))}}
1
+ import o from"chalk";import t from"inquirer";import{i18n as e}from"./i18n.js";import{canPrompt as n,hasExplicitYes as r}from"./runtime-options.js";import{flushTelemetry as l,track as i}from"./telemetry.js";import{toolManager as a}from"./tool-manager.js";import{getAdapter as s}from"./tools/registry.js";import{upgradeTool as p}from"./tool-upgrade.js";import{appsForTools as c,upgradeApp as f}from"./app-update.js";import{offerLatestUpgrades as u}from"./latest-upgrade.js";import{logger as m}from"../utils/logger.js";async function g(o){const{ok:e}=await t.prompt([{type:"confirm",name:"ok",message:o,default:!0}]);return e}export async function runPendingElevations(t){const a=n(),p=r();for(const n of t){const t=s(n)?.pendingElevation?.();if(!t)continue;const r=s(n)?.displayName??n;if(!p&&!a){console.log(o.yellow(" ! "+e.t("setup.elevation_skipped",{tool:r}))),i("elevate-registry","skip",{detail:{tool:n,reason:"no_terminal"}});continue}if(!p&&!await g(t.prompt)){i("elevate-registry","cancel",{detail:{tool:n,reason:"declined"}});continue}console.log(o.gray(" "+e.t("setup.elevation_running")));const c=Date.now();i("elevate-registry","start",{detail:{tool:n,asked:!p}}),await l();const f=t.run();i("elevate-registry",f?"ok":"fail",{duration_ms:Date.now()-c,detail:{tool:n,asked:!p}}),console.log(f?o.green(" √ "+e.t("setup.elevation_done",{tool:r})):o.yellow(" ! "+e.t("setup.elevation_failed",{tool:r})))}}export async function runFollowUps(t){const e=n();for(const n of t){let t,l;try{t=await(s(n)?.followUp?.())}catch(o){m.logError(`postApplyPrompts.followUp(${n})`,o);continue}if(t)if("run"in t&&(r()||e))if(r()||await g(t.prompt)){try{l=await t.run()}catch(e){m.logError(`postApplyPrompts.followUp.run(${n})`,e),i(`follow-up:${n}`,"fail",{error:e}),console.log(o.yellow(" ! "+t.hint));continue}for(const t of l)console.log("action"===t.kind?o.yellow(" ! "+t.text):o.green(" √ "+t.text))}else t.decline();else console.log(o.yellow(" ! "+t.hint))}}export async function postApplyPrompts(t,l={}){const i=new Set;for(const o of l.apps?c(t):[])try{const t=await f(o,{install:l.apps.install,quiet:!0,askBeforeUpgrade:!0});t.upgraded&&t.running&&i.add(o)}catch(t){m.logError(`postApplyPrompts.upgradeApp(${o})`,t)}for(const e of t){const t=await(s(e)?.prepareRuntime?.())??[];for(const e of t)console.log("action"===e.kind?o.yellow(" ! "+e.text):o.green(" √ "+e.text))}await runPendingElevations(t),await runFollowUps(t);const d=n(),y=r(),w=d||y?t.filter(o=>s(o)?.installSpec&&a.outdatedVersion(o)):[];if(w.length>0){const o=w.map(o=>s(o)?.displayName??o).join("、");if(y||await g(e.t("setup.offer_upgrade",{tools:o})))for(const o of w)await p(o)}await u(t.filter(o=>s(o)?.installSpec),new Set(w));for(const n of t){const t=s(n);if(i.has(n)||!t?.runningApp?.isRunning())continue;if(y||!d){console.log(o.yellow(" ! "+e.t("setup.reopen_hint",{tool:t.displayName})));continue}if(!await g(e.t("setup.offer_restart",{tool:t.displayName})))continue;const r=t.runningApp.restart();console.log(r?o.green(" √ "+e.t("setup.restarted",{tool:t.displayName})):o.yellow(" ! "+e.t("setup.restart_failed",{tool:t.displayName})))}}
@@ -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 p}from"./types.js";import{brand as l}from"../brand.js";export const NPM_MIRROR="https://registry.npmmirror.com";export function brandInstallScripts(t){const n=l().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 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(p(),...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 p="win32"===process.platform?i.toLowerCase():i;if(s.has(p))continue;s.add(p);const l=h(e).match(/(\d+)\.(\d+)\.(\d+)/);c.push({path:e,kind:w(t,e),version:l?l[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(p(),...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}
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}
@@ -349,6 +349,8 @@
349
349
  "done_commands": "Type {{commands}} in your terminal to start",
350
350
  "failed_summary": "{{count}} tool(s) not configured; see above",
351
351
  "offer_upgrade": "Upgrade {{tools}}? The installed version is too old.",
352
+ "offer_latest": "Upgrade {{tool}} ({{current}} → {{latest}})?",
353
+ "latest_declined": "Kept {{tool}} {{current}}; you won't be asked again for this version. To upgrade, run {{command}}",
352
354
  "offer_restart": "Restart {{tool}} so the new config takes effect? It is running and its windows will close.",
353
355
  "reopen_hint": "Reopen {{tool}} for the new config to take effect (it is running and was not restarted)",
354
356
  "restarted": "{{tool}} restarted",
@@ -349,6 +349,8 @@
349
349
  "done_commands": "在终端输入 {{commands}} 开始使用",
350
350
  "failed_summary": "{{count}} 个工具未完成配置,原因见上方",
351
351
  "offer_upgrade": "升级 {{tools}}?当前版本过旧。",
352
+ "offer_latest": "升级 {{tool}}({{current}} → {{latest}})?",
353
+ "latest_declined": "已保持 {{tool}} {{current}},这个版本不再询问;要升级运行 {{command}}",
352
354
  "offer_restart": "重启 {{tool}} 让新配置生效?它正在运行,当前窗口会被关闭。",
353
355
  "reopen_hint": "重新打开 {{tool}} 后生效(它正在运行,没有自动重启)",
354
356
  "restarted": "已重启 {{tool}}",
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": ["claude-fable-5-1", "claude-fable-5", "claude-opus-5-5", "claude-opus-5", "claude-opus-4-8"]
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": {
@@ -298,7 +305,7 @@
298
305
  },
299
306
  "toolMinVersions": {
300
307
  "codex": "0.122.0",
301
- "claude-code": "2.1.291",
308
+ "claude-code": "2.1.321",
302
309
  "claude-desktop": "2.2553.0",
303
310
  "agy": "1.3.5"
304
311
  }
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": ["claude-fable-5-1", "claude-fable-5", "claude-opus-5-5", "claude-opus-5", "claude-opus-4-8"]
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": {
@@ -298,7 +305,7 @@
298
305
  },
299
306
  "toolMinVersions": {
300
307
  "codex": "0.122.0",
301
- "claude-code": "2.1.291",
308
+ "claude-code": "2.1.321",
302
309
  "claude-desktop": "2.2553.0",
303
310
  "agy": "1.3.5"
304
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibeapi/api-helper",
3
- "version": "0.0.188",
3
+ "version": "0.0.190",
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",