nx-kv 0.66.3 → 0.67.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 (100) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/assets/nx-kv/references/A02-/346/217/220/344/272/244/344/273/273/345/212/241.md +6 -7
  3. package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +2 -2
  4. package/package.json +1 -1
  5. package/src/core/db/import-json/tasks.ts +10 -9
  6. package/src/core/db/import-json.ts +16 -6
  7. package/src/core/db/index.ts +1 -1
  8. package/src/core/db/verify.ts +7 -3
  9. package/src/core/topic-key.ts +5 -8
  10. package/src/core/workflow/readiness.ts +1 -1
  11. package/src/core/workflow/types.ts +1 -1
  12. package/src/modules/claim/host.ts +2 -2
  13. package/src/modules/claim/wait.ts +9 -49
  14. package/src/modules/localtask/actions/localtask-add.ts +1 -3
  15. package/src/modules/localtask/actions/localtask-boardtasks.ts +0 -1
  16. package/src/modules/localtask/actions/localtask-clone.ts +1 -1
  17. package/src/modules/localtask/infra/events.ts +5 -5
  18. package/src/modules/localtask/infra/repo/rows.ts +0 -1
  19. package/src/modules/localtask/infra/repo/topics.ts +0 -4
  20. package/src/modules/localtask/lifecycle/add.ts +2 -9
  21. package/src/modules/localtask/lifecycle/deletion.ts +7 -15
  22. package/src/modules/localtask/lifecycle/task-lifecycle.ts +2 -2
  23. package/src/modules/localtask/lifecycle/task-ops.ts +14 -56
  24. package/src/modules/localtask/lifecycle/task-view.ts +2 -3
  25. package/src/modules/localtask/lifecycle/topics.ts +0 -2
  26. package/src/modules/localtask/paths.ts +7 -17
  27. package/src/modules/localtask/service.ts +3 -7
  28. package/src/modules/localtask/ui/action-flags.ts +2 -2
  29. package/src/modules/localtask/ui/action-render.ts +4 -7
  30. package/src/modules/localtask/waiting.ts +1 -8
  31. package/src/modules/templates/scope.ts +1 -1
  32. package/src/web/frontend/App.tsx +4 -9
  33. package/src/web/frontend/api/cli-tree.json +2 -2
  34. package/src/web/frontend/api/client.generated.ts +3 -3
  35. package/src/web/frontend/api/tasks.ts +1 -1
  36. package/src/web/frontend/components/sidebar/index.tsx +52 -48
  37. package/src/web/frontend/components/sidebar/model.ts +16 -32
  38. package/src/web/frontend/components/sidebar/queue-nav.ts +3 -4
  39. package/src/web/frontend/components/sidebar/row-menu.tsx +1 -1
  40. package/src/web/frontend/components/sidebar/task-children.tsx +39 -21
  41. package/src/web/frontend/components/task-panel/task-ops.ts +3 -3
  42. package/src/web/frontend/modules/board/board-view.ts +2 -56
  43. package/src/web/frontend/modules/md/doc-store.ts +2 -3
  44. package/src/web/frontend/page/dag/head-bar.tsx +0 -1
  45. package/src/web/frontend/page/dag/index.tsx +1 -4
  46. package/src/web/frontend/page/dag/model.ts +0 -1
  47. package/src/web/frontend/page/dir/index.tsx +21 -25
  48. package/src/web/frontend/page/dir/task-actions.ts +20 -32
  49. package/src/web/frontend/page/dir/task-chain.ts +6 -10
  50. package/src/web/frontend/page/dir/task-dock-panel.tsx +2 -5
  51. package/src/web/frontend/page/dir/task-feedback.ts +9 -17
  52. package/src/web/frontend/page/dir/task-not-found.tsx +2 -3
  53. package/src/web/frontend/page/dir/task-utils.ts +0 -1
  54. package/src/web/frontend/page/dir/task.tsx +13 -17
  55. package/src/web/frontend/page/group/index.tsx +2 -3
  56. package/src/web/frontend/page/progress/index.tsx +7 -12
  57. package/src/web/frontend/panels.tsx +1 -1
  58. package/src/web/frontend/registry.ts +1 -2
  59. package/src/web/frontend/route-map.ts +0 -1
  60. package/src/web/frontend/routes/dir.ts +1 -4
  61. package/src/web/frontend/routes/keys.ts +5 -3
  62. package/src/web/frontend/svghub/catalog-nav.ts +8 -11
  63. package/src/web/public/assets/app-context-CngKv8Tc.js +1 -0
  64. package/src/web/public/assets/{bar-D7cWe7Kp.js → bar-C0Q_Qe4z.js} +1 -1
  65. package/src/web/public/assets/board-view-C8OQhkyi.js +1 -0
  66. package/src/web/public/assets/{button-3JlUeln_.js → button-Cs6w2CDi.js} +1 -1
  67. package/src/web/public/assets/{composer-launch--nJGFG35.js → composer-launch-BF3_hyn5.js} +1 -1
  68. package/src/web/public/assets/{composer-panel-Dhivt7UJ.js → composer-panel-D6vBrzCs.js} +1 -1
  69. package/src/web/public/assets/{dag-DUhHxgTk.js → dag-CZF6sV2_.js} +1 -1
  70. package/src/web/public/assets/dir-6RhnWw1E.js +1 -0
  71. package/src/web/public/assets/{doc-QBHQi1EV.js → doc-CVIVBV6n.js} +1 -1
  72. package/src/web/public/assets/group-AF62Z-_G.js +1 -0
  73. package/src/web/public/assets/index-Bposj22Z.js +3 -0
  74. package/src/web/public/assets/{list-search-B2S2g8kn.js → list-search-DFvFY408.js} +1 -1
  75. package/src/web/public/assets/{md-history-DdM6P9Gq.js → md-history-COQu16vy.js} +1 -1
  76. package/src/web/public/assets/{member-picker-BZgE3HGb.js → member-picker-CHX0nS0O.js} +1 -1
  77. package/src/web/public/assets/popup-dBtYqEM1.js +1 -0
  78. package/src/web/public/assets/progress-CDh6DY7g.js +3 -0
  79. package/src/web/public/assets/{refs-CCZgGPlL.js → refs-t79ynSY8.js} +1 -1
  80. package/src/web/public/assets/{reopen-text-BC9a8KOp.js → reopen-text-B2d9SZi0.js} +1 -1
  81. package/src/web/public/assets/{repo-form-modal-D8WabN0R.js → repo-form-modal-dZqpHyUj.js} +1 -1
  82. package/src/web/public/assets/{repos-V5xb5Kz-.js → repos-DdhOQJqF.js} +1 -1
  83. package/src/web/public/assets/{route-crumb-DX9C4jmQ.js → route-crumb-BKq2jry0.js} +1 -1
  84. package/src/web/public/assets/{settings-CAOSCF3E.js → settings-Bk3clN2f.js} +1 -1
  85. package/src/web/public/assets/task-C8nax2rT.js +13 -0
  86. package/src/web/public/assets/{task-ops-DZgza5eZ.js → task-ops-D6E_TgEC.js} +2 -2
  87. package/src/web/public/assets/task-utils-Dh33OFKe.js +1 -0
  88. package/src/web/public/assets/{templates-6ClSnYJN.js → templates-Dusbff7Z.js} +3 -3
  89. package/src/web/public/assets/{tool-bar-BYdfBQeo.js → tool-bar-DPXnjdQF.js} +1 -1
  90. package/src/web/public/assets/{use-rail-drag-BMXJ48je.js → use-rail-drag-B6J0iqFK.js} +1 -1
  91. package/src/web/public/index.html +12 -12
  92. package/src/web/public/assets/app-context-BqCBcDsx.js +0 -1
  93. package/src/web/public/assets/board-view-Cm8189wG.js +0 -1
  94. package/src/web/public/assets/dir-CkYGYT9e.js +0 -1
  95. package/src/web/public/assets/group-CfJxWA7V.js +0 -1
  96. package/src/web/public/assets/index-ByAPGidL.js +0 -3
  97. package/src/web/public/assets/popup-DZ2Khv2c.js +0 -1
  98. package/src/web/public/assets/progress-BVpSy-uF.js +0 -3
  99. package/src/web/public/assets/task-BwWlNP0i.js +0 -13
  100. package/src/web/public/assets/task-utils--WIpAwUx.js +0 -1
