@suifei/dsh-ai-team 0.4.69 → 0.4.71
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 +31 -0
- package/index.js +7 -2
- package/lib/host/project-registry.js +6 -6
- package/lib/runtime/wake-failure.js +22 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.71 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**删掉的默认项目不再被静默复活**
|
|
6
|
+
|
|
7
|
+
实测:把 `prj_main` 从 `projects.json` 移除并重启插件后,它又回来了——`ProjectRegistry.load`
|
|
8
|
+
原先「只要列表里缺少 `prj_main` 就 unshift 一条」。于是用户永远删不掉这个默认项目。
|
|
9
|
+
|
|
10
|
+
- 默认项目**只在一个项目都没有时**播种(初装第一入口);已有其它项目时不再凭空补一条;
|
|
11
|
+
- `activeProjectId` 缺失时回退到**第一个真实项目**,而不是硬编码 `prj_main`;
|
|
12
|
+
- 测试:`node --test` **273 通过 / 1 跳过**(新增 1 例:删除后保持删除;空列表才播种默认项目)。
|
|
13
|
+
|
|
14
|
+
附带说明:这一条是为了配合「彻底清掉归档项目 `prj_main`」——在此之前任何删除都会被下一次
|
|
15
|
+
boot 覆盖。
|
|
16
|
+
|
|
17
|
+
## 0.4.70 - 2026-11-12
|
|
18
|
+
|
|
19
|
+
**唤醒失败归类抽成单一实现 + 归档项目不再刷 attach 告警**
|
|
20
|
+
|
|
21
|
+
0.4.69 把「写租约被占用」写成一条独立的 `wake.session-busy`,但重建结果本来就有
|
|
22
|
+
`member.autoreseat` 记录,所以那条行只用于 `full` 级诊断——设计如此,也意味着它
|
|
23
|
+
不该内联在 `index.js` 里用正则判断。
|
|
24
|
+
|
|
25
|
+
- 抽出 `lib/runtime/wake-failure.js` 的 `classifyWakeFailure(causeChain)`:单一实现、
|
|
26
|
+
可单测;只认 `active write handle`,其它原因(无 continuation state / 无 preset
|
|
27
|
+
投影 / 无 cause)一律仍归 `wake.fail`。
|
|
28
|
+
- 归档项目的成员不再尝试 `workspace.attachSession`:`prj_main`(已归档)的 2 个历史
|
|
29
|
+
会话 cwd 指向旧插件数据目录,每次 boot 必然产生一对 `workspace.attach.fail`,
|
|
30
|
+
而归档项目不会有成员干活——这类项目交给「更换目录 + 重建会话」处理。
|
|
31
|
+
- 测试:`node --test` **272 通过 / 1 跳过**(新增 `wake-failure` 2 例:busy 归类、
|
|
32
|
+
其它原因不误判,含「write handle timeout」这类相似文本的反例)。
|
|
33
|
+
|
|
3
34
|
## 0.4.69 - 2026-11-12
|
|
4
35
|
|
|
5
36
|
**`NOT_RESUMABLE` 根因确诊:成员会话的写句柄从未释放**
|
package/index.js
CHANGED
|
@@ -48,6 +48,7 @@ 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
50
|
import { describeCauseChain } from './lib/runtime/error-chain.js';
|
|
51
|
+
import { classifyWakeFailure } from './lib/runtime/wake-failure.js';
|
|
51
52
|
import { aggregatePeople } from './lib/host/people-view.js';
|
|
52
53
|
import { riskView } from './lib/host/risk-view.js';
|
|
53
54
|
import { weeklyView } from './lib/host/weekly-view.js';
|
|
@@ -374,6 +375,11 @@ export function apply(ctx, config = {}) {
|
|
|
374
375
|
};
|
|
375
376
|
const attachMemberWorkspace = async (projectRuntime, sessionId) => {
|
|
376
377
|
if (typeof sessionId !== 'string' || sessionId === '') return;
|
|
378
|
+
// 归档项目(只读视图)的成员不会再干活:给它们 attach 只会每轮 boot 产生
|
|
379
|
+
// 一对注定失败的 `workspace.attach.fail`(会话 cwd 是历史的插件数据目录)。
|
|
380
|
+
// 这类项目交给「更换目录 + 重建会话」处理,不在这里制造噪音。
|
|
381
|
+
const projectState = projectRuntime?.service?.state?.projects?.[projectRuntime?.id ?? ''];
|
|
382
|
+
if (projectState?.status === 'archived') return;
|
|
377
383
|
const workspace = await workspaceForProject(projectRuntime);
|
|
378
384
|
if (workspace === null || workspace === undefined || typeof workspace.attachSession !== 'function') return;
|
|
379
385
|
try {
|
|
@@ -787,9 +793,8 @@ export function apply(ctx, config = {}) {
|
|
|
787
793
|
// 于是冷恢复必然失败。这是 Harness 侧的句柄泄漏,插件只能重建。
|
|
788
794
|
// 归类成单独事件:不再让这类必然失败每天刷上百条 `wake.fail`,
|
|
789
795
|
// 但仍在 `full` 级别可见,且重建路径不变。
|
|
790
|
-
const busyHandle = typeof causeChain === 'string' && /active write handle/i.test(causeChain);
|
|
791
796
|
diag.append({
|
|
792
|
-
ev:
|
|
797
|
+
ev: classifyWakeFailure(causeChain),
|
|
793
798
|
projectId: projectRuntime.id,
|
|
794
799
|
memberId: plan.memberId,
|
|
795
800
|
taskId: plan.taskId ?? null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** Lightweight Project index. The ledger remains the source of truth for Project state. */
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { DEFAULT_PROJECT_ID } from './project-runtime.js';
|
|
@@ -28,15 +28,15 @@ export class ProjectRegistry {
|
|
|
28
28
|
reportFail('registry.corrupt.fail', { kept }, `[ai-team] projects.json was unreadable (${error?.message ?? error}); kept as ${kept}`);
|
|
29
29
|
parsed = null;
|
|
30
30
|
}
|
|
31
|
+
// 默认项目只在**一个项目都没有**时播种(初装的第一入口)。此前只要列表里
|
|
32
|
+
// 缺少 `prj_main` 就补一条:用户把它删掉后会被静默复活,等于删不掉。
|
|
31
33
|
const projects = Array.isArray(parsed?.projects) && parsed.projects.length > 0
|
|
32
34
|
? parsed.projects.filter((project) => typeof project?.id === 'string' && project.id !== '')
|
|
33
|
-
: [
|
|
34
|
-
if (
|
|
35
|
-
projects.unshift({ id: DEFAULT_PROJECT_ID, name: '我的项目', createdAt: 0 });
|
|
36
|
-
}
|
|
35
|
+
: [];
|
|
36
|
+
if (projects.length === 0) projects.push({ id: DEFAULT_PROJECT_ID, name: '我的项目', createdAt: 0 });
|
|
37
37
|
const active = projects.some((project) => project.id === parsed?.activeProjectId)
|
|
38
38
|
? parsed.activeProjectId
|
|
39
|
-
:
|
|
39
|
+
: projects[0].id;
|
|
40
40
|
const registry = new ProjectRegistry({ rootDir, projects, activeProjectId: active });
|
|
41
41
|
if (!existsSync(file)) registry.save();
|
|
42
42
|
return registry;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 唤醒失败的归类。
|
|
3
|
+
*
|
|
4
|
+
* 实机根因(2026-11-12 确诊):成员回合结束后会话仍被一个活跃写句柄占用,
|
|
5
|
+
* `sessionQuery.observeSession` 拒绝发放读租约,冷恢复必然失败:
|
|
6
|
+
*
|
|
7
|
+
* subagent "X" is unavailable
|
|
8
|
+
* cause: session "X" is already owned by an active write handle
|
|
9
|
+
*
|
|
10
|
+
* 插件无法释放这个租约(属 Harness 侧的句柄泄漏),只能重建会话。这类失败是
|
|
11
|
+
* **可预期的**,不应按未知故障刷告警;其它原因仍然算真实失败。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const BUSY_HANDLE = /active write handle/i;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string|null|undefined} causeChain `describeCauseChain()` 的输出
|
|
18
|
+
* @returns {'wake.session-busy'|'wake.fail'} busy 表示「写租约被占用,必然需要重建」
|
|
19
|
+
*/
|
|
20
|
+
export function classifyWakeFailure(causeChain) {
|
|
21
|
+
return typeof causeChain === 'string' && BUSY_HANDLE.test(causeChain) ? 'wake.session-busy' : 'wake.fail';
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.71",
|
|
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",
|