nx-kv 0.52.0 → 0.53.0

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 (73) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +1 -1
  3. package/src/modules/docs/actions/_manifest.generated.ts +3 -0
  4. package/src/modules/docs/actions/docs-bindings.ts +45 -8
  5. package/src/modules/docs/actions/docs-gc.ts +32 -0
  6. package/src/modules/docs/gc.ts +87 -0
  7. package/src/modules/docs/refs.ts +4 -1
  8. package/src/modules/docs/service.ts +25 -6
  9. package/src/modules/localtask/action-render.ts +1 -1
  10. package/src/modules/localtask/actions/localtask-config.ts +9 -4
  11. package/src/modules/repos/actions/repo-update.ts +1 -1
  12. package/src/modules/tasktool/delivery-template.ts +5 -1
  13. package/src/modules/tasktool/get.ts +9 -5
  14. package/src/modules/tasktool/plugins/waitgoal-config.ts +9 -2
  15. package/src/shared/prompt-blocks.ts +25 -3
  16. package/src/web/frontend/api/cli-tree.json +16 -1
  17. package/src/web/frontend/api/client.generated.ts +12 -2
  18. package/src/web/frontend/components/repos/get-loop-modal.tsx +27 -5
  19. package/src/web/frontend/components/sidebar/task-children.tsx +3 -1
  20. package/src/web/frontend/modules/md/styles/docs.css +8 -0
  21. package/src/web/frontend/page/doc/api.ts +0 -20
  22. package/src/web/frontend/page/doc/index.tsx +64 -17
  23. package/src/web/frontend/page/overview/api.ts +13 -0
  24. package/src/web/frontend/page/overview/index.tsx +60 -7
  25. package/src/web/frontend/page/refs/index.tsx +120 -41
  26. package/src/web/frontend/page/refs/style.css +13 -2
  27. package/src/web/frontend/page/repos/board-admin.tsx +3 -3
  28. package/src/web/frontend/page/repos/board-refs.tsx +3 -3
  29. package/src/web/frontend/page/repos/doc-search-modal.tsx +1 -3
  30. package/src/web/frontend/page/repos/index.tsx +19 -22
  31. package/src/web/frontend/page/repos/repo-table.tsx +1 -1
  32. package/src/web/frontend/page/settings/api.ts +11 -1
  33. package/src/web/frontend/page/settings/prompt-templates-section.tsx +6 -8
  34. package/src/web/frontend/refs/api.ts +65 -0
  35. package/src/web/frontend/refs/follow.ts +91 -0
  36. package/src/web/frontend/refs/index.ts +15 -0
  37. package/src/web/frontend/refs/ops.ts +58 -0
  38. package/src/web/frontend/refs/rows.ts +51 -0
  39. package/src/web/frontend/styles-v2/sidebar.css +6 -0
  40. package/src/web/frontend/workspace/layout.ts +38 -0
  41. package/src/web/frontend/workspace/open.ts +8 -1
  42. package/src/web/frontend/workspace/panels.ts +42 -1
  43. package/src/web/public/assets/{bar-Di7RK1fB.js → bar-BBGb6Y5_.js} +1 -1
  44. package/src/web/public/assets/{composer-launch-yGr4Ayzx.js → composer-launch-CjUpcCqD.js} +1 -1
  45. package/src/web/public/assets/{composer-panel-U2jaQLVQ.js → composer-panel-ECutPtRA.js} +1 -1
  46. package/src/web/public/assets/{dir-BY5ibEGY.js → dir-B8B1sEfY.js} +1 -1
  47. package/src/web/public/assets/doc-CmGraKDe.js +6 -0
  48. package/src/web/public/assets/{group-mIIARpRB.js → group-BA0tiEYP.js} +1 -1
  49. package/src/web/public/assets/{index-j44oS8Y3.css → index-59ZF4OlE.css} +1 -1
  50. package/src/web/public/assets/index-C2C8mDHD.js +2 -0
  51. package/src/web/public/assets/{md-history-wRTMWb12.js → md-history-8KUZ9ipc.js} +1 -1
  52. package/src/web/public/assets/overview-VC4HFUS_.js +1 -0
  53. package/src/web/public/assets/{progress-BRSLsiPg.js → progress-D0qBwZIV.js} +1 -1
  54. package/src/web/public/assets/refs-BhgP7Ryy.js +2 -0
  55. package/src/web/public/assets/refs-IQi1h4-q.css +1 -0
  56. package/src/web/public/assets/{repo-form-modal-dO99i73A.js → repo-form-modal-B_ruPwr0.js} +1 -1
  57. package/src/web/public/assets/repos-DP6AFrI6.js +14 -0
  58. package/src/web/public/assets/settings-C_8mDUqx.js +8 -0
  59. package/src/web/public/assets/{task-Cxa641GX.js → task-IoEm4Lmw.js} +1 -1
  60. package/src/web/public/assets/{task-utils-DSZKkq5e.js → task-utils-BqIPKFHQ.js} +1 -1
  61. package/src/web/public/assets/{templates-CExLUDs6.js → templates-B2zDwQG0.js} +1 -1
  62. package/src/web/public/assets/{use-rail-drag-D-17tqYm.js → use-rail-drag-2mF0AHna.js} +1 -1
  63. package/src/web/public/assets/workspace-BwpvQUst.js +28 -0
  64. package/src/web/public/index.html +7 -7
  65. package/src/web/public/assets/doc-DHi__8Em.js +0 -6
  66. package/src/web/public/assets/index-DiOQ8kPZ.js +0 -2
  67. package/src/web/public/assets/overview-DPDbuE5d.js +0 -1
  68. package/src/web/public/assets/refs-C5idWnUj.css +0 -1
  69. package/src/web/public/assets/refs-CZdjVlxE.js +0 -2
  70. package/src/web/public/assets/repos-BaE9B1it.js +0 -14
  71. package/src/web/public/assets/settings-BX78BaLf.js +0 -8
  72. package/src/web/public/assets/workspace-fCTiC3R4.js +0 -28
  73. /package/src/web/frontend/{page → modules}/refs/api.ts +0 -0
