@vibeapi/api-helper 0.0.92 → 0.0.93
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/tools/antigravity.js +1 -1
- package/dist/locales/en_US.json +1 -2
- package/dist/locales/zh_CN.json +1 -2
- package/dist/models.json +1 -1
- package/models.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{chmodSync as t,existsSync as e,readFileSync as r}from"fs";import{join as n}from"path";import{i18n as o}from"../i18n.js";import{prettyModelName as i}from"../gateway-models.js";import{getAgyRules as a}from"../model-registry.js";import{logger as l}from"../../utils/logger.js";import{readPersistentEnvFile as s,removePersistentEnv as c,writePersistentEnv as u}from"../persistent-env.js";import{backupBeforeWrite as p,atomicWriteFile as d}from"./backup.js";import{mirrorInstallCommand as g}from"./tool-installs.js";import{toolHome as m}from"./types.js";const y="agy",f="AGY_LLM_GATEWAY_MODELS",v=["GEMINI_API_KEY","GOOGLE_GEMINI_BASE_URL","AGY_LLM_GATEWAY_URL","AGY_LLM_GATEWAY_API_KEY"],A="gemini",_=()=>n(m(),".gemini","antigravity-cli"),h=()=>n(_(),"settings.json"),E=()=>n(_(),"vibeapi.env"),j=()=>n(m(),".antigravity","settings.json"),b="https://cnb.cool/vibeapi/agy/-/releases/latest/download",w={command:"agy",native:{binDir:"win32"===process.platform?["AppData","Local","agy","bin"]:[".local","bin"],updateArgs:["update"],dataDirs:[]},mirrorScript:{sh:`${b}/install.sh`,ps1:`${b}/install.ps1`}};function I(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function K(t,n){if(!e(t))return{};const o=r(t,"utf-8");if(!o.trim())return{};try{const t=JSON.parse(o);if(!I(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 P=()=>K(h(),"~/.gemini/antigravity-cli/settings.json"),G=()=>K(j(),"~/.antigravity/settings.json");function L(e,r,n){p(e),d(e,JSON.stringify(r,null,2)+"\n",n),void 0!==n&&t(e,n)}function M(t){return(t||"").replace(/\/+$/,"").replace(/\/v1(beta)?$/,"")}function C(t){const e=a().gatewayModels,r=t?e.filter(e=>t.models.includes(e)):[];return r.length>0?r:e}const N=t=>i(t.replace(/-preview$/,""));function S(t){const e=t.gateway;return I(e)&&!0===e.enabled&&"string"==typeof e.apiKey&&e.apiKey.trim()&&"string"==typeof e.url?{url:e.url,apiKey:e.apiKey}:null}function Y(t){const e=t.models;return I(e)&&Array.isArray(e.list)?e.list.map(t=>I(t)&&"string"==typeof t.modelId?t.modelId:"").filter(Boolean):[]}function $(){try{if(P().modelProvider!==A)return null}catch{return null}const t=s(E()),e=t.GEMINI_API_KEY;return e&&e.trim()?{apiKey:e,url:t.GOOGLE_GEMINI_BASE_URL??""}:null}function k(t,e,r){const n=P(),o=G();o.gateway={...I(o.gateway)?o.gateway:{},enabled:!0,url:e,apiKey:t,wireProtocol:"genai"},o.models={...I(o.models)?o.models:{},defaultModelId:r[0],list:r.map(t=>({modelId:t,displayName:N(t),supportsThinking:!0}))},L(j(),o,384),v.some(t=>void 0!==s(E())[t])&&c(y,E(),v);const i=u(y,E(),{[f]:r.join(",")}).rcFiles;for(const t of v)delete process.env[t];return n.modelProvider===A&&(delete n.modelProvider,L(h(),n)),i}let O=null,x=null;export const antigravityAdapter={name:"agy",displayName:"Antigravity CLI",command:"agy",installCommand:g(w),installSpec:w,configPath:j(),wantsModelCatalog:!0,loadPrivateConfig(t){P(),G();const e=C(t.catalog);O=k(t.apiKey,M(t.baseUrl),e),x=e},unloadPrivateConfig(){try{const t=G();S(t)&&(delete t.gateway,delete t.models,L(j(),t,384))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}try{const t=P();t.modelProvider===A&&(delete t.modelProvider,L(h(),t))}catch(t){l.logError("antigravityAdapter.unloadPrivateConfig",t)}c(y,E(),[f,...v])},detectCurrentConfig(){try{const t=S(G());if(t)return{apiKey:t.apiKey}}catch{return{apiKey:null}}return{apiKey:$()?.apiKey??null}},listedModels(){try{const t=G();if(S(t))return Y(t)}catch{return null}return $()?[]:null},refreshModelMenu(t){const e=G(),r=S(e)??$();if(!r)return;const n=C(t.catalog),o=r.url||M(t.baseUrl);null!==S(e)&&Y(e).join(",")===n.join(",")&&s(E())[f]===n.join(",")&&null===$()||k(r.apiKey,o,n)},getConfig(){try{return G()}catch(t){return l.logError("antigravityAdapter.getConfig",t),null}},applyNotes(){const t=[];if(x&&x.length>0){const e=x.map(N);t.push({kind:"summary",text:o.t("tools.agy.menu_written",{count:String(e.length),list:e.join(o.t("tools.grok.list_separator")),default:e[0]})})}return null===O||t.push({kind:"action",text:o.t("tools.agy.effort_after_reopen")}),t},backupPaths:()=>[j(),h(),E()],forceResetPaths:()=>[E()]};
|
package/dist/locales/en_US.json
CHANGED
|
@@ -367,8 +367,7 @@
|
|
|
367
367
|
"version_outdated": "version {{current}} is too old (needs {{min}} or later); upgrade with {{upgrade}}",
|
|
368
368
|
"agy": {
|
|
369
369
|
"menu_written": "{{count}} models in the menu ({{list}}), default {{default}}",
|
|
370
|
-
"
|
|
371
|
-
"reopen_terminal_windows": "Key and address were saved as user environment variables; reopen the terminal before running agy"
|
|
370
|
+
"effort_after_reopen": "agy works right away; in a new terminal the model menu also offers thinking levels (low / medium / high)"
|
|
372
371
|
},
|
|
373
372
|
"grok": {
|
|
374
373
|
"menu_written": "{{count}} models in the menu ({{list}}), default {{default}}",
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -367,8 +367,7 @@
|
|
|
367
367
|
"version_outdated": "版本 {{current}} 过旧,需要 {{min}} 及以上,运行 {{upgrade}} 升级",
|
|
368
368
|
"agy": {
|
|
369
369
|
"menu_written": "模型菜单 {{count}} 个({{list}}),默认 {{default}}",
|
|
370
|
-
"
|
|
371
|
-
"reopen_terminal_windows": "Key 与地址已写入用户环境变量,重新打开终端再运行 agy"
|
|
370
|
+
"effort_after_reopen": "现在就能运行 agy;新开的终端里模型菜单还会带思考档位(低 / 中 / 高)"
|
|
372
371
|
},
|
|
373
372
|
"grok": {
|
|
374
373
|
"menu_written": "模型菜单 {{count}} 个({{list}}),默认 {{default}}",
|
package/dist/models.json
CHANGED
package/models.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/api-helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.93",
|
|
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",
|