@xhscopy-ai/cli 0.0.195 → 0.0.196
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.
|
@@ -1068,8 +1068,8 @@
|
|
|
1068
1068
|
"context_window": 1000000,
|
|
1069
1069
|
"description": "100 万上下文 | 均衡档",
|
|
1070
1070
|
"endpoint_types": [
|
|
1071
|
-
"
|
|
1072
|
-
"
|
|
1071
|
+
"openai",
|
|
1072
|
+
"anthropic"
|
|
1073
1073
|
],
|
|
1074
1074
|
"group": "",
|
|
1075
1075
|
"group_name": "",
|
|
@@ -2039,8 +2039,8 @@
|
|
|
2039
2039
|
"context_window": 1000000,
|
|
2040
2040
|
"description": "100 万上下文 | 均衡档",
|
|
2041
2041
|
"endpoint_types": [
|
|
2042
|
-
"
|
|
2043
|
-
"
|
|
2042
|
+
"openai",
|
|
2043
|
+
"anthropic"
|
|
2044
2044
|
],
|
|
2045
2045
|
"group": "",
|
|
2046
2046
|
"group_name": "",
|
|
@@ -1068,8 +1068,8 @@
|
|
|
1068
1068
|
"context_window": 1000000,
|
|
1069
1069
|
"description": "100 万上下文 | 均衡档",
|
|
1070
1070
|
"endpoint_types": [
|
|
1071
|
-
"
|
|
1072
|
-
"
|
|
1071
|
+
"openai",
|
|
1072
|
+
"anthropic"
|
|
1073
1073
|
],
|
|
1074
1074
|
"group": "",
|
|
1075
1075
|
"group_name": "",
|
|
@@ -2039,8 +2039,8 @@
|
|
|
2039
2039
|
"context_window": 1000000,
|
|
2040
2040
|
"description": "100 万上下文 | 均衡档",
|
|
2041
2041
|
"endpoint_types": [
|
|
2042
|
-
"
|
|
2043
|
-
"
|
|
2042
|
+
"openai",
|
|
2043
|
+
"anthropic"
|
|
2044
2044
|
],
|
|
2045
2045
|
"group": "",
|
|
2046
2046
|
"group_name": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as t,randomUUID as e}from"crypto";import{existsSync as n,mkdirSync as o,readFileSync as i,renameSync as r,writeFileSync as s}from"fs";import{homedir as l}from"os";import{dirname as c,join as a}from"path";import{fileURLToPath as f}from"url";import{CLIENT_SECTION as u,MIN_CLIENT_VERSION as d}from"./gateway-protocol.js";import{brand as p,brandEnv as m}from"./brand.js";export const CLIENT_CONFIG_SCHEMA=1;const g=new Set(["haiku","sonnet","opus","reasoning","fable"]),h=/^[A-Za-z0-9._:@/\-[\]]{1,200}$/,y=/^[a-z][a-z0-9-]{0,31}$/,_=/^\d+(\.\d+){0,3}$/,b=t=>!!t&&"object"==typeof t&&!Array.isArray(t),C=t=>"number"==typeof t&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,k=/^[A-Za-z0-9._-]{1,64}$/,v=t=>{if(!Array.isArray(t))return;const e=t.filter(t=>"string"==typeof t&&k.test(t));return e.length>0?e:void 0};function E(t){if(!b(t)||"string"!=typeof t.id||!t.id.trim())return null;const e={id:t.id.trim()};if(!0===t.hidden)return{...e,hidden:!0};"string"==typeof t.name&&t.name.trim()&&(e.name=t.name.trim()),"string"==typeof t.description&&t.description.trim()&&(e.description=t.description.trim()),!0===t.recommended&&(e.recommended=!0);const n=C(t.context_window);n&&(e.contextWindow=n);const o=C(t.max_output_tokens);o&&(e.maxOutputTokens=o);const i=C(t.auto_compact_tokens);i&&(e.autoCompactTokens=i);const r=function(t){if(!b(t))return;const e={};"boolean"==typeof t.functionCall&&(e.toolCall=t.functionCall),"boolean"==typeof t.vision&&(e.vision=t.vision),"boolean"==typeof t.reasoning&&(e.reasoning=t.reasoning);const n=C(t.contextWindowTokens);n&&(e.contextWindow=n);const o=C(t.maxOutput);o&&(e.maxOutput=o);const i=v(t.reasoningEfforts);i&&(e.reasoningEfforts=i),"string"==typeof t.defaultReasoningEffort&&k.test(t.defaultReasoningEffort)&&(e.defaultReasoningEffort=t.defaultReasoningEffort);const r=v(t.functionCallEndpoints);return r&&(e.toolCallEndpoints=r),Object.keys(e).length>0?e:void 0}(t.capabilities);r&&(e.capabilities=r);const s=v(t.endpoint_types);if(s&&(e.endpointTypes=s),b(t.clients)){const n={};for(const[e,o]of Object.entries(t.clients))y.test(e)&&"boolean"==typeof o&&(n[e]=o);Object.keys(n).length>0&&(e.clients=n)}const l=t[d];return"string"==typeof l&&_.test(l)&&(e.minClientVersion=l),"number"==typeof t.rollout_percent&&t.rollout_percent>=0&&t.rollout_percent<=100&&(e.rolloutPercent=t.rollout_percent),e}function x(t,e,n,o){if(void 0===t)return{};if(!b(t))throw new Error(`${u}.${o} must be an object`);const i={};for(const[r,s]of Object.entries(t)){if(!e.test(r)||"string"!=typeof s||!n(s))throw new Error(`${u}.${o}.${r} is invalid`);i[r]=s}return i}function $(t,e,{nonEmpty:n=!1}={}){if(void 0===t)return[];if(!Array.isArray(t)||t.some(t=>"string"!=typeof t||!h.test(t)))throw new Error(`${u}.${e} must be a list of model ids`);if(n&&0===t.length)throw new Error(`${u}.${e} must not be empty`);return[...t]}function w(t,e,n){if(void 0===t)return{};if(!b(t))throw new Error(`${u}.${e} must be an object`);const o={};for(const[i,r]of Object.entries(t)){if(!g.has(i))throw new Error(`${u}.${e}.${i} is not a tier slot`);o[i]=$(r,`${e}.${i}`,{nonEmpty:n})}return o}const O=t=>(t??[]).filter(t=>!t.hidden).length;export function parseClientConfig(t,e){if(!b(t))return{config:null,problem:"not an object"};if(1!==t.schema)return{config:null,problem:`unsupported schema ${String(t.schema)}`};if(!b(t.models))return{config:null,problem:"models is not an object"};const n={};for(const[e,o]of Object.entries(t.models)){if(!Array.isArray(o))return{config:null,problem:`models.${e} is not a list`};const t=o.map(E);if(t.some(t=>null===t))return{config:null,problem:`models.${e} has a row without an id`};n[e]=t}let o,i;try{o=function(t){if(null==t)return;if(!b(t))throw new Error(`${u} must be an object`);const e={};if(void 0!==t.min_version){if("string"!=typeof t.min_version||t.min_version&&!_.test(t.min_version))throw new Error(`${u}.min_version is invalid`);t.min_version&&(e.minVersion=t.min_version)}const n=x(t.default_models,/^(haiku|sonnet|opus|reasoning|fable)$/,t=>h.test(t),"default_models");Object.keys(n).length&&(e.defaultModels=n);const o=w(t.retired_default_models,"retired_default_models",!1);Object.keys(o).length&&(e.retiredDefaultModels=o);const i=x(t.tool_defaults,y,t=>""===t||h.test(t),"tool_defaults");Object.keys(i).length&&(e.toolDefaults=i);const r=w(t.tier_chains,"tier_chains",!0);Object.keys(r).length&&(e.tierChains=r);const s=$(t.retired_models,"retired_models");s.length&&(e.retiredModels=s);const l=x(t.tool_min_versions,y,t=>""===t||_.test(t),"tool_min_versions");Object.keys(l).length&&(e.toolMinVersions=l);const c=$(t.agy_models,"agy_models");c.length&&(e.agyModels=c);const a=$(t.one_million_fallback,"one_million_fallback");return a.length&&(e.oneMillionFallback=a),!0===t.accept_shrink&&(e.acceptShrink=!0),e}(t[u])}catch(t){i=`${u} section dropped: ${t instanceof Error?t.message:String(t)}`}const r=b(t.personal)&&Array.isArray(t.personal.lists)?t.personal.lists.filter(t=>"string"==typeof t&&Array.isArray(n[t])):[],s=t[u];if(e&&(!b(s)||!0!==s.accept_shrink))for(const[t,o]of Object.entries(e.models)){if(r.includes(t))continue;const e=O(o),i=O(n[t]);if(e>0&&0===i||e>=4&&2*i<e)return{config:null,problem:`models.${t} shrank from ${e} to ${i}`}}return{config:{schema:1,revision:"string"==typeof t.revision?t.revision:"",models:n,...o?{client:o}:{},...r.length?{personal:r}:{}},problem:i}}export function serializeClientConfig(t){const e=Object.fromEntries(Object.entries(t.models).map(([t,e])=>[t,e.map(t=>{return{id:t.id,...t.hidden?{hidden:!0}:{},...t.recommended?{recommended:!0}:{},...t.name?{name:t.name}:{},...t.description?{description:t.description}:{},...t.contextWindow?{context_window:t.contextWindow}:{},...t.maxOutputTokens?{max_output_tokens:t.maxOutputTokens}:{},...t.autoCompactTokens?{auto_compact_tokens:t.autoCompactTokens}:{},...t.capabilities?{capabilities:(e=t.capabilities,{...void 0!==e.toolCall?{functionCall:e.toolCall}:{},...void 0!==e.vision?{vision:e.vision}:{},...void 0!==e.reasoning?{reasoning:e.reasoning}:{},...e.contextWindow?{contextWindowTokens:e.contextWindow}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.reasoningEfforts?{reasoningEfforts:e.reasoningEfforts}:{},...e.defaultReasoningEffort?{defaultReasoningEffort:e.defaultReasoningEffort}:{},...e.toolCallEndpoints?{functionCallEndpoints:e.toolCallEndpoints}:{}})}:{},...t.endpointTypes?{endpoint_types:t.endpointTypes}:{},...t.clients?{clients:t.clients}:{},...t.minClientVersion?{[d]:t.minClientVersion}:{},...void 0!==t.rolloutPercent?{rollout_percent:t.rolloutPercent}:{}};var e})])),n=t.client,o=n?{...n.minVersion?{min_version:n.minVersion}:{},...n.defaultModels?{default_models:n.defaultModels}:{},...n.retiredDefaultModels?{retired_default_models:n.retiredDefaultModels}:{},...n.toolDefaults?{tool_defaults:n.toolDefaults}:{},...n.tierChains?{tier_chains:n.tierChains}:{},...n.retiredModels?{retired_models:n.retiredModels}:{},...n.toolMinVersions?{tool_min_versions:n.toolMinVersions}:{},...n.agyModels?{agy_models:n.agyModels}:{},...n.oneMillionFallback?{one_million_fallback:n.oneMillionFallback}:{},...n.acceptShrink?{accept_shrink:!0}:{}}:void 0;return{schema:t.schema,revision:t.revision,models:e,...o?{[u]:o}:{},...t.personal?{personal:{lists:t.personal}}:{}}}function j(){const t=m("CONFIG_DIR")?.trim();if(t)return t;const e=m("TEST_HOME")?.trim();return a(e||l(),p().configDirName)}export const cachePath=()=>a(j(),"client-config.json");function A(t,e){o(c(t),{recursive:!0});const n=`${t}.${process.pid}.tmp`;s(n,e,"utf-8"),r(n,t)}export function readCachedClientConfig(){try{if(!n(cachePath()))return null;const t=JSON.parse(i(cachePath(),"utf-8"));if("string"!=typeof t.site||"number"!=typeof t.fetchedAt)return null;const{config:e}=parseClientConfig(t.config);return e?{site:t.site,fetchedAt:t.fetchedAt,config:e,..."string"==typeof t.keyHash?{keyHash:t.keyHash}:{},..."string"==typeof t.etag?{etag:t.etag}:{}}:null}catch{return null}}export function writeCachedClientConfig(t){A(cachePath(),JSON.stringify({site:t.site,keyHash:t.keyHash,etag:t.etag,fetchedAt:t.fetchedAt,config:serializeClientConfig(t.config)},null,2)+"\n")}let M;export function bundledClientConfig(){if("1"===m("NO_BUNDLED_CLIENT_CONFIG"))return null;if(void 0!==M)return M;M=null;const t=c(f(import.meta.url));for(const e of[a(t,"..","..","client-config.snapshot.json"),a(t,"..","client-config.snapshot.json")])try{if(!n(e))continue;M=parseClientConfig(JSON.parse(i(e,"utf-8"))).config;break}catch{}return M}let T=null;export function setClientConfigSiteResolver(t){T=t}export function currentClientConfig(){const t=readCachedClientConfig();let e=null;try{e=T?T():null}catch{e=null}if(t&&null!==e&&t.site===e)return{config:t.config,source:"cache",fetchedAt:t.fetchedAt};const n=bundledClientConfig();return n?{config:n,source:"bundled"}:null}let V=null,S=null;export function setClientIdentityForTests(t,e){V=t,S=e}export const clientVersion=()=>V??function(){try{const t=c(f(import.meta.url));for(const e of[a(t,"..","..","package.json"),a(t,"..","package.json")])if(n(e))return String(JSON.parse(i(e,"utf-8")).version??"0.0.0")}catch{}return"0.0.0"}();function N(t,e){const n=t.split(".").map(t=>parseInt(t,10)||0),o=e.split(".").map(t=>parseInt(t,10)||0);for(let t=0;t<Math.max(n.length,o.length);t++){const e=(n[t]??0)-(o[t]??0);if(e)return e}return 0}export function installId(){if(S)return S;const t=a(j(),"install-id");try{if(n(t)){const e=i(t,"utf-8").trim();if(e)return e}const o=e();return A(t,o+"\n"),o}catch{return"unknown"}}export function rolloutBucket(e){return t("sha256").update(`${installId()}:${e}`).digest().readUInt32BE(0)%100}export function isEligible(t){return!(t.minClientVersion&&N(clientVersion(),t.minClientVersion)<0||void 0!==t.rolloutPercent&&rolloutBucket(t.id)>=t.rolloutPercent)}export function eligibleLists(t){return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,e.map(t=>t.hidden||isEligible(t)?t:{id:t.id,hidden:!0})]))}export function usableClientSection(t){const e=t?.client;if(e&&!(e.minVersion&&N(clientVersion(),e.minVersion)<0))return e}
|
|
1
|
+
import{createHash as t,randomUUID as e}from"crypto";import{existsSync as n,mkdirSync as o,readFileSync as i,renameSync as r,writeFileSync as s}from"fs";import{homedir as l}from"os";import{dirname as c,join as a}from"path";import{fileURLToPath as f}from"url";import{CLIENT_SECTION as u,MIN_CLIENT_VERSION as d}from"./gateway-protocol.js";import{brand as m,brandEnv as p}from"./brand.js";export const CLIENT_CONFIG_SCHEMA=1;const g=new Set(["haiku","sonnet","opus","reasoning","fable"]),h=/^[A-Za-z0-9._:@/\-[\]]{1,200}$/,_=/^[a-z][a-z0-9-]{0,31}$/,y=/^\d+(\.\d+){0,3}$/,b=t=>!!t&&"object"==typeof t&&!Array.isArray(t),C=t=>"number"==typeof t&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,k=/^[A-Za-z0-9._-]{1,64}$/,v=t=>{if(!Array.isArray(t))return;const e=t.filter(t=>"string"==typeof t&&k.test(t));return e.length>0?e:void 0};function E(t){if(!b(t)||"string"!=typeof t.id||!t.id.trim())return null;const e={id:t.id.trim()};if(!0===t.hidden)return{...e,hidden:!0};"string"==typeof t.name&&t.name.trim()&&(e.name=t.name.trim()),"string"==typeof t.description&&t.description.trim()&&(e.description=t.description.trim()),!0===t.recommended&&(e.recommended=!0);const n=C(t.context_window);n&&(e.contextWindow=n);const o=C(t.max_output_tokens);o&&(e.maxOutputTokens=o);const i=C(t.auto_compact_tokens);i&&(e.autoCompactTokens=i);const r=function(t){if(!b(t))return;const e={};"boolean"==typeof t.functionCall&&(e.toolCall=t.functionCall),"boolean"==typeof t.vision&&(e.vision=t.vision),"boolean"==typeof t.reasoning&&(e.reasoning=t.reasoning);const n=C(t.contextWindowTokens);n&&(e.contextWindow=n);const o=C(t.maxOutput);o&&(e.maxOutput=o);const i=v(t.reasoningEfforts);i&&(e.reasoningEfforts=i),"string"==typeof t.defaultReasoningEffort&&k.test(t.defaultReasoningEffort)&&(e.defaultReasoningEffort=t.defaultReasoningEffort);const r=v(t.functionCallEndpoints);return r&&(e.toolCallEndpoints=r),Object.keys(e).length>0?e:void 0}(t.capabilities);r&&(e.capabilities=r);const s=v(t.endpoint_types);if(s&&(e.endpointTypes=s),b(t.clients)){const n={};for(const[e,o]of Object.entries(t.clients))_.test(e)&&"boolean"==typeof o&&(n[e]=o);Object.keys(n).length>0&&(e.clients=n)}const l=t[d];return"string"==typeof l&&y.test(l)&&(e.minClientVersion=l),"number"==typeof t.rollout_percent&&t.rollout_percent>=0&&t.rollout_percent<=100&&(e.rolloutPercent=t.rollout_percent),e}function $(t,e,n,o){if(void 0===t)return{};if(!b(t))throw new Error(`${u}.${o} must be an object`);const i={};for(const[r,s]of Object.entries(t)){if(!e.test(r)||"string"!=typeof s||!n(s))throw new Error(`${u}.${o}.${r} is invalid`);i[r]=s}return i}function w(t,e,{nonEmpty:n=!1}={}){if(void 0===t)return[];if(!Array.isArray(t)||t.some(t=>"string"!=typeof t||!h.test(t)))throw new Error(`${u}.${e} must be a list of model ids`);if(n&&0===t.length)throw new Error(`${u}.${e} must not be empty`);return[...t]}function x(t,e,n){if(void 0===t)return{};if(!b(t))throw new Error(`${u}.${e} must be an object`);const o={};for(const[i,r]of Object.entries(t)){if(!g.has(i))throw new Error(`${u}.${e}.${i} is not a tier slot`);o[i]=w(r,`${e}.${i}`,{nonEmpty:n})}return o}const O=t=>(t??[]).filter(t=>!t.hidden).length;export function parseClientConfig(t,e){if(!b(t))return{config:null,problem:"not an object"};if(1!==t.schema)return{config:null,problem:`unsupported schema ${String(t.schema)}`};if(!b(t.models))return{config:null,problem:"models is not an object"};const n={};for(const[e,o]of Object.entries(t.models)){if(!Array.isArray(o))return{config:null,problem:`models.${e} is not a list`};const t=o.map(E);if(t.some(t=>null===t))return{config:null,problem:`models.${e} has a row without an id`};n[e]=t}let o,i;try{o=function(t){if(null==t)return;if(!b(t))throw new Error(`${u} must be an object`);const e={};if(void 0!==t.min_version){if("string"!=typeof t.min_version||t.min_version&&!y.test(t.min_version))throw new Error(`${u}.min_version is invalid`);t.min_version&&(e.minVersion=t.min_version)}const n=$(t.default_models,/^(haiku|sonnet|opus|reasoning|fable)$/,t=>h.test(t),"default_models");Object.keys(n).length&&(e.defaultModels=n);const o=x(t.retired_default_models,"retired_default_models",!1);Object.keys(o).length&&(e.retiredDefaultModels=o);const i=$(t.tool_defaults,_,t=>""===t||h.test(t),"tool_defaults");Object.keys(i).length&&(e.toolDefaults=i);const r=x(t.tier_chains,"tier_chains",!0);Object.keys(r).length&&(e.tierChains=r);const s=w(t.retired_models,"retired_models");s.length&&(e.retiredModels=s);const l=$(t.tool_min_versions,_,t=>""===t||y.test(t),"tool_min_versions");if(Object.keys(l).length&&(e.toolMinVersions=l),void 0!==t.tool_menu_models){if(!b(t.tool_menu_models))throw new Error(`${u}.tool_menu_models must be an object`);const n={};for(const[e,o]of Object.entries(t.tool_menu_models)){if(!_.test(e))throw new Error(`${u}.tool_menu_models.${e} is invalid`);n[e]=w(o,`tool_menu_models.${e}`)}Object.keys(n).length&&(e.toolMenuModels=n)}const c=w(t.agy_models,"agy_models");c.length&&(e.agyModels=c);const a=w(t.one_million_fallback,"one_million_fallback");return a.length&&(e.oneMillionFallback=a),!0===t.accept_shrink&&(e.acceptShrink=!0),e}(t[u])}catch(t){i=`${u} section dropped: ${t instanceof Error?t.message:String(t)}`}const r=b(t.personal)&&Array.isArray(t.personal.lists)?t.personal.lists.filter(t=>"string"==typeof t&&Array.isArray(n[t])):[],s=t[u];if(e&&(!b(s)||!0!==s.accept_shrink))for(const[t,o]of Object.entries(e.models)){if(r.includes(t))continue;const e=O(o),i=O(n[t]);if(e>0&&0===i||e>=4&&2*i<e)return{config:null,problem:`models.${t} shrank from ${e} to ${i}`}}return{config:{schema:1,revision:"string"==typeof t.revision?t.revision:"",models:n,...o?{client:o}:{},...r.length?{personal:r}:{}},problem:i}}export function serializeClientConfig(t){const e=Object.fromEntries(Object.entries(t.models).map(([t,e])=>[t,e.map(t=>{return{id:t.id,...t.hidden?{hidden:!0}:{},...t.recommended?{recommended:!0}:{},...t.name?{name:t.name}:{},...t.description?{description:t.description}:{},...t.contextWindow?{context_window:t.contextWindow}:{},...t.maxOutputTokens?{max_output_tokens:t.maxOutputTokens}:{},...t.autoCompactTokens?{auto_compact_tokens:t.autoCompactTokens}:{},...t.capabilities?{capabilities:(e=t.capabilities,{...void 0!==e.toolCall?{functionCall:e.toolCall}:{},...void 0!==e.vision?{vision:e.vision}:{},...void 0!==e.reasoning?{reasoning:e.reasoning}:{},...e.contextWindow?{contextWindowTokens:e.contextWindow}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.reasoningEfforts?{reasoningEfforts:e.reasoningEfforts}:{},...e.defaultReasoningEffort?{defaultReasoningEffort:e.defaultReasoningEffort}:{},...e.toolCallEndpoints?{functionCallEndpoints:e.toolCallEndpoints}:{}})}:{},...t.endpointTypes?{endpoint_types:t.endpointTypes}:{},...t.clients?{clients:t.clients}:{},...t.minClientVersion?{[d]:t.minClientVersion}:{},...void 0!==t.rolloutPercent?{rollout_percent:t.rolloutPercent}:{}};var e})])),n=t.client,o=n?{...n.minVersion?{min_version:n.minVersion}:{},...n.defaultModels?{default_models:n.defaultModels}:{},...n.retiredDefaultModels?{retired_default_models:n.retiredDefaultModels}:{},...n.toolDefaults?{tool_defaults:n.toolDefaults}:{},...n.tierChains?{tier_chains:n.tierChains}:{},...n.retiredModels?{retired_models:n.retiredModels}:{},...n.toolMinVersions?{tool_min_versions:n.toolMinVersions}:{},...n.toolMenuModels?{tool_menu_models:n.toolMenuModels}:{},...n.agyModels?{agy_models:n.agyModels}:{},...n.oneMillionFallback?{one_million_fallback:n.oneMillionFallback}:{},...n.acceptShrink?{accept_shrink:!0}:{}}:void 0;return{schema:t.schema,revision:t.revision,models:e,...o?{[u]:o}:{},...t.personal?{personal:{lists:t.personal}}:{}}}function j(){const t=p("CONFIG_DIR")?.trim();if(t)return t;const e=p("TEST_HOME")?.trim();return a(e||l(),m().configDirName)}export const cachePath=()=>a(j(),"client-config.json");function M(t,e){o(c(t),{recursive:!0});const n=`${t}.${process.pid}.tmp`;s(n,e,"utf-8"),r(n,t)}export function readCachedClientConfig(){try{if(!n(cachePath()))return null;const t=JSON.parse(i(cachePath(),"utf-8"));if("string"!=typeof t.site||"number"!=typeof t.fetchedAt)return null;const{config:e}=parseClientConfig(t.config);return e?{site:t.site,fetchedAt:t.fetchedAt,config:e,..."string"==typeof t.keyHash?{keyHash:t.keyHash}:{},..."string"==typeof t.etag?{etag:t.etag}:{}}:null}catch{return null}}export function writeCachedClientConfig(t){M(cachePath(),JSON.stringify({site:t.site,keyHash:t.keyHash,etag:t.etag,fetchedAt:t.fetchedAt,config:serializeClientConfig(t.config)},null,2)+"\n")}let A;export function bundledClientConfig(){if("1"===p("NO_BUNDLED_CLIENT_CONFIG"))return null;if(void 0!==A)return A;A=null;const t=c(f(import.meta.url));for(const e of[a(t,"..","..","client-config.snapshot.json"),a(t,"..","client-config.snapshot.json")])try{if(!n(e))continue;A=parseClientConfig(JSON.parse(i(e,"utf-8"))).config;break}catch{}return A}let T=null;export function setClientConfigSiteResolver(t){T=t}export function currentClientConfig(){const t=readCachedClientConfig();let e=null;try{e=T?T():null}catch{e=null}if(t&&null!==e&&t.site===e)return{config:t.config,source:"cache",fetchedAt:t.fetchedAt};const n=bundledClientConfig();return n?{config:n,source:"bundled"}:null}let V=null,S=null;export function setClientIdentityForTests(t,e){V=t,S=e}export const clientVersion=()=>V??function(){try{const t=c(f(import.meta.url));for(const e of[a(t,"..","..","package.json"),a(t,"..","package.json")])if(n(e))return String(JSON.parse(i(e,"utf-8")).version??"0.0.0")}catch{}return"0.0.0"}();function N(t,e){const n=t.split(".").map(t=>parseInt(t,10)||0),o=e.split(".").map(t=>parseInt(t,10)||0);for(let t=0;t<Math.max(n.length,o.length);t++){const e=(n[t]??0)-(o[t]??0);if(e)return e}return 0}export function installId(){if(S)return S;const t=a(j(),"install-id");try{if(n(t)){const e=i(t,"utf-8").trim();if(e)return e}const o=e();return M(t,o+"\n"),o}catch{return"unknown"}}export function rolloutBucket(e){return t("sha256").update(`${installId()}:${e}`).digest().readUInt32BE(0)%100}export function isEligible(t){return!(t.minClientVersion&&N(clientVersion(),t.minClientVersion)<0||void 0!==t.rolloutPercent&&rolloutBucket(t.id)>=t.rolloutPercent)}export function eligibleLists(t){return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,e.map(t=>t.hidden||isEligible(t)?t:{id:t.id,hidden:!0})]))}export function usableClientSection(t){const e=t?.client;if(e&&!(e.minVersion&&N(clientVersion(),e.minVersion)<0))return e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,join as o}from"path";import{fileURLToPath as t}from"url";import{existsSync as l,readFileSync as n}from"fs";import{currentClientConfig as r,usableClientSection as s}from"./client-config.js";import{brand as a}from"./brand.js";const i=e(t(import.meta.url)),d=(e=[],o=[])=>[...new Set([...e,...o])];export function overlayClientSection(e,o){if(!o)return e;const t={...e.retiredDefaultModels??{}};for(const[e,l]of Object.entries(o.retiredDefaultModels??{}))t[e]=d(t[e],l);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:d(e.gatewayModels?.retired,o.retiredModels)}:e.gatewayModels,toolMinVersions:{...e.toolMinVersions??{},...o.toolMinVersions??{}},agy:o.agyModels?{...e.agy??{},gatewayModels:[...o.agyModels]}:e.agy}}let u=null;function c(){return u||(u=overlayClientSection(function(){const e=[o(i,"..","..","models.json"),o(i,"..","models.json"),o(i,"models.json")];for(const o of e)if(l(o))return JSON.parse(n(o,"utf-8"));throw new Error(`models.json not found, searched: ${e.join(", ")}`)}(),s(r()?.config))),u}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),l=o.split(".").map(e=>parseInt(e,10)||0);for(let e=0;e<Math.max(t.length,l.length);e++){const o=(t[e]??0)-(l[e]??0);if(0!==o)return o}return 0}export function getToolMinVersion(e){return c().toolMinVersions?.[e]?.trim()||null}export function reloadRegistry(){u=null}
|
|
1
|
+
import{dirname as e,join as o}from"path";import{fileURLToPath as t}from"url";import{existsSync as l,readFileSync as n}from"fs";import{currentClientConfig as r,usableClientSection as s}from"./client-config.js";import{brand as a}from"./brand.js";const i=e(t(import.meta.url)),d=(e=[],o=[])=>[...new Set([...e,...o])];export function overlayClientSection(e,o){if(!o)return e;const t={...e.retiredDefaultModels??{}};for(const[e,l]of Object.entries(o.retiredDefaultModels??{}))t[e]=d(t[e],l);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:d(e.gatewayModels?.retired,o.retiredModels)}:e.gatewayModels,toolMinVersions:{...e.toolMinVersions??{},...o.toolMinVersions??{}},toolMenuModels:{...e.toolMenuModels??{},...o.toolMenuModels??{}},agy:o.agyModels?{...e.agy??{},gatewayModels:[...o.agyModels]}:e.agy}}let u=null;function c(){return u||(u=overlayClientSection(function(){const e=[o(i,"..","..","models.json"),o(i,"..","models.json"),o(i,"models.json")];for(const o of e)if(l(o))return JSON.parse(n(o,"utf-8"));throw new Error(`models.json not found, searched: ${e.join(", ")}`)}(),s(r()?.config))),u}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),l=o.split(".").map(e=>parseInt(e,10)||0);for(let e=0;e<Math.max(t.length,l.length);e++){const o=(t[e]??0)-(l[e]??0);if(0!==o)return o}return 0}export function getToolMinVersion(e){return c().toolMinVersions?.[e]?.trim()||null}export function reloadRegistry(){u=null}
|
package/dist/models.json
CHANGED
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dsh": "deepseek-v4-pro"
|
|
25
25
|
},
|
|
26
26
|
"toolMenuModels": {
|
|
27
|
-
"workbuddy": ["gpt-6.
|
|
28
|
-
"codebuddy": ["gpt-6.
|
|
29
|
-
"dsh": ["deepseek-v4.1-flash-1017", "gpt-6.
|
|
27
|
+
"workbuddy": ["gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"],
|
|
28
|
+
"codebuddy": ["gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"],
|
|
29
|
+
"dsh": ["deepseek-v4.1-flash-1017", "gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"]
|
|
30
30
|
},
|
|
31
31
|
"presets": [
|
|
32
32
|
{
|
package/models.json
CHANGED
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dsh": "deepseek-v4-pro"
|
|
25
25
|
},
|
|
26
26
|
"toolMenuModels": {
|
|
27
|
-
"workbuddy": ["gpt-6.
|
|
28
|
-
"codebuddy": ["gpt-6.
|
|
29
|
-
"dsh": ["deepseek-v4.1-flash-1017", "gpt-6.
|
|
27
|
+
"workbuddy": ["gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"],
|
|
28
|
+
"codebuddy": ["gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"],
|
|
29
|
+
"dsh": ["deepseek-v4.1-flash-1017", "gpt-6.2-sol", "gpt-6.2-astra", "claude-sonnet-5-5"]
|
|
30
30
|
},
|
|
31
31
|
"presets": [
|
|
32
32
|
{
|