@suifei/dsh-ai-team 0.4.42 → 0.4.43

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/index.js +18 -3
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.43 - 2026-11-12
4
+
5
+ **修复:成员会话的 cwd 落在插件数据目录(workspace attach 失败)**
6
+
7
+ 现象(另一台机器 0.4.39 实测):
8
+
9
+ ```
10
+ [ai-team] member session workspace attach failed: cannot attach session '04109981-…'
11
+ to workspace 'D:\works\jsvm': its cwd resolves to 'C:\Users\…\.dsh\ai-team\default'
12
+ ```
13
+
14
+ - **根因**:Host 会话(成员的父会话)创建时 `cwd` 用的是 `booted.dataDir`(插件数据目录),成员作为子会话继承这个 cwd,于是 `workspace.attachSession` 判定「会话 cwd 不在目标工作区内」而拒绝;成员实际也一直在数据目录里干活。
15
+ - **修复**:Host 会话的 `cwd` 改为**当前项目的工作区**(`state.projects[active].workspacePath`),没有才退回数据目录。
16
+ - **诊断**:attach 失败的告警里补上 `projectId`,并直接给出修复动作——`team member.reseat`(cwd 不会随 attach 改变,只能重建会话)——否则用户只看到一行警告。
17
+ - 测试:`node --test` **244/244**。
18
+
3
19
  ## 0.4.42 - 2026-11-12
4
20
 
5
21
  **批 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
- console.warn('[ai-team] member session workspace attach failed:', error?.message ?? error);
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
@@ -1436,12 +1438,25 @@ export function apply(ctx, config = {}) {
1436
1438
  const existingHost = [...(booted?.runtimes?.values() ?? [])]
1437
1439
  .map((runtime) => runtime.service.state.hostSessionId)
1438
1440
  .find((value) => value !== undefined && value !== null);
1441
+ // Host 会话的 cwd 必须是**项目工作区**,不能是插件数据目录:成员会话是它的
1442
+ // 子会话,会继承这个 cwd,于是 workspace.attachSession 报
1443
+ // "its cwd resolves to <…>/ai-team/<profile>" 而被拒,成员实际在数据目录里干活。
1444
+ // 取当前活动项目的 workspacePath,没有才退回数据目录。
1445
+ const hostCwd = () => {
1446
+ const active = booted?.runtime?.service?.state?.projects?.[booted?.activeProjectId ?? ''];
1447
+ const fromActive = typeof active?.workspacePath === 'string' ? active.workspacePath.trim() : '';
1448
+ if (fromActive !== '') return fromActive;
1449
+ const fromRegistry = (booted?.registry?.list?.() ?? [])
1450
+ .map((project) => (typeof project.workspacePath === 'string' ? project.workspacePath.trim() : ''))
1451
+ .find((value) => value !== '');
1452
+ return fromRegistry !== undefined && fromRegistry !== '' ? fromRegistry : (booted?.dataDir ?? process.cwd());
1453
+ };
1439
1454
  hostPromise = ensureHostAgent({
1440
1455
  agents: serviceOf(ctx, 'agents'),
1441
1456
  agentDefaultModel: serviceOf(ctx, 'agentDefaultModel'),
1442
1457
  workspaceRegistry: serviceOf(ctx, 'workspaceRegistry'),
1443
1458
  sessions: serviceOf(ctx, 'sessions'),
1444
- cwd: booted?.dataDir ?? process.cwd(),
1459
+ cwd: hostCwd(),
1445
1460
  resumeSessionId: existingHost,
1446
1461
  }).then(async (value) => {
1447
1462
  // Host 会话必须落账:它决定冷恢复与 sendMessage 的 parent,也决定归档
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.42",
3
+ "version": "0.4.43",
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",