@vibeapi/cli 0.0.169 → 0.0.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/gateway-models.js +1 -1
- package/dist/lib/tools/codex-catalog.js +1 -1
- package/dist/models.json +4 -11
- package/models.json +4 -11
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getGatewayModelRules as e}from"./model-registry.js";export function autoCompactTokens(t,o){return o&&o>0?Math.min(o,t):Math.floor(t*e().autoCompactRatio)}export function gatewayModelSpecs(o,i,d=[]){const n=e().models,c=n.filter(e=>function(e,t){return"codebuddy"===e||("codex"===e?!1!==t.codex:"grok"===e?"grok"===modelFamily(t.id):!t.id.startsWith("claude-")&&!1!==t.claudeCode)}(o,e));if(!i)return c;const r=new Set(Object.values(i).flat().filter(e=>e.hidden).map(e=>e.id)),l=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.filter(e=>!e.hidden)])),s=new Map;for(const e of Object.values(l).flat()){const t=e.clients?.[o];void 0===t||s.has(e.id)||s.set(e.id,t)}for(const[e,t]of s)t||r.add(e);const a=new Map(("claude-code"===o?n:c).map(e=>[e.id,e])),u=(l.gemini??[]).filter(e=>s.get(e.id)??!1!==n.find(t=>t.id===e.id)?.codex),
|
|
1
|
+
import{getGatewayModelRules as e}from"./model-registry.js";export function autoCompactTokens(t,o){return o&&o>0?Math.min(o,t):Math.floor(t*e().autoCompactRatio)}export function gatewayModelSpecs(o,i,d=[]){const n=e().models,c=n.filter(e=>function(e,t){return"codebuddy"===e||("codex"===e?!1!==t.codex:"grok"===e?"grok"===modelFamily(t.id):!t.id.startsWith("claude-")&&!1!==t.claudeCode)}(o,e));if(!i)return c;const r=new Set(Object.values(i).flat().filter(e=>e.hidden).map(e=>e.id)),l=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.filter(e=>!e.hidden)])),s=new Map;for(const e of Object.values(l).flat()){const t="codex"===o&&"gpt"===modelFamily(e.id)?void 0:e.clients?.[o];void 0===t||s.has(e.id)||s.set(e.id,t)}for(const[e,t]of s)t||r.add(e);const a=new Map(("claude-code"===o?n:c).map(e=>[e.id,e])),u=(l.gemini??[]).filter(e=>s.get(e.id)??!1!==n.find(t=>t.id===e.id)?.codex),m=("codebuddy"===o?[...l.claude??[],...l.codex??[],...l.gemini??[],...l.grok??[]]:"grok"===o?l.grok??[]:"codex"===o?[...l.codex??[],...u,...(l.claude??[]).filter(e=>e.id.startsWith("claude-")&&(s.get(e.id)??a.has(e.id)))]:function(e,t){return[...(e.codex??[]).filter(e=>"gpt"===modelFamily(e.id)),...e.gemini??[],...e.grok??[],...(e.claude??[]).filter(e=>!e.id.startsWith("claude-"))].filter(e=>e.clients?.["claude-code"]??t.get(e.id)?.claudeCode??!0)}(l,a)).filter(e=>!(e=>!1===s.get(e.id))(e));if(0===m.length)return c.filter(e=>!r.has(e.id));const f=new Set,g=[];for(const e of m){if(f.has(e.id))continue;f.add(e.id);const{clients:t,minClientVersion:o,rolloutPercent:i,...d}=e,n={...a.get(e.id),...d};void 0!==t?.codex&&(n.codex=t.codex),void 0!==t?.["claude-code"]&&(n.claudeCode=t["claude-code"]),g.push(n)}return t[o].some(e=>d.includes(e))?g:function(e,t,o){const i=[...e];return t.forEach((e,d)=>{if(o.has(e.id)||i.some(t=>t.id===e.id))return;const n=modelFamily(e.id),c=new Set(t.slice(d+1).filter(e=>modelFamily(e.id)===n).map(e=>e.id));let r=i.findIndex(e=>c.has(e.id));if(r<0){r=i.length;for(let e=i.length-1;e>=0;e--)if(modelFamily(i[e].id)===n){r=e+1;break}}i.splice(r,0,e)}),i}(g,c,r)}const t={grok:["grok"],codex:["codex","gemini","claude"],"claude-code":["codex","gemini","grok","claude"],codebuddy:["claude","codex","gemini","grok"]},o={gpt:"GPT",gemini:"Gemini",glm:"GLM",deepseek:"DeepSeek",minimax:"MiniMax",qwen:"Qwen"};export function modelBlurb(e,t={}){const o=[];for(const i of(e??"").split("|")){const e=i.trim();e&&(/\d\s*万?\s*输出|output\D*\d|\d\D*output/i.test(e)||(/[\d百千]\s*万?\s*上下文|context\D*\d|\d\D*context/i.test(e)?t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"):o.push(e)))}return t.millionContext&&!o.includes("百万上下文")&&o.unshift("百万上下文"),o.length>0?o.join(" | "):void 0}export function prettyModelName(e){const t=e.replace(/^([a-z]+)(\d)/i,"$1 $2").split(/[-_\s]+/).filter(Boolean),i=[];for(const e of t){const t=i[i.length-1];if(/^\d+$/.test(e)&&t&&/^\d+$/.test(t)&&e.length<=2&&!/^\d{8}$/.test(e)){i[i.length-1]=`${t}.${e}`;continue}const d=e.toLowerCase();i.push(o[d]??(/^[a-z]\d/i.test(e)?e.toUpperCase():e[0].toUpperCase()+e.slice(1)))}return i.join(" ")}export function vendorNames(e){return[...new Set(e.map(e=>prettyModelName(e).split(" ")[0]))]}export function modelFamily(e){const t=e.toLowerCase();return t.startsWith("claude-")?"claude":t.startsWith("gemini")?"gemini":t.startsWith("grok")?"grok":/^(gpt|o\d|codex)/.test(t)?"gpt":"other"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawnSync as t}from"child_process";import{existsSync as
|
|
1
|
+
import{spawnSync as t}from"child_process";import{existsSync as e,mkdtempSync as o,readFileSync as n,realpathSync as i,rmSync as s,statSync as r,writeFileSync as l}from"fs";import{tmpdir as c}from"os";import{delimiter as u,dirname as a,isAbsolute as d,join as p}from"path";import*as f from"@iarna/toml";import{fileURLToPath as m}from"url";import{logger as _}from"../../utils/logger.js";import{getCodexRules as x,compareVersions as g}from"../model-registry.js";import{autoCompactTokens as h,modelBlurb as w,prettyModelName as y}from"../gateway-models.js";import{codexHome as b,toolHome as v}from"./types.js";import{brandEnv as C,CLI_NAME as M,PROVIDER_KEY as j}from"../brand.js";const A=a(m(import.meta.url));export const CODEX_CATALOG_FILE=`${j}-model-catalog.json`;export const codexCatalogPath=()=>p(b(),CODEX_CATALOG_FILE);function O(){const t=C("CODEX_BIN");if(void 0!==t)return t.trim()?[t.trim()]:[];const e=["codex"];if("win32"===process.platform){const t=process.env.LOCALAPPDATA||p(v(),"AppData","Local");e.push(p(t,"Programs","OpenAI","Codex","bin","codex.exe"))}else e.push(p(v(),".local","bin","codex"));if("darwin"===process.platform)for(const t of["/Applications",p(v(),"Applications")])e.push(p(t,"ChatGPT.app/Contents/Resources/codex-cli/bin/codex")),e.push(p(t,"Codex.app/Contents/Resources/codex"));return e}function $(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function E(t){try{const e=JSON.parse(t),o=$(e)&&Array.isArray(e.models)?e.models.filter($):[];return o.length>0?o:null}catch{return null}}function S(e,o,n){const i={encoding:"utf-8",timeout:2e4,maxBuffer:67108864,windowsHide:!0,stdio:["ignore","pipe","pipe"],...n?{env:n}:{}};return"win32"!==process.platform||"codex"!==e&&!/\.cmd$/i.test(e)?t(e,o,i):t(["codex"===e?"codex":`"${e}"`,...o].join(" "),{...i,shell:!0})}function k(t){const e=S(t,["debug","models","--bundled"]);if(0===e.status&&e.stdout){const t=E(e.stdout);if(t)return t}return(e.error||0!==e.status)&&_.logError("loadBundledCodexModels",e.error??new Error(`${t} exited ${e.status}`)),null}export function loadBundledCodexModels(t){if(t)return k(t);for(const t of O()){if("codex"!==t&&!e(t))continue;const o=k(t);if(o)return o}return null}function P(t){try{return r(t).isFile()}catch{return!1}}export function installedCodexBinaries(){const t=[],e=O();if(e.includes("codex")){const e="win32"===process.platform?["codex.exe","codex.cmd"]:["codex"];for(const o of(process.env.PATH??"").split(u))if(o&&d(o))for(const n of e)t.push(p(o,n))}t.push(...e.filter(t=>"codex"!==t));const o=new Set,n=[];for(const e of t){if(!P(e))continue;let t=e;try{t=i(e)}catch{}const s="win32"===process.platform?t.toLowerCase():t;o.has(s)||(o.add(s),n.push(e))}return n}export function codexBinaryVersion(t){const e=`${S(t,["--version"]).stdout??""}`.match(/(\d+)\.(\d+)\.(\d+)/);return e?e[0]:null}export function catalogRejections(t,e=installedCodexBinaries()){if(0===e.length)return[];const n=o(p(c(),`${M}-codex-`)),i=[];try{l(p(n,"config.toml"),f.stringify({model_catalog_json:t}));for(const t of e){const e=S(t,["debug","models"],{...process.env,CODEX_HOME:n});if(0===e.status)continue;const o=`${e.stderr??""}\n${e.stdout??""}`,s=o.split(/\r?\n/).find(t=>t.includes("model_catalog_json"));s?i.push({bin:t,version:codexBinaryVersion(t),error:s.trim()}):_.logError("catalogRejections",e.error??new Error(`${t} exited ${e.status}: ${o.trim().slice(0,500)}`))}}finally{s(n,{recursive:!0,force:!0})}return i}export function loadPreviousCodexModels(){const t=W()?.filter(t=>!B(t));return t&&t.length>0?t:null}export function previousGatewayModelIds(){return(W()??[]).filter(B).map(t=>String(t.slug))}function W(){return e(codexCatalogPath())?E(n(codexCatalogPath(),"utf-8")):null}function B(t){return"number"==typeof t.priority&&(t.priority>=1e3||t.priority<0)}let L=null;function T(){if(null!==L)return L;const t=[p(A,"..","..","..","codex-base-instructions.md"),p(A,"..","..","codex-base-instructions.md"),p(A,"codex-base-instructions.md")],o=t.find(t=>e(t));if(!o)throw new Error(`codex-base-instructions.md not found, searched: ${t.join(", ")}`);return L=n(o,"utf-8"),L}function D(t){return"number"==typeof t&&Number.isFinite(t)&&t>0?t:void 0}function G(t,e,o,n){const i=o?t:Math.min(t,e);return{window:i,compact:h(i,n)}}function I(t,e,o,n){const{standardContextWindow:i}=x();let s=D(t.contextWindow)??i;n&&t.id.startsWith("claude-")&&(s=n.has(t.id)?Math.max(s,1e6):Math.min(s,2e5));const{window:r,compact:l}=G(s,i,o,D(t.autoCompactTokens));return{slug:t.id,display_name:t.name||y(t.id),description:w(t.description,{millionContext:r>=1e6})??null,supported_reasoning_levels:[],shell_type:"unified_exec",visibility:"list",supported_in_api:!0,priority:e,additional_speed_tiers:[],service_tiers:[],availability_nux:null,upgrade:null,model_messages:{instructions_template:T()},base_instructions:T(),supports_reasoning_summaries:!0,supports_parallel_tool_calls:!1,prefer_websockets:!1,include_skills_usage_instructions:!1,include_plugin_usage_instructions:!1,include_apps_usage_instructions:!1,default_reasoning_summary:"auto",support_verbosity:!1,default_verbosity:null,apply_patch_tool_type:null,web_search_tool_type:"text",truncation_policy:{mode:"bytes",limit:1e4},supports_image_detail_original:!1,context_window:r,max_context_window:r,auto_compact_token_limit:l,effective_context_window_percent:95,experimental_supported_tools:[],input_modalities:["text","image"],supports_search_tool:!1,supports_experimental_context:!1,use_responses_lite:!1,supports_reasoning_effort_updates:!1,node_repl_auto_review_required:!1,node_repl_disabled:!1}}const F={supports_parallel_tool_calls:!0,supports_reasoning_summaries:!0};export function fillFromOlderEntries(t,e){const o=new Map(e.map(t=>[t.slug,t])),n=new Map;for(const t of e)for(const[e,o]of Object.entries(t))n.has(e)||n.set(e,o);return t.map(t=>{const e=o.get(t.slug),i={...t};for(const[t,o]of n)t in i||(i[t]=e&&t in e?e[t]:o);return i})}function R(t,e,o){if("list"!==(t=function(t){const e=Object.keys(F).filter(e=>!(e in t));return 0===e.length?t:{...t,...Object.fromEntries(e.map(t=>[t,F[t]]))}}(t)).visibility)return t;const n=D(t.context_window);if(!n)return t;const i=D(t.max_context_window)??n,s=o?Math.min(D(e?.contextWindow)??i,i):n,{window:r,compact:l}=G(s,n,!0,D(e?.autoCompactTokens));return{...t,context_window:r,auto_compact_token_limit:l}}function X(t){return/^gpt-(\d+(?:\.\d+)?)(?:-|$)/.exec(t)?.[1]}function H(t,e){if(!t.startsWith("gpt-"))return;let o,n=4;for(const i of e){const e="string"==typeof i.slug?i.slug:"";if(!e.startsWith("gpt-")||"list"!==i.visibility)continue;let s=0;for(;s<e.length&&e[s]===t[s];)s++;s>n&&(o=i,n=s)}if(o||!X(t))return o;const i=t.slice(t.lastIndexOf("-")),s=e.filter(t=>"list"===t.visibility&&"string"==typeof t.slug&&X(t.slug));return s.find(t=>String(t.slug).endsWith(i))??s[0]}function N(t,e,o,n){return R({...t,...Object.fromEntries(["slug","display_name","description","priority"].map(t=>[t,e[t]])),upgrade:null,availability_nux:null},o,n)}export function buildCodexCatalog(t){const{bundled:e,specs:o,oneMillion:n,selectedModel:i}=t,s=t.claudeOneMillion?new Set(t.claudeOneMillion):void 0,r=t.keyModels?new Set(t.keyModels):null,l=new Set(t.gatewayAvailable),c=t=>!r||r.has(t)||t===i,u=t=>l.has(t)||t===i,a=new Map(o.map(t=>[t.id,t])),d=t.chosenGpt?new Set(t.chosenGpt):null,p=t=>!!d&&t.startsWith("gpt-")&&!d.has(t)&&t!==i,f=[],m=new Set;for(const t of e){const e="string"==typeof t.slug?t.slug:"";e&&!m.has(e)&&("list"!==t.visibility||c(e)&&!p(e))&&(m.add(e),f.push(R(t,a.get(e),n)))}const _=[...o];i&&!a.has(i)&&_.push({id:i});const x=e.filter(t=>"list"===t.visibility).map(t=>X(String(t.slug))??"0").reduce((t,e)=>g(e,t)>0?e:t,"0"),h=t=>g(X(t)??"0",x)>0;let w=-_.length;const y=function(t){const e=new Map;for(const o of t){const t=/^claude-([a-z]+)-(.+)$/.exec(o);if(!t)continue;const n=t[2].split("-").filter(t=>/^\d{1,2}$/.test(t)).join("."),i=e.get(t[1]);(!i||g(n,i.version)>0)&&e.set(t[1],{id:o,version:n})}return new Set([...e.values()].map(t=>t.id))}(_.map(t=>t.id).filter(u));for(const t of _){if(m.has(t.id)||!u(t.id))continue;if(t.id.startsWith("claude-")&&!y.has(t.id)&&t.id!==i)continue;m.add(t.id);const o=I(t,h(t.id)?w++:1e3+f.length,n,s),r=H(t.id,e);f.push(r?N(r,o,t,n):o)}return{models:f}}
|
package/dist/models.json
CHANGED
|
@@ -150,36 +150,31 @@
|
|
|
150
150
|
"id": "gpt-6-astra",
|
|
151
151
|
"name": "GPT-6 Astra",
|
|
152
152
|
"description": "105 万上下文 | 编码 / 计算机操作",
|
|
153
|
-
"contextWindow": 1050000
|
|
154
|
-
"codex": false
|
|
153
|
+
"contextWindow": 1050000
|
|
155
154
|
},
|
|
156
155
|
{
|
|
157
156
|
"id": "gpt-6.1-sol",
|
|
158
157
|
"name": "GPT-6.1 Sol",
|
|
159
158
|
"description": "105 万上下文 | 工具调用 | 结构化输出",
|
|
160
|
-
"contextWindow": 1050000
|
|
161
|
-
"codex": false
|
|
159
|
+
"contextWindow": 1050000
|
|
162
160
|
},
|
|
163
161
|
{
|
|
164
162
|
"id": "gpt-6-sol",
|
|
165
163
|
"name": "GPT-6 Sol",
|
|
166
164
|
"description": "105 万上下文 | 复杂编程与 Agent 工作流",
|
|
167
|
-
"contextWindow": 1050000
|
|
168
|
-
"codex": false
|
|
165
|
+
"contextWindow": 1050000
|
|
169
166
|
},
|
|
170
167
|
{
|
|
171
168
|
"id": "gpt-6-luna",
|
|
172
169
|
"name": "GPT-6 Luna",
|
|
173
170
|
"contextWindow": 1050000,
|
|
174
|
-
"claudeCode": false
|
|
175
|
-
"codex": false
|
|
171
|
+
"claudeCode": false
|
|
176
172
|
},
|
|
177
173
|
{
|
|
178
174
|
"id": "gpt-5.6-sol",
|
|
179
175
|
"name": "GPT-5.6 Sol",
|
|
180
176
|
"description": "105 万上下文 | 前沿档",
|
|
181
177
|
"contextWindow": 1050000,
|
|
182
|
-
"codex": false,
|
|
183
178
|
"claudeCode": false
|
|
184
179
|
},
|
|
185
180
|
{
|
|
@@ -187,7 +182,6 @@
|
|
|
187
182
|
"name": "GPT-5.6 Terra",
|
|
188
183
|
"description": "105 万上下文 | 均衡生产档",
|
|
189
184
|
"contextWindow": 1050000,
|
|
190
|
-
"codex": false,
|
|
191
185
|
"claudeCode": false
|
|
192
186
|
},
|
|
193
187
|
{
|
|
@@ -195,7 +189,6 @@
|
|
|
195
189
|
"name": "GPT-5.6 Luna",
|
|
196
190
|
"description": "105 万上下文 | 大批量低成本档",
|
|
197
191
|
"contextWindow": 1050000,
|
|
198
|
-
"codex": false,
|
|
199
192
|
"claudeCode": false
|
|
200
193
|
},
|
|
201
194
|
{
|
package/models.json
CHANGED
|
@@ -150,36 +150,31 @@
|
|
|
150
150
|
"id": "gpt-6-astra",
|
|
151
151
|
"name": "GPT-6 Astra",
|
|
152
152
|
"description": "105 万上下文 | 编码 / 计算机操作",
|
|
153
|
-
"contextWindow": 1050000
|
|
154
|
-
"codex": false
|
|
153
|
+
"contextWindow": 1050000
|
|
155
154
|
},
|
|
156
155
|
{
|
|
157
156
|
"id": "gpt-6.1-sol",
|
|
158
157
|
"name": "GPT-6.1 Sol",
|
|
159
158
|
"description": "105 万上下文 | 工具调用 | 结构化输出",
|
|
160
|
-
"contextWindow": 1050000
|
|
161
|
-
"codex": false
|
|
159
|
+
"contextWindow": 1050000
|
|
162
160
|
},
|
|
163
161
|
{
|
|
164
162
|
"id": "gpt-6-sol",
|
|
165
163
|
"name": "GPT-6 Sol",
|
|
166
164
|
"description": "105 万上下文 | 复杂编程与 Agent 工作流",
|
|
167
|
-
"contextWindow": 1050000
|
|
168
|
-
"codex": false
|
|
165
|
+
"contextWindow": 1050000
|
|
169
166
|
},
|
|
170
167
|
{
|
|
171
168
|
"id": "gpt-6-luna",
|
|
172
169
|
"name": "GPT-6 Luna",
|
|
173
170
|
"contextWindow": 1050000,
|
|
174
|
-
"claudeCode": false
|
|
175
|
-
"codex": false
|
|
171
|
+
"claudeCode": false
|
|
176
172
|
},
|
|
177
173
|
{
|
|
178
174
|
"id": "gpt-5.6-sol",
|
|
179
175
|
"name": "GPT-5.6 Sol",
|
|
180
176
|
"description": "105 万上下文 | 前沿档",
|
|
181
177
|
"contextWindow": 1050000,
|
|
182
|
-
"codex": false,
|
|
183
178
|
"claudeCode": false
|
|
184
179
|
},
|
|
185
180
|
{
|
|
@@ -187,7 +182,6 @@
|
|
|
187
182
|
"name": "GPT-5.6 Terra",
|
|
188
183
|
"description": "105 万上下文 | 均衡生产档",
|
|
189
184
|
"contextWindow": 1050000,
|
|
190
|
-
"codex": false,
|
|
191
185
|
"claudeCode": false
|
|
192
186
|
},
|
|
193
187
|
{
|
|
@@ -195,7 +189,6 @@
|
|
|
195
189
|
"name": "GPT-5.6 Luna",
|
|
196
190
|
"description": "105 万上下文 | 大批量低成本档",
|
|
197
191
|
"contextWindow": 1050000,
|
|
198
|
-
"codex": false,
|
|
199
192
|
"claudeCode": false
|
|
200
193
|
},
|
|
201
194
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.170",
|
|
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",
|