dsh-aiyayi 1.5.23 → 1.5.25

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
@@ -8,6 +8,23 @@
8
8
 
9
9
  ---
10
10
 
11
+ ## 1.5.25(2026-11-11 修复:extractFeishuErrorCode 补挖顶层 feishuCode——1.5.23 的 230001 判定真正生效)
12
+
13
+ - 环境:DSH-执行智能体(DeepSeek Harness 子会话,模型名未确证)
14
+ - git:本次 commit(2026-11-11,阿依娅伊)1.5.25:装版静态断言连续抓出的第二处遗漏。
15
+ - 现象:1.5.24 修好 import 后装版断言仍显示伪造 chatId 走 `ok:true + warning`(probe-error 分支),230001 判定没生效。
16
+ - 根因:`probeChatMembership` 抛错时把飞书错误码放在 **`error.feishuCode`**(`feishu-logic.js` 抛错处),而 `extractFeishuErrorCode` 的候选链只挖 `cause.response.data.code`/`cause.data.code`/`cause.code`/`data.code`/顶层 `code`——不认 `feishuCode`,返回 null,`=== 230001` 恒 false。
17
+ - 修法:候选链首位补 `typeof error?.feishuCode === 'number' ? error.feishuCode : undefined`(顶层 feishuCode 优先——probe 错误以它为准);`test/feishu-multiapp.test.mjs` 钉死:顶层 feishuCode 挖出、feishuCode 优先于 code、isOutOfChatError 认 feishuCode 抛错。
18
+ - 教训:**「函数级单测全过」≠「链路行为正确」**——extractFeishuErrorCode 的旧测试全是手工造的 SDK 形状错误,没人测 probe 自己抛的形状;两条修复(1.5.24 import、1.5.25 候选链)都是装版静态断言(mock ctx + 真实飞书 API)抓出来的。装版后断言应当作发版链路的固定环节。
19
+
20
+ ## 1.5.24(2026-11-11 修复 1.5.23 遗漏 import + 禁用宿主 ask_user_question 选项组件)
21
+
22
+ - 环境:DSH-执行智能体(DeepSeek Harness 子会话,模型名未确证)
23
+ - git:本次 commit(2026-11-11,阿依娅伊)1.5.24:装版静态断言抓到的运行时 ReferenceError 修复 + 李浩拍板的工具禁用。
24
+ - **修:`lib/feishu.js` `resolveChannelForChat` 里 `extractFeishuErrorCode is not defined`**——1.5.23 的 230001 判定在 catch 块里调用了 `extractFeishuErrorCode`(定义在 `feishu-logic.js`),但忘了加进 import;任何 probe 抛错(含 230001/网络错)都会 ReferenceError。`node --check` 查不出运行时引用错误,multiapp 测试够不到这条 SDK+网络路径,是装版静态断言(伪造 chatId 实测)抓出来的。修法:import 列表补 `extractFeishuErrorCode`。
25
+ - **禁用宿主工具 `ask_user_question`(选项组件)**:`cordis.patch.yml` 两处挂载(preset-aiyayi 约 :236-240、preset-aiyayi-worker 约 :361-365)加 `disabled: true`——李浩 2026-11-11 拍板「提问一律纯文本,别折腾组件」:该工具在飞书侧没有交互载体,他点不了会卡死对话。工具定义在本体 `@deepseek-ai/dsh-tool-ask-user`,禁用挂载即从模型侧消失。
26
+ - **连带废弃(预期内,死代码不删)**:1.5.18 引入的「飞书点选作答」链路(`buildQuestionCard`/`onCardAction`/`registerQuestionAnswerer` 等,见 1.5.18 条目「修四(D)」)随宿主工具禁用不再被触发;`tryAnswerByText` 文字兜底仍在(问答语义未消失,只是不再发卡片)。启动不受影响(相关代码仅在收到卡片回调/问题请求时执行)。
27
+
11
28
  ## 1.5.23(2026-11-11 修复:feishu_bind 对无效 chatId 的确定性拒绝——230001 与 230002 同判 not-member)
12
29
 
13
30
  - 环境:DSH-执行智能体(DeepSeek Harness 子会话,模型名未确证)
package/cordis.patch.yml CHANGED
@@ -235,6 +235,9 @@
235
235
  agentPreset: aiyayi-retriever
236
236
  - id: tool-ask-user
237
237
  name: '@deepseek-ai/dsh-tool-ask-user'
238
+ # 1.5.24(李浩 2026-11-11 拍板):提问一律纯文本,禁用选项组件——
239
+ # 飞书侧没有交互载体,点不了会卡死对话。
240
+ disabled: true
238
241
  - id: tool-schedule
