dsh-codearts 1.1.1 → 1.1.4

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
@@ -3,6 +3,54 @@
3
3
  本文件记录本插件的重要改动。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
4
4
  版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
5
5
 
6
+ ## [1.1.4] - 2026-10-26
7
+
8
+ ### 修复
9
+
10
+ - **升级到 1.1.3 报「更新失败:`ERR_PNPM_IGNORED_BUILDS`」**:1.1.3 为修 issue #2 把
11
+ `@earendil-works/pi-ai` 移进 `dependencies`,连带拉入 `@google/genai` / `protobufjs`
12
+ (都带安装期脚本);pnpm 11 默认拦截未批准的依赖脚本并以非零码退出,DSH 更新器据此
13
+ 判失败(包其实已装上)。现在 pi-ai 改为**构建期打包进 `lib/`**:它的厂商 SDK 全是
14
+ 懒加载 lane,插件只用 OpenAI 一路,tree-shaking 后 `@google/genai` / `protobufjs`
15
+ 不进产物也不进依赖树 —— 安装时零新增 npm 包,脚本拦截绝根;pi-ai 版本漂移(issue #2
16
+ 的根因)在结构上一并不可能了。1.1.3 用户侧的临时处理见 INSTALL「八」。
17
+ - 产物体积随之涨到约 1.1 MB(含 pi-ai 核心 + openai SDK 的 openai-completions 懒加载
18
+ chunk),功能与接口不变。
19
+
20
+ ## [1.1.3] - 2026-10-26
21
+
22
+ ### 修复
23
+
24
+ - **与 billion-context 同用时账号被永久禁用,报「当前没有可用账号」(issue #1)**:
25
+ billion-context 拦下 SDK-HMAC-SHA256 签名请求做压缩、找不到重签凭据时在本地回 403
26
+ (`signed_request_requires_resign`),插件把它当凭据失效,账号被禁用且没有任何恢复
27
+ 路径。现在按 body 里的拒签标记识别这类本地拦截:不再禁用账号,直接回 400(宿主不会
28
+ 再拿它重试 5 次),报错里给出 `resign.passthrough` 的配置方法。带标记的 401/403 之外
29
+ 的真凭据失效行为不变。
30
+ - **重新登录救不回被禁用的账号**:`disabled` 以前只能靠重启清掉,`pool.sync()` 对同一
31
+ userId 保留运行时状态。现在登录成功(OAuth 与手工贴 token 两条路)会调用池的
32
+ `revive()`,清掉该账号的禁用/冷却/错误计数。
33
+ - **「没有可用账号」不再一概而论**:一个账号都选不出来时,报错分清原因——全禁用(401,
34
+ 附各号最后错误并提示重新登录)、全在冷却(429,附剩余秒数)、本地并发槽位全满
35
+ (429,说明每账号 2 个在飞上限)。
36
+ - **已登录却报「积分不可用:statistics HTTP 0 Failed to parse URL from [object
37
+ Request]」(模型清单同时变空,issue #2)**:出网原本是 `fetch(new Request(url, ...), {signal})`
38
+ ——邻居插件(如 IP 池出口路由)会把 `globalThis.fetch` 换成它自己那份 undici 的
39
+ fetch,而 `globalThis.Request` 还是另一份实例。undici 用 `instanceof` 认自己的
40
+ Request,认不出就当 URL 字符串处理,于是每条请求在出网之前抛错(HTTP 0)。现在
41
+ `Request` 只当签名的载体,出网统一走 `dispatch()`:交「字符串 URL + 已展开的普通
42
+ 头 + 原字节请求体」,7 处调用点一并收口。
43
+ - **选中 CodeArts 模型后每条消息都「本轮运行失败:Cannot read properties of undefined
44
+ (reading 'length')」(issue #2)**:`@earendil-works/pi-ai` 过去只写在 `peerDependencies`
45
+ (`>=0.84.2 <2.0.0`),区间不会被安装流程强制满足;插件自己没有 `node_modules` 时
46
+ import 直接落到 profile 顶层被别的插件 hoist 上来的旧版。旧版的 `estimateMessageTokens`
47
+ 没有 `role:"system"` 分支,而宿主(`dsh-llm-pi-ai` 0.2.1-rc.2 起)会把系统提示折叠成
48
+ 一条 content 为**字符串**的 system 消息交给 provider —— 字符串被按字符遍历,读到
49
+ `block.name.length` 就崩,且崩在出网之前。现在 pi-ai 移进 `dependencies`(`^1.3.0`,
50
+ 自带一份),并在启动时探测这份能不能估折叠后的 system 消息:不满足就在日志和积分
51
+ 卡片上明说「pi-ai 不兼容,需要 >= 1.3.0」,不再让每条消息各自崩在一个看不懂的
52
+ TypeError 上。
53
+
6
54
  ## [1.1.1] - 2026-10-22
7
55
 
8
56
  ### 修复
package/INSTALL.en.md CHANGED
@@ -133,3 +133,27 @@ console.log(b[0]===0xEF&&b[1]===0xBB&&b[2]===0xBF?'BOM!':'no-BOM');
133
133
  > PS 5.1, which crashed startup repeatedly. It was fixed by rewriting the file with Node
134
134
  > (backup `package.json.bak-bomfix-*`). A scan of the whole `~/.dsh` tree found that one
135
135
  > file only.
136
+
137
+ ## 8. Update to 1.1.3+ fails with `ERR_PNPM_IGNORED_BUILDS`
138
+
139
+ It is not actually a failed install — the `+ dsh-codearts 1.1.3` line means the package
140
+ already landed. What fails is pnpm 11's post-install check: since 1.1.3 the plugin bundles
141
+ its own copy of `@earendil-works/pi-ai`, which transitively pulls `@google/genai` and
142
+ `protobufjs`; both carry install-time scripts, pnpm 11 blocks unapproved dependency scripts
143
+ by default (`strictDepBuilds`) and exits non-zero, which the DSH updater reports as failure.
144
+ Neither script does anything needed at runtime (one is a no-op echo, the other a package
145
+ integrity self-check), so skipping them is safe.
146
+
147
+ One-time fix: append to the profile's `pnpm-workspace.yaml`
148
+ (e.g. `~/.dsh/profiles/desktop/pnpm-workspace.yaml`):
149
+
150
+ ```yaml
151
+ allowBuilds:
152
+ '@google/genai': false
153
+ protobufjs: false
154
+ ```
155
+
156
+ `false` means "deliberately never run their install scripts". Then retry the update. If the
157
+ file already contains placeholder lines like `'@google/genai': set this to true or false`
158
+ (auto-added by pnpm), replace the value with `false` — placeholders count as undecided and
159
+ keep failing. `pnpm approve-builds` in the profile directory works too.
package/INSTALL.md CHANGED
@@ -104,6 +104,28 @@ node scripts/deploy.mjs [profileDir] # profileDir 默认 <用户目录>/.dsh
104
104
  2. **用 Node `fs.writeFileSync`**(默认无 BOM)。
105
105
  3. **用 PowerShell 7 的 `-Encoding utf8NoBOM`**(PS5.1 没有该选项)。
106
106
 
107
+ ## 八、更新到 1.1.3+ 报「更新失败:`ERR_PNPM_IGNORED_BUILDS`」
108
+
109
+ 不是安装失败 —— 看输出里的 `+ dsh-codearts 1.1.3`,包其实已经装好了。报错的是
110
+ pnpm 11 的收尾检查:1.1.3 起插件自带一份 `@earendil-works/pi-ai`,它间接依赖
111
+ `@google/genai` 和 `protobufjs`,这两个包带安装期脚本;pnpm 11 默认拦截未批准的依赖
112
+ 脚本(`strictDepBuilds`)并以**非零码退出**,DSH 更新器据此判为失败。这两个脚本一个
113
+ 是 no-op echo、一个是包完整性自检,**不跑没有任何功能影响**。
114
+
115
+ 修法(一次性):在 profile 的 `pnpm-workspace.yaml`(如
116
+ `~/.dsh/profiles/desktop/pnpm-workspace.yaml`)里追加:
117
+
118
+ ```yaml
119
+ allowBuilds:
120
+ '@google/genai': false
121
+ protobufjs: false
122
+ ```
123
+
124
+ `false` 表示「明确不跑它们的安装脚本」。然后重新更新即可。注意:如果该文件里已有
125
+ `'@google/genai': set this to true or false` 这样的占位行(pnpm 自动加的),必须把值
126
+ 改成 `false` —— 占位符不算决定,会一直报错。也可以在 profile 目录跑
127
+ `pnpm approve-builds` 交互式处理。
128
+
107
129
  写入后务必用 Node 校验前 3 字节是否为 BOM:
108
130
  ```js
109
131
  const fs=require('fs');const b=fs.readFileSync(p);
package/lib/bin.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { F as codeartsAccountsPath, M as isBenefitModel, N as CodeArtsAccountStore, d as fetchCallerIdentity, n as codeartsUsagePath, r as discoverModels, t as CodeArtsUsageTracker } from "./usage-zgF0QuQ4.mjs";
2
+ import { I as codeartsAccountsPath, M as isBenefitModel, N as CodeArtsAccountStore, d as fetchCallerIdentity, n as codeartsUsagePath, r as discoverModels, t as CodeArtsUsageTracker } from "./usage-B0NfG8vZ.mjs";
3
3
  import { existsSync, statSync } from "node:fs";
4
4
  //#region src/version.ts
5
- const CODEARTS_VERSION = "1.1.1";
5
+ const CODEARTS_VERSION = "1.1.4";
6
6
  //#endregion
7
7
  //#region src/bin.ts
8
8
  /**