zcode-pro 1.6.2 → 1.7.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/dist/inject.js CHANGED
@@ -185,23 +185,29 @@
185
185
  switchAttention: "r"
186
186
  // 打开运行中 / 未查看
187
187
  };
188
- STATUS_SESSION_IDS = /* @__PURE__ */ new Set(["ctx", "questions", "tokRate"]);
188
+ STATUS_SESSION_IDS = /* @__PURE__ */ new Set(["ctx", "questions", "tokRate", "inOut", "avgHit"]);
189
189
  STATUS_GLOBAL_IDS = /* @__PURE__ */ new Set(["todayTokens", "totalTokens", "tasks"]);
190
190
  DEFAULT_TURN_ITEMS = [
191
191
  { id: "turnIn", on: true },
192
192
  // 输入
193
193
  { id: "turnOut", on: true },
194
194
  // 输出
195
+ { id: "turnTps", on: true },
196
+ // TPS(输出 ÷ 净生成秒数,官方口径)
195
197
  { id: "turnCache", on: true }
196
198
  // 缓存命中率
197
199
  ];
198
200
  DEFAULT_STATUS_ITEMS = [
199
201
  { id: "tokRate", on: true },
200
202
  // 最近输出 tokens/s(60 秒窗口,本会话)
203
+ { id: "avgHit", on: true },
204
+ // 平均缓存命中率(本会话)
205
+ { id: "inOut", on: true },
206
+ // 累计输入/输出(本会话主轮请求)
201
207
  { id: "ctx", on: true },
202
208
  // 上下文占用
203
209
  { id: "questions", on: true },
204
- // 提问次数
210
+ // 主请求数(官方 model_usage 口径)
205
211
  { id: "todayTokens", on: true },
206
212
  // 今日 token(今天的会话记录完整,数据准确)
207
213
  { id: "totalTokens", on: true },
@@ -259,7 +265,7 @@
259
265
  proxyPlaceholder: "http://127.0.0.1:7890",
260
266
  proxySave: "\u4FDD\u5B58",
261
267
  proxySaved: "\u4EE3\u7406\u8BBE\u7F6E\u5DF2\u4FDD\u5B58",
262
- proxyHint: "\u7559\u7A7A\u4FDD\u5B58\u5373\u6E05\u9664\u4EE3\u7406\u3002",
268
+ proxyHint: "\u7559\u7A7A\u4FDD\u5B58\u5373\u6E05\u9664\u624B\u586B\u4EE3\u7406\uFF1AWindows \u8DDF\u968F\u7CFB\u7EDF\u4EE3\u7406\uFF0C\u5176\u4ED6\u5E73\u53F0\u76F4\u8FDE\u3002",
263
269
  proxyTest: "\u68C0\u6D4B",
264
270
  proxyTesting: "\u68C0\u6D4B\u4E2D\u2026",
265
271
  proxyTestEmpty: "\u8BF7\u5148\u8F93\u5165\u4EE3\u7406\u5730\u5740",
@@ -331,6 +337,8 @@
331
337
  devReload: "\u91CD\u8F7D ZCode Pro",
332
338
  devReloading: "\u91CD\u8F7D\u4E2D\u2026",
333
339
  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",
340
+ devToolsSwitch: "\u5F00\u53D1\u8005\u5DE5\u5177",
341
+ 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",
334
342
  rowGapName: "\u6BB5\u843D\u95F4\u8DDD",
335
343
  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",
336
344
  listSpacingName: "\u5217\u8868\u4E0A\u4E0B\u8FB9\u8DDD",
@@ -400,6 +408,10 @@
400
408
  autoRenameDone: "\u5DF2\u91CD\u547D\u540D\uFF1A",
401
409
  featureWsRunning: "\u6298\u53E0\u65F6\u4EFB\u52A1\u8FD0\u884C\u4E2D\u63D0\u793A",
402
410
  featureWsRunningDesc: "\u6709\u4F1A\u8BDD\u8FD0\u884C\u65F6\uFF0C\u6298\u53E0\u7684\u9879\u76EE\u4E0E\u4EFB\u52A1\u5206\u533A\u5934\u663E\u793A\u52A0\u8F7D\u56FE\u6807\uFF0C\u5168\u90E8\u7ED3\u675F\u6D88\u5931\u3002",
411
+ featureSubagentIcon: "\u5B50\u4EE3\u7406\u8FD0\u884C\u4E2D\u63D0\u793A",
412
+ featureSubagentIconDesc: "\u540E\u53F0\u5B50\u4EE3\u7406\u5728\u8DD1\u663E\u673A\u5668\u4EBA\u3001\u540E\u53F0\u7EC8\u7AEF\u547D\u4EE4\u5728\u8DD1\u663E\u7EC8\u7AEF\u56FE\u6807\uFF08\u540C\u65F6\u5728\u8DD1\u673A\u5668\u4EBA\u4F18\u5148\uFF09\uFF1B\u672A\u8BFB\u5706\u70B9\u8BA9\u4F4D\u5230\u884C\u5C3E\u5E38\u663E\uFF1B\u4F1A\u8BDD\u8FD0\u884C\u4E2D\u59CB\u7EC8\u663E\u793A\u8F6C\u5708\u56FE\u6807\uFF1B\u9879\u76EE\u672A\u8BFB\u5FBD\u6807\u5FFD\u7565\u9519\u8BEF\u884C\u3002",
413
+ subagentRobotTip: "\u5B50\u4EE3\u7406\u8FD0\u884C\u4E2D",
414
+ subagentTermTip: "\u540E\u53F0\u547D\u4EE4\u8FD0\u884C\u4E2D",
403
415
  tabPerformance: "\u6027\u80FD",
404
416
  perfDesc: "ZCode \u4E3A\u6BCF\u4E2A\u6253\u5F00\u8FC7\u7684\u9879\u76EE\u5E38\u9A7B\u4E00\u4E2A\u4F1A\u8BDD\u8FDB\u7A0B\uFF0C\u5E94\u7528\u81EA\u8EAB\u4E0D\u4F1A\u56DE\u6536\uFF0C\u9879\u76EE\u591A\u4E86\u5185\u5B58\u5360\u7528\u5C31\u9AD8\u3002\u5F00\u542F\u540E\uFF0C\u957F\u65F6\u95F4\u672A\u4F7F\u7528\u4E14\u6CA1\u6709\u4EFB\u52A1\u5728\u8DD1\u7684\u9879\u76EE\u4F1A\u88AB\u81EA\u52A8\u91CA\u653E\uFF1A\u4F1A\u8BDD\u8BB0\u5F55\u4E0D\u53D7\u5F71\u54CD\uFF0C\u518D\u6B21\u6253\u5F00\u65F6\u81EA\u52A8\u6062\u590D\uFF0C\u4EC5\u9996\u6B21\u56DE\u590D\u6709\u51E0\u79D2\u7B49\u5F85\u3002\u6B63\u5728\u4F7F\u7528\u7684\u9879\u76EE\u3001\u8FD0\u884C\u4E2D\u7684\u4F1A\u8BDD\u4E0E\u540E\u53F0\u547D\u4EE4\u3001\u5B9A\u65F6\u4EFB\u52A1\u90FD\u4E0D\u4F1A\u88AB\u56DE\u6536\u3002\u540E\u53F0\u547D\u4EE4\u68C0\u6D4B\u4F9D\u8D56\u7CFB\u7EDF\u8FDB\u7A0B\u4FE1\u606F\uFF08Linux / macOS / Windows \u5404\u8D70\u7CFB\u7EDF\u81EA\u5E26\u5DE5\u5177\uFF09\uFF0C\u68C0\u6D4B\u4E0D\u53EF\u7528\u65F6\u529F\u80FD\u81EA\u52A8\u505C\u7528\u3002",
405
417
  featureIdleReclaim: "\u7A7A\u95F2\u9879\u76EE\u5185\u5B58\u56DE\u6536",
@@ -451,7 +463,7 @@
451
463
  tabStatusPane: "\u72B6\u6001\u680F",
452
464
  themeColorsPane: "\u4E3B\u9898",
453
465
  themeBgRegions: "\u5206\u533A\u80CC\u666F",
454
- themeBgRegionFollow: "\u8DDF\u968F\u5168\u5C40\u58C1\u7EB8",
466
+ themeBgRegionFollow: "\u9ED8\u8BA4\uFF08\u5168\u5C40\u58C1\u7EB8\uFF09",
455
467
  themeBgRegionLeft: "\u5DE6\u4FA7\u8FB9\u680F",
456
468
  themeBgRegionCenter: "\u4E2D\u95F4\u533A\u57DF",
457
469
  themeBgRegionRight: "\u53F3\u4FA7\u8FB9\u680F",
@@ -504,7 +516,7 @@
504
516
  themeBgDialogFrost: "\u8BBE\u7F6E\u5F39\u7A97\u78E8\u7802",
505
517
  themeBgMisc: "\u5176\u4ED6",
506
518
  themeBgFollowGlobal: "\u8DDF\u968F\u5168\u5C40",
507
- themeBgRegionsHint: "\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",
519
+ 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",
508
520
  themeBgPlayback: "\u64AD\u653E\uFF08\u89C6\u9891\u58C1\u7EB8\uFF09",
509
521
  themeBgVolume: "\u97F3\u91CF",
510
522
  themeBgVolumeHint: "\u89C6\u9891\u58C1\u7EB8\u7684\u97F3\u8F68\u97F3\u91CF\uFF0C0 = \u9759\u97F3\uFF08\u9ED8\u8BA4\uFF09",
@@ -524,7 +536,9 @@
524
536
  tableCopied: "\u8868\u683C\u5DF2\u590D\u5236",
525
537
  sbItemCtx: "\u4E0A\u4E0B\u6587\u5360\u7528",
526
538
  sbItemTokRate: "\u6700\u8FD1\u8F93\u51FA tokens/s",
527
- sbItemQuestions: "\u63D0\u95EE\u6B21\u6570",
539
+ sbItemQuestions: "\u4E3B\u8BF7\u6C42\u6570\uFF08\u672C\u4F1A\u8BDD\uFF09",
540
+ sbItemInOut: "\u7D2F\u8BA1\u8F93\u5165/\u8F93\u51FA\uFF08\u672C\u4F1A\u8BDD\u4E3B\u8F6E\u8BF7\u6C42\uFF09",
541
+ sbItemHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D\u7387\uFF08\u672C\u4F1A\u8BDD\uFF09",
528
542
  sbMaster: "\u542F\u7528\u7EDF\u8BA1",
529
543
  sbMasterDesc: "\u603B\u5F00\u5173\uFF1A\u5173\u95ED\u540E\u8F93\u5165\u6846\u53F3\u4E0B\u89D2\u7684\u7EDF\u8BA1\u884C\u4E0E\u6BCF\u8F6E\u56DE\u7B54\u7684\u7528\u91CF\u6807\u6CE8\u4E00\u8D77\u505C\u7528\u3002",
530
544
  sbGroupSession: "\u4F1A\u8BDD\u7EDF\u8BA1\uFF08\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\uFF09",
@@ -533,8 +547,11 @@
533
547
  sbLabelIn: "\u8F93\u5165",
534
548
  sbLabelOut: "\u8F93\u51FA",
535
549
  sbLabelCache: "\u7F13\u5B58",
550
+ sbLabelTps: "\u8F93\u51FA tok/s",
551
+ sbLabelInOut: "\u8F93\u5165/\u8F93\u51FA",
552
+ sbLabelHit: "\u5E73\u5747\u547D\u4E2D",
536
553
  turnUsageTitle: "\u672C\u8F6E token",
537
- sbLabelQuestions: "\u63D0\u95EE",
554
+ sbLabelQuestions: "\u4E3B\u8BF7\u6C42\u6570",
538
555
  sbItemTodayTokens: "\u4ECA\u65E5 token",
539
556
  sbItemTasks: "\u4EFB\u52A1\u603B\u6570",
540
557
  sbLabelCtx: "\u4E0A\u4E0B\u6587",
@@ -723,6 +740,10 @@
723
740
  headroomInterval: "\u76D1\u89C6\u95F4\u9694",
724
741
  headroomIntervalDesc: "\u7701\u7535\u76D1\u89C6\u5668\u8F6E\u8BE2\u7535\u6E90\u72B6\u6001\u7684\u95F4\u9694\uFF0810\u20133600 \u79D2\uFF0C\u9ED8\u8BA4 60\uFF09\uFF1B\u4FDD\u5B58\u540E\u4ECE\u4E0B\u4E00\u8F6E\u5DE1\u68C0\u8D77\u751F\u6548\u3002",
725
742
  headroomSecUnit: "\u79D2",
743
+ serenaSwitch: "Serena \u8BED\u4E49\u68C0\u7D22",
744
+ serenaSwitchDesc: "\u6CE8\u518C Serena MCP\uFF1A\u7528\u7B26\u53F7\u5B9A\u4F4D\u3001\u5F15\u7528\u67E5\u627E\u7B49\u8BED\u4E49\u5DE5\u5177\u4EE3\u66FF\u6574\u6587\u4EF6\u8BFB\u53D6\uFF0C\u7701 token\u3002\u5199\u5165 ZCode MCP \u914D\u7F6E\uFF0C\u91CD\u542F\u4F1A\u8BDD\u540E\u751F\u6548\u3002",
745
+ serenaEnabled: "\u5DF2\u5F00\u542F Serena\uFF0C\u91CD\u542F\u4F1A\u8BDD\u540E\u751F\u6548",
746
+ serenaDisabled: "\u5DF2\u5173\u95ED Serena\uFF0C\u91CD\u542F\u4F1A\u8BDD\u540E\u79FB\u9664",
726
747
  upgradeCheck: "\u68C0\u67E5\u66F4\u65B0",
727
748
  upgradeChecking: "\u68C0\u67E5\u4E2D\u2026",
728
749
  upgradeUpToDate: "\u5DF2\u662F\u6700\u65B0\uFF08{v}\uFF09",
@@ -845,7 +866,7 @@
845
866
  proxyPlaceholder: "http://127.0.0.1:7890",
846
867
  proxySave: "Save",
847
868
  proxySaved: "Proxy settings saved.",
848
- proxyHint: "Save empty to clear the proxy.",
869
+ proxyHint: "Save empty to clear the manual proxy; Windows then follows the system proxy, other platforms connect directly.",
849
870
  proxyTest: "Test",
850
871
  proxyTesting: "Testing\u2026",
851
872
  proxyTestEmpty: "Enter a proxy address first",
@@ -915,6 +936,8 @@
915
936
  syncVerSaved: "Saved to",
916
937
  devModeDesc: 'For development: after changing zcode-pro code, click "Reload ZCode Pro" instead of restarting ZCode. It builds automatically (when running from the source repo), restarts the ZCode Pro launcher process (fresh helper and injected script), and every ZCode window refreshes and re-injects. The ZCode app itself and all sessions stay untouched.',
917
938
  devReload: "Reload ZCode Pro",
939
+ devToolsSwitch: "Developer tools",
940
+ 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.',
918
941
  devReloading: "Reloading\u2026",
919
942
  devReloadDesc: "Every ZCode window refreshes automatically within 2-3 seconds to load the new script.",
920
943
  rowGapName: "Paragraph spacing",
@@ -985,6 +1008,10 @@
985
1008
  autoRenameDone: "Renamed: ",
986
1009
  featureWsRunning: "Running indicator when collapsed",
987
1010
  featureWsRunningDesc: "Collapsed project and task headers show a loader while sessions run.",
1011
+ featureSubagentIcon: "Subagent running indicator",
1012
+ featureSubagentIconDesc: "Task rows show a robot icon while subagents run and a terminal icon while background commands run (robot wins when both); the unread dot moves to the row end; running sessions always show a spinner; project unread badges ignore error rows.",
1013
+ subagentRobotTip: "Subagents running",
1014
+ subagentTermTip: "Background commands running",
988
1015
  tabPerformance: "Performance",
989
1016
  perfDesc: "ZCode keeps a session process resident for every project you have opened and never reclaims it, so memory grows with projects. When enabled, projects unused for a while with nothing running release their memory automatically: sessions are untouched and reload when reopened, with a few seconds' wait on the first reply. The project in use, running sessions, background commands and scheduled tasks are never reclaimed. Background-command detection reads system process info via built-in tools (Linux / macOS / Windows); when unavailable, the feature disables itself.",
990
1017
  featureIdleReclaim: "Idle project memory reclaim",
@@ -1036,7 +1063,7 @@
1036
1063
  tabStatusPane: "Status bar",
1037
1064
  themeColorsPane: "Theme",
1038
1065
  themeBgRegions: "Regional backgrounds",
1039
- themeBgRegionFollow: "Follow global",
1066
+ themeBgRegionFollow: "Default (global)",
1040
1067
  themeBgRegionLeft: "Left sidebar",
1041
1068
  themeBgRegionCenter: "Center area",
1042
1069
  themeBgRegionRight: "Right sidebar",
@@ -1089,7 +1116,7 @@
1089
1116
  themeBgDialogFrost: "Frosted settings window",
1090
1117
  themeBgMisc: "Other",
1091
1118
  themeBgFollowGlobal: "Follow global",
1092
- themeBgRegionsHint: '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.',
1119
+ 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.',
1093
1120
  themeBgPlayback: "Playback (video)",
1094
1121
  themeBgVolume: "Volume",
1095
1122
  themeBgVolumeHint: "Audio track volume of video wallpapers, 0 = muted (default)",
@@ -1109,7 +1136,9 @@
1109
1136
  tableCopied: "Table copied",
1110
1137
  sbItemCtx: "Context usage",
1111
1138
  sbItemTokRate: "Recent output tokens/s",
1112
- sbItemQuestions: "Questions asked",
1139
+ sbItemQuestions: "Main requests (this session)",
1140
+ sbItemInOut: "Total input/output (main requests, this session)",
1141
+ sbItemHit: "Average cache hit rate (this session)",
1113
1142
  sbMaster: "Enable statistics",
1114
1143
  sbMasterDesc: "Master switch: turning this off disables both the input-box statistics and per-turn labels.",
1115
1144
  sbGroupSession: "Session statistics (follows the current session)",
@@ -1118,8 +1147,11 @@
1118
1147
  sbLabelIn: "in",
1119
1148
  sbLabelOut: "out",
1120
1149
  sbLabelCache: "cache",
1150
+ sbLabelTps: "out tok/s",
1151
+ sbLabelInOut: "in/out",
1152
+ sbLabelHit: "avg hit",
1121
1153
  turnUsageTitle: "Turn tokens",
1122
- sbLabelQuestions: "asks",
1154
+ sbLabelQuestions: "reqs",
1123
1155
  sbItemTodayTokens: "Tokens today",
1124
1156
  sbItemTasks: "Tasks",
1125
1157
  sbLabelCtx: "ctx",
@@ -1308,6 +1340,10 @@
1308
1340
  headroomInterval: "Watch interval",
1309
1341
  headroomIntervalDesc: "Seconds between power checks (10\u20133600, default 60); applies from the next round.",
1310
1342
  headroomSecUnit: "s",
1343
+ serenaSwitch: "Serena semantic search",
1344
+ serenaSwitchDesc: "Registers the Serena MCP: symbol lookup and reference search instead of reading whole files, saving tokens. Written to the ZCode MCP config; takes effect after restarting the session.",
1345
+ serenaEnabled: "Serena enabled; takes effect after restarting the session",
1346
+ serenaDisabled: "Serena disabled; removed after restarting the session",
1311
1347
  upgradeCheck: "Check for updates",
1312
1348
  upgradeChecking: "Checking\u2026",
1313
1349
  upgradeUpToDate: "Up to date ({v})",
@@ -1417,9 +1453,12 @@
1417
1453
  "headroom-action": "The headroom action failed",
1418
1454
  "headroom-status": "Failed to read the headroom status",
1419
1455
  "headroom-update": "headroom update failed",
1456
+ "serena-config-unreadable": "ZCode config is unparseable; aborted writing",
1420
1457
  "ZCODE_NOT_FOUND": "ZCode executable not found",
1421
1458
  "plugins-status": "Failed to read the plugin list",
1422
1459
  "plugins-update": "Failed to update plugins",
1460
+ "plugins-market-git": "Git is missing and GitHub is unreachable. Install Git or set a proxy in ZCode Pro \u2192 Proxy, then retry.",
1461
+ "plugins-market-network": "Cannot reach GitHub. If your network needs a proxy, set it in ZCode Pro \u2192 Proxy, then retry.",
1423
1462
  "sync-invalid": "Invalid sync settings",
1424
1463
  "sync-not-configured": "Set the sync type to WebDAV and save the config first",
1425
1464
  "sync-remote-missing": "No synced data on the server yet; upload from another computer first",
@@ -2270,6 +2309,14 @@
2270
2309
  /* \u6298\u53E0\u9879\u76EE\u8FD0\u884C\u63D0\u793A\uFF1Afolder \u56FE\u6807\u8BA9\u4F4D\u7ED9 loader\uFF08loader \u7531\u811A\u672C\u63D2\u5165\uFF0C
2271
2310
  folder \u53EF\u80FD\u88AB React \u968F\u65F6\u91CD\u5EFA\uFF0C\u9760\u7C7B\u9009\u62E9\u5668\u7EDF\u4E00\u9690\u85CF\uFF0C\u540E\u4EE3\u5199\u6CD5\u517C\u5BB9\u5305\u88C5\u5C42\uFF09 */
2272
2311
  span.zcodepro-ws-running svg:not(.zcodepro-ws-loader) { display: none !important; }
2312
+ /* \u5B50\u4EE3\u7406\u8FD0\u884C\u63D0\u793A\uFF08subagent-icon.js\uFF09\uFF1A\u6298\u53E0\u9879\u76EE folder \u8BA9\u4F4D\u7ED9\u673A\u5668\u4EBA/\u7EC8\u7AEF\uFF0C
2313
+ loader \u5728\u8F6C\u65F6\uFF08zcodepro-ws-loader\uFF09\u4F18\u5148\u663E\u793A\uFF0C\u4E0D\u8DDF\u673A\u5668\u4EBA\u4E92\u76F8\u85CF */
2314
+ span.zcodepro-subagent-on svg:not(.zcodepro-subagent-icon):not(.zcodepro-terminal-icon):not(.zcodepro-ws-loader) { display: none !important; }
2315
+ /* \u672A\u8BFB\u5706\u70B9\u8BA9\u4F4D\u673A\u5668\u4EBA\uFF1A\u539F\u70B9\u9690\u85CF\uFF0C\u884C\u5C3E\u590D\u5236\u54C1\u5E38\u663E\uFF08\u4E0D\u8DDF\u60AC\u6D6E\u64CD\u4F5C\u56FE\u6807\u4E00\u8D77\u9690\u85CF\uFF09 */
2316
+ li.zcodepro-subagent-unread-moved [data-unread-indicator] { display: none !important; }
2317
+ .zcodepro-subagent-unread-tail { display: inline-flex; align-items: center; align-self: center; }
2318
+ /* \u9879\u76EE\u84DD\u8272\u672A\u8BFB\u5FBD\u6807\u5FFD\u7565\u9519\u8BEF\u884C\uFF1A\u9879\u76EE\u91CC\u672A\u8BFB\u5168\u662F\u9519\u8BEF\u6001\uFF08\u7EA2\u70B9\uFF09\u65F6\u4E0D\u4EAE\u84DD\u5FBD\u6807 */
2319
+ .zcodepro-unread-error-only [data-workspace-unread-indicator] { display: none !important; }
2273
2320
  /* \u65E0\u611F\u63A2\u67E5\u671F\u95F4\u76D6\u5728\u9879\u76EE\u884C\u4E0A\u7684\u51BB\u7ED3\u514B\u9686\uFF1A\u56FA\u5B9A\u5B9A\u4F4D\u3001\u4E0D\u54CD\u5E94\u6307\u9488 */
2274
2321
  .zcodepro-ws-frozen {
2275
2322
  position: fixed;
@@ -3556,13 +3603,15 @@
3556
3603
  return;
3557
3604
  }
3558
3605
  if (k === hotkeys.switchRecent) {
3559
- if (!e.repeat && !popupEl && !openPopupInflight) {
3560
- if (!mru.length) {
3561
- showToast(t().switcherEmpty, "warning");
3562
- return;
3563
- }
3564
- await openPopup("mru");
3606
+ if (e.repeat) return;
3607
+ if (openPopupInflight) await openPopupInflight;
3608
+ if (popupEl && popupMode !== "attention") return;
3609
+ if (!mru.length) {
3610
+ showToast(t().switcherEmpty, "warning");
3611
+ return;
3565
3612
  }
3613
+ if (popupEl) closePopup(false);
3614
+ await openPopup("mru");
3566
3615
  return;
3567
3616
  }
3568
3617
  if (openPopupInflight) {
@@ -4654,10 +4703,10 @@
4654
4703
  function startImageMenu() {
4655
4704
  if (typeof window === "undefined") return;
4656
4705
  if (typeof navigator.clipboard?.write !== "function" || typeof window.ClipboardItem === "undefined") return;
4657
- let enabled14 = true;
4706
+ let enabled15 = true;
4658
4707
  const refresh = () => {
4659
4708
  void getConfig().then((c) => {
4660
- enabled14 = !(c.features && c.features.imageCopy === false);
4709
+ enabled15 = !(c.features && c.features.imageCopy === false);
4661
4710
  });
4662
4711
  };
4663
4712
  refresh();
@@ -4666,7 +4715,7 @@
4666
4715
  const img = copyTargetOf(e.target, e.clientX, e.clientY);
4667
4716
  if (!img) return;
4668
4717
  e.preventDefault();
4669
- if (enabled14) showMenu(e.clientX, e.clientY, img);
4718
+ if (enabled15) showMenu(e.clientX, e.clientY, img);
4670
4719
  refresh();
4671
4720
  }, true);
4672
4721
  }
@@ -4735,7 +4784,7 @@
4735
4784
  function waitFor(getter, timeoutMs, step) {
4736
4785
  const start = Date.now();
4737
4786
  return new Promise((resolve, reject) => {
4738
- const tick6 = () => {
4787
+ const tick7 = () => {
4739
4788
  let v = null;
4740
4789
  try {
4741
4790
  v = getter();
@@ -4749,9 +4798,9 @@
4749
4798
  reject(new Error(step));
4750
4799
  return;
4751
4800
  }
4752
- setTimeout(tick6, 120);
4801
+ setTimeout(tick7, 120);
4753
4802
  };
4754
- tick6();
4803
+ tick7();
4755
4804
  });
4756
4805
  }
4757
4806
  function setReactInputValue(input, value) {
@@ -6260,9 +6309,9 @@
6260
6309
  clearWallpaper();
6261
6310
  return;
6262
6311
  }
6263
- const tick6 = () => showFile(files[nextIdx(files.length)], "folder");
6264
- wpTickFn = tick6;
6265
- tick6();
6312
+ const tick7 = () => showFile(files[nextIdx(files.length)], "folder");
6313
+ wpTickFn = tick7;
6314
+ tick7();
6266
6315
  armRotateTimer(bg);
6267
6316
  return;
6268
6317
  }
@@ -6357,8 +6406,8 @@
6357
6406
  clearInterval(st.timer);
6358
6407
  st.timer = null;
6359
6408
  }
