dsh-gallery 0.17.0 → 1.0.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.
package/client.js CHANGED
@@ -1,3 +1,4 @@
1
+ // __DSH_BUILD_FINGERPRINT__ {"v":1,"fragments":{"src/client/00-head.js":"c62f6d728d1cfdb5d64db41764171d5d6314d6cc","src/client/01-i18n.js":"5edcfb18abac018ead28772972035b66fcb73562","src/client/02-util.js":"af7867f3cd7313b4d54ff17b727516eca315313e","src/client/03-theme.js":"fe8a1ed10f3ee8ab59bdbdb3038f5bb95e01f0be","src/client/04-paths.js":"d2f85774e5d0888ce512c0fe35755978b6986b52","src/client/05-feedback.js":"a9a21378ff499e482ce52c3d45041eda86d2e39d","src/client/06-ctxmenu.js":"82c4d1ccff0312453a68ae63630e4514eb11b70f","src/client/07-media.js":"e2690a07c9735856e03aaaa901e8007da005da7a","src/client/08-cards.js":"bbff076268c827f846229d97064c972ae34f7740","src/client/09-viewer.js":"4a909e1ea1fa2380062c69013ede1ba794c4535d","src/client/10-annotate.js":"0dd07c4a4929b512739df62e91ed6eb201201fb9","src/client/11-settings.js":"c02bc78edf896050dee3bc4b26d311433cc33ade","src/client/12-body.js":"656b068d26229df902eaa5a436ddd8aa0921af49","src/client/13-chrome.js":"de082de1a9d1ffbaeb600fbf659dba059cca7973","src/client/14-entry.js":"5ce848d53bef377c53b97b6411614bd571ff775b"},"shared":{"src/shared/feedback-text.js":"1e7454d368685c938b970db7b1fe297fd4e60f68"},"styles":"c5e27291a1416843ce3ae8379e40dbc80bd561bf","builtAt":"2026-11-14T14:35:40.643Z","artifactSha1":"e1f883e2f40c5f925b047d31cc21d335da835a84"}
1
2
  window.__ModuleLoader__.load({
2
3
  id: 'dsh-gallery',
3
4
  factory(require) {
@@ -57,6 +58,9 @@ const ANNOTATION_SHAPES = ["rect", "arrow", "text"]
57
58
  *
58
59
  * 约束:x/y/w/h 必须落在 [0,1];越界由写入端 clamp。
59
60
  */
61
+ /** 全局分组视图:每组一次画多少张卡,点「再显示」按这个步长追加。 */
62
+ const GROUP_PAGE = 60
63
+
60
64
  const ANNOTATION_LIMITS = { min: 0, max: 1, maxNoteLength: 500, maxPerAsset: 50 }
61
65
 
62
66
  /** 把任意数值 clamp 到 [0,1](批注坐标写入前必须过一遍)。 */
@@ -102,7 +106,11 @@ function trimPlaybackDecision(now, inPoint, outPoint, opts) {
102
106
  /** 校验并规整一条批注;不合法返回 null。 */
103
107
  function normalizeAnnotation(a) {
104
108
  if (a === null || typeof a !== "object") return null
105
- const shape = ANNOTATION_SHAPES.includes(a.shape) ? a.shape : "rect"
109
+ // v0.17.x:'polygon' 是前端「不规则区域标记」专用形状,不进 Host 的动作契约,
110
+ // 因此只在这里特判放行,host/protocol.js 的 ANNOTATION_SHAPES 无需跟着改。
111
+ const shape = a.shape === "polygon"
112
+ ? "polygon"
113
+ : (ANNOTATION_SHAPES.includes(a.shape) ? a.shape : "rect")
106
114
  const note = typeof a.note === "string" ? a.note.slice(0, ANNOTATION_LIMITS.maxNoteLength) : ""
107
115
  const x = clamp01(a.x)
108
116
  const y = clamp01(a.y)
@@ -112,9 +120,19 @@ function normalizeAnnotation(a) {
112
120
  if (w > 0 && x + w > 1) w = 1 - x
113
121
  if (h > 0 && y + h > 1) h = 1 - y
114
122
  const frameMs = Number.isFinite(a.frameMs) ? Math.max(0, Math.floor(a.frameMs)) : null
123
+ // 顶点数写死 4–20,与 POLYGON_LIMITS 一致;这里不引用后面的常量,
124
+ // 免得离线把本函数单独抽出来跑时踩到暂时性死区。
125
+ const polygon = shape === "polygon" && Array.isArray(a.polygon)
126
+ && a.polygon.length >= 4 && a.polygon.length <= 20
127
+ && a.polygon.every((p) => Array.isArray(p) && p.length === 2
128
+ && Number.isFinite(p[0]) && Number.isFinite(p[1]))
129
+ ? a.polygon.map((p) => [clamp01(p[0]), clamp01(p[1])])
130
+ : null
131
+ const fillColor = typeof a.fillColor === "string" && a.fillColor !== "" ? a.fillColor : "green"
115
132
  return {
116
133
  id: typeof a.id === "string" && a.id !== "" ? a.id : ("a" + Math.random().toString(36).slice(2, 10)),
117
134
  shape, x, y, w, h, note, frameMs,
135
+ ...(polygon !== null ? { polygon, fillColor } : {}),
118
136
  }
119
137
  }
120
138
 
@@ -195,12 +213,16 @@ function maskAlphaAt(px, py, rect) {
195
213
  }
196
214
 
197
215
  /* ------------------------------------------------------------------ *
198
- * v0.14.6 右键多点选区(老板 2026-11-12 拍板):
199
- * 标记态下左键仍是矩形批注,右键逐点点击 4–20 个顶点,闭合成实心多边形。
200
- * 实测口径(见验证报告第九节):必须是「实心、贴合目标外接框」的块,
201
- * 描笔画的镂空线框 / 椭圆 / 大矩形都会出白底;多边形天然实心且面积可量。
216
+ * 多边形选区(v0.14.6 起;老板 2026-11-15 再定版):
217
+ * · 左键按住拖动 = 矩形批注(老行为,保留)
218
+ * · 左键**单击**逐点 = 不规则区域标记,闭合后直接进反馈篮(不生成遮罩文件)
219
+ * · 右键逐点 = 实心多边形填充选区,闭合后导出遮罩 + 彩色预览(老行为,保留)
220
+ * 两套多边形共用一组顶点,模式互斥;4–20 点,点回起点 / Enter / 面板按钮闭合。
221
+ * 实测口径(见验证报告第九节):遮罩必须实心贴合目标外接框,线框 / 椭圆会出白底。
202
222
  * ------------------------------------------------------------------ */
203
223
  const POLYGON_LIMITS = { min: 4, max: 20, closeRadius: 0.02, minArea: 0.0001 }
224
+ /** 左键按下后移动超过这个归一化距离才算「拖框」,否则算一次点击(区域顶点)。 */
225
+ const ANNOT_DRAG_THRESHOLD = 0.008
204
226
 
205
227
  /* ------------------------------------------------------------------ *
206
228
  * 选区纯色半透明填充(v0.14.7 引入;老板 2026-11-12 20:22 再定版):
@@ -558,6 +580,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
558
580
  scopeNotFound: '找不到本对话的会话记录',
559
581
  scopeLogEmpty: '本对话的会话记录为空',
560
582
  subCount: '{shown} / {total} 条',
583
+ subCountGroups: '共 {total} 条 · {groups} 个对话',
561
584
  // ===== 资产分类(三色边框)=====
562
585
  catFinal: '成稿',
563
586
  catInput: '素材',
@@ -597,7 +620,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
597
620
  annotNotePrompt: '这块要改什么?(可留空)',
598
621
  annotNotePlaceholder: '例如:沙发位置偏了 / 色调太暖',
599
622
  annotNoNote: '(无说明)',
600
- annotHint: '左键拖拽或点两下画矩形批注;右键逐点圈出 4–20 点的多边形,闭合后直接生成局部重绘遮罩',
623
+ annotHint: '左键按住拖动=矩形框选(可写说明);左键单击逐点圈不规则区域,闭合后=标记进反馈篮;右键逐点圈选=生成实心填充遮罩',
601
624
  annotCount: '批注 {n} 处',
602
625
  annotPendingTag: '待保存',
603
626
  annotPendingHint: '黄色亮框就是刚圈的位置;写完点「保存并生效」,也可以直接在图上继续圈下一处(这处会先自动存档)',
@@ -667,6 +690,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
667
690
  groupIntermediate: '过程稿 {n}',
668
691
  groupUnknown: '未归类 {n}',
669
692
  groupTruncated: '仅显示最近 {shown} 个,共 {total} 个',
693
+ groupShowMore: '再显示 {step} 张 · 已显示 {shown} / 共 {total}',
670
694
  groupHistoryTitle: '历史资产',
671
695
  groupCurrentBadge: '当前对话',
672
696
  // 资产 → 会话(01)与归档/删除标注(02)
@@ -798,8 +822,15 @@ async function encodeMaskPngBytes(imageData, width, height) {
798
822
  polyClear: '清空',
799
823
  polyTooFew: '至少 4 个点才能闭合',
800
824
  polyDegenerate: '选区面积太小(点几乎连成一条线),请重新围一圈',
825
+ // v0.17.x 左键单击逐点 → 不规则区域标记,闭合只进反馈篮、不生成文件
826
+ polyNoteTitle: '不规则区域标记',
827
+ polyNoteHint: '左键逐点点出要标的位置;点回起点、按 Enter 或点「闭合并加入反馈篮」即收工。说明可填可不填,顶点可左键拖动微调,Backspace 撤销一点,Escape 清空。',
828
+ polyNotePlaceholder: '这块要说什么?(可留空)',
829
+ polyNoteClose: '闭合并加入反馈篮',
830
+ polyNoteSaved: '已把这块区域加进反馈篮(没有生成遮罩文件)',
801
831
  feedbackMaskFrom: '已有遮罩:{name}',
802
832
  feedbackAnnotHint: '{n} 条框选批注会随反馈一起发出,序号与草稿里的 Annotation N 一一对应',
833
+ feedbackAnnotPolygonTag: '不规则区域 · {n} 点',
803
834
  feedbackEditTitle: '编辑:{name}',
804
835
  feedbackReasonLabel: '理由(可选)',
805
836
  feedbackChangeOnlyLabel: '只改(逗号分隔,可选)',
@@ -810,6 +841,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
810
841
  feedbackGenerating: '正在生成…',
811
842
  feedbackGenerateHint: '生成草稿并写入输入框,由你确认后手动发送',
812
843
  feedbackDraftReady: '草稿已写入输入框(未发送)。确认无误请自行发送。',
844
+ feedbackDraftAlreadyThere: '这张图已经在输入框里了,没有重复添加。',
813
845
  dblClickHint: '双击 = 把带路径信息写进输入框(不自动发送)',
814
846
  feedbackDraftInClipboard: '草稿已复制到剪贴板(输入框通道不可用),请手动粘贴。',
815
847
  feedbackDraftFailed: '生成草稿失败',
@@ -943,6 +975,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
943
975
  scopeNotFound: 'Cannot find this chat’s session log',
944
976
  scopeLogEmpty: 'This chat’s session log is empty',
945
977
  subCount: '{shown} of {total}',
978
+ subCountGroups: '{total} items · {groups} chats',
946
979
  // Asset categories (colored borders)
947
980
  catFinal: 'Draft',
948
981
  catInput: 'Source',
@@ -982,7 +1015,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
982
1015
  annotNotePrompt: 'What should change here? (optional)',
983
1016
  annotNotePlaceholder: 'e.g. sofa position is off / color is too warm',
984
1017
  annotNoNote: '(no note)',
985
- annotHint: 'Left-drag or click twice for a boxed note; right-click 4–20 vertices for a polygon selection that becomes an inpaint mask',
1018
+ annotHint: 'Left-drag = boxed note (optional text); left-click vertices = irregular area mark, close it to add to the feedback basket; right-click vertices = solid filled mask',
986
1019
  annotCount: '{n} annotation(s)',
987
1020
  annotPendingTag: 'Pending',
988
1021
  annotPendingHint: 'The yellow box is the area you just marked. Add a note and click Save, or keep boxing more areas (this one is stored first).',
@@ -1052,6 +1085,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
1052
1085
  groupIntermediate: 'WIP {n}',
1053
1086
  groupUnknown: 'Unclassified {n}',
1054
1087
  groupTruncated: 'Showing latest {shown} of {total}',
1088
+ groupShowMore: 'Show {step} more · {shown} of {total}',
1055
1089
  groupHistoryTitle: 'Older assets',
1056
1090
  groupCurrentBadge: 'This chat',
1057
1091
  // Assets to chat (01) and archived / deleted badges (02)
@@ -1180,8 +1214,15 @@ async function encodeMaskPngBytes(imageData, width, height) {
1180
1214
  polyClear: 'Clear',
1181
1215
  polyTooFew: 'At least 4 points are needed',
1182
1216
  polyDegenerate: 'Selection area is too small — the points are nearly a line',
1217
+ // v0.17.x left-click vertices -> irregular area mark, goes to the feedback basket only
1218
+ polyNoteTitle: 'Irregular area mark',
1219
+ polyNoteHint: 'Left-click to add vertices; click the first point, press Enter, or use Close & add to basket. A note is optional; drag vertices to adjust, Backspace undoes one point, Escape clears.',
1220
+ polyNotePlaceholder: 'What should be said about this area? (optional)',
1221
+ polyNoteClose: 'Close & add to basket',
1222
+ polyNoteSaved: 'Area added to the feedback basket (no mask file created)',
1183
1223
  feedbackMaskFrom: 'Mask ready: {name}',
1184
1224
  feedbackAnnotHint: '{n} boxed note(s) will be sent with this feedback, numbered to match `Annotation N` in the draft',
1225
+ feedbackAnnotPolygonTag: 'Irregular area · {n} points',
1185
1226
  feedbackEditTitle: 'Edit: {name}',
1186
1227
  feedbackReasonLabel: 'Reason (optional)',
1187
1228
  feedbackChangeOnlyLabel: 'Only change (comma separated, optional)',
@@ -1192,6 +1233,7 @@ async function encodeMaskPngBytes(imageData, width, height) {
1192
1233
  feedbackGenerating: 'Generating…',
1193
1234
  feedbackGenerateHint: 'Writes the draft into the composer; you confirm and send it yourself',
1194
1235
  feedbackDraftReady: 'Draft written into the composer (not sent). Review it and send when ready.',
1236
+ feedbackDraftAlreadyThere: 'This image is already in the composer; nothing was added twice.',
1195
1237
  dblClickHint: 'Double-click = write the asset path into the chat input (never auto-sends)',
1196
1238
  feedbackDraftInClipboard: 'Draft copied to clipboard (composer channel unavailable) — paste it manually.',
1197
1239
  feedbackDraftFailed: 'Could not generate the draft',
@@ -3159,6 +3201,15 @@ async function encodeMaskPngBytes(imageData, width, height) {
3159
3201
  border-color: #1d9e75 !important; font-weight: 600;
3160
3202
  }
3161
3203
  .dg-polyPanelOps .dg-polyClose:disabled { opacity: 0.45; }
3204
+ .dg-polyPanel[data-gallery-poly-mode='note'] { border-color: rgba(255, 209, 102, 0.65); }
3205
+ .dg-polyPanel[data-gallery-poly-mode='note'] .dg-polyPanelHead { color: #ffe08a; }
3206
+ .dg-polyPanelNote { margin-top: 8px; }
3207
+ .dg-polyNoteInput {
3208
+ width: 100%; box-sizing: border-box; background: #10141b; color: #e8eaed;
3209
+ border: 1px solid rgba(255,255,255,0.22); border-radius: 4px;
3210
+ padding: 5px 7px; font-size: 11px; outline: none;
3211
+ }
3212
+ .dg-polyNoteInput:focus { border-color: #5ed696; }
3162
3213
 
3163
3214
  /* v0.16.0 粘贴结果提示 */
3164
3215
  .dg-pasteNotice {
@@ -3600,6 +3651,14 @@ const dragAssetIndex = new Map()
3600
3651
  const dragMaskByOverlay = new Map()
3601
3652
  const dragMaskBySource = new Map()
3602
3653
 
3654
+ /**
3655
+ * 双击卡片:同一张图「正在处理中」的登记本(模块级,界面重绘也不丢)。
3656
+ * 只用来挡连点 —— 上一次双击的文字/附图还没走完又来一次,两次会同时读到
3657
+ * 「输入框里还没有草稿」,于是文字和缩略图各写两份。处理完立刻摘掉;
3658
+ * 万一某次异常没走到收尾,超过 5 秒自动失效,绝不把这张图永久挡死。
3659
+ */
3660
+ const doubleClickInFlight = new Map()
3661
+
3603
3662
  /**
3604
3663
  * 生成拖出 File 的名字(纯函数,测试跑真身)。
3605
3664
  * 全角「|」分隔,控制字符清掉,长度夹在 240 以内,避免 DSH 卡片显示被截到看不懂。
@@ -3928,9 +3987,16 @@ function serializeFeedback(feedback) {
3928
3987
  await waitFlush()
3929
3988
  const before = stateText(ed)
3930
3989
 
3931
- // 用草稿头(前 24 字)判断,而不是全串匹配 ——
3932
- // 全串匹配在「草稿后面跟了用户自己打的字」时会失效(state 里包含但不再是完整 text)。
3933
- const headProbe = text.trim().slice(0, Math.min(24, text.trim().length))
3990
+ // 双击卡片生成的草稿是「产出台·文件名 | 路径=…」,用整段首段(最长 120 字)判断;
3991
+ // 固定前 24 字会把同一组图(原图 / 主遮罩 / 蓝填充预览)误判成同一份草稿:
3992
+ // 它们的文件名共享很长的前缀,前 24 字完全相同,双击第二张会连文字都不写。
3993
+ // 其它草稿(反馈篮那一大段)不带这个开头,仍用原来的 24 字探针,行为一点不变。
3994
+ // 也不用全串匹配:草稿后面跟了用户自己打的字时会失效。
3995
+ const trimmed = text.trim()
3996
+ const firstSegment = trimmed.split(/[||]/)[0].trim()
3997
+ const headProbe = (firstSegment.startsWith('产出台·') && firstSegment.length >= 8)
3998
+ ? firstSegment.slice(0, 120)
3999
+ : trimmed.slice(0, Math.min(24, trimmed.length))
3934
4000
  if (before.ok && headProbe !== '' && before.text.includes(headProbe)) {
3935
4001
  draftRef.current = text
3936
4002
  return { ok: true, via: 'composer', detail: 'already-present' }
@@ -3951,8 +4017,8 @@ function serializeFeedback(feedback) {
3951
4017
  return { ok: grew && contains, size: after.size }
3952
4018
  }
3953
4019
 
3954
- // 用于确认"确实插入了本次文本"的探针片段(取前 24 字,足够区分)
3955
- const probe = text.trim().slice(0, Math.min(24, text.trim().length))
4020
+ // 用于确认「确实插入了本次文本」的探针片段(复用上面的首段,能区分同组图片)
4021
+ const probe = headProbe
3956
4022
 
3957
4023
  // ---- 路径 1:**只发 beforeinput**(不跟 input)----
3958
4024
  // ⚠️ 真机实证:beforeinput 与 input 在同一同步块连发时,Lexical 在 flush 前
@@ -4080,7 +4146,11 @@ function serializeFeedback(feedback) {
4080
4146
  // 卡已被判「不要这张」时,批注也沿用打回;否则是「只改这个框」
4081
4147
  action: mark?.action === 'reject' ? 'reject' : 'redo-one-dim',
4082
4148
  reason: note === '' ? undefined : note,
4083
- region: { x: a.x, y: a.y, w: a.w, h: a.h },
4149
+ region: {
4150
+ x: a.x, y: a.y, w: a.w, h: a.h,
4151
+ // 不规则区域顶点随 region 一起走;草稿仍按外接框说人话
4152
+ ...(Array.isArray(a.polygon) ? { polygon: a.polygon } : {}),
4153
+ },
4084
4154
  frameOf: it.frameOf,
4085
4155
  // 遮罩来源随草稿带出(v0.14.5):由本图框选区域生成的 RGBA 遮罩资产
4086
4156
  maskOf: it.maskOf,
@@ -4219,7 +4289,7 @@ function serializeFeedback(feedback) {
4219
4289
  }, [
4220
4290
  h('div', { className: 'dg-feedbackHead', key: 'head' }, [
4221
4291
  h('span', { className: 'dg-feedbackTitle', key: 'title' },
4222
- format(t('feedbackBasketTitleN'), { n: rows.length }),
4292
+ t('feedbackBasketTitle'),
4223
4293
  ),
4224
4294
  h('button', {
4225
4295
  type: 'button', className: 'dg-btn', key: 'close',
@@ -4283,6 +4353,12 @@ function serializeFeedback(feedback) {
4283
4353
  : null,
4284
4354
  h('span', { className: 'dg-feedbackDim dg-feedbackRegion', key: 'r' },
4285
4355
  format(t('feedbackAnnotRegion'), { x: pct(a.x), y: pct(a.y), w: pct(a.w), h: pct(a.h) })),
4356
+ Array.isArray(a.polygon) && a.polygon.length >= 4
4357
+ ? h('span', {
4358
+ className: 'dg-feedbackDim', key: 'poly',
4359
+ 'data-gallery-feedback-poly': a.polygon.length,
4360
+ }, format(t('feedbackAnnotPolygonTag'), { n: String(a.polygon.length) }))
4361
+ : null,
4286
4362
  h('span', { className: 'dg-feedbackNote', key: 'note' },
4287
4363
  (typeof a.note === 'string' && a.note.trim() !== '') ? a.note : t('feedbackAnnotNoNote')),
4288
4364
  h('span', { className: 'dg-feedbackOps', key: 'ops' }, [
@@ -5388,7 +5464,7 @@ function serializeFeedback(feedback) {
5388
5464
  },
5389
5465
  })
5390
5466
  )),
5391
- trimUI,
5467
+ trimUI,
5392
5468
  h('div', { className: 'dg-mediaFoot', key: 'foot' }, [
5393
5469
  h('span', { className: 'dg-mediaFootName', key: 'name', title: item.relPath }, item.name),
5394
5470
  h('span', { className: 'dg-mediaFootMeta', key: 'meta' },
@@ -6659,7 +6735,9 @@ ${absPath}
6659
6735
  * 设计要点:
6660
6736
  * · 坐标全部归一化(0–1,相对图片宽高),见 shared/protocol.js 的 ANNOTATION_* 契约
6661
6737
  * · SVG 覆盖在图片之上;不干扰查看器原有的缩放/平移(只有「批注模式」下才接管指针)
6662
- * · 拖拽画矩形 → 亮框**一直留着**直到保存/取消 → 输入框写说明 → 存进批注列表
6738
+ * · 左键按住拖拽画矩形 → 亮框**一直留着**直到保存/取消 → 输入框写说明 → 存进批注列表
6739
+ * · 左键单击逐点圈不规则区域 → 闭合后直接进反馈篮(不生成遮罩文件),可顺手写一句说明
6740
+ * · 右键单击逐点圈选区 → 闭合成实心多边形 → 导出遮罩 + 彩色填充预览
6663
6741
  * · 已存在的批注按归一化坐标还原绘制,带编号,缩放/换屏都不失真
6664
6742
  * · 批注不发送任何东西;出口是与决策草稿同一通道(见 05-feedback.js)
6665
6743
  *
@@ -6671,7 +6749,8 @@ ${absPath}
6671
6749
  *
6672
6750
  * v0.14.2 修:
6673
6751
  * ⑤ 弹窗开着时第二处按不下:改为一按下就先把当前草稿存档,可连续圈多处
6674
- * ⑥ 只认「按住拖拽」:补「点两下」定义矩形(点起点 → 点终点),两种习惯都能用
6752
+ * ⑥ 「点两下成矩形」已于 2026-11-15 作废:左键单击改为「逐点闭合区域标记」。
6753
+ * 现在左键只有按住拖动才画矩形;单击是给不规则区域加一个顶点。
6675
6754
  *
6676
6755
  * v0.14.4 本地热修:
6677
6756
  * ⑦ SVG 原先覆盖整个预览容器且不带 transform,图片却是 contain 居中后单独
@@ -6684,14 +6763,17 @@ ${absPath}
6684
6763
  function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, frameMs, zoom, pan, imgBox, transformTransition, onExportMask }) {
6685
6764
  const [draft, setDraft] = React.useState(null)
6686
6765
  const [editing, setEditing] = React.useState(null)
6687
- /** 已点下第一下、等第二下定终点时的起点(归一化坐标)。 */
6688
- const [pendingStart, setPendingStart] = React.useState(null)
6689
6766
  const svgRef = React.useRef(null)
6767
+ /** 左键按下时记起点与「有没有真拖动」:拖动=矩形,没拖动=一个区域顶点。 */
6768
+ const dragStartRef = React.useRef(null)
6690
6769
  /** 遮罩导出提示(成功/失败),2.5 秒自动消失。 */
6691
6770
  const [maskNotice, setMaskNotice] = React.useState(null)
6692
6771
  const [maskBusy, setMaskBusy] = React.useState(false)
6693
- /** 右键多边形选区:归一化顶点 / 橡皮筋终点 / 正在拖动的顶点下标。 */
6772
+ /** 多边形选区:mask(右键→填充遮罩) / note(左键单击→区域标记进反馈篮),互斥共用一组顶点。 */
6694
6773
  const [poly, setPoly] = React.useState([])
6774
+ const [polyMode, setPolyMode] = React.useState('mask')
6775
+ /** 不规则区域可以顺手写一句说明(可留空),只随反馈走,不生成任何文件。 */
6776
+ const [polyNote, setPolyNote] = React.useState('')
6695
6777
  const [polyHover, setPolyHover] = React.useState(null)
6696
6778
  const [polyDrag, setPolyDrag] = React.useState(null)
6697
6779
  /** v0.14.7 选区填充色(红 / 绿 / 蓝),同时决定导出的彩色预览图颜色。 */
@@ -6721,12 +6803,22 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6721
6803
  .finally(() => setMaskBusy(false))
6722
6804
  }
6723
6805
 
6806
+ /** 清掉没闭合的多边形草稿,模式复位到右键(填充遮罩)。 */
6807
+ const resetPoly = () => {
6808
+ setPoly([])
6809
+ setPolyHover(null)
6810
+ setPolyDrag(null)
6811
+ setPolyNote('')
6812
+ setPolyMode('mask')
6813
+ }
6814
+
6724
6815
  /**
6725
- * 闭合多边形 → 立刻生成遮罩资产。老板要的是「右键点完就形成区域遮罩」,
6726
- * 所以闭合即导出,不再多一层确认;顶点/面积在闭合前一直可见可撤销。
6727
- * 零自动发送红线不变:这里只落盘遮罩资产,草稿仍要人工发送。
6816
+ * 闭合多边形 → 分两条路,绝不混:
6817
+ * · mask(右键):立刻生成遮罩资产 + 彩色填充预览(老行为,零自动发送)
6818
+ * · note(左键单击):只加一条「不规则区域」批注,直接进反馈篮,不落盘任何图片
6819
+ * 老板 2026-11-15 拍板:左键圈出来的区域是「给人 / 给助手看的标记」,不是遮罩文件。
6728
6820
  */
6729
- const commitPolygon = (points) => {
6821
+ const commitPolygon = (points, mode = polyMode) => {
6730
6822
  if (points.length < POLYGON_LIMITS.min) {
6731
6823
  setMaskNotice({ kind: 'failed', text: t('polyTooFew') })
6732
6824
  return
@@ -6736,13 +6828,21 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6736
6828
  return
6737
6829
  }
6738
6830
  const box = polygonBBox(points)
6739
- setPoly([])
6740
- setPolyHover(null)
6741
- setPolyDrag(null)
6831
+ const verts = points.map((p) => [clamp01(p.x), clamp01(p.y)])
6832
+ resetPoly()
6833
+ if (mode === 'note') {
6834
+ const normalized = normalizeAnnotation({
6835
+ shape: 'polygon', ...box, polygon: verts,
6836
+ fillColor, note: polyNote, frameMs: frameMs ?? null,
6837
+ })
6838
+ if (normalized !== null && typeof onAdd === 'function') onAdd(normalized)
6839
+ setMaskNotice({ kind: 'ok', text: t('polyNoteSaved') })
6840
+ return
6841
+ }
6742
6842
  runExportMask({
6743
6843
  shape: 'polygon',
6744
6844
  ...box,
6745
- polygon: points.map((p) => [clamp01(p.x), clamp01(p.y)]),
6845
+ polygon: verts,
6746
6846
  fillColor,
6747
6847
  note: '',
6748
6848
  })
@@ -6757,30 +6857,27 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6757
6857
  || (typeof el.closest === 'function' && el.closest('[data-gallery-annot-editor]') !== null))) return
6758
6858
  if (e.key === 'Enter' && poly.length >= POLYGON_LIMITS.min) {
6759
6859
  e.preventDefault()
6760
- commitPolygon(poly)
6860
+ commitPolygon(poly, polyMode)
6761
6861
  } else if (e.key === 'Backspace') {
6762
6862
  e.preventDefault()
6763
6863
  setPoly((cur) => cur.slice(0, -1))
6764
6864
  setPolyHover(null)
6765
6865
  } else if (e.key === 'Escape') {
6766
6866
  e.preventDefault()
6767
- setPoly([])
6768
- setPolyHover(null)
6867
+ resetPoly()
6769
6868
  }
6770
6869
  }
6771
6870
  window.addEventListener('keydown', onKey)
6772
6871
  return () => window.removeEventListener('keydown', onKey)
6773
- }, [active, poly, editing])
6872
+ }, [active, poly, editing, polyMode])
6774
6873
 
