dsh-cliproxyapi-pro 1.6.0 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -1,82 +1,146 @@
1
- # Changelog
2
-
3
- All notable changes to this plugin. Versions follow [Semantic Versioning](https://semver.org/).
1
+ # 更新日志
2
+
3
+ 中文 | [English](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/CHANGELOG.en.md)
4
+
5
+ 本插件的所有重要变更。版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
6
+
7
+ ## 1.8.0 — 2026-10-22
8
+
9
+ ### 新增
10
+ - **识别生图 / 生视频模型。** 按模型目录的 `type`(`openai-image`)、输出模态,以及 CPA 自己分流到图片 / 视频接口的模型族(`grok-imagine-image*`、`gpt-image-*`、`grok-imagine-video*`、`sora-2*`)识别生成模型;只出现在 `/v1/models` 普通列表里的生成模型也会收录。生成模型不再写入对话路由,也不参与首次推荐勾选;已保存的勾选保持不变。
11
+ - **账号页新增「生成」标签。** 分组列出生图 / 生视频模型,可以用开关决定是否提供给生成功能、手动修改类型(修改后立即重新同步路由)、标记漏识别的模型;`sora-2*` 标注为 Grok 视频模型的别名;底部可设置生成文件的保存位置和视频默认时长 / 分辨率。agent 工具默认关闭,需另行打开。
12
+ - **`/cpa-image` 生成图片。** 支持 `-m` 临时指定模型(完整 id 或能唯一匹配的片段)、`--aspect` 比例、`-n` 张数;附带图片时改用 `/v1/images/edits` 改图。图片保存到会话工作目录下的保存位置(默认 `generated`),同名不覆盖。只请求该模型所属账号的 CPA,结果是链接时只下载 `data:` / HTTPS 链接且不带 Key,最多等待 3 分钟。
13
+ - **输入框旁的生成模型按钮。** 在模型选择器左侧选择本会话的生图模型(按会话保存,并作为新会话的默认选择;刚启动时会先同步一次模型目录,不用等到第一次生图才出现);生成结果显示在对话里,图片接口只提供插件为该会话记录过的文件。新增 `media-sessions.json` 和接口 `/api/dsh-cliproxyapi/media/{session,session/save,file,command}`。
14
+ - **对话里以一问一答显示生图。** `/cpa-image` 在对话中的那一行改为自定义显示(DSH 的 `conversation.chat.commandview` 插槽):右侧气泡是提示词和选项,左侧回复显示模型、生成中的占位框和计时、完成后的图片(点击放大;右键列出能打开它的应用(默认应用在前)、在文件资源管理器 / 访达 / 文件管理器中显示、复制图片、复制文件路径)、耗时和保存目录(详情里的目录和文件名可点击打开),失败时显示原因。打开和显示文件夹通过 DSH 自己的会话接口完成。其他命令仍用 DSH 默认的样式。
15
+ - **生图在后台进行。** 命令检查完就返回,输入框立即清空;生成期间插件发送 DSH 的会话状态事件,工作区把会话显示为「进行中」,结束后恢复(在其他会话时会显示「已完成」)。生成无法中途停止;插件重载或 DSH 关闭会中断它,对应的行显示「已中断」。`media-sessions.json` 增加每次生成的记录(最近 48 次),`media/command` 返回 `{ run, files }`。
16
+ - **`/cpa-video` 生成视频。** 支持 `-m` 模型、`-s` 时长(1–15 秒)、`-r` 分辨率(480p / 720p)、`--aspect` 比例,可附带一张首帧图。通过 CPA 的原生接口 `POST /v1/videos/generations` 提交,在后台查询 `GET /v1/videos/{id}`(5 / 10 / 15 秒逐步放慢),完成后经 CPA 的 `/openai/v1/videos/{id}/content` 下载到保存位置(最大 200 MiB,同名不覆盖)。视频提交后无法取消。任务保存在新文件 `media-jobs.json`,重载插件或重启 DSH 后继续等待,超过 CPA 记录凭据的 3 小时后标记为过期。对话里 `/cpa-video` 的一行同样是一问一答,显示排队 / 进度 / 保存中,完成后可直接播放(`media/file` 支持 `Range`,可拖动进度)。`/cpa-video-status` 列出本会话的视频任务。输入框旁的按钮同时提供生视频模型选择。
17
+ - **更多视频方式。** 附带图片可作为参考图(`--ref`,2 张及以上默认;1.5 最多 14 张)、首尾帧(`--first-last`)或尾帧(`--last`),字段按 xAI 文档发送。新增 `/cpa-video-edit`、`/cpa-video-extend` 和视频行上的「编辑视频…」「延长视频…」按钮:可以编辑 / 延长任意 MP4:附带视频文件、`--video <路径>`、`--url <公开链接>`(由 xAI 下载)或 `--from <命令 id>`,不写时用本会话最新生成的视频。本地视频以 base64 随请求发送(CPA 没有文件上传接口;实测编辑接口能读 20 MiB 请求体,所以最大 14 MiB);插件生成的视频约 1 小时内直接用 xAI 结果自带的短期链接(只在内存中保留,不写入文件或日志),之后改为发送已保存的文件。发送前读取 MP4 的时长,超出 xAI 限制(编辑 ≤ 8.7 秒,延长 2–15 秒)时直接提示。上游没有某个接口(HTTP 405,例如延长)时显示明确原因,并在本次加载内不再向该账号发送同类请求。
18
+ - **agent 生成工具 `generate_media`(默认关闭)。** 在「生成」标签打开后,agent 可以生图、生视频、编辑或延长视频(参数结构化,提示词原样发送);生图时若当前模型能看图,会把生成的图片一并交给它。视频默认每次先问你(所属根会话输入框处的 DSH 原生提问,双语「Allow / 允许」「Decline / 拒绝」;仅缺少原生提问服务时使用所属根会话输入框旁的兼容确认区),不受执行审批权限或「完全访问」影响;图片默认直接生成,均可改;agent 视频按秒计入会话(子 agent 计入所属会话),默认每个会话 60 秒,只在直接生成时拦截超额,CPA 当场拒绝才退回秒数。确认方式和上限可在输入框旁的生成按钮里按会话单独设置,并显示已用秒数。工具最多等 10 分钟,超时或停止后在后台继续。对话里的工具调用显示成和斜杠命令一样的一问一答。关闭时不注册工具、不占上下文。`media-sessions.json` 增加会话的确认方式、上限和已用秒数。
19
+ - **用对话模型理解自然语言参数。** 每条 `/cpa-image`、`/cpa-video`、`/cpa-video-edit`、`/cpa-video-extend` 在后台先请当前会话的对话模型读出没写成选项的参数(时长、分辨率、比例、张数、附图用法、延长秒数),显式选项和可直接识别的词优先,所有值都按允许范围校验;提示词只允许删去参数说法,不能改写。回复里写明由哪个模型读出了哪些参数;失败时照常按原文生成。运行记录新增 `interpreted`。
20
+ - **参数可以直接写在提示词里。** `/cpa-video 10秒 480p 竖屏 …`、`/cpa-image 2张 16:9 …`:写在提示词开头或结尾、作为独立词的时长、分辨率、比例、张数会被识别,显式选项优先。
21
+ - **附带的大图片会先缩小。** 视频的首帧 / 尾帧 / 参考图合计按实测的 1 MiB 请求体上限分配(约 750 KB,扣除提示词),改图参考图合计约 1.4 MB;超出时 PNG 由插件转成 JPEG(透明处填白、长边 ≤ 1280,必要时更小),其他格式由 DSH 附件服务生成较小版本。超过上限的视频请求在插件内直接拒绝,上游返回「length limit exceeded」时提示请求过大。
22
+ - **只读诊断。** 只发送 GET 请求,读取两份模型目录中的生成模型字段,并在不带 Key 的情况下探测 CPA 的视频接口是否存在;不生成内容、不消耗额度、不返回 Key。
23
+ - 新接口 `/api/dsh-cliproxyapi/media/{status,save,diagnose}`;生成设置独立保存在 `.dsh-cliproxyapi/media-settings.json`,`state.json` 格式不变。`/cpa-status` 显示识别出的生成模型数量。
24
+
25
+ ### 变更
26
+ - **生图、生视频模型分开选择。** 输入框旁改为两个按钮:生图按钮只打开生图模型,生视频按钮只打开生视频模型;agent 的确认方式 / 视频秒数上限收进模型菜单底部的「agent 生成设置」,点开是二级菜单,不再和模型列表混在一起。
27
+ - **agent 生成的进度、预览和确认与思考过程分开。** 客户端从已有的 `tool/call` / `tool/result` 记录构建独立生成行,明确放在 process 外,复用斜杠命令的图片 / 视频预览及文件操作;宿主不再追加伪造的 `command/run` / `command/done`,不新增 Session 事件类型。存在对应生成行时隐藏重复工具卡片和旧版镜像命令卡片,真正的斜杠命令仍保留。确认独立位于输入框处,不再放在生成行内;10 分钟未回答、停止、关闭工具、重载 / 卸载插件或原生提问出错都不放行,只有明确选择允许才提交。缺少原生提问服务时,兼容确认区每 2 秒读取本会话的 `pendingConfirmations`,通过 `media/confirm` 回答;不会因原生提问出错而改走备用确认。
28
+ - **输入框较窄时,生图 / 生视频按钮只显示图标。** 输入框宽度小于 640 px 时隐藏模型名(仍保留无障碍名称和点击菜单),变宽后自动恢复。
29
+ - **agent 不再把提示词扩写成大段场景描写。** `generate_media` 的工具说明和 `prompt` 参数说明现在明确要求使用用户自己的措辞和细节,不要扩写、翻译或添加用户没有要求的镜头、光线、风格、人物或环境细节;斜杠命令的提示词本来就直接使用原文。
30
+
31
+ ### 修复
32
+ - **生图模型选择里偶尔整组消失。** 普通 `/v1/models` 列表和增强目录共用了同一个超时,目录稍慢时只出现在普通列表里的生图模型会整组读不到,输入框旁只剩生视频模型,直到下一次 5 分钟刷新。现在两份目录并行读取,普通列表有自己的超时并失败重试一次;仍读不到时会在同步后约 4 秒再试(最多两次),`media/session` 同时返回 `catalogIncomplete`,生成按钮据此继续刷新。
33
+ - **Responses 路由的 agent 生成反复报参数错误。** 可选参数支持 `null`,空模型名沿用用户的选择;兼容旧调用里的空字段、视频 `count: 1` 和无图片时的默认 `first-frame`,避免先后被「模型不能为空」「张数仅用于图片」挡住。仍拒绝多视频请求及真正不合法的帧数量、分辨率和时长,且不会自动重试生成。
34
+ - **编辑视频时把写在提示词里的视频路径当成了提示词。** `/cpa-video-edit D:\…\a.mp4 480p 换成雪夜` 会用本会话最新的视频作原视频,并把路径和 `480p` 一起发给 xAI。现在提示词开头或结尾的视频路径(可带引号或 `@`)就是原视频;编辑 / 延长用不上的 `480p`、`16:9`、`竖屏` 等词会去掉并标为「已忽略」。生成行的标签末尾新增「复制原始输入」,可复制当时输入的整条命令。
35
+ - **看不出附带的图片被当成首帧还是参考图。** 生成行的回复里新增一行,写明实际使用的模式(纯文字 / 首帧 / 参考图 ×N / 首尾帧 / 尾帧 / 编辑 / 延长 / 文生图 / 改图)及其含义;编辑 / 延长还写明原视频来源(上传的本地文件、公开链接、本会话生成的视频)。运行记录新增 `sourceKind`。
36
+ - **「测试连接」总是报错 `Failed to execute 'json' on 'Response': Unexpected end of JSON input`。** 设置页(添加账号表单和连接标签页)缺少测试连接接口的地址,请求发到了不存在的路径。现在会正确调用 `/api/dsh-cliproxyapi/accounts/test`;页面收到非 JSON 回复时改为显示 `HTTP <状态码>`。(1.7.0 起存在)
37
+
38
+ ### 注意
39
+ - 新增了打包文件 `lib/media.js`。1.5.0–1.6.0 内置的离线更新仍使用旧的固定文件清单,会拒绝这个版本的离线包;这些版本的用户请先通过插件市场或 npm 升级一次(插件页和 `dsh plugin add` 不受影响)。
40
+
41
+ ## 1.7.0 — 2026-10-21
42
+
43
+ ### 变更
44
+ - 包描述、关键词(`cpa`、`cli-proxy-api`)以及中英文插件标题和简介中加入了常用简称 **CPA**,搜索 "CPA" 时可以找到本插件。
45
+ - **移除 `cliproxyapi` agent 工具。** 它的工具定义在每个会话中占用约 3K tokens 的模型上下文,而账号本来就在设置页管理。插件现在不注册任何 agent 工具;设置页、HTTP 接口以及 `/cpa-status` / `/cpa-refresh` 不变。两份 README 中的 AI 安装指引改为让用户在 设置 → CLIProxyAPI 中添加账号。
46
+ - **重做账号设置流程。** 所有标签页共用一个账号栏;每个账号分为 **连接 / 模型 / 额度** 三个标签页(额度页单独的账号切换器已移除)。账号标题旁的 **启用** 开关立即生效,只提交这一个字段;**立即探测刷新** 和 **删除此账号** 移入 **⋯** 菜单,与保存操作分开。连接和模型的修改共用一个"未保存"状态和一条吸底的 **有未保存的更改 · 放弃更改 / 保存并应用** 栏(原来的三个保存按钮已移除),切换账号前会确认是否放弃修改。**清除密钥** 只清除密钥。全局刷新间隔标注为所有账号共用。
47
+ - **添加账号** 改为一个小表单(名称、地址、密钥):先测试连接,成功后才创建一个已启用的账号;测试失败时可用 **仍然添加(不启用)** 保留旧行为。只点击 **+ 添加账号** 不会再创建占位账号。
48
+ - 次要说明移入可访问的 ⓘ 提示(悬停、键盘聚焦或点击显示);去掉了页面副标题,输入时需要的提示改为输入框占位文字。标签文字更简短。
49
+
50
+ ### 文档
51
+ - README 新增重做后的设置页、额度标签页、输入框额度标识和添加账号表单的截图(已标注为使用示例数据的离线组件渲染);移除 1.6.0 的账号栏截图,保留实机拍摄的更新页截图。
52
+ - 更新日志改为中文(`CHANGELOG.md`,默认),英文版见 `CHANGELOG.en.md`。
53
+
54
+ ### 修复
55
+ - **离线更新下载会拒绝任何新增文件。** 更新器原来按写死的文件清单校验更新包,以后版本只要多带一个文件(比如英文更新日志、新的界面语言),内置的"下载"就会报"更新包无效"。现在改为:包内每个文件必须在该包自己的 `package.json` `files` 中声明(`package.json`、README、LICENSE 等 npm 总会打包的文件除外),路径穿越、隐藏文件、`node_modules`、链接/特殊条目、依赖和安装脚本仍然一律拒绝。被拒绝时,具体原因(例如哪个文件未声明)会写入 DSH 日志,页面仍只显示本地化的错误提示。已安装 1.5.0–1.6.0 的用户仍使用旧规则:如果以后某个版本新增了文件,请通过插件市场、插件页面或 `dsh plugin add` 升级一次。
56
+ - **输入框额度标识在某个会话中反复消失。** DSH 会按会话绑定缓存插槽条目 `inject()` 的结果,而额度标识在 `inject()` 中解析会话的模型目录。如果这一步发生在会话完成绑定之前(页面加载、DSH 重启、切换会话),这次失败会被缓存,该会话的额度标识就一直隐藏,而模型选择器本身已经恢复。现在改为在渲染时解析模型目录,并在其可用之前持续重试。
57
+ - **新对话页面没有额度标识。** DSH 只在会话绑定后才渲染输入框的 `conversation.input.right` 列表,而新会话页面已经显示了模型选择器。额度标识现在也注册到 `conversation.hero.options`(新会话页面输入框上方那一行),并且只在同一会话没有挂载输入框额度标识时显示,保证始终只出现一个。
58
+ - **插件重载后输入框额度标识(以及可能的其他插件条目)消失,直到刷新页面。** DSH 会拒绝在同一优先级下注册相同 id/key 的第二个列表或键控插槽条目,而热重载可能在旧实例销毁之前就启动新实例。现在条目会降低一个优先级重试(保留稳定的 id/key;渲染优先级最低的那个,旧实例销毁后由新条目接管)。每个实例也拥有自己的样式表,销毁旧实例不会再移除新实例的样式。
59
+
60
+ ### 新增
61
+ - **支持 CPA 自带管理面板支持的所有渠道额度。** 对照 CLIProxyAPI 及其管理中心实现:**Meta**(Muse Code;套餐、滚动窗口和每周额度——其接口需要凭证的 `dca_token`,仅为这一次请求从 `/v0/management/auth-files/download` 读取,从不存储、记录或返回)、**Kimi 国际版**(`kimi-ai` 凭证查询 `api.kimi.ai`;被一个 Kimi 主机拒绝的令牌会在另一个主机上重试),以及 **CPA 插件渠道**:CPA 标记为 `supports_quota` 的其他凭证(额度插件或声明式 `quota_probe`)通过 CPA 统一的 `POST /v0/management/quota/fetch` 读取(套餐及分组额度窗口)。API Key 渠道和 Vertex 没有额度接口;付费 xAI 账号不会用真实的对话请求去探测。
62
+ - **Devin 额度。** Devin 凭证现在显示套餐以及每日 / 每周剩余额度和重置时间,通过 `/v0/management/api-call` 调用 Devin 的 `SeatManagementService/GetUserStatus` 读取(与 CPA 管理中心发出的请求相同;由 CPA 代入凭证的会话令牌)。该额度按账号统计,因此所有 `devin/…` 模型在额度标识和"模型 → 渠道"表中显示相同的窗口。响应中没有额度字段时报告为错误,而不是显示空数据。
63
+ - **测试连接**(`POST /api/dsh-cliproxyapi/accounts/test`)用尚未保存的地址/密钥进行探测,不保存也不写入路由;密钥留空时使用已存储的密钥,且从不返回密钥。
64
+ - **CLIProxyAPI 设置分区新增"额度"标签页。** 分区现在有 **设置**(原有的账号/模型页)和 **额度** 两个标签页。为每个账号填写 CPA 管理密钥(存放在 DSH 凭据服务中的 `CLI_PROXY_MANAGEMENT_KEY` / `CLI_PROXY_MANAGEMENT_KEY_<ACCOUNT_ID>` 下,从不写入状态文件或设置)后,Host 会读取该服务器的凭证(`/v0/management/auth-files`、各凭证的模型列表,以及通过 `/v0/management/api-call` 获取的上游额度)。该标签页沿用 DSH 原生设置页的平铺行布局:密钥行和刷新行、分布条、按渠道分组的所有凭证及其套餐、状态和额度窗口(5 小时 / 每周 / 每月 / 每日,以进度条显示并附重置时间)、渠道筛选,以及可展开的"模型 → 渠道"表,展示每个选择器模型对应到哪些凭证。没有已知额度接口的渠道只显示状态。
65
+ - **输入框额度标识**,位于模型选择器左侧(`conversation.input.right`):显示信号格和在当前所选模型所属账号中、可服务该模型的凭证里最高的剩余百分比;点击可在 DSH 菜单面板上查看每个凭证的详情。标识沿用模型选择器触发按钮的尺寸,没有管理密钥的账号不显示。匹配按账号、按渠道进行:模型 id 只匹配其路由所属账号的凭证,带前缀的 id(`devin/…`)只匹配带该前缀的凭证,不带前缀的 id 优先匹配不带前缀的凭证。
66
+ - `/cpa-status` 末尾追加每个账号的额度摘要(是否配置密钥、状态、凭证数量,以及每个选择器模型对应的凭证和其中最紧张的剩余百分比);不输出任何密钥。
67
+ - 额度 HTTP 接口 `/api/dsh-cliproxyapi/quota/{status,refresh,save}`;保存密钥和刷新会启动刷新并立即返回,页面在 `refreshing` 期间跟踪进度。Host 将结果缓存 5 分钟,且只在有页面请求时在后台刷新过期账号;管理密钥被拒绝(401/403)后,该账号暂停自动刷新,直到密钥变更或手动刷新,以免触发 CPA 的错误密钥保护。
4
68
 
5
69
  ## 1.6.0 — 2026-10-20
6
70
 
7
- ### Changed
8
- - **Accounts and models moved to the Settings dialog's left navigation.** The account/model page is now its own `settings.section` entry ("CLIProxyAPI"), like the dshmarket "Market" section. The plugin's bundle page (Sidebar → Plugins) and its Built-in plugins tab now contain only plugin updates: a pointer to the new section plus the update card, expanded by default there.
71
+ ### 变更
72
+ - **账号和模型移到设置对话框的左侧导航。** 账号/模型页现在是独立的 `settings.section` 条目("CLIProxyAPI"),与 dshmarket 的"市场"分区一样。插件的捆绑包页面(侧边栏 → 插件)及其内置插件标签页现在只包含插件更新:一条指向新分区的提示和更新卡片,在这里默认展开。
9
73
 
10
- ### Fixed
11
- - **"Check for Updates" always failed on the DSH desktop app.** The desktop shell strips the `Origin` header when it forwards page requests to the Host, and update POSTs (`check`, `save`, `download`) required an explicit exact `Origin`, so every one was refused with `forbidden-origin`. Update POSTs now follow the host connection fence: a missing `Origin` relies on the host session authentication, while a present `Origin` must still be this listener's own authority (compared under its own `http(s)` scheme). A refused origin now has its own localized message.
74
+ ### 修复
75
+ - **DSH 桌面版上"检查更新"总是失败。** 桌面外壳在把页面请求转发给 Host 时会去掉 `Origin` 头,而更新 POST(`check`、`save`、`download`)要求带有完全匹配的 `Origin`,因此每次都以 `forbidden-origin` 被拒绝。更新 POST 现在遵循 Host 的连接防护规则:缺少 `Origin` 时依赖 Host 会话认证,而带有 `Origin` 时仍必须是本监听器自身的地址(按其自身的 `http(s)` 协议比较)。被拒绝的来源现在有单独的本地化提示。
12
76
 
13
- ### Added
14
- - **One-click updates through the DSH plugin market.** When dshmarket's public Update API v1 is detected (`GET /dsh-market/api/v1/capabilities`), the update card offers **Update Now**: after a version confirmation it submits the update to the market, follows the operation's progress, reports the version actually installed (and warns when it is below the checked target), and shows restart/refresh guidance from the market's outcome, with a restart button only when the market owns restarts. Market failure codes are localized; **Install Anyway** is offered only after a release-age wait or unresolved version. Linked installs are never installed through the market. This plugin still never runs a package manager itself.
15
- - **Automatic installation (opt-in, `autoInstall`, default off).** With automatic checks on and dshmarket present, a version found by the Host's automatic check is installed through the market while a DSH page is open; each version is tried at most once every 6 hours and never again once installed, and automatic mode never forces. Stored as an optional field of the v1 `update-settings.json`; older files load as off.
77
+ ### 新增
78
+ - **通过 DSH 插件市场一键更新。** 检测到 dshmarket 的公开 Update API v1(`GET /dsh-market/api/v1/capabilities`)时,更新卡片提供 **立即更新**:确认版本后将更新提交给市场,跟踪操作进度,报告市场实际安装的版本(低于检查到的目标版本时给出警告),并根据市场返回的结果给出重启/刷新指引,只有市场负责重启时才显示重启按钮。市场的失败代码均已本地化;只有在发布时间等待期或版本未解析时才提供 **仍然安装**。链接安装永远不会通过市场安装。本插件自身仍然从不运行包管理器。
79
+ - **自动安装(可选,`autoInstall`,默认关闭)。** 开启自动检查且存在 dshmarket 时,Host 自动检查发现的新版本会在 DSH 页面打开期间通过市场安装;每个版本每 6 小时最多尝试一次,安装成功后不再重试,自动模式从不强制安装。该选项作为 v1 `update-settings.json` 的可选字段存储;旧文件加载时视为关闭。
16
80
 
17
81
  ## 1.5.1 — 2026-10-19
18
82
 
19
- ### Fixed
20
- - A missing update endpoint (page updated but DSH still running the previous host code) is no longer reported as "invalid version information": 404/405/501 answers now map to a dedicated "update service unavailable" message that names the real cause and says DSH must be restarted, not merely refreshed.
83
+ ### 修复
84
+ - 缺少更新接口(页面已更新但 DSH 仍在运行旧的 Host 代码)时,不再报告为"版本信息无效":404/405/501 响应现在对应一条单独的"更新服务不可用"提示,说明真实原因,并指出需要重启 DSH 而不只是刷新页面。
21
85
 
22
86
  ## 1.5.0 — 2026-10-19
23
87
 
24
- ### Added
25
- - **Plugin update card**, independent of account forms and drafts, with Chinese/English strings, localized errors, current/latest versions, Stable / Beta / Dev channels, Auto / Global / Mainland China regions, automatic checks and optional automatic downloads. The card is collapsed by default to a single compact row (title, current version, short update status) and expands on click; polling and saves never reset that choice.
26
- - Automatic checks enabled by default about 3 seconds after startup or rescheduling preferences, then every 6 hours; automatic downloads are off by default and run only after an automatic check finds a newer version. No automatic installation, uninstall, source overwrite or restart.
27
- - Strict SemVer channel checks using npm `latest` / `beta` / `dev`, explicit errors for unpublished channels, and no cross-channel fallback or downgrade. Auto region races npmjs and npmmirror for the first valid metadata; explicit regions stay on their selected registry and do not affect CPA traffic.
28
- - Mainland China downloads follow npmmirror's official CDN redirects through an exact host/package/version allowlist, with at most three HTTPS hops and the original metadata integrity preserved. External, local, cross-region and downgrade redirects are refused.
29
- - Verified offline package preparation: registry-provided SHA-512 integrity plus bounded gzip/tar, package identity/version and file-structure checks. Reject traversal, links/special entries, unexpected files, dependencies and installation lifecycle scripts; never extract or execute an update. These checks are not publisher-signature or npm provenance verification.
30
- - Packages saved atomically under the profile's `.dsh-cliproxyapi/updates/` directory, with a version-specific download confirmation and an offline `dsh plugin --profile 'name' add 'absolute.tgz'` command for use after DSH is closed, followed by a restart. Linked local installations can check/download but receive no command, protecting the source-based installation.
31
- - Separate versioned `update-settings.json` preferences; invalid or unreadable files disable automatic network checks, while a missing file uses first-run defaults. Existing v2 account state and credentials remain untouched. Check results and download notices are in-memory only; downloaded files remain for user-managed cleanup.
32
- - Authenticated update HTTP routes: read-only `GET /api/dsh-cliproxyapi/updates/status` and `POST` operations `/check`, `/save`, `/download`. Update POSTs require an explicit exact same-origin header matching the actual connection scheme and Host, without trusting forwarded-protocol claims.
33
- - Offline updater, HTTP and dependency-free VM/Hook client tests; actual-component offline previews (collapsed and expanded) with clearly labeled example versions.
34
-
35
- ### Changed
36
- - Release automation publishes stable versions to npm `latest` and Beta / Dev prereleases to `beta` / `dev`, marking the corresponding GitHub Releases as prereleases without replacing stable.
37
- - Both READMEs and the architecture guide explain download-versus-install behavior, linked-source protection, storage, API admission and the manual closed-DSH upgrade workflow. The packed zero-dependency bundle now includes the internal `lib/updater.js` module.
88
+ ### 新增
89
+ - **插件更新卡片**,独立于账号表单和草稿,提供中英文文案、本地化错误、当前/最新版本、稳定版 / Beta / Dev 渠道、自动 / 全球 / 中国大陆区域、自动检查和可选的自动下载。卡片默认折叠为一行(标题、当前版本、简短的更新状态),点击展开;轮询和保存不会重置展开状态。
90
+ - 自动检查默认开启:启动或修改计划设置约 3 秒后执行,之后每 6 小时一次;自动下载默认关闭,只在自动检查发现新版本后运行。不会自动安装、卸载、覆盖源码或重启。
91
+ - 严格的 SemVer 渠道检查,使用 npm `latest` / `beta` / `dev`;未发布的渠道明确报错,不会跨渠道回退或降级。自动区域同时请求 npmjs 和 npmmirror,取最先返回的有效元数据;指定区域只使用所选的源,且不影响 CPA 流量。
92
+ - 中国大陆下载按精确的主机/包名/版本白名单跟随 npmmirror 官方 CDN 重定向,最多 3 次 HTTPS 跳转,并保留原始元数据中的完整性校验值。拒绝外部、本地、跨区域和降级的重定向。
93
+ - 离线包校验:使用源提供的 SHA-512 完整性校验值,并检查 gzip/tar 大小上限、包名/版本和文件结构。拒绝路径穿越、链接/特殊条目、意外文件、依赖和安装生命周期脚本;从不解压或执行更新包。这些检查不是发布者签名或 npm 来源证明(provenance)验证。
94
+ - 更新包以原子方式保存到 profile 的 `.dsh-cliproxyapi/updates/` 目录,下载前需确认具体版本,并提供离线命令 `dsh plugin --profile 'name' add 'absolute.tgz'`,在关闭 DSH 后运行,然后重启。本地链接安装可以检查和下载,但不提供命令,以保护基于源码的安装。
95
+ - 独立的带版本号的 `update-settings.json` 偏好设置;文件无效或无法读取时关闭自动网络检查,文件缺失时使用首次运行的默认值。现有 v2 账号状态和凭据保持不变。检查结果和下载提示只保存在内存中;下载的文件由用户自行清理。
96
+ - 需要认证的更新 HTTP 接口:只读的 `GET /api/dsh-cliproxyapi/updates/status`,以及 `POST` 操作 `/check`、`/save`、`/download`。更新 POST 要求带有与实际连接协议和 Host 完全匹配的同源请求头,不信任转发的协议声明。
97
+ - 离线更新器、HTTP 以及无依赖的 VM/Hook 客户端测试;使用真实组件的离线预览(折叠和展开),并清楚标注示例版本。
98
+
99
+ ### 变更
100
+ - 发布流程将稳定版发布到 npm `latest`,Beta / Dev 预发布版发布到 `beta` / `dev`,并将对应的 GitHub Release 标记为预发布,不会替换稳定版。
101
+ - 两份 README 和架构指南说明了下载与安装的区别、链接源码保护、存储位置、接口准入规则,以及关闭 DSH 后手动升级的流程。打包的零依赖插件现在包含内部模块 `lib/updater.js`。
38
102
 
39
103
  ## 1.4.1 — 2026-10-19
40
104
 
41
- Documentation and release tooling only; the plugin code is unchanged from 1.4.0.
105
+ 仅涉及文档和发布工具;插件代码与 1.4.0 相同。
42
106
 
43
- ### Changed
44
- - `README.md` is now Chinese (the default on GitHub and npm), with the English version in `README.en.md`. Both are rewritten: a quick start, four verified ways to install (DSH **Plugins** page, the DSH agent, `dsh plugin add`, GitHub / offline package), upgrading and uninstalling, and a FAQ. Images and links use absolute URLs so they also render on npmjs.com.
45
- - Releases publish to npm through npm trusted publishing (GitHub Actions OIDC) with an automatic provenance statement; no npm token is stored anywhere. The release workflow can also be run by hand for an existing tag and skips steps that are already done.
107
+ ### 变更
108
+ - `README.md` 改为中文(GitHub 和 npm 上的默认版本),英文版见 `README.en.md`。两份文档都已重写:快速开始、四种经过验证的安装方式(DSH **插件** 页面、DSH agent、`dsh plugin add`、GitHub / 离线包)、升级和卸载,以及常见问题。图片和链接使用绝对地址,在 npmjs.com 上也能正常显示。
109
+ - 发布通过 npm 可信发布(GitHub Actions OIDC)推送到 npm,并自动附带来源证明;任何地方都不存储 npm 令牌。发布流程也可以针对已有标签手动运行,并跳过已完成的步骤。
46
110
 
47
111
  ## 1.4.0 — 2026-10-19
48
112
 
49
- First public release.
50
-
51
- ### Added
52
- - **Multiple CLIProxyAPI accounts.** Each account has its own base URL, API key (own credential ref), provider route ID, protocol mode, model selection and per-model overrides, and synchronizes into its own `llm-pi-ai` routes (`cli-proxy-2`, `cli-proxy-2-responses`, `cli-proxy-2-messages`, …).
53
- - **Per-account enable switch.** A disabled account keeps its settings but its routes are removed, so its models leave the picker. New accounts start disabled; a manual refresh still probes them so models can be picked before enabling.
54
- - Settings panel account bar: switch accounts, **+ Add Account**, **Delete Account**, credential-ref field.
55
- - `cliproxyapi` tool: `add_account` and `remove_account` actions, `account`, `enabled` and `apiKeyEnv` parameters; output lists every account.
56
- - HTTP routes `POST /api/dsh-cliproxyapi/accounts/add` and `/accounts/remove`; `refresh` and `save` accept `accountId`.
57
- - English `README.md` and Chinese `README.zh.md` with captioned screenshots; `screenshots.json` for plugin storefronts; `LICENSE`, `AGENTS.md`, `CHANGELOG.md`.
58
- - GitHub Actions: CI (Ubuntu + Windows, Node 22 / 24) and a tag-triggered release that attaches the packed bundle and optionally publishes to npm.
59
-
60
- ### Changed
61
- - `state.json` is now `{ version: 2, refreshIntervalSeconds, probeTimeoutMs, accounts: [...] }`. A v1 single-account file migrates automatically into account `default` with the same routes, key and selection; the original is kept as `state.v1.json`.
62
- - An account with an explicit base URL only probes that URL and never falls back to local `:8317`, the existing route or `CLIPROXYAPI_BASE_URL`.
63
- - Overlapping provider route IDs between accounts are rejected on save; an overlapping account in a hand-edited file is reported as an error and never writes or removes another account's routes.
64
- - Settings writes from concurrent account syncs are serialized.
65
- - `/cpa-status` and `/cpa-refresh` cover every account.
66
- - The DSH version requirement moved to top-level `engines.dsh`, where DSH reads it; `./icon` is exported.
67
- - `engines.node` is now `>=22` (the versions CI tests).
68
-
69
- ### Fixed
70
- - **First-run selection no longer uses hard-coded model ids.** An account without a saved selection is seeded once, on its first successful probe, with the newest model of each family from its own server's catalog (at most 12). Previously a fresh install pre-selected 7 fixed ids that most servers do not offer, so nothing reached the picker.
71
- - **Reset to Recommended** uses the same catalog-derived list (with its count) instead of the fixed 7.
72
- - Saving a new account before its catalog was ever probed no longer stores an empty selection.
73
- - When a saved selection matches nothing on the server, the error names the server and the discovered models stay visible in the panel.
113
+ 首个公开版本。
114
+
115
+ ### 新增
116
+ - **多个 CLIProxyAPI 账号。** 每个账号有独立的基础地址、API 密钥(独立的凭据引用)、提供方路由 ID、协议模式、模型选择和单模型覆盖设置,并同步到各自的 `llm-pi-ai` 路由(`cli-proxy-2`、`cli-proxy-2-responses`、`cli-proxy-2-messages` 等)。
117
+ - **单账号启用开关。** 停用的账号保留设置,但其路由会被移除,模型也随之从选择器中消失。新账号默认停用;手动刷新仍会探测它们,以便在启用前选好模型。
118
+ - 设置面板账号栏:切换账号、**+ 添加账号**、**删除此账号**、凭据引用字段。
119
+ - `cliproxyapi` 工具:新增 `add_account` 和 `remove_account` 操作,以及 `account`、`enabled` 和 `apiKeyEnv` 参数;输出列出所有账号。
120
+ - HTTP 接口 `POST /api/dsh-cliproxyapi/accounts/add` 和 `/accounts/remove`;`refresh` 和 `save` 支持 `accountId`。
121
+ - 英文 `README.md` 和中文 `README.zh.md`,附带说明的截图;供插件商店读取的 `screenshots.json`;`LICENSE`、`AGENTS.md`、`CHANGELOG.md`。
122
+ - GitHub Actions:CI(Ubuntu + Windows,Node 22 / 24),以及由标签触发的发布流程,附加打包好的插件并可选发布到 npm。
123
+
124
+ ### 变更
125
+ - `state.json` 改为 `{ version: 2, refreshIntervalSeconds, probeTimeoutMs, accounts: [...] }`。v1 单账号文件会自动迁移为账号 `default`,保留相同的路由、密钥和模型选择;原文件保存为 `state.v1.json`。
126
+ - 设置了明确基础地址的账号只探测该地址,不再回退到本地 `:8317`、已有路由或 `CLIPROXYAPI_BASE_URL`。
127
+ - 保存时拒绝账号之间重叠的提供方路由 ID;手动编辑文件导致重叠的账号会报告错误,且从不写入或删除其他账号的路由。
128
+ - 多个账号并发同步时,设置写入按顺序执行。
129
+ - `/cpa-status` 和 `/cpa-refresh` 覆盖所有账号。
130
+ - DSH 版本要求移到顶层 `engines.dsh`,DSH 从这里读取;导出了 `./icon`。
131
+ - `engines.node` 改为 `>=22`(CI 测试的版本)。
132
+
133
+ ### 修复
134
+ - **首次运行的模型选择不再使用写死的模型 id。** 没有保存过选择的账号会在首次成功探测时,从其服务器自己的模型目录中为每个系列选出最新的模型(最多 12 个),只做一次。之前全新安装会预选 7 个固定 id,而大多数服务器并不提供这些模型,导致选择器里什么都没有。
135
+ - **恢复推荐精选** 使用同样从模型目录推导出的列表(并显示数量),不再使用固定的 7 个。
136
+ - 在从未探测模型目录前保存新账号,不再存储一个空的模型选择。
137
+ - 保存的模型选择在服务器上一个都匹配不到时,错误信息会指出是哪个服务器,已发现的模型仍显示在面板中。
74
138
 
75
139
  ## 1.3.0
76
140
 
77
- - Per-model native protocol routing (`protocolMode: "auto"`): Claude via Anthropic Messages, GPT/Codex/Grok via OpenAI Responses, others via OpenAI Chat, one `llm-pi-ai` route per protocol; the default model follows its route.
78
- - Per-model protocol override and fixed protocol mode.
141
+ - 按模型使用原生协议路由(`protocolMode: "auto"`):Claude 走 Anthropic Messages,GPT/Codex/Grok 走 OpenAI Responses,其他走 OpenAI Chat,每种协议一条 `llm-pi-ai` 路由;默认模型跟随其路由。
142
+ - 单模型协议覆盖和固定协议模式。
79
143
 
80
- ## 1.2.0 and earlier
144
+ ## 1.2.0 及更早
81
145
 
82
- - Auto-discovery of CLIProxyAPI, model selection filter, per-model parameter editor, credentials-service key storage, `/cpa-status` and `/cpa-refresh`.
146
+ - CLIProxyAPI 自动发现、模型选择过滤、单模型参数编辑器、基于凭据服务的密钥存储、`/cpa-status` 和 `/cpa-refresh`。