6360
- const setState = (image, tick6) => {
6361
- regionState[region] = { sig, image, tick: tick6, timer: null, interval: 0 };
6409
+ const setState = (image, tick7) => {
6410
+ regionState[region] = { sig, image, tick: tick7, timer: null, interval: 0 };
6362
6411
  if (image) addRule(region, image);
6363
6412
  };
6364
6413
  const drop = () => {
@@ -6461,6 +6510,82 @@
6461
6510
  }
6462
6511
  }
6463
6512
 
6513
+ // src/inject/features/plugin-updates.js
6514
+ init_core();
6515
+ init_ui();
6516
+ var NOTIFIED_KEY = "zcodepro-plugin-updates-notified";
6517
+ var AUTO_UPDATE_LAUNCH_KEY = "zcodepro-plugin-autoupdate-launch";
6518
+ var AUTO_UPDATE_SESSION_KEY = "zcodepro-plugin-autoupdate-session-claim";
6519
+ function autoUpdateLaunchMark() {
6520
+ try {
6521
+ const raw = new URLSearchParams(location.search).get("zcodeLaunchMarks");
6522
+ if (raw) {
6523
+ const createdAt = JSON.parse(raw)?.createdAt;
6524
+ if (createdAt != null) return `launch:${createdAt}`;
6525
+ }
6526
+ } catch {
6527
+ }
6528
+ try {
6529
+ let id = sessionStorage.getItem("zcodepro-plugin-autoupdate-session");
6530
+ if (!id) {
6531
+ id = `session:${Date.now()}:${Math.random().toString(36).slice(2)}`;
6532
+ sessionStorage.setItem("zcodepro-plugin-autoupdate-session", id);
6533
+ }
6534
+ return id;
6535
+ } catch {
6536
+ return `memory:${Date.now()}:${Math.random().toString(36).slice(2)}`;
6537
+ }
6538
+ }
6539
+ var memoryClaimed = false;
6540
+ var LAUNCH_MARK = autoUpdateLaunchMark();
6541
+ function claimIn(storage, key, mark) {
6542
+ try {
6543
+ if (storage.getItem(key) === mark) return false;
6544
+ storage.setItem(key, mark);
6545
+ return true;
6546
+ } catch {
6547
+ return null;
6548
+ }
6549
+ }
6550
+ function claimAutoUpdateRun() {
6551
+ const mark = LAUNCH_MARK;
6552
+ const local = typeof localStorage === "undefined" ? null : localStorage;
6553
+ const viaLocal = local ? claimIn(local, AUTO_UPDATE_LAUNCH_KEY, mark) : null;
6554
+ if (viaLocal !== null) return viaLocal;
6555
+ const session = typeof sessionStorage === "undefined" ? null : sessionStorage;
6556
+ const viaSession = session ? claimIn(session, AUTO_UPDATE_SESSION_KEY, mark) : null;
6557
+ if (viaSession !== null) return viaSession;
6558
+ if (memoryClaimed) return false;
6559
+ memoryClaimed = true;
6560
+ return true;
6561
+ }
6562
+ async function startPluginUpdateCheck() {
6563
+ const status = await rpc("/plugins/status");
6564
+ if (!status.ok || !Array.isArray(status.updates)) return;
6565
+ const L = t();
6566
+ if (status.updates.length === 0) return;
6567
+ const config = await getConfig();
6568
+ if ((config.features || {}).autoUpdatePlugins === true) {
6569
+ if (!claimAutoUpdateRun()) return;
6570
+ const res = await rpc("/plugins/update", { method: "POST", body: {} });
6571
+ if (res.ok) showToast(L.pluginsAutoUpdated, "success");
6572
+ else showToast(L.pluginsUpdateFailed + ": " + (res.error || ""), "error");
6573
+ return;
6574
+ }
6575
+ const sig = status.updates.map((u) => `${u.name}:${u.installed}>${u.latest}`).join(",");
6576
+ let seen2 = "";
6577
+ try {
6578
+ seen2 = window.localStorage.getItem(NOTIFIED_KEY) || "";
6579
+ } catch {
6580
+ }
6581
+ if (seen2 === sig) return;
6582
+ try {
6583
+ window.localStorage.setItem(NOTIFIED_KEY, sig);
6584
+ } catch {
6585
+ }
6586
+ showToast(L.pluginsUpdatesAvailable.replaceAll("{n}", String(status.updates.length)), "info");
6587
+ }
6588
+
6464
6589
  // src/inject/features/settings-dialog.js
