zcode-pro 1.8.0 → 1.8.2

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/dist/inject.js CHANGED
@@ -366,8 +366,10 @@
366
366
  devReloadDesc: "\u70B9\u51FB\u540E\u7EA6 2-3 \u79D2\u5185\u6240\u6709 ZCode \u7A97\u53E3\u81EA\u52A8\u5237\u65B0\u4E00\u6B21\u5E76\u52A0\u8F7D\u65B0\u811A\u672C\u3002",
367
367
  devToolsSwitch: "\u5F00\u53D1\u8005\u5DE5\u5177",
368
368
  devToolsSwitchDesc: "\u5B98\u65B9\u4FA7\u680F\u7684\u201C\u5F00\u53D1\u8005\u5DE5\u5177\u201D\u9762\u677F\uFF08Token \u8C03\u8BD5 / \u7F51\u7EDC\u72B6\u6001\uFF09\uFF0C\u9ED8\u8BA4\u5173\u95ED\u3002\u6539\u52A8\u5199\u5165\u5B98\u65B9\u6BCF\u79D2\u8F6E\u8BE2\u7684\u5F00\u5173\uFF0C1 \u79D2\u5185\u751F\u6548\u3002",
369
- rowGapName: "\u6BB5\u843D\u95F4\u8DDD",
370
- rowGapDesc: "\u4F1A\u8BDD\u4E2D\u6BB5\u843D\u7B49\u6587\u672C\u5757\u4E4B\u95F4\u7684\u5782\u76F4\u95F4\u8DDD\uFF08\u56DE\u5408\u4E4B\u95F4\u3001\u7B54\u6848\u5185\u90E8\uFF09\u3002",
369
+ thinkingRowGapName: "\u601D\u8003\u6BB5\u843D\u95F4\u8DDD",
370
+ thinkingRowGapDesc: "\u201C\u5DF2\u5DE5\u4F5C/\u5DE5\u4F5C\u4E2D\u201D\u8FC7\u7A0B\u8BB0\u5F55\u91CC\u5404\u884C\u3001\u601D\u8003\u6B63\u6587\u4E4B\u95F4\u7684\u5782\u76F4\u95F4\u8DDD\u3002",
371
+ answerRowGapName: "\u56DE\u7B54\u6BB5\u843D\u95F4\u8DDD",
372
+ answerRowGapDesc: "\u56DE\u7B54\u6B63\u6587\u91CC\u6BB5\u843D\u7B49\u6587\u672C\u5757\u4E4B\u95F4\u3001\u4EE5\u53CA\u56DE\u5408\u4E4B\u95F4\u7684\u5782\u76F4\u95F4\u8DDD\u3002",
371
373
  listSpacingName: "\u5217\u8868\u4E0A\u4E0B\u8FB9\u8DDD",
372
374
  listSpacingDesc: "\u7B54\u6848\u4E2D\u5217\u8868\u4E0A\u4E0B\u7684\u7559\u767D\u3002",
373
375
  listItemSpacingName: "\u5217\u8868\u9879\u95F4\u8DDD",
@@ -541,6 +543,8 @@
541
543
  themeBgBlur: "\u753B\u9762\u6A21\u7CCA",
542
544
  themeBgPanel: "\u9762\u677F\u4E0D\u900F\u660E\u5EA6",
543
545
  themeBgDialogFrost: "\u8BBE\u7F6E\u5F39\u7A97\u78E8\u7802",
546
+ themeBgCardVeil: "\u63D2\u4EF6\u5361\u7247\u906E\u7F69",
547
+ themeBgCardVeilHint: "\u58C1\u7EB8\u5F00\u7740\u65F6\u57AB\u5728\u63D2\u4EF6\u5361\u7247\u5E95\u4E0B\u7684\u4E3B\u9898\u8272\u906E\u7F69\uFF1A0 \u4E0D\u906E\uFF08\u58C1\u7EB8\u539F\u6837\u900F\u51FA\uFF09\uFF0C\u8D8A\u5927\u5361\u7247\u8D8A\u5B9E\u5728\u3001\u8D8A\u6697\u3002",
544
548
  themeBgMisc: "\u5176\u4ED6",
545
549
  themeBgFollowGlobal: "\u8DDF\u968F\u5168\u5C40",
546
550
  themeBgRegionsHint: "\u6765\u6E90\u9009\u201C\u9ED8\u8BA4\uFF08\u5168\u5C40\u58C1\u7EB8\uFF09\u201D\u5373\u8BE5\u533A\u4E0D\u5355\u72EC\u8BBE\u7F6E\u3001\u76F4\u63A5\u663E\u793A\u5168\u5C40\u58C1\u7EB8\uFF1B\u6BCF\u884C\u7684\u7F29\u653E\u3001\u906E\u7F69\u53EF\u5355\u72EC\u8BBE\u7F6E\uFF0C\u9009\u201C\u8DDF\u968F\u5168\u5C40\u201D\u5373\u8DDF\u968F\u201C\u753B\u9762\u201D\u7684\u503C\uFF1B\u6A21\u7CCA\u3001\u8F6C\u573A\u3001\u64AD\u653E\u4EC5\u4F5C\u7528\u4E8E\u5168\u5C40\u58C1\u7EB8\uFF08\u5206\u533A\u53EA\u80FD\u94FA\u56FE\uFF0C\u4E0D\u80FD\u64AD\u89C6\u9891\uFF09\u3002\u5206\u533A\u7528\u6587\u4EF6\u5939\u65F6\uFF0C\u8F6E\u6362\u95F4\u9694\u4E0E\u968F\u673A\u987A\u5E8F\u6CBF\u7528\u5168\u5C40\u8BBE\u7F6E\u3002",
@@ -624,6 +628,8 @@
624
628
  featureSessionLink: "\u4F1A\u8BDD ID \u663E\u793A\u4E3A\u4EFB\u52A1\u540D\u94FE\u63A5",
625
629
  featureSessionLinkDesc: "\u63D0\u95EE\u4E0E\u56DE\u7B54\u91CC\u7684\u4F1A\u8BDD ID\uFF08sess_ / session_ \u5F00\u5934\uFF09\u663E\u793A\u4E3A\u4EFB\u52A1\u540D\uFF0C\u70B9\u51FB\u5207\u6362\u5230\u8BE5\u4F1A\u8BDD\uFF0C\u60AC\u505C\u53EF\u770B\u539F\u59CB ID\u3002",
626
630
  featureComposerProviderDesc: "\u6A21\u578B\u540D\u524D\u663E\u793A\u4F9B\u5E94\u5546\u540D\uFF08\u5982 BigModel-Max1 / glm-5.3\uFF09\uFF0C\u533A\u5206\u540C\u540D\u6A21\u578B\u3002",
631
+ featureComposerEditModel: "\u7F16\u8F91\u65F6\u4FDD\u6301\u5F53\u524D\u6A21\u578B",
632
+ featureComposerEditModelDesc: "\u70B9\u7F16\u8F91\u4E0A\u4E00\u6761\u6D88\u606F\u65F6\uFF0C\u4FDD\u6301\u4F60\u70B9\u7F16\u8F91\u524D\u9009\u7684\u6A21\u578B\uFF0C\u4E0D\u4F1A\u6362\u6210\u8FD9\u6761\u6D88\u606F\u5F53\u65F6\u7528\u7684\u6A21\u578B\uFF1B\u8FDB\u5165\u7F16\u8F91\u540E\u4ECD\u7136\u53EF\u4EE5\u518D\u6362\uFF0C\u91CD\u8DD1\u7528\u6700\u7EC8\u9009\u7684\u6A21\u578B\u3002",
627
633
  featureSessionImport: "\u5BFC\u5165\u4F1A\u8BDD",
628
634
  featureSessionImportDesc: "\u5728\u8BBE\u7F6E\u5F39\u7A97\u91CC\u628A Codex\u3001Claude Code\u3001dsh\u3001pi \u7684\u5386\u53F2\u4F1A\u8BDD\u5BFC\u5165\u6210 ZCode \u4EFB\u52A1\u3002",
629
635
  imageCopy: "\u590D\u5236\u56FE\u7247",