@@ -8,7 +8,7 @@ import { useMemo, useState } from 'react';
8
8
  import { addTask, reorderTask } from './api.js';
9
9
  import { useToast } from '../../components/toast/index.jsx';
10
10
  import { useDialog } from '../../components/popup/index.jsx';
11
- import { GLOBAL_KEY, isGroupTask } from '../../modules/board/board-view.js';
11
+ import { isGroupTask } from '../../modules/board/board-view.js';
12
12
  import { useApp } from '../../app-context.jsx';
13
13
  import Introduction from '../../components/Introduction/index.jsx';
14
14
  import GetLoopModal from '../../components/repos/get-loop-modal.js';
@@ -48,18 +48,14 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
48
48
  const model = app.model;
49
49
  const repos = (app.repoData && app.repoData.repos) || [];
50
50
 
51
- const isGlobal = !dirKey || dirKey === GLOBAL_KEY;
52
51
  const [dagTask, setDagTask] = useState<LocalTask | null>(null); // 正在编排依赖的任务(DAG 节点编辑器)
53
52
  // #165:持续 get(waitgoal)配置——按主题(仓库)粒度控制,收在工具区直读状态
54
53
  const [glOpen, setGlOpen] = useState(false);
55
54
 
56
- const topic = useMemo(() => {
57
- if (isGlobal) return rows.find((r) => r.isGlobal) || null;
58
- return rows.find((r) => r.key === dirKey) || null;
59
- }, [rows, dirKey, isGlobal]);
55
+ const topic = useMemo(() => rows.find((r) => r.key === dirKey) || null, [rows, dirKey]);
60
56
 
61
57
  const repo = useMemo<RepoRow | null>(() => {
62
- if (!topic || isGlobal) return null;
58
+ if (!topic) return null;
63
59
  const rk = topic.repo && topic.repo.key;
64
60
  if (rk) {
65
61
  const byKey = repos.find((r) => r.key === rk);
@@ -68,7 +64,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
68
64
  const cwd = String(topic.cwd || '').replace(/\\/g, '/').toLowerCase();
69
65
  if (!cwd) return null;
70
66
  return repos.find((r) => String(r.path || '').replace(/\\/g, '/').toLowerCase() === cwd) || null;
71
- }, [topic, repos, isGlobal]);
67
+ }, [topic, repos]);
72
68
 
73
69
  // 显示序:未完成(待领取)优先,追加的新任务不会被历史埋在下面;