6775
6874
  /** 退出标注模式时清掉未保存的草稿,避免输入框/虚线框/顶点残留。 */
6776
6875
  React.useEffect(() => {
6777
6876
  if (active) return undefined
6778
6877
  setDraft(null)
6779
6878
  setEditing(null)
6780
- setPendingStart(null)
6781
- setPoly([])
6782
- setPolyHover(null)
6783
- setPolyDrag(null)
6879
+ dragStartRef.current = null
6880
+ resetPoly()
6784
6881
  return undefined
6785
6882
  }, [active])
6786
6883
 
@@ -6809,7 +6906,6 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6809
6906
  const clearPending = () => {
6810
6907
  setDraft(null)
6811
6908
  setEditing(null)
6812
- setPendingStart(null)
6813
6909
  }
6814
6910
 
6815
6911
  /**
@@ -6828,70 +6924,76 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6828
6924
  // 不能直接塞 {x,y,w,h},否则 Math.min(undefined) → NaN%,框画不出来。
6829
6925
  setDraft({ x0: box.x, y0: box.y, x1: box.x + box.w, y1: box.y + box.h })
6830
6926
  setEditing({ shape: 'rect', ...box, note: '', frameMs: frameMs ?? null })
6831
- setPendingStart(null)
6927
+ }
6928
+
6929
+ /** 逐点采集一个多边形;mode 决定闭合后去哪儿,两套选区互斥、切换时清空旧点。 */
6930
+ const addPolygonPoint = (p, mode) => {
6931
+ const switching = polyMode !== mode || poly.length === 0
6932
+ const cur = switching ? [] : poly
6933
+ if (switching) {
6934
+ setPolyMode(mode)
6935
+ setPolyNote('')
6936
+ setPolyHover(null)
6937
+ setPolyDrag(null)
6938
+ }
6939
+ const first = cur[0]
6940
+ const nearFirst = cur.length >= POLYGON_LIMITS.min && first !== undefined
6941
+ && Math.hypot(p.x - first.x, p.y - first.y) <= POLYGON_LIMITS.closeRadius
6942
+ if (nearFirst || cur.length >= POLYGON_LIMITS.max) {
6943
+ commitPolygon(cur, mode)
6944
+ return
6945
+ }
6946
+ const next = [...cur, p]
6947
+ setPoly(next)
6948
+ setPolyHover(null)
6949
+ if (next.length >= POLYGON_LIMITS.max) commitPolygon(next, mode)
6832
6950
  }