@@ -996,8 +1002,10 @@
996
1002
  devToolsSwitchDesc: 'The official "Developer tools" side pane (Token debug / Network status), off by default. The change goes to the flag the official app polls every second.',
997
1003
  devReloading: "Reloading\u2026",
998
1004
  devReloadDesc: "Every ZCode window refreshes automatically within 2-3 seconds to load the new script.",
999
- rowGapName: "Paragraph spacing",
1000
- rowGapDesc: "Vertical spacing between text blocks (turns, paragraphs inside answers).",
1005
+ thinkingRowGapName: "Thinking paragraph spacing",
1006
+ thinkingRowGapDesc: 'Vertical spacing between rows of the "Worked/Working" process view and thinking text.',
1007
+ answerRowGapName: "Answer paragraph spacing",
1008
+ answerRowGapDesc: "Vertical spacing between text blocks inside answers and between turns.",
1001
1009
  listSpacingName: "List spacing",
1002
1010
  listSpacingDesc: "Space above and below lists.",
1003
1011
  listItemSpacingName: "List item spacing",
@@ -1170,6 +1178,8 @@
1170
1178
  themeBgBlur: "Wallpaper blur",
1171
1179
  themeBgPanel: "Panel opacity",
1172
1180
  themeBgDialogFrost: "Frosted settings window",
1181
+ themeBgCardVeil: "Plugin card veil",
1182
+ themeBgCardVeilHint: "Theme-colored veil behind plugin cards while a wallpaper is on: 0 shows the wallpaper as-is; higher makes cards more solid and darker.",
1173
1183
  themeBgMisc: "Other",
1174
1184
  themeBgFollowGlobal: "Follow global",
1175
1185
  themeBgRegionsHint: '"Default (global)" means the region is not set on its own and just shows the global wallpaper. Fit and mask can be set per row; "Follow global" uses the Display values. Blur, transition and playback apply only to the global wallpaper (regions are static images, no video). Region folders reuse the global rotation interval and order settings.',
@@ -1253,6 +1263,8 @@
1253
1263
  featureSessionLink: "Session ID links",
1254
1264
  featureSessionLinkDesc: "Shows session IDs (sess_ / session_) in chat as task names; click to switch to that session, hover for the raw ID.",
1255
1265
  featureComposerProviderDesc: "Shows the provider before the model name (e.g. BigModel-Max1 / glm-5.3).",
1266
+ featureComposerEditModel: "Keep current model when editing",
1267
+ featureComposerEditModelDesc: "Keeps the model you selected before clicking edit instead of switching to the model the message was sent with. You can still change it in the editor; the rerun uses the final selection.",
1256
1268
  featureSessionImport: "Session import",
1257
1269
  featureSessionImportDesc: "Import sessions from Codex, Claude Code, dsh and pi as ZCode tasks from the settings dialog.",
1258
1270
  imageCopy: "Copy image",
@@ -2205,6 +2217,16 @@
2205
2217
  .zcodepro-textarea.zcodepro-textarea-sm { min-height: 0; }
2206
2218
  /* \u5168\u5C40\u63D0\u793A\u8BCD\u5927\u7F16\u8F91\u6846\uFF1A\u9ED8\u8BA4/\u6700\u5927\u9AD8\u5EA6\u90FD\u6BD4\u9ED8\u8BA4\u6587\u672C\u57DF\u66F4\u9AD8 */
2207
2219
  .zcodepro-textarea.zcodepro-textarea-lg { min-height: 16rem; max-height: 40rem; }
2220
+ /* \u8BBE\u7F6E\u9875\u4E0B\u62C9\u6846\uFF1A\u58C1\u7EB8\u5F00\u7740\u65F6\u8868\u9762 token \u88AB\u6362\u6210 color-mix \u534A\u900F\u660E\uFF0C\u539F\u751F\u4E0B\u62C9\u5217\u8868
2221
+ \u4F1A\u6E32\u67D3\u6210\u9ED1\u5E95 + \u9ED8\u8BA4\u9ED1\u5B57\uFF08\u6DF1\u8272\u6A21\u5F0F\u770B\u4E0D\u6E05\uFF09\u3002\u7ED9\u9009\u9879\u5199\u6B7B\u4E3B\u9898\u7684\u4E0D\u900F\u660E\u5E95\u8272\u4E0E
2222
+ \u6B63\u6587\u8272\uFF0C\u5E76\u6309\u660E\u6697\u7ED9 select \u4E00\u4E2A color-scheme\uFF0C\u5217\u8868\u5728\u4E24\u79CD\u6A21\u5F0F\u4E0B\u90FD\u53EF\u8BFB */
2223
+ [data-zcodepro-settings] select { color-scheme: light; }
2224
+ html.theme-zai-dark [data-zcodepro-settings] select,
2225
+ html.dark [data-zcodepro-settings] select { color-scheme: dark; }
2226
+ [data-zcodepro-settings] select option {
2227
+ background-color: var(--color-popover, #fff);
2228
+ color: var(--color-foreground, #111);
2229
+ }
2208
2230
  /* \u884C\u9AD8\u6ED1\u6746\uFF08\u6837\u5F0F\u8C03\u6574\u6807\u7B7E\u9875\uFF09 */
2209
2231
  .zcodepro-range {
2210
2232
  -webkit-appearance: none;
@@ -2303,8 +2325,8 @@
2303
2325
  color: var(--color-muted-foreground, #888);
2304
2326
  }
2305
2327
  /* \u72B6\u6001\u680F\u7EDF\u8BA1\uFF08status-bar.js\uFF09\uFF1A\u8F93\u5165\u6846\u4E0B\u65B9\u53F3\u5BF9\u9F50\u7684\u4E00\u884C\u5C0F\u5B57\uFF0C\u6BCF\u9879\u5E26 lucide \u5C0F\u56FE\u6807\u3002
2306
- \u4E0A\u4E0B\u95F4\u8DDD\u7531\u811A\u672C\u6309\u89C6\u56FE\u63A7\u5236\uFF08status-bar.js\uFF1A\u4E0B\u65B9\u6709\u5185\u5BB9\u65F6\u5BF9\u79F0 7px\uFF0C
2307
- \u4E0B\u65B9\u662F\u7A97\u5E95\u7559\u767D\u65F6\u8D1F margin \u538B\u5165\u8D34\u5E95\uFF09 */
2328
+ \u4F1A\u8BDD\u89C6\u56FE\u91CC\u7EDD\u5BF9\u5B9A\u4F4D\u5230\u6EDA\u52A8\u5BB9\u5668\u5916\u7684\u5E95\u90E8\uFF08\u907F\u5F00\u6EDA\u52A8\u88C1\u526A\uFF09\uFF0C\u65B0\u5EFA\u4F1A\u8BDD\u89C6\u56FE\u5728\u8F93\u5165\u6846\u540E
2329
+ \u6309\u539F\u6837\u6392\uFF1B\u4F4D\u7F6E\u4E0E\u95F4\u8DDD\u7531\u811A\u672C\u63A7\u5236 */
2308
2330
  .zcodepro-statusbar {
2309
2331
  display: flex;
2310
2332
  justify-content: flex-end;
@@ -2664,12 +2686,12 @@
2664
2686
  return null;
2665
2687
  }
2666
2688
  }
2667
- function listActiveIdsCached(base) {
2689
+ function listActiveIdsCached(base, fresh = false) {
2668
2690
  const key = String(base).replace(/[\\/]+$/, "");
2669
2691
  const now = Date.now();
2670
2692
  const hit = activeIdsCache.get(key);
2671
2693
  if (hit && hit.pending) return hit.pending;
2672
- if (hit && now - hit.doneAt < ACTIVE_IDS_TTL_MS) return Promise.resolve(hit.ids);
2694
+ if (!fresh && hit && now - hit.doneAt < ACTIVE_IDS_TTL_MS) return Promise.resolve(hit.ids);
2673
2695
  const services = findServices();
2674
2696
  const ts = services && services.zcodeTaskService;
2675
2697
  if (!ts || typeof ts.listActiveTaskIds !== "function") return Promise.resolve(null);
@@ -2738,6 +2760,7 @@
2738
2760
  }
2739
2761
  function scan() {
2740
2762
  wsWithRows = /* @__PURE__ */ new Set();
2763
+ const changed = /* @__PURE__ */ new Set();
2741
2764
  for (const el of document.querySelectorAll(TASK_SEL)) {
2742
2765
  const key = el.getAttribute("data-task-item-key") || "";
2743
2766
  const ws = workspaceOf(key);
@@ -2750,10 +2773,21 @@
2750
2773
  set = /* @__PURE__ */ new Set();
2751
2774
  runningByWs.set(ws, set);
2752
2775
  }
2776
+ if (!set.has(key)) changed.add(ws);
2753
2777
  set.add(key);
2754
2778
  } else if (set) {
2755
- set.delete(key);
2779
+ if (set.delete(key)) changed.add(ws);
2780
+ }
2781
+ }
2782
+ if (changed.size) {
2783
+ for (const ws of changed) activeIdsCache.delete(String(ws).replace(/[\\/]+$/, ""));
2784
+ for (const ws of changed) {
2785
+ const set = runningByWs.get(ws);
2786
+ if (set && set.size) continue;
2787
+ const norm3 = (v) => String(v || "").replace(/[\\/]+$/, "");
2788
+ for (const p of [...activeProjectPaths]) if (norm3(p) === norm3(ws)) activeProjectPaths.delete(p);
2756
2789
  }
2790
+ scheduleForceScan();
2757
2791
  }
2758
2792
  syncPeeks();
2759
2793
  apply();
@@ -2841,8 +2875,29 @@
2841
2875
  return { head, cont: contOk ? cont : null, kind };
2842
2876
  }).filter((x) => x.head);
