@suifei/dsh-ai-team 0.4.64 → 0.4.65
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 +12 -0
- package/README.md +1 -1
- package/lib/runtime/host-agent.js +33 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.65 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**修:重建出来的会话仍落在插件数据目录(host 会话 cwd 是 11-09 的旧值)**
|
|
6
|
+
|
|
7
|
+
解压真机会话日志后发现:最近 3 小时 34 个新会话里 **30 个 `cwd = C:\Users\SuiFei\.dsh\ai-team\default`**(插件数据目录),且它们都是同一条 host 会话的子会话——那条 host 建于 **2026-11-09**,记录的 cwd 就是旧数据目录。0.4.43 修的是「新建 host 时用项目工作区」,但**持久化的 host 每次 boot 都是 resume,cwd 沿用旧值**,于是成员子会话全部继承它;这正是 `workspace.attach.fail` 每天上百次的来源。
|
|
8
|
+
|
|
9
|
+
- `ensureHostAgent`:resume 之后核对 `session.header.cwd` 与期望的项目工作区;不一致就 **dispose 旧句柄并新建 host**(路径比较忽略大小写与末尾分隔符)。
|
|
10
|
+
- 失败行 `host.resume.cwd-mismatch.fail` 进诊断(带 `expectedCwd` / `actualCwd`),下次 boot 可直接确认是否再次发生。
|
|
11
|
+
- 副作用与自愈路径:新 host 的会话 id 变化后,既有成员的下一次唤醒会 `NOT_RESUMABLE` → `member.autoreseat` 重建到新 host 之下(这是既有机制,不需要额外代码)。
|
|
12
|
+
- 顺带修掉 `diag-sink` 用例的清理竞态(诊断 logger 仍在落盘时 `rm` 报 ENOTEMPTY,改为重试)。
|
|
13
|
+
- 测试:`node --test` **266 通过 / 1 跳过**(新增 2 例:旧 cwd 的 host 会被替换并释放、匹配 cwd 仍走 resume 且大小写/尾斜杠不影响判定)。
|
|
14
|
+
|
|
3
15
|
## 0.4.64 - 2026-11-12
|
|
4
16
|
|
|
5
17
|
**重建后不再从零开始:冷路径提示词带上当前 Task 与最近对话**
|
package/README.md
CHANGED
|
@@ -170,7 +170,7 @@ POST /ai-team/api/projects/<id>/commands
|
|
|
170
170
|
|
|
171
171
|
## 验证
|
|
172
172
|
|
|
173
|
-
- `node --test`:**
|
|
173
|
+
- `node --test`:**266 通过 / 1 跳过**(跳过项是目录 junction 用例,本机沙箱不允许创建)
|
|
174
174
|
- 真实账本副本干跑(`.ptc/rounds/dryrun-real-ledger.mjs`,可重复运行、不写生产数据):
|
|
175
175
|
用**已安装的 npm 产物**启动真实项目账本,核对 `health` / `bootstrap` / `/people` /
|
|
176
176
|
`project.repair`(`acceptedRange` + `seqGaps`)/ 新建项目空目录被 400 拒绝
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* Resolve the parent Agent that owns member activations.
|
|
3
3
|
*
|
|
4
4
|
* Preference order:
|
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
* repaired here by unarchiving on resolve.
|
|
20
20
|
*/
|
|
21
21
|
import { randomUUID } from 'node:crypto';
|
|
22
|
+
import { reportFail } from '../diaglog.js';
|
|
23
|
+
|
|
24
|
+
/** Windows 路径大小写不敏感,末尾分隔符也不该影响判定。 */
|
|
25
|
+
const samePath = (left, right) => {
|
|
26
|
+
const norm = (value) => String(value).replace(/[\\/]+$/, '').replace(/\\/g, '/').toLowerCase();
|
|
27
|
+
return norm(left) === norm(right);
|
|
28
|
+
};
|
|
22
29
|
|
|
23
30
|
export class HostAgentError extends Error {
|
|
24
31
|
constructor(code, message, details = {}) {
|
|
@@ -83,15 +90,31 @@ export async function ensureHostAgent(options) {
|
|
|
83
90
|
try {
|
|
84
91
|
const handle = await agents.resume({ resumeSessionId: options.resumeSessionId });
|
|
85
92
|
await unarchiveHost(options.resumeSessionId);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// 持久化的 host 会话保留着**创建时的 cwd**,而成员子会话会继承它。
|
|
94
|
+
// 实机事故:2026-11-09 建的 host 记的是 `…/.dsh/ai-team/default`,于是
|
|
95
|
+
// 30 个成员会话全在插件数据目录里干活,`workspace.attachSession` 每天被拒
|
|
96
|
+
// 上百次。cwd 不一致时不能复用这条 host——释放它,落到下面的创建分支。
|
|
97
|
+
const expectedCwd = typeof options.cwd === 'string' ? options.cwd.trim() : '';
|
|
98
|
+
const actualCwd = handle?.agent?.session?.header?.cwd ?? options.sessions?.get?.(options.resumeSessionId)?.header?.cwd ?? null;
|
|
99
|
+
if (expectedCwd !== '' && typeof actualCwd === 'string' && actualCwd !== ''
|
|
100
|
+
&& samePath(actualCwd, expectedCwd) === false) {
|
|
101
|
+
try { await handle.dispose?.(); } catch { /* already gone */ }
|
|
102
|
+
reportFail(
|
|
103
|
+
'host.resume.cwd-mismatch.fail',
|
|
104
|
+
{ sessionId: options.resumeSessionId, expectedCwd, actualCwd },
|
|
105
|
+
'[ai-team] Team Host session cwd does not match the project workspace; creating a fresh host',
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
const selection = typeof options.agentDefaultModel?.currentSelection === 'function' ? options.agentDefaultModel.currentSelection() : null;
|
|
109
|
+
persistSelection(options.resumeSessionId, selection);
|
|
110
|
+
return {
|
|
111
|
+
agent: handle.agent,
|
|
112
|
+
created: false,
|
|
113
|
+
resumed: true,
|
|
114
|
+
sessionId: options.resumeSessionId,
|
|
115
|
+
dispose: async () => { try { await handle.dispose?.(); } catch { /* already gone */ } },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
95
118
|
} catch (error) {
|
|
96
119
|
// A persisted host must be resumed: creating another one would break the
|
|
97
120
|
// existing members' direct-child adjacency.
|
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.65",
|
|
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",
|