@suifei/dsh-ai-team 0.3.66 → 0.3.68

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.68 — 2026-11-11
4
+
5
+ - **【致命】取消任务对话框卡死修复(用户实证三连)**:①根因是 `WorkbenchDialog` 挂载处**漏传 `onDismiss` prop**——settle/cancel 调用 `onDismiss()` 抛 TypeError,`setDialog(null)` 永不执行,对话框永久驻留无法关闭;②「确定没反应」实为 resolve 已执行(任务在后台真实取消)但关框崩溃吞掉了全部反馈;③「理由可留空」的提示与确定按钮禁用矛盾,且 host 域层 `cancelTask/reopenTask` 的 `requireText(reason)` 也强制必填——三层各自为政。现修复:挂载处显式传 `onDismiss: () => setDialog(null)`;settle 先关框后 resolve(后续异步不再阻断);对话框新增 `optional` 语义(理由类输入允许留空);domain 层 cancel/reopen 理由改 `optionalText`(留空记空串,超长边界保留)。新增 cancel/reason 链路测试 2 项(138 总)。
6
+
7
+ ## 0.3.67 — 2026-11-11
8
+
9
+ - review 整改:PMO tick 的 prune 数组补入 `pmoLastDispatch`——补派节流时钟的任务条目在离开 active 集后随其余四个时钟一并清理,消除慢性 Map 增长(与 0.3.57 同类问题的复发面闭合)。
10
+
3
11
  ## 0.3.66 — 2026-11-11
4
12
 
5
13
  - **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 总)。