2843
2877
  }
2844
- function globalAnyActive() {
2845
- if (anyActiveCache.value !== null && Date.now() - anyActiveCache.at < 3e4) return anyActiveCache.value;
2878
+ function anySpinLit() {
2879
+ return anyActiveCache.value === true || sectionActive.task || sectionActive.project || sectionActive.pinned || activeProjectPaths.size > 0;
2880
+ }
2881
+ function scheduleGlobalScan() {
2882
+ clearTimeout(globalScanTimer);
2883
+ const wait = anySpinLit() ? 1e4 : 3e4;
2884
+ globalScanTimer = setTimeout(() => {
2885
+ if (!document.hidden && enabled2 && !anyActiveCache.busy) {
2886
+ if (anySpinLit()) globalAnyActive(true);
2887
+ else if (Date.now() - anyActiveCache.at >= 3e4) globalAnyActive();
2888
+ }
2889
+ scheduleGlobalScan();
2890
+ }, wait);
2891
+ }
2892
+ function scheduleForceScan() {
2893
+ if (forceScanTimer) return;
2894
+ forceScanTimer = setTimeout(() => {
2895
+ forceScanTimer = 0;
2896
+ if (!document.hidden && enabled2) globalAnyActive(true);
2897
+ }, 800);
2898
+ }
2899
+ function globalAnyActive(force) {
2900
+ if (!force && anyActiveCache.value !== null && Date.now() - anyActiveCache.at < 3e4) return anyActiveCache.value;
2846
2901
  if (anyActiveCache.busy) return anyActiveCache.value === true;
2847
2902
  anyActiveCache.busy = true;
2848
2903
  sectionActive.task = false;
@@ -2889,7 +2944,8 @@
2889
2944
  }
2890
2945
  projectPaths.set(proj.name, names);
2891
2946
  }
2892
- const pairs = await Promise.all([...scanPaths].map(async (base) => [base, await listActiveIdsCached(base) || []]));
2947
+ const hot = /* @__PURE__ */ new Set([...activeProjectPaths, ...authActiveByWs.keys()]);
2948
+ const pairs = await Promise.all([...scanPaths].map(async (base) => [base, await listActiveIdsCached(base, force && hot.has(base)) || []]));
2893
2949
  for (const [base, ids] of pairs) {
2894
2950
  if (!ids.length) continue;
2895
2951
  byKindByPath.set(base, ids);
@@ -2900,13 +2956,25 @@
2900
2956
  const st = allIds.length ? await rpc("/task-statuses?ids=" + encodeURIComponent(allIds.join(","))).catch(() => null) : null;
2901
2957
  const TERMINAL = /* @__PURE__ */ new Set(["completed", "error", "interrupted"]);
2902
2958
  const recOf = (id) => st && st.ok && st.available ? st.statuses[id] : void 0;
2959
+ const domIdle = /* @__PURE__ */ new Set();
2960
+ const domRunningIds = /* @__PURE__ */ new Set();
2961
+ for (const el of document.querySelectorAll(TASK_SEL)) {
2962
+ const k = el.getAttribute("data-task-item-key") || "";
2963
+ const id = k.slice(k.lastIndexOf(":") + 1);
2964
+ if (!id) continue;
2965
+ if (isRunningRow(el)) domRunningIds.add(id);
2966
+ else domIdle.add(id);
2967
+ }
2968
+ for (const id of domRunningIds) domIdle.delete(id);
2903
2969
  const live = (id) => {
2970
+ if (domIdle.has(id)) return false;
2904
2971
  const rec = recOf(id);
2905
2972
  if (rec === void 0) return true;
2906
2973
  if (!TERMINAL.has(rec.status)) return true;
2907
2974
  return Date.now() - rec.updatedAt < 3e5;
2908
2975
  };
2909
2976
  const liveSession = (id) => {
2977
+ if (domIdle.has(id)) return false;
2910
2978
  const rec = recOf(id);
2911
2979
  if (rec === void 0) return !!domRowKeyOf(id);
2912
2980
  if (!TERMINAL.has(rec.status)) return true;
@@ -3262,7 +3330,7 @@
3262
3330
  if (row) wsTouchAt.set(row, Date.now());
3263
3331
  }, true);
3264
3332
  }
