@suifei/dsh-ai-team 0.4.42 → 0.4.44
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 +24 -0
- package/index.js +22 -3
- package/lib/host/service.js +8 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.44 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**批 12:报告路径按 realpath 判定、唤醒去重键按项目淘汰**
|
|
6
|
+
|
|
7
|
+
- **junction 不再能绕过工作区限制**:`backfillHumanMentions` 只做词法包含性判断,工作区内的 junction/symlink 指向外部时会被当成「在工作区内」,等于把「读主机任意文件」的通道留着。现在两边都取 `realpath` 再比较(取不到才退回词法解析)。
|
|
8
|
+
- **唤醒去重键按项目淘汰**:窗口淘汰用**当前项目**的账本水位去比较所有键,水位较低的项目里刚产生的键会被整批删掉,那些唤醒随后会被重复规划。
|
|
9
|
+
- 测试:`node --test` **244 通过 / 1 跳过**(跳过的是 junction 用例——本机沙箱不允许创建目录 junction,用 `t.skip` 显式标注,不伪装成通过)。
|
|
10
|
+
|
|
11
|
+
## 0.4.43 - 2026-11-12
|
|
12
|
+
|
|
13
|
+
**修复:成员会话的 cwd 落在插件数据目录(workspace attach 失败)**
|
|
14
|
+
|
|
15
|
+
现象(另一台机器 0.4.39 实测):
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[ai-team] member session workspace attach failed: cannot attach session '04109981-…'
|
|
19
|
+
to workspace 'D:\works\jsvm': its cwd resolves to 'C:\Users\…\.dsh\ai-team\default'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **根因**:Host 会话(成员的父会话)创建时 `cwd` 用的是 `booted.dataDir`(插件数据目录),成员作为子会话继承这个 cwd,于是 `workspace.attachSession` 判定「会话 cwd 不在目标工作区内」而拒绝;成员实际也一直在数据目录里干活。
|
|
23
|
+
- **修复**:Host 会话的 `cwd` 改为**当前项目的工作区**(`state.projects[active].workspacePath`),没有才退回数据目录。
|
|
24
|
+
- **诊断**:attach 失败的告警里补上 `projectId`,并直接给出修复动作——`team member.reseat`(cwd 不会随 attach 改变,只能重建会话)——否则用户只看到一行警告。
|
|
25
|
+
- 测试:`node --test` **244/244**。
|
|
26
|
+
|
|
3
27
|
## 0.4.42 - 2026-11-12
|
|
4
28
|
|
|
5
29
|
**批 11:checkpoint 恢复可用、激活单飞、PMO 门禁取实时快照**
|
package/index.js
CHANGED
|
@@ -292,8 +292,10 @@ export function apply(ctx, config = {}) {
|
|
|
292
292
|
try {
|
|
293
293
|
await workspace.attachSession(sessionId);
|
|
294
294
|
} catch (error) {
|
|
295
|
-
diag.append({ ev: 'workspace.attach.fail', sessionId, message: error?.message ?? String(error) });
|
|
296
|
-
|
|
295
|
+
diag.append({ ev: 'workspace.attach.fail', sessionId, projectId: projectRuntime?.id ?? null, message: error?.message ?? String(error) });
|
|
296
|
+
// cwd 不会随 attach 改变:这类失败只能靠重建会话修复,日志里直接给出动作,
|
|
297
|
+
// 否则用户只看到一行警告,成员仍旧在插件数据目录里干活。
|
|
298
|
+
console.warn('[ai-team] member session workspace attach failed:', error?.message ?? error, '— reseat the member (team member.reseat) to recreate its session in the project workspace');
|
|
297
299
|
}
|
|
298
300
|
};
|
|
299
301
|
// A restored member session has no live AgentOptions; without a recorded
|
|
@@ -565,8 +567,12 @@ export function apply(ctx, config = {}) {
|
|
|
565
567
|
if (plans.length === 0) return;
|
|
566
568
|
// Window eviction: a key older than this horizon can no longer dedupe
|
|
567
569
|
// a relevant event, so drop it instead of growing the Map forever.
|
|
570
|
+
// 只淘汰**本项目**的键:`head` 是当前项目的账本水位,拿它去比较别的项目的
|
|
571
|
+
// seq,会把水位较低的项目里刚产生的键全部删掉(那些键还没发挥去重作用)。
|
|
568
572
|
const head = projectRuntime?.ledger?.head?.seq ?? 0;
|
|
573
|
+
const projectSuffix = `:${projectRuntime.id}`;
|
|
569
574
|
for (const [key, seq] of wakeKeys) {
|
|
575
|
+
if (!key.endsWith(projectSuffix)) continue;
|
|
570
576
|
if (Number.isSafeInteger(seq) && head - seq > 500) wakeKeys.delete(key);
|
|
571
577
|
}
|
|
572
578
|
const subagents = serviceOf(ctx, 'subagents');
|
|
@@ -1436,12 +1442,25 @@ export function apply(ctx, config = {}) {
|
|
|
1436
1442
|
const existingHost = [...(booted?.runtimes?.values() ?? [])]
|
|
1437
1443
|
.map((runtime) => runtime.service.state.hostSessionId)
|
|
1438
1444
|
.find((value) => value !== undefined && value !== null);
|
|
1445
|
+
// Host 会话的 cwd 必须是**项目工作区**,不能是插件数据目录:成员会话是它的
|
|
1446
|
+
// 子会话,会继承这个 cwd,于是 workspace.attachSession 报
|
|
1447
|
+
// "its cwd resolves to <…>/ai-team/<profile>" 而被拒,成员实际在数据目录里干活。
|
|
1448
|
+
// 取当前活动项目的 workspacePath,没有才退回数据目录。
|
|
1449
|
+
const hostCwd = () => {
|
|
1450
|
+
const active = booted?.runtime?.service?.state?.projects?.[booted?.activeProjectId ?? ''];
|
|
1451
|
+
const fromActive = typeof active?.workspacePath === 'string' ? active.workspacePath.trim() : '';
|
|
1452
|
+
if (fromActive !== '') return fromActive;
|
|
1453
|
+
const fromRegistry = (booted?.registry?.list?.() ?? [])
|
|
1454
|
+
.map((project) => (typeof project.workspacePath === 'string' ? project.workspacePath.trim() : ''))
|
|
1455
|
+
.find((value) => value !== '');
|
|
1456
|
+
return fromRegistry !== undefined && fromRegistry !== '' ? fromRegistry : (booted?.dataDir ?? process.cwd());
|
|
1457
|
+
};
|
|
1439
1458
|
hostPromise = ensureHostAgent({
|
|
1440
1459
|
agents: serviceOf(ctx, 'agents'),
|
|
1441
1460
|
agentDefaultModel: serviceOf(ctx, 'agentDefaultModel'),
|
|
1442
1461
|
workspaceRegistry: serviceOf(ctx, 'workspaceRegistry'),
|
|
1443
1462
|
sessions: serviceOf(ctx, 'sessions'),
|
|
1444
|
-
cwd:
|
|
1463
|
+
cwd: hostCwd(),
|
|
1445
1464
|
resumeSessionId: existingHost,
|
|
1446
1465
|
}).then(async (value) => {
|
|
1447
1466
|
// Host 会话必须落账:它决定冷恢复与 sendMessage 的 parent,也决定归档
|
package/lib/host/service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import pathDefault from 'node:path';
|
|
3
3
|
import { ERRORS, fail } from '../domain/errors.js';
|
|
4
4
|
import { findReportPath, parseDecisionQuestions } from './decision-report.js';
|
|
@@ -286,12 +286,17 @@ export class TeamService {
|
|
|
286
286
|
const projectId = Object.keys(this.state.projects ?? {})[0];
|
|
287
287
|
// 路径包含性:Thread 正文由 agent 写,正文里的绝对路径不能变成
|
|
288
288
|
// 「读主机任意文件」的通道——只接受项目工作目录内的 .md。
|
|
289
|
+
// 必须按 **realpath** 比较:工作区内的 junction/symlink 指向外部时,
|
|
290
|
+
// 纯词法比较会把它当成「在工作区内」,等于放行任意路径。
|
|
291
|
+
const realOrNull = (value) => {
|
|
292
|
+
try { return realpathSync(value); } catch { return null; }
|
|
293
|
+
};
|
|
289
294
|
const allowedRoot = typeof workspacePath === 'string' && workspacePath !== ''
|
|
290
|
-
? pathDefault.resolve(workspacePath)
|
|
295
|
+
? realOrNull(workspacePath) ?? pathDefault.resolve(workspacePath)
|
|
291
296
|
: null;
|
|
292
297
|
const insideWorkspace = (candidate) => {
|
|
293
298
|
if (allowedRoot === null) return false;
|
|
294
|
-
const resolved = pathDefault.resolve(candidate);
|
|
299
|
+
const resolved = realOrNull(candidate) ?? pathDefault.resolve(candidate);
|
|
295
300
|
const relative = pathDefault.relative(allowedRoot, resolved);
|
|
296
301
|
return relative !== '' && !relative.startsWith('..') && !pathDefault.isAbsolute(relative);
|
|
297
302
|
};
|
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.44",
|
|
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",
|