6833
6951
 
6834
6952
  const onPointerDown = (event) => {
6835
- // 中键(1)放行给查看器的原生拖拽平移;左键留给画框(v0.14.4 标注态中键移动)。
6836
- // 若继续对所有按键 stopPropagation,中键会被吞、标注时挪不动图。
6953
+ // 中键(1)放行给查看器原生拖拽平移;左键(0)/右键(2)才由标注层接管。
6837
6954
  if (annotationPointerRouting(active, event.button) !== 'draw') return
6838
6955
  // 放大状态下查看器会在 pointerdown 里 setPointerCapture;这里必须拦住冒泡,
6839
6956
  // 否则弹窗内的输入框/按钮会被「拖图」逻辑抢走,表现为点击无反应。
6840
6957
  event.stopPropagation()
6841
- // 右键(2):多边形遮罩选区逐点采集(4–20 点)。点回首点 / 满 20 点 / Enter / 面板按钮都可闭合。
6842
- // 左键矩形批注与右键多边形互斥,避免两套草稿同时活着互相打架。
6958
+ // 右键(2):填充遮罩选区逐点采集(4–20 点)。点回首点 / 满 20 点 / Enter / 面板按钮都可闭合。
6843
6959
  if (event.button === 2) {
6844
6960
  event.preventDefault()
6845
6961
  const p = toNorm(event)
6846
6962
  if (p === null) return
6847
6963
  clearPending()
6848
- const first = poly[0]
6849
- const nearFirst = poly.length >= POLYGON_LIMITS.min && first !== undefined
6850
- && Math.hypot(p.x - first.x, p.y - first.y) <= POLYGON_LIMITS.closeRadius
6851
- if (nearFirst || poly.length >= POLYGON_LIMITS.max) {
6852
- commitPolygon(poly)
6853
- return
6854
- }
6855
- const next = [...poly, p]
6856
- setPoly(next)
6857
- setPolyHover(null)
6858
- if (next.length >= POLYGON_LIMITS.max) commitPolygon(next)
6964
+ dragStartRef.current = null
6965
+ addPolygonPoint(p, 'mask')
6859
6966
  return
6860
6967
  }
6861
6968
  if (event.button !== 0) return
6862
6969
  const p = toNorm(event)
6863
6970
  if (p === null) return
6864
6971
  event.preventDefault()
6865
- if (poly.length > 0) {
6866
- setPoly([])
6867
- setPolyHover(null)
6868
- setPolyDrag(null)
6869
- }
6870
6972
  try { event.currentTarget.setPointerCapture(event.pointerId) } catch { /* 忽略 */ }
6871
-
6872
- // 上一处还在输入 → 先存档,第二处才按得下去(v0.14.2 ⑤)
6973
+ // 上一处还在输入 → 先存档,下一处才按得下去(v0.14.2 ⑤)
6873
6974
  if (editing !== null) commitEditing()
6874
-
6875
- // 已经点过第一下 → 这一下当终点,直接成框(v0.14.2 ⑥)
6876
- if (pendingStart !== null) {
6877
- const box = rectFrom(pendingStart, p)
6878
- if (isValidBox(box)) {
6879
- beginEdit(box)
6880
- } else {
6881
- // 两次点到同一处:把起点挪到新位置,继续等第二下
6882
- setPendingStart(p)
6883
- setDraft({ x0: p.x, y0: p.y, x1: p.x, y1: p.y })
6884
- }
6885
- return
6886
- }
6887
-
6888
- setPendingStart(p)
6889
- setDraft({ x0: p.x, y0: p.y, x1: p.x, y1: p.y })
6975
+ // 先只记起点:松手时才判定「拖过=矩形」还是「没拖=一个区域顶点」。
6976
+ // 这样单纯点一下不会闪出虚线框,也不会再出现「点两下成矩形」。
6977
+ dragStartRef.current = { start: p, moved: false }
6890
6978
  }