239
242
  name: '@deepseek-ai/dsh-tool-schedule'
240
243
  # 阿依娅伊的小伙伴:她派活用的执行预设(蓝本=standard,去掉委派组——
@@ -357,6 +360,9 @@
357
360
  tailChars: 1024
358
361
  - id: tool-ask-user
359
362
  name: '@deepseek-ai/dsh-tool-ask-user'
363
+ # 1.5.24(李浩 2026-11-11 拍板):提问一律纯文本,禁用选项组件——
364
+ # 飞书侧没有交互载体,点不了会卡死对话。
365
+ disabled: true
360
366
  - id: tool-todo
361
367
  name: '@deepseek-ai/dsh-tool-todo'
362
368
  config:
@@ -205,6 +205,9 @@ export async function probeChatMembership({ domain, appId, appSecret, chatId })
205
205
  /** 从 SDK 抛出的错误里挖出飞书错误码(LarkChannelError 带 code + cause 链)。 */
206
206
  export function extractFeishuErrorCode(error) {
207
207
  const candidates = [
208
+ // probeChatMembership 抛的错把码放顶层 feishuCode(1.5.25:候选链补上它——
209
+ // 1.5.24 装版断言实测发现漏挖,230001 判定失效走回 probe-error)。
210
+ typeof error?.feishuCode === 'number' ? error.feishuCode : undefined,
208
211
  error?.cause?.response?.data?.code,
209
212
  error?.cause?.data?.code,
210
213
  typeof error?.cause?.code === 'number' ? error.cause.code : undefined,
package/lib/feishu.js CHANGED
@@ -42,6 +42,7 @@ import {
42
42
  composeDeliveryText,
43
43
  createTokenManager,
44
44
  ensureFeishuDir,
45
+ extractFeishuErrorCode,
45
46
  extractText,
46
47
  formatAnswerSummary,
47
48
  isOutOfChatError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aiyayi",
3
- "version": "1.5.23",
3
+ "version": "1.5.25",
4
4
  "license": "MIT",
5
5
  "author": "阿依娅伊 <aiyayi@local>",
6
6
  "keywords": [
@@ -3,6 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSy
3
3
  import { tmpdir } from 'node:os'
4
4
  import { join } from 'node:path'
5
5
  import {
6
+ extractFeishuErrorCode,
6
7
  isOutOfChatError,
7
8
  migrateConfigFile,
8
9
  normalizeApps,
@@ -127,6 +128,26 @@ assert.equal(isOutOfChatError({ cause: { response: { data: { code: 99991663 } }
127
128
  assert.equal(isOutOfChatError(null), false)
128
129
  assert.equal(isOutOfChatError('230002-string'), false, 'bare string is not an error code object')
129
130
 
131
+ // ── extractFeishuErrorCode:probeChatMembership 顶层 feishuCode 候选(1.5.25 钉死)──
132
+ // 1.5.24 装版断言实测:probe 抛错把码放 error.feishuCode(feishu-logic.js:200),
133
+ // 候选链不查它 → 230001 判定失效走回 probe-error → 伪造 chat 被照绑。
134
+ {
135
+ const probeErr = new Error('成员探测失败: HTTP 400 code=230001 msg=invalid container_id')
136
+ probeErr.feishuCode = 230001
137
+ assert.equal(extractFeishuErrorCode(probeErr), 230001, '顶层 feishuCode 被挖出')
138
+ // 顶层 code 仍在(旧路径不回退)。
139
+ assert.equal(extractFeishuErrorCode({ code: 230002 }), 230002)
140
+ // 顶层 code 与 feishuCode 并存时 feishuCode 优先(probe 错误以它为准)。
141
+ const both = new Error('dual')
142
+ both.code = 99991663
143
+ both.feishuCode = 230002
144
+ assert.equal(extractFeishuErrorCode(both), 230002, 'feishuCode 优先于 code')
145
+ // isOutOfChatError 同样受益(probe 抛的 230002 也能判定)。
146
+ const p230002 = new Error('成员探测失败: code=230002')
147
+ p230002.feishuCode = 230002
148
+ assert.equal(isOutOfChatError(p230002), true, 'isOutOfChatError 认 feishuCode')
149
+ }
150
+
130
151
  // ── 与旧测试共存检查:迁移后的 config 能被 normalizeApps 直接消化 ──
131
152
  const root3 = mkdtempSync(join(tmpdir(), 'feishu-roundtrip-test-'))
132
153
  try {