@suifei/dsh-ai-team 0.4.65 → 0.4.66

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,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.66 - 2026-11-12
4
+
5
+ **`wake.fail` 带上 cause 链:`NOT_RESUMABLE` 的真实原因不再被吞掉**
6
+
7
+ 真机复盘:过去一天 118 次 `NOT_RESUMABLE` 的日志全是同一句
8
+ `subagent "X" is unavailable`——外层错误把真实原因(persistence 读不出会话 /
9
+ descriptor 不可续 / 血缘校验失败)挂在 `cause` 上丢掉了,等于无法定位。这轮同时核实了
10
+ 这些会话本身是健康的(多帧 zstd 解压后 87 个事件、`subagent/descriptor` 的
11
+ `mode: "continuable"` 都在),所以问题在外层读取路径,不在会话内容。
12
+
13
+ - 新增 `lib/runtime/error-chain.js` 的 `describeCauseChain()`(最多 4 层、防循环、
14
+ 非 Error cause 也能渲染),`wake.fail` 行新增 `cause` 字段。
15
+ - 顺带核实并归档了两条「发现但非缺陷」:
16
+ - `dispatch.fail` 全是 `thread.post E_STALE_REPLY`(乐观并发守卫按设计拒绝,提示可直接行动);
17
+ - `workspace.attach.fail` 在成员会话重建后归零(重启后仅存 1 条,属修复前的旧会话)。
18
+ - 测试:`node --test` **269 通过 / 1 跳过**(新增 `error-chain` 3 例:带 code 的链、
19
+ 深度上限、循环与非法 cause)。
20
+
3
21
  ## 0.4.65 - 2026-11-12
4
22
 
5
23
  **修:重建出来的会话仍落在插件数据目录(host 会话 cwd 是 11-09 的旧值)**
package/README.md CHANGED
@@ -170,7 +170,7 @@ POST /ai-team/api/projects/<id>/commands
170
170
 
171
171
  ## 验证
172
172
 
173
- - `node --test`:**266 通过 / 1 跳过**(跳过项是目录 junction 用例,本机沙箱不允许创建)
173
+ - `node --test`:**269 通过 / 1 跳过**(跳过项是目录 junction 用例,本机沙箱不允许创建)
174
174
  - 真实账本副本干跑(`.ptc/rounds/dryrun-real-ledger.mjs`,可重复运行、不写生产数据):
175
175
  用**已安装的 npm 产物**启动真实项目账本,核对 `health` / `bootstrap` / `/people` /
176
176
  `project.repair`(`acceptedRange` + `seqGaps`)/ 新建项目空目录被 400 拒绝
package/index.js CHANGED
@@ -47,6 +47,7 @@ import { installFaultAdapter } from './lib/host/fault-adapter.js';
47
47
  import { buildModelCatalog } from './lib/host/model-catalog.js';
48
48
  import { createTeamTool } from './lib/host/member-tools.js';
49
49
  import { describeTaskContext, describeWake, planWakes } from './lib/host/waker.js';
50
+ import { describeCauseChain } from './lib/runtime/error-chain.js';
50
51
  import { aggregatePeople } from './lib/host/people-view.js';
51
52
  import { riskView } from './lib/host/risk-view.js';
52
53
  import { weeklyView } from './lib/host/weekly-view.js';
@@ -733,6 +734,10 @@ export function apply(ctx, config = {}) {
733
734
  reason: plan.reason,
734
735
  code: error?.code ?? null,
735
736
  message: error?.message ?? String(error),
737
+ // 外层错误只写「subagent X is unavailable」,真实原因在 cause 里
738
+ // (persistence 读不出会话 / descriptor 不可续 / 血缘校验失败)。
739
+ // 不把它带出来,每次只能看到同一句无从下手的提示。
740
+ cause: describeCauseChain(error),
736
741
  });
737
742
  console.warn('[ai-team] wake failed:', plan.memberId, error?.code ?? error?.message ?? error);
738
743
  // 一次性迁移自愈:旧形态成员会话(历史上由 agents.create 创建、
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 把 Error 的 cause 链摊平成一行可检索文本。
3
+ *
4
+ * 实机背景:`subagents.sendMessage` 失败时外层只给
5
+ * `subagent "X" is unavailable`,真实原因(persistence 读不出会话、descriptor
6
+ * 不可续、血缘校验失败)挂在 `cause` 上被丢掉,诊断日志因此无法定位。
7
+ */
8
+
9
+ const MAX_DEPTH = 4;
10
+ const MAX_PART = 240;
11
+
12
+ /**
13
+ * @param {unknown} error
14
+ * @returns {string|null} `code: message ← code: message`;没有 cause 时返回 null
15
+ */
16
+ export function describeCauseChain(error) {
17
+ if (error === undefined || error === null) return null;
18
+ const parts = [];
19
+ const seen = new Set();
20
+ let current = error.cause;
21
+ let depth = 0;
22
+ while (current !== undefined && current !== null && depth < MAX_DEPTH && !seen.has(current)) {
23
+ seen.add(current);
24
+ const code = typeof current.code === 'string' && current.code !== '' ? `${current.code}: ` : '';
25
+ const message = typeof current.message === 'string' ? current.message : String(current);
26
+ parts.push(`${code}${message}`.slice(0, MAX_PART));
27
+ current = current.cause;
28
+ depth += 1;
29
+ }
30
+ return parts.length === 0 ? null : parts.join(' ← ');
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.65",
3
+ "version": "0.4.66",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",