6465
6590
  function openExternal(url) {
6466
6591
  try {
@@ -6546,7 +6671,7 @@
6546
6671
  setState(L.upgradeFound.replaceAll("{v}", res.latest || ""));
6547
6672
  btn.textContent = L.upgradeNow;
6548
6673
  };
6549
- const tick6 = async () => {
6674
+ const tick7 = async () => {
6550
6675
  const res = await rpc(endpoint + "/upgrade");
6551
6676
  if (!res.ok) {
6552
6677
  stopPoll();
@@ -6586,9 +6711,9 @@
6586
6711
  btn.textContent = L.upgradeStop;
6587
6712
  setState(L.upgradeRunning);
6588
6713
  timer = setInterval(() => {
6589
- void tick6();
6714
+ void tick7();
6590
6715
  }, 1500);
6591
- void tick6();
6716
+ void tick7();
6592
6717
  };
6593
6718
  void (async () => {
6594
6719
  const res = await rpc(endpoint + "/upgrade");
@@ -6731,11 +6856,11 @@
6731
6856
  const cfg = await getConfig(true).catch(() => null);
6732
6857
  const res = await rpc("/plugins/status");
6733
6858
  if (!res.ok) {
6734
- setPluginsStatus("");
6859
+ setPluginsStatus(errText(res));
6735
6860
  return;
6736
6861
  }
6737
6862
  const n = (res.updates || []).length;
6738
- if (cfg && (cfg.features || {}).autoUpdatePlugins === true && n > 0) {
6863
+ if (cfg && (cfg.features || {}).autoUpdatePlugins === true && n > 0 && claimAutoUpdateRun()) {
6739
6864
  void runPluginsUpdate();
6740
6865
  return;
6741
6866
  }
@@ -6837,6 +6962,11 @@
6837
6962
  if (await setFeature("wsRunningSpin", next)) f.wsRunningSpin = next;
6838
6963
  refreshRows();
6839
6964
  }),
6965
+ settingRow(L.featureSubagentIcon, L.featureSubagentIconDesc, f.subagentIcon !== false, async () => {
6966
+ const next = !(f.subagentIcon !== false);
6967
+ if (await setFeature("subagentIcon", next)) f.subagentIcon = next;
6968
+ refreshRows();
6969
+ }),
6840
6970
  settingRow(L.featureNewtabPanels, L.featureNewtabPanelsDesc, f.newtabPanels !== false, async () => {
6841
6971
  const next = !(f.newtabPanels !== false);
6842
6972
  if (await setFeature("newtabPanels", next)) f.newtabPanels = next;
@@ -7313,7 +7443,7 @@
7313
7443
  };
7314
7444
  const sbList = h("div", { class: "divide-y divide-border rounded-xl border border-border" });
7315
7445
  const sbGlobalList = h("div", { class: "divide-y divide-border rounded-xl border border-border" });
7316
- const TURN_NAMES = { turnIn: "sbLabelIn", turnOut: "sbLabelOut", turnCache: "sbLabelCache" };
7446
+ const TURN_NAMES = { turnIn: "sbLabelIn", turnOut: "sbLabelOut", turnTps: "sbLabelTps", turnCache: "sbLabelCache" };
7317
7447
  const turnItems = () => {
7318
7448
  const saved = config.statusBar && Array.isArray(config.statusBar.turnItems) ? config.statusBar.turnItems : null;
7319
7449
  if (!saved) return DEFAULT_TURN_ITEMS.map((x) => ({ ...x }));
@@ -8453,11 +8583,6 @@
8453
8583
  }, "shrink-0");
8454
8584
  const runProxyTest = async () => {
8455
8585
  if (proxyTesting) return;
8456
- if (!proxyInput.value.trim()) {
8457
- proxyTestState.className = "mt-2 text-ui-xs/relaxed text-amber-500";
8458
- proxyTestState.textContent = L.proxyTestEmpty;
8459
- return;
8460
- }
8461
8586
  proxyTesting = true;
8462
8587
  proxyTestBtn.disabled = true;
8463
8588
  proxyTestBtn.textContent = L.proxyTesting;
@@ -9004,11 +9129,53 @@
9004
9129
  }
9005
9130
  }, 2e3);
9006
9131
  };
9132
+ const DT_KEYS = ["zcode:developer-tools:enabled", "zcode:token-debug:enabled"];
9133
+ const dtRead = (v) => v !== null && !["0", "false", "off", "no"].includes(v.trim().toLowerCase());
9134
+ const dtOn = () => DT_KEYS.some((k) => dtRead(localStorage.getItem(k)));
9135
+ const dtSet = (on) => {
9136
+ for (const k of DT_KEYS) {
9137
+ if (on) localStorage.setItem(k, "true");
9138
+ else localStorage.removeItem(k);
9139
+ }
9140
+ };
9141
+ const dtSwitchBtn = (checked) => h("button", {
9142
+ type: "button",
9143
+ role: "switch",
9144
+ "aria-checked": String(checked),
9145
+ class: "relative inline-flex shrink-0 cursor-pointer items-center"
9146
+ }, h(
9147
+ "span",
9148
+ { class: "zcodepro-switch", "data-zcodepro-switch": "", "data-state": checked ? "on" : "off" },
9149
+ h("span", { class: "zcodepro-switch-knob" })
9150
+ ));
9151
+ const devToolsRow = () => {
9152
+ const sw = dtSwitchBtn(dtOn());
9153
+ return h(
9154
+ "div",
9155
+ {
9156
+ class: "flex cursor-pointer items-center justify-between gap-2 px-2 py-1.5",
9157
+ onClick: () => {
9158
+ dtSet(!dtOn());
9159
+ const n = dtOn();
9160
+ sw.setAttribute("aria-checked", String(n));
9161
+ sw.firstElementChild.setAttribute("data-state", n ? "on" : "off");
9162
+ }
9163
+ },
9164
+ h(
9165
+ "div",
9166
+ { class: "min-w-0" },
9167
+ h("div", { class: "text-ui-sm font-medium text-foreground" }, L.devToolsSwitch),
9168
+ h("div", { class: "mt-0.5 text-ui-xs/relaxed text-foreground-subtle" }, L.devToolsSwitchDesc)
9169
+ ),
9170
+ sw
9171
+ );
9172
+ };
9007
9173
  paneDebug.append(
9008
9174
  h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.devModeDesc),
9009
9175
  h(
9010
9176
  "div",
9011
- { class: "mt-3 rounded-xl border border-border" },
9177
+ { class: "mt-3 divide-y divide-border rounded-xl border border-border" },
9178
+ devToolsRow(),
9012
9179
  h(
9013
9180
  "div",
9014
9181
  { class: "flex items-center justify-between gap-2 px-2 py-1.5" },
@@ -9022,7 +9189,13 @@
9022
9189
  )
9023
9190
  )
9024
9191
  );