6891
6979
 
6892
6980
  const onPointerMove = (event) => {
6893
- // 中键平移进行中:标注层一律不插手,让查看器独占指针(双保险,主保险是中键不再拦冒泡)
6981
+ // 中键平移进行中:标注层一律不插手,让查看器独占指针
6894
6982
  if (dragging) return
6983
+ const gesture = dragStartRef.current
6984
+ // 左键按下还没判定:移动超过阈值才算「拖框」,此刻才建立矩形草稿
6985
+ if (gesture !== null && !gesture.moved) {
6986
+ const p = toNorm(event)
6987
+ if (p === null) return
6988
+ if (Math.hypot(p.x - gesture.start.x, p.y - gesture.start.y) < ANNOT_DRAG_THRESHOLD) return
6989
+ gesture.moved = true
6990
+ // 真拖动=矩形批注,先撤掉没闭合的多边形草稿,两套选区不混着画
6991
+ resetPoly()
6992
+ setDraft({ x0: gesture.start.x, y0: gesture.start.y, x1: p.x, y1: p.y })
6993
+ event.stopPropagation()
6994
+ event.preventDefault()
6995
+ return
6996
+ }
6895
6997
  // 多边形橡皮筋:只在没有矩形草稿、没有说明弹窗时跟随指针
6896
6998
  if (active && poly.length > 0 && draft === null && editing === null) {
6897
6999
  event.stopPropagation()
@@ -6909,17 +7011,22 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6909
7011
 
6910
7012
  const finishDraft = (event) => {
6911
7013
  if (dragging) return
6912
- if (draft === null || editing !== null) return
7014
+ const gesture = dragStartRef.current
7015
+ if (gesture === null) return
7016
+ dragStartRef.current = null
6913
7017
  event.preventDefault()
6914
7018
  event.stopPropagation()
6915
- const box = rectFrom({ x: draft.x0, y: draft.y0 }, { x: draft.x1, y: draft.y1 })
6916
- if (!isValidBox(box)) {
6917
- // 只是点了一下、还没拖:保留起点,等第二下点终点(v0.14.2 ⑥)
6918
- setPendingStart({ x: draft.x0, y: draft.y0 })
7019
+ const p = toNorm(event) ?? gesture.start
7020
+ if (!gesture.moved) {
7021
+ // 单纯点一下 = 不规则区域的一个顶点;点回起点 / 满 20 点即闭合进反馈篮
6919
7022
  setDraft(null)
7023
+ addPolygonPoint(p, 'note')
6920
7024
  return
6921
7025
  }
6922
- // 草稿框不清:输入框弹出期间,图上必须仍然看得见刚才圈的位置
7026
+ // 拖出来的矩形:亮框不清,输入框弹出期间图上必须仍看得见刚圈的位置
7027
+ const box = rectFrom(gesture.start, p)
7028
+ setDraft(null)
7029
+ if (!isValidBox(box)) return
6923
7030
  beginEdit(box)
6924
7031
  }
6925
7032
 
@@ -6997,7 +7104,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
6997
7104
  ])
6998
7105
  })
