nx-kv 0.25.0 → 0.26.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 (36) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/assets/kv-get/SKILL.md +7 -11
  3. package/package.json +1 -1
  4. package/src/modules/localtask/index.js +36 -15
  5. package/src/modules/localtask/task-lifecycle.js +128 -55
  6. package/src/modules/localtask/task-view.js +89 -12
  7. package/src/web/frontend/components/md/sel-menu.jsx +112 -19
  8. package/src/web/frontend/components/md/task-chain.jsx +75 -0
  9. package/src/web/frontend/components/md/tool-bar.jsx +6 -0
  10. package/src/web/frontend/modules/board/ack-nodes.js +2 -2
  11. package/src/web/frontend/modules/md/style.css +44 -0
  12. package/src/web/frontend/page/dir/index.jsx +32 -15
  13. package/src/web/frontend/page/dir/landing.jsx +2 -2
  14. package/src/web/frontend/page/dir/task.jsx +300 -89
  15. package/src/web/frontend/panels.jsx +13 -3
  16. package/src/web/public/assets/{Introduction-VfytFhtV.js → Introduction-ka0UxW_S.js} +1 -1
  17. package/src/web/public/assets/{cloud-DolkshAI.js → cloud-y1mZIdlN.js} +1 -1
  18. package/src/web/public/assets/{dag-C-E5GoLz.js → dag-CiMSs7uT.js} +1 -1
  19. package/src/web/public/assets/dir-DKzzrY8P.js +3 -0
  20. package/src/web/public/assets/{group-BQTuoGyZ.js → group-DOLdLkaj.js} +1 -1
  21. package/src/web/public/assets/{index-BryAyn_9.js → index-CbZfbzqr.js} +2 -2
  22. package/src/web/public/assets/{index-B48b_WIl.css → index-DUvCgdUV.css} +1 -1
  23. package/src/web/public/assets/{md-history-vwtmQsFJ.js → md-history-Ddk04A_2.js} +1 -1
  24. package/src/web/public/assets/{member-picker-DwJAdKTe.js → member-picker-Dsy1GH0E.js} +1 -1
  25. package/src/web/public/assets/{overview-Crnguaek.js → overview-ty9m-bCh.js} +1 -1
  26. package/src/web/public/assets/{progress-ijTyMRPT.js → progress-BQJhISlF.js} +1 -1
  27. package/src/web/public/assets/{repos-C_dN0b6h.js → repos-Di5InllN.js} +1 -1
  28. package/src/web/public/assets/{route-crumb-DZw2J3Nx.js → route-crumb-g3leiQhY.js} +1 -1
  29. package/src/web/public/assets/{settings-C7zGy-xI.js → settings-CE-rlcXr.js} +1 -1
  30. package/src/web/public/assets/task-D97dEZdc.js +6 -0
  31. package/src/web/public/assets/{template-slots-DhPGCIqW.js → template-slots-D40ponA2.js} +1 -1
  32. package/src/web/public/assets/{templates-xXPow5BD.js → templates-Ca1jXhnO.js} +1 -1
  33. package/src/web/public/assets/{upload-uBhGCTZ2.js → upload-BeiJetbd.js} +1 -1
  34. package/src/web/public/index.html +2 -2
  35. package/src/web/public/assets/dir-kBhfKX8r.js +0 -3
  36. package/src/web/public/assets/task-CqoiXFKL.js +0 -5
@@ -1,5 +1,6 @@
1
- /** 划选浮层:格式条(源码/live 编辑)与划线评论(任意选区) */
1
+ /** 划选浮层:格式条 + 统一「评论/反馈」组件(可粘贴/添加图片附件) */
2
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { filesToAttachments } from './attachments.js';
3
4
 
