zcode-pro 0.20.1 → 0.20.2
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/package.json +1 -1
- package/src/host/helper.mjs +17 -2
package/package.json
CHANGED
package/src/host/helper.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { reorderWorkspaceTasks, reorderGroupMembers } from './taskOrder.mjs';
|
|
|
17
17
|
import { webdavRequest, webdavPutWithMkcol, webdavHttpText, parseWebdavListing, findCurl } from './webdav.mjs';
|
|
18
18
|
import { resolveZcodeExecutable } from './paths.mjs';
|
|
19
19
|
|
|
20
|
-
const VERSION = '0.20.
|
|
20
|
+
const VERSION = '0.20.2';
|
|
21
21
|
|
|
22
22
|
// 全局提示词固定在用户主目录:官方加载器按 HOME/USERPROFILE 拼 .zcode/AGENTS.md,
|
|
23
23
|
// 不读 ZCODE_DATA_BASE_DIR(数据根迁走时全局指令仍在原位)。
|
|
@@ -2006,6 +2006,17 @@ function titleGenProviderDisplayName(id, name, planKinds = {}) {
|
|
|
2006
2006
|
return (name && String(name).trim()) || id;
|
|
2007
2007
|
}
|
|
2008
2008
|
|
|
2009
|
+
// headroom 压缩路由(/hr-join)注册表:供应商接入后 baseUrl 统一指向 127.0.0.1:8787,
|
|
2010
|
+
// 地址不再带协议线索,真实格式(anthropic/openai)记录在 ~/.zcode/headroom.json 的
|
|
2011
|
+
// providers 里;按供应商 id 查,查不到返回空串。同一查表逻辑在 zcode-plugins 的
|
|
2012
|
+
// vision-lib.mjs(headroomFormatOf)与 hr-join 接入规则各有一份,改 providers
|
|
2013
|
+
// 结构时三处同改
|
|
2014
|
+
function headroomFormatOf(headroomProviders, providerId) {
|
|
2015
|
+
const hit = (headroomProviders || []).find((p) => p && p.id === providerId);
|
|
2016
|
+
const f = String(hit?.format || '').toLowerCase();
|
|
2017
|
+
return f === 'anthropic' || f === 'openai' ? f : '';
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2009
2020
|
// 供应商条目(智能起名与视觉代理共用),列表范围与 ZCode 界面的供应商列表
|
|
2010
2021
|
// 保持一致:
|
|
2011
2022
|
// - 内置套餐(builtin:*):有地址、密钥才列出(无密钥的 helper 无法在会话外
|
|
@@ -2014,13 +2025,16 @@ function titleGenProviderDisplayName(id, name, planKinds = {}) {
|
|
|
2014
2025
|
// 自定义列表就来自它),provider 表里不在其中的残留条目(已弃用的中转等)
|
|
2015
2026
|
// 不列出;
|
|
2016
2027
|
// - 协议:api.type / kind 缺失时按地址推断(含 anthropic → anthropic,含
|
|
2017
|
-
// openai 或以 /v\d 结尾 → openai
|
|
2028
|
+
// openai 或以 /v\d 结尾 → openai);地址推不出(典型:指向 headroom 压缩路由
|
|
2029
|
+
// 127.0.0.1:8787)时查上面的注册表,仍没有才放弃该条目。
|
|
2018
2030
|
// 两张来源表同 id 合并(模型并集、原始名收进别名)。models 为该供应商的
|
|
2019
2031
|
// 可选模型(下拉用,可为空)。导出以便测试
|
|
2020
2032
|
export function listTitleGenProviders() {
|
|
2021
2033
|
const out = [];
|
|
2022
2034
|
const byId = new Map();
|
|
2023
2035
|
const planKinds = codingPlanKindByFamily();
|
|
2036
|
+
// 注册表读一次,供下方各条目的协议判定兜底复用(文件不存在时为空数组)
|
|
2037
|
+
const headroomProviders = (readJsonFile(join(homedir(), '.zcode', 'headroom.json')) || {}).providers || [];
|
|
2024
2038
|
const add = (id, { name, aliases = [], kind, baseUrl, apiKey, models = [] }) => {
|
|
2025
2039
|
baseUrl = typeof baseUrl === 'string' ? baseUrl.trim() : '';
|
|
2026
2040
|
apiKey = typeof apiKey === 'string' ? apiKey.trim() : '';
|
|
@@ -2028,6 +2042,7 @@ export function listTitleGenProviders() {
|
|
|
2028
2042
|
let format = /anthropic/i.test(String(kind)) ? 'anthropic' : /openai/i.test(String(kind)) ? 'openai' : '';
|
|
2029
2043
|
if (!format) format = /anthropic/i.test(baseUrl) ? 'anthropic'
|
|
2030
2044
|
: (/openai/i.test(baseUrl) || /\/v\d+$/.test(baseUrl)) ? 'openai' : '';
|
|
2045
|
+
if (!format) format = headroomFormatOf(headroomProviders, id);
|
|
2031
2046
|
if (!format) return;
|
|
2032
2047
|
models = models.filter(Boolean);
|
|
2033
2048
|
const known = byId.get(id);
|