6999
7106
 
7000
- // ---- 正在画的框 / 已点下的起点(保存前一直可见)----
7107
+ // ---- 正在拖的矩形(保存前一直可见);单击加顶点不画虚线框 ----
7001
7108
  const draftShape = draft !== null
7002
7109
  ? (() => {
7003
7110
  const x = Math.min(draft.x0, draft.x1)
@@ -7013,21 +7120,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7013
7120
  }, t('annotPendingTag')),
7014
7121
  ])
7015
7122
  })()
7016
- : (pendingStart !== null
7017
- ? h('g', { key: 'startPoint' }, [
7018
- h('circle', {
7019
- cx: (pendingStart.x * 100) + '%', cy: (pendingStart.y * 100) + '%', r: 5,
7020
- fill: '#ffd166', stroke: '#000', strokeWidth: 1.5,
7021
- }),
7022
- h('text', {
7023
- x: (pendingStart.x * 100) + '%', y: (pendingStart.y * 100) + '%',
7024
- dx: 9, dy: 4, fill: '#ffe08a', fontSize: 12, stroke: '#000', strokeWidth: 0.6,
7025
- style: { paintOrder: 'stroke' },
7026
- }, t('annotStartTag')),
7027
- ])
7028
- : null)
7123
+ : null
7029
7124
 
7030
- /** 右键多边形预览:实心半透明填充 + 可拖顶点 + 橡皮筋(点回首点即闭合)。 */
7125
+ /** 多边形预览:实心半透明填充 + 可拖顶点 + 橡皮筋(点回首点即闭合),两种模式共用。 */
7031
7126
  const polyShape = poly.length === 0 ? null : (() => {
7032
7127
  const toPx = (p) => [p.x * boxW, p.y * boxH]
7033
7128
  const pts = poly.map(toPx)
@@ -7057,6 +7152,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7057
7152
  'data-gallery-poly-vertex': String(idx),
7058
7153
  onPointerDown: (e) => {
7059
7154
  if (e.button !== 0) return
7155
+ // 点回起点=闭合选区,别被「拖顶点」抢走:首点在够点数时放行,
7156
+ // 事件冒泡到 SVG 的 pointerdown/pointerup,由 addPolygonPoint 判闭合。
7157
+ if (idx === 0 && poly.length >= POLYGON_LIMITS.min) return
7060
7158
  e.stopPropagation()
7061
7159
  e.preventDefault()
7062
7160
  setPolyDrag(idx)
@@ -7093,11 +7191,14 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7093
7191
 
7094
7192
  /** 多边形选区操作条:点数 / 外接框 / 面积实时可见,闭合前可撤销、可清空。 */
7095
7193
  const polyBox = poly.length > 0 ? polygonBBox(poly) : null
7194
+ const isNoteMode = polyMode === 'note'
7096
7195
  const polyPanel = poly.length === 0 ? null : h('div', {
7097
- className: 'dg-polyPanel', key: 'polyPanel', 'data-gallery-poly-panel': true,
7196
+ className: 'dg-polyPanel', key: 'polyPanel',
7197
+ 'data-gallery-poly-panel': true,
7198
+ 'data-gallery-poly-mode': polyMode,
7098
7199
  ...blockViewer,
7099
7200
  }, [
7100
- h('div', { className: 'dg-polyPanelHead', key: 'h' }, t('polyTitle')),
7201
+ h('div', { className: 'dg-polyPanelHead', key: 'h' }, t(isNoteMode ? 'polyNoteTitle' : 'polyTitle')),
7101
7202
  h('div', { className: 'dg-polyPanelInfo', key: 'i', 'data-gallery-poly-info': true },
7102
7203
  format(t('polyInfo'), {
7103
7204
  n: String(poly.length), max: String(POLYGON_LIMITS.max),
@@ -7105,7 +7206,18 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7105
7206
  w: Math.round(polyBox.w * 100), h: Math.round(polyBox.h * 100),
7106
7207
  area: (polygonArea(poly) * 100).toFixed(2),
7107
7208
  })),
7108
- h('div', { className: 'dg-polyPanelHint', key: 'p' }, t('polyHint')),
7209
+ h('div', { className: 'dg-polyPanelHint', key: 'p' }, t(isNoteMode ? 'polyNoteHint' : 'polyHint')),
7210
+ // 只有「区域标记」模式才给说明框:遮罩导出不需要文字,也别把说明塞进文件名
7211
+ isNoteMode ? h('div', { className: 'dg-polyPanelNote', key: 'note' },
7212
+ h('input', {
7213
+ type: 'text', className: 'dg-polyNoteInput',
7214
+ 'data-gallery-poly-note': true,
7215
+ placeholder: t('polyNotePlaceholder'),
7216
+ value: polyNote, maxLength: 500,
7217
+ // 字母 / 退格 / 回车都归输入框,别被查看器全局快捷键与闭合监听抢走
7218
+ onKeyDown: (e) => e.stopPropagation(),
7219
+ onChange: (e) => setPolyNote(e.target.value),
7220
+ })) : null,
7109
7221
  h('div', { className: 'dg-polyColors', key: 'colors', 'data-gallery-poly-colors': true }, [
7110
7222
  h('span', { className: 'dg-polyColorsLabel', key: 'l' }, t('polyFillColor')),
7111
7223
  ...MASK_FILL_KEYS.map((k) => h('button', {
@@ -7131,15 +7243,15 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7131
7243
  type: 'button', className: 'dg-btn dg-btnSmall', key: 'c',
7132
7244
  onClick: (e) => {
7133
7245
  e.stopPropagation(); e.preventDefault()
7134
- setPoly([]); setPolyHover(null); setPolyDrag(null)
7246
+ resetPoly()
7135
7247
  },
7136
7248
  }, t('polyClear')),
7137
7249
  h('button', {
7138
7250
  type: 'button', className: 'dg-btn dg-btnSmall dg-polyClose', key: 's',
7139
7251
  'data-gallery-poly-close': true,
7140
- disabled: maskBusy || poly.length < POLYGON_LIMITS.min,
7141
- onClick: (e) => { e.stopPropagation(); e.preventDefault(); commitPolygon(poly) },
7142
- }, t('polyClose')),
7252
+ disabled: (isNoteMode ? false : maskBusy) || poly.length < POLYGON_LIMITS.min,
7253
+ onClick: (e) => { e.stopPropagation(); e.preventDefault(); commitPolygon(poly, polyMode) },
7254
+ }, t(isNoteMode ? 'polyNoteClose' : 'polyClose')),
7143
7255
  ]),
7144
7256
  ])
7145
7257
 
@@ -7234,7 +7346,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7234
7346
  onPointerDown,
7235
7347
  onPointerMove,
7236
7348
  onPointerUp: finishDraft,
7237
- onPointerCancel: () => { setDraft(null); setPendingStart(null) },
7349
+ onPointerCancel: () => { setDraft(null); dragStartRef.current = null },
7238
7350
  onClick: active ? (event) => { event.preventDefault(); event.stopPropagation() } : undefined,
7239
7351
  onContextMenu: active ? (event) => { event.preventDefault(); event.stopPropagation() } : undefined,
7240
7352
  }, [draftShape, polyShape, ...shapes]),