@@ -33,9 +33,20 @@ export default function GetLoopModal({ repo, onClose, onSaved }: GetLoopModalPro
33
33
  const toast = useToast();
34
34
  const loop = repo.getLoop && typeof repo.getLoop === 'object' ? repo.getLoop : null;
35
35
  const [on, setOn] = useState(!!(loop && loop.enabled));
36
- const [minutes, setMinutes] = useState(String((loop && loop.waitMinutes) || DEFAULT_MINUTES));
36
+ // #112:0 是合法值(= 不设项目级窗口,沿用 get 的默认阻塞),不能被 `|| 默认值` 吞掉
37
+ const [minutes, setMinutes] = useState(
38
+ loop && loop.waitMinutes !== undefined && loop.waitMinutes !== null ? String(loop.waitMinutes) : String(DEFAULT_MINUTES)
39
+ );
37
40
  const [busy, setBusy] = useState(false);
38
41
 
42
+ /** 输入框 → 落库值:空/非法回落默认;0 原样保留(#112)。 */
43
+ const minutesOf = (raw: string): number => {
44
+ const s = String(raw ?? '').trim();
45
+ if (s === '') return DEFAULT_MINUTES;
46
+ const n = Number(s);
47
+ return Number.isFinite(n) && n >= 0 ? Math.min(Math.floor(n), 600) : DEFAULT_MINUTES;
48
+ };
49
+
39
50
  const save = async (override?: { enabled?: boolean }) => {
40
51
  setBusy(true);
41
52
  try {
@@ -46,9 +57,14 @@ export default function GetLoopModal({ repo, onClose, onSaved }: GetLoopModalPro
46
57
  // 于是「保存成功」但落库纹丝不动(#182 探针抓个正着)。
47
58
  await updateRepo(repo.id, {
48
59
  'get-loop': enabled ? 'on' : 'off',
49
- ...(enabled ? { 'get-loop-minutes': Number(minutes) || DEFAULT_MINUTES } : {}),
60
+ ...(enabled ? { 'get-loop-minutes': minutesOf(minutes) } : {}),
50
61
  });
51
- toast(enabled ? `已保存「${repo.name}」的持续 get 设置(${Number(minutes) || DEFAULT_MINUTES} 分钟)` : `已关闭「${repo.name}」的持续 get`);
62
+ const mm = minutesOf(minutes);
63
+ toast(
64
+ enabled
65
+ ? `已保存「${repo.name}」的持续 get 设置(${mm > 0 ? `${mm} 分钟阻塞窗口` : '不阻塞,没活立即返回'})`
66
+ : `已关闭「${repo.name}」的持续 get`
67
+ );
52
68
  if (app.refreshRepos) app.refreshRepos();
53
69
  if (onSaved) onSaved();
54
70
  } catch (e) {
@@ -86,12 +102,18 @@ export default function GetLoopModal({ repo, onClose, onSaved }: GetLoopModalPro
86
102
  <div className="rp-gl-row">
87
103
  <span>阻塞窗口</span>
88
104
  <span className="rp-gl-unit">
89
- <input className="rp-gl-min" value={minutes} onChange={(e) => setMinutes(e.target.value)} inputMode="numeric" />
105
+ <input
106
+ className="rp-gl-min"
107
+ value={minutes}
108
+ onChange={(e) => setMinutes(e.target.value)}
109
+ inputMode="numeric"
110
+ title="0 = 不阻塞:没任务时 get 立即返回 timeout"
111
+ />
90
112
  分钟
91
113
  </span>
92
114
  </div>
93
115
  <div className="rp-gl-note">
94
- {'领到任务后那段「继续 get 直到 timeout」的提示词是全局的,只有一份:要改文案去 设置 → 提示词模板 → 持续 get。这里只决定这个仓库开不开、每轮最多等多久。'}
116
+ {'这里只决定没有任务时 get 最多阻塞多久(0 = 不阻塞,立即返回 timeout)。领到任务后那段「继续 get 直到 timeout」的提示词是全局的,只有一份:要改文案去 设置 → 提示词模板 → 持续 get。'}
95
117
  </div>
96
118
  <div className="rp-gl-acts">
97
119
  <span className="spacer" />
@@ -71,7 +71,9 @@ export default function TaskChildren({ row, onNavigate, refreshLocal }: TaskChil
71
71
  onNavigate?.(`${base}?task=${encodeURIComponent(String(t.id))}`);
72
72
  }}
73
73
  >
74
- <span className="gico"><Icon name="list" size={12} /></span>
74
+ {/* #106:这里原本是统一的 list 图标——子行按类型只有 task 一种,图标没有
75
+ 信息量;换成任务编号(序列号)能一眼看出队列规模与位置。 */}
76
+ <span className="gico num" aria-hidden="true">#{t.id}</span>
75
77
  <span className="nm">{taskLabel(t)}</span>
76
78
  <span className={`cnt ${statusTone(t)}`}>
77
79
  {statusShort(t)}
@@ -121,6 +121,14 @@
121
121
  .docp-desc .k{flex:none;font-size:10px;color:var(--faint,#A9AEB4);letter-spacing:.04em}
122
122
  .docp-desc .v{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
123
123
  .docp-desc.empty .v{color:var(--faint,#A9AEB4)}
124
+ /* #107:描述行直接输入——看起来是文字,聚焦时才显出输入框(无边框、无弹窗) */
125
+ .docp-desc-input{
126
+ flex:1;min-width:0;border:0;background:transparent;padding:1px 4px;border-radius:5px;
127
+ font:inherit;font-size:11px;line-height:1.6;color:inherit;outline:none;
128
+ }
129
+ .docp-desc-input::placeholder{color:var(--faint,#A9AEB4)}
130
+ .docp-desc-input:hover{background:var(--soft,#F1F0EC)}
131
+ .docp-desc-input:focus{background:var(--paper,#fff);box-shadow:0 0 0 1px var(--mdw-accent,#2F6F5E) inset}
124
132
  .docp-desc-edit{
125
133
  flex:none;border:0;background:transparent;padding:1px 6px;border-radius:5px;
126
134
  font:inherit;font-size:10.5px;color:var(--mdw-accent,#2F6F5E);cursor:pointer;
@@ -64,26 +64,6 @@ export interface DocItemBody {
64
64
  body?: string;
65
65
  }
66
66
 
67
- /** 写文档正文 / 描述(PATCH /api/docs/item)。 */
68
- export function updateDocItem(body: { ref?: string; body?: string; desc?: string }): Promise<any> {
69
- return api('/api/docs/item', { method: 'PATCH', body });
70
- }
71
-
72
- /** 删除文档(DELETE /api/docs/item;ref 是 docId)。 */
73
- export function removeDocItem(body: { ref?: string }): Promise<any> {
74
- return api('/api/docs/item', { method: 'DELETE', body });
75
- }
76
-
77
- /** 新建直接 ref(POST /api/docs/ref;desc + 归属,不创建任何文件)。 */
78
- export function createRefDoc(body: {
79
- owner: 'repo' | 'group' | 'group_repo';
80
- repo?: string;
81
- group?: string;
82
- desc?: string;
83
- }): Promise<{ refId: string; docId: string; desc?: string }> {
84
- return api('/api/docs/ref', { method: 'POST', body });
85
- }
86
-
87
67
  /** 把文档登记进参考仓库的文档集(POST /api/repos/docs)。 */
88
68
  export function bindRepoDoc(body: { id: string; ref?: string; path?: string; note?: string; tag?: string }): Promise<any> {
89
69
  return api('/api/repos/docs', { method: 'POST', body });
@@ -6,16 +6,15 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { Actions } from 'flexlayout-react';
7
7
  import type { Model } from 'flexlayout-react';
8
8
  import {
9
- createRefDoc,
10
9
  docAttachments,
11
- docHostBindings,
12
10
  listBoards,
13
11
  loadDocsIndex,
14
- removeDocItem,
15
12
  getDocItem,
16
- updateDocItem,
17
13
  type DocItem,
18
14
  } from './api.js';
15
+ // #120:文档条目的读写统一走 refs 模块(列表 CRUD 的唯一入口)
16
+ import { docsBindings, removeDocItem, updateDocItem } from '../../refs/api.js';
17
+ import { createDoc, saveDesc as saveDocDesc } from '../../refs/ops.js';
19
18
  import { useToast } from '../../components/toast/index.jsx';
20
19
  import { useDialog } from '../../components/popup/index.jsx';
21
20
  import { useApp } from '../../app-context.jsx';
@@ -90,6 +89,9 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
90
89
  const [error, setError] = useState('');
91
90
  const [dirty, setDirty] = useState(false);
92
91
  const [mode, setMode] = useState('split');
92
+ // #107:描述行直接可编辑(不再点「改」弹窗)——草稿 + 保存态
93
+ const [descDraft, setDescDraft] = useState('');
94
+ const [descBusy, setDescBusy] = useState(false);
93
95
  // 底部信息面板(附件 / 归属):与任务页同一套 dock 状态,存储空间另用 'doc';
94
96
  // 文档页首次进入默认收起(编辑正文为主),入口常驻在底部状态栏
95
97
  const dock = useDock('doc', false);
@@ -100,6 +102,12 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
100
102
  const docRef = useRef<DocItem | null>(null);
101
103
  useEffect(() => { docRef.current = doc; }, [doc]);
102
104
 
105
+ // #107:描述草稿跟随文档(换文档、保存回来都会重置)。用 desc 而不是 refId 作依赖,
106
+ // 保存成功后服务端回填的 desc 立即反映到输入框,不会和用户正在敲的内容打架。
107
+ useEffect(() => {
108
+ setDescDraft(doc?.desc || '');
109
+ }, [doc?.refId, doc?.desc]);
110
+
103
111
  const load = useCallback(async () => {
104
112
  setError('');
105
113
  try {
@@ -139,7 +147,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
139
147
  return out;
140
148
  };
141
149
  if (ownerKind === 'repo') {
142
- docHostBindings({ host: ownerKey })
150
+ docsBindings({ host: ownerKey })
143
151
  .then((d) => setIntroLinks(toLinks(d.bindings || [])))
144
152
  .catch(() => setIntroLinks(current));
145
153
  return;
@@ -149,7 +157,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
149
157
  .then(async (d) => {
150
158
  const boards = (d && d.boards) || (Array.isArray(d) ? d : []);
151
159
  const b = boards.find((x: { id?: string; key?: string }) => x.id === ownerKey || x.key === ownerKey);
152
- const res = await docHostBindings({ group: String(b?.key || ownerKey) });
160
+ const res = await docsBindings({ group: String(b?.key || ownerKey) });
153
161
  setIntroLinks(toLinks(res.bindings || []));
154
162
  })
155
163
  .catch(() => setIntroLinks(current));
@@ -243,17 +251,15 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
243
251
  if (name === null) return;
244
252
  const desc = String(name).trim();
245
253
  if (!desc) return;
246
- const res = await createRefDoc(
254
+ // 建文档 + 起标题骨架 + 广播刷新,都在 refs.ops 里(列表 CRUD 唯一入口)
255
+ const refId = await createDoc(
247
256
  ownerKind === 'repo'
248
- ? { owner: 'repo', repo: ownerKey, desc }
249
- : { owner: 'group', group: ownerKey, desc }
257
+ ? { owner: 'repo', repo: ownerKey, desc, title: desc }
258
+ : { owner: 'group', group: ownerKey, desc, title: desc }
250
259
  );
251
- // 空正文直接可编辑;给一个标题骨架,打开后就是「待补」状态。
252
- await updateDocItem({ ref: 'ref:' + res.refId, body: `# ${desc}\n\n(待补)\n` });
253
260
  toast(`已补充:${desc}`);
254
- notifyDocsChanged();
255
261
  loadIntroLinks();
256
- openByDocId('ref:' + res.refId, null, openExtra);
262
+ openByDocId('ref:' + refId, null, openExtra);
257
263
  });
258
264
  };
259
265
 
@@ -343,6 +349,8 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
343
349
  };
344
350
 
345
351
  // ─── 改描述:ref 是 DB 实体,没有路径可改;desc 是列表 / 提示词模板的快速定位标签 ───
352
+ // #107 起主入口是标题下面那一行**直接输入**(见 renderDescRow),菜单里的「改描述」
353
+ // 保留给习惯弹窗的人;两条路走同一个 PATCH。
346
354
  const renameDoc = () => {
347
355
  if (!doc) return;
348
356
  guard(async () => {
@@ -361,6 +369,25 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
361
369
  });
362
370
  };
363
371
 
372
+ /** #107:行内描述保存(失焦 / 回车触发;Esc 放弃)。空串合法 = 清掉描述。 */
373
+ const saveDesc = async () => {
374
+ if (!doc || !writable || descBusy || !docId) return;
375
+ const next = descDraft.trim();
376
+ if (next === String(doc.desc || '').trim()) return;
377
+ setDescBusy(true);
378
+ try {
379
+ // #120:写入 + 广播统一走 refs 模块,不在页面里另拼一次
380
+ const saved = await saveDocDesc(docId, next);
381
+ setDoc((d) => (d ? { ...d, desc: saved } : d));
382
+ toast('描述已更新');
383
+ } catch (e) {
384
+ toast(String((e as Error).message || e));
385
+ setDescDraft(doc.desc || '');
386
+ } finally {
387
+ setDescBusy(false);
388
+ }
389
+ };
390
+
364
391
  // ─── 删除:danger 确认 → DELETE 落盘 → 主布局就地回归属页(不拆面板,#191 同规)───
365
392
  const delDoc = () => {
366
393
  if (!doc) return;
@@ -489,12 +516,32 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
489
516
  ]) as unknown as never[]}
490
517
  onSave={save as unknown as null}
491
518
  />
492
- {/* desc 是「快速定位」的一句话:标题下面是它自己的位置,可看可改 */}
519
+ {/* desc 是「快速定位」的一句话:标题下面直接可编辑(#107:不再点「改」),
520
+ 失焦 / 回车保存,Esc 放弃;只读文档照旧显示成文字。 */}
493
521
  <div className={'docp-desc' + (doc.desc ? '' : ' empty')}>
494
522
  <span className="k">描述</span>
495
- <span className="v">{doc.desc || '未填写——写一句这篇讲什么,列表与提示词里用它快速定位'}</span>
496
- {writable && (
497
- <button type="button" className="docp-desc-edit" onClick={renameDoc}>改</button>
523
+ {writable ? (
524
+ <input
525
+ className="docp-desc-input"
526
+ value={descDraft}
527
+ disabled={descBusy}
528
+ spellCheck={false}
529
+ placeholder="未填写——写一句这篇讲什么,列表与提示词里用它快速定位"
530
+ aria-label="文档描述(失焦或回车保存)"
531
+ onChange={(e) => setDescDraft(e.target.value)}
532
+ onBlur={() => { void saveDesc(); }}
533
+ onKeyDown={(e) => {
534
+ if (e.key === 'Enter') {
535
+ e.preventDefault();
536
+ e.currentTarget.blur();
537
+ } else if (e.key === 'Escape') {
538
+ setDescDraft(doc.desc || '');
539
+ e.currentTarget.blur();
540
+ }
541
+ }}
542
+ />
543
+ ) : (
544
+ <span className="v">{doc.desc || '未填写——写一句这篇讲什么,列表与提示词里用它快速定位'}</span>
498
545
  )}
499
546
  </div>
500
547
  <MdPanes
@@ -14,3 +14,16 @@ export interface RemoveManyResult {
14
14
  export function removeTasks(input: { key: string; ids: number[] }): Promise<any> {
15
15
  return api('/api/localtasks/items', { method: 'DELETE', body: input });
16
16
  }
17
+
18
+ /** 批量收口返回:count=收口数;claimedClosed=其中原本已领取的;skipped=终态跳过明细。 */
19
+ export interface CloseManyResult {
20
+ count?: number;
21
+ claimedClosed?: number[];
22
+ skipped?: Array<{ id: number; status?: string; reason?: string }>;
23
+ missing?: number[];
24
+ }
25
+
26
+ /** 批量收口任务(POST /api/localtasks/items/close;status=done|cancelled)。 */
27
+ export function closeTasks(input: { key: string; ids: number[]; status: string; summary?: string }): Promise<CloseManyResult> {
28
+ return api('/api/localtasks/items/close', { method: 'POST', body: input });
29
+ }
@@ -14,12 +14,13 @@
14
14
  // 1. **每行任务带状态 tag**(待领取 / 已领取,口径与 splitQueueTasks 一致;
15
15
  // #121 起渲染走统一组件 components/status-tag——蓝=进行中、绿=已完成、浅灰=待领取);
16
16
  // 行可点:直接进该任务的工作台详情(#/dir/<key>?task=<id>)。
17
- // 2. **批量删除的落点在底部操作条**:勾选任意行后出现(position:sticky),
18
- // 跨目录一次删完(按目录分组逐个调 DELETE /api/localtasks/items);
19
- // 仍是软删除(CLI localtask task restore 可恢复)。
17
+ // 2. **批量操作的落点在底部操作条**:勾选任意行后出现(position:sticky),
18
+ // 跨目录一次处理完(按目录分组逐个调批量接口):标为完成(#103,POST
19
+ // /api/localtasks/items/close,与目录页「标为完成选中」同口径)+ 批量删除
20
+ //(DELETE /api/localtasks/items);删除仍是软删除(CLI localtask task restore 可恢复)。
20
21
  import RouteBreadcrumb from '../../components/layout/route-crumb.jsx';
21
22
  import { useMemo, useState } from 'react';
22
- import { removeTasks } from './api.js';
23
+ import { closeTasks, removeTasks } from './api.js';
23
24
  import { useToast } from '../../components/toast/index.jsx';
24
25
  import { useDialog } from '../../components/popup/index.jsx';
25
26
  import StatusTag from '../../components/status-tag/index.jsx';
@@ -130,8 +131,8 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
130
131
  };
131
132
  const allOn = shown.length > 0 && picked.length === shown.length;
132
133
 
133
- /** 底部操作条的删除:把选中项按目录分组,逐组调批量删除接口。 */
134
- const dropAll = async () => {
134
+ /** 选中项按目录分组(批量删除 / 批量收口共用:接口都按单主题寻址)。 */
135
+ const pickGroups = () => {
135
136
  const pickedSet = new Set(picked);
136
137
  const groups: { key: string; name: string; ids: number[] }[] = [];
137
138
  for (const f of flat) {
@@ -143,6 +144,12 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
143
144
  }
144
145
  g.ids.push(Number(f.t.id));
145
146
  }
147
+ return groups;
148
+ };
149
+
150
+ /** 底部操作条的删除:把选中项按目录分组,逐组调批量删除接口。 */
151
+ const dropAll = async () => {
152
+ const groups = pickGroups();
146
153
  const total = groups.reduce((n, g) => n + g.ids.length, 0);
147
154
  if (!total) return;
148
155
  const scope = groups.length > 1 ? `(跨 ${groups.length} 个目录)` : '';
@@ -180,6 +187,49 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
180
187
  refreshLocal?.();
181
188
  };
182
189
 
190
+ /** 底部操作条的批量收口(#103 总览补齐,与目录页「标为完成选中」同口径):
191
+ 待领取与已领取(正在跑)都收,已完成/已取消/已删除跳过,agent 回执被忽略。 */
192
+ const finishAll = async () => {
193
+ const groups = pickGroups();
194
+ const total = groups.reduce((n, g) => n + g.ids.length, 0);
195
+ if (!total) return;
196
+ const scope = groups.length > 1 ? `(跨 ${groups.length} 个目录)` : '';
197
+ const ok = await dialog({
198
+ title: `把 ${total} 条任务标为完成${scope}`,
199
+ message: '待领取与已领取(正在跑)都能收:已领取的直接收口,agent 侧回执会被忽略。已完成/已取消会跳过。完成会补一条完成记录,原文留档。',
200
+ okText: '标为完成',
201
+ });
202
+ if (!ok) return;
203
+ let n = 0;
204
+ let claimed = 0;
205
+ let skip = 0;
206
+ const errs = [];
207
+ for (const g of groups) {
208
+ try {
209
+ const r = await closeTasks({ key: g.key, ids: g.ids, status: 'done' });
210
+ n += Number(r?.count ?? 0);
211
+ claimed += (r?.claimedClosed || []).length;
212
+ skip += (r?.skipped || []).length;
213
+ } catch (e) {
214
+ const msg = String((e as Error).message || e);
215
+ if (/接口不存在/.test(msg)) {
216
+ toast('本机面板服务较旧,重启面板后再试(批量收口接口未上线)');
217
+ return;
218
+ }
219
+ errs.push(`${g.name}: ${msg}`);
220
+ }
221
+ }
222
+ if (errs.length) {
223
+ toast(`已标为完成 ${n} 条;${errs.length} 个目录失败:${errs[0]}${errs.length > 1 ? ` 等 ${errs.length} 项` : ''}`);
224
+ } else {
225
+ toast(
226
+ `已标为完成 ${n} 条${claimed ? `(含 ${claimed} 条已领取)` : ''}${skip ? `,跳过 ${skip} 条` : ''}`,
227
+ );
228
+ }
229
+ setSel(new Set());
230
+ refreshLocal?.();
231
+ };
232
+
183
233
  /** 行点击:组任务走组锚定路由(#86:#/group/<boardMark>?task=N),其余进目录工作台。 */
184
234
  const openTask = (f: FlatRow, id: number | string) => {
185
235
  const url = f.t.boardMark
@@ -260,7 +310,7 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
260
310
  )}
261
311
 
262
312
  {selCount > 0 && (
263
- <div className="ov-bar" role="toolbar" aria-label="批量删除操作条">
313
+ <div className="ov-bar" role="toolbar" aria-label="批量操作条">
264
314
  <span className="ov-bar-n">
265
315
  已选 <b>{selCount}</b> 条任务
266
316
  </span>
@@ -268,6 +318,9 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
268
318
  <button type="button" className="mini" onClick={() => setSel(new Set())}>
269
319
  取消选择
270
320
  </button>
321
+ <button type="button" className="btn small" onClick={finishAll}>
322
+ 标为完成 {selCount}
323
+ </button>
271
324
  <button type="button" className="btn small danger" onClick={dropAll}>
272
325
  删除选中 {selCount}
273
326
  </button>