74
70
  // 软删除的行不进表。#85 两种走向:目录页是**项目走向**的视图——组任务
@@ -108,9 +104,9 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
108
104
 
109
105
  const guard = (fn: () => Promise<unknown>) => fn().catch((e) => toast(String((e as Error).message || e)));
110
106
 
111
- // 主题定位二选一:全局池用 key,目录用 cwd(行尾 / 批量 / 编排同一套)
112
- const scopeBody = () => (isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd });
113
- const topicKeyHere = isGlobal ? GLOBAL_KEY : dirKey || GLOBAL_KEY;
107
+ // 主题定位:按目录 cwd(行尾 / 批量 / 编排同一套;#190 全局池已删除)
108
+ const scopeBody = () => ({ cwd: topic?.cwd });
109
+ const topicKeyHere = dirKey || '';
114
110
  // 持续 get 的展示态(配置本身在 GetLoopModal 里改)
115
111
  const glOn = !!(repo && repo.getLoop && repo.getLoop.enabled);
116
112
  const glMinutes = repo && repo.getLoop && repo.getLoop.waitMinutes !== undefined && repo.getLoop.waitMinutes !== null
@@ -124,7 +120,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
124
120
  refresh: () => {
125
121
  refreshLocal?.();
126
122
  },
127
- docKey: dirKey || GLOBAL_KEY,
123
+ docKey: dirKey || 'local',
128
124
  onDeleted: (t) => {
129
125
  if (!model) return;
130
126
  // workspace.findOpenPanel 的返回类型尚未收口(被推断成 null),按实际契约窄化
@@ -149,8 +145,8 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
149
145
  const openTplList = () => {
150
146
  const id = putManageSession({
151
147
  topic: topicKeyHere,
152
- repo: isGlobal ? '' : (repo?.key || ''),
153
- label: isGlobal ? '全局池' : (topic?.name || dirKey || '本目录'),
148
+ repo: repo?.key || '',
149
+ label: topic?.name || dirKey || '本目录',
154
150
  });
155
151
  app.onNavigate?.(`#/templates/manage/${id}`);
156
152
  };
@@ -160,7 +156,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
160
156
  openPanel(model, {
161
157
  component: 'progress',
162
158
  name: '进程',
163
- config: { dirKey: dirKey || GLOBAL_KEY },
159
+ config: { dirKey: dirKey || '' },
164
160
  location: 'right',
165
161
  });
166
162
  };
@@ -179,7 +175,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
179
175
  openTemplateEditor(model, {
180
176
  mode: 'new',
181
177
  topic: topicKeyHere,
182
- scope: isGlobal ? [] : [`topic:${topicKeyHere}`],
178
+ scope: [`topic:${topicKeyHere}`],
183
179
  name: '',
184
180
  });
185
181
  };
@@ -200,14 +196,14 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
200
196
  },
201
197
  }]),
202
198
  'sep',
203
- { label: `为本${isGlobal ? '全局池' : '目录'}新建模板…`, icon: 'plus', onClick: newTemplateForHere },
199
+ { label: '为本目录新建模板…', icon: 'plus', onClick: newTemplateForHere },
204
200
  { label: '管理模板…', icon: 'gear', onClick: openTplList },
205
201
  ];
206
202
 
207
203
  // ─── 文档列表(右侧栏)────────────────────────────────────────────
