@suifei/dsh-ai-team 0.4.163 → 0.4.164

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.164 - 2026-12-04
4
+
5
+ - 运行中的常规项目可以在关闭 PMO 自动时开启只读编制巡检。诊断日志同时记录 PMO 状态、验收流量、积压、槽位和建议。关闭 PMO 后建议仅用于诊断采样。感谢 @buger-gif 提供编制巡检和真实验收队列场景(#116)。
6
+
3
7
  ## 0.4.163 - 2026-12-04
4
8
 
5
9
  - `/ai-team 开工` 根据目标建议团队和一张可独立验收的首发样稿。项目、编制和首发任务在同一次确认中落地,任务走文渊阁现有派发与验收流程。项目登记失败后重试可沿用已落盘的原卡。感谢 @buger-gif 提供从一句目标到建队派活的场景(#121)。
package/README.md CHANGED
@@ -37,6 +37,7 @@
37
37
 
38
38
  ## 最近更新
39
39
 
40
+ - **手动调度项目也能巡检编制**(0.4.164)。打开巡检设置后,即使关闭 PMO 自动,也可按窗口观察待验收任务、验收流量和代理树槽位。采样建议留在诊断日志。感谢 [@buger-gif](https://github.com/buger-gif),[#116](https://github.com/suifei/dsh-ai-team/issues/116)。
40
41
  - **一句目标开工**(0.4.163)。在 DSH 会话输入 `/ai-team 开工 目标`,可一起核对预设、编制、首发样稿、执行人和验收条件。确认后创建项目并派发首发任务。感谢 [@buger-gif](https://github.com/buger-gif),[#121](https://github.com/suifei/dsh-ai-team/issues/121)。
41
42
  - **会话里建卡和分派**(0.4.162)。可核对整批任务的执行人、交付标准和独立验收项,再一次确认到文渊阁。待领取的原卡也能在会话里分派。感谢 [@buger-gif](https://github.com/buger-gif),[#121](https://github.com/suifei/dsh-ai-team/issues/121)。
42
43
  - **会话一次确认多项编制调整**(0.4.161)。增员、改岗位和原任务交接可进入同一份草稿,核对整组后一次写入。感谢 [@buger-gif](https://github.com/buger-gif),[#121](https://github.com/suifei/dsh-ai-team/issues/121)。
@@ -202,7 +203,7 @@ const svg = HashAvatar.svg('墨渊', { gender: 'male', age: 'middle', race: 'asi
202
203
 
203
204
  ### 只读编制巡检试跑
204
205
 
205
- 在当前 DSH profile 的 `ai-team` 配置中设 `staffingReviewMinutes: 180` 和 `diagLevel: full` 后,启用 PMO 自动的运行中普通项目会随现有巡检周期采样,每个时间窗口记录一次。`staffingReviewMinutes: 0`(默认)关闭采样。诊断日志中的 `pmo.staffing.review` 包含岗位已分配队列、可认领与待验收队列、最长及平均等待,以及采样窗口内每位成员的提交、验收和退回。返工率按退回的本窗口提交除以本窗口提交数计算,零样本为空。项目级 `acceptanceActivity` 按 `since`、`now` 内的账本记录计数,包含已离队成员和人工处理的结果。通过次数包含人工自验,日志另外列出自验次数。
206
+ 在当前 DSH profile 的 `ai-team` 配置中设 `staffingReviewMinutes: 180` 和 `diagLevel: full` 后,运行中的普通项目会随现有巡检周期采样,每个时间窗口记录一次。关闭 PMO 自动时,采样建议只写入诊断日志。暂停项目会暂停巡检,`staffingReviewMinutes: 0`(默认)关闭采样。诊断日志中的 `pmo.staffing.review` 记录采样时的 `pmoAuto`、岗位已分配队列、可认领与待验收队列、最长及平均等待,以及采样窗口内每位成员的提交、验收和退回。返工率按退回的本窗口提交除以本窗口提交数计算,零样本为空。项目级 `acceptanceActivity` 按 `since`、`now` 内的账本记录计数,包含已离队成员和人工处理的结果。通过次数包含人工自验,日志另外列出自验次数。
206
207
 
207
208
  巡检还会记录没有合格验收人的任务 ID 和在队成员运行回合数。宿主提供 `capacityOf` 时,`host-live` 表示当前代理树的实时槽位快照,`occupiedSlots` 和 `remainingSlots` 分别记录占用和余量。`host` 表示这棵树的容量回执,`default` 表示默认估计。这两种来源的占用和余量字段为空。宿主释放槽位后,插件优先补投本树排队最久的成员。加人建议会提示采样时的槽位不足,长期无人可验收的任务也会进入现有补位建议。
208
209
 
@@ -453,7 +454,7 @@ round-19 DeepSeek + Zhipu 双 provider
453
454
  | 贡献者 | 贡献 | 带来的进展 |
454
455
  |---|---|---|
455
456
  | [@idontlikefruit](https://github.com/idontlikefruit) | 受阻状态的三组复现输入 [#115](https://github.com/suifei/dsh-ai-team/issues/115) | 统一看板徽标、读屏和分组统计的受阻判定,保留历史依赖 |
456
- | [@buger-gif](https://github.com/buger-gif) | 编制巡检、离队交接案例 [#116](https://github.com/suifei/dsh-ai-team/issues/116)、[#117](https://github.com/suifei/dsh-ai-team/issues/117),派发空转记录 [#120](https://github.com/suifei/dsh-ai-team/issues/120),会话按目标建队开工、指定人数、按目标补位、调整编制与任务分派场景 [#121](https://github.com/suifei/dsh-ai-team/issues/121) | 统一认领与离队顺序,减少派发空转,可按窗口对照验收流量和代理树槽位。在 DSH 会话按目标核对团队和首发样稿后一次确认开工,也可调整编制、交接原任务或分派已有卡片 |
457
+ | [@buger-gif](https://github.com/buger-gif) | 编制巡检、离队交接案例 [#116](https://github.com/suifei/dsh-ai-team/issues/116)、[#117](https://github.com/suifei/dsh-ai-team/issues/117),派发空转记录 [#120](https://github.com/suifei/dsh-ai-team/issues/120),会话按目标建队开工、指定人数、按目标补位、调整编制与任务分派场景 [#121](https://github.com/suifei/dsh-ai-team/issues/121) | 统一认领与离队顺序,减少派发空转。手动调度的项目也可以按巡检窗口对照验收流量和代理树槽位。在 DSH 会话按目标核对团队和首发样稿后一次确认开工,也可调整编制、交接原任务或分派已有卡片 |
457
458
  | [@Estelle00](https://github.com/Estelle00) | DSH 0.2.3 启动 503 的复现和桌面验证 [#122](https://github.com/suifei/dsh-ai-team/issues/122) | 接入新版会话鉴权接口,恢复工作台初始化,并在 Alpha 宿主验证看板登录 |
458
459
  | [@phm101299-ui](https://github.com/phm101299-ui) | PMO 冷恢复的复现、根因和桌面验证 [#112](https://github.com/suifei/dsh-ai-team/issues/112) | 让原 PMO 在宿主重启后带着模型路由继续工作,保留成员关系和任务 |
459
460
  | [@godfay-g](https://github.com/godfay-g) | 技能目录和 ZIP 的导入建议 [#109](https://github.com/suifei/dsh-ai-team/issues/109) | 成员与自定义人才可在文渊阁选择已安装的技能或导入完整技能包。0.4.151 统一新建人才的导入入口,并由文渊阁直接安装整包 |
package/index.js CHANGED
@@ -1395,6 +1395,39 @@ export function apply(ctx, config = {}) {
1395
1395
  diag.append({ ev: 'blueprint.advance.fail', projectId: runtime.id, message: error?.message ?? String(error) });
1396
1396
  }
1397
1397
  };
1398
+ const inspectStaffing = (projectRuntime) => {
1399
+ const staffingState = projectRuntime.service.state;
1400
+ const project = staffingState.projects?.[projectRuntime.id];
1401
+ if (disposed || !project || project.status === 'archived' || project.runState === 'stopped') return [];
1402
+ const pmoAuto = project.pmoAuto !== false;
1403
+ const now = Date.now();
1404
+ const reviewInterval = (config.staffingReviewMinutes ?? 0) * 60_000;
1405
+ const reviewWindow = diag.level === 'full' && reviewInterval > 0 ? Math.floor(now / reviewInterval) : null;
1406
+ const reviewDue = reviewWindow !== null && pmoStaffingReviewWindows.get(projectRuntime.id) !== reviewWindow;
1407
+ if (!pmoAuto && (!reviewDue || project.blueprint)) return [];
1408
+ const suppressed = [];
1409
+ const inTurn = (id) => turnsInFlight.has(id);
1410
+ const hostCapacity = treeCapacity.read(hosts.get(projectRuntime.id)?.agent, serviceOf(ctx, 'subagents'));
1411
+ const capacity = hostCapacity.capacity ?? HOST_SUBAGENT_LIMIT;
1412
+ const adviceList = planStaffingAdvice(staffingState, {
1413
+ now, inTurn, capacity, remainingSlots: hostCapacity.remainingSlots,
1414
+ humanId: projectRuntime.service.humanId(), wait: (config.staffingAdviceMinutes ?? 30) * 60_000,
1415
+ onSuppressed: reviewDue ? (entry) => suppressed.push(entry) : undefined,
1416
+ });
1417
+ if (reviewDue) {
1418
+ pmoStaffingReviewWindows.set(projectRuntime.id, reviewWindow);
1419
+ try {
1420
+ const review = staffingReview(staffingState, projectRuntime.ledger.events, {
1421
+ ...hostCapacity, now, intervalMs: reviewInterval, capacity,
1422
+ inTurn, advice: adviceList, suppressed,
1423
+ });
1424
+ diag.append({ ev: 'pmo.staffing.review', projectId: projectRuntime.id, window: reviewWindow, pmoAuto, ...review });
1425
+ } catch (error) {
1426
+ diag.append({ ev: 'pmo.staffing.review.fail', projectId: projectRuntime.id, message: error?.message ?? String(error) });
1427
+ }
1428
+ }
1429
+ return pmoAuto ? adviceList : [];
1430
+ };
1398
1431
  const pmoTick = async (projectRuntime) => {
1399
1432
  if (projectRuntime === null || projectRuntime === undefined) return;
1400
1433
  // 归档修复重试点:boot 时 workspaceRegistry 往往还没 active,等 tick
@@ -1441,10 +1474,13 @@ export function apply(ctx, config = {}) {
1441
1474
  // 门禁必须在 await 之后重新取:reconcileJobs 可能耗时数秒,期间 Human
1442
1475
  // 可能已经停用 PMO / 归档 / 停止项目,用 await 之前的快照会继续写账本。
1443
1476
  const project = projectRuntime.service.state.projects?.[projectRuntime.id];
1444
- if (project === undefined || project.pmoAuto === false || project.status === 'archived') return;
1445
1477
  // P6 停止门:stopped 项目停止一切派发(补派/心跳/升级/continue 全停),
1446
1478
  // 正在执行的回合自然完成;唤醒事件 hook 同样检查(见 wakeFromResult)。
1447
- if (project.runState === 'stopped') return;
1479
+ if (!project || project.status === 'archived' || project.runState === 'stopped') return;
1480
+ if (project.pmoAuto === false) {
1481
+ inspectStaffing(projectRuntime);
1482
+ return;
1483
+ }
1448
1484
  for (const member of Object.values(state.members ?? {})) {
1449
1485
  if (member.kind === 'agent' && typeof member.sessionId === 'string') {
1450
1486
  await titleMemberSession(projectRuntime, member);
@@ -1505,34 +1541,9 @@ export function apply(ctx, config = {}) {
1505
1541
  }, {});
1506
1542
  }
1507
1543
  // 加人建议:推进过慢(待办没人接 / 待验收排长队)时给 Human 收件箱一条建议,由 Human 决定(planStaffingAdvice)。
1508
- const staffingState = projectRuntime.service.state;
1509
- const reviewInterval = (config.staffingReviewMinutes ?? 0) * 60_000;
1510
- const reviewWindow = diag.level === 'full' && reviewInterval > 0 ? Math.floor(now / reviewInterval) : null;
1511
- const reviewDue = reviewWindow !== null && pmoStaffingReviewWindows.get(projectRuntime.id) !== reviewWindow;
1512
- const suppressed = [];
1513
- const inTurn = (id) => turnsInFlight.has(id);
1514
- const hostCapacity = treeCapacity.read(hosts.get(projectRuntime.id)?.agent, serviceOf(ctx, 'subagents'));
1515
- const capacity = hostCapacity.capacity ?? HOST_SUBAGENT_LIMIT;
1516
- const adviceList = planStaffingAdvice(staffingState, {
1517
- now, inTurn, capacity, remainingSlots: hostCapacity.remainingSlots,
1518
- humanId: projectRuntime.service.humanId(), wait: (config.staffingAdviceMinutes ?? 30) * 60_000,
1519
- onSuppressed: reviewDue ? (entry) => suppressed.push(entry) : undefined,
1520
- });
1521
- if (reviewDue) {
1522
- pmoStaffingReviewWindows.set(projectRuntime.id, reviewWindow);
1523
- try {
1524
- const review = staffingReview(staffingState, projectRuntime.ledger.events, {
1525
- ...hostCapacity, now, intervalMs: reviewInterval, capacity,
1526
- inTurn, advice: adviceList, suppressed,
1527
- });
1528
- diag.append({ ev: 'pmo.staffing.review', projectId: projectRuntime.id, window: reviewWindow, ...review });
1529
- } catch (error) {
1530
- diag.append({ ev: 'pmo.staffing.review.fail', projectId: projectRuntime.id, message: error?.message ?? String(error) });
1531
- }
1532
- }
1533
- for (const advice of adviceList) {
1544
+ for (const advice of inspectStaffing(projectRuntime)) {
1534
1545
  const item = await projectRuntime.service.recordStaffingAdvice(projectRuntime.id, advice);
1535
- diag.append({ ev: 'pmo.advice', projectId: projectRuntime.id, role: advice.role, count: advice.count, title: advice.title, itemId: item?.id ?? null });
1546
+ if (item) diag.append({ ev: 'pmo.advice', projectId: projectRuntime.id, role: advice.role, count: advice.count, title: advice.title, itemId: item.id });
1536
1547
  }
1537
1548
  if (active.length > 0) {
1538
1549
  // Prune per-task clock entries whose task left the active set, so
@@ -1,109 +1,109 @@
1
- /** Lightweight Project index. The ledger remains the source of truth for Project state. */
2
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { DEFAULT_PROJECT_ID } from './project-runtime.js';
5
- import { reportFail } from '../diaglog.js';
6
-
7
- export class ProjectRegistry {
8
- constructor({ rootDir, projects, activeProjectId }) {
9
- this.rootDir = rootDir;
10
- this.projects = Array.isArray(projects) ? projects : [];
11
- this.activeProjectId = activeProjectId ?? DEFAULT_PROJECT_ID;
12
- }
13
-
14
- static load(rootDir, options = {}) {
15
- // 初装时会给一个默认项目;它必须有工作目录,否则成员会话的 cwd 只能落到
16
- // 插件数据目录(workspace attach 会被拒,成员也在错误目录里干活)。
17
- const defaultWorkspacePath = typeof options.defaultWorkspacePath === 'string' ? options.defaultWorkspacePath : '';
18
- mkdirSync(rootDir, { recursive: true });
19
- const file = join(rootDir, 'projects.json');
20
- let parsed;
21
- try {
22
- parsed = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;
23
- } catch (error) {
24
- // A corrupt index must not silently vanish the user's project list:
25
- // keep the broken file for forensics, then fall back to the default.
26
- const kept = `${file}.corrupt-${Date.now()}`;
27
- try { renameSync(file, kept); } catch { /* rename is best-effort */ }
28
- reportFail('registry.corrupt.fail', { kept }, `[ai-team] projects.json was unreadable (${error?.message ?? error}); kept as ${kept}`);
29
- parsed = null;
30
- }
31
- // 默认项目只在**一个项目都没有**时播种(初装的第一入口)。此前只要列表里
32
- // 缺少 `prj_main` 就补一条:用户把它删掉后会被静默复活,等于删不掉。
33
- const projects = Array.isArray(parsed?.projects) && parsed.projects.length > 0
34
- ? parsed.projects.filter((project) => typeof project?.id === 'string' && project.id !== '')
35
- : [];
36
- if (projects.length === 0) projects.push({ id: DEFAULT_PROJECT_ID, name: '我的项目', createdAt: 0 });
37
- const active = projects.some((project) => project.id === parsed?.activeProjectId)
38
- ? parsed.activeProjectId
39
- : projects[0].id;
40
- const registry = new ProjectRegistry({ rootDir, projects, activeProjectId: active });
41
- if (!existsSync(file)) registry.save();
42
- return registry;
43
- }
44
-
45
- get activeProject() {
46
- return this.projects.find((project) => project.id === this.activeProjectId) ?? this.projects[0];
47
- }
48
-
49
- list() {
50
- return this.projects.map((project) => ({ ...project, active: project.id === this.activeProjectId }));
51
- }
52
-
53
- /** 更新某个项目的工作目录(与账本的 project/workspace-changed 保持同步)。 */
54
- setWorkspace(id, workspacePath) {
55
- const project = this.projects.find((entry) => entry.id === id);
56
- if (project === undefined) return false;
57
- const next = typeof workspacePath === 'string' ? workspacePath : '';
58
- if ((project.workspacePath ?? '') === next) return false;
59
- project.workspacePath = next;
60
- this.save();
61
- return true;
62
- }
63
- add({ id, name, createdAt, goal, workspacePath }) {
64
- if (typeof id !== 'string' || id === '') throw new Error('project id is required');
65
- if (!this.projects.some((project) => project.id === id)) {
66
- this.projects.push({ id, name: name ?? id, goal: goal ?? '', workspacePath: workspacePath ?? '', createdAt: createdAt ?? Date.now() });
67
- try {
68
- this.save();
69
- } catch (error) {
70
- this.projects.pop();
71
- throw error;
72
- }
73
- }
74
- return this.projects.find((project) => project.id === id);
75
- }
76
-
77
- setActive(id) {
78
- const project = this.projects.find((entry) => entry.id === id);
79
- if (project === undefined) throw new Error(`unknown project: ${id}`);
80
- // 归档项目不能成为 active:registry 的 active 会被 bootstrap 当作「默认项目」,
81
- // 指向一个已归档/无账本的项目会让工作台直接不可达。
82
- if (project.archived === true) throw new Error(`project ${id} is archived`);
83
- this.activeProjectId = id;
84
- this.save();
85
- }
86
-
87
- /** Mirror a Project's archive flag into the global index (ledger stays the source of truth). */
88
- setArchived(id, archived) {
89
- const project = this.projects.find((entry) => entry.id === id);
90
- if (project === undefined) throw new Error(`unknown project: ${id}`);
91
- project.archived = archived === true;
92
- if (archived === true && this.activeProjectId === id) {
93
- const fallback = this.projects.find((entry) => entry.id !== id && entry.archived !== true);
94
- if (fallback !== undefined) this.activeProjectId = fallback.id;
95
- }
96
- this.save();
97
- return project;
98
- }
99
-
100
- save() {
101
- const file = join(this.rootDir, 'projects.json');
102
- const temp = `${file}.tmp`;
103
- writeFileSync(temp, JSON.stringify({
104
- activeProjectId: this.activeProjectId,
105
- projects: this.projects,
106
- }, null, 2), 'utf8');
107
- renameSync(temp, file);
108
- }
109
- }
1
+ /** Lightweight Project index. The ledger remains the source of truth for Project state. */
2
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { DEFAULT_PROJECT_ID } from './project-runtime.js';
5
+ import { reportFail } from '../diaglog.js';
6
+
7
+ export class ProjectRegistry {
8
+ constructor({ rootDir, projects, activeProjectId }) {
9
+ this.rootDir = rootDir;
10
+ this.projects = Array.isArray(projects) ? projects : [];
11
+ this.activeProjectId = activeProjectId ?? DEFAULT_PROJECT_ID;
12
+ }
13
+
14
+ static load(rootDir, options = {}) {
15
+ // 初装时会给一个默认项目;它必须有工作目录,否则成员会话的 cwd 只能落到
16
+ // 插件数据目录(workspace attach 会被拒,成员也在错误目录里干活)。
17
+ const defaultWorkspacePath = typeof options.defaultWorkspacePath === 'string' ? options.defaultWorkspacePath : '';
18
+ mkdirSync(rootDir, { recursive: true });
19
+ const file = join(rootDir, 'projects.json');
20
+ let parsed;
21
+ try {
22
+ parsed = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;
23
+ } catch (error) {
24
+ // A corrupt index must not silently vanish the user's project list:
25
+ // keep the broken file for forensics, then fall back to the default.
26
+ const kept = `${file}.corrupt-${Date.now()}`;
27
+ try { renameSync(file, kept); } catch { /* rename is best-effort */ }
28
+ reportFail('registry.corrupt.fail', { kept }, `[ai-team] projects.json was unreadable (${error?.message ?? error}); kept as ${kept}`);
29
+ parsed = null;
30
+ }
31
+ // 默认项目只在**一个项目都没有**时播种(初装的第一入口)。此前只要列表里
32
+ // 缺少 `prj_main` 就补一条:用户把它删掉后会被静默复活,等于删不掉。
33
+ const projects = Array.isArray(parsed?.projects) && parsed.projects.length > 0
34
+ ? parsed.projects.filter((project) => typeof project?.id === 'string' && project.id !== '')
35
+ : [];
36
+ if (projects.length === 0) projects.push({ id: DEFAULT_PROJECT_ID, name: '我的项目', createdAt: 0 });
37
+ const active = projects.some((project) => project.id === parsed?.activeProjectId)
38
+ ? parsed.activeProjectId
39
+ : projects[0].id;
40
+ const registry = new ProjectRegistry({ rootDir, projects, activeProjectId: active });
41
+ if (!existsSync(file)) registry.save();
42
+ return registry;
43
+ }
44
+
45
+ get activeProject() {
46
+ return this.projects.find((project) => project.id === this.activeProjectId) ?? this.projects[0];
47
+ }
48
+
49
+ list() {
50
+ return this.projects.map((project) => ({ ...project, active: project.id === this.activeProjectId }));
51
+ }
52
+
53
+ /** 更新某个项目的工作目录(与账本的 project/workspace-changed 保持同步)。 */
54
+ setWorkspace(id, workspacePath) {
55
+ const project = this.projects.find((entry) => entry.id === id);
56
+ if (project === undefined) return false;
57
+ const next = typeof workspacePath === 'string' ? workspacePath : '';
58
+ if ((project.workspacePath ?? '') === next) return false;
59
+ project.workspacePath = next;
60
+ this.save();
61
+ return true;
62
+ }
63
+ add({ id, name, createdAt, goal, workspacePath }) {
64
+ if (typeof id !== 'string' || id === '') throw new Error('project id is required');
65
+ if (!this.projects.some((project) => project.id === id)) {
66
+ this.projects.push({ id, name: name ?? id, goal: goal ?? '', workspacePath: workspacePath ?? '', createdAt: createdAt ?? Date.now() });
67
+ try {
68
+ this.save();
69
+ } catch (error) {
70
+ this.projects.pop();
71
+ throw error;
72
+ }
73
+ }
74
+ return this.projects.find((project) => project.id === id);
75
+ }
76
+
77
+ setActive(id) {
78
+ const project = this.projects.find((entry) => entry.id === id);
79
+ if (project === undefined) throw new Error(`unknown project: ${id}`);
80
+ // 归档项目不能成为 active:registry 的 active 会被 bootstrap 当作「默认项目」,
81
+ // 指向一个已归档/无账本的项目会让工作台直接不可达。
82
+ if (project.archived === true) throw new Error(`project ${id} is archived`);
83
+ this.activeProjectId = id;
84
+ this.save();
85
+ }
86
+
87
+ /** Mirror a Project's archive flag into the global index (ledger stays the source of truth). */
88
+ setArchived(id, archived) {
89
+ const project = this.projects.find((entry) => entry.id === id);
90
+ if (project === undefined) throw new Error(`unknown project: ${id}`);
91
+ project.archived = archived === true;
92
+ if (archived === true && this.activeProjectId === id) {
93
+ const fallback = this.projects.find((entry) => entry.id !== id && entry.archived !== true);
94
+ if (fallback !== undefined) this.activeProjectId = fallback.id;
95
+ }
96
+ this.save();
97
+ return project;
98
+ }
99
+
100
+ save() {
101
+ const file = join(this.rootDir, 'projects.json');
102
+ const temp = `${file}.tmp`;
103
+ writeFileSync(temp, JSON.stringify({
104
+ activeProjectId: this.activeProjectId,
105
+ projects: this.projects,
106
+ }, null, 2), 'utf8');
107
+ renameSync(temp, file);
108
+ }
109
+ }
@@ -1805,6 +1805,8 @@ export class TeamService {
1805
1805
  */
1806
1806
  async recordStaffingAdvice(projectId, advice) {
1807
1807
  return this.runExclusive(async () => {
1808
+ const project = this.state.projects?.[projectId];
1809
+ if (!project || project.pmoAuto === false || project.status === 'archived' || project.runState === 'stopped') return null;
1808
1810
  const humanId = this.humanId();
1809
1811
  if (humanId === null) return null;
1810
1812
  const item = createInboxItem({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.163",
3
+ "version": "0.4.164",
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",