@vibeapi/cli 0.0.164 → 0.0.165
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 +1569 -67
- package/dist/client-config.snapshot.json +1569 -67
- package/dist/lib/tools/dsh.js +1 -1
- package/dist/locales/en_US.json +0 -1
- package/dist/locales/zh_CN.json +0 -1
- package/package.json +1 -1
package/dist/lib/tools/dsh.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,readFileSync as t}from"fs";import{join as r}from"path";import*as
|
|
1
|
+
import{existsSync as e,readFileSync as t}from"fs";import{join as r}from"path";import*as n from"js-yaml";import{logger as o}from"../../utils/logger.js";import{API_KEY_ENV as s,BRAND_NAME as i,PROVIDER_KEY as a}from"../brand.js";import{i18n as d}from"../i18n.js";import{modelFamily as l,prettyModelName as c,vendorNames as f}from"../gateway-models.js";import{getToolDefaultModel as p,getToolMenuModels as m}from"../model-registry.js";import{atomicWriteFile as u,backupBeforeWrite as h}from"./backup.js";import{bareModelId as g,menuSpecs as y,usesResponses as v}from"./codebuddy-models.js";import{pickModel as b,toolHome as w,withV1 as k}from"./types.js";const x=()=>process.env.DSH_HOME?.trim()||r(w(),".dsh"),A=e=>r(x(),"profiles",e,"cordis.patch.yml"),j=()=>r(x(),".credentials.yaml"),E=["web","desktop"],C="llm-pi-ai",O="agent-default-model",P=a,$=`${a}-gpt`,_=`${a}-claude`,M=["off","minimal","low","medium","high","xhigh","max"],S=e=>!!e&&"object"==typeof e&&!Array.isArray(e),D=e=>e===P||e.startsWith(`${a}-`);class L{source;constructor(e){this.source=e}}const H=n.DEFAULT_SCHEMA.extend(new n.Type("tag:yaml.org,2002:js",{kind:"scalar",construct:e=>new L(e??""),instanceOf:L,represent:e=>e.source}));function T(r){if(!e(r))return{entries:[],header:""};const o=t(r,"utf-8"),s=o.match(/^(?:#.*\r?\n)*/)?.[0]??"",i=n.load(o,{schema:H});if(null==i)return{entries:[],header:s};if(!Array.isArray(i))throw new Error(`Existing ${r} must hold a YAML list`);return{entries:i,header:s}}function W(r,o){const s=o.header+n.dump(o.entries,{schema:H,lineWidth:-1,noRefs:!0,sortKeys:!1});e(r)&&t(r,"utf-8")===s||(h(r),u(r,s))}function K(e,t){let r=e.find(e=>e.id===t);return r||(r={id:t},e.push(r)),S(r.config)||(r.config={}),r.config}function N(e){const t=e.find(e=>e.id===C&&S(e.config))?.config;return S(t?.providers)?t.providers:{}}function R(){if(!e(j()))return{version:1,refs:{}};const r=n.load(t(j(),"utf-8"));if(null==r)return{version:1,refs:{}};if(!S(r))throw new Error(`Existing ${j()} must hold a YAML mapping`);return"version"in r?S(r.refs)?r:{...r,refs:{}}:{version:1,refs:r}}function U(e){h(j()),u(j(),n.dump(e,{lineWidth:-1,sortKeys:!1}),384)}function F(e){const t=e.capabilities??{},r={id:e.id,name:e.name??c(e.id)},n=t.contextWindow??e.contextWindow;n&&(r.contextWindow=n);const o=t.maxOutput??e.maxOutputTokens;if(o&&(r.maxTokens=o),t.vision&&(r.input=["text","image"]),e.id.startsWith("deepseek-"))r.compat={thinkingFormat:"deepseek"},r.reasoningEfforts={off:null,high:"high",max:"max"};else if(t.reasoning&&t.reasoningEfforts){const e=t.reasoningEfforts.filter(e=>M.includes(e)&&"off"!==e);e.length>0&&(r.reasoningEfforts=Object.fromEntries(e.map(e=>[e,e])))}return r}function Y(e){return"claude"===l(e.id)?_:v(e)?$:P}function G(e,t){const r=k(t),n={apiKeyEnv:s},o={[P]:{displayName:i,...n,api:"openai-completions",baseURL:r,compat:{supportsDeveloperRole:!1,maxTokensField:"max_tokens"}},[$]:{displayName:`${i} GPT`,...n,api:"openai-responses",baseURL:r},[_]:{displayName:`${i} Claude`,...n,api:"anthropic-messages",baseURL:r.replace(/\/v\d+$/,"")}},a={};for(const[t,r]of Object.entries(o)){const n=e.filter(e=>Y(e)===t).map(F);n.length>0&&(a[t]={...r,models:n})}return a}const I=e=>g(b(e.models,p("dsh"))),q=(e,t)=>y(e,t,m("dsh"));function z(e,t,r,n=T(e)){const o=K(n.entries,C),s=Object.entries(S(o.providers)?o.providers:{}).filter(([e])=>!D(e));o.providers={...Object.fromEntries(s),...G(t,r)},W(e,n)}const B=e=>{const t=e.find(e=>e.id===O)?.config;return!S(t)||"string"!=typeof t.provider||D(t.provider)?null:`${t.provider}/${String(t.model)}`};let J=null;export const dshAdapter={name:"dsh",displayName:"DeepSeek Harness",command:"dsh",installCommand:"npx @deepseek-ai/dsh web",get configPath(){return A("web")},wantsModelCatalog:!0,isInstalled(){if(e(x()))return!0;if("darwin"===process.platform)return["/Applications/DeepSeek Harness.app",r(w(),"Applications","DeepSeek Harness.app")].some(t=>e(t));const t="win32"===process.platform?process.env.LOCALAPPDATA:void 0;return!!t&&e(r(t,"Programs","DeepSeek Harness"))},loadPrivateConfig(e){const t=q(e.catalog,I(e));if(0===t.length)throw new Error(d.t("tools.dsh.no_models"));const r=t.find(t=>t.id===I(e))??t[0],n=[];for(const o of E){const s=A(o),i=T(s),a=B(i.entries);a&&!n.includes(a)&&n.push(a);const d=K(i.entries,O);d.provider=Y(r),d.model=r.id,delete d.reasoningEffort,z(s,t,e.baseUrl,i)}const o=R();o.refs={...o.refs,[s]:e.apiKey},U(o),J={count:t.length,vendors:f(t.map(e=>e.id)),replaced:n}},unloadPrivateConfig(){try{for(const t of E){const r=A(t);if(!e(r))continue;const n=T(r),o=N(n.entries);for(const e of Object.keys(o))D(e)&&delete o[e];const s=n.entries.find(e=>e.id===O)?.config;S(s)&&"string"==typeof s.provider&&D(s.provider)&&(n.entries=n.entries.filter(e=>e.id!==O)),W(r,n)}const t=R(),r=t.refs;s in r&&(delete r[s],U(t))}catch(e){o.logError("dshAdapter.unloadPrivateConfig",e)}},detectCurrentConfig(){try{const e=R().refs[s];return{apiKey:"string"==typeof e&&e?e:null}}catch{return{apiKey:null}}},listedModels(){try{const e=Object.entries(N(T(A("web")).entries)).filter(([e])=>D(e));return 0===e.length?null:e.flatMap(([,e])=>S(e)&&Array.isArray(e.models)?e.models:[]).map(e=>String(e.id))}catch{return null}},refreshModelMenu(e){const t=q(e.catalog,I(e));if(0!==t.length)for(const r of E)z(A(r),t,e.baseUrl)},planNotes(){try{const e=B(T(A("web")).entries);return e?[d.t("tools.dsh.replaces_default",{model:e})]:[]}catch{return[]}},applyNotes(){if(!J)return[];const e=[{kind:"summary",text:d.t("tools.dsh.menu_written",{count:String(J.count),list:J.vendors.join(d.t("tools.codebuddy.list_separator"))})},{kind:"action",text:d.t("tools.dsh.pick_in_app")}];for(const t of J.replaced)e.push({kind:"detail",text:d.t("tools.dsh.replaced_default",{model:t})});return e},backupPaths:()=>[...E.map(A),j()],forceResetPaths:()=>E.map(A),getConfig(){try{return T(A("web")).entries}catch(e){return o.logError("dshAdapter.getConfig",e),null}}};
|
package/dist/locales/en_US.json
CHANGED
|
@@ -462,7 +462,6 @@
|
|
|
462
462
|
"dsh": {
|
|
463
463
|
"menu_written": "Wrote {{count}} models ({{list}})",
|
|
464
464
|
"pick_in_app": "Open DeepSeek Harness and pick a model from the menu under the input box; no restart needed",
|
|
465
|
-
"desktop_later": "Start the DeepSeek Harness desktop app once, then run `{{cli}} config dsh --yes` to configure it",
|
|
466
465
|
"replaces_default": "Replaces the default model {{model}}",
|
|
467
466
|
"replaced_default": "Replaced the default model {{model}} (to undo, run `{{cli}} config dsh restore`)",
|
|
468
467
|
"no_models": "Cannot configure DeepSeek Harness: this API key has no usable models"
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -462,7 +462,6 @@
|
|
|
462
462
|
"dsh": {
|
|
463
463
|
"menu_written": "已写入 {{count}} 个模型({{list}})",
|
|
464
464
|
"pick_in_app": "打开 DeepSeek Harness,在输入框下方的模型菜单里选择;已打开的不用重启",
|
|
465
|
-
"desktop_later": "DeepSeek Harness 桌面端启动过一次后,再运行 `{{cli}} config dsh --yes` 配置它",
|
|
466
465
|
"replaces_default": "将替换默认模型 {{model}}",
|
|
467
466
|
"replaced_default": "已替换默认模型 {{model}}(恢复运行 `{{cli}} config dsh restore`)",
|
|
468
467
|
"no_models": "无法配置 DeepSeek Harness:这个令牌没有可用的模型"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.165",
|
|
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",
|