9025
- const VISION_DEFAULT_PROMPT = "\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5168\u90E8\u5185\u5BB9\u3002\u82E5\u662F\u754C\u9762\u6216\u56FE\u8868\u622A\u56FE\uFF0C\u8BF7\u5148\u628A\u6240\u6709\u9519\u8BEF\u3001\u8B66\u544A\u3001\u5F02\u5E38\u72B6\u6001\u9010\u5B57\u5F15\u7528\u51FA\u6765\uFF08\u542B\u5B8C\u6574\u539F\u6587\uFF09\uFF0C\u518D\u63CF\u8FF0\u6574\u4F53\u5E03\u5C40\u3001\u6587\u5B57\u4E0E\u5173\u952E\u6570\u636E\u3002";
9192
+ const VISION_DEFAULT_PROMPT_ZH = "\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5168\u90E8\u5185\u5BB9\u3002\u82E5\u662F\u754C\u9762\u6216\u56FE\u8868\u622A\u56FE\uFF0C\u8BF7\u5148\u628A\u6240\u6709\u9519\u8BEF\u3001\u8B66\u544A\u3001\u5F02\u5E38\u72B6\u6001\u9010\u5B57\u5F15\u7528\u51FA\u6765\uFF08\u542B\u5B8C\u6574\u539F\u6587\uFF09\uFF0C\u518D\u63CF\u8FF0\u6574\u4F53\u5E03\u5C40\u3001\u6587\u5B57\u4E0E\u5173\u952E\u6570\u636E\u3002";
9193
+ const VISION_DEFAULT_PROMPT_EN = "Describe the entire content of this image in detail. If it is a UI or chart screenshot, first quote every error, warning, and abnormal state verbatim (including the full text), then describe the overall layout, text, and key data.";
9194
+ const VISION_DEFAULT_PROMPT = isZhLocale() ? VISION_DEFAULT_PROMPT_ZH : VISION_DEFAULT_PROMPT_EN;
9195
+ const isBuiltinVisionPrompt = (p) => {
9196
+ const text = String(p || "").trim();
9197
+ return text === VISION_DEFAULT_PROMPT_ZH || text === VISION_DEFAULT_PROMPT_EN;
9198
+ };
9026
9199
  const VISION_DEFAULT_CFG = {
9027
9200
  enabled: true,
9028
9201
  chainMode: "fallback",
@@ -9039,6 +9212,11 @@
9039
9212
  // forceIntercept 不写:缺省 = 自动(跟随宿主「模型设置」图片开关,zcode-vision ≥1.7.9)
9040
9213
  };
9041
9214
  let visionCfg = visionRes.ok && visionRes.config && typeof visionRes.config === "object" ? structuredClone(visionRes.config) : null;
9215
+ if (visionCfg && Array.isArray(visionCfg.proxies)) {
9216
+ for (const proxy of visionCfg.proxies) {
9217
+ if (isBuiltinVisionPrompt(proxy.prompt)) proxy.prompt = VISION_DEFAULT_PROMPT;
9218
+ }
9219
+ }
9042
9220
  let visionAutoInitTried = false;
9043
9221
  let visionSaveTimer = null;
9044
9222
  const persistVision = async () => {
@@ -9868,6 +10046,24 @@
9868
10046
  );
9869
10047
  };
9870
10048
  renderHrUsageSwitch();
10049
+ const hrSerenaRow = h("div");
10050
+ const renderSerenaSwitch = () => {
10051
+ const serenaOn = !!(headroomRes.serena && headroomRes.serena.enabled);
10052
+ hrSerenaRow.replaceChildren(
10053
+ settingRow(L.serenaSwitch, L.serenaSwitchDesc, serenaOn, async () => {
10054
+ const next = !serenaOn;
10055
+ const res = await rpc("/headroom", { method: "POST", body: { serena: next } });
10056
+ if (!res.ok) {
10057
+ showToast(L.failed + ": " + errText(res), "error");
10058
+ return;
10059
+ }
10060
+ if (res.serena) headroomRes.serena = res.serena;
10061
+ renderSerenaSwitch();
10062
+ showToast(next ? L.serenaEnabled : L.serenaDisabled, "success");
10063
+ })
10064
+ );
10065
+ };
10066
+ renderSerenaSwitch();
9871
10067
  const hrRefreshBtn = btnSmall(L.headroomRefresh, () => {
9872
10068
  void hrRefresh();
9873
10069
  });
@@ -10062,7 +10258,8 @@
10062
10258
  )
10063
10259
  ),
10064
10260
  hrPwrHint
10065
- )
10261
+ ),
10262
+ h("div", { class: "mt-2 rounded-xl border border-border p-1" }, hrSerenaRow)
10066
10263
  );
10067
10264
  };
10068
10265
  renderHeadroomPane();
@@ -10643,6 +10840,9 @@
10643
10840
  }
10644
10841
  var lastRenderedHtml = null;
10645
10842
  function selectedSessionId() {
10843
+ const pane = document.querySelector("[data-session-id]");
10844
+ const pid = pane ? pane.getAttribute("data-session-id") : "";
10845
+ if (pid && /^(?:sess|session)_/.test(pid)) return pid;
10646
10846
  const row = document.querySelector("[data-task-item-key].bg-selected");
10647
10847
  const key = row ? row.getAttribute("data-task-item-key") : "";
10648
10848
  const i = key.lastIndexOf(":sess");
@@ -10752,12 +10952,14 @@
10752
10952
  }
10753
10953
  var GLOBAL_GROUP = /* @__PURE__ */ new Set(["todayTokens", "totalTokens", "tasks"]);
10754
10954
  var SB_ICONS = {
10755
- tokRate: '<path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>',
10955
+ tokRate: '<path d="m12 11 4-4"/><path d="M3.34 16a10 10 0 1 1 17.32 0"/>',
10756
10956
  ctx: '<path d="M21.21 15.89A10 10 0 1 1 8 2.83"/><path d="M22 12A10 10 0 0 0 12 2v10z"/>',
10757
10957
  asks: '<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>',
10758
10958
  today: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
10759
10959
  total: '<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',
10760
10960
  tasks: '<rect x="3" y="5" width="6" height="6" rx="1"/><path d="m3 17 2 2 4-4"/><path d="M13 6h8"/><path d="M13 12h8"/><path d="M13 18h8"/>',
10961
+ inOut: '<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',
10962
+ hit: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a2 2 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a2 2 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',
10761
10963
  coins: '<circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="m16.71 13.88.7.71-2.82 2.82"/>'
10762
10964
  };