208
204
  const openRefs = () => {
209
- if (isGlobal || !repo) {
210
- toast('全局池没有项目文档列表');
205
+ if (!repo) {
206
+ toast('这个目录还没有登记为仓库,没有项目文档列表');
211
207
  return;
212
208
  }
213
209
  if (!model) return;
@@ -229,7 +225,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
229
225
  const name = file.name.replace(/\.md$/i, '');
230
226
  await guard(async () => {
231
227
  const bodyText = text.startsWith('#') ? text : `# ${name}\n\n${text}`;
232
- const res = await addTask(isGlobal ? { global: true, text: bodyText } : { cwd: topic?.cwd, text: bodyText });
228
+ const res = await addTask({ cwd: topic?.cwd, text: bodyText });
233
229
  toast(`已导入:${file.name}`);
234
230
  refreshLocal?.();
235
231
  const newId = res?.task?.id ?? res?.id;
@@ -237,7 +233,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
237
233
  });
238
234
  };
239
235
 
240
- if (!topic && !isGlobal) {
236
+ if (!topic) {
241
237
  // 空态与组页同骨架(#170:落地页不套 .mdw 编辑器外壳;#251:两页空态都走 rp-page)
242
238
  return (
243
239
  <div className="rp-page">
@@ -254,11 +250,11 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
254
250
  <>
255
251
  <TaskPage
256
252
  kind="dir"
257
- name={isGlobal ? '全局池' : (topic?.name || '目录')}
258
- title={isGlobal ? '全局池任务' : '任务'}
259
- intro={!isGlobal && repo ? <Introduction kind="repo" owner={repo} model={model} /> : null}
253
+ name={topic?.name || '目录'}
254
+ title='任务'
255
+ intro={repo ? <Introduction kind="repo" owner={repo} model={model} /> : null}
260
256
  rows={pageRows}
261
- emptyText={`还没有页面:点「+ 新建页」写第一篇,或让 agent 往${isGlobal ? '全局池' : '这个目录'}投递任务。`}
257
+ emptyText='还没有页面:点「+ 新建页」写第一篇,或让 agent 往这个目录投递任务。'
262
258
  tplMenuItems={tplMenuItems}
263
259
  onNew={() => {
264
260
  const p = tpl ? tpl.defaultPick() : null;
@@ -33,7 +33,6 @@ import {
33
33
  saveDoc,
34
34
  scopeOf,
35
35
  } from '../../modules/md/doc-store.js';
36
- import { GLOBAL_KEY } from '../../modules/board/board-view.js';
37
36
  import type { AttachAreaHandle } from '../../components/md/attachments/attach-area.jsx';
38
37
  import type { LocalTask, LocalTopic, TemplatesApi } from '../../types.js';
39
38
  import type {
@@ -65,7 +64,6 @@ interface UseTaskActionsArgs {
65
64
  taskRow: LocalTask | null;
66
65
  topicKey: string;
67
66
  topic: LocalTopic | null;
68
- isGlobal: boolean;
69
67
  boardCtx: BoardCtx | null;
70
68
  docFm: DocFm;
71
69
  groupAnchored: boolean;
@@ -91,7 +89,7 @@ interface UseTaskActionsArgs {
91
89
  }
92
90
 
93
91
  export function useTaskActions({
94
- doc, id, isDraft, task, taskRow, topicKey, topic, isGlobal, boardCtx, docFm,
92
+ doc, id, isDraft, task, taskRow, topicKey, topic, boardCtx, docFm,
95
93
  groupAnchored, groupId, rows, app, model, tabId, tpl, refreshLocal,
96
94
  markDirty, histRef, editorApiRef, attachAreaRef,
97
95
  setDirty,
@@ -141,7 +139,7 @@ export function useTaskActions({
141
139
  const fm = parseFrontmatter(doc.body);
142
140
  const b = composeText(t, doc.body);
143
141
  const projTopic = fm.project
144
- ? rows.find((r) => !r.isGlobal && r.repo && r.repo.key === fm.project)
142
+ ? rows.find((r) => r.repo && r.repo.key === fm.project)
145
143
  : null;
146
144
  const groupSubmit = !!(boardCtx && fm.project &&
147
145
  boardCtx.members.some((m) => m.key === fm.project));
@@ -152,8 +150,7 @@ export function useTaskActions({
152
150
  }
153
151
  if (!isDraft) {
154
152
  const res = await patchTaskItem({
155
- cwd: isGlobal ? (projTopic ? projTopic.cwd : undefined) : topic?.cwd,
156
- key: isGlobal && !projTopic ? GLOBAL_KEY : undefined,
153
+ cwd: projTopic ? projTopic.cwd : topic?.cwd,
157
154
  id: Number(task),
158
155
  text: b,
159
156
  ...gp,
@@ -195,9 +192,7 @@ export function useTaskActions({
195
192
  ? { text: b, board: boardCtx.board.id, project: fm.project }
196
193
  : fm.project
197
194
  ? { text: b, project: fm.project }
198
- : isGlobal
199
- ? { global: true, text: b }
200
- : { cwd: topic?.cwd, text: b }),
195
+ : { cwd: topic?.cwd, text: b }),
201
196
  ...gp,
202
197
  });
203
198
  const newId = res?.task?.id ?? res?.id;
@@ -224,18 +219,14 @@ export function useTaskActions({
224
219
  }
225
220
  toast(`已提交:${slugName(t)}`);
226
221
  refreshLocal?.();
227
- }), [doc, id, isDraft, task, topicKey, topic, isGlobal, boardCtx, groupAnchored, groupId, rows, app, model, tabId, refreshLocal, histRef, setDirty, composeText, goalPatchOf, guard, toast]);
222
+ }), [doc, id, isDraft, task, topicKey, topic, boardCtx, groupAnchored, groupId, rows, app, model, tabId, refreshLocal, histRef, setDirty, composeText, goalPatchOf, guard, toast]);
228
223
 
229
224
  const importMd = useCallback(async (file: File) => {
230
225
  const text = await file.text();
231
226
  const name = file.name.replace(/\.md$/i, '');
232
227
  await guard(async () => {
233
228
  const bodyText = text.startsWith('#') ? text : `# ${name}\n\n${text}`;
234
- const res = await addTask(
235
- isGlobal
236
- ? { global: true, text: bodyText }
237
- : { cwd: topic?.cwd, text: bodyText },
238
- );
229
+ const res = await addTask({ cwd: topic?.cwd, text: bodyText });
239
230
  toast(`已导入:${file.name}`);
240
231
  refreshLocal?.();
241
232
  const newId = res?.task?.id ?? res?.id;
@@ -244,7 +235,7 @@ export function useTaskActions({
244
235
  else app.openPage({ dirKey: topicKey, task: String(newId), name: `#${newId}` });
245
236
  }
246
237
  });
247
- }, [isGlobal, groupAnchored, docFm.project, topic?.cwd, topicKey, groupId, app, refreshLocal, guard, toast]);
238
+ }, [groupAnchored, docFm.project, topic?.cwd, topicKey, groupId, app, refreshLocal, guard, toast]);
248
239
 
249
240
  const delTask = useCallback(async () => {
250
241
  if (!doc || isDraft) return;
@@ -257,7 +248,7 @@ export function useTaskActions({
257
248
  });
258
249
  if (!ok) return;
259
250
  guard(async () => {
260
- await removeTaskItem(isGlobal ? { key: GLOBAL_KEY, id: Number(task) } : { cwd: topic?.cwd, id: Number(task) });
251
+ await removeTaskItem({ cwd: topic?.cwd, id: Number(task) });
261
252
  toast(`已删除「${title}」`);
262
253
  // #191:删除后**不拆面板**——maincontent 永远不会被删除。主布局里的任务页
263
254
  // 就地导航回父级(组页 / 目录页 / 全局),路由 effect 会用 openPanel 换内容,
@@ -273,14 +264,12 @@ export function useTaskActions({
273
264
  if (model && tabId) model.doAction(Actions.deleteTab(tabId));
274
265
  } else if (groupAnchored) {
275
266
  app.onNavigate('#/group/' + encodeURIComponent(groupId || ''));
276
- } else if (isGlobal) {
277
- app.onNavigate('#/global');
278
267
  } else {
279
268
  app.onNavigate('#/dir/' + encodeURIComponent(topicKey || ''));
280
269
  }
281
270
  refreshLocal?.();
282
271
  });
283
- }, [doc, isDraft, task, isGlobal, topic, model, tabId, app, groupAnchored, groupId, topicKey, refreshLocal, guard, toast, dialog]);
272
+ }, [doc, isDraft, task, topic, model, tabId, app, groupAnchored, groupId, topicKey, refreshLocal, guard, toast, dialog]);
284
273
 
285
274
  // #184:正在跑(claimed)的任务以前在面板上是死路——工具栏连「标为完成」都不渲染,
286
275
  // 只能干等 agent 自己回执。现在 claimed 也能收:用户是最终验收方,agent 稍后的 done
@@ -294,7 +283,7 @@ export function useTaskActions({
294
283
  if (kind === 'done' ? !canComplete : !canCancel) return;
295
284
  guard(async () => {
296
285
  const title = doc?.title || `#${task}`;
297
- const scope = isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd };
286
+ const scope = { cwd: topic?.cwd };
298
287
  if (kind === 'done') {
299
288
  const claimed = taskStatus === 'claimed';
300
289
  const who = String(taskRow?.claimedByName || taskRow?.claimedBy || '').trim();
@@ -323,7 +312,7 @@ export function useTaskActions({
323
312
  }
324
313
  refreshLocal?.();
325
314
  });
326
- }, [canComplete, canCancel, doc, task, isGlobal, topic, taskStatus, taskRow, refreshLocal, guard, toast, dialog]);
315
+ }, [canComplete, canCancel, doc, task, topic, taskStatus, taskRow, refreshLocal, guard, toast, dialog]);
327
316
 
328
317
  // #131:plan(草稿)态开关。任务页「更多」里直接切——
329
318
  // 草稿态不进队列(get/wait 领不到),转回待领取才重新排队。
@@ -332,12 +321,12 @@ export function useTaskActions({
332
321
  if (!canPlan) return;
333
322
  const to = taskStatus === 'plan' ? 'pending' : 'plan';
334
323
  guard(async () => {
335
- const scope = isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd };
324
+ const scope = { cwd: topic?.cwd };
336
325
  await setPlanStatus({ ...scope, id: Number(task), to });
337
326
  toast(to === 'plan' ? `已把 #${task} 转成草稿态(不进队列)` : `已把 #${task} 转回待领取`);
338
327
  refreshLocal?.();
339
328
  });
340
- }, [canPlan, taskStatus, task, isGlobal, topic, guard, toast, refreshLocal]);
329
+ }, [canPlan, taskStatus, task, topic, guard, toast, refreshLocal]);
341
330
 
342
331
  const addFiles = useCallback(async (fileList: FileList | File[], opts: { mode?: string } = {}) => {
343
332
  if (!doc) return;
@@ -375,8 +364,7 @@ export function useTaskActions({
375
364
  saveDoc(id, { body: synced, title: titleFromMd(synced) });
376
365
  try {
377
366
  await patchTaskItem({
378
- cwd: isGlobal ? undefined : topic?.cwd,
379
- key: isGlobal ? GLOBAL_KEY : undefined,
367
+ cwd: topic?.cwd,
380
368
  id: Number(task),
381
369
  text: synced,
382
370
  });
@@ -390,7 +378,7 @@ export function useTaskActions({
390
378
  return;
391
379
  }
392
380
  markDirty();
393
- }, [doc, id, isDraft, task, topic, isGlobal, setDirty, refreshLocal, markDirty, composeText, editorApiRef, toast]);
381
+ }, [doc, id, isDraft, task, topic, setDirty, refreshLocal, markDirty, composeText, editorApiRef, toast]);
394
382
 
395
383
  /** 「更多 → 新任务」:新草稿**带着当前上下文**(工作组 + 归属项目)。 */
396
384
  const newTask = useCallback(() => {
@@ -419,7 +407,7 @@ export function useTaskActions({
419
407
  return;
420
408
  }
421
409
  guard(async () => {
422
- const res = await cloneTask(isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd });
410
+ const res = await cloneTask({ id: Number(task), cwd: topic?.cwd });
423
411
  toast(`已克隆为新任务 #${res.task?.id ?? res.id}`);
424
412
  refreshLocal?.();
425
413
  const newId = res?.task?.id ?? res?.id;
@@ -428,7 +416,7 @@ export function useTaskActions({
428
416
  else app.openPage({ dirKey: topicKey, task: String(newId), name: `${(doc?.title || '任务').slice(0, 30)}(克隆)` });
429
417
  }
430
418
  });
431
- }, [isDraft, task, isGlobal, topic, groupAnchored, groupId, topicKey, app, doc, refreshLocal, guard, toast]);
419
+ }, [isDraft, task, topic, groupAnchored, groupId, topicKey, app, doc, refreshLocal, guard, toast]);
432
420
 
433
421
  /** 「更多 → Fork 任务」:clone 的原文复制 + 保留源任务链(#67)。 */
434
422
  const forkCur = useCallback(() => {
@@ -437,7 +425,7 @@ export function useTaskActions({
437
425
  return;
438
426
  }
439
427
  guard(async () => {
440
- const res = await forkTask(isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd });
428
+ const res = await forkTask({ id: Number(task), cwd: topic?.cwd });
441
429
  toast(`已 Fork 为新任务 #${res.task?.id ?? res.id}(保留任务链)`);
442
430
  refreshLocal?.();
443
431
  const newId = res?.task?.id ?? res?.id;
@@ -446,7 +434,7 @@ export function useTaskActions({
446
434
  else app.openPage({ dirKey: topicKey, task: String(newId), name: `${(doc?.title || '任务').slice(0, 30)}(Fork)` });
447
435
  }
448
436
  });
449
- }, [isDraft, task, isGlobal, topic, groupAnchored, groupId, topicKey, app, doc, refreshLocal, guard, toast]);
437
+ }, [isDraft, task, topic, groupAnchored, groupId, topicKey, app, doc, refreshLocal, guard, toast]);
450
438
 
451
439
  const openProgress = useCallback(() => {
452
440
  const m = model || app.model;
@@ -457,7 +445,7 @@ export function useTaskActions({
457
445
  name: '进程',
458
446
  config: boardId
459
447
  ? { groupKey: boardId, task: task != null ? String(task) : undefined }
460
- : { dirKey: topicKey || GLOBAL_KEY, task: task != null ? String(task) : undefined },
448
+ : { dirKey: topicKey, task: task != null ? String(task) : undefined },
461
449
  location: 'right',
462
450
  });
463
451
  }, [model, app.model, docFm, task, topicKey]);
@@ -2,7 +2,6 @@
2
2
  import { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import type { Model } from 'flexlayout-react';
4
4
  import { getTaskChain } from './api.js';
5
- import { GLOBAL_KEY } from '../../modules/board/board-view.js';
6
5
  import { openBesideMain } from '../../workspace.js';
7
6
  import type { LocalTask, LocalTopic } from '../../types.js';
8
7
  import type { AppSlice, ChainApi, ChainApiItem, ChainNode, ChainTreeNode, HistorySnapshot } from './task-utils.js';
@@ -13,7 +12,6 @@ interface UseChainArgs {
13
12
  taskRow: LocalTask | null;
14
13
  topicKey: string;
15
14
  topic: LocalTopic | null;
16
- isGlobal: boolean;
17
15
  groupAnchored: boolean;
18
16
  groupId?: string;
19
17
  app: AppSlice;
@@ -23,7 +21,7 @@ interface UseChainArgs {
23
21
  }
24
22
 
25
23
  export function useChain({
26
- isDraft, task, taskRow, topicKey, topic, isGlobal, groupAnchored, groupId,
24
+ isDraft, task, taskRow, topicKey, topic, groupAnchored, groupId,
27
25
  app, model, historyId, toast,
28
26
  }: UseChainArgs) {
29
27
  const [chainApi, setChainApi] = useState<ChainApi | null>(null);
@@ -33,9 +31,7 @@ export function useChain({
33
31
  return undefined;
34
32
  }
35
33
  let cancelled = false;
36
- const q = isGlobal
37
- ? `key=${encodeURIComponent(GLOBAL_KEY)}&id=${Number(task)}`
38
- : `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
34
+ const q = `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
39
35
  getTaskChain(q)
40
36
  .then((d) => {
41
37
  if (!cancelled) setChainApi(d);
@@ -46,7 +42,7 @@ export function useChain({
46
42
  return () => {
47
43
  cancelled = true;
48
44
  };
49
- }, [isDraft, task, isGlobal, topic?.cwd, taskRow?.history?.length, taskRow?.forkOf, taskRow?.reopenCount]);
45
+ }, [isDraft, task, topic?.cwd, taskRow?.history?.length, taskRow?.forkOf, taskRow?.reopenCount]);
50
46
 
51
47
  // #172:单向树(后端 taskChain.tree)——面板树视图的结构真相
52
48
  const chainTree = useMemo<ChainTreeNode | null>(() => (isDraft || !chainApi ? null : (chainApi.tree as ChainTreeNode) || null), [isDraft, chainApi]);
@@ -110,7 +106,7 @@ export function useChain({
110
106
  attachmentCount: 0,
111
107
  current: true,
112
108
  taskId: Number(task),
113
- dirKey: topicKey || GLOBAL_KEY,
109
+ dirKey: topicKey,
114
110
  });
115
111
  for (const c of children) {
116
112
  nodes.push({
@@ -144,7 +140,7 @@ export function useChain({
144
140
  // 组锚定页保持组锚(任务还在本组,只是看最新一轮)
145
141
  if (groupAnchored) app.openPage({ groupId, task: String(latestChild.id), name: `#${latestChild.id}` });
146
142
  else app.openPage({
147
- dirKey: String(latestChild.key || topicKey || GLOBAL_KEY),
143
+ dirKey: String(latestChild.key || topicKey || ''),
148
144
  task: String(latestChild.id),
149
145
  name: `#${latestChild.id}`,
150
146
  });
@@ -165,7 +161,7 @@ export function useChain({
165
161
  component: 'page',
166
162
  name: `链 #${task} · ${node.kind || node.historyId}`,
167
163
  config: {
168
- dirKey: topicKey || GLOBAL_KEY,
164
+ dirKey: topicKey,
169
165
  task: String(task),
170
166
  historyId: Number(node.historyId),
171
167
  },
@@ -11,7 +11,6 @@ import { docIdOfLocator } from '../../components/md/attachments/attach-common.js
11
11
  import { openPanel } from '../../workspace.js';
12
12
  import { getMdfileContent } from './api.js';
13
13
  import { renderMarkdownHtml } from '../../modules/md/md-render.js';
14
- import { GLOBAL_KEY } from '../../modules/board/board-view.js';
15
14
  import type { LocalTask, LocalTopic } from '../../types.js';
16
15
  import { fmtSec } from './task-utils.js';
17
16
  import type { AppSlice, ChainApiItem, DocState, GoalLogState } from './task-utils.js';
@@ -41,7 +40,6 @@ interface DockPanelProps {
41
40
  task: string;
42
41
  topic: LocalTopic | null;
43
42
  topicKey: string;
44
- isGlobal: boolean;
45
43
  doc: DocState;
46
44
  id: string;
47
45
  model: Model | null;
@@ -137,7 +135,7 @@ export function DockPanel({
137
135
  dockOpen, dockTab, dockH, dockRef, dockMax,
138
136
  showDockTab, onDockDragStart, toggleDockMax, setDockOpen,
139
137
  canShowGoalLog, goalLog, openGoalLog,
140
- isDraft, task, topic, topicKey, isGlobal, doc, id, model, app,
138
+ isDraft, task, topic, topicKey, doc, id, model, app,
141
139
  refreshLocal, markDirty, saveDoc, persistAtt,
142
140
  attachAreaRef, reviewBarRef, reviewSumRef,
143
141
  taskRow, ackOpen, setAckOpen, ackOverflow, ackLong, ackHtml,
@@ -240,8 +238,7 @@ export function DockPanel({
240
238
  ref={attachAreaRef}
241
239
  host="task"
242
240
  hostId={Number(task)}
243
- hostKey={isGlobal ? GLOBAL_KEY : undefined}
244
- hostCwd={isGlobal ? undefined : topic.cwd}
241
+ hostCwd={topic.cwd}
245
242
  allow={{ file: true, url: true, folder: true, task: true, ref: true, repo: true }}
246
243
  taskOptions={(topic.tasks || []).map((t: LocalTask) => ({ id: t.id, text: t.text, status: t.status }))}
247
244
  onChanged={refreshLocal}
@@ -10,7 +10,6 @@ import { persistAtt } from '../../components/md/attachments/attachments.js';
10
10
  import type { Attachment } from '../../components/md/attachments/attach-common.js';
11
11
  import { titleFromMd } from '../../modules/md/md-parse.js';
12
12
  import { docIdOf, saveDoc, scopeOf } from '../../modules/md/doc-store.js';
13
- import { GLOBAL_KEY } from '../../modules/board/board-view.js';
14
13
  import {
15
14
  buildReopenText,
16
15
  FEEDBACK_HEADING,
@@ -35,7 +34,6 @@ interface UseFeedbackArgs {
35
34
  taskRow: LocalTask | null;
36
35
  topicKey: string;
37
36
  topic: LocalTopic | null;
38
- isGlobal: boolean;
39
37
  dirKey?: string;
40
38
  groupAnchored: boolean;
41
39
  groupId?: string;
@@ -52,7 +50,7 @@ interface UseFeedbackArgs {
52
50
  }
53
51
 
54
52
  export function useFeedback({
55
- doc, isDraft, task, taskRow, topicKey, topic, isGlobal, dirKey,
53
+ doc, isDraft, task, taskRow, topicKey, topic, dirKey,
56
54
  groupAnchored, groupId, app, model, tabId, refreshLocal,
57
55
  closeSelMenu, lastSel, selMenu, dirty, setDirty, guard,
58
56
  }: UseFeedbackArgs) {
@@ -61,11 +59,9 @@ export function useFeedback({
61
59
  /** 服务端当前任务(#79):评论/反馈的 base 以**盘上正文**为准——会话 doc 可能过期。 */
62
60
  const fetchServerTask = useCallback(async () => {
63
61
  if (isDraft || task == null || /^draft/i.test(String(task))) return null;
64
- const q = isGlobal
65
- ? `key=${encodeURIComponent(GLOBAL_KEY)}&id=${Number(task)}`
66
- : `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
62
+ const q = `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
67
63
  return findTaskItem(q).catch(() => null);
68
- }, [isDraft, task, isGlobal, topic?.cwd]);
64
+ }, [isDraft, task, topic?.cwd]);
69
65
 
70
66
  /** 反馈:开一块 **md 编辑面板** 写意见;提交后**新建一条任务**(forkOf 指回本条),原任务不动。 */
71
67
  const openFeedback = useCallback(() => {
@@ -79,7 +75,7 @@ export function useFeedback({
79
75
  prevQuote: String(taskRow?.roundSummary || '').trim()
80
76
  || String(doc?.body || '').trim().slice(0, 400),
81
77
  // 原文定位(#107):点引用区在右侧并排打开这条任务的原文
82
- src: { dirKey: topicKey || dirKey || GLOBAL_KEY, task: String(task), name: `原文 #${task}` },
78
+ src: { dirKey: topicKey || dirKey || '', task: String(task), name: `原文 #${task}` },
83
79
  onSubmit: (payload: FeedbackPayload) => spawnFeedbackTask(payload),
84
80
  });
85
81
  }, [model, app.model, task, doc, taskRow, topicKey, dirKey]);
@@ -115,11 +111,7 @@ export function useFeedback({
115
111
  !isDraft && task != null && !/^draft/i.test(String(task))
116
112
  ? { forkOf: String(task), forkKind: 'reopen' }
117
113
  : {};
118
- const res = await addTask(
119
- isGlobal
120
- ? { global: true, text, ...linkFields }
121
- : { cwd: topic?.cwd, text, ...linkFields },
122
- );
114
+ const res = await addTask({ cwd: topic?.cwd, text, ...linkFields });
123
115
  const newId = String(res?.task?.id ?? res?.id ?? '');
124
116
  if (!newId) {
125
117
  toast('反馈已提交,但未拿到新任务编号');
@@ -137,7 +129,7 @@ export function useFeedback({
137
129
  else app.openPage({ dirKey: landedKey, task: newId, name: `${title.slice(0, 24)}(反馈)` });
138
130
  }
139
131
  });
140
- }, [doc, task, taskRow, isDraft, isGlobal, topic, topicKey, groupAnchored, groupId, app, refreshLocal, closeSelMenu, guard, toast, fetchServerTask]);
132
+ }, [doc, task, taskRow, isDraft, topic, topicKey, groupAnchored, groupId, app, refreshLocal, closeSelMenu, guard, toast, fetchServerTask]);
141
133
 
142
134
  /** 划选评论 → 派生评论任务(#172:原任务保持活着不取消,新任务只记录这条批注)。 */
143
135
  const submitCommentInPlace = useCallback(({ text: fbRaw, attachments = [], inserts = '', quote }: FeedbackPayload = {}) => {
@@ -184,7 +176,7 @@ export function useFeedback({
184
176
  text = buildReopenText(reopenArgs);
185
177
  }
186
178
  const res = await postReopen({
187
- ...(isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd }),
179
+ cwd: topic?.cwd,
188
180
  id: Number(task),
189
181
  ...(text ? { text } : {}),
190
182
  kind: 'comment',
@@ -213,7 +205,7 @@ export function useFeedback({
213
205
  toast(`已回写评论「${title}」#${sameId}`);
214
206
  refreshLocal?.();
215
207
  });
216
- }, [doc, task, isDraft, isGlobal, topic, topicKey, model, tabId, refreshLocal, closeSelMenu, lastSel, dirty, setDirty, guard, toast, fetchServerTask]);
208
+ }, [doc, task, isDraft, topic, topicKey, model, tabId, refreshLocal, closeSelMenu, lastSel, dirty, setDirty, guard, toast, fetchServerTask]);
217
209
 
218
210
  /** 工具栏「评论」:只用当前可见选区;**新开 md 编辑面板**(#104) */
219
211
  const openCommentFromToolbar = useCallback(() => {
@@ -231,7 +223,7 @@ export function useFeedback({
231
223
  quote,
232
224
  taskLabel: task != null ? '#' + task : '',
233
225
  taskTitle: String(doc?.title || '').replace(/^#+\s*/, ''),
234
- src: { dirKey: topicKey || dirKey || GLOBAL_KEY, task: String(task), name: `原文 #${task}` },
226
+ src: { dirKey: topicKey || dirKey || '', task: String(task), name: `原文 #${task}` },
235
227
  onSubmit: (payload: FeedbackPayload) => submitCommentInPlace({ ...payload, quote }),
236
228
  });
237
229
  closeSelMenu();
@@ -6,11 +6,10 @@ interface NotFoundViewProps {
6
6
  app: AppSlice;
7
7
  groupAnchored: boolean;
8
8
  groupId?: string;
9
- isGlobal: boolean;
10
9
  dirKey?: string;
11
10
  }
12
11
 
13
- export function NotFoundView({ task, app, groupAnchored, groupId, isGlobal, dirKey }: NotFoundViewProps) {
12
+ export function NotFoundView({ task, app, groupAnchored, groupId, dirKey }: NotFoundViewProps) {
14
13
  return (
15
14
  <div className="mdw">
16
15
  <div className="pad stack">
@@ -22,7 +21,7 @@ export function NotFoundView({ task, app, groupAnchored, groupId, isGlobal, dirK
22
21
  onClick={() => app.onNavigate && app.onNavigate(
23
22
  groupAnchored
24
23
  ? '#/group/' + encodeURIComponent(groupId || '')
25
- : isGlobal ? '#/global' : '#/dir/' + encodeURIComponent(dirKey || '')
24
+ : '#/dir/' + encodeURIComponent(dirKey || '')
26
25
  )}
27
26
  >
28
27
  回到目录
@@ -249,7 +249,6 @@ export interface TaskCtx {
249
249
  taskRow: LocalTask | null;
250
250
  topicKey: string;
251
251
  topic: LocalTopic | null;
252
- isGlobal: boolean;
253
252
  groupAnchored: boolean;
254
253
  groupId?: string;
255
254
  dirKey?: string;