@@ -7687,8 +7799,57 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7687
7799
  *
7688
7800
  * 绝不自动发送:只写草稿,发送由人自己按。
7689
7801
  */
7802
+ /**
7803
+ * 阶段 3 / C2:双击时把图片本体也放进输入框(尽力而为)。
7804
+ *
7805
+ * 宿主对话输入框的粘贴处理会同时读「文件」和「纯文本」;这里只放文件,
7806
+ * 不带 text/plain,所以不会把上面那段文字重复插一遍。
7807
+ * 合成事件有三处没经过真机实证(宿主内部实现、Electron 对合成 File 取路径、
7808
+ * 覆盖 clipboardData),因此全程 try/catch:失败就只是「没附图」,
7809
+ * 文字草稿、发送按钮、既有双击行为一律不受影响。
7810
+ *
7811
+ * 红线:绝不调用发送,也不写任何业务数据。
7812
+ */
7813
+ const isImageRel = (rel) => /\.(png|jpe?g|webp|bmp|gif|avif|tiff?)$/i.test(String(rel ?? ''))
7814
+
7815
+ async function attachAssetImageToComposer(target) {
7816
+ const relPath = String(target?.relPath ?? '')
7817
+ if (!isImageRel(relPath)) return { ok: false, reason: 'not-image' }
7818
+ const composer = document.querySelector('[data-composer-input][data-lexical-editor="true"]')
7819
+ ?? document.querySelector('[data-lexical-editor="true"]')
7820
+ if (composer === null) return { ok: false, reason: 'no-composer' }
7821
+ try {
7822
+ const response = await fetch(mediaUrlOf(relPath, target?.mtime), { credentials: 'same-origin' })
7823
+ if (!response.ok) return { ok: false, reason: 'fetch-' + response.status }
7824
+ const blob = await response.blob()
7825
+ if (!(blob.size > 0) || blob.size > 20 * 1024 * 1024) {
7826
+ return { ok: false, reason: 'size' }
7827
+ }
7828
+ const name = String(target?.name ?? relPath.split('/').pop() ?? 'image.png')
7829
+ const file = new File([blob], name, { type: blob.type || 'image/png' })
7830
+ const dt = new DataTransfer()
7831
+ dt.items.add(file)
7832
+ const ev = new ClipboardEvent('paste', { bubbles: true, cancelable: true })
7833
+ Object.defineProperty(ev, 'clipboardData', { value: dt, configurable: true })
7834
+ ev.__dshGallerySynthetic = true
7835
+ // 焦点先进输入框:插件自己的 document 级粘贴监听有「焦点在编辑区就放行」的门控。
7836
+ composer.focus()
7837
+ composer.dispatchEvent(ev)
7838
+ return { ok: true, name, size: blob.size }
7839
+ } catch (error) {
7840
+ console.warn('dsh-gallery: 图片附件未自动加入输入框(文字草稿不受影响)', error)
7841
+ return { ok: false, reason: String(error?.message ?? error) }
7842
+ }
7843
+ }
7690
7844
  const writeAssetToComposer = (target, abs) => {
7691
7845
  const info = target ?? {}
7846
+ const key = String(info.relPath ?? '')
7847
+ // 连点保护:上一次还没处理完就直接忽略,避免文字和缩略图各写两份。
7848
+ // 5 秒兜底 + finally 摘除,处理完(含失败)绝不长期占着。
7849
+ const now = Date.now()
7850
+ const busyAt = key === '' ? undefined : doubleClickInFlight.get(key)
7851
+ if (busyAt !== undefined && now - busyAt < 5000) return
7852
+ if (key !== '') doubleClickInFlight.set(key, now)
7692
7853
  // 预览图 / 原图没有自己的 maskOf,按 overlayRelPath / sourceRelPath 反查主遮罩
7693
7854
  const linked = dragMaskByOverlay.get(info.relPath) ?? dragMaskBySource.get(info.relPath) ?? null
7694
7855
  const hasMask = info?.maskOf !== null && info?.maskOf !== undefined
@@ -7699,12 +7860,19 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7699
7860
  void writeDraftToComposer(text, sessionId).then((result) => {
7700
7861
  // 写不进 composer 就放剪贴板,人自己粘
7701
7862
  if (!result.ok) void copyText(text)
7863
+ // 文字那步有幂等:草稿已在输入框时返回 already-present,本次并没有真的插入文字。
7864
+ // 附图必须跟着同一把尺子走,否则重复双击会一次次往输入框塞同一张缩略图。
7865
+ const alreadyPresent = result.ok && result.detail === 'already-present'
7866
+ if (result.ok && !alreadyPresent) void attachAssetImageToComposer(info)
7702
7867
  showToast(result.ok ? 'ok' : 'failed',
7703
- result.ok ? t('feedbackDraftReady') : t('feedbackDraftInClipboard'))
7868
+ alreadyPresent ? t('feedbackDraftAlreadyThere')
7869
+ : (result.ok ? t('feedbackDraftReady') : t('feedbackDraftInClipboard')))
7704
7870
  }).catch((error) => {
7705
7871
  console.warn('dsh-gallery: 写输入框失败,已退回剪贴板', error)
7706
7872
  void copyText(text)
7707
7873
  showToast('failed', t('feedbackDraftInClipboard'))
7874
+ }).finally(() => {
7875
+ if (key !== '') doubleClickInFlight.delete(key)
7708
7876
  })
7709
7877
  }
7710
7878
 
@@ -7722,6 +7890,36 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7722
7890
  // 让回调(如右键菜单)读到最新值而不必重建依赖
7723
7891
  const viewerRef = React.useRef(null)
7724
7892
  React.useEffect(() => { viewerRef.current = viewer }, [viewer])
