@suifei/dsh-ai-team 0.4.65 → 0.4.67

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,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.67 - 2026-11-12
4
+
5
+ **启动探针:把「关键服务缺失」变成可判定的一行**
6
+
7
+ 继续追 `NOT_RESUMABLE`。已排除的假设(都有证据):
8
+
9
+ - 会话文件损坏 —— 逐帧解压 87 个事件、`subagent/descriptor` 的 `mode: "continuable"` 完好;
10
+ - 会话未登记工作区 —— 7 个成员会话全部在 `E:\works\il2c` 的 `sessionIds` 里;
11
+ - 后端未挂载 —— `dsh-base` 的 `cordis.patch.yml` 声明了 `session-persistence-jsonl`,宿主启动日志显示 `state: 'active'`。
12
+
13
+ 剩下的嫌疑集中在**运行期取不到服务**:`agents.resume` 在 `sessionPersistence` 缺失时抛
14
+ "cannot resume: session persistence is not configured",`subagents.coldResume` 在同一个
15
+ 服务缺失时直接 `notFound`——两者都会表现为我们看到的 `subagent "X" is unavailable`。
16
+
17
+ - boot 时探针 `sessions` / `sessionPersistence` / `subagents` / `agents` / `workspaceRegistry`:
18
+ 缺失即写 `service.missing.fail`(发布默认级别可见),齐全则写 `service.probe`(`full` 级)。
19
+ - 与 0.4.66 的 `wake.fail.cause` 配合,下一次 `NOT_RESUMABLE` 就能同时拿到「服务地图」和
20
+ 「真实错误码/消息」,不必再猜。
21
+ - 测试:`node --test` **269 通过 / 1 跳过**;干跑可见 `service.probe` 与
22
+ `service.missing.fail` 按预期产出(假 ctx 必然缺失)。
23
+
24
+ ## 0.4.66 - 2026-11-12
25
+
26
+ **`wake.fail` 带上 cause 链:`NOT_RESUMABLE` 的真实原因不再被吞掉**
27
+
28
+ 真机复盘:过去一天 118 次 `NOT_RESUMABLE` 的日志全是同一句
29
+ `subagent "X" is unavailable`——外层错误把真实原因(persistence 读不出会话 /
30
+ descriptor 不可续 / 血缘校验失败)挂在 `cause` 上丢掉了,等于无法定位。这轮同时核实了
31
+ 这些会话本身是健康的(多帧 zstd 解压后 87 个事件、`subagent/descriptor` 的
32
+ `mode: "continuable"` 都在),所以问题在外层读取路径,不在会话内容。
33
+
34
+ - 新增 `lib/runtime/error-chain.js` 的 `describeCauseChain()`(最多 4 层、防循环、
35
+ 非 Error cause 也能渲染),`wake.fail` 行新增 `cause` 字段。
36
+ - 顺带核实并归档了两条「发现但非缺陷」:
37
+ - `dispatch.fail` 全是 `thread.post E_STALE_REPLY`(乐观并发守卫按设计拒绝,提示可直接行动);
38
+ - `workspace.attach.fail` 在成员会话重建后归零(重启后仅存 1 条,属修复前的旧会话)。
39
+ - 测试:`node --test` **269 通过 / 1 跳过**(新增 `error-chain` 3 例:带 code 的链、
40
+ 深度上限、循环与非法 cause)。
41
+
3
42
  ## 0.4.65 - 2026-11-12
4
43
 
5
44
  **修:重建出来的会话仍落在插件数据目录(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';
@@ -257,6 +258,20 @@ export function apply(ctx, config = {}) {
257
258
  // 库模块(ledger / registry / host-agent / skill-provider / jobs)拿不到 diag,
258
259
  // 之前只能 console.warn——线上不可检索。这里把共享失败汇接到真正的 diag。
259
260
  const removeDiagSink = installDiagSink((row) => diag.append(row));
261
+ // 启动探针:实机 `NOT_RESUMABLE` 的两种可能都指向「取不到服务」——
262
+ // `agents.resume` 在 `sessionPersistence` 缺失时抛 "cannot resume: session
263
+ // persistence is not configured",`subagents.coldResume` 在同一个服务缺失时
264
+ // 直接 notFound。这里把缺失的关键服务记成 `.fail`(发布默认级别可见),
265
+ // 不必再靠猜。
266
+ try {
267
+ const required = ['sessions', 'sessionPersistence', 'subagents', 'agents', 'workspaceRegistry'];
268
+ const missing = required.filter((name) => serviceOf(ctx, name) === undefined);
269
+ const present = required.filter((name) => !missing.includes(name));
270
+ diag.append({ ev: 'service.probe', present });
271
+ if (missing.length > 0) diag.append({ ev: 'service.missing.fail', missing });
272
+ } catch (probeError) {
273
+ diag.append({ ev: 'service.probe.fail', message: probeError?.message ?? String(probeError) });
274
+ }
260
275
  // HTTP 层失败/拒绝的统一落点(route.reject 在 errors 白名单内)。
261
276
  const errorResponse = (res, error) => {
262
277
  diag.append({
@@ -733,6 +748,10 @@ export function apply(ctx, config = {}) {
733
748
  reason: plan.reason,
734
749
  code: error?.code ?? null,
735
750
  message: error?.message ?? String(error),
751
+ // 外层错误只写「subagent X is unavailable」,真实原因在 cause 里
752
+ // (persistence 读不出会话 / descriptor 不可续 / 血缘校验失败)。
753
+ // 不把它带出来,每次只能看到同一句无从下手的提示。
754
+ cause: describeCauseChain(error),
736
755
  });
737
756
  console.warn('[ai-team] wake failed:', plan.memberId, error?.code ?? error?.message ?? error);
738
757
  // 一次性迁移自愈:旧形态成员会话(历史上由 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.67",
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",