@suifei/dsh-ai-team 0.3.65 → 0.3.66

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.3.66 — 2026-11-11
4
+
5
+ - **pending 快速补派(用户实证的开工等待问题)**:取证发现 task/created 的事件唤醒可能在责任位正忙时被投递语义吞掉,而账本没有「回合结束/空闲」事件(member.status 只有 running/failed 写点,idle 一直是 bootstrap 显示兜底)——pending 卡的第二次提示要等 10 分钟心跳、30 分钟停滞,这正是「待处理等很久不开工」的根源。现 PMO 60s tick 增加状态检查兜底:pending 且责任位**非 running** → 立即 `pmo/dispatch` 补派(每分钟最多一次,bucket 参与 dedupe key),开工等待从最长 10 分钟压到一个 tick;prompt 明确「认领推进,不再负责则 reassign 交还」。in_progress/done 不补派;retired/failed 不唤醒。waker 分支 3 项新测试(136 总)。
6
+
3
7
  ## 0.3.65 — 2026-11-11
4
8
 
5
9
  - **Human↔成员对话门(项目级开关)**:成员的原生会话由团队路由驱动,宿主守卫(`session/agent-busy`)拒绝直接输入——这是宿主核心行为且无配置面。插件以产品通道补齐体验:
package/index.js CHANGED
@@ -41,7 +41,7 @@ export const name = 'ai-team';
41
41
  /** The workbench only makes sense where the Web carrier exists. */
42
42
  export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy'];
43
43
 
44
- const VERSION = '0.3.65';
44
+ const VERSION = '0.3.66';
45
45
  const PROJECT_ID = 'prj_main';
46
46
  const HUMAN_ID = 'mem_human';
47
47
 
@@ -369,6 +369,7 @@ export function apply(ctx, config = {}) {
369
369
  const pmoLastKick = new Map();
370
370
  const pmoLastStall = new Map();
371
371
  const pmoLastHeartbeat = new Map();
372
+ const pmoLastDispatch = new Map();
372
373
  const pmoLastEscalate = new Map();
373
374
  const pmoLastReview = new Map();
374
375
  // Members resumed from cold sessions produce AgentHandles nobody stored;
@@ -513,6 +514,25 @@ export function apply(ctx, config = {}) {
513
514
  const active = Object.values(state.tasks ?? {}).filter((task) =>
514
515
  task.tombstone !== true && ['pending', 'in_progress', 'pending_acceptance'].includes(task.status));
515
516
  const now = Date.now();
517
+ // R-14 pending 快速补派:task/created 的事件唤醒可能在责任位正忙时
518
+ // 被投递语义吞掉,而账本没有「回合结束/空闲」事件可挂钩(member.status
519
+ // 只有 running/failed 写点,idle 是 bootstrap 显示兜底)——所以用
520
+ // 60s tick + 责任位状态检查兜底:pending 且责任位非 running → 每分钟
521
+ // 最多一次补派。pending 开工等待从最长 10 分钟压到一个 tick。
522
+ for (const task of active) {
523
+ if (task.status !== 'pending') continue;
524
+ const responsibleId = task.assigneeId ?? task.ownerId;
525
+ const responsible = state.members?.[responsibleId];
526
+ if (responsible === undefined || responsible.kind !== 'agent') continue;
527
+ if (responsible.status === 'running') continue; // 正在执行别的回合:不打断
528
+ if (responsible.status === 'retired' || responsible.status === 'failed') continue; // 不自动唤醒
529
+ const lastDispatch = pmoLastDispatch.get(task.id) ?? 0;
530
+ if (now - lastDispatch < 60_000) continue;
531
+ pmoLastDispatch.set(task.id, now);
532
+ await wakeFromResult(projectRuntime, {
533
+ event: { type: 'pmo/dispatch', payload: { taskId: task.id, bucket: Math.floor(now / 60_000) } },
534
+ }, {});
535
+ }
516
536
  for (const task of active) {
517
537
  const thread = state.threads?.[task.id];
518
538
  const threadAt = thread?.entries?.at(-1)?.at;
package/lib/host/waker.js CHANGED
@@ -65,6 +65,9 @@ function promptFor(reason, state, taskId) {
65
65
  if (reason === 'inbox') {
66
66
  return 'Team event: 你的收件箱有新条目。调用 team 工具查看 inbox,处理与你有关的事项。';
67
67
  }
68
+ if (reason === 'pmo_dispatch') {
69
+ return `PMO 补派:${title} 仍处于待处理且你当前空闲(可能此前的唤醒未送达)。调用 team 工具认领(claim)它并立即推进;若它不再由你负责或无法推进,用 task.reassign 交还并说明原因;不要静默等待。`;
70
+ }
68
71
  if (reason === 'pmo_review') {
69
72
  return `PMO 验收提醒:${title} 仍处于 pending_acceptance,QA checklist 还没有完成记录。请独立复跑并按 resultDefinition 验收或退回;不要静默等待,也不要把验收推回 Human。`;
70
73
  }
@@ -214,6 +217,17 @@ export function planWakes(state, result, actor = {}) {
214
217
  }
215
218
  }
216
219
  }
220
+ if (event?.type === 'pmo/dispatch') {
221
+ // Pending 快速补派(60s tick 的状态检查兜底):任务仍 pending 且责任位
222
+ // 空闲。key 带 bucket(每分钟最多一次),避免与创建时的 task_created
223
+ // 去重键互相吞掉。
224
+ const task = state.tasks?.[event.payload?.taskId];
225
+ if (task !== undefined && task.status === 'pending') {
226
+ const bucket = event.payload?.bucket ?? Math.floor(Date.now() / 60_000);
227
+ const responsibleId = task.assigneeId ?? task.ownerId;
228
+ add(responsibleId, task.id, 'pmo_dispatch', `pmo_dispatch:${task.id}:${bucket}`);
229
+ }
230
+ }
217
231
  if (event?.type === 'pmo/heartbeat') {
218
232
  const task = state.tasks?.[event.payload?.taskId];
219
233
  if (task !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.3.65",
3
+ "version": "0.3.66",
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",