package/client.js CHANGED
@@ -1613,12 +1613,14 @@ window.__ModuleLoader__.load({
1613
1613
  function WorkbenchDialog({ t, dialog, onDismiss }) {
1614
1614
  const [value, setValue] = React.useState(dialog.value ?? '');
1615
1615
  const settle = (result) => {
1616
- dialog.resolve(result);
1616
+ // 先关框再 resolve:resolve 触发的后续异步命令不应阻断关框。
1617
1617
  onDismiss();
1618
+ dialog.resolve(result);
1618
1619
  };
1619
1620
  const cancel = () => settle(dialog.mode === 'confirm' ? false : null);
1620
1621
  const submit = () => settle(dialog.mode === 'confirm' ? true : value.trim());
1621
- const canSubmit = dialog.mode === 'confirm' || value.trim() !== '';
1622
+ // optional 语义:理由类输入允许留空(placeholder 已声明「可留空」)。
1623
+ const canSubmit = dialog.mode === 'confirm' || dialog.optional === true || value.trim() !== '';
1622
1624
  return h(ModalBack, { onClose: cancel },
1623
1625
  h('div', {
1624
1626
  className: 'at-modal',
@@ -2601,7 +2603,7 @@ window.__ModuleLoader__.load({
2601
2603
  dialogSeqRef.current += 1;
2602
2604
  setDialog({ mode: 'confirm', title, body, resolve });
2603
2605
  });
2604
- const askPrompt = (title, { placeholder = '', value = '', options = null } = {}) => new Promise((resolve) => {
2606
+ const askPrompt = (title, { placeholder = '', value = '', options = null, optional = false } = {}) => new Promise((resolve) => {
2605
2607
  dialogSeqRef.current += 1;
2606
2608
  setDialog({
2607
2609
  mode: options === null ? 'prompt' : 'choice',
@@ -2609,6 +2611,7 @@ window.__ModuleLoader__.load({
2609
2611
  placeholder,
2610
2612
  value: value ?? (options && options.length > 0 ? options[0] : ''),
2611
2613
  options,
2614
+ optional,
2612
2615
  resolve,
2613
2616
  });
2614
2617
  });
@@ -3641,7 +3644,7 @@ window.__ModuleLoader__.load({
3641
3644
  }
3642
3645
  async function cancelSelected() {
3643
3646
  if (!selectedTask) return;
3644
- const reason = await askPrompt(t('cancelPrompt'));
3647
+ const reason = await askPrompt(t('cancelPrompt'), { optional: true });
3645
3648
  if (reason === null) return;
3646
3649
  try {
3647
3650
  await runCommand('task.cancel', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
@@ -3653,7 +3656,7 @@ window.__ModuleLoader__.load({
3653
3656
  }
3654
3657
  async function reopenSelected() {
3655
3658
  if (!selectedTask) return;
3656
- const reason = await askPrompt(t('reopenPrompt'));
3659
+ const reason = await askPrompt(t('reopenPrompt'), { optional: true });
3657
3660
  if (reason === null) return;
3658
3661
  try {
3659
3662
  await runCommand('task.reopen', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
@@ -4171,7 +4174,7 @@ window.__ModuleLoader__.load({
4171
4174
  h('div', { className: 'at-modalactions' },
4172
4175
  h('button', { className: 'at-btn', type: 'button', onClick: () => setNewOpen(false), disabled: nBusy }, t('cancel')),
4173
4176
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: nBusy || !nName.trim() || !nWorkspace.trim() }, nBusy ? t('saving') : t('projectCreate'))))) : null,
4174
- dialog ? h(WorkbenchDialog, { key: dialogSeqRef.current, t, dialog }) : null,
4177
+ dialog ? h(WorkbenchDialog, { key: dialogSeqRef.current, t, dialog, onDismiss: () => setDialog(null) }) : null,
4175
4178
  shortcutsOpen ? h(ModalBack, { onClose: () => setShortcutsOpen(false) },
4176
4179
  h('div', { className: 'at-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('shortcutTitle') },
4177
4180
  h('h2', { className: 'at-modaltitle' }, t('shortcutTitle')),
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.66';
44
+ const VERSION = '0.3.68';
45
45
  const PROJECT_ID = 'prj_main';
46
46
  const HUMAN_ID = 'mem_human';
47
47
 
@@ -599,7 +599,7 @@ export function apply(ctx, config = {}) {
599
599
  // Prune per-task clock entries whose task left the active set, so
600
600
  // the five Map keys track live work instead of growing forever.
601
601
  const live = new Set(active.map((task) => task.id));
602
- for (const map of [pmoLastReview, pmoLastHeartbeat, pmoLastEscalate, pmoLastStall]) {
602
+ for (const map of [pmoLastReview, pmoLastHeartbeat, pmoLastEscalate, pmoLastStall, pmoLastDispatch]) {
603
603
  for (const taskId of map.keys()) {
604
604
  if (!live.has(taskId)) map.delete(taskId);
605
605
  }
@@ -40,6 +40,14 @@ const requireText = (value, field, max = 16_384) => {
40
40
  return value.trim();
41
41
  };
42
42
 
43
+ // 理由类可选文本:留空/缺省返回空串(事件里统一为 '',不缺字段)。
44
+ const optionalText = (value, field, max = 16_384) => {
45
+ if (value === undefined || value === null) return '';
46
+ if (typeof value !== 'string') fail(ERRORS.INVALID_ARGUMENT, `${field} must be a string`);
47
+ if (value.length > max) fail(ERRORS.INVALID_ARGUMENT, `${field} is too long (max ${String(max)})`);
48
+ return value.trim();
49
+ };
50
+
43
51
  const next = (task, patch) => ({ ...task, ...patch, revision: task.revision + 1 });
44
52
 
45
53
  /**
@@ -254,7 +262,7 @@ export function cancelTask(task, actor, options = {}) {
254
262
  if (task.status === 'cancelled' || task.tombstone === true) {
255
263
  fail(ERRORS.INVALID_STATE, 'task is already terminal');
256
264
  }
257
- const reason = requireText(options.reason, 'reason', 2_000);
265
+ const reason = optionalText(options.reason, 'reason', 2_000);
258
266
  const updated = next(task, { status: 'cancelled', updatedAt: options.at ?? Date.now() });
259
267
  return {
260
268
  task: updated,
@@ -269,7 +277,7 @@ export function reopenTask(task, actor, options = {}) {
269
277
  if (task.status !== 'done' && task.status !== 'pending_acceptance') {
270
278
  fail(ERRORS.INVALID_STATE, 'only done or pending_acceptance tasks can be reopened');
271
279
  }
272
- const reason = requireText(options.reason, 'reason', 2_000);
280
+ const reason = optionalText(options.reason, 'reason', 2_000);
273
281
  const assignee = task.assigneeId === null ? null : options.members?.[task.assigneeId] ?? null;
274
282
  const assigneeInvalid =
275
283
  assignee !== null && (assignee.status === 'retired' || assignee.status === 'unavailable' || assignee.status === 'failed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.3.66",
3
+ "version": "0.3.68",
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",