3265
- var installed, enabled2, SCAN_DEBOUNCE_MS, SCAN_FALLBACK_MS, PEEK_FIRST_MS, PEEK_REPEAT_MS, PEEK_SETTLE_MS, PEEK_MAX_MS, PEEK_UNMOUNT_WAIT_MS, CONFIG_POLL_MIN_MS, CONFIG_POLL_MAX_MS, TASK_SEL, WS_SEL, LOADER_FALLBACK_PATHS, runningByWs, peekTimers, activePeeks, peekedWs, wsWithRows, servicesRef, servicesMissAt, ACTIVE_IDS_TTL_MS, ACTIVE_IDS_TIMEOUT_MS, activeIdsCache, synthClick, headInfoCache, PROJECT_HEAD_TEXTS, TASK_HEAD_TEXTS, SEC_SPIN_CLASS, anyActiveCache, sectionActive, activeProjectPaths, authActiveByWs, peekChain, PEEK_EXEMPT_CLASS, cssAttr, TOUCH_WINDOW_MS, wsTouchAt, pollMs, scanDebounce;
3333
+ var installed, enabled2, SCAN_DEBOUNCE_MS, SCAN_FALLBACK_MS, PEEK_FIRST_MS, PEEK_REPEAT_MS, PEEK_SETTLE_MS, PEEK_MAX_MS, PEEK_UNMOUNT_WAIT_MS, CONFIG_POLL_MIN_MS, CONFIG_POLL_MAX_MS, TASK_SEL, WS_SEL, LOADER_FALLBACK_PATHS, runningByWs, peekTimers, activePeeks, peekedWs, wsWithRows, servicesRef, servicesMissAt, ACTIVE_IDS_TTL_MS, ACTIVE_IDS_TIMEOUT_MS, activeIdsCache, synthClick, headInfoCache, PROJECT_HEAD_TEXTS, TASK_HEAD_TEXTS, SEC_SPIN_CLASS, anyActiveCache, sectionActive, activeProjectPaths, authActiveByWs, globalScanTimer, forceScanTimer, peekChain, PEEK_EXEMPT_CLASS, cssAttr, TOUCH_WINDOW_MS, wsTouchAt, pollMs, scanDebounce;
3266
3334
  var init_ws_running = __esm({
3267
3335
  "src/inject/features/ws-running.js"() {
3268
3336
  init_core();
@@ -3314,10 +3382,9 @@
3314
3382
  sectionActive = { task: false, project: false, pinned: false };
3315
3383
  activeProjectPaths = /* @__PURE__ */ new Set();
3316
3384
  authActiveByWs = /* @__PURE__ */ new Map();
3317
- setInterval(() => {
3318
- if (document.hidden || !enabled2) return;
3319
- if (!anyActiveCache.busy && Date.now() - anyActiveCache.at >= 3e4) globalAnyActive();
3320
- }, 3e4);
3385
+ globalScanTimer = 0;
3386
+ scheduleGlobalScan();
3387
+ forceScanTimer = 0;
3321
3388
  peekChain = Promise.resolve();
3322
3389
  PEEK_EXEMPT_CLASS = "zcodepro-peek-exempt";
3323
3390
  cssAttr = (v) => String(v).replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4795,10 +4862,10 @@
4795
4862
  function startImageMenu() {
4796
4863
  if (typeof window === "undefined") return;
4797
4864
  if (typeof navigator.clipboard?.write !== "function" || typeof window.ClipboardItem === "undefined") return;
4798
- let enabled15 = true;
4865
+ let enabled16 = true;
4799
4866
  const refresh = () => {
4800
4867
  void getConfig().then((c) => {
4801
- enabled15 = !(c.features && c.features.imageCopy === false);
4868
+ enabled16 = !(c.features && c.features.imageCopy === false);
4802
4869
  });
4803
4870
  };
4804
4871
  refresh();
@@ -4807,7 +4874,7 @@
4807
4874
  const img = copyTargetOf(e.target, e.clientX, e.clientY);
4808
4875
  if (!img) return;
4809
4876
  e.preventDefault();
4810
- if (enabled15) showMenu(e.clientX, e.clientY, img);
4877
+ if (enabled16) showMenu(e.clientX, e.clientY, img);
4811
4878
  refresh();
4812
4879
  }, true);
4813
4880
  }
@@ -5319,8 +5386,10 @@
5319
5386
  // src/inject/features/styles.js
5320
5387
  init_core();
5321
5388
  var STYLE_DEFAULTS = {
5322
- rowGap: 20,
5323
- // 段落间距:会话内各块之间的垂直间距
5389
+ thinkingRowGap: 20,
5390
+ // 思考段落间距:“已工作/工作中”过程视图内各行之间的距离
5391
+ answerRowGap: 20,
5392
+ // 回答段落间距:回答正文内文本块、回合之间的垂直间距
5324
5393
  listSpacing: 12,
5325
5394
  // 列表上下留白(my-3)
5326
5395
  listItemSpacing: 6,
@@ -5373,34 +5442,57 @@
5373
5442
  var SEL_TABLE = `${CONV} .space-y-4 > div:has(table)`;
5374
5443
  function buildCss(styles) {
5375
5444
  const parts = [];
5376
- const n = styles.rowGap;
5377
- const rowGapSet = typeof n === "number" && Number.isFinite(n) && n >= 0;
5378
- if (rowGapSet) {
5445
+ const num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
5446
+ const tg = num(styles.thinkingRowGap);
5447
+ const ag = num(styles.answerRowGap);
5448
+ const thinkingSet = tg !== null;
5449
+ const answerSet = ag !== null;
5450
+ if (answerSet) {
5379
5451
  parts.push(
5380
5452
  // 回合内外各级容器(SECTION 自身或后代,二者都覆盖)
5381
- `${CONV}.pb-5,${CONV} .pb-5{padding-bottom:${n}px !important;}`,
5382
- `${CONV}.pt-5,${CONV} .pt-5{padding-top:${n}px !important;}`,
5383
- `${CONV} .flex.flex-col.gap-5{gap:${n}px !important;}`,
5384
- `${CONV} .flex.flex-col.gap-4{gap:${n}px !important;}`,
5453
+ `${CONV}.pb-5,${CONV} .pb-5{padding-bottom:${ag}px !important;}`,
5454
+ `${CONV}.pt-5,${CONV} .pt-5{padding-top:${ag}px !important;}`,
5455
+ `${CONV} .flex.flex-col.gap-5{gap:${ag}px !important;}`,
5456
+ `${CONV} .flex.flex-col.gap-4{gap:${ag}px !important;}`,
5385
5457
  // 答案内相邻文本块之间(特殊块除外,走各自间距项)
5386
- `${CONV} .space-y-4 > * + *:not(${SPECIAL}){margin-block-start:${n}px !important;margin-top:${n}px !important;}`,
5458
+ `${CONV} .space-y-4 > * + *:not(${SPECIAL}){margin-block-start:${ag}px !important;margin-top:${ag}px !important;}`,
5387
5459
  // 特殊块后接文本块:去掉文本块的段落间距,避免与特殊块自身留白叠加
5388
5460
  `${CONV} .space-y-4 > ${SPECIAL} + *:not(${SPECIAL}){margin-block-start:0 !important;margin-top:0 !important;}`,
5389
- // 回合内部条目之间(思考触发条 ↔ 正文等)
5390
- `.history-message.flex.flex-col > * + *:not([data-slot="collapsible-content"]){margin-block-start:${n}px !important;margin-top:${n}px !important;}`,
5461
+ // 历史回合里“已工作”展开块之后接回答正文:这段距离算回答间距
5462
+ `.history-message.flex.flex-col > * + *[class~="group/assistant-row"]{margin-block-start:${ag}px !important;margin-top:${ag}px !important;}`,
5391
5463
  // 工具/状态卡片(“N 个文件已更改”等)上方间距下限 8px:
5392
- // 段落间距调到 0 时也不至于贴死(gap 与 margin 在弹性布局里相加)
5393
- `${CONV} .flex.flex-col.gap-5 > [data-slot="collapsible"]{margin-block-start:max(0px, calc(8px - ${n}px)) !important;margin-top:max(0px, calc(8px - ${n}px)) !important;}`
5464
+ // 回答段落间距调到 0 时也不至于贴死(gap 与 margin 在弹性布局里相加)
5465
+ `${CONV} .flex.flex-col.gap-5 > [data-slot="collapsible"]{margin-block-start:max(0px, calc(8px - ${ag}px)) !important;margin-top:max(0px, calc(8px - ${ag}px)) !important;}`
5394
5466
  );
5395
5467
  }
5396
- const own = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : rowGapSet ? n : null;
5468
+ if (thinkingSet) {
5469
+ parts.push(
5470
+ // 过程视图(思考/工具摘要/过程正文)的行块:应用给容器 4px gap + 每行
5471
+ // 12px 上内边距(共 16px)。思考段落间距设置时直接接管:gap 归零、上内边距
5472
+ // 按设置值,总间距等于设置值(设 0 就完全贴紧)
5473
+ `${CONV} [data-conversation-work-items]{gap:0 !important;}`,
5474
+ `${CONV} [data-conversation-work-items] > * + *{padding-top:${tg}px !important;}`,
5475
+ // 过程视图里的叙述正文按思考算(比回答间距规则多一层容器限定,优先命中)
5476
+ `${CONV} [data-conversation-work-items] .space-y-4 > * + *:not(${SPECIAL}){margin-block-start:${tg}px !important;margin-top:${tg}px !important;}`,
5477
+ // 过程视图里特殊块后接文本块同样清零,避免与特殊块自身留白叠加(后写覆盖上一条)
5478
+ `${CONV} [data-conversation-work-items] .space-y-4 > ${SPECIAL} + *:not(${SPECIAL}){margin-block-start:0 !important;margin-top:0 !important;}`,
5479
+ // “已工作”展开块顶部留白(包裹层在历史内容容器内)
5480
+ `${CONV} [data-testid^="chat-assistant-history-content"] .pt-5{padding-top:${tg}px !important;}`,
5481
+ // 历史回合里“已工作”触发行等过程行之间;回答正文那一行走回答间距规则
5482
+ `.history-message.flex.flex-col > * + *:not([data-slot="collapsible-content"]):not([class~="group/assistant-row"]){margin-block-start:${tg}px !important;margin-top:${tg}px !important;}`
5483
+ );
5484
+ }
5485
+ if (thinkingSet || answerSet) {
5486
+ parts.push(`${CONV} .flex.flex-col.gap-5 > [data-zcode-chat-loading-slot]:not(:first-child){margin-block-start:0 !important;margin-top:0 !important;}`);
5487
+ }
5488
+ const own = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : answerSet ? ag : null;
5397
5489
  const ls = own(styles.listSpacing);
5398
5490
  const qc = own(styles.quoteCodeSpacing);
5399
5491
  const tsp = own(styles.tableSpacing);
5400
5492
  const anySet = ls !== null || qc !== null || tsp !== null;
5401
5493
  if (ls !== null) parts.push(`${SEL_LIST}{margin-block:${ls}px !important;}`);
5402
5494
  if (qc !== null) parts.push(`${SEL_QUOTE}{margin-block:${qc}px !important;}`);
5403
- if (rowGapSet || anySet) {
5495
+ if (thinkingSet || answerSet || anySet) {
5404
5496
  parts.push(`${CONV} .space-y-4 > :not(${SPECIAL}){margin-block-end:0 !important;margin-bottom:0 !important;}`);
5405
5497
  }
5406
5498
  if (tsp !== null) {
@@ -5438,7 +5530,20 @@
5438
5530
  const tlh = styles.thinkingLineHeight;
5439
5531
  if (typeof tlh === "number" && Number.isFinite(tlh) && tlh >= 0.8) {
5440
5532
  parts.push(
5441
- `[data-testid^="chat-assistant-history-content"]{line-height:${tlh} !important;}`
5533
+ `[data-testid^="chat-assistant-history-content"]{line-height:${tlh} !important;}`,
5534
+ // 历史回合顶部的“已工作 N 秒”触发行在历史内容容器外,按钮自带 text-ui-base
5535
+ // 的行高,只靠容器继承改不到;直接覆盖,否则调“思考行高”时这行不变
5536
+ `[class~="group/history-message"]{line-height:${tlh} !important;}`,
5537
+ // 用户要求:“已工作”展开块内的内容算思考,块外的才算回答。
5538
+ // 历史视图整轮消息(含回答正文)都在历史内容容器里,容器内的 .space-y-4
5539
+ // 改用思考行高;正在回答的回合里,展开块外的回答正文仍用回答行高。
5540
+ // 放在回答行高规则之后(同特异性,后写的生效)
5541
+ `[data-testid^="chat-assistant-history-content"] .space-y-4{line-height:${tlh} !important;}`,
5542
+ `[data-conversation-work-items] .space-y-4{line-height:${tlh} !important;}`,
5543
+ // 3.18 实时回合的思考正文与“工作中”行在历史容器外,且自带 text-ui-base 的
5544
+ // 行高,只靠继承改不动;直接覆盖,调“思考行高”时正在生成的回合也生效
5545
+ `[data-testid="chat-reasoning-content"] .whitespace-pre-wrap{line-height:${tlh} !important;}`,
5546
+ `[data-testid="chat-loading"] *{line-height:${tlh} !important;}`
5442
5547
  );
5443
5548
  }
5444
5549
  const ulh = styles.userLineHeight;
@@ -5535,7 +5640,8 @@
5535
5640
  });
5536
5641
  }
5537
5642
  var HL_SELECTORS = {
5538
- rowGap: `${CONV} .space-y-4 > *, ${CONV} .flex.flex-col.gap-5 > *`,
5643
+ thinkingRowGap: `${CONV} [data-conversation-work-items] > * + *, .history-message.flex.flex-col > * + *:not([data-slot="collapsible-content"]):not([class~="group/assistant-row"])`,
5644
+ answerRowGap: `${CONV} .space-y-4 > *, ${CONV} .flex.flex-col.gap-5 > *`,
5539
5645
  listSpacing: `${CONV} :is(ul, ol)`,
5540
5646
  listItemSpacing: `${CONV} :is(ul, ol) > li`,
5541
5647
  quoteCodeSpacing: SEL_QUOTE,
@@ -5543,10 +5649,9 @@
5543
5649
  tableCellPaddingV: `${CONV} td, ${CONV} th`,
5544
5650
  tableCellPaddingH: `${CONV} td, ${CONV} th`,
5545
5651
  codeLineHeight: `${CONV} diffs-container, ${CONV} pre`,
5546
- lineHeight: `${CONV} .space-y-4:not([data-reasoning-content] *)`,
5547
- // 思考行高作用在“已工作/工作中”过程视图容器上;视图折叠未挂载时不标
5548
- // (触发行不属此设置范围,不额外描边)
5549
- thinkingLineHeight: `[data-testid^="chat-assistant-history-content"]`,
5652
+ lineHeight: `${CONV} .space-y-4:not([data-reasoning-content] *):not([data-testid^="chat-assistant-history-content"] *):not([data-conversation-work-items] *)`,
5653
+ // 思考行高作用在“已工作/工作中”过程视图、触发行与思考正文上;视图折叠未挂载时不标
5654
+ thinkingLineHeight: `[data-testid^="chat-assistant-history-content"], [class~="group/history-message"], [data-testid="chat-loading"], [data-testid="chat-reasoning-content"]`,
5550
5655
  userLineHeight: `${CONV} [class*="user-row"] .whitespace-pre-wrap`,
5551
5656
  contentWidth: "[data-v4-timeline-content-column]",
5552
5657
  // 双结构:新侧栏项目行 / 旧 testid 行
@@ -5554,7 +5659,8 @@
5554
5659
  sidebarTaskSpacing: "li[data-task-item-key]"
5555
5660
  };
5556
5661
  var HL_MARGIN = {
5557
- rowGap: { sel: `${CONV} .space-y-4 > * + *:not(${SPECIAL}):not(${SPECIAL} + *)`, top: true },
5662
+ thinkingRowGap: { sel: `${CONV} [data-conversation-work-items] > * + *`, top: true, insideTop: true },
5663
+ answerRowGap: { sel: `${CONV} .space-y-4 > * + *:not(${SPECIAL}):not(${SPECIAL} + *)`, top: true },
5558
5664
  listSpacing: { sel: SEL_LIST, top: true, bottom: true },
5559
5665
  listItemSpacing: { sel: `${CONV} :is(ul, ol) > li + li`, top: true },
5560
5666
  quoteCodeSpacing: { sel: SEL_QUOTE, top: true, bottom: true },
@@ -5578,7 +5684,7 @@
5578
5684
  if (margin) {
5579
5685
  const v = typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
5580
5686
  parts.push(`${margin.sel}{position:relative !important;}`);
5581
- if (margin.top) parts.push(`${margin.sel}::before{content:'' !important;position:absolute;left:0;right:0;bottom:100%;height:${v}px;background:${HL_AMBER};pointer-events:none;}`);
5687
+ if (margin.top) parts.push(`${margin.sel}::before{content:'' !important;position:absolute;left:0;right:0;${margin.insideTop ? "top:0" : "bottom:100%"};height:${v}px;background:${HL_AMBER};pointer-events:none;}`);
5582
5688
  if (margin.bottom) parts.push(`${margin.sel}::after{content:'' !important;position:absolute;left:0;right:0;top:100%;height:${v}px;background:${HL_AMBER};pointer-events:none;}`);
5583
5689
  }
5584
5690
  hlEl.textContent = parts.join("");
@@ -5974,18 +6080,37 @@
5974
6080
  }
5975
6081
  var webviewScanTimer = null;
5976
6082
  var wvStyled = [];
6083
+ function cardVeilCss() {
6084
+ const raw = Number((currentTheme.bg || {}).cardVeil);
6085
+ const veil = Number.isFinite(raw) ? raw : 0.2;
6086
+ const rgb = rgbTriple(resolvedColor("--color-background"), isDarkMode() ? "13,13,13" : "248,248,248");
6087
+ return `html,body{background:rgba(${rgb},${veil}) !important}`;
6088
+ }
5977
6089
  function applyWebviewTransparency() {
5978
- const css = "html,body{background:transparent !important}";
5979
- const hook = (w) => {
6090
+ const guestUrl = (w) => {
6091
+ try {
6092
+ return String(w.getURL ? w.getURL() : w.src || "");
6093
+ } catch {
6094
+ return "";
6095
+ }
6096
+ };
6097
+ const maybeCard = (w) => {
6098
+ const u = guestUrl(w);
6099
+ return u === "" || /^zcode-sandbox:\/\//i.test(u);
6100
+ };
6101
+ const hook = (w, css) => {
6102
+ if (!maybeCard(w)) return;
5980
6103
  const on = document.documentElement.classList.contains("zcodepro-bg-on");
5981
6104
  const rec = wvStyled.find((r) => r.el === w);
5982
6105
  if (on && !rec) {
5983
- const entry = { el: w, key: null, handler: null };
6106
+ const entry = { el: w, key: null, css, handler: null };
5984
6107
  entry.handler = () => {
5985
6108
  if (!wvStyled.includes(entry)) return;
6109
+ if (!maybeCard(w)) return;
6110
+ const myCss = entry.css;
5986
6111
  try {
5987
- void w.insertCSS(css).then((k) => {
5988
- if (wvStyled.includes(entry)) entry.key = k;
6112
+ void w.insertCSS(myCss).then((k) => {
6113
+ if (wvStyled.includes(entry) && entry.css === myCss) entry.key = k;
5989
6114
  else {
5990
6115
  try {
5991
6116
  void w.removeCSS(k).catch(() => {
@@ -6001,6 +6126,33 @@
6001
6126
  w.addEventListener("dom-ready", entry.handler);
6002
6127
  wvStyled.push(entry);
6003
6128
  entry.handler();
6129
+ } else if (on && rec && rec.css !== css) {
6130
+ if (!maybeCard(w)) return;
6131
+ rec.css = css;
6132
+ const oldKey = rec.key;
6133
+ rec.key = null;
6134
+ if (oldKey) {
6135
+ try {
6136
+ void w.removeCSS(oldKey).catch(() => {
6137
+ });
6138
+ } catch {
6139
+ }
6140
+ }
6141
+ try {
6142
+ void w.insertCSS(css).then((k) => {
6143
+ if (wvStyled.includes(rec) && rec.css === css) rec.key = k;
6144
+ else {
6145
+ try {
6146
+ void w.removeCSS(k).catch(() => {
6147
+ });
6148
+ } catch {
6149
+ }
6150
+ }
6151
+ }).catch(() => {
6152
+ if (wvStyled.includes(rec) && rec.css === css) rec.css = "";
6153
+ });
6154
+ } catch {
6155
+ }
6004
6156
  } else if (!on && rec) {
6005
6157
  if (rec.handler) w.removeEventListener("dom-ready", rec.handler);
6006
6158
  if (rec.key) {
@@ -6013,7 +6165,10 @@
6013
6165
  wvStyled.splice(wvStyled.indexOf(rec), 1);
6014
6166
  }
6015
6167
  };
6016
- const scan6 = () => document.querySelectorAll("webview").forEach(hook);
6168
+ const scan6 = () => {
6169
+ const css = cardVeilCss();
6170
+ document.querySelectorAll("webview").forEach((w) => hook(w, css));
6171
+ };
6017
6172
  scan6();
6018
6173
  if (!webviewScanTimer) webviewScanTimer = setInterval(scan6, 2e3);
6019
6174
  }
@@ -7432,6 +7587,11 @@
7432
7587
  if (await setFeature("composerProvider", next)) f.composerProvider = next;
7433
7588
  refreshRows();
7434
7589
  }),
7590
+ settingRow(L.featureComposerEditModel, L.featureComposerEditModelDesc, f.composerEditModel !== false, async () => {
7591
+ const next = !(f.composerEditModel !== false);
7592
+ if (await setFeature("composerEditModel", next)) f.composerEditModel = next;
7593
+ refreshRows();
7594
+ }),
7435
7595
  settingRow(L.featureSessionImport, L.featureSessionImportDesc, f.sessionImport !== false, async () => {
7436
7596
  const next = !(f.sessionImport !== false);
7437
7597
  if (await setFeature("sessionImport", next)) f.sessionImport = next;
@@ -7816,10 +7976,11 @@
7816
7976
  styleCell(L.sidebarProjectSpacingName, L.sidebarProjectSpacingDesc, "sidebarProjectSpacing", { max: 24 }),
7817
7977
  styleCell(L.sidebarTaskSpacingName, L.sidebarTaskSpacingDesc, "sidebarTaskSpacing", { max: 24 }),
7818
7978
  widthCell,
7819
- styleCell(L.rowGapName, L.rowGapDesc, "rowGap"),
7820
7979
  styleCell(L.userLineHeightName, L.userLineHeightDesc, "userLineHeight", { min: 1, max: 3, step: 0.05, unit: "x" }),
7821
- styleCell(L.lineHeightName, L.lineHeightDesc, "lineHeight", { min: 1, max: 3, step: 0.05, unit: "x" }),
7822
7980
  styleCell(L.thinkingLineHeightName, L.thinkingLineHeightDesc, "thinkingLineHeight", { min: 1, max: 3, step: 0.05, unit: "x" }),
7981
+ styleCell(L.thinkingRowGapName, L.thinkingRowGapDesc, "thinkingRowGap"),
7982
+ styleCell(L.lineHeightName, L.lineHeightDesc, "lineHeight", { min: 1, max: 3, step: 0.05, unit: "x" }),
7983
+ styleCell(L.answerRowGapName, L.answerRowGapDesc, "answerRowGap"),
7823
7984
  styleCell(L.codeLineHeightName, L.codeLineHeightDesc, "codeLineHeight", { min: 1, max: 3, step: 0.05, unit: "x" }),
7824
7985
  styleCell(L.listSpacingName, L.listSpacingDesc, "listSpacing"),
7825
7986
  styleCell(L.listItemSpacingName, L.listItemSpacingDesc, "listItemSpacing"),
@@ -8552,6 +8713,19 @@
8552
8713
  void saveTheme({ bg: { dialogFrost: !(themeCfg.bg.dialogFrost !== false) } });
8553
8714
  });
8554
8715
  };
8716
+ const cardVeilRow = () => sliderRow(
8717
+ L.themeBgCardVeil,
8718
+ "",
8719
+ 0,
8720
+ 100,
8721
+ 1,
8722
+ Math.round(numOr(themeCfg.bg.cardVeil, 0.2) * 100),
8723
+ "%",
8724
+ (v) => {
8725
+ void saveTheme({ bg: { cardVeil: v / 100 } });
8726
+ },
8727
+ L.themeBgCardVeilHint
8728
+ );
8555
8729
  const urlInput = h("input", { type: "url", value: themeCfg.bg.url, class: themeInputCls, placeholder: "https://..." });
8556
8730
  urlInput.addEventListener("change", () => {
8557
8731
  const v = urlInput.value.trim();
@@ -8803,6 +8977,7 @@
8803
8977
  pauseCheck("pauseOnBlur", L.themeBgPauseBlur),
8804
8978
  pauseCheck("pauseOnBattery", L.themeBgPauseBattery)
8805
8979
  ),
8980
+ themeCfg.bg.mode !== "none" ? cardVeilRow() : null,
8806
8981
  dialogFrostRow()
8807
8982
  )),
8808
8983
  bgInput
@@ -11311,6 +11486,8 @@
11311
11486
  var enabled4 = true;
11312
11487
  var items = DEFAULT_STATUS_ITEMS.map((x) => ({ ...x }));
11313
11488
  var barEl = null;
11489
+ var liftedPane = null;
11490
+ var BAR_LIFT = 10;
11314
11491
  var lastStats = null;
11315
11492
  var lastSid = null;
11316
11493
  var statsSid = null;
@@ -11544,26 +11721,68 @@
11544
11721
  return null;
11545
11722
  }
11546
11723
  }
11724
+ function clipPane(el) {
11725
+ for (let n = el.parentElement; n && n !== document.body; n = n.parentElement) {
11726
+ if (/(auto|scroll|hidden)/.test(getComputedStyle(n).overflowY)) return n;
11727
+ }
11728
+ return null;
11729
+ }
11547
11730
  function renderBar() {
11548
11731
  const ta = composerEl();
11549
11732
  const host = ta && (ta.closest("form") || ta.parentElement);
11550
11733
  if (!enabled4 || !host || !host.parentElement) {
11551
11734
  if (barEl) barEl.remove();
11552
11735
  barEl = null;
11736
+ if (liftedPane) {
11737
+ liftedPane.style.marginBottom = "";
11738
+ liftedPane = null;
11739
+ }
11553
11740
  lastRenderedHtml = null;
11554
11741
  return;
11555
11742
  }
11556
- if (!barEl || !barEl.isConnected) {
11743
+ const hasSession = !!selectedSessionId();
11744
+ const pane = hasSession ? clipPane(host) : null;
11745
+ const mount = pane && pane.parentElement && getComputedStyle(pane.parentElement).position !== "static" ? pane.parentElement : host.parentElement;
11746
+ if (!barEl || !barEl.isConnected || barEl.parentElement !== mount) {
11557
11747
  if (!barEl) {
11558
11748
  barEl = document.createElement("div");
11559
11749
  barEl.className = "zcodepro-statusbar";
11560
11750
  lastRenderedHtml = null;
11561
11751
  }
11562
- host.parentElement.insertBefore(barEl, host.nextSibling);
11752
+ if (mount === host.parentElement) mount.insertBefore(barEl, host.nextSibling);
11753
+ else mount.append(barEl);
11754
+ }
11755
+ if (mount !== host.parentElement) {
11756
+ if (liftedPane && liftedPane !== pane) liftedPane.style.marginBottom = "";
11757
+ liftedPane = pane;
11758
+ liftedPane.style.marginBottom = `${BAR_LIFT}px`;
11759
+ const hr = host.getBoundingClientRect();
11760
+ const mr = mount.getBoundingClientRect();
11761
+ barEl.style.position = "absolute";
11762
+ barEl.style.left = `${Math.round(hr.left - mr.left - mount.clientLeft)}px`;
11763
+ barEl.style.width = `${Math.round(hr.width)}px`;
11764
+ barEl.style.top = `${Math.round(hr.bottom - mr.top - mount.clientTop)}px`;
11765
+ const below = innerHeight - mr.bottom;
11766
+ barEl.style.bottom = `${below >= 0 && below <= 8 ? Math.round(mr.bottom - innerHeight) : 0}px`;
11767
+ barEl.style.zIndex = "20";
11768
+ barEl.style.marginBottom = "0";
11769
+ barEl.style.paddingTop = "0";
11770
+ barEl.style.paddingBottom = "0";
11771
+ } else {
11772
+ if (liftedPane) {
11773
+ liftedPane.style.marginBottom = "";
11774
+ liftedPane = null;
11775
+ }
11776
+ barEl.style.position = "";
11777
+ barEl.style.left = "";
11778
+ barEl.style.width = "";
11779
+ barEl.style.top = "";
11780
+ barEl.style.bottom = "";
11781
+ barEl.style.zIndex = "";
11782
+ barEl.style.paddingTop = "";
11783
+ barEl.style.marginBottom = hasSession ? "-14px" : "0";
11784
+ barEl.style.paddingBottom = hasSession ? "0" : "7px";
11563
11785
  }
11564
- const hasSession = !!selectedSessionId();
11565
- barEl.style.marginBottom = hasSession ? "-14px" : "0";
11566
- barEl.style.paddingBottom = hasSession ? "0" : "7px";
11567
11786
  const L = t();
11568
11787
  const entries = [];
11569
11788
  for (const it of items) {
@@ -12432,11 +12651,11 @@
12432
12651
  async function injectHoverButtons() {
12433
12652
  const cfg = await getConfig();
12434
12653
  if (!cfg || !cfg.titleGen) return;
12435
- const enabled15 = cfg.titleGen.hoverBtn !== false;
12654
+ const enabled16 = cfg.titleGen.hoverBtn !== false;
12436
12655
  const L = t();
12437
12656
  for (const area of document.querySelectorAll(ACTIONS_SEL)) {
12438
12657
  const existing = area.querySelector('[data-zcodepro-item="auto-rename"]');
12439
- if (!enabled15) {
12658
+ if (!enabled16) {
12440
12659
  existing?.remove();
12441
12660
  continue;
12442
12661
  }
@@ -14079,6 +14298,273 @@
14079
14298
  apply4();
14080
14299
  }
14081
14300
 
14301
+ // src/inject/features/composer-edit-model.js
14302
+ init_core();
14303
+ var TRIGGER_SEL2 = '[data-testid="chat-model-select-trigger"]';
14304
+ var PROVIDER_TRIGGER_SEL = '[data-testid="composer-provider-trigger"]';
14305
+ var EDIT_BAR_SEL = '[data-testid="v4-composer-edit-bar"]';
14306
+ var EDIT_BTN_PREFIX = "v4-edit-";
14307
+ var ITEM_PREFIX = "chat-model-select-item-";
14308
+ var GROUP_PREFIX = "chat-model-select-group-";
14309
+ var installed10 = false;
14310
+ var enabled15 = true;
14311
+ var modelBeforeEdit = null;
14312
+ var pendingEdit = false;
14313
+ var editRequestAt = 0;
14314
+ var providerListAt = 0;
14315
+ var applying = false;
14316
+ function currentModelValue() {
14317
+ const trigger = document.querySelector(TRIGGER_SEL2);
14318
+ return trigger ? trigger.getAttribute("data-model-current-value") || "" : "";
14319
+ }
14320
+ function decodeProviderId(value) {
14321
+ if (!value || !value.startsWith("custom:")) return null;
14322
+ const body = value.slice("custom:".length);
14323
+ const index = body.indexOf(":");
14324
+ const encoded = index < 0 ? body : body.slice(0, index);
14325
+ try {
14326
+ return decodeURIComponent(encoded);
14327
+ } catch {
14328
+ return encoded;
14329
+ }
14330
+ }
14331
+ function findByTestId(exact) {
14332
+ return [...document.querySelectorAll("[data-testid]")].find(
14333
+ (el) => el.getAttribute("data-testid") === exact
14334
+ ) || null;
14335
+ }
14336
+ function clickModelItem(value) {
14337
+ const item = findByTestId(ITEM_PREFIX + value);
14338
+ if (!item) return false;
14339
+ item.click();
14340
+ return true;
14341
+ }
14342
+ function openProviderList() {
14343
+ const trigger = document.querySelector(PROVIDER_TRIGGER_SEL);
14344
+ if (!trigger) return false;
14345
+ trigger.focus();
14346
+ for (const name of ["pointerenter", "mouseenter", "mousemove"]) {
14347
+ trigger.dispatchEvent(new MouseEvent(name, { bubbles: true, cancelable: true, view: window }));
14348
+ }
14349
+ trigger.click();
14350
+ return true;
14351
+ }
14352
+ function openProviderGroup(providerId) {
14353
+ const group = findByTestId(GROUP_PREFIX + "registry-provider:" + providerId);
14354
+ if (!group) {
14355
+ if (Date.now() - providerListAt > 400) {
14356
+ providerListAt = Date.now();
14357
+ openProviderList();
14358
+ }
14359
+ return false;
14360
+ }
14361
+ group.focus();
14362
+ for (const name of ["pointerenter", "mouseenter", "mousemove"]) {
14363
+ group.dispatchEvent(new MouseEvent(name, { bubbles: true, cancelable: true, view: window }));
14364
+ }
14365
+ group.click();
14366
+ return true;
14367
+ }
14368
+ function menuIsOpen() {
14369
+ return Boolean(
14370
+ document.querySelector(`[data-testid^="${ITEM_PREFIX}"]`) || document.querySelector(`[data-testid^="${GROUP_PREFIX}"]`)
14371
+ );
14372
+ }
14373
+ function openModelMenu() {
14374
+ const trigger = document.querySelector(TRIGGER_SEL2);
14375
+ if (!trigger || trigger.disabled || trigger.getAttribute("aria-disabled") === "true") {
14376
+ return false;
14377
+ }
14378
+ if (trigger.getAttribute("aria-expanded") === "true" || menuIsOpen()) return true;
14379
+ trigger.focus();
14380
+ const base = {
14381
+ bubbles: true,
14382
+ cancelable: true,
14383
+ composed: true,
14384
+ view: window,
14385
+ button: 0,
14386
+ pointerId: 1,
14387
+ pointerType: "mouse",
14388
+ isPrimary: true
14389
+ };
14390
+ trigger.dispatchEvent(new PointerEvent("pointerdown", { ...base, buttons: 1 }));
14391
+ trigger.dispatchEvent(new PointerEvent("pointerup", { ...base, buttons: 0 }));
14392
+ trigger.click();
14393
+ return true;
14394
+ }
14395
+ function setModelDirect(value) {
14396
+ const trigger = document.querySelector(TRIGGER_SEL2);
14397
+ if (!trigger) return false;
14398
+ const fiberKey = Object.keys(trigger).find((k) => k.startsWith("__reactFiber$"));
14399
+ if (!fiberKey) return false;
14400
+ let fiber = trigger[fiberKey];
14401
+ for (let i = 0; fiber && i < 80; i += 1) {
14402
+ const props = fiber.memoizedProps || {};
14403
+ if (props.composerOptions && typeof props.composerOptions === "object" && typeof props.onValueChange === "function") {
14404
+ try {
14405
+ props.onValueChange(value);
14406
+ return true;
14407
+ } catch {
14408
+ return false;
14409
+ }
14410
+ }
14411
+ fiber = fiber.return;
14412
+ }
14413
+ return false;
14414
+ }
14415
+ function applyModel(value) {
14416
+ if (!setModelDirect(value)) {
14417
+ selectModel(value);
14418
+ return;
14419
+ }
14420
+ setTimeout(() => {
14421
+ if (!enabled15 || !document.querySelector(EDIT_BAR_SEL)) return;
14422
+ if (currentModelValue() !== value) selectModel(value);
14423
+ }, 300);
14424
+ }
14425
+ function closeModelMenu() {
14426
+ const base = {
14427
+ bubbles: true,
14428
+ cancelable: true,
14429
+ composed: true,
14430
+ view: window,
14431
+ button: 0,
14432
+ pointerId: 1,
14433
+ pointerType: "mouse",
14434
+ isPrimary: true
14435
+ };
14436
+ document.body.dispatchEvent(new PointerEvent("pointerdown", { ...base, buttons: 1 }));
14437
+ document.body.dispatchEvent(new PointerEvent("pointerup", { ...base, buttons: 0 }));
14438
+ document.body.dispatchEvent(new MouseEvent("click", { ...base, buttons: 0 }));
14439
+ }
14440
+ function selectModel(value) {
14441
+ if (applying || !enabled15) return;
14442
+ if (currentModelValue() === value) return;
14443
+ applying = true;
14444
+ let attempts = 0;
14445
+ let groupOpened = false;
14446
+ const step = () => {
14447
+ if (!enabled15 || currentModelValue() === value) {
14448
+ applying = false;
14449
+ return;
14450
+ }
14451
+ if (!menuIsOpen()) {
14452
+ openModelMenu();
14453
+ groupOpened = false;
14454
+ }
14455
+ if (clickModelItem(value)) {
14456
+ setTimeout(() => {
14457
+ closeModelMenu();
14458
+ applying = false;
14459
+ }, 100);
14460
+ return;
14461
+ }
14462
+ const providerId = decodeProviderId(value);
14463
+ if (providerId) {
14464
+ if (!groupOpened) groupOpened = openProviderGroup(providerId);
14465
+ } else {
14466
+ for (const group of document.querySelectorAll(`[data-testid^="${GROUP_PREFIX}"]`)) {
14467
+ group.focus();
14468
+ for (const name of ["pointerenter", "mouseenter", "mousemove"]) {
14469
+ group.dispatchEvent(
14470
+ new MouseEvent(name, { bubbles: true, cancelable: true, view: window })
14471
+ );
14472
+ }
14473
+ group.click();
14474
+ if (clickModelItem(value)) {
14475
+ applying = false;
14476
+ return;
14477
+ }
14478
+ }
14479
+ }
14480
+ attempts += 1;
14481
+ if (attempts < 20) setTimeout(step, 120);
14482
+ else {
14483
+ applying = false;
14484
+ console.warn("[zcodepro] composer-edit-model: \u6CA1\u80FD\u9009\u56DE\u6A21\u578B " + value);
14485
+ }
14486
+ };
14487
+ if (!menuIsOpen() && !openModelMenu()) {
14488
+ applying = false;
14489
+ return;
14490
+ }
14491
+ setTimeout(step, 80);
14492
+ }
14493
+ function onEditClick(event) {
14494
+ if (!enabled15) return;
14495
+ const target = event.target;
14496
+ if (!(target instanceof Element)) return;
14497
+ if (!target.closest(`[data-testid^="${EDIT_BTN_PREFIX}"]`)) return;
14498
+ const value = currentModelValue();
14499
+ if (document.querySelector(EDIT_BAR_SEL)) return;
14500
+ if (!value) return;
14501
+ modelBeforeEdit = value;
14502
+ pendingEdit = true;
14503
+ editRequestAt = Date.now();
14504
+ }
14505
+ function onMutate() {
14506
+ if (!enabled15) return;
14507
+ const bar = document.querySelector(EDIT_BAR_SEL);
14508
+ if (!bar) {
14509
+ if (!pendingEdit || Date.now() - editRequestAt > 3e3) {
14510
+ pendingEdit = false;
14511
+ modelBeforeEdit = null;
14512
+ }
14513
+ applying = false;
14514
+ return;
14515
+ }
14516
+ if (!pendingEdit || !modelBeforeEdit) return;
14517
+ if (Date.now() - editRequestAt > 3e3) {
14518
+ pendingEdit = false;
14519
+ modelBeforeEdit = null;
14520
+ return;
14521
+ }
14522
+ pendingEdit = false;
14523
+ const target = modelBeforeEdit;
14524
+ let checks = 0;
14525
+ const tick7 = () => {
14526
+ if (!enabled15 || !document.querySelector(EDIT_BAR_SEL)) return;
14527
+ const current2 = currentModelValue();
14528
+ if (current2 && current2 !== target) {
14529
+ const official2 = current2;
14530
+ applyModel(target);
14531
+ const watch = (left) => {
14532
+ if (!enabled15 || !document.querySelector(EDIT_BAR_SEL)) return;
14533
+ if (currentModelValue() === official2 && left > 0) {
14534
+ applyModel(target);
14535
+ setTimeout(() => watch(left - 1), 400);
14536
+ }
14537
+ };
14538
+ setTimeout(() => watch(2), 400);
14539
+ return;
14540
+ }
14541
+ checks += 1;
14542
+ if (checks < 16) setTimeout(tick7, 50);
14543
+ };
14544
+ setTimeout(tick7, 60);
14545
+ }
14546
+ function startComposerEditModel() {
14547
+ if (installed10 || typeof document === "undefined") return;
14548
+ installed10 = true;
14549
+ void getConfig().then((cfg) => {
14550
+ enabled15 = cfg.features ? cfg.features.composerEditModel !== false : true;
14551
+ }).catch(() => {
14552
+ });
14553
+ window.addEventListener("zcodepro:config-changed", () => {
14554
+ void getConfig(true).then((cfg) => {
14555
+ enabled15 = cfg.features ? cfg.features.composerEditModel !== false : true;
14556
+ if (!enabled15) {
14557
+ pendingEdit = false;
14558
+ modelBeforeEdit = null;
14559
+ }
14560
+ }).catch(() => {
14561
+ });
14562
+ });
14563
+ document.addEventListener("click", onEditClick, true);
14564
+ new MutationObserver(onMutate).observe(document.body, { childList: true, subtree: true });
14565
+ onMutate();
14566
+ }
14567
+
14082
14568
  // src/inject/index.js
14083
14569
  init_ui();
14084
14570
  (function zcodeproInject() {
@@ -14223,6 +14709,10 @@
14223
14709
  startComposerProvider();
14224
14710
  } catch {
14225
14711
  }
14712
+ try {
14713
+ startComposerEditModel();
14714
+ } catch {
14715
+ }
14226
14716
  try {
14227
14717
  startSettingsEntry();
14228
14718
  } catch {