4
5
  const FMT = [
5
6
  { op: 'bold', label: 'B', title: '粗体', cls: 'b' },
@@ -8,6 +9,24 @@ const FMT = [
8
9
  { op: 'link', label: '链', title: '链接', cls: 'link' },
9
10
  ];
10
11
 
12
+ function clipboardFiles(e) {
13
+ const out = [];
14
+ const cd = e.clipboardData;
15
+ if (!cd) return out;
16
+ if (cd.files?.length) {
17
+ for (const f of cd.files) out.push(f);
18
+ }
19
+ if (!out.length && cd.items?.length) {
20
+ for (const it of cd.items) {
21
+ if (it.kind === 'file') {
22
+ const f = it.getAsFile();
23
+ if (f) out.push(f);
24
+ }
25
+ }
26
+ }
27
+ return out;
28
+ }
29
+
11
30
  export default function SelMenu({
12
31
  at,
13
32
  onFormat,
@@ -18,12 +37,16 @@ export default function SelMenu({
18
37
  }) {
19
38
  const [composing, setComposing] = useState(false);
20
39
  const [draft, setDraft] = useState('');
40
+ const [pendingAtt, setPendingAtt] = useState({ items: [], inserts: '' });
41
+ const [busy, setBusy] = useState(false);
21
42
  const taRef = useRef(null);
43
+ const fileRef = useRef(null);
22
44
 
23
45
  useEffect(() => {
24
46
  setComposing(!!at?.comment);
25
47
  setDraft('');
26
- }, [at?.text, at?.x, at?.y, at?.comment]);
48
+ setPendingAtt({ items: [], inserts: '' });
49
+ }, [at?.text, at?.x, at?.y, at?.comment, at?.mode]);
27
50
 
28
51
  useEffect(() => {
29
52
  if (!composing) return undefined;
@@ -36,25 +59,61 @@ export default function SelMenu({
36
59
  const showFmt = kind === 'format' || kind === 'both';
37
60
  const quote = String(at.text || '');
38
61
  const quoteShort = quote.length > 72 ? `${quote.slice(0, 72)}…` : quote;
39
- // 重做模式:针对整条任务(不锚定选区),没有引文可显示
40
- const isRedo = at.mode === 'redo';
41
- const cap = isRedo ? '重做:写下要改的地方' : '划线评论';
62
+ const isFeedback = at.mode === 'feedback' || at.mode === 'redo';
63
+ const cap = isFeedback ? '反馈:写下要改的地方(将新开任务)' : '划线评论(回写本任务)';
64
+ const canSubmit = !!draft.trim() || pendingAtt.items.length > 0;
42
65
 
43
66
  const startCompose = () => {
44
67
  setComposing(true);
45
- onCompose?.(); // 父级打上 comment:true,避免选区塌缩时关掉浮层
68
+ onCompose?.();
46
69
  };
47
70
 
48
71
  const cancelCompose = () => {
49
72
  setComposing(false);
50
73
  setDraft('');
51
- onClose?.(); // 取消直接收起:选区已塌,格式条也没用了
74
+ setPendingAtt({ items: [], inserts: '' });
75
+ onClose?.();
52
76
  };
53
77
 
54
78
  const submit = () => {
55
- const q = draft.trim();
56
- if (!q) return;
57
- onComment?.(q);
79
+ if (!canSubmit || busy) return;
80
+ onComment?.({
81
+ text: draft.trim(),
82
+ attachments: pendingAtt.items,
83
+ inserts: pendingAtt.inserts,
84
+ mode: isFeedback ? 'feedback' : 'comment',
85
+ quote,
86
+ });
87
+ };
88
+
89
+ const pickFiles = async (fileList) => {
90
+ if (!fileList?.length) return;
91
+ setBusy(true);
92
+ try {
93
+ const { items, imageInserts, fileInserts } = await filesToAttachments(fileList);
94
+ const inserts = [...(imageInserts || []), ...(fileInserts || [])].join('');
95
+ setPendingAtt((prev) => ({
96
+ items: [...prev.items, ...items],
97
+ inserts: `${prev.inserts}${inserts}`,
98
+ }));
99
+ } finally {
100
+ setBusy(false);
101
+ if (fileRef.current) fileRef.current.value = '';
102
+ }
103
+ };
104
+
105
+ const onPaste = (e) => {
106
+ const files = clipboardFiles(e);
107
+ if (!files.length) return; // 纯文本走默认粘贴
108
+ e.preventDefault();
109
+ pickFiles(files);
110
+ };
111
+
112
+ const onDrop = (e) => {
113
+ e.preventDefault();
114
+ e.stopPropagation();
115
+ const files = [...(e.dataTransfer?.files || [])];
116
+ if (files.length) pickFiles(files);
58
117
  };
59
118
 
60
119
  return (
@@ -64,13 +123,19 @@ export default function SelMenu({
64
123
  style={{ left: at.x, top: at.y }}
65
124
  role="menu"
66
125
  onMouseDown={(e) => {
67
- // 保划选:点按钮不丢选区;输入框要能聚焦,不能 preventDefault
68
- if (e.target.closest?.('textarea, input')) return;
126
+ if (e.target.closest?.('textarea, input, button')) return;
69
127
  e.preventDefault();
70
128
  }}
71
129
  >
72
130
  {composing ? (
73
- <div className="mdw-sel-comment">
131
+ <div
132
+ className="mdw-sel-comment"
133
+ onDragOver={(e) => {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ }}
137
+ onDrop={onDrop}
138
+ >
74
139
  <div className="mdw-sel-comment-cap">{cap}</div>
75
140
  {quote ? (
76
141
  <div className="mdw-sel-quote" title={quote}>{quoteShort}</div>
@@ -80,9 +145,10 @@ export default function SelMenu({
80
145
  className="mdw-sel-comment-ta"
81
146
  rows={3}
82
147
  value={draft}
83
- placeholder={isRedo ? '写下要改的地方…' : '对此处提出问题…'}
84
- aria-label="评论文本"
148
+ placeholder={isFeedback ? '写下反馈…可粘贴/拖入图片' : '对此处提出问题…可粘贴/拖入图片'}
149
+ aria-label={isFeedback ? '反馈文本' : '评论文本'}
85
150
  onChange={(e) => setDraft(e.target.value)}
151
+ onPaste={onPaste}
86
152
  onKeyDown={(e) => {
87
153
  if (e.key === 'Escape') {
88
154
  e.preventDefault();
@@ -96,20 +162,47 @@ export default function SelMenu({
96
162
  }
97
163
  }}
98
164
  />
165
+ {pendingAtt.items.length ? (
166
+ <div className="mdw-sel-att-list">
167
+ {pendingAtt.items.map((a) => (
168
+ <span key={a.id} className="mdw-sel-att-chip" title={a.name}>
169
+ {a.type === 'image' ? '🖼' : '📎'} {a.name}
170
+ </span>
171
+ ))}
172
+ </div>
173
+ ) : null}
99
174
  <div className="mdw-sel-comment-acts">
175
+ <input
176
+ ref={fileRef}
177
+ type="file"
178
+ multiple
179
+ hidden
180
+ accept="image/*,*/*"
181
+ onChange={(e) => pickFiles(e.target.files)}
182
+ />
183
+ <button
184
+ type="button"
185
+ className="ghost"
186
+ disabled={busy}
187
+ title="添加图片或附件(也可粘贴/拖入)"
188
+ onClick={() => fileRef.current?.click()}
189
+ >
190
+ {busy ? '上传中…' : '附件'}
191
+ </button>
192
+ <span className="grow" />
100
193
  <button type="button" className="ghost" onClick={cancelCompose}>
101
194
  取消
102
195
  </button>
103
196
  <button
104
197
  type="button"
105
198
  className="primary"
106
- disabled={!draft.trim()}
199
+ disabled={!canSubmit || busy}
107
200
  onClick={submit}
108
201
  >
109
- {isRedo ? '重开此任务' : '提交为任务'}
202
+ {isFeedback ? '新开任务' : '回写本任务'}
110
203
  </button>
111
204
  </div>
112
- <div className="mdw-sel-comment-hint">Ctrl/⌘+Enter 提交</div>
205
+ <div className="mdw-sel-comment-hint">Ctrl/⌘+Enter 提交 · 粘贴/拖入图片 · 附件</div>
113
206
  </div>
114
207
  ) : (
115
208
  <>
@@ -134,7 +227,7 @@ export default function SelMenu({
134
227
  <button
135
228
  type="button"
136
229
  className="mdw-sel-fmt-btn comment"
137
- title="划线评论 → 新任务"
230
+ title="划线评论 → 回写本任务"
138
231
  onClick={startCompose}
139
232
  >
140
233
  评论
@@ -0,0 +1,75 @@
1
+ /** 任务链可视化(#77):弹窗内展示;history 或 fork 祖先/子任务,点节点旁路查看。 */
2
+ import { Modal } from '../popup/index.jsx';
3
+
4
+ const KIND_LAB = {
5
+ origin: '起点',
6
+ reopen: '反馈',
7
+ comment: '评论',
8
+ current: '当前',
9
+ };
10
+
11
+ function ChainList({ nodes = [], onOpenNode }) {
12
+ if (!nodes.length) {
13
+ return <div className="mdw-chain-empty muted">这条任务还没有链(反馈 / 评论派生后会出现)</div>;
14
+ }
15
+ return (
16
+ <ol className="mdw-chain-list" aria-label="任务链节点">
17
+ {nodes.map((n, i) => {
18
+ const key = n.current
19
+ ? 'current'
20
+ : n.historyId != null
21
+ ? `h-${n.historyId}`
22
+ : `t-${n.dirKey || ''}-${n.taskId ?? i}`;
23
+ const lab = KIND_LAB[n.kind] || n.kind || '?';
24
+ const title = n.excerpt || n.feedback || lab;
25
+ const meta = [
26
+ n.taskId != null ? `#${n.taskId}` : null,
27
+ n.at || null,
28
+ n.attachmentCount ? `📎${n.attachmentCount}` : null,
29
+ ]
30
+ .filter(Boolean)
31
+ .join(' · ');
32
+ return (
33
+ <li key={key} className={`mdw-chain-li${n.current ? ' is-current' : ''}`}>
34
+ <div className="mdw-chain-rail" aria-hidden>
35
+ <span className="mdw-chain-dot" />
36
+ {i < nodes.length - 1 ? <span className="mdw-chain-line" /> : null}
37
+ </div>
38
+ <button
39
+ type="button"
40
+ className={`mdw-chain-card${n.kind === 'comment' ? ' is-comment' : ''}`}
41
+ title={n.current ? '当前任务(本页)' : `查看:${title}`}
42
+ disabled={!!n.current}
43
+ onClick={() => {
44
+ if (!n.current) onOpenNode?.(n);
45
+ }}
46
+ >
47
+ <span className="mdw-chain-kind">{lab}</span>
48
+ <span className="mdw-chain-ex">{title || '—'}</span>
49
+ {meta ? <span className="mdw-chain-meta">{meta}</span> : null}
50
+ </button>
51
+ </li>
52
+ );
53
+ })}
54
+ </ol>
55
+ );
56
+ }
57
+
58
+ /** 「更多 → 任务链」弹窗 */
59
+ export function TaskChainModal({ open, nodes, onOpenNode, onClose }) {
60
+ if (!open) return null;
61
+ return (
62
+ <Modal title="任务链" onClose={onClose} size="md" className="mdw-chain-modal">
63
+ <p className="mdw-chain-hint">从早到晚排列。点非当前节点可在旁路打开内容。</p>
64
+ <ChainList
65
+ nodes={nodes}
66
+ onOpenNode={(n) => {
67
+ onOpenNode?.(n);
68
+ onClose?.();
69
+ }}
70
+ />
71
+ </Modal>
72
+ );
73
+ }
74
+
75
+ export default ChainList;
@@ -98,6 +98,7 @@ export default function ToolBar({
98
98
  onOverview,
99
99
  onFormat,
100
100
  onTurn,
101
+ onChain,
101
102
  }) {
102
103
  const canFormat = mode === 'edit' || mode === 'split';
103
104
  const liveOrEdit = mode !== 'preview';
@@ -110,10 +111,15 @@ export default function ToolBar({
110
111
  }, [mode]);
111
112
 
112
113
  const secondary = [
114
+ // #77:任务链进「更多」弹窗入口(置顶,别埋在删除旁边)
115
+ onChain && { id: 'chain', label: '任务链', run: onChain },
113
116
  // 预览:**看 agent 到底会收到什么**(任务 #65)。不是「预览渲染效果」,
114
117
  // 而是把交付链路(组上下文 / 收尾指令 / check 指令 / 附件 / ack / 持续 get)
115
118
  // 拼出来的原文摆出来——模板可配之后,这是唯一可信的观测口。
116
119
  onPreview && { id: 'preview', label: '预览提示词', run: onPreview },
120
+ // #76:附件入口放进「更多」,预览态也能找到(左栏图标只在编辑态)
121
+ onImg && { id: 'img', label: '插入图片', run: onImg },
122
+ onAtt && { id: 'att', label: '添加附件', run: onAtt },
117
123
  mode !== 'split' && { id: 'import', label: '导入', run: onImport },
118
124
  { id: 'new', label: '新任务', run: onNew },
119
125
  // 克隆(#70):内容快速复制成新任务,不建派生链(与评论/反馈的链式派生区分)
@@ -4,8 +4,8 @@
4
4
  // 说「这个功能可以快速定位,而对于一些反复 ack 反馈的页面,这些任务页面很长,
5
5
  // 操作不便捷,想要复用这个组件,将每一次 ack 作为一个节点去快速定位」。
6
6
  //
7
- // 事实基础:每次「重做(带反馈)」都会把上一轮的 ack 与本轮反馈**追加**进任务正文
8
- // (见 modules/board/reopen-text.js 的 buildReopenText),所以正文里会出现**多个**
7
+ // 事实基础:每次「反馈」新开任务都会把上一轮的 ack 与本轮反馈**追加**进新正文
8
+ // (见 modules/board/reopen-text.js 的 buildReopenText),所以链上任务正文里会出现
9
9
  // `## 上一轮完成总结` / `## 验收反馈` 段。任务 #34 就是 5 轮、正文 13903 字符。
10
10
  //
11
11
  // 为什么不能直接用 extractMdHeadings 的标题 id:它给同名标题生成 `上一轮完成总结` /
@@ -766,6 +766,50 @@
766
766
  .mdw-sel-comment-acts button.primary:disabled{opacity:.45;cursor:not-allowed;filter:none}
767
767
  .mdw-sel-comment-hint{font-size:10.5px;color:var(--faint,#A9AEB4);text-align:right}
768
768
  .mdw-sel-fmt-btn.comment{font-family:inherit;font-weight:650;letter-spacing:0}
769
+ .mdw-sel-comment-acts .grow{flex:1}
770
+ .mdw-sel-att-list{display:flex;flex-wrap:wrap;gap:4px}
771
+ .mdw-sel-att-chip{
772
+ font-size:10.5px;padding:2px 6px;border-radius:4px;
773
+ background:var(--soft,#F1F0EC);color:var(--ink-2,#4B515A);max-width:100%;
774
+ overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
775
+ }
776
+ /* 任务链弹窗(#77):「更多 → 任务链」竖排时间线 */
777
+ .mdw-chain-hint{margin:0 0 12px;font-size:12px;color:var(--faint,#A9AEB4);line-height:1.45}
778
+ .mdw-chain-empty{padding:18px 8px;text-align:center;font-size:13px}
779
+ .mdw-chain-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:0}
780
+ .mdw-chain-li{display:flex;gap:10px;align-items:stretch;min-height:0}
781
+ .mdw-chain-rail{
782
+ flex:none;width:14px;display:flex;flex-direction:column;align-items:center;
783
+ }
784
+ .mdw-chain-dot{
785
+ width:10px;height:10px;border-radius:50%;flex:none;margin-top:14px;
786
+ background:var(--mdw-accent,#2F6F5E);border:2px solid var(--paper,#fff);
787
+ box-shadow:0 0 0 1px var(--mdw-accent-line,#9CB8AE);
788
+ }
789
+ .mdw-chain-li.is-current .mdw-chain-dot{background:var(--ink,#16181C);box-shadow:0 0 0 1px var(--ink,#16181C)}
790
+ .mdw-chain-line{flex:1;width:2px;background:var(--line,#E4E2DC);margin:4px 0 0}
791
+ .mdw-chain-card{
792
+ flex:1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:3px;
793
+ margin:0 0 8px;padding:10px 12px;border-radius:8px;text-align:left;
794
+ border:1px solid var(--line,#E4E2DC);background:var(--paper,#fff);
795
+ cursor:pointer;font:inherit;color:var(--ink,#16181C);
796
+ }
797
+ .mdw-chain-card:hover:not(:disabled){
798
+ border-color:var(--mdw-accent-line,#9CB8AE);background:var(--mdw-accent-soft,#E8F2EE);
799
+ }
800
+ .mdw-chain-card:disabled{cursor:default;opacity:1;background:var(--soft,#F7F6F3)}
801
+ .mdw-chain-card.is-comment .mdw-chain-kind{color:var(--info,#1558BC)}
802
+ .mdw-chain-kind{font-size:10.5px;font-weight:700;color:var(--mdw-accent,#2F6F5E);letter-spacing:.02em}
803
+ .mdw-chain-ex{font-size:13px;line-height:1.4;color:var(--ink,#16181C);overflow-wrap:anywhere}
804
+ .mdw-chain-meta{font-size:11px;color:var(--faint,#A9AEB4)}
805
+ .mdw-hist-ro{
806
+ flex:1;min-height:0;overflow:auto;padding:16px 18px;
807
+ font-size:13px;line-height:1.55;
808
+ }
809
+ .mdw-hist-meta{
810
+ font-size:11px;color:var(--faint,#A9AEB4);margin-bottom:10px;
811
+ display:flex;gap:8px;flex-wrap:wrap;
812
+ }
769
813
  /* 验收条:已完成任务的 ack 卡——放在正文末尾的页脚条:完成总结等用户回复
770
814
  (通行 / 重做;划线评论提详细问题) */
771
815
  .mdw-review{
@@ -162,22 +162,17 @@ export default function DirPanel({ dirKey }) {
162
162
  if (!t) return;
163
163
  const title = (t.text || '').split('\n').find((l) => l.trim()) || `#${t.id}`;
164
164
  guard(async () => {
165
+ const acked = !!t.completedAt;
165
166
  const body = await dialog({
166
- title: `反馈修改 · #${t.id}`,
167
+ title: acked ? `反馈 · #${t.id}` : `反馈修改 · #${t.id}`,
167
168
  input: true,
168
- placeholder: '写下要改的地方(留空 = 只重开,不改正文)',
169
+ placeholder: acked
170
+ ? '写下反馈(将新开一条任务,原任务不动)'
171
+ : '写下要改的地方(留空 = 只重开,不改正文)',
169
172
  });
170
173
  if (body === null || body === undefined) return;
171
- // 反馈是**追加**不是替换:reopen 的 text 是整段新正文,直接把反馈当正文发过去
172
- // 会把原任务丢掉(agent 下一轮只看得见这句反馈)。拼成「原正文 + 反馈」。
173
- //
174
- // 已完成的任务走 **ack 语义**:除了用户反馈,还要把上一轮 agent 的完成总结
175
- // 追加进正文——重开后验收条消失,总结若不落进正文就没人看得见了。
176
- // 未完成的任务只是「反馈修改」,保持旧口径(不追加总结、段名不同)。
177
174
  const fb = String(body).trim();
178
- const acked = !!t.completedAt;
179
175
  const ackSummary = acked ? t.roundSummary || '' : '';
180
- // 没有新增内容 → 不带 text 字段(服务端只翻状态,正文一个字不动)。
181
176
  const text =
182
177
  fb || ackSummary
183
178
  ? buildReopenText({
@@ -188,21 +183,43 @@ export default function DirPanel({ dirKey }) {
188
183
  bold: acked,
189
184
  })
190
185
  : '';
186
+
187
+ // #75:已完成 → 反馈 = **新开任务**(forkOf 指回本条),原任务留档不动
188
+ if (acked) {
189
+ if (!text) {
190
+ toast('写一下反馈');
191
+ return;
192
+ }
193
+ const res = await api('/api/localtasks', {
194
+ method: 'POST',
195
+ body: isGlobal
196
+ ? { global: true, text, forkOf: String(t.id), forkKind: 'reopen' }
197
+ : { cwd: topic.cwd, text, forkOf: String(t.id), forkKind: 'reopen' },
198
+ });
199
+ const newId = String(res?.task?.id ?? res?.id ?? '');
200
+ const landedKey = res?.key || dirKey;
201
+ if (newId) saveDoc(docIdOf(scopeOf(landedKey), newId), { body: text });
202
+ toast(`已反馈「${title.replace(/^#\s*/, '')}」→ 新任务 #${newId || '?'}`);
203
+ refreshLocal();
204
+ return;
205
+ }
206
+
207
+ // 未完成:就地回写(#74 reopen)
191
208
  const res = await api('/api/localtasks/reopen', {
192
209
  method: 'POST',
193
210
  body: {
194
211
  ...(isGlobal ? { key: GLOBAL_KEY } : { cwd: topic.cwd }),
195
212
  id: t.id,
213
+ kind: 'reopen',
214
+ feedback: fb,
196
215
  ...(text ? { text } : {}),
197
216
  },
198
217
  });
199
- // 重开 = **新建一条任务**(新 md),旧任务归档留档(#59:状态单向)。
200
- // 旧文档**不动**(那是历史);新正文写进新任务自己的文档。
201
218
  const landedKey = res?.key || dirKey;
202
- const newId = String(res?.task?.id ?? t.id);
203
- if (text) saveDoc(docIdOf(scopeOf(landedKey), newId), { body: text });
219
+ const sameId = String(res?.task?.id ?? t.id);
220
+ if (text) saveDoc(docIdOf(scopeOf(landedKey), sameId), { body: text });
204
221
  toast(
205
- `已重开「${title.replace(/^#\s*/, '')}」→ 新任务 #${newId}(旧任务归档留档)` +
222
+ `已回写「${title.replace(/^#\s*/, '')}」#${sameId}` +
206
223
  (res?.moved && res.name ? `;归属迁到「${res.name}」` : ''),
207
224
  );
208
225
  refreshLocal();
@@ -249,8 +249,8 @@ export default function Landing({
249
249
  {onReopenTask && t.status !== 'archived' && (t.status === 'consumed' || t.completedAt) && (
250
250
  <span
251
251
  className="op" role="button" tabIndex={-1}
252
- title={t.completedAt ? '重做(验收反馈):新建一条任务继续做,旧任务归档留档' : '反馈修改:新建一条任务继续做,旧任务归档留档'}
253
- aria-label={`重开 ${titleFromMd(t.text)}`}
252
+ title={t.completedAt ? '反馈:新开一条任务(原任务不动)' : '反馈修改:回写本任务并记入任务链'}
253
+ aria-label={`反馈 ${titleFromMd(t.text)}`}
254
254
  onClick={(e) => {
255
255
  e.stopPropagation();
256
256
  onReopenTask(t);