10763
10965
  var sbIcon = (name) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="zcodepro-sb-icon">${SB_ICONS[name]}</svg>`;
@@ -10785,15 +10987,14 @@
10785
10987
  case "tokRate": {
10786
10988
  const sid = selectedSessionId();
10787
10989
  if (!sid) return null;
10788
- const streaming = streamEst && Date.now() - streamEst.at < 6e3;
10789
- const r = g && g.rate60 && statsSid === sid ? g.rate60 : null;
10990
+ const s = lastStats && statsSid === sid ? lastStats.sessionSummary : null;
10991
+ const tps = s && s.tps != null ? s.tps : null;
10790
10992
  const est = streamEst ? streamEst.value : null;
10791
- const useEst = !!streaming || !(r && r.out > 0);
10792
- const shown = useEst ? est : r.out;
10993
+ const shown = tps != null ? tps : est;
10793
10994
  if (shown == null) return null;
10794
10995
  const zh2 = isZhLocale();
10795
- const estMark = useEst && est != null ? "\u2248" : "";
10796
- const detail = r ? `${L.sbLabelOut} ${r.out.toLocaleString()} tok/s \xB7 ${zh2 ? "\u603B\u91CF" : "total"} ${r.total.toLocaleString()} tok/s` : zh2 ? "\u65E0 usage \u6570\u636E\uFF0C\u6309\u6587\u672C\u589E\u957F\u4F30\u7B97" : "no usage data, estimated from text growth";
10996
+ const estMark = tps == null && est != null ? "\u2248" : "";
10997
+ const detail = tps != null ? `${L.sbLabelOut} ${tps.toLocaleString()} tok/s${zh2 ? "\uFF08\u5B98\u65B9\u51C0\u751F\u6210\u53E3\u5F84\uFF0C\u672C\u4F1A\u8BDD\u6811\uFF09" : " (net generation, session tree)"}` : zh2 ? "\u65E0 usage \u6570\u636E\uFF0C\u6309\u6587\u672C\u589E\u957F\u4F30\u7B97" : "no usage data, estimated from text growth";
10797
10998
  return {
10798
10999
  html: sbIcon("tokRate") + label(L.sbLabelOut) + `<b>${estMark}${fmtNum(Math.round(shown * 10) / 10)} tok/s</b>`,
10799
11000
  title: `${L.sbItemTokRate}${zh2 ? "\uFF08\u672C\u4F1A\u8BDD\uFF09\uFF1A" : " (this session): "}${detail}`,
@@ -10814,9 +11015,22 @@
10814
11015
  return null;
10815
11016
  }
10816
11017
  case "questions": {
10817
- const nav = document.querySelector('[data-testid="v4-turn-navigator"]');
10818
- const n = nav ? Number(nav.getAttribute("data-item-count")) : 0;
10819
- return n > 0 ? { html: sbIcon("asks") + label(L.sbLabelQuestions) + String(n), title: L.sbItemQuestions } : null;
11018
+ const s = lastStats && statsSid === selectedSessionId() ? lastStats.sessionSummary : null;
11019
+ return s && s.requests > 0 ? { html: sbIcon("asks") + label(L.sbLabelQuestions) + String(s.requests), title: L.sbItemQuestions } : null;
11020
+ }
11021
+ case "inOut": {
11022
+ const s = lastStats && statsSid === selectedSessionId() ? lastStats.sessionSummary : null;
11023
+ return s && s.totalIn + s.totalOut > 0 ? {
11024
+ html: sbIcon("inOut") + label(L.sbLabelInOut) + `${fmtNum(s.totalIn)}/${fmtNum(s.totalOut)}`,
11025
+ title: `${L.sbItemInOut}${isZhLocale() ? "\uFF1A" : ": "}${s.totalIn.toLocaleString()} / ${s.totalOut.toLocaleString()}`
11026
+ } : null;
11027
+ }
11028
+ case "avgHit": {
11029
+ const s = lastStats && statsSid === selectedSessionId() ? lastStats.sessionSummary : null;
11030
+ return s && s.hitRate != null ? {
11031
+ html: sbIcon("hit") + label(L.sbLabelHit) + `${(s.hitRate * 100).toFixed(2)}%`,
11032
+ title: `${L.sbItemHit}${isZhLocale() ? "\uFF1A" : ": "}${(s.hitRate * 100).toFixed(2)}%`
11033
+ } : null;
10820
11034
  }
10821
11035
  case "todayTokens": {
10822
11036
  const n = official && official.todayTokens != null ? official.todayTokens : g ? g.todayTokens : 0;
@@ -10851,7 +11065,7 @@
10851
11065
  }
10852
11066
  host.parentElement.insertBefore(barEl, host.nextSibling);
10853
11067
  }
10854
- const hasSession = !!document.querySelector("[data-task-item-key].bg-selected");
11068
+ const hasSession = !!selectedSessionId();
10855
11069
  barEl.style.marginBottom = hasSession ? "-14px" : "0";
10856
11070
  barEl.style.paddingBottom = hasSession ? "0" : "7px";
10857
11071
  const L = t();
@@ -10946,11 +11160,12 @@
10946
11160
  // src/inject/features/turn-usage.js
10947
11161
  init_core();
10948
11162
  var enabled5 = true;
10949
- var recentTurns = [];
11163
+ var rounds = [];
10950
11164
  var scanTimer = 0;
10951
11165
  var turnCfg = [
10952
11166
  { id: "turnIn", on: true },
10953
11167
  { id: "turnOut", on: true },
11168
+ { id: "turnTps", on: true },
10954
11169
  { id: "turnCache", on: true }
10955
11170
  ];
10956
11171
  var refreshTurnItems = () => {
@@ -10966,10 +11181,12 @@
10966
11181
  };
10967
11182
  var ICONS = {
10968
11183
  up: '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
10969
- down: '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
10970
- cache: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>'
11184
+ cache: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',
11185
+ // 与状态栏“输出”同款(gauge):计数段与速度段共用
11186
+ // 墨迹在 24 格视图里垂直居中且不出框(旧字形 U 弧画到框底,描边被裁看着偏下)
11187
+ out: '<path d="m12 11 4-4"/><path d="M3.34 16a10 10 0 1 1 17.32 0"/>'
10971
11188
  };
10972
- var icon = (name) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:11px;height:11px;vertical-align:-1.5px;opacity:.6">${ICONS[name]}</svg>`;
11189
+ var icon = (name) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:11px;height:11px;opacity:.6">${ICONS[name]}</svg>`;
10973
11190
  function fmt(n) {
10974
11191
  if (!isZhLocale()) {
10975
11192
  if (n >= 1e9) return (n / 1e9).toFixed(1) + "B";
@@ -11002,6 +11219,9 @@
11002
11219
  return rows;
11003
11220
  }
11004
11221
  function currentSessionId() {
11222
+ const pane = document.querySelector("[data-session-id]");
11223
+ const pid = pane ? pane.getAttribute("data-session-id") : "";
11224
+ if (pid && /^(?:sess|session)_/.test(pid)) return pid;
11005
11225
  const rows = [...document.querySelectorAll("[data-task-item-key]")];
11006
11226
  const cur = rows.find((e) => (e.className + "").includes("bg-selected")) || rows[rows.length - 1];
11007
11227
  const key = cur ? cur.getAttribute("data-task-item-key") : "";
@@ -11012,6 +11232,7 @@
11012
11232
  if (!bucket || bucket.in + bucket.out <= 0) return;
11013
11233
  const L = t();
11014
11234
  const cachePct = bucket.in > 0 && bucket.cacheRead > 0 ? (bucket.cacheRead / bucket.in * 100).toFixed(2) : "";
11235
+ const tps = bucket.genMs > 0 ? bucket.tpsOut / (bucket.genMs / 1e3) : null;
11015
11236
  const group = (html2) => `<span style="display:inline-flex;align-items:center;gap:2px">${html2}</span>`;
11016
11237
  const em = (text) => `<em style="font-style:normal;opacity:.75">${text}</em>`;
11017
11238
  const DOT = '<span style="opacity:.45">\xB7</span>';
@@ -11019,7 +11240,8 @@
11019
11240
  for (const s of turnCfg) {
11020
11241
  if (!s.on) continue;
11021
11242
  if (s.id === "turnIn") sections.push(group(icon("up") + em(L.sbLabelIn) + fmt(bucket.in)));
11022
- else if (s.id === "turnOut") sections.push(group(icon("down") + em(L.sbLabelOut) + fmt(bucket.out)));
11243
+ else if (s.id === "turnOut") sections.push(group(icon("out") + em(L.sbLabelOut) + fmt(bucket.out)));
11244
+ else if (s.id === "turnTps" && tps != null) sections.push(group(icon("out") + em(L.sbLabelOut) + Math.round(tps * 10) / 10 + " tok/s"));
11023
11245
  else if (s.id === "turnCache" && cachePct) sections.push(group(icon("cache") + em(L.sbLabelCache) + cachePct + "%"));
11024
11246
  }
11025
11247
  const old = row.querySelector("[data-zcodepro-turn-span]");
@@ -11044,7 +11266,7 @@
11044
11266
  el.style.gap = "4px";
11045
11267
  el.style.marginLeft = "10px";
11046
11268
  el.innerHTML = html;
11047
- el.title = `${L.turnUsageTitle}${isZhLocale() ? "\uFF1A" : ": "}${L.sbLabelIn} ${bucket.in.toLocaleString()} / ${L.sbLabelOut} ${bucket.out.toLocaleString()}` + (bucket.cacheRead > 0 ? ` / ${L.sbLabelCache} ${bucket.cacheRead.toLocaleString()}` : "");
11269
+ el.title = `${L.turnUsageTitle}${isZhLocale() ? "\uFF1A" : ": "}${L.sbLabelIn} ${bucket.in.toLocaleString()} / ${L.sbLabelOut} ${bucket.out.toLocaleString()}` + (tps != null ? ` / ${L.sbLabelOut} ${Math.round(tps * 10) / 10} tok/s` : "") + (bucket.cacheRead > 0 ? ` / ${L.sbLabelCache} ${bucket.cacheRead.toLocaleString()}` : "");
11048
11270
  row.dataset.zcodeproTurn = "1";
11049
11271
  row.append(el);
11050
11272
  }
@@ -11079,31 +11301,35 @@
11079
11301
  const sid = currentSessionId();
11080
11302
  if (sid !== lastSid2) {
11081
11303
  lastSid2 = sid;
11082
- recentTurns = [];
11304
+ rounds = [];
11083
11305
  for (const r of rows) clearRow(r.row);
11084
11306
  void tick2();
11085
11307
  return;
11086
11308
  }
11087
- if (document.hidden || !recentTurns.length) {
11309
+ if (document.hidden || !rounds.length) {
11088
11310
  for (const r of rows) clearRow(r.row);
11089
11311
  return;
11090
11312
  }
11091
- const agg = rows.map(() => ({ in: 0, out: 0, cacheRead: 0 }));
11313
+ const agg = rows.map(() => ({ in: 0, out: 0, cacheRead: 0, tpsOut: 0, genMs: 0 }));
11092
11314
  const dayOf = (t2) => {
11093
11315
  const d = new Date(t2);
11094
11316
  return d.getFullYear() * 1e4 + (d.getMonth() + 1) * 100 + d.getDate();
11095
11317
  };
11096
- for (const b of recentTurns) {
11318
+ for (const b of rounds) {
11097
11319
  let owner = -1;
11098
11320
  for (let i = 0; i < rows.length; i++) {
11099
- if (rows[i].ts <= b.ts) owner = i;
11321
+ if (rows[i].ts <= b.at) owner = i;
11100
11322
  else break;
11101
11323
  }
11102
11324
  if (owner < 0) continue;
11103
- if (dayOf(rows[owner].ts) !== dayOf(b.ts)) continue;
11325
+ if (dayOf(rows[owner].ts) !== dayOf(b.at)) continue;
11104
11326
  agg[owner].in += b.in;
11105
11327
  agg[owner].out += b.out;
11106
11328
  agg[owner].cacheRead += b.cacheRead;
11329
+ if (b.genMs) {
11330
+ agg[owner].tpsOut += b.out;
11331
+ agg[owner].genMs += b.genMs;
11332
+ }
11107
11333
  }
11108
11334
  for (let i = 0; i < rows.length; i++) {
11109
11335
  if (agg[i].in + agg[i].out > 0) injectRow(rows[i].row, agg[i]);
@@ -11115,10 +11341,10 @@
11115
11341
  if (!enabled5 || document.hidden) return;
11116
11342
  const sid = currentSessionId();
11117
11343
  const seq = ++tickSeq2;
11118
- const res = await rpc("/stats/usage" + (sid ? "?session=" + encodeURIComponent(sid) : "")).catch(() => null);
11119
- if (res && res.ok && Array.isArray(res.recentTurns)) {
11344
+ const res = await rpc("/stats/turns" + (sid ? "?session=" + encodeURIComponent(sid) : "")).catch(() => null);
11345
+ if (res && res.ok && Array.isArray(res.rounds)) {
11120
11346
  if (seq !== tickSeq2 || sid !== currentSessionId()) return;
11121
- recentTurns = res.recentTurns;
11347
+ rounds = res.rounds;
11122
11348
  scan3();
11123
11349
  }
11124
11350
  }
@@ -11304,9 +11530,9 @@
11304
11530
  var mapRefreshTimer = 0;
11305
11531
  function refreshMapSoon() {
11306
11532
  if (mapRefreshTimer) return;
11307
- const tick6 = () => {
11533
+ const tick7 = () => {
11308
11534
  if (document.hidden) {
11309
- mapRefreshTimer = setTimeout(tick6, 1e4);
11535
+ mapRefreshTimer = setTimeout(tick7, 1e4);
11310
11536
  return;
11311
11537
  }
11312
11538
  mapRefreshTimer = 0;
@@ -11314,7 +11540,7 @@
11314
11540
  if (m) scan4();
11315
11541
  });
11316
11542
  };
11317
- mapRefreshTimer = setTimeout(tick6, MAP_REFRESH_MS);
11543
+ mapRefreshTimer = setTimeout(tick7, MAP_REFRESH_MS);
11318
11544
  }
11319
11545
  var editingKey = null;
11320
11546
  var bootDelay = 0;
@@ -11644,11 +11870,11 @@
11644
11870
  async function injectHoverButtons() {
11645
11871
  const cfg = await getConfig();
11646
11872
  if (!cfg || !cfg.titleGen) return;
11647
- const enabled14 = cfg.titleGen.hoverBtn !== false;
11873
+ const enabled15 = cfg.titleGen.hoverBtn !== false;
11648
11874
  const L = t();
11649
11875
  for (const area of document.querySelectorAll(ACTIONS_SEL)) {
11650
11876
  const existing = area.querySelector('[data-zcodepro-item="auto-rename"]');
11651
- if (!enabled14) {
11877
+ if (!enabled15) {
11652
11878
  existing?.remove();
11653
11879
  continue;
11654
11880
  }
@@ -11738,6 +11964,411 @@
11738
11964
  // src/inject/index.js
11739
11965
  init_ws_running();
11740
11966
 
11967
+ // src/inject/features/subagent-icon.js
11968
+ init_core();
11969
+ init_ws_running();
11970
+ init_ws_rows();
11971
+ var installed6 = false;
11972
+ var enabled7 = true;
11973
+ var POLL_MS = 2e4;
11974
+ var ACTIVITY_FRESH_MS = 60 * 6e4;
11975
+ var WS_CANDIDATES_TTL_MS = 5 * 6e4;
11976
+ var APPLY_DEBOUNCE_MS = 300;
11977
+ var CALL_TIMEOUT_MS = 6e3;
11978
+ var TICK_GUARD_MS = 3e4;
11979
+ var TASK_SEL5 = "[data-task-item-key]";
11980
+ var ROBOT_CLASS = "zcodepro-subagent-icon";
11981
+ var TERMINAL_CLASS = "zcodepro-terminal-icon";
11982
+ var ROBOT_ON_CLASS = "zcodepro-subagent-on";
11983
+ var UNREAD_MOVED_CLASS = "zcodepro-subagent-unread-moved";
11984
+ var UNREAD_TAIL_CLASS = "zcodepro-subagent-unread-tail";
11985
+ var UNREAD_IGNORE_CLASS = "zcodepro-unread-error-only";
11986
+ var BUSY_LOADER_CLASS = "zcodepro-busy-loader";
11987
+ var BOT_FALLBACK = [
11988
+ ["path", { d: "M12 8V4H8" }],
11989
+ ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }],
11990
+ ["path", { d: "M2 14h2" }],
11991
+ ["path", { d: "M20 14h2" }],
11992
+ ["path", { d: "M15 13v2" }],
11993
+ ["path", { d: "M9 13v2" }]
11994
+ ];
11995
+ function makeBotSvg(baseClass) {
11996
+ const ns = "http://www.w3.org/2000/svg";
11997
+ const proto = document.querySelector(`svg.lucide-bot:not(.${ROBOT_CLASS})`);
11998
+ if (proto) {
11999
+ const clone = proto.cloneNode(true);
12000
+ const orig = proto.getAttribute("class") || "";
12001
+ const keep = orig.split(/\s+/).filter((c) => /^(size-|text-)/.test(c)).join(" ");
12002
+ clone.setAttribute("class", ((keep || baseClass || "size-4") + " " + ROBOT_CLASS).trim());
12003
+ clone.setAttribute("title", t().subagentRobotTip);
12004
+ return clone;
12005
+ }
12006
+ const svg = document.createElementNS(ns, "svg");
12007
+ svg.setAttribute("viewBox", "0 0 24 24");
12008
+ svg.setAttribute("fill", "none");
12009
+ svg.setAttribute("stroke", "currentColor");
12010
+ svg.setAttribute("stroke-width", "2");
12011
+ svg.setAttribute("stroke-linecap", "round");
12012
+ svg.setAttribute("stroke-linejoin", "round");
12013
+ svg.setAttribute("class", ((baseClass || "size-4") + " " + ROBOT_CLASS).trim());
12014
+ svg.setAttribute("title", t().subagentRobotTip);
12015
+ for (const [tag, attrs] of BOT_FALLBACK) {
12016
+ const el = document.createElementNS(ns, tag);
12017
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, v);
12018
+ svg.append(el);
12019
+ }
12020
+ return svg;
12021
+ }
12022
+ function rowIconSlot(row) {
12023
+ return row.firstElementChild && row.firstElementChild.querySelector(":scope > span[aria-hidden]");
12024
+ }
12025
+ var LOADER_FALLBACK_PATHS2 = [
12026
+ "M12 2v4",
12027
+ "m16.2 7.8 2.9-2.9",
12028
+ "M18 12h4",
12029
+ "m19.8 16.2-2.9 2.9",
12030
+ "M12 18v4",
12031
+ "m7.8 19.8-2.9-2.9",
12032
+ "M6 12H2",
12033
+ "m4.2 7.8 2.9-2.9"
12034
+ ];
12035
+ var TERMINAL_FALLBACK = [
12036
+ ["path", { d: "m4 17 6-6-6-6" }],
12037
+ ["path", { d: "M12 19h8" }]
12038
+ ];
12039
+ function makeTerminalIcon() {
12040
+ const ns = "http://www.w3.org/2000/svg";
12041
+ const proto = document.querySelector(`svg.lucide-terminal:not(.${TERMINAL_CLASS}), svg.lucide-square-terminal:not(.${TERMINAL_CLASS})`);
12042
+ if (proto) {
12043
+ const clone = proto.cloneNode(true);
12044
+ const orig = proto.getAttribute("class") || "";
12045
+ const keep = orig.split(/\s+/).filter((c) => /^(size-|text-)/.test(c)).join(" ");
12046
+ clone.setAttribute("class", ((keep || "size-4 text-foreground-subtle") + " " + TERMINAL_CLASS).trim());
12047
+ clone.setAttribute("title", t().subagentTermTip);
12048
+ return clone;
12049
+ }
12050
+ const svg = document.createElementNS(ns, "svg");
12051
+ svg.setAttribute("viewBox", "0 0 24 24");
12052
+ svg.setAttribute("fill", "none");
12053
+ svg.setAttribute("stroke", "currentColor");
12054
+ svg.setAttribute("stroke-width", "2");
12055
+ svg.setAttribute("stroke-linecap", "round");
12056
+ svg.setAttribute("stroke-linejoin", "round");
12057
+ svg.setAttribute("class", `size-4 text-foreground-subtle ${TERMINAL_CLASS}`);
12058
+ svg.setAttribute("title", t().subagentTermTip);
12059
+ for (const [tag, attrs] of TERMINAL_FALLBACK) {
12060
+ const el = document.createElementNS(ns, tag);
12061
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, v);
12062
+ svg.append(el);
12063
+ }
12064
+ return svg;
12065
+ }
12066
+ function makeBusyLoader() {
12067
+ const ns = "http://www.w3.org/2000/svg";
12068
+ const proto = document.querySelector(`svg.lucide-loader:not(.${BUSY_LOADER_CLASS})`);
12069
+ if (proto) {
12070
+ const clone = proto.cloneNode(true);
12071
+ const orig = proto.getAttribute("class") || "";
12072
+ const keep = orig.split(/\s+/).filter((c) => /^(size-|text-)/.test(c)).join(" ");
12073
+ clone.setAttribute("class", ((keep || "size-4 text-foreground-subtle") + ` animate-spin ${BUSY_LOADER_CLASS}`).trim());
12074
+ return clone;
12075
+ }
12076
+ const svg = document.createElementNS(ns, "svg");
12077
+ svg.setAttribute("viewBox", "0 0 24 24");
12078
+ svg.setAttribute("fill", "none");
12079
+ svg.setAttribute("stroke", "currentColor");
12080
+ svg.setAttribute("stroke-width", "2");
12081
+ svg.setAttribute("stroke-linecap", "round");
12082
+ svg.setAttribute("stroke-linejoin", "round");
12083
+ svg.setAttribute("class", `size-4 text-foreground-subtle animate-spin ${BUSY_LOADER_CLASS}`);
12084
+ for (const d of LOADER_FALLBACK_PATHS2) {
12085
+ const path = document.createElementNS(ns, "path");
12086
+ path.setAttribute("d", d);
12087
+ svg.append(path);
12088
+ }
12089
+ return svg;
12090
+ }
12091
+ function updateRow(row, sub, busy, term) {
12092
+ const slot = rowIconSlot(row);
12093
+ if (!slot) return;
12094
+ const unread = !!slot.querySelector("[data-unread-indicator]");
12095
+ const hasBlocking = [...slot.children].some(
12096
+ (c) => !c.classList.contains(ROBOT_CLASS) && !c.classList.contains(BUSY_LOADER_CLASS) && !c.classList.contains(TERMINAL_CLASS) && !c.hasAttribute("data-unread-indicator")
12097
+ );
12098
+ const hidden = slot.classList.contains("hidden") || slot.classList.contains("invisible");
12099
+ const ok = !hasBlocking && !hidden;
12100
+ const wantLoader = ok && busy && unread;
12101
+ const wantRobot = ok && sub && !busy;
12102
+ const wantTerm = ok && term && !busy && !wantRobot;
12103
+ const curRobot = slot.querySelector(`:scope > svg.${ROBOT_CLASS}`);
12104
+ if (wantRobot && !curRobot) slot.append(makeBotSvg("size-4 text-foreground-subtle"));
12105
+ else if (!wantRobot && curRobot) curRobot.remove();
12106
+ const curTerm = slot.querySelector(`:scope > svg.${TERMINAL_CLASS}`);
12107
+ if (wantTerm && !curTerm) slot.append(makeTerminalIcon());
12108
+ else if (!wantTerm && curTerm) curTerm.remove();
12109
+ const curLoader = slot.querySelector(`:scope > svg.${BUSY_LOADER_CLASS}`);
12110
+ if (wantLoader && !curLoader) slot.append(makeBusyLoader());
12111
+ else if (!wantLoader && curLoader) curLoader.remove();
12112
+ const moveUnread = (wantRobot || wantLoader || wantTerm) && unread;
12113
+ row.classList.toggle(UNREAD_MOVED_CLASS, moveUnread);
12114
+ let tail = row.querySelector(`:scope > .${UNREAD_TAIL_CLASS}`);
12115
+ if (moveUnread) {
12116
+ if (!tail) {
12117
+ tail = document.createElement("span");
12118
+ tail.className = UNREAD_TAIL_CLASS;
12119
+ tail.setAttribute("aria-hidden", "true");
12120
+ const dot = document.createElement("span");
12121
+ dot.className = "size-[7px] rounded-full bg-icon-blue";
12122
+ tail.append(dot);
12123
+ }
12124
+ row.insertBefore(tail, row.querySelector(":scope > [data-task-row-actions]") || null);
12125
+ } else if (tail) {
12126
+ tail.remove();
12127
+ }
12128
+ }
12129
+ function setProjectIcon(row, robotOn, termOn) {
12130
+ const icon2 = iconHolderOf(row);
12131
+ if (!icon2) return;
12132
+ const loaderSpins = icon2.classList.contains("zcodepro-ws-running") || !!icon2.querySelector(":scope > svg.zcodepro-ws-loader");
12133
+ const wantRobot = robotOn && !loaderSpins;
12134
+ const wantTerm = termOn && !loaderSpins && !wantRobot;
12135
+ icon2.classList.toggle(ROBOT_ON_CLASS, wantRobot || wantTerm);
12136
+ const curRobot = icon2.querySelector(`:scope > svg.${ROBOT_CLASS}`);
12137
+ if (wantRobot && !curRobot) icon2.append(makeBotSvg());
12138
+ else if (!wantRobot && curRobot) curRobot.remove();
12139
+ const curTerm = icon2.querySelector(`:scope > svg.${TERMINAL_CLASS}`);
12140
+ if (wantTerm && !curTerm) icon2.append(makeTerminalIcon());
12141
+ else if (!wantTerm && curTerm) curTerm.remove();
12142
+ }
12143
+ var ticking = false;
12144
+ var liveSessions = /* @__PURE__ */ new Set();
12145
+ var liveByWs = /* @__PURE__ */ new Set();
12146
+ var busySessions = /* @__PURE__ */ new Set();
12147
+ var liveTermSessions = /* @__PURE__ */ new Set();
12148
+ var liveTermByWs = /* @__PURE__ */ new Set();
12149
+ var projectTrueUnread = /* @__PURE__ */ new Map();
12150
+ var wsCandidatesCache = /* @__PURE__ */ new Map();
12151
+ var projRootsCache = { at: 0, map: null };
12152
+ function normWs(v) {
12153
+ return String(v || "").replace(/[\\/]+$/, "");
12154
+ }
12155
+ function withTimeout(p, ms, fallback) {
12156
+ const guarded = Promise.resolve(p).catch(() => fallback);
12157
+ return Promise.race([guarded, new Promise((resolve) => setTimeout(() => resolve(fallback), ms))]);
12158
+ }
12159
+ async function projRoots() {
12160
+ if (projRootsCache.map && Date.now() - projRootsCache.at < WS_CANDIDATES_TTL_MS) return projRootsCache.map;
12161
+ const res = await withTimeout(rpc("/projects-v2"), CALL_TIMEOUT_MS, null);
12162
+ const map = /* @__PURE__ */ new Map();
12163
+ if (res && res.ok && res.available !== false && Array.isArray(res.projects)) {
12164
+ for (const proj of res.projects) {
12165
+ const id = String(proj.id || "");
12166
+ const paths = (proj.roots || []).map((r) => String(r.path || "")).filter(Boolean);
12167
+ if (id && paths.length) map.set(id, paths);
12168
+ }
12169
+ }
12170
+ projRootsCache = { at: Date.now(), map };
12171
+ return map;
12172
+ }
12173
+ function projectPathsOf(row, roots) {
12174
+ const id = row.getAttribute && row.getAttribute("data-project-id");
12175
+ const byId = id && roots && roots.get(id);
12176
+ if (byId && byId.length) return byId;
12177
+ const p = rowPath(row);
12178
+ return p ? [p] : [];
12179
+ }
12180
+ async function wsCandidates(ws) {
12181
+ const c = wsCandidatesCache.get(ws);
12182
+ if (c && Date.now() - c.at < WS_CANDIDATES_TTL_MS) return c.ids;
12183
+ const res = await withTimeout(rpc("/workspace-sessions?path=" + encodeURIComponent(ws)), CALL_TIMEOUT_MS, null);
12184
+ const ids = res && res.ok && Array.isArray(res.ids) ? res.ids : [];
12185
+ wsCandidatesCache.set(ws, { at: Date.now(), ids });
12186
+ return ids;
12187
+ }
12188
+ async function tick3() {
12189
+ if (!enabled7 || document.hidden || ticking) return;
12190
+ ticking = true;
12191
+ const guard = setTimeout(() => {
12192
+ ticking = false;
12193
+ }, TICK_GUARD_MS);
12194
+ try {
12195
+ const services = findServices();
12196
+ const ag = services && services.zcodeAgentService;
12197
+ if (!ag) return;
12198
+ const candidates = /* @__PURE__ */ new Map();
12199
+ for (const el of document.querySelectorAll(TASK_SEL5)) {
12200
+ const key = el.getAttribute("data-task-item-key") || "";
12201
+ const cut = key.lastIndexOf(":");
12202
+ if (cut > 1) candidates.set(key.slice(cut + 1), key.slice(0, cut));
12203
+ }
12204
+ const roots = await projRoots();
12205
+ const collapsedRows = projectRows().filter((row) => {
12206
+ const head = wsHead(row);
12207
+ return !!head && head.getAttribute("aria-expanded") === "false";
12208
+ });
12209
+ const wsPaths = collapsedRows.flatMap((row) => projectPathsOf(row, roots));
12210
+ const wsLists = await Promise.all(wsPaths.map((p) => wsCandidates(p)));
12211
+ wsLists.forEach((ids, i) => {
12212
+ for (const id of ids) {
12213
+ if (!candidates.has(id)) candidates.set(id, wsPaths[i]);
12214
+ }
12215
+ });
12216
+ const childRes = await withTimeout(
12217
+ rpc("/subagent-children?ids=" + encodeURIComponent([...candidates.keys()].join(","))),
12218
+ CALL_TIMEOUT_MS,
12219
+ null
12220
+ );
12221
+ const rootsWithKids = new Set((childRes && childRes.children || []).map((c) => c.root));
12222
+ const endedLists = await Promise.all([...candidates].filter(([sid]) => rootsWithKids.has(sid)).map(async ([sid, ws]) => {
12223
+ const r = await withTimeout(
12224
+ ag.listSessionSubagents({ workspacePath: ws, sessionId: sid, endedLimit: 20 }),
12225
+ CALL_TIMEOUT_MS,
12226
+ null
12227
+ );
12228
+ return r && r.ended && r.ended.items || [];
12229
+ }));
12230
+ const endedAt = /* @__PURE__ */ new Map();
12231
+ for (const items2 of endedLists) {
12232
+ for (const e of items2) {
12233
+ const id = e && e.childSessionId;
12234
+ if (id) endedAt.set(id, Math.max(endedAt.get(id) || 0, Number(e.endedAt) || 0));
12235
+ }
12236
+ }
12237
+ const now = Date.now();
12238
+ const live = /* @__PURE__ */ new Set();
12239
+ const liveWs = /* @__PURE__ */ new Set();
12240
+ for (const c of childRes && childRes.children || []) {
12241
+ const at = Number(c.at) || 0;
12242
+ if (!(at > 0 && now - at <= ACTIVITY_FRESH_MS)) continue;
12243
+ const end = endedAt.get(c.id) || 0;
12244
+ if (end && end >= at) continue;
12245
+ live.add(c.root);
12246
+ const ws = candidates.get(c.root);
12247
+ if (ws) liveWs.add(normWs(ws));
12248
+ }
12249
+ liveSessions = live;
12250
+ liveByWs = liveWs;
12251
+ const ts = services && services.zcodeTaskService;
12252
+ const busy = /* @__PURE__ */ new Set();
12253
+ if (ts && typeof ts.listActiveTaskIds === "function") {
12254
+ const needBusyWs = /* @__PURE__ */ new Set();
12255
+ for (const el of document.querySelectorAll(TASK_SEL5)) {
12256
+ const key = el.getAttribute("data-task-item-key") || "";
12257
+ const cut = key.lastIndexOf(":");
12258
+ const sid = cut > 1 ? key.slice(cut + 1) : "";
12259
+ const slot = rowIconSlot(el);
12260
+ const unread = slot && slot.querySelector("[data-unread-indicator]");
12261
+ if (live.has(sid) || unread) needBusyWs.add(normWs(key.slice(0, cut)));
12262
+ }
12263
+ await Promise.all([...needBusyWs].flatMap((ws) => [ws, ws + "/"].map(async (w) => {
12264
+ const r = await withTimeout(ts.listActiveTaskIds({ workspacePath: w }), CALL_TIMEOUT_MS, null);
12265
+ if (Array.isArray(r)) for (const id of r) busy.add(String(id));
12266
+ })));
12267
+ }
12268
+ busySessions = busy;
12269
+ const term = /* @__PURE__ */ new Set();
12270
+ const termWs = /* @__PURE__ */ new Set();
12271
+ const bbRes = await withTimeout(rpc("/background-bash"), CALL_TIMEOUT_MS, null);
12272
+ for (const j of bbRes && bbRes.jobs || []) {
12273
+ const sid = j && j.sessionId;
12274
+ if (!sid || !candidates.has(sid)) continue;
12275
+ term.add(sid);
12276
+ const ws = candidates.get(sid);
12277
+ if (ws) termWs.add(normWs(ws));
12278
+ }
12279
+ liveTermSessions = term;
12280
+ liveTermByWs = termWs;
12281
+ const projIds = [...new Set(projectRows().map((r) => r.getAttribute("data-project-id")).filter(Boolean))];
12282
+ if (projIds.length) {
12283
+ const pu = await withTimeout(
12284
+ rpc("/project-unread?ids=" + encodeURIComponent(projIds.join(","))),
12285
+ CALL_TIMEOUT_MS,
12286
+ null
12287
+ );
12288
+ if (pu && pu.ok && pu.unread) projectTrueUnread = new Map(Object.entries(pu.unread));
12289
+ }
12290
+ apply2();
12291
+ } finally {
12292
+ clearTimeout(guard);
12293
+ ticking = false;
12294
+ }
12295
+ }
12296
+ function apply2() {
12297
+ for (const el of document.querySelectorAll(TASK_SEL5)) {
12298
+ const key = el.getAttribute("data-task-item-key") || "";
12299
+ const cut = key.lastIndexOf(":");
12300
+ const sid = cut > 1 ? key.slice(cut + 1) : "";
12301
+ updateRow(el, enabled7 && liveSessions.has(sid), busySessions.has(sid), enabled7 && liveTermSessions.has(sid));
12302
+ }
12303
+ const roots = projRootsCache.map;
12304
+ for (const row of projectRows()) {
12305
+ const head = wsHead(row);
12306
+ const collapsed = !!head && head.getAttribute("aria-expanded") === "false";
12307
+ const paths = projectPathsOf(row, roots);
12308
+ setProjectIcon(
12309
+ row,
12310
+ enabled7 && collapsed && paths.some((p) => liveByWs.has(normWs(p))),
12311
+ enabled7 && collapsed && paths.some((p) => liveTermByWs.has(normWs(p)))
12312
+ );
12313
+ const pid = row.getAttribute("data-project-id");
12314
+ row.classList.toggle(UNREAD_IGNORE_CLASS, enabled7 && pid !== null && projectTrueUnread.get(pid) === 0);
12315
+ }
12316
+ }
12317
+ async function refreshConfig2() {
12318
+ try {
12319
+ const cfg = await getConfig();
12320
+ const next = !!(cfg && cfg.features && cfg.features.subagentIcon !== false);
12321
+ if (next !== enabled7) {
12322
+ enabled7 = next;
12323
+ apply2();
12324
+ }
12325
+ } catch {
12326
+ }
12327
+ }
12328
+ var applyDebounce = 0;
12329
+ var tickThrottle = 0;
12330
+ function startSubagentIcon() {
12331
+ if (installed6 || typeof document === "undefined") return;
12332
+ installed6 = true;
12333
+ void refreshConfig2();
12334
+ void tick3();
12335
+ setInterval(() => {
12336
+ void refreshConfig2();
12337
+ void tick3();
12338
+ }, POLL_MS);
12339
+ document.addEventListener("visibilitychange", () => {
12340
+ if (!document.hidden) {
12341
+ void refreshConfig2();
12342
+ void tick3();
12343
+ }
12344
+ });
12345
+ const observer2 = new MutationObserver((muts) => {
12346
+ let rowHit = false;
12347
+ let rowAdded = false;
12348
+ for (const m of muts) {
12349
+ if (m.type !== "childList") continue;
12350
+ const t2 = m.target instanceof Element ? m.target : null;
12351
+ const added = [...m.addedNodes].filter((n) => n instanceof Element);
12352
+ if (added.some((n) => n.matches(TASK_SEL5) || n.querySelector(TASK_SEL5))) rowAdded = true;
12353
+ const touched = t2 && t2.closest(TASK_SEL5) || added.some((n) => n.matches(TASK_SEL5) || n.querySelector(TASK_SEL5)) || [...m.removedNodes].some((n) => n instanceof Element && (n.matches(TASK_SEL5) || n.querySelector(TASK_SEL5)));
12354
+ if (touched) rowHit = true;
12355
+ }
12356
+ if (rowAdded) apply2();
12357
+ if (rowHit && !tickThrottle) {
12358
+ tickThrottle = setTimeout(() => {
12359
+ tickThrottle = 0;
12360
+ void tick3();
12361
+ }, 5e3);
12362
+ }
12363
+ if (applyDebounce) return;
12364
+ applyDebounce = setTimeout(() => {
12365
+ applyDebounce = 0;
12366
+ apply2();
12367
+ }, APPLY_DEBOUNCE_MS);
12368
+ });
12369
+ observer2.observe(document.body, { childList: true, subtree: true });
12370
+ }
12371
+
11741
12372
  // src/inject/features/idle-reclaim.js
11742
12373
  init_core();
11743
12374
  init_ws_running();
@@ -11749,7 +12380,7 @@
11749
12380
  var scanDisabledLogged = false;
11750
12381
  var bootAt = Date.now();
11751
12382
  var startupSweepDone = false;
11752
- var enabled7 = true;
12383
+ var enabled8 = true;
11753
12384
  var normP = (v) => String(v || "").replace(/[\\/]+$/, "");
11754
12385
  async function sidebarWorkspaces() {
11755
12386
  const out = /* @__PURE__ */ new Set();
@@ -11801,14 +12432,14 @@
11801
12432
  await reclaim(ws);
11802
12433
  blockUntil.set(ws, Date.now() + cooldownMs);
11803
12434
  }
11804
- async function tick3() {
11805
- if (!enabled7) {
12435
+ async function tick4() {
12436
+ if (!enabled8) {
11806
12437
  idleSince.clear();
11807
12438
  return;
11808
12439
  }
11809
12440
  const cfg = await getConfig();
11810
- enabled7 = !cfg.features || cfg.features.idleReclaim !== false;
11811
- if (!enabled7) {
12441
+ enabled8 = !cfg.features || cfg.features.idleReclaim !== false;
12442
+ if (!enabled8) {
11812
12443
  idleSince.clear();
11813
12444
  return;
11814
12445
  }
@@ -11869,13 +12500,13 @@
11869
12500
  function startIdleReclaim() {
11870
12501
  window.addEventListener("zcodepro:config-changed", () => {
11871
12502
  void getConfig(true).then((cfg) => {
11872
- enabled7 = !cfg.features || cfg.features.idleReclaim !== false;
11873
- if (!enabled7) idleSince.clear();
12503
+ enabled8 = !cfg.features || cfg.features.idleReclaim !== false;
12504
+ if (!enabled8) idleSince.clear();
11874
12505
  }).catch(() => {
11875
12506
  });
11876
12507
  });
11877
12508
  const loop = () => {
11878
- tick3().catch(() => {
12509
+ tick4().catch(() => {
11879
12510
  });
11880
12511
  };
11881
12512
  loop();
@@ -11914,7 +12545,7 @@
11914
12545
  }
11915
12546
  var cooldown = /* @__PURE__ */ new Map();
11916
12547
  var disabledLogged = false;
11917
- var enabled8 = true;
12548
+ var enabled9 = true;
11918
12549
  function onPortsMessage(e) {
11919
12550
  const d = e.data;
11920
12551
  if (!d || d.type !== "zcode:plugin-sandbox-ports" || typeof d.sandboxId !== "string") return;
@@ -11931,14 +12562,14 @@
11931
12562
  if (!root.getClientRects().length) return false;
11932
12563
  return Number(getComputedStyle(root).opacity) > 0.5;
11933
12564
  }
11934
- async function tick4() {
11935
- if (!enabled8) {
12565
+ async function tick5() {
12566
+ if (!enabled9) {
11936
12567
  seen.clear();
11937
12568
  return;
11938
12569
  }
11939
12570
  const cfg = await getConfig();
11940
- enabled8 = !cfg.features || cfg.features.sandboxReclaim !== false;
11941
- if (!enabled8) {
12571
+ enabled9 = !cfg.features || cfg.features.sandboxReclaim !== false;
12572
+ if (!enabled9) {
11942
12573
  seen.clear();
11943
12574
  return;
11944
12575
  }
@@ -11995,13 +12626,13 @@
11995
12626
  window.addEventListener("message", onPortsMessage);
11996
12627
  window.addEventListener("zcodepro:config-changed", () => {
11997
12628
  void getConfig(true).then((cfg) => {
11998
- enabled8 = !cfg.features || cfg.features.sandboxReclaim !== false;
11999
- if (!enabled8) seen.clear();
12629
+ enabled9 = !cfg.features || cfg.features.sandboxReclaim !== false;
12630
+ if (!enabled9) seen.clear();
12000
12631
  }).catch(() => {
12001
12632
  });
12002
12633
  });
12003
12634
  const loop = () => {
12004
- tick4().catch(() => {
12635
+ tick5().catch(() => {
12005
12636
  });
12006
12637
  };
12007
12638
  loop();
@@ -12032,7 +12663,7 @@
12032
12663
  }
12033
12664
  return out;
12034
12665
  }
12035
- async function tick5() {
12666
+ async function tick6() {
12036
12667
  const cfg = await getConfig();
12037
12668
  if ((cfg.features || {}).pluginCardRetry === false) return;
12038
12669
  const now = Date.now();
@@ -12046,7 +12677,7 @@
12046
12677
  }
12047
12678
  function startPluginCardRetry() {
12048
12679
  setInterval(() => {
12049
- tick5().catch(() => {
12680
+ tick6().catch(() => {
12050
12681
  });
12051
12682
  }, SCAN_MS);
12052
12683
  }
@@ -12059,7 +12690,7 @@
12059
12690
  var SCAN_FALLBACK_MS5 = 5e3;
12060
12691
  var ROW_SEL = "[data-task-item-key]";
12061
12692
  var MENU_SEL = '[data-testid="task-new-button"], [data-testid="automations-open"], [data-testid="plugin-store-sidebar-open"], [data-testid="sidebar-search-open"], [data-slot="command"], [data-testid="desktop-top-nav-back"]';
12062
- var enabled9 = true;
12693
+ var enabled10 = true;
12063
12694
  var rowEl = null;
12064
12695
  var origs = null;
12065
12696
  var syncTimer = 0;
@@ -12202,7 +12833,7 @@
12202
12833
  return scroll.getBoundingClientRect().width < NARROW_SIDEBAR_PX;
12203
12834
  }
12204
12835
  function sync() {
12205
- if (!enabled9) return;
12836
+ if (!enabled10) return;
12206
12837
  const parts = findParts();
12207
12838
  if (!parts) {
12208
12839
  if (rowEl) rowEl.style.display = "none";
@@ -12262,18 +12893,18 @@
12262
12893
  origs = null;
12263
12894
  }
12264
12895
  }
12265
- async function refreshConfig2() {
12896
+ async function refreshConfig3() {
12266
12897
  const cfg = await getConfig(true).catch(() => null);
12267
- enabled9 = !cfg || !cfg.features || cfg.features.toolbarIcons !== false;
12268
- if (enabled9) sync();
12898
+ enabled10 = !cfg || !cfg.features || cfg.features.toolbarIcons !== false;
12899
+ if (enabled10) sync();
12269
12900
  else teardown();
12270
12901
  }
12271
12902
  function startToolbarIcons() {
12272
12903
  ensureStyle();
12273
12904
  window.addEventListener("zcodepro:config-changed", () => {
12274
- void refreshConfig2();
12905
+ void refreshConfig3();
12275
12906
  });
12276
- void refreshConfig2();
12907
+ void refreshConfig3();
12277
12908
  new MutationObserver((muts) => {
12278
12909
  if (relevantMutations(muts)) scheduleSync();
12279
12910
  }).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "aria-pressed"] });
@@ -12293,7 +12924,7 @@
12293
12924
  var STORE_KEY = "zcodepro:pinned-collapsed";
12294
12925
  var SYNC_DEBOUNCE_MS2 = 300;
12295
12926
  var SCAN_FALLBACK_MS6 = 5e3;
12296
- var enabled10 = true;
12927
+ var enabled11 = true;
12297
12928
  var syncTimer2 = 0;
12298
12929
  function findPinnedHeader() {
12299
12930
  for (const h3 of document.querySelectorAll("h3")) {
@@ -12336,9 +12967,9 @@
12336
12967
  localStorage.setItem(STORE_KEY, isCollapsed() ? "0" : "1");
12337
12968
  } catch {
12338
12969
  }
12339
- apply2();
12970
+ apply3();
12340
12971
  }
12341
- function apply2() {
12972
+ function apply3() {
12342
12973
  const h3 = findPinnedHeader();
12343
12974
  if (!h3) return false;
12344
12975
  const sect = h3.parentElement;
@@ -12353,7 +12984,7 @@
12353
12984
  if (!h3.dataset.zcodeproPinHead) {
12354
12985
  h3.dataset.zcodeproPinHead = "1";
12355
12986
  h3.addEventListener("click", () => {
12356
- if (enabled10) toggle();
12987
+ if (enabled11) toggle();
12357
12988
  });
12358
12989
  }
12359
12990
  const btn = h("button", {
@@ -12363,7 +12994,7 @@
12363
12994
  "aria-expanded": collapsed ? "false" : "true",
12364
12995
  onClick: (e) => {
12365
12996
  e.stopPropagation();
12366
- if (enabled10) toggle();
12997
+ if (enabled11) toggle();
12367
12998
  }
12368
12999
  });
12369
13000
  btn.append(chevronSvg());
@@ -12371,7 +13002,7 @@
12371
13002
  return true;
12372
13003
  }
12373
13004
  function sync2() {
12374
- if (enabled10) apply2();
13005
+ if (enabled11) apply3();
12375
13006
  }
12376
13007
  function scheduleSync2() {
12377
13008
  if (syncTimer2) return;
@@ -12398,18 +13029,18 @@
12398
13029
  h3.parentElement?.classList.remove(COLLAPSED_CLASS);
12399
13030
  }
12400
13031
  }
12401
- async function refreshConfig3() {
13032
+ async function refreshConfig4() {
12402
13033
  const cfg = await getConfig(true).catch(() => null);
12403
- enabled10 = !cfg || !cfg.features || cfg.features.pinnedCollapse !== false;
12404
- if (enabled10) sync2();
13034
+ enabled11 = !cfg || !cfg.features || cfg.features.pinnedCollapse !== false;
13035
+ if (enabled11) sync2();
12405
13036
  else teardown2();
12406
13037
  }
12407
13038
  function startPinnedCollapse() {
12408
13039
  ensureStyle();
12409
13040
  window.addEventListener("zcodepro:config-changed", () => {
12410
- void refreshConfig3();
13041
+ void refreshConfig4();
12411
13042
  });
12412
- void refreshConfig3();
13043
+ void refreshConfig4();
12413
13044
  new MutationObserver((muts) => {
12414
13045
  if (relevantMutations2(muts)) scheduleSync2();
12415
13046
  }).observe(document.body, { childList: true, subtree: true });
@@ -12424,8 +13055,8 @@
12424
13055
  // src/inject/features/table-copy.js
12425
13056
  init_ui();
12426
13057
  init_core();
12427
- var installed6 = false;
12428
- var enabled11 = true;
13058
+ var installed7 = false;
13059
+ var enabled12 = true;
12429
13060
  function cleanTable(table) {
12430
13061
  const clone = table.cloneNode(false);
12431
13062
  const walk = (src, dst) => {
@@ -12516,8 +13147,8 @@
12516
13147
  return btn;
12517
13148
  }
12518
13149
  function startTableCopy() {
12519
- if (installed6 || typeof document === "undefined") return;
12520
- installed6 = true;
13150
+ if (installed7 || typeof document === "undefined") return;
13151
+ installed7 = true;
12521
13152
  ensureStyle();
12522
13153
  const tableOf = (bar) => {
12523
13154
  let scope = bar.parentElement;
@@ -12542,12 +13173,12 @@
12542
13173
  };
12543
13174
  scan6();
12544
13175
  void getConfig().then((cfg) => {
12545
- enabled11 = cfg.features ? cfg.features.tableCopy !== false : true;
13176
+ enabled12 = cfg.features ? cfg.features.tableCopy !== false : true;
12546
13177
  }).catch(() => {
12547
13178
  });
12548
13179
  window.addEventListener("zcodepro:config-changed", () => {
12549
13180
  void getConfig(true).then((cfg) => {
12550
- enabled11 = cfg.features ? cfg.features.tableCopy !== false : true;
13181
+ enabled12 = cfg.features ? cfg.features.tableCopy !== false : true;
12551
13182
  }).catch(() => {
12552
13183
  });
12553
13184
  });
@@ -12556,7 +13187,7 @@
12556
13187
  if (scanTimer2) return;
12557
13188
  scanTimer2 = setTimeout(() => {
12558
13189
  scanTimer2 = 0;
12559
- if (enabled11) scan6();
13190
+ if (enabled12) scan6();
12560
13191
  }, 300);
12561
13192
  };
12562
13193
  const maybeTable = (muts) => {
@@ -12569,7 +13200,7 @@
12569
13200
  return false;
12570
13201
  };
12571
13202
  const observer2 = new MutationObserver((muts) => {
12572
- if (enabled11 && maybeTable(muts)) scheduleScan4();
13203
+ if (enabled12 && maybeTable(muts)) scheduleScan4();
12573
13204
  });
12574
13205
  observer2.observe(document.body, { childList: true, subtree: true });
12575
13206
  }
@@ -12578,7 +13209,7 @@
12578
13209
  init_core();
12579
13210
  init_ui();
12580
13211
  var CONV3 = '[class*="@md/conversation"]';
12581
- var SKIP_SEL = "pre, code, a, button, input, textarea, select, [data-zcodepro-sess]";
13212
+ var SKIP_SEL = "pre, code, a, button, input, textarea, select, [contenteditable], [data-zcodepro-sess]";
12582
13213
  var SESS_RE = /(?<![A-Za-z0-9_])(?:session|sess)_[A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]/g;
12583
13214
  function matchIds(text) {
12584
13215
  SESS_RE.lastIndex = 0;
@@ -12588,8 +13219,8 @@
12588
13219
  }
12589
13220
  return out;
12590
13221
  }
12591
- var installed7 = false;
12592
- var enabled12 = true;
13222
+ var installed8 = false;
13223
+ var enabled13 = true;
12593
13224
  var titleCache = /* @__PURE__ */ new Map();
12594
13225
  var TITLE_CACHE_MAX = 500;
12595
13226
  var pendingIds = /* @__PURE__ */ new Set();
@@ -12694,14 +13325,14 @@
12694
13325
  }
12695
13326
  function setEnabled(cfg) {
12696
13327
  const next = cfg.features ? cfg.features.sessionLink !== false : true;
12697
- if (enabled12 && !next) unwrapAll();
12698
- enabled12 = next;
13328
+ if (enabled13 && !next) unwrapAll();
13329
+ enabled13 = next;
12699
13330
  if (next) scan5();
12700
13331
  }
12701
13332
  var inConv = (el) => !!(el && el.closest && el.closest(CONV3));
12702
13333
  function startSessionLink() {
12703
- if (installed7 || typeof document === "undefined") return;
12704
- installed7 = true;
13334
+ if (installed8 || typeof document === "undefined") return;
13335
+ installed8 = true;
12705
13336
  ensureStyle();
12706
13337
  void getConfig().then(setEnabled).catch(() => {
12707
13338
  });
@@ -12716,11 +13347,11 @@
12716
13347
  for (const m of muts) {
12717
13348
  if (m.type === "characterData") {
12718
13349
  doneNodes.delete(m.target);
12719
- if (enabled12 && inConv(m.target.parentElement)) texts.push(m.target);
13350
+ if (enabled13 && inConv(m.target.parentElement)) texts.push(m.target);
12720
13351
  continue;
12721
13352
  }
12722
13353
  for (const n of m.addedNodes) {
12723
- if (!enabled12) continue;
13354
+ if (!enabled13) continue;
12724
13355
  if (n.nodeType === Node.TEXT_NODE) {
12725
13356
  if (inConv(n.parentElement)) texts.push(n);
12726
13357
  continue;
@@ -12733,7 +13364,7 @@
12733
13364
  if (inConv(n) && !n.closest(SKIP_SEL)) walkTexts(n, texts);
12734
13365
  }
12735
13366
  }
12736
- if (!enabled12) return;
13367
+ if (!enabled13) return;
12737
13368
  if (structural) {
12738
13369
  scan5();
12739
13370
  return;
@@ -12744,7 +13375,7 @@
12744
13375
  }).observe(document.body, { childList: true, subtree: true, characterData: true });
12745
13376
  document.addEventListener("click", (e) => {
12746
13377
  const span = e.target instanceof Element && e.target.closest("[data-zcodepro-sess]");
12747
- if (!span || !enabled12) return;
13378
+ if (!span || !enabled13) return;
12748
13379
  e.preventDefault();
12749
13380
  e.stopPropagation();
12750
13381
  const id = span.getAttribute("data-zcodepro-sess") || "";
@@ -12758,8 +13389,8 @@
12758
13389
 
12759
13390
  // src/inject/features/composer-provider.js
12760
13391
  init_core();
12761
- var installed8 = false;
12762
- var enabled13 = true;
13392
+ var installed9 = false;
13393
+ var enabled14 = true;
12763
13394
  var TRIGGER_SEL = '[data-testid="chat-model-select-trigger"]';
12764
13395
  function labelParts(label) {
12765
13396
  const text = (label || "").trim();
@@ -12790,12 +13421,12 @@
12790
13421
  if (node && node.nodeType === 3 && !node.nextSibling) node.nodeValue = text;
12791
13422
  else el.textContent = text;
12792
13423
  }
12793
- function apply3() {
13424
+ function apply4() {
12794
13425
  for (const btn of document.querySelectorAll(TRIGGER_SEL)) {
12795
13426
  const parts = labelParts(btn.getAttribute("aria-label") || "");
12796
13427
  if (!parts) continue;
12797
13428
  const holders = holdersOf(btn, parts.model);
12798
- if (enabled13) {
13429
+ if (enabled14) {
12799
13430
  if (!parts.provider || !holders.length) continue;
12800
13431
  const target = `${parts.provider} / ${parts.model}`;
12801
13432
  for (const el of holders) {
@@ -12815,8 +13446,8 @@
12815
13446
  }
12816
13447
  }
12817
13448
  function startComposerProvider() {
12818
- if (installed8 || typeof document === "undefined") return;
12819
- installed8 = true;
13449
+ if (installed9 || typeof document === "undefined") return;
13450
+ installed9 = true;
12820
13451
  const COMPOSER_SEL = '[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content], [data-testid="chat-model-select-trigger"]';
12821
13452
  const relevant2 = (muts) => {
12822
13453
  for (const m of muts) {
@@ -12835,24 +13466,24 @@
12835
13466
  };
12836
13467
  const schedule = () => {
12837
13468
  clearTimeout(schedule.t);
12838
- schedule.t = setTimeout(apply3, 120);
13469
+ schedule.t = setTimeout(apply4, 120);
12839
13470
  };
12840
13471
  void getConfig().then((cfg) => {
12841
- enabled13 = cfg.features ? cfg.features.composerProvider !== false : true;
13472
+ enabled14 = cfg.features ? cfg.features.composerProvider !== false : true;
12842
13473
  }).catch(() => {
12843
13474
  });
12844
13475
  window.addEventListener("zcodepro:config-changed", () => {
12845
13476
  void getConfig(true).then((cfg) => {
12846
13477
  const next = cfg.features ? cfg.features.composerProvider !== false : true;
12847
- if (next !== enabled13) {
12848
- enabled13 = next;
12849
- apply3();
13478
+ if (next !== enabled14) {
13479
+ enabled14 = next;
13480
+ apply4();
12850
13481
  }
12851
13482
  }).catch(() => {
12852
13483
  });
12853
13484
  });
12854
13485
  const observer2 = new MutationObserver((muts) => {
12855
- if (enabled13 && relevant2(muts)) schedule();
13486
+ if (enabled14 && relevant2(muts)) schedule();
12856
13487
  });
12857
13488
  observer2.observe(document.body, {
12858
13489
  childList: true,
@@ -12862,37 +13493,7 @@
12862
13493
  attributeFilter: ["aria-label", "data-model-current-value"]
12863
13494
  // 这两个只有应用会写,不认 title,避免自己改 title 叫醒自己
12864
13495
  });
12865
- apply3();
12866
- }
12867
-
12868
- // src/inject/features/plugin-updates.js
12869
- init_core();
12870
- init_ui();
12871
- var NOTIFIED_KEY = "zcodepro-plugin-updates-notified";
12872
- async function startPluginUpdateCheck() {
12873
- const status = await rpc("/plugins/status");
12874
- if (!status.ok || !Array.isArray(status.updates)) return;
12875
- const L = t();
12876
- if (status.updates.length === 0) return;
12877
- const config = await getConfig();
12878
- if ((config.features || {}).autoUpdatePlugins === true) {
12879
- const res = await rpc("/plugins/update", { method: "POST", body: {} });
12880
- if (res.ok) showToast(L.pluginsAutoUpdated, "success");
12881
- else showToast(L.pluginsUpdateFailed + ": " + (res.error || ""), "error");
12882
- return;
12883
- }
12884
- const sig = status.updates.map((u) => `${u.name}:${u.installed}>${u.latest}`).join(",");
12885
- let seen2 = "";
12886
- try {
12887
- seen2 = window.localStorage.getItem(NOTIFIED_KEY) || "";
12888
- } catch {
12889
- }
12890
- if (seen2 === sig) return;
12891
- try {
12892
- window.localStorage.setItem(NOTIFIED_KEY, sig);
12893
- } catch {
12894
- }
12895
- showToast(L.pluginsUpdatesAvailable.replaceAll("{n}", String(status.updates.length)), "info");
13496
+ apply4();
12896
13497
  }
12897
13498
 
12898
13499
  // src/inject/index.js
@@ -12983,6 +13584,10 @@
12983
13584
  startWsRunningSpin();
12984
13585
  } catch {
12985
13586
  }
13587
+ try {
13588
+ startSubagentIcon();
13589
+ } catch {
13590
+ }
12986
13591
  try {
12987
13592
  startIdleReclaim();
12988
13593
  } catch {