@suifei/dsh-ai-team 0.4.164 → 0.4.165

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.165 - 2026-12-04
4
+
5
+ - 编制巡检的连续窗口按新入账的序号统计提交、验收和退回。宿主重启、跳过窗口或账本水位失效时,在诊断记录中标出新起点。感谢 @buger-gif 提供验收流量与编制巡检的对照场景(#116)。
6
+
3
7
  ## 0.4.164 - 2026-12-04
4
8
 
5
9
  - 运行中的常规项目可以在关闭 PMO 自动时开启只读编制巡检。诊断日志同时记录 PMO 状态、验收流量、积压、槽位和建议。关闭 PMO 后建议仅用于诊断采样。感谢 @buger-gif 提供编制巡检和真实验收队列场景(#116)。
package/README.md CHANGED
@@ -37,6 +37,7 @@
37
37
 
38
38
  ## 最近更新
39
39
 
40
+ - **巡检连续窗口精确对账**(0.4.165)。连续采样按两次账本水位之间的新增记录统计提交、验收和退回。巡检在首次启动及采样中断后标出新的起点。感谢 [@buger-gif](https://github.com/buger-gif),[#116](https://github.com/suifei/dsh-ai-team/issues/116)。
40
41
  - **手动调度项目也能巡检编制**(0.4.164)。打开巡检设置后,即使关闭 PMO 自动,也可按窗口观察待验收任务、验收流量和代理树槽位。采样建议留在诊断日志。感谢 [@buger-gif](https://github.com/buger-gif),[#116](https://github.com/suifei/dsh-ai-team/issues/116)。
41
42
  - **一句目标开工**(0.4.163)。在 DSH 会话输入 `/ai-team 开工 目标`,可一起核对预设、编制、首发样稿、执行人和验收条件。确认后创建项目并派发首发任务。感谢 [@buger-gif](https://github.com/buger-gif),[#121](https://github.com/suifei/dsh-ai-team/issues/121)。
42
43
  - **会话里建卡和分派**(0.4.162)。可核对整批任务的执行人、交付标准和独立验收项,再一次确认到文渊阁。待领取的原卡也能在会话里分派。感谢 [@buger-gif](https://github.com/buger-gif),[#121](https://github.com/suifei/dsh-ai-team/issues/121)。
@@ -203,7 +204,9 @@ const svg = HashAvatar.svg('墨渊', { gender: 'male', age: 'middle', race: 'asi
203
204
 
204
205
  ### 只读编制巡检试跑
205
206
 
206
- 在当前 DSH profile 的 `ai-team` 配置中设 `staffingReviewMinutes: 180` 和 `diagLevel: full` 后,运行中的普通项目会随现有巡检周期采样,每个时间窗口记录一次。关闭 PMO 自动时,采样建议只写入诊断日志。暂停项目会暂停巡检,`staffingReviewMinutes: 0`(默认)关闭采样。诊断日志中的 `pmo.staffing.review` 记录采样时的 `pmoAuto`、岗位已分配队列、可认领与待验收队列、最长及平均等待,以及采样窗口内每位成员的提交、验收和退回。返工率按退回的本窗口提交除以本窗口提交数计算,零样本为空。项目级 `acceptanceActivity` 按 `since`、`now` 内的账本记录计数,包含已离队成员和人工处理的结果。通过次数包含人工自验,日志另外列出自验次数。
207
+ 在当前 DSH profile 的 `ai-team` 配置中设 `staffingReviewMinutes: 180` 和 `diagLevel: full` 后,运行中的普通项目会随现有巡检周期采样,每个时间窗口记录一次。关闭 PMO 自动时,采样建议只写入诊断日志。暂停项目会暂停巡检,`staffingReviewMinutes: 0`(默认)关闭采样。诊断日志中的 `pmo.staffing.review` 记录采样时的 `pmoAuto`、岗位已分配队列、可认领与待验收队列、最长及平均等待,以及采样窗口内每位成员的提交、验收和退回。返工率按退回的本窗口提交除以本窗口提交数计算,零样本为空。
208
+
209
+ 连续窗口按 `afterSeq` 到 `headSeq` 之间新入账的记录统计提交、验收和退回。`afterSeq` 是上一条采样的账本水位。首次采样、重启或窗口中断时,`afterSeq` 为 `null`,按 `(since, now]` 的时间范围开启一段新记录。项目级 `acceptanceActivity` 包含已离队成员和人工处理的结果。通过次数包含人工自验,日志另外列出自验次数。
207
210
 
208
211
  巡检还会记录没有合格验收人的任务 ID 和在队成员运行回合数。宿主提供 `capacityOf` 时,`host-live` 表示当前代理树的实时槽位快照,`occupiedSlots` 和 `remainingSlots` 分别记录占用和余量。`host` 表示这棵树的容量回执,`default` 表示默认估计。这两种来源的占用和余量字段为空。宿主释放槽位后,插件优先补投本树排队最久的成员。加人建议会提示采样时的槽位不足,长期无人可验收的任务也会进入现有补位建议。
209
212
 
@@ -454,7 +457,7 @@ round-19 DeepSeek + Zhipu 双 provider
454
457
  | 贡献者 | 贡献 | 带来的进展 |
455
458
  |---|---|---|
456
459
  | [@idontlikefruit](https://github.com/idontlikefruit) | 受阻状态的三组复现输入 [#115](https://github.com/suifei/dsh-ai-team/issues/115) | 统一看板徽标、读屏和分组统计的受阻判定,保留历史依赖 |
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 会话按目标核对团队和首发样稿后一次确认开工,也可调整编制、交接原任务或分派已有卡片 |
460
+ | [@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 会话按目标核对团队和首发样稿后一次确认开工,也可调整编制、交接原任务或分派已有卡片 |
458
461
  | [@Estelle00](https://github.com/Estelle00) | DSH 0.2.3 启动 503 的复现和桌面验证 [#122](https://github.com/suifei/dsh-ai-team/issues/122) | 接入新版会话鉴权接口,恢复工作台初始化,并在 Alpha 宿主验证看板登录 |
459
462
  | [@phm101299-ui](https://github.com/phm101299-ui) | PMO 冷恢复的复现、根因和桌面验证 [#112](https://github.com/suifei/dsh-ai-team/issues/112) | 让原 PMO 在宿主重启后带着模型路由继续工作,保留成员关系和任务 |
460
463
  | [@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
@@ -1403,7 +1403,8 @@ export function apply(ctx, config = {}) {
1403
1403
  const now = Date.now();
1404
1404
  const reviewInterval = (config.staffingReviewMinutes ?? 0) * 60_000;
1405
1405
  const reviewWindow = diag.level === 'full' && reviewInterval > 0 ? Math.floor(now / reviewInterval) : null;
1406
- const reviewDue = reviewWindow !== null && pmoStaffingReviewWindows.get(projectRuntime.id) !== reviewWindow;
1406
+ const previous = pmoStaffingReviewWindows.get(projectRuntime.id);
1407
+ const reviewDue = reviewWindow !== null && (previous === undefined || reviewWindow > previous.window);
1407
1408
  if (!pmoAuto && (!reviewDue || project.blueprint)) return [];
1408
1409
  const suppressed = [];
1409
1410
  const inTurn = (id) => turnsInFlight.has(id);
@@ -1415,15 +1416,22 @@ export function apply(ctx, config = {}) {
1415
1416
  onSuppressed: reviewDue ? (entry) => suppressed.push(entry) : undefined,
1416
1417
  });
1417
1418
  if (reviewDue) {
1418
- pmoStaffingReviewWindows.set(projectRuntime.id, reviewWindow);
1419
+ const sample = { window: reviewWindow };
1419
1420
  try {
1421
+ // 修复账本可能重用序号,只有原水位仍在这条哈希链上才能接续。
1422
+ const validPrior = previous?.window === reviewWindow - 1 && previous.headSeq <= staffingState.lastSeq
1423
+ && projectRuntime.ledger.writer.hashAt(previous.headSeq) === previous.lastHash;
1424
+ const prior = validPrior ? previous : null;
1420
1425
  const review = staffingReview(staffingState, projectRuntime.ledger.events, {
1421
- ...hostCapacity, now, intervalMs: reviewInterval, capacity,
1426
+ ...hostCapacity, now, intervalMs: reviewInterval, since: prior?.now, afterSeq: prior?.headSeq, capacity,
1422
1427
  inTurn, advice: adviceList, suppressed,
1423
1428
  });
1424
1429
  diag.append({ ev: 'pmo.staffing.review', projectId: projectRuntime.id, window: reviewWindow, pmoAuto, ...review });
1430
+ Object.assign(sample, { now, headSeq: review.headSeq, lastHash: staffingState.lastHash });
1425
1431
  } catch (error) {
1426
1432
  diag.append({ ev: 'pmo.staffing.review.fail', projectId: projectRuntime.id, message: error?.message ?? String(error) });
1433
+ } finally {
1434
+ pmoStaffingReviewWindows.set(projectRuntime.id, sample);
1427
1435
  }
1428
1436
  }
1429
1437
  return pmoAuto ? adviceList : [];
package/lib/host/pmo.js CHANGED
@@ -268,16 +268,21 @@ const ACCEPTANCE_ACTIVITY = new Map([
268
268
  ['review/changes-requested', 'returned'],
269
269
  ]);
270
270
 
271
- /** A read-only rollup of the existing queues and observed submissions in this window. */
272
- export function staffingReview(state, events, { now, intervalMs, capacity, capacitySource = null, occupiedSlots = null, remainingSlots = null, inTurn, advice = [], suppressed = [] }) {
273
- const since = now - intervalMs;
271
+ /** An unlinked sample uses wall time. Consecutive samples count newly appended records. */
272
+ export function staffingReview(state, events, {
273
+ now, intervalMs, since = now - intervalMs, afterSeq = null, capacity, capacitySource = null,
274
+ occupiedSlots = null, remainingSlots = null, inTurn, advice = [], suppressed = [],
275
+ }) {
276
+ const headSeq = state.lastSeq ?? null;
274
277
  const people = new Map(Object.values(state.members ?? {})
275
278
  .filter((member) => member.kind === 'agent' && member.status !== 'retired')
276
279
  .map(({ id, role, status }) => [id, { id, role: role || '未设置岗位', status, submitted: 0, accepted: 0, returned: 0 }]));
277
280
  const submissions = new Map();
278
281
  const acceptanceActivity = { submitted: 0, accepted: 0, returned: 0, humanSelfAccepted: 0 };
279
282
  for (const event of events) {
280
- if (!Number.isFinite(event.at) || event.at < since || event.at > now) continue;
283
+ if (afterSeq === null) {
284
+ if (!Number.isFinite(event.at) || event.at <= since || event.at > now) continue;
285
+ } else if (!Number.isSafeInteger(event.seq) || event.seq <= afterSeq || event.seq > headSeq) continue;
281
286
  const activity = ACCEPTANCE_ACTIVITY.get(event.type);
282
287
  const taskId = event.payload?.taskId ?? event.payload?.id;
283
288
  if (activity === undefined || typeof taskId !== 'string' || taskId === '') continue;
@@ -313,7 +318,7 @@ export function staffingReview(state, events, { now, intervalMs, capacity, capac
313
318
  if (task.status === 'in_progress') group.inProgress += 1;
314
319
  }
315
320
  return {
316
- since, now, capacity, capacitySource, capacityScope: 'agent-tree', occupiedSlots, remainingSlots, activeMemberTurns,
321
+ since, now, afterSeq, headSeq, capacity, capacitySource, capacityScope: 'agent-tree', occupiedSlots, remainingSlots, activeMemberTurns,
317
322
  claimable: waitingSummary(claimableTasks(state, open), now),
318
323
  pendingAcceptance: waitingSummary(waitingReview, now),
319
324
  acceptanceActivity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.164",
3
+ "version": "0.4.165",
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",