7893
+
7894
+ /**
7895
+ * 阶段 3 / C1:把「人此刻正在看哪张图」告诉后台。
7896
+ * 关闭查看器时不清空 —— 保留最后一次,人回头问「我刚看的那张」仍然答得上来。
7897
+ * 纯状态同步:不发送任何消息,失败只记日志,绝不影响看图本身。
7898
+ */
7899
+ React.useEffect(() => {
7900
+ if (viewer === null || !Array.isArray(viewer.list)) return
7901
+ const current = viewer.list[viewer.index]
7902
+ if (current === null || current === undefined || String(current.relPath ?? '') === '') return
7903
+ // 原图 / 彩色填充预览图自己没有 maskOf;用列表刷新时建好的反查表补上,
7904
+ // 让「助手查刚看的图」与双击、拖图写进输入框拿到同一张主遮罩。
7905
+ const linkedMask = dragMaskByOverlay.get(String(current.relPath))
7906
+ ?? dragMaskBySource.get(String(current.relPath)) ?? null
7907
+ void callHost('setContext', {
7908
+ item: {
7909
+ relPath: String(current.relPath),
7910
+ name: String(current.name ?? ''),
7911
+ absPath: String(current.absPath ?? ''),
7912
+ category: String(current.category ?? 'unknown'),
7913
+ categoryManual: current.categoryManual === true,
7914
+ maskOf: current.maskOf ?? (linkedMask !== null
7915
+ ? { relPath: String(linkedMask.relPath ?? '') } : null),
7916
+ sessionId: String(current.sessionId ?? viewer.originSid ?? ''),
7917
+ sessionTitle: String(current.sessionTitle ?? viewer.originTitle ?? ''),
7918
+ },
7919
+ }).catch((error) => {
7920
+ console.warn('dsh-gallery: 同步「正在看的图」失败(不影响看图)', error)
7921
+ })
7922
+ }, [viewer])
7725
7923
  /**
7726
7924
  * v0.16.2 粘贴落点:全局视图下「鼠标所在的对话组」。
7727
7925
  *
@@ -7753,6 +7951,10 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7753
7951
  const [settingsOpen, setSettingsOpen] = React.useState(false)
7754
7952
  // 全局分组:哪些组是展开的(键是 sessionId 或 '__history__')
7755
7953
  const [openGroups, setOpenGroups] = React.useState(new Set())
7954
+ // 每组额外取回来的明细(首次只有 60 张,点「再显示」再追加 60 张)。
7955
+ // 全量明细留在后台内存,界面一次只画一小批:加载轻、也不卡。
7956
+ const [groupExtras, setGroupExtras] = React.useState(() => new Map())
7957
+ const [groupBusy, setGroupBusy] = React.useState(() => new Set())
7756
7958
  /**
7757
7959
  * 「打开对话」的实测结论:sid → 'ok' | 'failed'。
7758
7960
  * 它比 Host 的归档字段优先级更高:点得开就撤掉一切标注,点不开才标无法重建。
@@ -7836,6 +8038,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
7836
8038
  y: Number(a?.y) || 0,
7837
8039
  w: Number(a?.w) || 0,
7838
8040
  h: Number(a?.h) || 0,
8041
+ // 不规则区域:顶点挂在 region 里原样透传,Host 展开与草稿都认这个对象
8042
+ ...(a?.shape === 'polygon' && Array.isArray(a?.polygon)
8043
+ ? { polygon: a.polygon, shape: 'polygon' } : {}),
7839
8044
  },
7840
8045
  markedAt: Number(a?.createdAt) || Date.now(),
7841
8046
  }), [])
@@ -8226,8 +8431,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8226
8431
  // 先同步 ref 再 setState:落盘要读「加上这一条之后」的完整数组
8227
8432
  annotationsRef.current = nextAll
8228
8433
  setAnnotations(nextAll)
8229
- // v0.16.4 · A 档:框选批注同样是判定 → 进待处理。
8230
- // v0.16.5:整组写,Agent 才拿得到同一张图上的每一处;
8434
+ // v0.16.4 · A 档:框选批注同样是判定 → 进待处理。
8435
+ // v0.16.5:整组写,Agent 才拿得到同一张图上的每一处;
8231
8436
  // 若该图已有非批注判定(如「交付不合格」),保留那条 action 不被冲掉。
8232
8437
  const existing = marks[relPath]
8233
8438
  writePendingAnnotations(relPath, next, {
@@ -8401,6 +8606,12 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8401
8606
  // v0.16.4:分类(素材 / 过程稿 / 定稿),批注落盘与草稿都要用
8402
8607
  category: it.category ?? 'unknown',
8403
8608
  categoryManual: it.categoryManual === true,
8609
+ // 阶段 3 / C1:同步「正在看哪张」要用的字段。
8610
+ // maskOf 只留 relPath,避免把整个关联对象塞进 viewer state。
8611
+ absPath: it.absPath ?? '',
8612
+ maskOf: it.maskOf ? { relPath: String(it.maskOf.relPath ?? '') } : null,
8613
+ sessionId: it.sessionId ?? '',
8614
+ sessionTitle: it.sessionTitle ?? '',
8404
8615
  }))
8405
8616
  // v0.16.2:记住这张图属于哪个对话组 —— 裁剪产物要跟着来源组落盘,
8406
8617
  // 不能一律塞进当前对话(否则在历史对话的图上裁剪,产物跑到别的对话)。
@@ -8697,12 +8908,14 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8697
8908
  * 所以必须挂 document 级监听,再用两道门控避免抢走对话输入框的粘贴:
8698
8909
  * ① 鼠标必须悬停在本面板上(hoveringRef);
8699
8910
  * ② 焦点不能在 input/textarea/contenteditable 里。
8700
- */
8701
- const hoveringRef = React.useRef(false)
8702
- React.useEffect(() => {
8703
- const onDocPaste = (event) => {
8704
- if (hoveringRef.current !== true) return
8705
- if (event?.defaultPrevented === true) return
8911
+ */
8912
+ const hoveringRef = React.useRef(false)
8913
+ React.useEffect(() => {
8914
+ const onDocPaste = (event) => {
8915
+ if (hoveringRef.current !== true) return
8916
+ // 阶段 3 / C2:我们自己在输入框合成的图片粘贴事件,不是往面板里粘图。
8917
+ if (event?.__dshGallerySynthetic === true) return
8918
+ if (event?.defaultPrevented === true) return
8706
8919
  const ae = document.activeElement
8707
8920
  const tag = (ae?.tagName ?? '').toLowerCase()
8708
8921
  if (tag === 'input' || tag === 'textarea' || ae?.isContentEditable === true) return
@@ -8915,7 +9128,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8915
9128
  h('span', { className: 'dg-sub', key: 'sub' },
8916
9129
  data === null
8917
9130
  ? (view.status === 'failed' ? t('errorTitle') : t('loading'))
8918
- : format(t('subCount'), { shown: visibleItems.length, total: data.total })),
9131
+ : (scope === 'global' && Array.isArray(data.groups) && data.groups.length > 0
9132
+ ? format(t('subCountGroups'), { total: data.total, groups: data.groups.length })
9133
+ : format(t('subCount'), { shown: visibleItems.length, total: data.total }))),
8919
9134
  ]),
8920
9135
  scopeSwitch,
8921
9136
  // 图片 / 文件 / 音视频 三画廊切换(v0.10.1)
@@ -8970,6 +9185,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8970
9185
  // 反馈篮独立入口(S3-a):关闭后能重新打开,不必再标记一张卡
8971
9186
  // 计数取「表态 ∪ 批注」并集:只有框选批注、没表态的卡也算一条待发反馈
8972
9187
  const markedCount = new Set([...Object.keys(marks), ...Object.keys(annotations)]).size
9188
+ // 2026-11-15:按钮上不再显示「· N 条」,恒显「反馈篮」。
9189
+ // 条数数据属性保留(不是可见数字),反馈的读写与生命周期一点不动。
8973
9190
  const basketToggle = h('button', {
8974
9191
  type: 'button',
8975
9192
  className: 'dg-btn dg-basketToggle',
@@ -8979,30 +9196,18 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
8979
9196
  title: t('feedbackBasketToggleHint'),
8980
9197
  'aria-label': t('feedbackBasketToggleHint'),
8981
9198
  onClick: () => setBasketOpen((v) => !v),
8982
- }, markedCount > 0
8983
- ? format(t('feedbackBasketToggleN'), { n: markedCount })
8984
- : t('feedbackBasketToggle'))
9199
+ }, t('feedbackBasketToggle'))
8985
9200
 
8986
9201
  /**
8987
- * v0.16.4 · B 档:待处理反馈角标。
9202
+ * 2026-11-15:待处理数字角标已下线(老板拍板「留篮子、去掉数字」)。
8988
9203
  *
8989
- * 为什么要和上面那个「反馈篮 · N 条」并存:
8990
- * · 按钮上的 N = 篮子里现在有几条(持久)
8991
- * · 角标上的 N = 自上次处理完以来有几条新判定(一次性)
8992
- * 人做完一轮后按钮还显示条数(标记还在),但角标归零 —— 表示「没有待办了」。
8993
- * 点角标 = 打开反馈篮,**不会**自动拉给 Agent。
9204
+ * 今天助手已能自己查资产、记住刚打开的那张、双击卡片直接带图进输入框,
9205
+ * 「攒意见 → 角标提醒 → 等助手来拉」这条老链路不再走;反馈文件自 12:24 起为空。
9206
+ * 但反馈篮本体保留:多条意见打包成草稿、框选批注、编辑 / 清空仍只有它做得到。
9207
+ * 数据层一律不动(pendingCount 的读写与 ack 照旧),避免碰反馈生命周期。
9208
+ * 恒为 null:渲染数组里仍引用 pendingBadge,留个空位比删变量安全。
8994
9209
  */
8995
- const pendingBadge = pendingCount > 0
8996
- ? h('button', {
8997
- type: 'button',
8998
- className: 'dg-pendingBadge',
8999
- key: 'pendingBadge',
9000
- 'data-gallery-pending-count': pendingCount,
9001
- title: format(t('pendingFeedbackBadgeHint'), { n: pendingCount }),
9002
- 'aria-label': format(t('pendingFeedbackBadgeHint'), { n: pendingCount }),
9003
- onClick: () => setBasketOpen(true),
9004
- }, format(t('pendingFeedbackBadge'), { n: pendingCount }))
9005
- : null
9210
+ const pendingBadge = null
9006
9211
 
9007
9212
  /**
9008
9213
  * 各分类的全局计数(供顶部开关显示数字 + 判断「已显示 N / 共 M」)。
@@ -9011,12 +9216,27 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9011
9216
  const catCounts = React.useMemo(() => {
9012
9217
  // v0.14.2:只数 4 个原生标签,表态层已下线
9013
9218
  const c = { final: 0, input: 0, intermediate: 0, unknown: 0 }
9219
+ // 🔴 全局分组视图下,下面渲染的是 data.groups(全库按对话分组),
9220
+ // 而 items 只是最新一页的 60 条。还按 items 统计,顶部数字会与
9221
+ // 各组小标签加总差几十倍 —— 直接汇总各组全量 counts,口径才一致。
9222
+ if (scope === 'global' && Array.isArray(data?.groups) && data.groups.length > 0) {
9223
+ for (const g of data.groups) {
9224
+ for (const k of Object.keys(c)) c[k] += Number(g.counts?.[k] ?? 0)
9225
+ }
9226
+ return c
9227
+ }
9228
+ // 2026-11-15:当前对话视图也按「本对话全部」算。后台 list 会带回 counts,
9229
+ // 直接用;items 只是第一页 60 张,数它会和全局「当前对话」组的小标签对不上。
9230
+ if (data?.counts !== null && typeof data?.counts === 'object') {
9231
+ for (const k of Object.keys(c)) c[k] = Number(data.counts[k] ?? 0)
9232
+ return c
9233
+ }
9014
9234
  for (const it of items) {
9015
9235
  const b = bucketOf(it)
9016
9236
  if (Object.prototype.hasOwnProperty.call(c, b)) c[b] += 1
9017
9237
  }
9018
9238
  return c
9019
- }, [items, bucketOf])
9239
+ }, [items, bucketOf, scope, data])
9020
9240
  const finalCount = catCounts.final
9021
9241
  const inputCount = catCounts.input
9022
9242
  const interimCount = catCounts.intermediate
@@ -9217,8 +9437,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9217
9437
  ]),
9218
9438
  ]),
9219
9439
  ])
9220
- : null
9221
-
9440
+ : null
9441
+
9222
9442
  let body
9223
9443
  if (view.status === 'loading') {
9224
9444
  body = h('div', { className: 'dg-body', key: 'body' }, h('p', { className: 'dg-status' }, t('loading')))
@@ -9230,8 +9450,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9230
9450
  ])
9231
9451
  } else if (data !== null && data.rootMissing) {
9232
9452
  // 目录不存在是最常见的「装上打不开」原因:直接给出改目录入口
9233
- body = h('div', { className: 'dg-body', key: 'body' }, [
9234
- h('p', { className: 'dg-status', key: 'msg' },
9453
+ body = h('div', { className: 'dg-body', key: 'body' }, [
9454
+ h('p', { className: 'dg-status', key: 'msg' },
9235
9455
  format(t('rootMissing'), { root: data.root })),
9236
9456
  h('p', { className: 'dg-status dg-statusAction', key: 'fix' },
9237
9457
  h('button', {
@@ -9244,7 +9464,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9244
9464
  } else if (items.length === 0) {
9245
9465
  // 当前对话为空时,要区分:会话记录没找到 / 日志空 / 找到了但确实没产出
9246
9466
  // 全局为空时,按画廊类型给不同文案(图片 / 文件)
9247
- let emptyText = kind === 'file' ? t('emptyFile')
9467
+ let emptyText = kind === 'file' ? t('emptyFile')
9248
9468
  : kind === 'media' ? t('emptyMedia')
9249
9469
  : t('empty')
9250
9470
  if (scope === 'session' && data !== null) {
@@ -9411,11 +9631,14 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9411
9631
  const sidebarSnapshot = readSidebarSessions()
9412
9632
  const groupNodes = data.groups.map((group, gi) => {
9413
9633
  const groupKey = group.sessionId ?? '__history__'
9414
- const isOpen = openGroups.has(groupKey)
9415
- // v0.14.3:过程稿显隐只认顶部「过程稿」开关,组内不再第二套开关。
9634
+ const isOpen = openGroups.has(groupKey)
9635
+ // v0.14.3:过程稿显隐只认顶部「过程稿」开关,组内不再第二套开关。
9416
9636
  // 顶部开 → 所有组的过程稿都显示;顶部关 → 全部隐藏。
9417
9637
  // 分类开关过滤:按 bucketOf 判断该文件属哪一类,再查开关。
9418
- const visibleFiles = group.files.filter(
9638
+ // 后端首次只给每组前 60 张,点「再显示」再追加 60 张。
9639
+ const extra = groupExtras.get(groupKey) ?? []
9640
+ const allFiles = [...(Array.isArray(group.files) ? group.files : []), ...extra]
9641
+ const visibleFiles = allFiles.filter(
9419
9642
  (f) => categoryFilter[bucketOf(f)] !== false)
9420
9643
 
9421
9644
  const chips = []
@@ -9423,8 +9646,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9423
9646
  chips.push(h('span', { className: 'dg-chip dg-chip-final', key: 'f' }, format(t('groupFinal'), { n: group.counts.final })))
9424
9647
  }
9425
9648
  if (group.counts.input > 0) {
9426
- chips.push(h('span', { className: 'dg-chip dg-chip-input', key: 'i' }, format(t('groupInput'), { n: group.counts.input })))
9427
- }
9649
+ chips.push(h('span', { className: 'dg-chip dg-chip-input', key: 'i' }, format(t('groupInput'), { n: group.counts.input })))
9650
+ }
9428
9651
  if (group.counts.intermediate > 0) {
9429
9652
  chips.push(h('span', { className: 'dg-chip dg-chip-intermediate', key: 'm' }, format(t('groupIntermediate'), { n: group.counts.intermediate })))
9430
9653
  }
@@ -9502,6 +9725,42 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9502
9725
  ? h('div', { className: `dg-grid${kind === 'file' ? ' dg-fileGrid' : ''}`, key: 'grid' },
9503
9726
  visibleFiles.map((f) => cardFor(f, headKey, visibleFiles, group)))
9504
9727
  : h('div', { className: 'dg-groupEmpty', key: 'empty' }, t('groupEmpty')),
9728
+ allFiles.length < Number(group.fileCount ?? 0)
9729
+ ? h('button', {
9730
+ type: 'button',
9731
+ className: 'dg-btn dg-groupMore',
9732
+ key: 'more',
9733
+ 'data-gallery-group-more': groupKey,
9734
+ disabled: groupBusy.has(groupKey),
9735
+ onClick: () => {
9736
+ if (groupBusy.has(groupKey)) return
9737
+ setGroupBusy((prev) => new Set(prev).add(groupKey))
9738
+ void callHost('groupMore', {
9739
+ kind, scope: 'global', sessionId, groupKey,
9740
+ offset: allFiles.length, limit: GROUP_PAGE,
9741
+ }).then((r) => {
9742
+ if (r?.ok !== true || !Array.isArray(r.files)) return
9743
+ setGroupExtras((prev) => {
9744
+ const next = new Map(prev)
9745
+ next.set(groupKey, [...(prev.get(groupKey) ?? []), ...r.files])
9746
+ return next
9747
+ })
9748
+ }).catch((error) => {
9749
+ console.warn('dsh-gallery: 再显示失败(不影响已显示的图)', error)
9750
+ }).finally(() => {
9751
+ setGroupBusy((prev) => {
9752
+ const next = new Set(prev)
9753
+ next.delete(groupKey)
9754
+ return next
9755
+ })
9756
+ })
9757
+ },
9758
+ }, format(t('groupShowMore'), {
9759
+ step: Math.min(GROUP_PAGE, Number(group.fileCount ?? 0) - allFiles.length),
9760
+ shown: allFiles.length,
9761
+ total: Number(group.fileCount ?? 0),
9762
+ }))
9763
+ : null,
9505
9764
  group.truncated
9506
9765
  ? h('div', { className: 'dg-groupEmpty', key: 'trunc', style: { marginTop: '8px' } },
9507
9766
  format(t('groupTruncated'), { shown: group.returnedCount, total: group.fileCount }))
@@ -9741,8 +10000,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
9741
10000
  item: mediaPlaying,
9742
10001
  t,
9743
10002
  sessionId: mediaSameAsCurrent ? (sessionId ?? '') : mediaOriginSid,
9744
- sessionTitle: mediaSameAsCurrent && Array.isArray(data?.groups)
9745
- ? (data.groups.find((g) => g.isCurrent)?.title ?? '')
10003
+ sessionTitle: mediaSameAsCurrent && Array.isArray(data?.groups)
10004
+ ? (data.groups.find((g) => g.isCurrent)?.title ?? '')
9746
10005
  : '',
9747
10006
  sessionCreatedAt: mediaSameAsCurrent && Array.isArray(data?.groups)
9748
10007
  ? (data.groups.find((g) => g.isCurrent)?.createdAt ?? 0)
@@ -10336,7 +10595,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
10336
10595
  * @param filter - {
10337
10596
  * kind?: 'image'|'file'|'media', scope?: 'global'|'session', sessionId?: string,
10338
10597
  * label?: 'input'|'intermediate'|'final', // 与 category 同义,取生效值(手动标签优先)
10339
- * category?: 同上, confirmed?: boolean, action?: string,
10598
+ * category?: 同上, action?: string,
10340
10599
  * ext?: '.png', q?: string, limit?: number, page?: number
10341
10600
  * }
10342
10601
  * @returns { schema, items, count, total, error? }
@@ -10376,7 +10635,6 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
10376
10635
  name: String(it.name ?? relPath.split('/').pop() ?? relPath),
10377
10636
  category: String(it.category ?? 'unknown'),
10378
10637
  categoryManual: it.categoryManual === true,
10379
- confirmed: it.confirmed === true,
10380
10638
  action: String(it.markAction ?? ''),
10381
10639
  ext: String(it.extension ?? ''),
10382
10640
  size: Number(it.size) || 0,
@@ -10403,7 +10661,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
10403
10661
  * 否则 Agent 看一眼就把用户的意见吞了。
10404
10662
  *
10405
10663
  * @returns { schema, items, count, draft }
10406
- * items[i] = { relPath, absolute, action, reason, changeOnly, keep, region, markedAt, category, sessionId, confirmed }
10664
+ * items[i] = { relPath, absolute, action, reason, changeOnly, keep, region, markedAt, category, sessionId }
10407
10665
  * draft = 已渲染好的成稿文本(可直接用,省得自己拼)
10408
10666
  */
10409
10667
  async getPendingFeedback() {