zcode-pro 1.5.0 → 1.6.1

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
@@ -109,6 +109,39 @@
109
109
  tabProxy: "\u4EE3\u7406",
110
110
  tabBehavior: "\u884C\u4E3A",
111
111
  tabAgents: "\u5168\u5C40\u63D0\u793A\u8BCD",
112
+ tabZcode: "ZCode CLI",
113
+ zcodeDesc: "ZCode \u81EA\u8EAB\u7684\u884C\u4E3A\u914D\u7F6E\uFF08\u5199\u5165 ~/.zcode/cli/config.json\uFF09\uFF0C\u4FDD\u5B58\u540E\u5BF9\u65B0\u4F1A\u8BDD\u751F\u6548\u3002",
114
+ zcodeStatsTitle: "\u6280\u80FD\u6E05\u5355\u68C0\u67E5",
115
+ zcodeStatsCounts: "\u6280\u80FD {total} \u4E2A\uFF08\u672C\u5730 {user} \xB7 \u63D2\u4EF6 {plugin}\uFF09",
116
+ zcodeStatsChars: "\u5B8C\u6574\u6E05\u5355\u7EA6 {n} \u5B57\u7B26",
117
+ zcodeBudgetDefaultTag: "\uFF08\u9ED8\u8BA4\u503C\uFF09",
118
+ zcodeStatsDegraded: "\u8D85\u51FA\u9884\u7B97\uFF1A\u5B8C\u6574\u6E05\u5355\u653E\u4E0D\u4E0B\uFF0C\u964D\u7EA7\u4E3A\u4EC5\u540D\u79F0\uFF0C\u6A21\u578B\u770B\u4E0D\u5230\u6280\u80FD\u63CF\u8FF0",
119
+ zcodeStatsOk: "\u9884\u7B97\u5145\u8DB3\uFF1A\u6E05\u5355\u5E26\u5B8C\u6574\u63CF\u8FF0\u6CE8\u5165\u65B0\u4F1A\u8BDD",
120
+ zcodeStatsSuggest: "\u5EFA\u8BAE\u9884\u7B97 {n} \u5B57\u7B26\uFF08\u7559 20% \u4F59\u91CF\uFF09",
121
+ zcodeBudgetApply: "\u7528\u5EFA\u8BAE\u503C",
122
+ zcodeBudgetApplied: "\u6E05\u5355\u9884\u7B97\u5DF2\u4FDD\u5B58",
123
+ zcodeStatsNote: "\u6309\u5F53\u524D\u78C1\u76D8\u72B6\u6001\u4F30\u7B97\uFF0C\u4E0D\u542B\u5404\u9879\u76EE\u5185\u7684\u6280\u80FD\u76EE\u5F55\u3002",
124
+ zcodeSkillEnabled: "\u6280\u80FD\u7CFB\u7EDF",
125
+ zcodeSkillEnabledDesc: "skills.enabled\uFF1A\u5173\u95ED\u540E ZCode \u4E0D\u518D\u53D1\u73B0\u4E0E\u6CE8\u5165\u4EFB\u4F55\u6280\u80FD",
126
+ zcodeSkillIncludeInstructions: "\u6280\u80FD\u8BF4\u660E\u6CE8\u5165",
127
+ zcodeSkillIncludeInstructionsDesc: "skills.includeInstructions\uFF1A\u6280\u80FD\u8BF4\u660E\u662F\u5426\u968F\u6E05\u5355\u4E00\u8D77\u6CE8\u5165",
128
+ zcodeSkillBudget: "\u6280\u80FD\u6E05\u5355\u9884\u7B97\uFF08\u5B57\u7B26\uFF09",
129
+ zcodeSkillBudgetDesc: "skills.metadataBudget\uFF1A\u5B8C\u6574\u6E05\u5355\u8D85\u8FC7\u8BE5\u957F\u5EA6\u5C31\u964D\u7EA7\u4E3A\u4EC5\u540D\u79F0\uFF0C\u9ED8\u8BA4 20000",
130
+ zcodeSkillRoots: "\u989D\u5916\u6280\u80FD\u76EE\u5F55",
131
+ zcodeSkillRootsDesc: "skills.roots\uFF1A\u6BCF\u884C\u4E00\u4E2A\u76EE\u5F55\uFF0C\u76EE\u5F55\u4E0B\u7684\u6280\u80FD\u4F1A\u88AB\u53D1\u73B0\uFF08~/.zcode/skills\u3001~/.agents/skills \u4E4B\u5916\u7684\u8865\u5145\uFF09",
132
+ zcodeSave: "\u4FDD\u5B58",
133
+ zcodeRootsSaved: "\u6280\u80FD\u76EE\u5F55\u5DF2\u4FDD\u5B58",
134
+ zcodeFeatCompact: "\u4F1A\u8BDD\u538B\u7F29",
135
+ zcodeFeatCompactDesc: "features.compact\uFF1A\u4E0A\u4E0B\u6587\u8FC7\u957F\u65F6\u538B\u7F29\u65E9\u671F\u4F1A\u8BDD\u5185\u5BB9",
136
+ zcodeFeatRewind: "\u4F1A\u8BDD\u56DE\u6EAF",
137
+ zcodeFeatRewindDesc: "features.rewind\uFF1A\u56DE\u9000\u5230\u8F83\u65E9\u8282\u70B9\u91CD\u65B0\u7EE7\u7EED",
138
+ zcodeFeatSubagent: "\u5B50\u4EE3\u7406",
139
+ zcodeFeatSubagentDesc: "features.subagent\uFF1A\u6D3E\u51FA\u5B50\u4EE3\u7406\u5904\u7406\u5B50\u4EFB\u52A1",
140
+ zcodeFeatSkill: "\u6280\u80FD\u5DE5\u5177",
141
+ zcodeFeatSkillDesc: "features.skill\uFF1ASkill \u5DE5\u5177\u53EF\u7528\uFF08\u8FD8\u9700\u5F00\u542F\u6280\u80FD\u7CFB\u7EDF\uFF09",
142
+ zcodeFeatMcp: "MCP \u5DE5\u5177",
143
+ zcodeFeatMcpDesc: "features.mcp\uFF1A\u4F7F\u7528 MCP \u670D\u52A1\u5668\u63D0\u4F9B\u7684\u5DE5\u5177",
144
+ zcodeMemoryHint: "\u8BB0\u5FC6\u4E0D\u5728\u6B64\u5904\uFF1A\u5DE5\u4F5C\u533A\u8BB0\u5FC6\u5728\u5B98\u65B9 \u8BBE\u7F6E \u2192 Agent \u80FD\u529B \u2192 \u8BB0\u5FC6 \u4E2D\u5F00\u5173\uFF08\u542B\u8BB0\u5FC6\u8BE6\u60C5\u67E5\u770B\uFF09\u3002",
112
145
  agentsDesc: "\u5199\u5165 ~/.zcode/AGENTS.md\uFF0C\u4F5C\u4E3A\u9ED8\u8BA4\u6307\u4EE4\u7528\u4E8E\u6240\u6709\u9879\u76EE\u7684\u6BCF\u6B21\u4F1A\u8BDD\uFF1B\u4FDD\u5B58\u540E\u4ECE\u65B0\u4F1A\u8BDD\u8D77\u751F\u6548\uFF0C\u9879\u76EE\u5185\u7684 AGENTS.md \u53EF\u8865\u5145\u6216\u8986\u76D6\u3002\u5185\u5BB9\u8D85\u8FC7 100KB \u4F1A\u88AB\u5E94\u7528\u622A\u65AD\u3002",
113
146
  agentsPlaceholder: "\u586B\u5199\u5E0C\u671B\u6240\u6709\u9879\u76EE\u9ED8\u8BA4\u9075\u5FAA\u7684\u6307\u4EE4\uFF1B\u6E05\u7A7A\u5E76\u4FDD\u5B58\u5373\u79FB\u9664\u5168\u5C40\u63D0\u793A\u8BCD",
114
147
  agentsSave: "\u4FDD\u5B58",
@@ -150,7 +183,7 @@
150
183
  syncIncludeZcp: "ZCode Pro \u8BBE\u7F6E",
151
184
  syncIncludeZcpDesc: "\u529F\u80FD\u5F00\u5173\u3001\u6837\u5F0F\u8C03\u6574\u4E0E\u4EE3\u7406\u8BBE\u7F6E\uFF1B\u540C\u6B65\u914D\u7F6E\u4E0E\u51ED\u636E\u672C\u8EAB\u4E0D\u53C2\u4E0E\u540C\u6B65\u3002\u9879\u76EE\u522B\u540D\u4E0D\u540C\u6B65\uFF08\u5B98\u65B9\u5DF2\u652F\u6301\u6539\u9879\u76EE\u540D\uFF09\u3002",
152
185
  syncIncludeModel: "\u6A21\u578B\u8BBE\u7F6E",
153
- syncIncludeModelDesc: "\u81EA\u5B9A\u4E49\u4F9B\u5E94\u5546\u4E0E\u6A21\u578B\u914D\u7F6E\uFF08config.json \u4E0E provider_config.json\uFF0C\u542B API Key\uFF09\u3002\u8D26\u53F7\u767B\u5F55\u7684\u51ED\u636E\uFF08\u5982 BigModel \u8BA2\u9605\uFF09\u4E0D\u53C2\u4E0E\u540C\u6B65\uFF0C\u5404\u673A\u5668\u7528\u5404\u81EA\u8D26\u53F7\u767B\u5F55\u3002",
186
+ syncIncludeModelDesc: "\u81EA\u5B9A\u4E49\u4F9B\u5E94\u5546\u4E0E\u6A21\u578B\u914D\u7F6E\uFF08config.json \u4E0E provider_config.json\uFF0C\u542B API Key\uFF09\u4E0E Headroom \u4F9B\u5E94\u5546\u6620\u5C04\uFF08headroom.json\uFF0Ckey \u4EC5\u4EE5 keyHash \u5B58\u50A8\u3001\u4E0D\u542B\u660E\u6587\uFF09\u3002\u8D26\u53F7\u767B\u5F55\u7684\u51ED\u636E\uFF08\u5982 BigModel \u8BA2\u9605\uFF09\u4E0D\u53C2\u4E0E\u540C\u6B65\uFF0C\u5404\u673A\u5668\u7528\u5404\u81EA\u8D26\u53F7\u767B\u5F55\u3002",
154
187
  syncUpload: "\u4E0A\u4F20\u5230\u4E91\u7AEF",
155
188
  syncDownload: "\u4ECE\u4E91\u7AEF\u4E0B\u8F7D",
156
189
  syncUploading: "\u4E0A\u4F20\u4E2D\u2026",
@@ -268,7 +301,7 @@
268
301
  featureSandboxReclaimDesc: "\u6C99\u7BB1\u6EE1 64 \u4E2A\u65F6\u81EA\u52A8\u91CA\u653E\u6700\u65E9\u7684\uFF0C\u65B0\u5361\u7247\u4E0D\u518D\u6253\u4E0D\u5F00\uFF1B\u65E7\u5361\u91CD\u65B0\u6253\u5F00\u6240\u5728\u4F1A\u8BDD\u5373\u53EF\u6062\u590D\u3002",
269
302
  featurePluginCardRetry: "\u63D2\u4EF6\u5361\u7247\u81EA\u52A8\u91CD\u8BD5",
270
303
  featurePluginCardRetryDesc: "\u56E0\u540D\u989D\u4E0A\u9650\u52A0\u8F7D\u5931\u8D25\u7684\u63D2\u4EF6\u5361\u7247\u81EA\u52A8\u70B9\u51FB\u91CD\u65B0\u52A0\u8F7D\uFF0C\u540D\u989D\u7A7A\u51FA\u540E\u81EA\u52A8\u6062\u590D\u3002",
271
- visionCardUi: "\u601D\u8003\u8FC7\u7A0B\u663E\u793A\u8BC6\u56FE\u5361\u7247",
304
+ visionCardUi: "\u601D\u8003\u8FC7\u7A0B\u663E\u793A Vision \u5361\u7247",
272
305
  pinnedToggleAria: "\u6298\u53E0/\u5C55\u5F00\u5DF2\u7F6E\u9876",
273
306
  sidebarProjectSpacingName: "\u9879\u76EE\u95F4\u8DDD",
274
307
  sidebarProjectSpacingDesc: "\u4FA7\u8FB9\u680F\u4E2D\u76F8\u90BB\u9879\u76EE\u884C\u4E4B\u95F4\u7684\u89C6\u89C9\u95F4\u8DDD\uFF08\u542B\u884C\u5185\u7559\u767D\uFF09\uFF1B\u8BBE\u7F6E\u540E\u5404\u5206\u533A\uFF08\u5DF2\u7F6E\u9876/\u9879\u76EE/\u4EFB\u52A1\uFF09\u4E4B\u95F4\u7684\u95F4\u8DDD\u4E5F\u7EDF\u4E00\u4E3A\u8BE5\u503C\u3002",
@@ -280,14 +313,14 @@
280
313
  userFontDesc: "\u4F1A\u8BDD\u4E2D\u63D0\u95EE\u5185\u5BB9\u7684\u5B57\u4F53\uFF1B\u9009\u201C\u9ED8\u8BA4\u201D\u65F6\u8DDF\u968F\u754C\u9762\u5B57\u4F53\u3002",
281
314
  assistantFontName: "\u56DE\u7B54\u5B57\u4F53",
282
315
  assistantFontDesc: "\u4F1A\u8BDD\u4E2D\u56DE\u7B54\u6B63\u6587\u7684\u5B57\u4F53\uFF08\u4EE3\u7801\u5757\u4ECD\u7528\u7B49\u5BBD\u5B57\u4F53\uFF09\uFF1B\u9009\u201C\u9ED8\u8BA4\u201D\u65F6\u8DDF\u968F\u754C\u9762\u5B57\u4F53\u3002",
283
- switcherHint: "{prev} / {next} \u6216 \u2191 / \u2193 \u9009\u62E9\uFF0CEnter \u6216\u677E\u5F00 alt \u5207\u6362\uFF0CEsc \u53D6\u6D88",
316
+ switcherHint: "{prev} / {next} \u6216 \u2191 / \u2193 \u9009\u62E9\uFF0CEnter \u6216\u70B9\u51FB\u884C\u5207\u6362\uFF0CEsc \u53D6\u6D88",
284
317
  switcherCurrent: "\u5F53\u524D",
285
318
  switcherEmpty: "\u6682\u65E0\u4E0A\u6B21\u4F1A\u8BDD\uFF08\u5207\u6362\u8FC7\u4F1A\u8BDD\u540E\u53EF\u7528\uFF09",
286
319
  switcherFailed: "\u672A\u80FD\u5207\u6362\u5230\u8BE5\u4F1A\u8BDD\uFF08\u53EF\u80FD\u5DF2\u5220\u9664\uFF09",
287
320
  switcherMore: "\u8FD8\u6709 {n} \u6761 \xB7 \u6309 c \u52A0\u8F7D",
288
321
  switcherRunning: "\u8FD0\u884C\u4E2D",
289
322
  switcherUnseen: "\u672A\u67E5\u770B",
290
- switcherAttentionHint: "\u8FD0\u884C\u4E2D / \u8FD0\u884C\u5B8C\u672A\u67E5\u770B\u7684\u4EFB\u52A1 \xB7 {prev} / {next} \u6216 \u2191 / \u2193 \u9009\u62E9\uFF0CEnter \u6216\u677E\u5F00 alt \u5207\u6362",
323
+ switcherAttentionHint: "\u8FD0\u884C\u4E2D / \u8FD0\u884C\u5B8C\u672A\u67E5\u770B\u7684\u4EFB\u52A1 \xB7 {prev} / {next} \u6216 \u2191 / \u2193 \u9009\u62E9\uFF0CEnter \u6216\u70B9\u51FB\u884C\u5207\u6362",
291
324
  switcherAttentionEmpty: "\u6682\u65E0\u8FD0\u884C\u4E2D\u6216\u672A\u67E5\u770B\u7684\u4EFB\u52A1",
292
325
  featureNewtabPanels: "\u65B0\u6807\u7B7E\u9875\u63D2\u4EF6\u9762\u677F\u5165\u53E3",
293
326
  featureNewtabPanelsDesc: "\u65B0\u6807\u7B7E\u9875\u52A0\u5165\u7B2C\u4E09\u65B9\u63D2\u4EF6\uFF08headroom\u3001rtk \u7B49\uFF09\u7684\u9762\u677F\u5361\u7247\uFF0C\u70B9\u51FB\u5728\u4FA7\u8FB9\u9762\u677F\u6253\u5F00\u3002",
@@ -302,7 +335,7 @@
302
335
  themeBgRegionLeft: "\u5DE6\u4FA7\u8FB9\u680F",
303
336
  themeBgRegionCenter: "\u4E2D\u95F4\u533A\u57DF",
304
337
  themeBgRegionRight: "\u53F3\u4FA7\u8FB9\u680F",
305
- themeBgPane: "\u80CC\u666F\u56FE",
338
+ themeBgPane: "\u58C1\u7EB8",
306
339
  themeSkinTitle: "\u76AE\u80A4",
307
340
  themeSkinDesc: "\u77E5\u540D\u7F16\u8F91\u5668\u4E3B\u9898\u914D\u8272\uFF0C\u81EA\u52A8\u5339\u914D ZCode \u7684\u6D45\u8272 / \u6DF1\u8272\u6A21\u5F0F\uFF1B\u9ED8\u8BA4\u4FDD\u6301 ZCode \u539F\u6837\uFF0C\u81EA\u5B9A\u4E49\u5728\u4E0B\u65B9\u81EA\u884C\u8C03\u8272\u3002",
308
341
  themeSkinCustom: "\u81EA\u5B9A\u4E49",
@@ -315,39 +348,55 @@
315
348
  themeCustomFg: "\u6B63\u6587",
316
349
  themeCustomMuted: "\u6B21\u7EA7\u6587\u5B57",
317
350
  themeCustomAccent: "\u5F3A\u8C03\u8272",
318
- themeBgDesc: "\u80CC\u666F\u6765\u6E90\u53EF\u9009\u672C\u5730\u56FE\u5E93\u3001\u6587\u4EF6\u5939\uFF08\u5B9A\u65F6\u8F6E\u6362\uFF09\u6216\u7F51\u5740\uFF08\u5B9A\u65F6\u5237\u65B0\uFF09\uFF0C\u5DE6\u680F / \u4E2D\u680F / \u53F3\u680F\u53EF\u5206\u533A\u72EC\u7ACB\u8BBE\u7F6E\uFF1B\u4FA7\u680F\u3001\u4F1A\u8BDD\u6D41\u3001\u8F93\u5165\u6846\u900F\u51FA\u80CC\u666F\uFF0C\u5F39\u7A97\u83DC\u5355\u4FDD\u6301\u4E0D\u900F\u660E\u4FDD\u53EF\u8BFB\u3002\u672C\u5730\u56FE\u5E93\u968F WebDAV \u540C\u6B65\u4E0A\u4F20\uFF08\u8986\u76D6\u5F0F\uFF0C\u4E0D\u7559\u5386\u53F2\u7248\u672C\uFF09\u3002",
319
- themeBgModeNone: "\u65E0\u80CC\u666F",
351
+ themeBgDesc: "\u58C1\u7EB8\u652F\u6301\u56FE\u7247\u3001\u89C6\u9891\u3001\u7F51\u9875\u4E09\u7C7B\uFF0C\u94FA\u5728\u754C\u9762\u540E\u65B9\uFF1B\u6765\u6E90\u53EF\u9009\u672C\u5730\u56FE\u5E93\u3001\u6587\u4EF6\u5939\uFF08\u5B9A\u65F6\u8F6E\u6362\uFF09\u3001\u56FE\u7247\u7F51\u5740\uFF08\u5B9A\u65F6\u5237\u65B0\uFF09\u6216\u7F51\u9875\u5730\u5740\uFF0C\u5DE6\u680F / \u4E2D\u680F / \u53F3\u680F\u53EF\u5206\u533A\u72EC\u7ACB\u8BBE\u7F6E\uFF08\u4EC5\u9759\u6001\u56FE\uFF09\uFF1B\u4FA7\u680F\u3001\u4F1A\u8BDD\u6D41\u3001\u8F93\u5165\u6846\u900F\u51FA\u753B\u9762\uFF0C\u5F39\u7A97\u83DC\u5355\u4FDD\u6301\u4E0D\u900F\u660E\u4FDD\u53EF\u8BFB\u3002\u672C\u5730\u56FE\u5E93\u968F WebDAV \u540C\u6B65\u4E0A\u4F20\uFF08\u8986\u76D6\u5F0F\uFF0C\u4E0D\u7559\u5386\u53F2\u7248\u672C\uFF09\u3002",
352
+ themeBgModeNone: "\u65E0\u58C1\u7EB8",
320
353
  themeBgModeLibrary: "\u672C\u5730\u56FE\u5E93",
321
354
  themeBgModeFolder: "\u6587\u4EF6\u5939",
322
- themeBgModeUrl: "\u7F51\u5740",
355
+ themeBgModeUrl: "\u56FE\u7247\u7F51\u5740",
356
+ themeBgModeWeb: "\u7F51\u9875",
323
357
  themeBgLibrary: "\u6211\u7684\u56FE\u5E93",
324
- themeBgUpload: "\u4E0A\u4F20\u56FE\u7247",
325
- themeBgEmpty: "\u8FD8\u6CA1\u6709\u4E0A\u4F20\u56FE\u7247\uFF0C\u652F\u6301 png / jpg / webp / gif / bmp / avif\uFF0C\u5355\u5F20 10MB \u4EE5\u5185",
358
+ themeBgUpload: "\u4E0A\u4F20\u56FE\u7247/\u89C6\u9891",
359
+ themeBgEmpty: "\u8FD8\u6CA1\u6709\u4E0A\u4F20\u6587\u4EF6\uFF1B\u56FE\u7247\u652F\u6301 png / jpg / webp / gif / bmp / avif\uFF0810MB \u4EE5\u5185\uFF09\uFF0C\u89C6\u9891\u652F\u6301 mp4 / webm / mov\uFF08200MB \u4EE5\u5185\uFF09",
326
360
  themeBgDelete: "\u5220\u9664",
327
- themeBgNoneHint: "\u9009\u62E9\u4E00\u79CD\u80CC\u666F\u6765\u6E90\uFF1B\u6587\u4EF6\u5939\u53EF\u5B9A\u65F6\u8F6E\u6362\uFF0C\u7F51\u5740\u53EF\u914D\u5408\u968F\u673A\u56FE API \u5B9A\u65F6\u5237\u65B0\u3002",
361
+ themeBgNoneHint: "\u9009\u62E9\u4E00\u79CD\u58C1\u7EB8\u6765\u6E90\uFF1B\u56FE\u5E93\u548C\u6587\u4EF6\u5939\u53EF\u5B9A\u65F6\u8F6E\u6362\uFF0C\u56FE\u7247\u7F51\u5740\u53EF\u914D\u5408\u968F\u673A\u56FE API \u5B9A\u65F6\u5237\u65B0\u3002",
328
362
  themeBgFolderPick: "\u6D4F\u89C8",
329
- themeBgFolderPickTitle: "\u9009\u62E9\u80CC\u666F\u56FE\u6587\u4EF6\u5939",
330
- themeBgFolderHint: "\u9009\u62E9\u4E00\u4E2A\u88C5\u58C1\u7EB8\u7684\u6587\u4EF6\u5939\uFF0C\u56FE\u7247\u539F\u5730\u8BFB\u53D6\u4E0D\u590D\u5236\u3002",
363
+ themeBgFolderPickTitle: "\u9009\u62E9\u58C1\u7EB8\u6587\u4EF6\u5939",
364
+ themeBgFolderHint: "\u9009\u62E9\u4E00\u4E2A\u88C5\u58C1\u7EB8\u7684\u6587\u4EF6\u5939\uFF0C\u6587\u4EF6\u539F\u5730\u8BFB\u53D6\u4E0D\u590D\u5236\u3002",
331
365
  themeBgFolderRandom: "\u968F\u673A\u987A\u5E8F",
332
366
  themeBgIntervalHint: "\u5207\u6362\u95F4\u9694\uFF08\u5206\u949F\uFF09",
333
367
  themeBgIntervalUnit: "\u5206\u949F\uFF0C0 = \u4E0D\u5207\u6362",
334
- themeBgFolderCount: "\u6587\u4EF6\u5939\u91CC\u6709 {n} \u5F20\u56FE\u7247\uFF0C\u5B9A\u65F6\u8F6E\u6362\u4E2D\u3002",
335
- themeBgFolderMissing: "\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\u6216\u91CC\u9762\u6CA1\u6709\u56FE\u7247\u3002",
368
+ themeBgFolderCount: "\u6587\u4EF6\u5939\u91CC\u6709 {n} \u4E2A\u58C1\u7EB8\u6587\u4EF6\uFF0C\u5B9A\u65F6\u8F6E\u6362\u4E2D\u3002",
369
+ themeBgFolderMissing: "\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\u6216\u91CC\u9762\u6CA1\u6709\u58C1\u7EB8\u6587\u4EF6\u3002",
336
370
  themeBgUrlHint: "\u5B9A\u65F6\u5237\u65B0\u9002\u5408\u968F\u673A\u56FE API\uFF08\u6BCF\u6B21\u8BF7\u6C42\u8FD4\u56DE\u4E0D\u540C\u56FE\uFF09\uFF1B\u5237\u65B0\u65F6\u5E26\u7F13\u5B58\u53C2\u6570\u907F\u514D\u547D\u4E2D\u7F13\u5B58\u3002",
337
371
  themeBgUrlIntervalHint: "\u5237\u65B0\u95F4\u9694\uFF08\u5206\u949F\uFF09",
338
372
  themeBgUrlInvalid: "\u7F51\u5740\u9700\u4EE5 http(s):// \u5F00\u5934",
373
+ themeBgWebHint: "\u7F51\u9875\u58C1\u7EB8\u7528\u6C99\u7BB1 iframe \u94FA\u5728\u754C\u9762\u540E\u65B9\uFF0C\u9875\u9762\u9700\u81EA\u884C\u64AD\u653E\u52A8\u753B\u6216\u89C6\u9891\uFF1B\u4EC5\u9875\u9762\u81EA\u8EAB\u900F\u660E\u5E95\u65F6\u80FD\u900F\u51FA\u58C1\u7EB8\uFF0C\u90E8\u5206\u4F9D\u8D56\u767B\u5F55\u6001\u7684\u9875\u9762\u65E0\u6CD5\u663E\u793A\u3002",
339
374
  themeBgFit: "\u7F29\u653E\u65B9\u5F0F",
340
375
  themeBgFitCover: "\u586B\u6EE1",
341
376
  themeBgFitContain: "\u9002\u5E94",
342
377
  themeBgFitFill: "\u62C9\u4F38",
343
378
  themeBgFitTile: "\u5E73\u94FA",
344
379
  themeBgMask: "\u906E\u7F69\u4E0D\u900F\u660E\u5EA6",
345
- themeBgMaskHint: "\u6570\u503C\u8D8A\u9AD8\uFF0C\u56FE\u7247\u8D8A\u5411\u4E3B\u9898\u80CC\u666F\u8272\u6DE1\u5316\uFF0C\u6587\u5B57\u5BF9\u6BD4\u8D8A\u6E05\u6670",
346
- themeBgMaskHint2: "\u56FE\u7247\u5411\u4E3B\u9898\u80CC\u666F\u8272\u6DE1\u5316\u7684\u7A0B\u5EA6",
347
- themeBgBlur: "\u56FE\u7247\u6A21\u7CCA",
380
+ themeBgMaskHint: "\u6570\u503C\u8D8A\u9AD8\uFF0C\u753B\u9762\u8D8A\u5411\u4E3B\u9898\u80CC\u666F\u8272\u6DE1\u5316\uFF0C\u6587\u5B57\u5BF9\u6BD4\u8D8A\u6E05\u6670",
381
+ themeBgMaskHint2: "\u753B\u9762\u5411\u4E3B\u9898\u80CC\u666F\u8272\u6DE1\u5316\u7684\u7A0B\u5EA6",
382
+ themeBgBlur: "\u753B\u9762\u6A21\u7CCA",
348
383
  themeBgPanel: "\u9762\u677F\u4E0D\u900F\u660E\u5EA6",
349
- themeBgPanelHint: "\u4FA7\u680F\u3001\u9762\u677F\u4E0E\u6807\u7B7E\u680F\u7684\u4E0D\u900F\u660E\u7A0B\u5EA6\u3002\u8D8A\u4F4E\uFF0C\u900F\u51FA\u7684\u56FE\u7247\u8D8A\u591A\u3002",
350
- themeBgDeletedActive: "\u5F53\u524D\u80CC\u666F\u5DF2\u5220\u9664\uFF0C\u5DF2\u81EA\u52A8\u505C\u7528\u80CC\u666F",
384
+ themeBgPanelHint: "\u4FA7\u680F\u3001\u9762\u677F\u4E0E\u6807\u7B7E\u680F\u7684\u4E0D\u900F\u660E\u7A0B\u5EA6\u3002\u8D8A\u4F4E\uFF0C\u900F\u51FA\u7684\u753B\u9762\u8D8A\u591A\u3002",
385
+ themeBgPlayback: "\u64AD\u653E",
386
+ themeBgVolume: "\u97F3\u91CF",
387
+ themeBgVolumeHint: "\u89C6\u9891\u58C1\u7EB8\u7684\u97F3\u8F68\u97F3\u91CF\uFF0C0 = \u9759\u97F3\uFF08\u9ED8\u8BA4\uFF09",
388
+ themeBgRate: "\u500D\u901F",
389
+ themeBgFps: "\u5E27\u7387\u4E0A\u9650",
390
+ themeBgFpsOff: "\u539F\u59CB\u5E27\u7387",
391
+ themeBgFpsHint: "\u5BF9\u89C6\u9891\u58C1\u7EB8\u91CD\u7F16\u7801\u62BD\u5E27\u4EE5\u7701\u8D44\u6E90\uFF0C\u9700\u8981 ffmpeg\uFF1B\u672A\u5B89\u88C5\u65F6\u4FDD\u6301\u539F\u59CB\u5E27\u7387\u3002",
392
+ themeBgTransition: "\u5207\u6362\u8F6C\u573A",
393
+ themeBgTransitionCut: "\u786C\u5207",
394
+ themeBgTransitionFade: "\u6DE1\u5165\u6DE1\u51FA",
395
+ themeBgPause: "\u6682\u505C\u6761\u4EF6",
396
+ themeBgPauseHidden: "\u7A97\u53E3\u6700\u5C0F\u5316\u65F6",
397
+ themeBgPauseBlur: "\u7A97\u53E3\u5931\u7126\u65F6",
398
+ themeBgPauseBattery: "\u7535\u6C60\u4F9B\u7535\u65F6",
399
+ themeBgDeletedActive: "\u5F53\u524D\u58C1\u7EB8\u5DF2\u5220\u9664\uFF0C\u5DF2\u81EA\u52A8\u505C\u7528\u58C1\u7EB8",
351
400
  tableCopyBtn: "\u590D\u5236\u8868\u683C",
352
401
  tableCopied: "\u8868\u683C\u5DF2\u590D\u5236",
353
402
  sbItemCtx: "\u4E0A\u4E0B\u6587\u5360\u7528",
@@ -384,8 +433,6 @@
384
433
  hkArrow: "\u5F39\u7A97\u6253\u5F00\u65F6\u79FB\u52A8\u9AD8\u4EAE\uFF08\u4E0E alt + {prev} / alt + {next} \u540C\u89C4\u5219\uFF09",
385
434
  hkEnter: "\u786E\u8BA4\u5207\u6362\u5230\u9AD8\u4EAE\u7684\u4F1A\u8BDD",
386
435
  hkEsc: "\u53D6\u6D88\u5E76\u5173\u95ED\u5F39\u7A97",
387
- hkRelease: "\u79FB\u52A8\u8FC7\u9AD8\u4EAE\u65F6\u677E\u5F00\u5373\u5207\u6362\uFF1B\u4ECE\u672A\u79FB\u52A8\u5219\u5F39\u7A97\u4FDD\u6301\u6253\u5F00\uFF0C\u7EE7\u7EED\u9009\u62E9",
388
- hkReleaseKey: "\u677E\u5F00 alt",
389
436
  hkModify: "\u4FEE\u6539",
390
437
  hkRecording: "\u6309\u4E0B\u65B0\u952E\u2026",
391
438
  hkInvalid: "\u5FEB\u6377\u952E\u53EA\u652F\u6301\u5355\u4E2A\u5B57\u6BCD\u6216\u6570\u5B57",
@@ -431,7 +478,11 @@
431
478
  tabVision: "Vision",
432
479
  visionDesc: "\u4E3B\u6A21\u578B\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\u65F6\uFF08\u5982 glm-5.3\uFF09\uFF0C\u81EA\u52A8\u628A\u6D88\u606F\u91CC\u7684\u56FE\u7247\u4EA4\u7ED9\u4E0B\u9762\u7684\u89C6\u89C9\u6A21\u578B\u8BC6\u522B\uFF0C\u628A\u63CF\u8FF0\u5E26\u7ED9\u4E3B\u6A21\u578B\uFF08zcode-vision \u63D2\u4EF6\uFF1B/vision-* \u547D\u4EE4\u7F16\u8F91\u540C\u4E00\u914D\u7F6E\uFF09\u3002",
433
480
  visionEnabled: "\u542F\u7528",
434
- visionForceIntercept: "\u4E3B\u6A21\u578B\u80FD\u770B\u56FE\u4E5F\u62E6\u622A",
481
+ visionForceIntercept: "\u4E3B\u6A21\u578B",
482
+ visionForceInterceptAuto: "\u4E0D\u80FD\u8BC6\u56FE\u5C31\u4F7F\u7528\u63D2\u4EF6",
483
+ visionForceInterceptTrue: "\u59CB\u7EC8\u4F7F\u7528\u63D2\u4EF6",
484
+ visionForceInterceptFalse: "\u4E0D\u4F7F\u7528\u63D2\u4EF6",
485
+ visionForceInterceptHint: "\u4E0D\u80FD\u8BC6\u56FE\u5C31\u4F7F\u7528\u63D2\u4EF6 = \u8DDF\u968F ZCode\u300C\u6A21\u578B\u8BBE\u7F6E\u300D\u91CC\u8BE5\u6A21\u578B\u7684\u56FE\u7247\u5F00\u5173\uFF1A\u5F00 = \u6A21\u578B\u81EA\u770B\u4E0D\u91CD\u590D\u8BC6\u522B\uFF0C\u5173 = \u8D70\u8BC6\u522B\u4EE3\u7406\uFF08tool \u6A21\u5F0F\u51FA\u8BC6\u522B\u5361\u7247\uFF09\uFF1B\u59CB\u7EC8\u4F7F\u7528\u63D2\u4EF6 = \u80FD\u770B\u56FE\u4E5F\u5F3A\u5236\u8D70\u8BC6\u522B\u4EE3\u7406\uFF08\u53CC\u91CD\u8BC6\u522B\u6362\u5361\u7247\uFF09\uFF1B\u4E0D\u4F7F\u7528\u63D2\u4EF6 = \u80FD\u770B\u56FE\u5C31\u653E\u884C\uFF08\u4E0D\u80FD\u8BC6\u56FE\u7684\u6A21\u578B\u4ECD\u8D70\u8BC6\u522B\u4EE3\u7406\uFF09",
435
486
  visionMode: "\u94FE\u6A21\u5F0F",
436
487
  visionModeFallback: "\u4F9D\u6B21\u5C1D\u8BD5",
437
488
  visionModeFallbackDesc: "\u524D\u4E00\u4E2A\u5931\u8D25\u624D\u8BD5\u4E0B\u4E00\u4E2A\uFF0C\u4EFB\u4E00\u6210\u529F\u5373\u6B62\uFF08\u4E3B\u529B + \u5907\u7528\uFF09\u3002",
@@ -478,7 +529,7 @@
478
529
  headroomDesc: "Headroom \u63D2\u4EF6\uFF1A\u672C\u5730\u538B\u7F29\u4EE3\u7406\u9A7B\u7559 127.0.0.1\uFF08\u9ED8\u8BA4 8787 \u7AEF\u53E3\uFF09\uFF0C\u538B\u7F29\u53D1\u5F80\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u4EE5\u7701 token\uFF08/hr-* \u547D\u4EE4\u7F16\u8F91\u540C\u4E00\u914D\u7F6E\uFF09\u3002\u5207\u6362\u8BBE\u5907\u4F1A\u91CD\u542F\u4EE3\u7406\uFF0C\u6B63\u5728\u5904\u7406\u7684\u8BF7\u6C42\u53EF\u80FD\u4E2D\u65AD\u4E00\u6B21\u3002",
479
530
  headroomBinMissing: "\u672A\u627E\u5230 headroom \u7A0B\u5E8F\uFF0C\u4EE3\u7406\u65E0\u6CD5\u542F\u52A8\uFF1B\u5B89\u88C5 headroom \u540E\u4EE5\u4E0B\u8BBE\u7F6E\u81EA\u52A8\u751F\u6548",
480
531
  hrInstallBin: "\u5B89\u88C5 headroom \u672C\u4F53",
481
- hrBinInstalled: "headroom \u672C\u4F53\u5DF2\u5B89\u88C5\uFF1B\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD\u540E\u4EE3\u7406\u53EF\u7528\uFF08SessionStart \u94A9\u5B50\u81EA\u52A8\u62C9\u8D77\uFF09",
532
+ hrBinInstalled: "headroom \u672C\u4F53\u5DF2\u5B89\u88C5\uFF1B\u91CD\u65B0\u6253\u5F00\u5E94\u7528\u6216\u4F1A\u8BDD\u540E\u4EE3\u7406\u53EF\u7528\uFF08SessionStart \u94A9\u5B50\u81EA\u52A8\u62C9\u8D77\uFF09",
482
533
  headroomInstallTitle: "\u672A\u5B89\u88C5 headroom \u63D2\u4EF6",
483
534
  headroomInstallDesc: "\u4ECE zcode-plugins \u5E02\u573A\u5B89\u88C5\u540E\u5373\u53EF\u5728\u6B64\u7BA1\u7406\u538B\u7F29\u4EE3\u7406\uFF1B\u91CD\u542F\u4F1A\u8BDD\u540E\u751F\u6548\u3002",
484
535
  headroomInstall: "\u5B89\u88C5",
@@ -621,6 +672,39 @@
621
672
  tabProxy: "Proxy",
622
673
  tabBehavior: "Behavior",
623
674
  tabAgents: "Global Prompt",
675
+ tabZcode: "ZCode CLI",
676
+ zcodeDesc: "ZCode behavior settings (written to ~/.zcode/cli/config.json); takes effect for new sessions.",
677
+ zcodeStatsTitle: "Skill listing check",
678
+ zcodeStatsCounts: "{total} skills ({user} local \xB7 {plugin} plugin)",
679
+ zcodeStatsChars: "Full listing \u2248 {n} characters",
680
+ zcodeBudgetDefaultTag: " (default)",
681
+ zcodeStatsDegraded: "Over budget: the listing degrades to names only, so the model cannot see skill descriptions",
682
+ zcodeStatsOk: "Within budget: the full listing with descriptions is injected into new sessions",
683
+ zcodeStatsSuggest: "Suggested budget {n} characters (with 20% margin)",
684
+ zcodeBudgetApply: "Use suggested",
685
+ zcodeBudgetApplied: "Listing budget saved.",
686
+ zcodeStatsNote: "Estimated from the current disk state; per-project skill directories are not counted.",
687
+ zcodeSkillEnabled: "Skill system",
688
+ zcodeSkillEnabledDesc: "skills.enabled: when off, ZCode discovers and injects no skills",
689
+ zcodeSkillIncludeInstructions: "Skill instructions injection",
690
+ zcodeSkillIncludeInstructionsDesc: "skills.includeInstructions: whether skill instructions are injected along with the listing",
691
+ zcodeSkillBudget: "Skill listing budget (characters)",
692
+ zcodeSkillBudgetDesc: "skills.metadataBudget: the listing degrades to names only beyond this length; default 20000",
693
+ zcodeSkillRoots: "Extra skill directories",
694
+ zcodeSkillRootsDesc: "skills.roots: one directory per line; skills under them are discovered (beyond ~/.zcode/skills and ~/.agents/skills)",
695
+ zcodeSave: "Save",
696
+ zcodeRootsSaved: "Skill directories saved.",
697
+ zcodeFeatCompact: "Compaction",
698
+ zcodeFeatCompactDesc: "features.compact: compact earlier conversation when the context grows too long",
699
+ zcodeFeatRewind: "Rewind",
700
+ zcodeFeatRewindDesc: "features.rewind: roll back to an earlier point and continue from there",
701
+ zcodeFeatSubagent: "Subagents",
702
+ zcodeFeatSubagentDesc: "features.subagent: dispatch subagents for subtasks",
703
+ zcodeFeatSkill: "Skill tool",
704
+ zcodeFeatSkillDesc: "features.skill: the Skill tool is available (the skill system must also be on)",
705
+ zcodeFeatMcp: "MCP tools",
706
+ zcodeFeatMcpDesc: "features.mcp: use tools provided by MCP servers",
707
+ zcodeMemoryHint: "Memory is not here: workspace memory is toggled in the official settings under Settings \u2192 Agent capabilities \u2192 Memory (with the memory viewer).",
624
708
  agentsDesc: "Written to ~/.zcode/AGENTS.md and used as default instructions in every session across all projects. Takes effect for new sessions; per-project AGENTS.md can extend or override it. Content over 100 KB is truncated by the app.",
625
709
  agentsPlaceholder: "Instructions followed by all projects by default; save empty to remove the global prompt",
626
710
  agentsSave: "Save",
@@ -662,7 +746,7 @@
662
746
  syncIncludeZcp: "ZCode Pro settings",
663
747
  syncIncludeZcpDesc: "Feature toggles, style adjustments and the proxy setting; the sync config and credentials themselves are never synced. Project aliases are not synced (renaming is built in now).",
664
748
  syncIncludeModel: "Model settings",
665
- syncIncludeModelDesc: "Custom providers and model config (config.json and provider_config.json, API keys included). Account sign-in credentials (e.g. the BigModel subscription) are not synced; each computer signs in with its own account.",
749
+ syncIncludeModelDesc: "Custom providers and model config (config.json and provider_config.json, API keys included) and the Headroom provider map (headroom.json; keys are stored as keyHashes, never in plaintext). Account sign-in credentials (e.g. the BigModel subscription) are not synced; each computer signs in with its own account.",
666
750
  syncUpload: "Upload",
667
751
  syncDownload: "Download",
668
752
  syncUploading: "Uploading\u2026",
@@ -792,14 +876,14 @@
792
876
  userFontDesc: 'Font of question text in conversations; "default" follows the UI font.',
793
877
  assistantFontName: "Answer font",
794
878
  assistantFontDesc: 'Font of answer text in conversations (code blocks stay monospaced); "default" follows the UI font.',
795
- switcherHint: "{prev} / {next} or \u2191 / \u2193 to choose, Enter or release alt to switch, Esc to cancel",
879
+ switcherHint: "{prev} / {next} or \u2191 / \u2193 to choose, Enter or click a row to switch, Esc to cancel",
796
880
  switcherCurrent: "current",
797
881
  switcherEmpty: "No previous session yet (available after you switch sessions)",
798
882
  switcherFailed: "Failed to switch to that session (it may have been deleted)",
799
883
  switcherMore: "{n} more \xB7 press c to load",
800
884
  switcherRunning: "running",
801
885
  switcherUnseen: "unseen",
802
- switcherAttentionHint: "Running / finished but unseen tasks \xB7 {prev} / {next} or \u2191 / \u2193 to choose, Enter or release alt to switch",
886
+ switcherAttentionHint: "Running / finished but unseen tasks \xB7 {prev} / {next} or \u2191 / \u2193 to choose, Enter or click a row to switch",
803
887
  switcherAttentionEmpty: "No running or unseen tasks",
804
888
  featureNewtabPanels: "Plugin panels on the new tab page",
805
889
  featureNewtabPanelsDesc: "Adds third-party plugin panels (headroom, rtk, ...) to the new tab page; click to open in the side pane.",
@@ -814,7 +898,7 @@
814
898
  themeBgRegionLeft: "Left sidebar",
815
899
  themeBgRegionCenter: "Center area",
816
900
  themeBgRegionRight: "Right sidebar",
817
- themeBgPane: "Background",
901
+ themeBgPane: "Wallpaper",
818
902
  themeSkinTitle: "Skins",
819
903
  themeSkinDesc: 'Famous editor theme palettes, auto-matching ZCode\u2019s light / dark mode; "Default" keeps ZCode as-is, "Custom" is tuned below.',
820
904
  themeSkinCustom: "Custom",
@@ -827,39 +911,55 @@
827
911
  themeCustomFg: "Text",
828
912
  themeCustomMuted: "Muted text",
829
913
  themeCustomAccent: "Accent",
830
- themeBgDesc: "Sources: local library, folder (rotate on a timer) or URL (refresh on a timer); left / center / right regions can each have their own. Sidebar, chat and composer reveal the background while menus and dialogs stay opaque. The library uploads with the zcode-pro sync group (overwrite, no history versions).",
914
+ themeBgDesc: "Wallpapers can be images, videos or web pages, rendered behind the UI. Sources: local library, folder (rotate on a timer), image URL (refresh on a timer) or a web page; left / center / right regions can each have their own (static images only). Sidebar, chat and composer reveal the wallpaper while menus and dialogs stay opaque. The library uploads with the zcode-pro sync group (overwrite, no history versions).",
831
915
  themeBgModeNone: "None",
832
916
  themeBgModeLibrary: "Library",
833
917
  themeBgModeFolder: "Folder",
834
- themeBgModeUrl: "URL",
918
+ themeBgModeUrl: "Image URL",
919
+ themeBgModeWeb: "Web page",
835
920
  themeBgLibrary: "My library",
836
- themeBgUpload: "Upload",
837
- themeBgEmpty: "No images yet. png / jpg / webp / gif / bmp / avif, up to 10MB each",
921
+ themeBgUpload: "Upload images/videos",
922
+ themeBgEmpty: "Nothing uploaded yet. Images: png / jpg / webp / gif / bmp / avif (up to 10MB); videos: mp4 / webm / mov (up to 200MB)",
838
923
  themeBgDelete: "Delete",
839
- themeBgNoneHint: "Pick a background source; folders rotate on a timer, URLs refresh on a timer for random-image APIs.",
924
+ themeBgNoneHint: "Pick a wallpaper source; library and folder rotate on a timer, image URLs refresh on a timer for random-image APIs.",
840
925
  themeBgFolderPick: "Browse",
841
926
  themeBgFolderPickTitle: "Choose a wallpaper folder",
842
- themeBgFolderHint: "Pick a folder of wallpapers; images are read in place, not copied.",
927
+ themeBgFolderHint: "Pick a folder of wallpapers; files are read in place, not copied.",
843
928
  themeBgFolderRandom: "Random order",
844
929
  themeBgIntervalHint: "Switch interval (minutes)",
845
930
  themeBgIntervalUnit: "min, 0 = off",
846
- themeBgFolderCount: "{n} images in the folder, rotating on the timer.",
847
- themeBgFolderMissing: "Folder missing or contains no images.",
931
+ themeBgFolderCount: "{n} wallpaper files in the folder, rotating on the timer.",
932
+ themeBgFolderMissing: "Folder missing or contains no wallpaper files.",
848
933
  themeBgUrlHint: "Timed refresh suits random-image APIs (each request returns a new image); a cache-buster is appended on refresh.",
849
934
  themeBgUrlIntervalHint: "Refresh interval (minutes)",
850
935
  themeBgUrlInvalid: "URL must start with http(s)://",
936
+ themeBgWebHint: "Web wallpapers render behind the UI in a sandboxed iframe; the page plays its own animation or video. Only pages with their own transparent background reveal the wallpaper; pages that need a login session may not show.",
851
937
  themeBgFit: "Fit",
852
938
  themeBgFitCover: "Fill",
853
939
  themeBgFitContain: "Fit",
854
940
  themeBgFitFill: "Stretch",
855
941
  themeBgFitTile: "Tile",
856
942
  themeBgMask: "Mask opacity",
857
- themeBgMaskHint: "Higher values fade the image toward the theme background color for clearer text",
858
- themeBgMaskHint2: "How much the image fades toward the theme background color",
859
- themeBgBlur: "Image blur",
943
+ themeBgMaskHint: "Higher values fade the wallpaper toward the theme background color for clearer text",
944
+ themeBgMaskHint2: "How much the wallpaper fades toward the theme background color",
945
+ themeBgBlur: "Wallpaper blur",
860
946
  themeBgPanel: "Panel opacity",
861
- themeBgPanelHint: "Opacity of sidebar, panels and tab bar. Lower reveals more of the image.",
862
- themeBgDeletedActive: "Active background was deleted; background disabled",
947
+ themeBgPanelHint: "Opacity of sidebar, panels and tab bar. Lower reveals more of the wallpaper.",
948
+ themeBgPlayback: "Playback",
949
+ themeBgVolume: "Volume",
950
+ themeBgVolumeHint: "Audio track volume of video wallpapers, 0 = muted (default)",
951
+ themeBgRate: "Speed",
952
+ themeBgFps: "FPS cap",
953
+ themeBgFpsOff: "Native",
954
+ themeBgFpsHint: "Re-encodes video wallpapers to a lower frame rate to save resources; needs ffmpeg, otherwise the native rate is kept.",
955
+ themeBgTransition: "Transition",
956
+ themeBgTransitionCut: "Cut",
957
+ themeBgTransitionFade: "Fade",
958
+ themeBgPause: "Pause when",
959
+ themeBgPauseHidden: "Window minimized",
960
+ themeBgPauseBlur: "Window unfocused",
961
+ themeBgPauseBattery: "On battery",
962
+ themeBgDeletedActive: "Active wallpaper was deleted; wallpaper disabled",
863
963
  tableCopyBtn: "Copy table",
864
964
  tableCopied: "Table copied",
865
965
  sbItemCtx: "Context usage",
@@ -896,8 +996,6 @@
896
996
  hkArrow: "Move the highlight while the popup is open (same rules as alt + {prev} / alt + {next})",
897
997
  hkEnter: "Switch to the highlighted session",
898
998
  hkEsc: "Cancel and close the popup",
899
- hkRelease: "Releasing alt switches once the highlight has moved; otherwise the popup stays open for further selection",
900
- hkReleaseKey: "release alt",
901
999
  hkModify: "Change",
902
1000
  hkRecording: "press a key\u2026",
903
1001
  hkInvalid: "Shortcuts accept a single letter or digit only",
@@ -943,7 +1041,11 @@
943
1041
  tabVision: "Vision",
944
1042
  visionDesc: "When the main model cannot see images (e.g. glm-5.3), images in messages are recognized by the vision models below and passed to the main model as text (zcode-vision plugin; /vision-* commands edit the same file).",
945
1043
  visionEnabled: "Enable",
946
- visionForceIntercept: "Intercept even if the main model sees images",
1044
+ visionForceIntercept: "Main model",
1045
+ visionForceInterceptAuto: "Use plugin only if model can't see images",
1046
+ visionForceInterceptTrue: "Always use plugin",
1047
+ visionForceInterceptFalse: "Never use plugin",
1048
+ visionForceInterceptHint: "Use plugin only if model can't see images = follow the image toggle in ZCode model settings: on = the model sees images itself (no duplicate recognition), off = route through the vision proxy (tool mode shows the result card); Always use plugin = forced double recognition for the card; Never use plugin = let capable models see images (models that can't still go through the plugin)",
947
1049
  visionMode: "Chain mode",
948
1050
  visionModeFallback: "Fallback",
949
1051
  visionModeFallbackDesc: "Try in order until one succeeds (primary + backup).",
@@ -990,7 +1092,7 @@
990
1092
  headroomDesc: "Headroom plugin: a local compression proxy on 127.0.0.1 (port 8787 by default) that compresses context sent to the model to save tokens (/hr-* commands edit the same file). Switching the device restarts the proxy, so requests in progress may be interrupted once.",
991
1093
  headroomBinMissing: "The headroom program was not found, so the proxy cannot start. The settings below take effect once it is installed.",
992
1094
  hrInstallBin: "Install headroom binary",
993
- hrBinInstalled: "headroom installed; reopen a session and the hook will start the proxy automatically",
1095
+ hrBinInstalled: "headroom installed; reopen the app or a session and the proxy will start automatically",
994
1096
  headroomInstallTitle: "headroom plugin not installed",
995
1097
  headroomInstallDesc: "Install it from the zcode-plugins marketplace to manage the compression proxy here; takes effect after a session restart.",
996
1098
  headroomInstall: "Install",
@@ -1264,21 +1366,36 @@
1264
1366
 
1265
1367
  // src/inject/ui.js
1266
1368
  var toastTimer = null;
1369
+ var TOAST_KINDS = {
1370
+ success: { name: "success", glyph: "\u2713", ms: 2600 },
1371
+ warning: { name: "warning", glyph: "\uFF01", ms: 3600 },
1372
+ error: { name: "error", glyph: "\u2715", ms: 5e3 },
1373
+ info: { name: "info", glyph: "\u24D8", ms: 2600 }
1374
+ };
1267
1375
  function showToast(text, kind = "info") {
1268
1376
  document.getElementById("__zcodepro_toast__")?.remove();
1269
- const el = h(
1377
+ clearTimeout(toastTimer);
1378
+ const v = TOAST_KINDS[kind === "ok" ? "success" : kind] || TOAST_KINDS.info;
1379
+ const chip = h(
1270
1380
  "div",
1271
1381
  {
1272
- id: "__zcodepro_toast__",
1273
- class: "fixed bottom-6 z-[100] flex max-w-md items-center gap-2 rounded-lg border px-4 py-3 text-ui-sm shadow-lg " + (kind === "error" ? "border-destructive/40 bg-menu text-foreground" : "border-border bg-menu text-foreground"),
1274
- // left 用内联样式:ZCode 的 Tailwind 未编译 left-6/right-6 工具类(bottom-6 有)
1275
- style: "animation:zcodepro-fade-in .18s ease; left: 1.5rem;"
1382
+ class: `zcodepro-toast zcodepro-toast-${v.name}`,
1383
+ style: "animation:zcodepro-fade-in .18s ease;"
1276
1384
  },
1385
+ h("span", { class: "zcodepro-toast-glyph" }, v.glyph),
1277
1386
  h("span", { class: "truncate" }, text)
1278
1387
  );
1279
- document.body.append(el);
1280
- clearTimeout(toastTimer);
1281
- toastTimer = setTimeout(() => el.remove(), kind === "error" ? 5e3 : 2600);
1388
+ const wrap = h("div", { id: "__zcodepro_toast__", class: "pointer-events-none flex items-center justify-center" });
1389
+ const host = document.querySelector("[data-zcodepro-settings]");
1390
+ if (host) {
1391
+ const r = host.getBoundingClientRect();
1392
+ wrap.style.cssText = `position:fixed; left:${Math.round(r.left)}px; top:${Math.round(r.top)}px; width:${Math.round(r.width)}px; height:${Math.round(r.height)}px; z-index:100;`;
1393
+ } else {
1394
+ wrap.style.cssText = "position:fixed; inset:0; z-index:100;";
1395
+ }
1396
+ wrap.append(chip);
1397
+ document.body.append(wrap);
1398
+ toastTimer = setTimeout(() => wrap.remove(), v.ms);
1282
1399
  }
1283
1400
  var overlayClass = "fixed inset-0 isolate z-50 flex items-start justify-center bg-black/60 supports-backdrop-filter:backdrop-blur-xs duration-100 p-4 platform-linux-desktop:top-12";
1284
1401
  var overlayClassBare = "fixed inset-0 isolate z-50 flex items-start justify-center duration-100 p-4 platform-linux-desktop:top-12";
@@ -1289,6 +1406,13 @@
1289
1406
  const prevActive = document.activeElement;
1290
1407
  let cleanupDrag = null;
1291
1408
  const close = () => {
1409
+ const active = document.activeElement;
1410
+ if (active && overlayEl.contains(active)) {
1411
+ try {
1412
+ active.blur();
1413
+ } catch {
1414
+ }
1415
+ }
1292
1416
  overlayEl.remove();
1293
1417
  dialogStack = dialogStack.filter((e) => e !== overlayEl);
1294
1418
  document.removeEventListener("keydown", onKey);
@@ -1353,11 +1477,34 @@
1353
1477
  titleEl.style.cursor = "move";
1354
1478
  titleEl.style.userSelect = "none";
1355
1479
  let dragging = false, sx = 0, sy = 0, ox = 0, oy = 0;
1480
+ let tbCache = { at: 0, h: 0 };
1481
+ const titleBarHeight = () => {
1482
+ if (Date.now() - tbCache.at < 2e3) return tbCache.h;
1483
+ let h2 = 0;
1484
+ try {
1485
+ for (const el of document.querySelectorAll('[class*="app-region"], [style*="app-region"], header')) {
1486
+ const st = getComputedStyle(el);
1487
+ if ((st.webkitAppRegion || st.appRegion) !== "drag") continue;
1488
+ const r = el.getBoundingClientRect();
1489
+ if (r.top <= 2 && r.height > 8 && r.height < 120) h2 = Math.max(h2, r.bottom);
1490
+ }
1491
+ } catch {
1492
+ }
1493
+ tbCache = { at: Date.now(), h: h2 };
1494
+ return h2;
1495
+ };
1496
+ const baseRect = () => {
1497
+ const r = content.getBoundingClientRect();
1498
+ return { left: r.left - ox, top: r.top - oy, right: r.right - ox, bottom: r.bottom - oy };
1499
+ };
1500
+ const clampAxis = (v, lo, hi) => lo > hi ? (lo + hi) / 2 : Math.min(hi, Math.max(lo, v));
1356
1501
  const clampPos = (x, y) => {
1357
- const ob = overlayEl.getBoundingClientRect();
1358
- const mx = Math.max(0, (ob.width - content.offsetWidth) / 2 - 8);
1359
- const my = Math.max(0, (ob.height - content.offsetHeight) / 2 - 8);
1360
- return [Math.min(mx, Math.max(-mx, x)), Math.min(my, Math.max(-my, y))];
1502
+ const M = 8;
1503
+ const b = baseRect();
1504
+ return [
1505
+ clampAxis(x, M - b.left, window.innerWidth - M - b.right),
1506
+ clampAxis(y, titleBarHeight() + M - b.top, window.innerHeight - M - b.bottom)
1507
+ ];
1361
1508
  };
1362
1509
  const applyPos = () => {
1363
1510
  content.style.transform = ox || oy ? `translate(${ox}px, ${oy}px)` : "";
@@ -1649,6 +1796,23 @@
1649
1796
  if (!root) return;
1650
1797
  root.append(h("style", { id: "__zcodepro_style__" }, `
1651
1798
  @keyframes zcodepro-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
1799
+ /* \u63D0\u793A\u6761\u56DB\u6001\uFF08\u6210\u529F/\u8B66\u544A/\u5931\u8D25/\u4FE1\u606F\uFF09\uFF1A\u914D\u8272\u7528\u4E3B\u9898\u53D8\u91CF\u52A0\u5B57\u9762\u91CF\u515C\u5E95\uFF0C
1800
+ \u4E0D\u4F9D\u8D56\u5BBF\u4E3B Tailwind \u751F\u6210\u914D\u8272\u5DE5\u5177\u7C7B */
1801
+ .zcodepro-toast {
1802
+ display: flex; align-items: center; gap: .5rem;
1803
+ max-width: 28rem; padding: .75rem 1rem;
1804
+ border-radius: .5rem; border: 1px solid var(--color-border, #555);
1805
+ background: var(--color-menu, #1f1f1f); color: var(--color-foreground, #eee);
1806
+ font-size: .875rem; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .3);
1807
+ }
1808
+ .zcodepro-toast .zcodepro-toast-glyph { font-weight: 600; }
1809
+ .zcodepro-toast-success { border-color: #22c55e; }
1810
+ .zcodepro-toast-success .zcodepro-toast-glyph { color: #22c55e; }
1811
+ .zcodepro-toast-warning { border-color: #f59e0b; }
1812
+ .zcodepro-toast-warning .zcodepro-toast-glyph { color: #f59e0b; }
1813
+ .zcodepro-toast-error { border-color: var(--color-destructive, #ef4444); }
1814
+ .zcodepro-toast-error .zcodepro-toast-glyph { color: var(--color-destructive, #ef4444); }
1815
+ .zcodepro-toast-info .zcodepro-toast-glyph { color: var(--color-foreground-subtle, #999); }
1652
1816
  /* \u5F39\u7A97\u906E\u7F69/\u9762\u677F\u515C\u5E95\uFF1A\u4E0D\u4F9D\u8D56\u5E94\u7528 Tailwind \u7C7B\u662F\u5426\u4ECD\u5B58\u5728\uFF1B\u4E3B\u9898\u8272\u8D70 --color-* \u53D8\u91CF\uFF0C\u7F3A\u5931\u65F6\u56DE\u9000\u5B57\u9762\u91CF */
1653
1817
  .zcodepro-overlay { background-color: rgba(0, 0, 0, 0.6); }
1654
1818
  .zcodepro-overlay[data-overlay="none"] { background-color: transparent; }
@@ -1752,7 +1916,7 @@
1752
1916
  }
1753
1917
  .zcodepro-bg-card:hover { filter: brightness(1.15); }
1754
1918
  .zcodepro-bg-card[data-state="active"] { border-color: var(--color-primary, #333); }
1755
- .zcodepro-bg-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
1919
+ .zcodepro-bg-card img, .zcodepro-bg-card video { width: 100%; height: 100%; object-fit: cover; display: block; }
1756
1920
  .zcodepro-bg-del {
1757
1921
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
1758
1922
  border-radius: 6px; border: none; cursor: pointer; font-size: 11px; line-height: 1;
@@ -2159,7 +2323,7 @@
2159
2323
  }
2160
2324
  async function copyText(text) {
2161
2325
  const L = t();
2162
- if (await copyToClipboard(text)) showToast(L.pathCopied);
2326
+ if (await copyToClipboard(text)) showToast(L.pathCopied, "success");
2163
2327
  else showToast(L.pathCopyFailed, "error");
2164
2328
  }
2165
2329
  async function copyToClipboard(text) {
@@ -2355,7 +2519,7 @@
2355
2519
  close();
2356
2520
  clearConfigCache();
2357
2521
  await refreshAliases();
2358
- showToast(name ? L.aliasSaved : L.aliasCleared);
2522
+ showToast(name ? L.aliasSaved : L.aliasCleared, "success");
2359
2523
  return;
2360
2524
  }
2361
2525
  showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
@@ -2391,7 +2555,7 @@
2391
2555
  close();
2392
2556
  clearConfigCache();
2393
2557
  await refreshAliases();
2394
- showToast(L.aliasCleared);
2558
+ showToast(L.aliasCleared, "success");
2395
2559
  } else showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
2396
2560
  }));
2397
2561
  }
@@ -2523,7 +2687,10 @@
2523
2687
  submitBtn.removeAttribute("disabled");
2524
2688
  if (res.ok) {
2525
2689
  close();
2526
- showToast(res.indexSynced === false ? L.relocateIndexSkipped : L.relocateSuccess);
2690
+ showToast(
2691
+ res.indexSynced === false ? L.relocateIndexSkipped : L.relocateSuccess,
2692
+ res.indexSynced === false ? "warning" : "success"
2693
+ );
2527
2694
  setTimeout(() => location.reload(), 900);
2528
2695
  return;
2529
2696
  }
@@ -2795,7 +2962,7 @@
2795
2962
  content.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: true, cancelable: true }));
2796
2963
  } catch {
2797
2964
  }
2798
- void copyToClipboard(primary.path).then((ok) => showToast(ok ? L.pathCopied : L.pathCopyFailed, ok ? void 0 : "error"));
2965
+ void copyToClipboard(primary.path).then((ok) => showToast(ok ? L.pathCopied : L.pathCopyFailed, ok ? "success" : "error"));
2799
2966
  });
2800
2967
  openItem.after(copyItem);
2801
2968
  }
@@ -2867,7 +3034,7 @@
2867
3034
  try {
2868
3035
  const key = Object.keys(el).find((k) => k.startsWith("__reactFiber$"));
2869
3036
  let fiber = key ? el[key] : null;
2870
- for (let i = 0; fiber && i < 40; i++, fiber = fiber.return) {
3037
+ for (let i = 0; fiber && i < 100; i++, fiber = fiber.return) {
2871
3038
  const props = fiber.memoizedProps;
2872
3039
  if (!props || typeof props !== "object") continue;
2873
3040
  for (const k of ["target", "fileLink", "row"]) {
@@ -3069,9 +3236,9 @@
3069
3236
  if (!blob) throw new Error("empty image");
3070
3237
  if (blob.type !== "image/png") blob = await toPng(blob);
3071
3238
  await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
3072
- showToast(L.imageCopied);
3239
+ showToast(L.imageCopied, "success");
3073
3240
  } catch {
3074
- if (copyViaSelection(img)) showToast(L.imageCopied);
3241
+ if (copyViaSelection(img)) showToast(L.imageCopied, "success");
3075
3242
  else showToast(L.imageCopyFailed, "error");
3076
3243
  }
3077
3244
  }
@@ -3541,7 +3708,7 @@
3541
3708
  clearConfigCache();
3542
3709
  renderList();
3543
3710
  window.dispatchEvent(new CustomEvent("zcodepro:aliases-changed"));
3544
- if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace("{n}", String(ok)));
3711
+ if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace("{n}", String(ok)), "success");
3545
3712
  else showToast(L.aliasMigrateDeadClearFailed, "error");
3546
3713
  };
3547
3714
  const goBtn = btnPrimary(L.aliasMigrateGo, () => {
@@ -3581,9 +3748,9 @@
3581
3748
  decide();
3582
3749
  close();
3583
3750
  if (!failed.length) {
3584
- showToast(L.aliasMigrateDone.replace("{n}", String(ok)), "ok");
3751
+ showToast(L.aliasMigrateDone.replace("{n}", String(ok)), "success");
3585
3752
  } else if (ok) {
3586
- showToast(L.aliasMigratePartial.replace("{n}", String(ok)).replace("{m}", String(failed.length)), "error");
3753
+ showToast(L.aliasMigratePartial.replace("{n}", String(ok)).replace("{m}", String(failed.length)), "warning");
3587
3754
  } else {
3588
3755
  showToast(L.aliasMigrateAllFailed, "error");
3589
3756
  }
@@ -4169,16 +4336,27 @@
4169
4336
  var classObserver = null;
4170
4337
  var currentTheme = { skin: "default", custom: null, bg: { mode: "none", maskOpacity: 0.82, blurPx: 0, panelOpacity: 0.3 } };
4171
4338
  var lastModeSig = "";
4339
+ var lastThemeSig = "";
4340
+ var themePollTimer = null;
4172
4341
  var bgTimer = null;
4342
+ var bgTimerMs = 0;
4343
+ var wpShowTicket = 0;
4344
+ var wpSlide = null;
4345
+ var wpMask = null;
4346
+ var wpMedia = null;
4347
+ var wpTimers = /* @__PURE__ */ new Set();
4348
+ var lastWpSig = "";
4349
+ var batteryCharging = null;
4173
4350
  var regionStyleEl = null;
4174
- var regionTimers = [];
4175
4351
  var regionFolderIdx = { left: -1, center: -1, right: -1 };
4176
4352
  var REGION_SELECTORS = {
4177
4353
  left: 'div[class*="workspace-sidebar-panel-width"]',
4178
4354
  center: '[data-testid="conversation-column"]',
4179
4355
  right: '[data-testid="conversation-column"] ~ [data-testid="browser"]'
4180
4356
  };
4181
- var folderIdx = -1;
4357
+ var rotateIdx = -1;
4358
+ var wpTickFn = null;
4359
+ var wpItem = null;
4182
4360
  var urlTick = 0;
4183
4361
  var applySeq = 0;
4184
4362
  var SURFACE_TOKENS = [
@@ -4193,6 +4371,7 @@
4193
4371
  "--color-input-focused",
4194
4372
  "--color-highspeed-composer-surface"
4195
4373
  ];
4374
+ var sameName = (a, b) => String(a).normalize("NFC").toLowerCase() === String(b).normalize("NFC").toLowerCase();
4196
4375
  var isDarkMode = () => document.documentElement.classList.contains("theme-zai-dark") || document.documentElement.classList.contains("dark");
4197
4376
  var probeEl = null;
4198
4377
  function resolvedColor(token) {
@@ -4204,12 +4383,38 @@
4204
4383
  }
4205
4384
  probeEl.style.color = "";
4206
4385
  probeEl.style.color = `var(${token})`;
4386
+ if (!getComputedStyle(probeEl).getPropertyValue(token).trim()) return "";
4207
4387
  const v = getComputedStyle(probeEl).color;
4208
- return /^rgba?\(/.test(v) ? v : "";
4388
+ return /^[a-z-]+\(/.test(v) ? v : "";
4209
4389
  } catch {
4210
4390
  return "";
4211
4391
  }
4212
4392
  }
4393
+ function rgbTriple(v, fallback) {
4394
+ const pick = (str) => {
4395
+ const m = str.match(/^rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)/);
4396
+ if (m) return [Math.round(+m[1]), Math.round(+m[2]), Math.round(+m[3])].join(",");
4397
+ const s = str.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);
4398
+ if (s) return [Math.round(+s[1] * 255), Math.round(+s[2] * 255), Math.round(+s[3] * 255)].join(",");
4399
+ const h2 = str.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i);
4400
+ if (h2) return [parseInt(h2[1], 16), parseInt(h2[2], 16), parseInt(h2[3], 16)].join(",");
4401
+ return "";
4402
+ };
4403
+ const direct = pick(v);
4404
+ if (direct) return direct;
4405
+ try {
4406
+ const ctx = document.createElement("canvas").getContext("2d");
4407
+ ctx.fillStyle = "#010203";
4408
+ ctx.fillStyle = v;
4409
+ const norm3 = String(ctx.fillStyle);
4410
+ if (norm3 !== "#010203") {
4411
+ const p = pick(norm3);
4412
+ if (p) return p;
4413
+ }
4414
+ } catch {
4415
+ }
4416
+ return fallback;
4417
+ }
4213
4418
  function ensureEl(id) {
4214
4419
  let el = document.getElementById(id);
4215
4420
  if (!el || !el.isConnected) {
@@ -4259,19 +4464,237 @@
4259
4464
  for (const k of injectedKeys) root.style.removeProperty(k);
4260
4465
  injectedKeys = /* @__PURE__ */ new Set();
4261
4466
  }
4262
- async function applyBackground(bg) {
4263
- const seq = ++applySeq;
4264
- bgStyleEl = ensureEl("__zcodepro_bg__");
4265
- const root = document.documentElement;
4467
+ function wpLayerEl() {
4468
+ let layer = document.getElementById("__zcodepro_wallpaper__");
4469
+ if (!layer || !layer.isConnected) {
4470
+ layer = document.createElement("div");
4471
+ layer.id = "__zcodepro_wallpaper__";
4472
+ layer.style.cssText = "position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden";
4473
+ (document.body || document.documentElement).append(layer);
4474
+ }
4475
+ return layer;
4476
+ }
4477
+ function clearWallpaper() {
4478
+ const layer = document.getElementById("__zcodepro_wallpaper__");
4479
+ if (wpMedia && wpMedia.tagName === "VIDEO") wpMedia.pause();
4480
+ if (layer) layer.remove();
4481
+ wpSlide = null;
4482
+ wpMask = null;
4483
+ wpMedia = null;
4484
+ wpShowTicket += 1;
4485
+ }
4486
+ function clearWpTimers() {
4266
4487
  if (bgTimer) {
4267
4488
  clearInterval(bgTimer);
4268
4489
  bgTimer = null;
4269
4490
  }
4491
+ for (const t2 of wpTimers) clearInterval(t2);
4492
+ wpTimers.clear();
4493
+ }
4494
+ var webviewScanTimer = null;
4495
+ var wvStyled = [];
4496
+ function applyWebviewTransparency() {
4497
+ const css = "html,body{background:transparent !important}";
4498
+ const hook = (w) => {
4499
+ const on = document.documentElement.classList.contains("zcodepro-bg-on");
4500
+ const rec = wvStyled.find((r) => r.el === w);
4501
+ if (on && !rec) {
4502
+ const entry = { el: w, key: null, handler: null };
4503
+ entry.handler = () => {
4504
+ if (!wvStyled.includes(entry)) return;
4505
+ try {
4506
+ void w.insertCSS(css).then((k) => {
4507
+ if (wvStyled.includes(entry)) entry.key = k;
4508
+ else {
4509
+ try {
4510
+ void w.removeCSS(k).catch(() => {
4511
+ });
4512
+ } catch {
4513
+ }
4514
+ }
4515
+ }).catch(() => {
4516
+ });
4517
+ } catch {
4518
+ }
4519
+ };
4520
+ w.addEventListener("dom-ready", entry.handler);
4521
+ wvStyled.push(entry);
4522
+ entry.handler();
4523
+ } else if (!on && rec) {
4524
+ if (rec.handler) w.removeEventListener("dom-ready", rec.handler);
4525
+ if (rec.key) {
4526
+ try {
4527
+ void w.removeCSS(rec.key).catch(() => {
4528
+ });
4529
+ } catch {
4530
+ }
4531
+ }
4532
+ wvStyled.splice(wvStyled.indexOf(rec), 1);
4533
+ }
4534
+ };
4535
+ const scan5 = () => document.querySelectorAll("webview").forEach(hook);
4536
+ scan5();
4537
+ if (!webviewScanTimer) webviewScanTimer = setInterval(scan5, 2e3);
4538
+ }
4539
+ function applyMediaState() {
4540
+ const bg = currentTheme.bg || {};
4541
+ const paused = bg.pauseOnHidden !== false && document.hidden || bg.pauseOnBlur === true && !document.hasFocus() || bg.pauseOnBattery === true && batteryCharging === false;
4542
+ const el = wpMedia;
4543
+ if (!el || !el.isConnected) return;
4544
+ if (el.tagName === "VIDEO") {
4545
+ if (paused) {
4546
+ el.pause();
4547
+ return;
4548
+ }
4549
+ el.muted = el.volume === 0;
4550
+ el.play().catch(() => {
4551
+ el.muted = true;
4552
+ el.play().catch(() => {
4553
+ });
4554
+ });
4555
+ return;
4556
+ }
4557
+ if (paused) {
4558
+ if (el.src && el.src !== "about:blank") {
4559
+ el.dataset.wpSrc = el.src;
4560
+ el.src = "about:blank";
4561
+ el.style.visibility = "hidden";
4562
+ }
4563
+ } else if (el.dataset.wpSrc) {
4564
+ el.src = el.dataset.wpSrc;
4565
+ delete el.dataset.wpSrc;
4566
+ el.style.visibility = "";
4567
+ }
4568
+ }
4569
+ function applySlideStyle(el, bg) {
4570
+ if (!el || !el.isConnected) return;
4571
+ const blurPx = typeof bg.blurPx === "number" && Number.isFinite(bg.blurPx) ? Math.min(24, Math.max(0, Math.round(bg.blurPx))) : 0;
4572
+ const spread = blurPx > 0 ? Math.max(20, blurPx * 2) : 0;
4573
+ el.style.inset = `-${spread}px`;
4574
+ el.style.filter = blurPx > 0 ? `blur(${blurPx}px)` : "";
4575
+ el.style.transition = (currentTheme.bg || {}).transition === "fade" ? "opacity .4s ease" : "none";
4576
+ if (el.tagName === "DIV") {
4577
+ const fit = bg.fit || "cover";
4578
+ el.style.backgroundSize = fit === "tile" ? "auto" : fit === "fill" ? "100% 100%" : fit;
4579
+ el.style.backgroundRepeat = fit === "tile" ? "repeat" : "no-repeat";
4580
+ return;
4581
+ }
4582
+ el.style.objectFit = bg.fit === "fill" ? "fill" : bg.fit === "contain" ? "contain" : "cover";
4583
+ if (el.tagName === "VIDEO") {
4584
+ el.volume = typeof bg.videoVolume === "number" && Number.isFinite(bg.videoVolume) ? Math.min(1, Math.max(0, bg.videoVolume)) : 0;
4585
+ if (!el.paused) el.muted = el.volume === 0;
4586
+ el.playbackRate = typeof bg.playbackRate === "number" && Number.isFinite(bg.playbackRate) ? Math.min(2, Math.max(0.5, bg.playbackRate)) : 1;
4587
+ }
4588
+ }
4589
+ function applySlideParams(bg, rgb, alpha) {
4590
+ if (wpMask) wpMask.style.background = `rgba(${rgb},${alpha})`;
4591
+ const el = wpSlide;
4592
+ if (!el || !el.isConnected) return;
4593
+ applySlideStyle(el, bg);
4594
+ if (el.tagName === "VIDEO") {
4595
+ if (String(Number(bg.fpsCap) || 0) !== (el.dataset.wpFps || "")) maybeTranscode(el, el.dataset.wpName, el.dataset.wpFrom);
4596
+ }
4597
+ }
4598
+ function armRotateTimer(bg) {
4599
+ const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4600
+ const want = ms >= 3e4 && wpTickFn ? ms : 0;
4601
+ if (bgTimer && want === bgTimerMs) return;
4602
+ if (bgTimer) {
4603
+ clearInterval(bgTimer);
4604
+ bgTimer = null;
4605
+ }
4606
+ bgTimerMs = want;
4607
+ if (want) bgTimer = setInterval(wpTickFn, want);
4608
+ }
4609
+ function maybeTranscode(el, name, from) {
4610
+ const helperUrl = liveBoot().helperUrl || HELPER_URL;
4611
+ const cap = Number((currentTheme.bg || {}).fpsCap) || 0;
4612
+ el.dataset.wpFps = String(cap);
4613
+ if (!cap || !name) {
4614
+ if (!cap && name && el.src && el.src.includes("/bg/transcode/file/")) {
4615
+ const orig = (from === "folder" ? `${helperUrl}/bg/folder/file/` : `${helperUrl}/bg/file/`) + encodeURIComponent(name);
4616
+ const at = el.currentTime;
4617
+ el.src = orig;
4618
+ el.addEventListener("loadedmetadata", () => {
4619
+ if (!el.isConnected) return;
4620
+ try {
4621
+ el.currentTime = at;
4622
+ } catch {
4623
+ }
4624
+ applyMediaState();
4625
+ }, { once: true });
4626
+ }
4627
+ return;
4628
+ }
4629
+ void (async () => {
4630
+ const reqCap = String(cap);
4631
+ const res = await rpc("/bg/transcode", { method: "POST", body: { name, from, fps: cap } });
4632
+ if (!res.ok || !res.key) {
4633
+ if (el.isConnected) el.dataset.wpFps = "";
4634
+ return;
4635
+ }
4636
+ if (!el.isConnected) return;
4637
+ const swapTo = () => {
4638
+ if (!el.isConnected) return;
4639
+ if (el.dataset.wpFps !== reqCap) return;
4640
+ const target = `${helperUrl}/bg/transcode/file/${res.key}.mp4`;
4641
+ if (el.src === target) return;
4642
+ const at = el.currentTime;
4643
+ el.src = target;
4644
+ el.addEventListener("loadedmetadata", () => {
4645
+ if (!el.isConnected) return;
4646
+ try {
4647
+ el.currentTime = at;
4648
+ } catch {
4649
+ }
4650
+ applyMediaState();
4651
+ }, { once: true });
4652
+ };
4653
+ if (res.ready) {
4654
+ swapTo();
4655
+ return;
4656
+ }
4657
+ let pollN = 0;
4658
+ const poll = setInterval(() => {
4659
+ if (!el.isConnected) {
4660
+ clearInterval(poll);
4661
+ wpTimers.delete(poll);
4662
+ return;
4663
+ }
4664
+ if (++pollN > 360) {
4665
+ clearInterval(poll);
4666
+ wpTimers.delete(poll);
4667
+ return;
4668
+ }
4669
+ void fetch(`${helperUrl}/bg/transcode/file/${res.key}.mp4`).then((r) => {
4670
+ if (!r.ok) return;
4671
+ clearInterval(poll);
4672
+ wpTimers.delete(poll);
4673
+ void (r.body && r.body.cancel && r.body.cancel());
4674
+ swapTo();
4675
+ }).catch(() => {
4676
+ });
4677
+ }, 5e3);
4678
+ wpTimers.add(poll);
4679
+ })();
4680
+ }
4681
+ async function applyBackground(bg) {
4682
+ const seq = ++applySeq;
4683
+ bgStyleEl = ensureEl("__zcodepro_bg__");
4684
+ const root = document.documentElement;
4270
4685
  root.classList.remove("zcodepro-bg-on");
4271
4686
  clearBgOverrides();
4272
4687
  const bgActive = !!(bg && bg.mode && bg.mode !== "none");
4273
4688
  const anyRegion = !!(bg && bg.regions && (bg.regions.left || bg.regions.center || bg.regions.right));
4274
- if (!bgActive) bgStyleEl.textContent = "";
4689
+ if (!bgActive) {
4690
+ bgStyleEl.textContent = "";
4691
+ ensureEl("__zcodepro_bg_extra__").textContent = "";
4692
+ clearWpTimers();
4693
+ wpTickFn = null;
4694
+ wpItem = null;
4695
+ lastWpSig = "";
4696
+ clearWallpaper();
4697
+ }
4275
4698
  if (!bgActive && !anyRegion) {
4276
4699
  await applyRegionBackgrounds(bg);
4277
4700
  return;
@@ -4282,144 +4705,343 @@
4282
4705
  const blurPx = typeof bg.blurPx === "number" && Number.isFinite(bg.blurPx) ? Math.min(24, Math.max(0, Math.round(bg.blurPx))) : 0;
4283
4706
  const panelOpacity = num01(bg.panelOpacity, 0.3);
4284
4707
  const resolvedBg = resolvedColor("--color-background");
4285
- const mHex = resolvedBg.match(/^rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)/);
4286
- const rgb = mHex ? [Math.round(+mHex[1]), Math.round(+mHex[2]), Math.round(+mHex[3])].join(",") : isDarkMode() ? "13,13,13" : "248,248,248";
4708
+ const rgb = rgbTriple(resolvedBg, isDarkMode() ? "13,13,13" : "248,248,248");
4287
4709
  const panelMix = Math.round(panelOpacity * 100);
4288
- if (panelMix < 100) {
4289
- for (const t2 of SURFACE_TOKENS) {
4290
- const v = resolvedColor(t2);
4291
- if (v) {
4292
- root.style.setProperty(t2, `color-mix(in srgb, ${v} ${panelMix}%, transparent)`);
4293
- injectedKeys.add(t2);
4294
- }
4710
+ const composerVeil = Math.max(panelMix, 65);
4711
+ const inputTriple = rgbTriple(resolvedColor("--color-input"), rgb);
4712
+ for (const t2 of SURFACE_TOKENS) {
4713
+ if (panelMix >= 100) continue;
4714
+ const v = resolvedColor(t2);
4715
+ if (v) {
4716
+ root.style.setProperty(t2, `color-mix(in srgb, ${v} ${panelMix}%, transparent)`);
4717
+ injectedKeys.add(t2);
4295
4718
  }
4296
4719
  }
4720
+ ensureEl("__zcodepro_bg_extra__").textContent = `[data-testid="chat-summary-panel"]{background-color:color-mix(in srgb, var(--color-popover) ${panelMix}%, transparent) !important;backdrop-filter:blur(24px) saturate(1.15);-webkit-backdrop-filter:blur(24px) saturate(1.15);}[data-testid="v4-composer"] form > .rounded-2xl{background-color:rgba(${inputTriple},${composerVeil / 100}) !important;backdrop-filter:blur(24px) saturate(1.15);-webkit-backdrop-filter:blur(24px) saturate(1.15);}aside[data-testid="sidebar"] svg:not(.zcodepro-ws-loader){color:var(--color-foreground) !important;stroke:currentColor !important;}`;
4297
4721
  await applyRegionBackgrounds(bg, { rgb, alpha, fit: bg.fit, seq });
4298
4722
  if (seq !== applySeq) return;
4299
4723
  if (!bgActive) return;
4300
- const FIT_CSS = {
4301
- cover: "background-size:100% 100%,cover !important;background-repeat:no-repeat !important;",
4302
- contain: "background-size:100% 100%,contain !important;background-repeat:no-repeat !important;",
4303
- fill: "background-size:100% 100%,100% 100% !important;background-repeat:no-repeat !important;",
4304
- tile: "background-size:100% 100%,auto !important;background-repeat:no-repeat,repeat !important;"
4305
- };
4306
- const fitCss = FIT_CSS[bg.fit] || FIT_CSS.cover;
4307
- const blurCss = blurPx > 0 ? `filter:blur(${blurPx}px);` : "";
4308
- const spread = blurPx > 0 ? Math.max(20, blurPx * 2) : 0;
4309
- const setImage = (image) => {
4310
- bgStyleEl.textContent = `html.zcodepro-bg-on{background-color:rgb(${rgb}) !important;}html.zcodepro-bg-on::before{content:'' !important;position:fixed;inset:-${spread}px;z-index:-1;pointer-events:none;background-image:linear-gradient(rgba(${rgb},${alpha}),rgba(${rgb},${alpha})),${image} !important;${fitCss}background-position:center !important;${blurCss}}`;
4724
+ const sourceSig = JSON.stringify([bg.mode, bg.file, bg.folder, bg.url]);
4725
+ const markBgOn = () => {
4726
+ bgStyleEl.textContent = `html.zcodepro-bg-on{background-color:rgb(${rgb}) !important;}html.zcodepro-bg-on webview{background:transparent !important;}`;
4311
4727
  root.classList.add("zcodepro-bg-on");
4312
4728
  };
4729
+ if (sourceSig === lastWpSig && wpSlide && wpSlide.isConnected) {
4730
+ markBgOn();
4731
+ applySlideParams(bg, rgb, alpha);
4732
+ armRotateTimer(bg);
4733
+ return;
4734
+ }
4735
+ const commit = () => {
4736
+ lastWpSig = sourceSig;
4737
+ clearWpTimers();
4738
+ wpTickFn = null;
4739
+ };
4740
+ markBgOn();
4313
4741
  const helperUrl = liveBoot().helperUrl || HELPER_URL;
4742
+ const B = () => currentTheme.bg || bg;
4743
+ const spread = blurPx > 0 ? Math.max(20, blurPx * 2) : 0;
4744
+ const mkSlide = (kind) => {
4745
+ const cur = B();
4746
+ const el = document.createElement(kind === "video" ? "video" : kind === "web" ? "iframe" : "div");
4747
+ el.className = "__zcp-slide";
4748
+ el.style.position = "absolute";
4749
+ el.style.inset = `-${spread}px`;
4750
+ el.style.transition = cur.transition === "fade" ? "opacity .4s ease" : "none";
4751
+ if (blurPx > 0) el.style.filter = `blur(${blurPx}px)`;
4752
+ if (kind === "image") {
4753
+ const fit = cur.fit || "cover";
4754
+ el.style.backgroundSize = fit === "tile" ? "auto" : fit === "fill" ? "100% 100%" : fit;
4755
+ el.style.backgroundRepeat = fit === "tile" ? "repeat" : "no-repeat";
4756
+ el.style.backgroundPosition = "center";
4757
+ } else {
4758
+ el.style.objectFit = cur.fit === "fill" ? "fill" : cur.fit === "contain" ? "contain" : "cover";
4759
+ }
4760
+ return el;
4761
+ };
4762
+ const mask = document.createElement("div");
4763
+ mask.className = "__zcp-mask";
4764
+ mask.style.position = "absolute";
4765
+ mask.style.inset = "0";
4766
+ mask.style.background = `rgba(${rgb},${alpha})`;
4767
+ const setSlide = (el) => {
4768
+ const layer = wpLayerEl();
4769
+ for (const c of [...layer.children]) if (c.classList.contains("__zcp-mask")) c.remove();
4770
+ const old = wpSlide;
4771
+ el.style.opacity = old && B().transition === "fade" ? "0" : "1";
4772
+ if (wpMask) mask.style.background = wpMask.style.background;
4773
+ layer.append(el, mask);
4774
+ wpMask = mask;
4775
+ wpSlide = el;
4776
+ wpMedia = el.tagName === "DIV" ? null : el;
4777
+ applySlideStyle(el, B());
4778
+ if (old) {
4779
+ if (old.tagName === "VIDEO") old.pause();
4780
+ if (B().transition === "fade") {
4781
+ requestAnimationFrame(() => {
4782
+ el.style.opacity = "1";
4783
+ old.style.opacity = "0";
4784
+ });
4785
+ setTimeout(() => old.remove(), 450);
4786
+ } else {
4787
+ old.remove();
4788
+ }
4789
+ }
4790
+ applyMediaState();
4791
+ };
4792
+ const setImage = (rawUrl) => {
4793
+ const el = mkSlide("image");
4794
+ el.style.backgroundImage = `url("${rawUrl}")`;
4795
+ const ticket = ++wpShowTicket;
4796
+ const probe = new Image();
4797
+ probe.onload = () => {
4798
+ if (ticket === wpShowTicket) setSlide(el);
4799
+ };
4800
+ probe.src = rawUrl;
4801
+ };
4802
+ const setupVideo = (srcUrl, name, from) => {
4803
+ const cur = B();
4804
+ const el = mkSlide("video");
4805
+ el.dataset.wpName = name;
4806
+ el.dataset.wpFrom = from;
4807
+ el.src = srcUrl;
4808
+ el.loop = true;
4809
+ el.playsInline = true;
4810
+ el.muted = true;
4811
+ el.volume = num01(cur.videoVolume, 0);
4812
+ el.playbackRate = typeof cur.playbackRate === "number" && Number.isFinite(cur.playbackRate) ? Math.min(2, Math.max(0.5, cur.playbackRate)) : 1;
4813
+ const ticket = ++wpShowTicket;
4814
+ let done = false;
4815
+ const go = () => {
4816
+ if (done) return;
4817
+ done = true;
4818
+ if (ticket !== wpShowTicket) return;
4819
+ setSlide(el);
4820
+ maybeTranscode(el, name, from);
4821
+ };
4822
+ el.addEventListener("loadeddata", go, { once: true });
4823
+ el.addEventListener("error", () => {
4824
+ done = true;
4825
+ }, { once: true });
4826
+ wpTimers.add(setTimeout(go, 8e3));
4827
+ };
4828
+ const setupWeb = (u) => {
4829
+ const el = mkSlide("web");
4830
+ el.style.border = "none";
4831
+ el.style.background = "transparent";
4832
+ el.style.visibility = "";
4833
+ el.sandbox = "allow-scripts";
4834
+ el.src = u;
4835
+ const ticket = ++wpShowTicket;
4836
+ let done = false;
4837
+ const go = () => {
4838
+ if (done) return;
4839
+ done = true;
4840
+ if (ticket !== wpShowTicket) return;
4841
+ setSlide(el);
4842
+ };
4843
+ el.addEventListener("load", go, { once: true });
4844
+ el.addEventListener("error", () => {
4845
+ done = true;
4846
+ }, { once: true });
4847
+ wpTimers.add(setTimeout(go, 8e3));
4848
+ };
4849
+ const showFile = (f, from) => {
4850
+ wpItem = { name: f.name, from };
4851
+ const u = from === "folder" ? `${helperUrl}/bg/folder/file/${encodeURIComponent(f.name)}` : `${helperUrl}/bg/file/${encodeURIComponent(f.name)}`;
4852
+ if (/\.(mp4|webm|mov)$/i.test(f.name)) setupVideo(u, f.name, from);
4853
+ else setImage(u);
4854
+ };
4855
+ const nextIdx = (n) => {
4856
+ if (B().folderRandom !== false) return n > 1 ? Math.floor(Math.random() * n) : 0;
4857
+ rotateIdx = (rotateIdx + 1) % n;
4858
+ return rotateIdx;
4859
+ };
4314
4860
  if (bg.mode === "library") {
4315
- if (!bg.file) {
4316
- bgStyleEl.textContent = "";
4861
+ const res = await rpc("/bg");
4862
+ if (seq !== applySeq) return;
4863
+ if (!res.ok) {
4864
+ lastThemeSig = "";
4865
+ return;
4866
+ }
4867
+ commit();
4868
+ const files = Array.isArray(res.files) ? res.files.filter((f) => f && f.name) : [];
4869
+ if (!files.length) {
4870
+ clearWallpaper();
4317
4871
  return;
4318
4872
  }
4319
- setImage(`url("${helperUrl}/bg/file/${encodeURIComponent(bg.file)}")`);
4873
+ const tick6 = () => showFile(files[nextIdx(files.length)], "library");
4874
+ wpTickFn = tick6;
4875
+ if (!(Math.max(0, Number(bg.intervalMin) || 0) * 6e4 >= 3e4)) {
4876
+ const pickFile = files.find((f) => sameName(f.name, bg.file));
4877
+ if (!pickFile) {
4878
+ clearWallpaper();
4879
+ return;
4880
+ }
4881
+ showFile(pickFile, "library");
4882
+ return;
4883
+ }
4884
+ tick6();
4885
+ armRotateTimer(bg);
4320
4886
  return;
4321
4887
  }
4322
4888
  if (bg.mode === "folder") {
4323
4889
  const res = await rpc("/bg/folder/list");
4324
4890
  if (seq !== applySeq) return;
4325
- const files = res.ok && Array.isArray(res.files) ? res.files.filter((f) => f && f.name) : [];
4891
+ if (!res.ok) {
4892
+ lastThemeSig = "";
4893
+ return;
4894
+ }
4895
+ commit();
4896
+ const files = Array.isArray(res.files) ? res.files.filter((f) => f && f.name) : [];
4326
4897
  if (!files.length) {
4327
- bgStyleEl.textContent = "";
4328
- root.classList.remove("zcodepro-bg-on");
4898
+ clearWallpaper();
4329
4899
  return;
4330
4900
  }
4331
- const pick = () => {
4332
- let idx = 0;
4333
- if (bg.folderRandom) idx = files.length > 1 ? Math.floor(Math.random() * files.length) : 0;
4334
- else {
4335
- folderIdx = (folderIdx + 1) % files.length;
4336
- idx = folderIdx;
4337
- }
4338
- setImage(`url("${helperUrl}/bg/folder/file/${encodeURIComponent(files[idx].name)}")`);
4339
- };
4340
- pick();
4341
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4342
- if (ms >= 3e4) bgTimer = setInterval(pick, ms);
4901
+ const tick6 = () => showFile(files[nextIdx(files.length)], "folder");
4902
+ wpTickFn = tick6;
4903
+ tick6();
4904
+ armRotateTimer(bg);
4343
4905
  return;
4344
4906
  }
4345
4907
  if (bg.mode === "url") {
4908
+ commit();
4346
4909
  const u0 = /^https?:\/\/\S+$/i.test(bg.url || "") && !/[<>"'\\]/.test(bg.url) ? bg.url : "";
4347
4910
  if (!u0) {
4348
- bgStyleEl.textContent = "";
4911
+ clearWallpaper();
4349
4912
  return;
4350
4913
  }
4351
4914
  const bust = () => {
4352
4915
  urlTick += 1;
4353
4916
  const sep = u0.includes("?") ? "&" : "?";
4354
- setImage(`url("${u0}${sep}_zcp=${urlTick}")`);
4917
+ setImage(`${u0}${sep}_zcp=${urlTick}`);
4355
4918
  };
4919
+ wpTickFn = bust;
4356
4920
  bust();
4357
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4358
- if (ms >= 3e4) bgTimer = setInterval(bust, ms);
4921
+ armRotateTimer(bg);
4922
+ return;
4923
+ }
4924
+ if (bg.mode === "web") {
4925
+ commit();
4926
+ const u0 = /^https?:\/\/\S+$/i.test(bg.url || "") && !/[<>"'\\]/.test(bg.url) ? bg.url : "";
4927
+ if (!u0) {
4928
+ clearWallpaper();
4929
+ return;
4930
+ }
4931
+ setupWeb(u0);
4932
+ }
4933
+ if (!["library", "folder", "url", "web"].includes(bg.mode)) {
4934
+ commit();
4935
+ clearWallpaper();
4359
4936
  }
4360
4937
  }
4938
+ var regionState = { left: null, center: null, right: null };
4939
+ var regionRules = /* @__PURE__ */ new Map();
4940
+ var regionPaint = { rgb: "13,13,13", alpha: 0.82, sizeVal: "100% 100%,cover", repeatVal: "no-repeat" };
4361
4941
  async function applyRegionBackgrounds(bg, pre) {
4362
4942
  regionStyleEl = ensureEl("__zcodepro_bg_regions__");
4363
- for (const t2 of regionTimers) clearInterval(t2);
4364
- regionTimers = [];
4365
- const rules = /* @__PURE__ */ new Map();
4366
4943
  const flush = () => {
4367
- regionStyleEl.textContent = [...rules.values()].join("");
4944
+ regionStyleEl.textContent = [...regionRules.values()].join("");
4368
4945
  };
4369
- const alpha = pre ? pre.alpha : 0.82;
4370
- const rgb = pre ? pre.rgb : "13,13,13";
4946
+ regionPaint.alpha = pre ? pre.alpha : 0.82;
4947
+ regionPaint.rgb = pre ? pre.rgb : "13,13,13";
4371
4948
  const FIT_CSS = {
4372
4949
  cover: "100% 100%,cover",
4373
4950
  contain: "100% 100%,contain",
4374
4951
  fill: "100% 100%,100% 100%",
4375
4952
  tile: "100% 100%,auto"
4376
4953
  };
4377
- const sizeVal = FIT_CSS[bg && bg.fit] || FIT_CSS.cover;
4378
- const repeatVal = bg && bg.fit === "tile" ? "no-repeat,repeat" : "no-repeat";
4954
+ regionPaint.sizeVal = FIT_CSS[bg && bg.fit] || FIT_CSS.cover;
4955
+ regionPaint.repeatVal = bg && bg.fit === "tile" ? "no-repeat,repeat" : "no-repeat";
4379
4956
  const helperUrl = liveBoot().helperUrl || HELPER_URL;
4380
4957
  const safeUrl = (u) => /^https?:\/\/\S+$/i.test(u || "") && !/[<>"'\\]/.test(u) ? u : "";
4381
4958
  const addRule = (region, image) => {
4382
4959
  if (!image) return;
4383
- rules.set(region, `${REGION_SELECTORS[region]}{background-image:linear-gradient(rgba(${rgb},${alpha}),rgba(${rgb},${alpha})),${image} !important;background-size:${sizeVal} !important;background-position:center !important;background-repeat:${repeatVal} !important;}`);
4960
+ regionRules.set(region, `${REGION_SELECTORS[region]}{background-image:linear-gradient(rgba(${regionPaint.rgb},${regionPaint.alpha}),rgba(${regionPaint.rgb},${regionPaint.alpha})),${image} !important;background-size:${regionPaint.sizeVal} !important;background-position:center !important;background-repeat:${regionPaint.repeatVal} !important;}`);
4384
4961
  };
4385
4962
  const seq = applySeq;
4963
+ const ms = Math.max(0, Number(bg && bg.intervalMin) || 0) * 6e4;
4386
4964
  for (const region of ["left", "center", "right"]) {
4387
4965
  const r = bg && bg.regions && bg.regions[region];
4388
- if (!r) continue;
4966
+ const st = regionState[region];
4967
+ if (!r) {
4968
+ if (st) {
4969
+ if (st.timer) clearInterval(st.timer);
4970
+ regionState[region] = null;
4971
+ }
4972
+ regionRules.delete(region);
4973
+ continue;
4974
+ }
4975
+ const sig = JSON.stringify([r.mode, r.file, r.folder, r.url]);
4976
+ if (st && st.sig === sig && st.image) {
4977
+ addRule(region, st.image);
4978
+ if (st.timer && st.interval !== ms) {
4979
+ clearInterval(st.timer);
4980
+ st.timer = null;
4981
+ }
4982
+ if (!st.timer && st.tick && ms >= 3e4) {
4983
+ st.timer = setInterval(st.tick, ms);
4984
+ st.interval = ms;
4985
+ }
4986
+ continue;
4987
+ }
4988
+ if (st && st.timer) {
4989
+ clearInterval(st.timer);
4990
+ st.timer = null;
4991
+ }
4992
+ const setState = (image, tick6) => {
4993
+ regionState[region] = { sig, image, tick: tick6, timer: null, interval: 0 };
4994
+ if (image) addRule(region, image);
4995
+ };
4996
+ const drop = () => {
4997
+ regionRules.delete(region);
4998
+ regionState[region] = null;
4999
+ };
4389
5000
  if (r.mode === "library") {
4390
- if (r.file) addRule(region, `url("${helperUrl}/bg/file/${encodeURIComponent(r.file)}")`);
5001
+ if (r.file) setState(`url("${helperUrl}/bg/file/${encodeURIComponent(r.file)}")`, null);
5002
+ else drop();
4391
5003
  } else if (r.mode === "url") {
4392
5004
  const u = safeUrl(r.url);
4393
- if (u) addRule(region, `url("${u}")`);
5005
+ if (u) setState(`url("${u}")`, null);
5006
+ else drop();
4394
5007
  } else if (r.mode === "folder" && r.folder) {
4395
5008
  const res = await rpc("/bg/folder/list?dir=" + encodeURIComponent(r.folder));
4396
5009
  if (seq !== applySeq) return;
4397
- const files = res.ok && !res.missing && Array.isArray(res.files) ? res.files.filter((f) => f && f.name) : [];
5010
+ const files = res.ok && !res.missing && Array.isArray(res.files) ? res.files.filter((f) => f && f.name && !/\.(mp4|webm|mov)$/i.test(f.name)) : [];
4398
5011
  if (!files.length) continue;
4399
5012
  const pick = () => {
4400
5013
  let idx = 0;
4401
- if (bg.folderRandom !== false) idx = files.length > 1 ? Math.floor(Math.random() * files.length) : 0;
5014
+ if ((currentTheme.bg || {}).folderRandom !== false) idx = files.length > 1 ? Math.floor(Math.random() * files.length) : 0;
4402
5015
  else {
4403
5016
  regionFolderIdx[region] = (regionFolderIdx[region] + 1) % files.length;
4404
5017
  idx = regionFolderIdx[region];
4405
5018
  }
4406
- addRule(region, `url("${helperUrl}/bg/folder/file/${encodeURIComponent(files[idx].name)}")`);
5019
+ const image = `url("${helperUrl}/bg/folder/file/${encodeURIComponent(files[idx].name)}?dir=${encodeURIComponent(r.folder)}")`;
5020
+ if (regionState[region]) regionState[region].image = image;
5021
+ addRule(region, image);
4407
5022
  flush();
4408
5023
  };
5024
+ setState(null, pick);
4409
5025
  pick();
4410
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4411
- if (ms >= 3e4) regionTimers.push(setInterval(pick, ms));
5026
+ if (ms >= 3e4) {
5027
+ regionState[region].timer = setInterval(pick, ms);
5028
+ regionState[region].interval = ms;
5029
+ }
5030
+ } else {
5031
+ drop();
4412
5032
  }
4413
5033
  }
4414
5034
  flush();
4415
5035
  }
4416
5036
  function applyAll(theme) {
4417
5037
  if (theme && typeof theme === "object") currentTheme = theme;
5038
+ lastThemeSig = JSON.stringify(currentTheme);
4418
5039
  applySkin(currentTheme.skin || "default", currentTheme.custom);
4419
5040
  void applyBackground(currentTheme.bg);
4420
5041
  }
4421
5042
  function startTheme() {
4422
5043
  if (!document.head && !document.documentElement) return;
5044
+ applyWebviewTransparency();
4423
5045
  applyAll({ skin: "default", custom: null, bg: { mode: "none", maskOpacity: 0.82, blurPx: 0, panelOpacity: 0.3 } });
4424
5046
  void getConfig().then((cfg) => applyAll(cfg.theme)).catch(() => {
4425
5047
  });
@@ -4427,6 +5049,38 @@
4427
5049
  void getConfig(true).then((cfg) => applyAll(cfg.theme)).catch(() => {
4428
5050
  });
4429
5051
  });
5052
+ lastThemeSig = JSON.stringify(currentTheme);
5053
+ if (themePollTimer) clearInterval(themePollTimer);
5054
+ let pollFail = 0;
5055
+ themePollTimer = setInterval(() => {
5056
+ if (pollFail >= 3 && ++pollFail % 6 !== 0) return;
5057
+ void getConfig(true).then((cfg) => {
5058
+ if (!cfg.theme) {
5059
+ pollFail = Math.max(pollFail + 1, 3);
5060
+ return;
5061
+ }
5062
+ pollFail = 0;
5063
+ const sig = JSON.stringify(cfg.theme);
5064
+ if (sig !== lastThemeSig) applyAll(cfg.theme);
5065
+ }).catch(() => {
5066
+ pollFail = Math.max(pollFail + 1, 3);
5067
+ });
5068
+ }, 5e3);
5069
+ document.addEventListener("visibilitychange", applyMediaState);
5070
+ window.addEventListener("focus", applyMediaState);
5071
+ window.addEventListener("blur", applyMediaState);
5072
+ if (navigator.getBattery) {
5073
+ navigator.getBattery().then((b) => {
5074
+ batteryCharging = !!b.charging;
5075
+ b.addEventListener("chargingchange", () => {
5076
+ batteryCharging = !!b.charging;
5077
+ applyMediaState();
5078
+ });
5079
+ applyMediaState();
5080
+ }).catch(() => {
5081
+ batteryCharging = null;
5082
+ });
5083
+ }
4430
5084
  if (!classObserver) {
4431
5085
  lastModeSig = isDarkMode() ? "d" : "l";
4432
5086
  classObserver = new MutationObserver(() => {
@@ -4446,6 +5100,7 @@
4446
5100
  } catch {
4447
5101
  }
4448
5102
  }
5103
+ var sameName2 = (a, b) => String(a).normalize("NFC").toLowerCase() === String(b).normalize("NFC").toLowerCase();
4449
5104
  var PLUGINS_REPO_URL = "https://github.com/duanluan/zcode-plugins";
4450
5105
  function makeUpgradeControls({ endpoint, metaRefresh, idleText }) {
4451
5106
  const L = t();
@@ -4585,7 +5240,7 @@
4585
5240
  // sm:max-w-3xl 不存在会失去约束拉满全屏;max-w-3xl=48rem 存在——英文界面
4586
5241
  // 标签栏较长,42rem 会挤出一块空白并触发横向滚动
4587
5242
  width: "max-w-3xl",
4588
- bodyClass: "mt-1",
5243
+ bodyClass: "mt-0",
4589
5244
  overlay: "none",
4590
5245
  draggable: true,
4591
5246
  posKey: "settings",
@@ -4595,7 +5250,9 @@
4595
5250
  if (rtkUpgradePollStop) rtkUpgradePollStop();
4596
5251
  },
4597
5252
  onMount: async ({ body, close, content }) => {
5253
+ if (content) content.setAttribute("data-zcodepro-settings", "1");
4598
5254
  const titleEl = content && content.firstElementChild;
5255
+ let titleLeft = null;
4599
5256
  if (titleEl && titleEl.tagName === "H2") {
4600
5257
  titleEl.classList.add("flex", "w-full", "items-center", "justify-between");
4601
5258
  const ns2 = "http://www.w3.org/2000/svg";
@@ -4616,7 +5273,7 @@
4616
5273
  }
4617
5274
  return svg;
4618
5275
  };
4619
- const titleLeft = h("span", { class: "flex min-w-0 items-center" }, L.settingsTitle);
5276
+ titleLeft = h("span", { class: "flex min-w-0 items-center" }, L.settingsTitle);
4620
5277
  if (typeof window.zcode?.openExternal === "function") {
4621
5278
  const REPO_URL = "https://github.com/duanluan/zcode-pro";
4622
5279
  titleLeft.replaceChildren(
@@ -4642,7 +5299,7 @@
4642
5299
  }, "\u2715");
4643
5300
  titleEl.replaceChildren(titleLeft, closeX);
4644
5301
  }
4645
- const [health, config, agentsRes, visionRes, titleGenRes, titleGenProvidersRes, rtkRes, headroomRes] = await Promise.all([
5302
+ const [health, config, agentsRes, visionRes, titleGenRes, titleGenProvidersRes, rtkRes, headroomRes, zcodeConfigRes] = await Promise.all([
4646
5303
  rpc("/health"),
4647
5304
  getConfig(true),
4648
5305
  rpc("/agents"),
@@ -4650,7 +5307,8 @@
4650
5307
  rpc("/title-gen"),
4651
5308
  rpc("/title-gen/providers"),
4652
5309
  rpc("/rtk"),
4653
- rpc("/headroom")
5310
+ rpc("/headroom"),
5311
+ rpc("/zcode-config")
4654
5312
  ]);
4655
5313
  const titleGenProviders = titleGenProvidersRes.ok && Array.isArray(titleGenProvidersRes.providers) ? titleGenProvidersRes.providers : [];
4656
5314
  const setFeature = async (key, value) => {
@@ -4658,7 +5316,7 @@
4658
5316
  clearConfigCache();
4659
5317
  window.dispatchEvent(new CustomEvent("zcodepro:config-changed"));
4660
5318
  if (!res.ok) {
4661
- body.querySelector("[data-zcodepro-status]").replaceChildren(
5319
+ statusLine.replaceChildren(
4662
5320
  h("span", { class: "text-ui-sm text-destructive" }, L.failed + ": " + errText(res))
4663
5321
  );
4664
5322
  return false;
@@ -4668,16 +5326,17 @@
4668
5326
  const statusLine = h(
4669
5327
  "div",
4670
5328
  {
4671
- class: "flex items-center gap-2 text-ui-sm text-foreground-subtle",
5329
+ class: "ml-2 flex min-w-0 items-center gap-1.5 text-ui-xs text-foreground-subtle",
4672
5330
  "data-zcodepro-status": "1"
4673
5331
  },
4674
5332
  h("span", { class: "inline-block size-2 rounded-full bg-emerald-500" }),
4675
- h("span", { class: "text-foreground-subtle/70" }, `${health.version} \xB7 ${HELPER_URL}`)
5333
+ h("span", { class: "truncate text-foreground-subtle/70" }, `${health.version} \xB7 ${HELPER_URL}`)
4676
5334
  );
5335
+ if (titleLeft) titleLeft.append(statusLine);
4677
5336
  const rows = h("div", { class: "grid grid-cols-2 gap-x-0 gap-y-1 rounded-xl border border-border p-2 divide-x divide-border" });
4678
5337
  const pluginsStatusLine = h("span", { class: "max-w-40 truncate text-ui-xs/relaxed text-foreground-subtle" }, "\u2026");
4679
5338
  const setPluginsStatus = (text) => {
4680
- setPluginsStatus(text);
5339
+ pluginsStatusLine.textContent = text;
4681
5340
  pluginsStatusLine.setAttribute("title", text);
4682
5341
  };
4683
5342
  const pluginsBtn = btnSmall(L.pluginsCheckNow, () => {
@@ -4883,14 +5542,15 @@
4883
5542
  L.wechatGroupDesc.replaceAll("{id}", WECHAT_ID),
4884
5543
  () => hCopyIcon("size-4 shrink-0 text-foreground-subtle"),
4885
5544
  async () => {
4886
- if (await copyToClipboard(WECHAT_ID)) showToast(L.wechatIdCopied);
5545
+ if (await copyToClipboard(WECHAT_ID)) showToast(L.wechatIdCopied, "success");
4887
5546
  }
4888
5547
  )
4889
5548
  );
4890
5549
  let activeTab = "features";
5550
+ const subTabBars = {};
4891
5551
  const paneFeatures = h(
4892
5552
  "div",
4893
- { role: "tabpanel", class: "mt-4" },
5553
+ { role: "tabpanel", class: "mt-2" },
4894
5554
  h("div", {}, rows),
4895
5555
  communityCards
4896
5556
  );
@@ -4923,8 +5583,7 @@
4923
5583
  }),
4924
5584
  hkCell("\u2191 / \u2193", L.hkArrow.replaceAll("{prev}", keys.switchPrev).replaceAll("{next}", keys.switchNext)),
4925
5585
  hkCell("Enter", L.hkEnter),
4926
- hkCell("Esc", L.hkEsc),
4927
- hkCell(L.hkReleaseKey, L.hkRelease)
5586
+ hkCell("Esc", L.hkEsc)
4928
5587
  );
4929
5588
  };
4930
5589
  const stopHkRecording = () => {
@@ -4953,14 +5612,14 @@
4953
5612
  }
4954
5613
  const k = e.key.toLowerCase();
4955
5614
  if (!/^[a-z0-9]$/.test(k)) {
4956
- showToast(L.hkInvalid, "error");
5615
+ showToast(L.hkInvalid, "warning");
4957
5616
  return;
4958
5617
  }
4959
5618
  const keys = hkKeys();
4960
5619
  const names = hkNames();
4961
5620
  const conflict = HK_ACTIONS.find(([a2]) => a2 !== hkRecording && keys[a2] === k);
4962
5621
  if (conflict) {
4963
- showToast(L.hkConflict.replaceAll("{k}", k).replaceAll("{name}", names[conflict[0]]), "error");
5622
+ showToast(L.hkConflict.replaceAll("{k}", k).replaceAll("{name}", names[conflict[0]]), "warning");
4964
5623
  return;
4965
5624
  }
4966
5625
  const a = hkRecording;
@@ -5003,7 +5662,7 @@
5003
5662
  };
5004
5663
  const paneShortcuts = h(
5005
5664
  "div",
5006
- { role: "tabpanel", class: "mt-4", style: "display:none" },
5665
+ { role: "tabpanel", style: "display:none" },
5007
5666
  h("div", { class: "mb-2 text-ui-sm font-medium" }, L.hkTitle),
5008
5667
  h(
5009
5668
  "div",
@@ -5015,16 +5674,16 @@
5015
5674
  ),
5016
5675
  hkCard
5017
5676
  );
5018
- const paneStyles = h("div", { role: "tabpanel", class: "mt-2", style: "display:none" });
5019
- const panePerf = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5020
- const paneAgents = h("div", { role: "tabpanel", class: "mt-2", style: "display:none" });
5021
- const paneProxy = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5022
- const paneSync = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5023
- const paneVision = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5024
- const paneRtk = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5025
- const paneHeadroom = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5026
- const paneTitleGen = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5027
- const paneDebug = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5677
+ const paneStyles = h("div", { role: "tabpanel", style: "display:none" });
5678
+ const panePerf = h("div", { role: "tabpanel", style: "display:none" });
5679
+ const paneAgents = h("div", { role: "tabpanel", style: "display:none" });
5680
+ const paneProxy = h("div", { role: "tabpanel", style: "display:none" });
5681
+ const paneSync = h("div", { role: "tabpanel", style: "display:none" });
5682
+ const paneVision = h("div", { role: "tabpanel", style: "display:none" });
5683
+ const paneRtk = h("div", { role: "tabpanel", style: "display:none" });
5684
+ const paneHeadroom = h("div", { role: "tabpanel", style: "display:none" });
5685
+ const paneTitleGen = h("div", { role: "tabpanel", style: "display:none" });
5686
+ const paneDebug = h("div", { role: "tabpanel", style: "display:none" });
5028
5687
  const panes = { features: paneFeatures, shortcuts: paneShortcuts, styles: paneStyles, perf: panePerf, agents: paneAgents, proxy: paneProxy, sync: paneSync, vision: paneVision, headroom: paneHeadroom, rtk: paneRtk, debug: paneDebug };
5029
5688
  const tabDefs = [
5030
5689
  ["features", L.tabFeatures],
@@ -5054,6 +5713,7 @@
5054
5713
  activeTab = name;
5055
5714
  if (name !== "shortcuts" && hkRecording) stopHkRecording();
5056
5715
  for (const [id, pane] of Object.entries(panes)) pane.style.display = id === name ? "" : "none";
5716
+ for (const [id, bar] of Object.entries(subTabBars)) bar.style.display = id === name ? "" : "none";
5057
5717
  renderTabs();
5058
5718
  };
5059
5719
  renderTabs();
@@ -5230,10 +5890,10 @@
5230
5890
  for (const c of fontCells) c.setOptions(list);
5231
5891
  })();
5232
5892
  renderToolbarSwitch();
5233
- const paneStylesSub1 = h("div", { class: "mt-4" });
5234
- const paneStylesSub2 = h("div", { class: "mt-4", style: "display:none" });
5235
- const paneStylesSub3 = h("div", { class: "mt-4", style: "display:none" });
5236
- const paneStylesSub4 = h("div", { class: "mt-4", style: "display:none" });
5893
+ const paneStylesSub1 = h("div", { class: "mt-2" });
5894
+ const paneStylesSub2 = h("div", { class: "mt-2", style: "display:none" });
5895
+ const paneStylesSub3 = h("div", { class: "mt-2", style: "display:none" });
5896
+ const paneStylesSub4 = h("div", { class: "mt-2", style: "display:none" });
5237
5897
  const ITEM_NAMES = {
5238
5898
  ctx: "sbItemCtx",
5239
5899
  questions: "sbItemQuestions",
@@ -5444,12 +6104,23 @@
5444
6104
  renderThemeBg();
5445
6105
  const res = await rpc("/bg");
5446
6106
  bgLoading = false;
5447
- if (res.ok && Array.isArray(res.files)) bgFiles = res.files;
5448
- if (themeCfg.bg.mode === "library" && themeCfg.bg.file && !bgFiles.some((f) => f.name === themeCfg.bg.file)) {
5449
- themeCfg = { ...themeCfg, bg: { ...themeCfg.bg, file: "" } };
5450
- await saveTheme({ bg: { file: "" } });
5451
- showToast(L.themeBgDeletedActive, "success");
5452
- return;
6107
+ const listed = res.ok && Array.isArray(res.files);
6108
+ if (listed) bgFiles = res.files;
6109
+ if (listed) {
6110
+ const regionPatch = {};
6111
+ for (const [k, r] of Object.entries(themeCfg.bg.regions || {})) {
6112
+ if (r && r.mode === "library" && r.file && !bgFiles.some((f) => sameName2(f.name, r.file))) regionPatch[k] = { ...r, file: "" };
6113
+ }
6114
+ if (Object.keys(regionPatch).length) {
6115
+ themeCfg = { ...themeCfg, bg: { ...themeCfg.bg, regions: { ...themeCfg.bg.regions, ...regionPatch } } };
6116
+ await saveTheme({ bg: { regions: { ...themeCfg.bg.regions } } });
6117
+ }
6118
+ if (themeCfg.bg.mode === "library" && themeCfg.bg.file && !bgFiles.some((f) => sameName2(f.name, themeCfg.bg.file))) {
6119
+ themeCfg = { ...themeCfg, bg: { ...themeCfg.bg, file: "" } };
6120
+ await saveTheme({ bg: { file: "" } });
6121
+ showToast(L.themeBgDeletedActive, "success");
6122
+ return;
6123
+ }
5453
6124
  }
5454
6125
  renderThemeBg();
5455
6126
  };
@@ -5463,7 +6134,7 @@
5463
6134
  folderInfo = res.ok && !res.missing && Array.isArray(res.files) ? { count: res.files.length, dir: res.dir || themeCfg.bg.folder } : { count: 0, dir: themeCfg.bg.folder };
5464
6135
  renderThemeBg();
5465
6136
  };
5466
- const bgInput = h("input", { type: "file", accept: ".png,.jpg,.jpeg,.webp,.gif,.bmp,.avif", multiple: "", style: "display:none" });
6137
+ const bgInput = h("input", { type: "file", accept: ".png,.jpg,.jpeg,.webp,.gif,.bmp,.avif,.mp4,.webm,.mov", multiple: "", style: "display:none" });
5467
6138
  bgInput.addEventListener("change", () => {
5468
6139
  const files = [...bgInput.files || []];
5469
6140
  bgInput.value = "";
@@ -5471,20 +6142,29 @@
5471
6142
  void (async () => {
5472
6143
  let first = themeCfg.bg.file;
5473
6144
  for (const f of files) {
5474
- const dataUrl = await new Promise((resolve) => {
5475
- const r = new FileReader();
5476
- r.onload = () => resolve(String(r.result || ""));
5477
- r.onerror = () => resolve("");
5478
- r.readAsDataURL(f);
5479
- });
5480
- if (!dataUrl) continue;
5481
- const res = await rpc("/bg", { method: "POST", body: { name: f.name, data: dataUrl } });
5482
- if (!res.ok) {
5483
- showToast(L.failed + ": " + errText(res), "error");
6145
+ let res = null;
6146
+ if (/\.(mp4|webm|mov)$/i.test(f.name)) {
6147
+ res = await fetch(`${HELPER_URL}/bg/upload?name=${encodeURIComponent(f.name)}`, {
6148
+ method: "POST",
6149
+ headers: { "X-ZCodePro-Token": liveBoot().token || "" },
6150
+ body: f
6151
+ }).then((r) => r.json()).catch((e) => ({ ok: false, error: String(e && e.message || e) }));
6152
+ } else {
6153
+ const dataUrl = await new Promise((resolve) => {
6154
+ const r = new FileReader();
6155
+ r.onload = () => resolve(String(r.result || ""));
6156
+ r.onerror = () => resolve("");
6157
+ r.readAsDataURL(f);
6158
+ });
6159
+ if (!dataUrl) continue;
6160
+ res = await rpc("/bg", { method: "POST", body: { name: f.name, data: dataUrl } });
6161
+ }
6162
+ if (!res || !res.ok) {
6163
+ showToast(L.failed + ": " + errText(res || {}), "error");
5484
6164
  continue;
5485
6165
  }
5486
6166
  if (Array.isArray(res.files)) bgFiles = res.files;
5487
- if (!first) first = f.name;
6167
+ if (!first) first = res.name || f.name;
5488
6168
  }
5489
6169
  if (first && first !== themeCfg.bg.file) await saveTheme({ bg: { file: first } });
5490
6170
  else renderThemeBg();
@@ -5611,20 +6291,28 @@
5611
6291
  if (mode === "library") {
5612
6292
  const sel = h("select", { class: "h-7 max-w-40 rounded-lg border border-border bg-input px-1.5 text-ui-xs text-foreground outline-none" });
5613
6293
  sel.append(h("option", { value: "" }, "\u2014"));
5614
- for (const f of bgFiles) sel.append(h("option", { value: f.name }, f.name));
6294
+ for (const f of bgFiles) {
6295
+ if (/\.(mp4|webm|mov)$/i.test(f.name)) continue;
6296
+ sel.append(h("option", { value: f.name }, f.name));
6297
+ }
5615
6298
  sel.value = cur && cur.file || "";
5616
6299
  sel.addEventListener("change", () => setRegion(region, { ...cur, file: sel.value }));
5617
6300
  valueCtrl = sel;
5618
6301
  } else if (mode === "folder") {
5619
6302
  const inp = h("input", { type: "text", value: cur && cur.folder || "", class: themeInputCls.replace("h-8", "h-7"), placeholder: "/path/to/wallpapers" });
5620
6303
  inp.addEventListener("change", () => {
5621
- if (inp.value.trim()) setRegion(region, { ...cur, folder: inp.value.trim() });
6304
+ setRegion(region, { ...cur, folder: inp.value.trim() });
5622
6305
  });
5623
6306
  valueCtrl = inp;
5624
6307
  } else if (mode === "url") {
5625
6308
  const inp = h("input", { type: "url", value: cur && cur.url || "", class: themeInputCls.replace("h-8", "h-7"), placeholder: "https://..." });
5626
6309
  inp.addEventListener("change", () => {
5627
- if (/^https?:\/\/\S+$/.test(inp.value.trim())) setRegion(region, { ...cur, url: inp.value.trim() });
6310
+ const v = inp.value.trim();
6311
+ if (/^https?:\/\/\S+$/.test(v) && !/[<>"'\\]/.test(v)) setRegion(region, { ...cur, url: v });
6312
+ else {
6313
+ showToast(L.themeBgUrlInvalid, "warning");
6314
+ renderThemeBg();
6315
+ }
5628
6316
  });
5629
6317
  valueCtrl = inp;
5630
6318
  }
@@ -5715,7 +6403,11 @@
5715
6403
  type: "button",
5716
6404
  class: "zcodepro-tab",
5717
6405
  "data-state": themeCfg.bg.mode === id ? "active" : "inactive",
5718
- onClick: () => void saveTheme({ bg: { mode: id } })
6406
+ onClick: () => {
6407
+ const cur = themeCfg.bg.mode;
6408
+ const cross = (cur === "url" || cur === "web") && (id === "url" || id === "web") && cur !== id;
6409
+ void saveTheme({ bg: cross ? { mode: id, url: "" } : { mode: id } });
6410
+ }
5719
6411
  }, label);
5720
6412
  const folderInput = h("input", { type: "text", value: themeCfg.bg.folder, class: themeInputCls, placeholder: "/path/to/wallpapers" });
5721
6413
  const applyFolder = async (dir) => {
@@ -5759,13 +6451,27 @@
5759
6451
  void saveTheme({ bg: { mode: "none", url: "" } });
5760
6452
  return;
5761
6453
  }
5762
- if (!/^https?:\/\/\S+$/.test(v)) {
5763
- showToast(L.themeBgUrlInvalid, "error");
6454
+ if (!/^https?:\/\/\S+$/.test(v) || /[<>"'\\]/.test(v)) {
6455
+ showToast(L.themeBgUrlInvalid, "warning");
5764
6456
  renderThemeBg();
5765
6457
  return;
5766
6458
  }
5767
6459
  void saveTheme({ bg: { mode: "url", url: v } });
5768
6460
  });
6461
+ const webInput = h("input", { type: "url", value: themeCfg.bg.url, class: themeInputCls, placeholder: "https://..." });
6462
+ webInput.addEventListener("change", () => {
6463
+ const v = webInput.value.trim();
6464
+ if (!v) {
6465
+ void saveTheme({ bg: { mode: "none", url: "" } });
6466
+ return;
6467
+ }
6468
+ if (!/^https?:\/\/\S+$/.test(v) || /[<>"'\\]/.test(v)) {
6469
+ showToast(L.themeBgUrlInvalid, "warning");
6470
+ renderThemeBg();
6471
+ return;
6472
+ }
6473
+ void saveTheme({ bg: { mode: "web", url: v } });
6474
+ });
5769
6475
  const libCard = (f) => {
5770
6476
  const del = h("button", {
5771
6477
  type: "button",
@@ -5784,13 +6490,14 @@
5784
6490
  })();
5785
6491
  }
5786
6492
  }, "\u2715");
6493
+ const thumb = /\.(mp4|webm|mov)$/i.test(f.name) ? h("video", { src: bgUrl(f.name), preload: "metadata", muted: "" }) : h("img", { src: bgUrl(f.name), alt: "", loading: "lazy" });
5787
6494
  return h("button", {
5788
6495
  type: "button",
5789
6496
  class: "zcodepro-bg-card",
5790
- "data-state": themeCfg.bg.mode === "library" && themeCfg.bg.file === f.name ? "active" : "inactive",
6497
+ "data-state": themeCfg.bg.mode === "library" && sameName2(themeCfg.bg.file, f.name) ? "active" : "inactive",
5791
6498
  title: f.name,
5792
6499
  onClick: () => void saveTheme({ bg: { mode: "library", file: themeCfg.bg.file === f.name ? "" : f.name } })
5793
- }, h("img", { src: bgUrl(f.name), alt: "", loading: "lazy" }), del);
6500
+ }, thumb, del);
5794
6501
  };
5795
6502
  const section = (titleText, body2) => h(
5796
6503
  "div",
@@ -5812,7 +6519,16 @@
5812
6519
  "div",
5813
6520
  { class: "grid grid-cols-4 gap-2", style: "max-height:13.5rem;overflow-y:auto;" },
5814
6521
  ...bgFiles.map(libCard)
5815
- ) : null
6522
+ ) : null,
6523
+ h(
6524
+ "div",
6525
+ { class: "flex items-center gap-2" },
6526
+ h("label", { class: "flex items-center gap-1.5 text-ui-xs text-foreground-subtle" }, randomCheck, L.themeBgFolderRandom),
6527
+ numField(themeCfg.bg.intervalMin, 0, 1440, (v) => {
6528
+ void saveTheme({ bg: { intervalMin: v } });
6529
+ }, L.themeBgIntervalHint),
6530
+ h("span", { class: "text-ui-xs text-foreground-subtle" }, L.themeBgIntervalUnit)
6531
+ )
5816
6532
  ))
5817
6533
  ] : themeCfg.bg.mode === "folder" ? [
5818
6534
  section(L.themeBgModeFolder, h(
@@ -5849,6 +6565,13 @@
5849
6565
  ),
5850
6566
  h("p", { class: "text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgUrlHint)
5851
6567
  ))
6568
+ ] : themeCfg.bg.mode === "web" ? [
6569
+ section(L.themeBgModeWeb, h(
6570
+ "div",
6571
+ { class: "flex flex-col gap-2" },
6572
+ webInput,
6573
+ h("p", { class: "text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgWebHint)
6574
+ ))
5852
6575
  ] : [h("p", { class: "mt-3 text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgNoneHint)];
5853
6576
  const fitBtn = (id, label) => h("button", {
5854
6577
  type: "button",
@@ -5856,6 +6579,66 @@
5856
6579
  "data-state": (themeCfg.bg.fit || "cover") === id ? "active" : "inactive",
5857
6580
  onClick: () => void saveTheme({ bg: { fit: id } })
5858
6581
  }, label);
6582
+ const transBtn = (id, label) => h("button", {
6583
+ type: "button",
6584
+ class: "zcodepro-tab",
6585
+ "data-state": (themeCfg.bg.transition || "cut") === id ? "active" : "inactive",
6586
+ onClick: () => void saveTheme({ bg: { transition: id } })
6587
+ }, label);
6588
+ const pauseCheck = (key, label) => {
6589
+ const c = h("input", { type: "checkbox" });
6590
+ c.checked = key === "pauseOnHidden" ? themeCfg.bg.pauseOnHidden !== false : !!themeCfg.bg[key];
6591
+ c.addEventListener("change", () => void saveTheme({ bg: { [key]: c.checked } }));
6592
+ return h("label", { class: "flex items-center gap-1.5 text-ui-xs text-foreground-subtle" }, c, label);
6593
+ };
6594
+ const selectField = (value, options, commit) => {
6595
+ const sel = h("select", { class: "h-7 rounded-lg border border-border bg-input px-1.5 text-ui-xs text-foreground outline-none" });
6596
+ for (const [v, label] of options) sel.append(h("option", { value: String(v) }, label));
6597
+ sel.value = String(value);
6598
+ sel.addEventListener("change", () => commit(sel.value));
6599
+ return sel;
6600
+ };
6601
+ const labelledRow = (label, ctrl) => h(
6602
+ "div",
6603
+ { class: "flex items-center gap-3" },
6604
+ h("span", { class: "shrink-0 whitespace-nowrap text-ui-xs font-medium text-foreground-subtle", style: "width:72px" }, label),
6605
+ ctrl
6606
+ );
6607
+ const volumeRow = () => sliderRow(
6608
+ L.themeBgVolume,
6609
+ L.themeBgVolumeHint,
6610
+ 0,
6611
+ 100,
6612
+ 1,
6613
+ Math.round(numOr(themeCfg.bg.videoVolume, 0) * 100),
6614
+ "%",
6615
+ (v) => {
6616
+ void saveTheme({ bg: { videoVolume: v / 100 } });
6617
+ },
6618
+ ""
6619
+ );
6620
+ const rateRow = () => labelledRow(
6621
+ L.themeBgRate,
6622
+ selectField(
6623
+ numOr(themeCfg.bg.playbackRate, 1),
6624
+ [["0.5", "0.5x"], ["0.75", "0.75x"], ["1", "1x"], ["1.25", "1.25x"], ["1.5", "1.5x"], ["2", "2x"]],
6625
+ (v) => {
6626
+ void saveTheme({ bg: { playbackRate: Number(v) } });
6627
+ }
6628
+ )
6629
+ );
6630
+ const fpsRow = () => h(
6631
+ "div",
6632
+ { class: "flex flex-col gap-0.5" },
6633
+ labelledRow(L.themeBgFps, selectField(
6634
+ numOr(themeCfg.bg.fpsCap, 0),
6635
+ [["0", L.themeBgFpsOff], ["15", "15 fps"], ["30", "30 fps"], ["60", "60 fps"]],
6636
+ (v) => {
6637
+ void saveTheme({ bg: { fpsCap: Number(v) } });
6638
+ }
6639
+ )),
6640
+ h("span", { class: "text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgFpsHint)
6641
+ );
5859
6642
  paneStylesSub4.replaceChildren(
5860
6643
  h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.themeBgDesc),
5861
6644
  h(
@@ -5864,7 +6647,8 @@
5864
6647
  modeBtn("none", L.themeBgModeNone),
5865
6648
  modeBtn("library", L.themeBgModeLibrary),
5866
6649
  modeBtn("folder", L.themeBgModeFolder),
5867
- modeBtn("url", L.themeBgModeUrl)
6650
+ modeBtn("url", L.themeBgModeUrl),
6651
+ modeBtn("web", L.themeBgModeWeb)
5868
6652
  ),
5869
6653
  ...modeArea,
5870
6654
  section(L.themeBgRegions, h(
@@ -5883,6 +6667,21 @@
5883
6667
  fitBtn("fill", L.themeBgFitFill),
5884
6668
  fitBtn("tile", L.themeBgFitTile)
5885
6669
  ),
6670
+ h(
6671
+ "div",
6672
+ { class: "mt-3 flex flex-wrap items-center gap-2" },
6673
+ h("span", { class: "text-ui-xs font-medium text-foreground-subtle" }, L.themeBgTransition),
6674
+ transBtn("cut", L.themeBgTransitionCut),
6675
+ transBtn("fade", L.themeBgTransitionFade)
6676
+ ),
6677
+ h(
6678
+ "div",
6679
+ { class: "mt-3 flex flex-wrap items-center gap-2" },
6680
+ h("span", { class: "text-ui-xs font-medium text-foreground-subtle" }, L.themeBgPause),
6681
+ pauseCheck("pauseOnHidden", L.themeBgPauseHidden),
6682
+ pauseCheck("pauseOnBlur", L.themeBgPauseBlur),
6683
+ pauseCheck("pauseOnBattery", L.themeBgPauseBattery)
6684
+ ),
5886
6685
  h(
5887
6686
  "div",
5888
6687
  { class: "mt-3 flex flex-col gap-2" },
@@ -5890,6 +6689,13 @@
5890
6689
  blurRow(),
5891
6690
  panelRow()
5892
6691
  ),
6692
+ section(L.themeBgPlayback, h(
6693
+ "div",
6694
+ { class: "flex flex-col gap-2" },
6695
+ volumeRow(),
6696
+ rateRow(),
6697
+ fpsRow()
6698
+ )),
5893
6699
  bgInput
5894
6700
  );
5895
6701
  };
@@ -5920,7 +6726,8 @@
5920
6726
  }
5921
6727
  }, label)));
5922
6728
  renderStylesSubTabs();
5923
- paneStyles.append(stylesSubTablist, paneStylesSub1, paneStylesSub2, paneStylesSub3, paneStylesSub4);
6729
+ subTabBars.styles = stylesSubTablist;
6730
+ paneStyles.append(paneStylesSub1, paneStylesSub2, paneStylesSub3, paneStylesSub4);
5924
6731
  paneStylesSub1.append(
5925
6732
  toolbarSwitchWrap,
5926
6733
  h(
@@ -5968,24 +6775,149 @@
5968
6775
  const res = await rpc("/agents", { method: "POST", body: { content: agentsArea.value } });
5969
6776
  if (res.ok) {
5970
6777
  agentsOriginal = typeof res.content === "string" ? res.content : agentsArea.value;
5971
- showToast(L.agentsSaved);
6778
+ showToast(L.agentsSaved, "success");
5972
6779
  } else {
5973
6780
  showToast(L.failed + ": " + errText(res), "error");
5974
6781
  agentsSaveBtn.disabled = false;
5975
6782
  }
5976
6783
  };
5977
- const agentsPromptPane = h("div", { class: "mt-4" });
6784
+ const paneZcode = h("div", { class: "mt-2" });
6785
+ let snap = zcodeConfigRes;
6786
+ const setZcode = async (body2) => {
6787
+ const res = await rpc("/zcode-config", { method: "POST", body: body2 });
6788
+ if (!res.ok) {
6789
+ showToast(L.failed + ": " + errText(res), "error");
6790
+ return false;
6791
+ }
6792
+ snap = res;
6793
+ return true;
6794
+ };
6795
+ if (!snap.ok) {
6796
+ paneZcode.append(h("p", { class: "mt-2 text-ui-sm text-destructive" }, L.failed + ": " + errText(snap)));
6797
+ } else {
6798
+ const fmt2 = (n) => String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6799
+ const countsEl = h("div", { class: "text-ui-sm text-foreground" });
6800
+ const charsEl = h("div", { class: "mt-0.5 text-ui-sm text-foreground" });
6801
+ const statusEl = h("div", { class: "mt-0.5 text-ui-sm" });
6802
+ const budgetField = numberField({
6803
+ value: snap.values.skills.metadataBudget,
6804
+ fallback: snap.stats.defaultBudget,
6805
+ min: 0,
6806
+ max: 1e6,
6807
+ step: 1e3,
6808
+ onCommit: async (v) => {
6809
+ if (await setZcode({ skills: { metadataBudget: v } })) renderStats();
6810
+ }
6811
+ });
6812
+ const budgetTag = h("span", { class: "text-ui-xs text-foreground-subtle" });
6813
+ const suggestEl = h("div", { class: "min-w-0 flex-1 text-ui-xs/relaxed text-foreground-subtle" });
6814
+ const renderStats = () => {
6815
+ countsEl.textContent = L.zcodeStatsCounts.replaceAll("{total}", fmt2(snap.stats.total)).replaceAll("{user}", fmt2(snap.stats.userCount)).replaceAll("{plugin}", fmt2(snap.stats.pluginCount));
6816
+ charsEl.textContent = L.zcodeStatsChars.replaceAll("{n}", fmt2(snap.stats.fullChars));
6817
+ statusEl.textContent = snap.stats.degraded ? L.zcodeStatsDegraded : L.zcodeStatsOk;
6818
+ statusEl.className = "mt-0.5 text-ui-sm " + (snap.stats.degraded ? "text-destructive" : "text-foreground");
6819
+ budgetTag.textContent = snap.configured.skills.metadataBudget ? "" : L.zcodeBudgetDefaultTag;
6820
+ suggestEl.textContent = L.zcodeStatsSuggest.replaceAll("{n}", fmt2(snap.stats.suggested));
6821
+ };
6822
+ const applyBtn = btnSmall(L.zcodeBudgetApply, async () => {
6823
+ if (await setZcode({ skills: { metadataBudget: snap.stats.suggested } })) {
6824
+ budgetField.set(snap.values.skills.metadataBudget);
6825
+ renderStats();
6826
+ showToast(L.zcodeBudgetApplied, "success");
6827
+ }
6828
+ }, "shrink-0");
6829
+ const statsBudgetRow = h(
6830
+ "div",
6831
+ { class: "mt-2 flex items-stretch gap-2" },
6832
+ h(
6833
+ "div",
6834
+ { class: "flex min-w-0 flex-1 flex-col rounded-xl border border-border p-3" },
6835
+ h("div", { class: "text-ui-sm font-medium" }, L.zcodeStatsTitle),
6836
+ countsEl,
6837
+ charsEl,
6838
+ statusEl,
6839
+ h("div", { class: "mt-1 text-ui-xs/relaxed text-foreground-subtle" }, L.zcodeStatsNote)
6840
+ ),
6841
+ h(
6842
+ "div",
6843
+ { class: "flex min-w-0 flex-1 flex-col rounded-xl border border-border p-3" },
6844
+ h("div", { class: "text-ui-sm font-medium" }, L.zcodeSkillBudget),
6845
+ h("div", { class: "mt-0.5 text-ui-xs/relaxed text-foreground-subtle" }, L.zcodeSkillBudgetDesc),
6846
+ h("div", { class: "mt-2 flex items-center gap-1" }, budgetField.el, budgetTag),
6847
+ h("div", { class: "mt-1 flex items-center gap-2" }, suggestEl, applyBtn)
6848
+ )
6849
+ );
6850
+ const togglesWrap = h("div", { class: "mt-2 flex flex-col gap-0.5 rounded-xl border border-border p-1" });
6851
+ const renderToggles = () => {
6852
+ const v = snap.values;
6853
+ const row = (name, desc, checked, patch) => settingRow(name, desc, checked, async () => {
6854
+ if (await setZcode(patch(!checked))) renderToggles();
6855
+ });
6856
+ togglesWrap.replaceChildren(
6857
+ row(L.zcodeSkillEnabled, L.zcodeSkillEnabledDesc, v.skills.enabled, (n) => ({ skills: { enabled: n } })),
6858
+ row(L.zcodeSkillIncludeInstructions, L.zcodeSkillIncludeInstructionsDesc, v.skills.includeInstructions, (n) => ({ skills: { includeInstructions: n } })),
6859
+ row(L.zcodeFeatCompact, L.zcodeFeatCompactDesc, v.features.compact, (n) => ({ features: { compact: n } })),
6860
+ row(L.zcodeFeatRewind, L.zcodeFeatRewindDesc, v.features.rewind, (n) => ({ features: { rewind: n } })),
6861
+ row(L.zcodeFeatSubagent, L.zcodeFeatSubagentDesc, v.features.subagent, (n) => ({ features: { subagent: n } })),
6862
+ row(L.zcodeFeatSkill, L.zcodeFeatSkillDesc, v.features.skill, (n) => ({ features: { skill: n } })),
6863
+ row(L.zcodeFeatMcp, L.zcodeFeatMcpDesc, v.features.mcp, (n) => ({ features: { mcp: n } })),
6864
+ // 记忆不放这里:官方“工作区记忆”是桌面设置里的 memoryEnabled
6865
+ // (~/.zcode/v2/setting.json),与本页写的 agent 配置不是同一层开关
6866
+ h("div", { class: "px-2 pb-1 pt-1 text-ui-xs/relaxed text-foreground-subtle" }, L.zcodeMemoryHint)
6867
+ );
6868
+ };
6869
+ const rootsArea = h("textarea", {
6870
+ class: "zcodepro-textarea zcodepro-textarea-sm",
6871
+ rows: 3,
6872
+ spellcheck: "false",
6873
+ placeholder: "/path/to/skills"
6874
+ });
6875
+ let rootsOriginal = snap.values.skills.roots.join("\n");
6876
+ rootsArea.value = rootsOriginal;
6877
+ const rootsSaveBtn = btnSmall(L.zcodeSave, async () => {
6878
+ rootsSaveBtn.disabled = true;
6879
+ const lines = rootsArea.value.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
6880
+ if (await setZcode({ skills: { roots: lines } })) {
6881
+ rootsOriginal = snap.values.skills.roots.join("\n");
6882
+ renderStats();
6883
+ showToast(L.zcodeRootsSaved, "success");
6884
+ } else {
6885
+ rootsSaveBtn.disabled = false;
6886
+ }
6887
+ }, "shrink-0", "primary");
6888
+ rootsSaveBtn.disabled = true;
6889
+ rootsArea.addEventListener("input", () => {
6890
+ rootsSaveBtn.disabled = rootsArea.value === rootsOriginal;
6891
+ });
6892
+ renderStats();
6893
+ renderToggles();
6894
+ paneZcode.append(
6895
+ h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.zcodeDesc),
6896
+ statsBudgetRow,
6897
+ togglesWrap,
6898
+ h(
6899
+ "div",
6900
+ { class: "mt-2 rounded-xl border border-border p-2" },
6901
+ h("div", { class: "text-ui-sm font-medium text-foreground" }, L.zcodeSkillRoots),
6902
+ h("div", { class: "mt-0.5 text-ui-xs/relaxed text-foreground-subtle" }, L.zcodeSkillRootsDesc),
6903
+ h("div", { class: "mt-2" }, rootsArea),
6904
+ h("div", { class: "mt-2 flex justify-end" }, rootsSaveBtn)
6905
+ )
6906
+ );
6907
+ }
6908
+ const agentsPromptPane = h("div", { class: "mt-2" });
5978
6909
  agentsPromptPane.append(
5979
6910
  h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.agentsDesc),
5980
6911
  ...agentsFailed ? [h("p", { class: "mt-2 text-ui-sm text-destructive" }, L.agentsLoadFailed + ": " + errText(agentsRes))] : [],
5981
6912
  h("div", { class: "mt-3" }, agentsArea),
5982
6913
  h("div", { class: "mt-3 flex justify-end" }, agentsSaveBtn)
5983
6914
  );
5984
- let agentsSubTab = "prompt";
5985
- const agentsSubPanes = { prompt: agentsPromptPane, titleGen: paneTitleGen };
6915
+ let agentsSubTab = "zcode";
6916
+ const agentsSubPanes = { zcode: paneZcode, prompt: agentsPromptPane, titleGen: paneTitleGen };
5986
6917
  const agentsSubList = h("div", { role: "tablist", "aria-orientation": "horizontal", class: "zcodepro-tablist" });
5987
6918
  const renderAgentsSubTabs = () => {
5988
6919
  agentsSubList.replaceChildren(...[
6920
+ ["zcode", L.tabZcode],
5989
6921
  ["prompt", L.tabAgents],
5990
6922
  ["titleGen", L.tabTitleGen]
5991
6923
  ].map(([id, label]) => h("button", {
@@ -6003,7 +6935,8 @@
6003
6935
  };
6004
6936
  for (const [pid, pane] of Object.entries(agentsSubPanes)) pane.style.display = pid === agentsSubTab ? "" : "none";
6005
6937
  renderAgentsSubTabs();
6006
- paneAgents.append(agentsSubList, agentsPromptPane, paneTitleGen);
6938
+ subTabBars.agents = agentsSubList;
6939
+ paneAgents.append(paneZcode, agentsPromptPane, paneTitleGen);
6007
6940
  const savedProxy = typeof config.proxy === "string" ? config.proxy : "";
6008
6941
  const proxyInputCls = "h-8 w-full rounded-lg border border-border bg-input px-2.5 text-ui-sm text-foreground outline-none transition-shadow placeholder:text-foreground-subtle focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40";
6009
6942
  const proxyInput = h("input", { type: "text", value: savedProxy, placeholder: L.proxyPlaceholder, spellcheck: "false", class: proxyInputCls + " min-w-0 flex-1" });
@@ -6021,7 +6954,7 @@
6021
6954
  if (res.ok) {
6022
6955
  proxyOriginal = res.config && typeof res.config.proxy === "string" ? res.config.proxy : proxyInput.value.trim();
6023
6956
  proxyInput.value = proxyOriginal;
6024
- showToast(L.proxySaved);
6957
+ showToast(L.proxySaved, "success");
6025
6958
  } else {
6026
6959
  proxySaveBtn.disabled = false;
6027
6960
  showToast(L.failed + ": " + errText(res), "error");
@@ -6221,7 +7154,7 @@
6221
7154
  syncLoginInput.value = res.sync.login;
6222
7155
  syncPasswordInput.value = res.sync.password;
6223
7156
  syncHistoryInput.value = syncFormOriginal.historyLimit;
6224
- showToast(L.syncSaved);
7157
+ showToast(L.syncSaved, "success");
6225
7158
  } else {
6226
7159
  showToast(L.failed + ": " + errText(res), "error");
6227
7160
  syncCheckDirty();
@@ -6612,8 +7545,8 @@
6612
7545
  // 视觉上游冷启动可能近 2 分钟,与插件 DEFAULT_CONFIG 一致
6613
7546
  compressThresholdKB: 1024,
6614
7547
  skipAfterFailures: 2,
6615
- skipMinutes: 30,
6616
- forceIntercept: true
7548
+ skipMinutes: 30
7549
+ // forceIntercept 不写:缺省 = 自动(跟随宿主「模型设置」图片开关,zcode-vision ≥1.7.9)
6617
7550
  };
6618
7551
  let visionCfg = visionRes.ok && visionRes.config && typeof visionRes.config === "object" ? structuredClone(visionRes.config) : null;
6619
7552
  let visionAutoInitTried = false;
@@ -6900,32 +7833,51 @@
6900
7833
  )
6901
7834
  )
6902
7835
  ),
6903
- // 链模式 + 强制拦截开关合到一行(启用开关已上移信息卡)
7836
+ // 链模式 / 主模型策略 / 识图卡片 三项均分一行、各格内容左对齐(启用开关已上移信息卡)
6904
7837
  h(
6905
7838
  "div",
6906
- { class: "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-border p-1" },
6907
- h("span", { class: "ml-1.5 shrink-0 text-ui-sm font-medium text-foreground" }, L.visionMode),
6908
- modeBtn("fallback", L.visionModeFallback, L.visionModeFallbackDesc),
6909
- modeBtn("pipeline", L.visionModePipeline, L.visionModePipelineDesc),
7839
+ { class: "mt-3 grid grid-cols-1 items-center gap-1.5 rounded-xl border border-border p-2 sm:grid-cols-3" },
6910
7840
  h(
6911
7841
  "div",
6912
- { class: "ml-auto flex items-center gap-4" },
7842
+ { class: "flex flex-wrap items-center gap-2" },
7843
+ h("span", { class: "shrink-0 text-ui-sm font-medium text-foreground" }, L.visionMode),
7844
+ modeBtn("fallback", L.visionModeFallback, L.visionModeFallbackDesc),
7845
+ modeBtn("pipeline", L.visionModePipeline, L.visionModePipelineDesc)
7846
+ ),
7847
+ (() => {
7848
+ const sel = h(
7849
+ "select",
7850
+ { class: "h-8 rounded-lg border border-border bg-input px-2 text-ui-sm text-foreground outline-none", title: L.visionForceInterceptHint },
7851
+ h("option", { value: "auto" }, L.visionForceInterceptAuto),
7852
+ h("option", { value: "true" }, L.visionForceInterceptTrue),
7853
+ h("option", { value: "false" }, L.visionForceInterceptFalse)
7854
+ );
7855
+ sel.value = visionCfg.forceIntercept === true ? "true" : visionCfg.forceIntercept === false ? "false" : "auto";
7856
+ sel.addEventListener("change", () => {
7857
+ visionCfg.forceIntercept = sel.value === "true" ? true : sel.value === "false" ? false : null;
7858
+ void persistVision();
7859
+ });
7860
+ return h(
7861
+ "label",
7862
+ { class: "flex items-center gap-1.5", title: L.visionForceInterceptHint },
7863
+ h("span", { class: "text-ui-sm font-medium text-foreground" }, L.visionForceIntercept),
7864
+ sel
7865
+ );
7866
+ })(),
7867
+ h(
7868
+ "div",
7869
+ { class: "flex items-center" },
6913
7870
  settingRow(L.visionCardUi, "", visionCfg.cardUi !== false, async () => {
6914
7871
  visionCfg.cardUi = !(visionCfg.cardUi !== false);
6915
7872
  await persistVision();
6916
7873
  renderVision();
6917
- }),
6918
- settingRow(L.visionForceIntercept, "", visionCfg.forceIntercept !== false, async () => {
6919
- visionCfg.forceIntercept = !(visionCfg.forceIntercept !== false);
6920
- await persistVision();
6921
- renderVision();
6922
7874
  })
6923
7875
  )
6924
7876
  ),
6925
- // 压缩阈值 / 连续失败次数 / 跳过分钟数 三个数字一行
7877
+ // 压缩阈值 / 连续失败次数 / 跳过分钟数 三个数字一行(p-2 与上方信息卡对齐)
6926
7878
  h(
6927
7879
  "div",
6928
- { class: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-border p-1" },
7880
+ { class: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-border p-2" },
6929
7881
  (() => {
6930
7882
  const n = h("input", {
6931
7883
  type: "number",
@@ -7078,7 +8030,7 @@
7078
8030
  const v = input.value.trim();
7079
8031
  if (!v) return;
7080
8032
  if (!/^(git:)?[A-Za-z0-9._-]+$/.test(v) || rtkCfg.whitelist.includes(v)) {
7081
- showToast(L.rtkWhitelistInvalid, "error");
8033
+ showToast(L.rtkWhitelistInvalid, "warning");
7082
8034
  return;
7083
8035
  }
7084
8036
  if (await persistRtk({ whitelist: [...rtkCfg.whitelist, v] })) {
@@ -7206,7 +8158,7 @@
7206
8158
  if (await persistRtk({ whitelist: [] })) {
7207
8159
  rtkCfg.whitelist = [];
7208
8160
  renderRtk();
7209
- showToast(L.rtkWhitelistCleared);
8161
+ showToast(L.rtkWhitelistCleared, "success");
7210
8162
  }
7211
8163
  })();
7212
8164
  }, "shrink-0")
@@ -7322,7 +8274,7 @@
7322
8274
  clearInterval(timerIv);
7323
8275
  hrBusy = false;
7324
8276
  await hrRefresh();
7325
- showToast(doneMsg, isStart ? "success" : void 0);
8277
+ showToast(doneMsg, "success");
7326
8278
  return;
7327
8279
  }
7328
8280
  }
@@ -7341,7 +8293,7 @@
7341
8293
  return false;
7342
8294
  }
7343
8295
  if (res.config) Object.assign(hrCfg, res.config);
7344
- if (warn) showToast(warn);
8296
+ if (warn) showToast(warn, "warning");
7345
8297
  if (!isStart && !isStop) {
7346
8298
  hrBusy = false;
7347
8299
  setTimeout(() => {
@@ -7421,7 +8373,7 @@
7421
8373
  }
7422
8374
  if (res.usage) headroomRes.usage = res.usage;
7423
8375
  renderHrUsageSwitch();
7424
- if (next && !res.changed && !(res.usage && res.usage.enabled)) showToast(L.hrUsageNone);
8376
+ if (next && !res.changed && !(res.usage && res.usage.enabled)) showToast(L.hrUsageNone, "warning");
7425
8377
  })
7426
8378
  );
7427
8379
  };
@@ -7805,9 +8757,13 @@
7805
8757
  );
7806
8758
  };
7807
8759
  renderTitleGenPane();
8760
+ const subTabHost = h("div", { class: "mt-2" });
8761
+ for (const bar of Object.values(subTabBars)) {
8762
+ bar.style.display = "none";
8763
+ subTabHost.append(bar);
8764
+ }
8765
+ content.insertBefore(h("div", { class: "flex flex-col items-start" }, tablist, subTabHost), body);
7808
8766
  body.append(
7809
- statusLine,
7810
- tablist,
7811
8767
  paneFeatures,
7812
8768
  paneShortcuts,
7813
8769
  paneAgents,
@@ -7892,7 +8848,7 @@
7892
8848
  const scope = workspaces.size === 1 ? "workspace" : "group-members";
7893
8849
  const res = await rpc("/task-order", { method: "POST", body: { scope, ordered } });
7894
8850
  if (res && res.ok) {
7895
- showToast(L.taskOrderSaved);
8851
+ showToast(L.taskOrderSaved, "success");
7896
8852
  setTimeout(() => location.reload(), 600);
7897
8853
  } else {
7898
8854
  showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
@@ -8044,7 +9000,7 @@
8044
9000
  }
8045
9001
  }
8046
9002
  function workspaceOf(key) {
8047
- const i = key.indexOf(":sess_");
9003
+ const i = key.lastIndexOf(":");
8048
9004
  return i > 0 ? key.slice(0, i) : key;
8049
9005
  }
8050
9006
  function wsHead(row) {
@@ -8182,6 +9138,7 @@
8182
9138
  var anyActiveCache = { at: 0, value: null, busy: false };
8183
9139
  var sectionActive = { task: false, project: false, pinned: false };
8184
9140
  var activeProjectPaths = /* @__PURE__ */ new Set();
9141
+ var authActiveByWs = /* @__PURE__ */ new Map();
8185
9142
  setInterval(() => {
8186
9143
  if (!anyActiveCache.busy && Date.now() - anyActiveCache.at >= 1e4) globalAnyActive();
8187
9144
  }, 1e4);
@@ -8193,6 +9150,7 @@
8193
9150
  sectionActive.project = false;
8194
9151
  sectionActive.pinned = false;
8195
9152
  activeProjectPaths = /* @__PURE__ */ new Set();
9153
+ authActiveByWs = /* @__PURE__ */ new Map();
8196
9154
  void (async () => {
8197
9155
  let hit = null;
8198
9156
  try {
@@ -8244,12 +9202,24 @@
8244
9202
  const allIds = [...byKind.task, ...byKind.project];
8245
9203
  const st = allIds.length ? await rpc("/task-statuses?ids=" + encodeURIComponent(allIds.join(","))).catch(() => null) : null;
8246
9204
  const TERMINAL = /* @__PURE__ */ new Set(["completed", "error", "interrupted"]);
9205
+ const recOf = (id) => st && st.ok && st.available ? st.statuses[id] : void 0;
8247
9206
  const live = (id) => {
8248
- const rec = st && st.ok && st.available ? st.statuses[id] : void 0;
9207
+ const rec = recOf(id);
8249
9208
  if (rec === void 0) return true;
8250
9209
  if (!TERMINAL.has(rec.status)) return true;
8251
9210
  return Date.now() - rec.updatedAt < 3e5;
8252
9211
  };
9212
+ const liveSession = (id) => {
9213
+ const rec = recOf(id);
9214
+ if (rec === void 0) return !!domRowKeyOf(id);
9215
+ if (!TERMINAL.has(rec.status)) return true;
9216
+ return Date.now() - rec.updatedAt < 3e5;
9217
+ };
9218
+ authActiveByWs = /* @__PURE__ */ new Map();
9219
+ for (const [base, ids] of byKindByPath) {
9220
+ const liveIds = ids.filter(liveSession);
9221
+ if (liveIds.length) authActiveByWs.set(base, liveIds);
9222
+ }
8253
9223
  activeProjectPaths = /* @__PURE__ */ new Set();
8254
9224
  for (const [base, ids] of byKindByPath) {
8255
9225
  if (!projPaths.has(base)) continue;
@@ -8272,7 +9242,7 @@
8272
9242
  for (const el of list.querySelectorAll("[data-task-item-key]")) {
8273
9243
  if (el.closest("section[data-project-id]")) continue;
8274
9244
  const k = el.getAttribute("data-task-item-key") || "";
8275
- const id = k.slice(k.indexOf(":sess_") + 1);
9245
+ const id = k.slice(k.lastIndexOf(":") + 1);
8276
9246
  const base = k.slice(0, k.lastIndexOf(":")).replace(/[\/]+$/, "");
8277
9247
  const ids = byKindByPath.get(base) || [];
8278
9248
  if (ids.map(String).includes(id) && ids.some(live)) {
@@ -8423,9 +9393,23 @@
8423
9393
  current: curKey ? workspaceOf(curKey) || null : null
8424
9394
  };
8425
9395
  }
9396
+ function domRowKeyOf(id) {
9397
+ if (!id) return "";
9398
+ try {
9399
+ const el = document.querySelector(`[data-task-item-key$=":${CSS.escape(id)}"]`);
9400
+ return el && el.getAttribute("data-task-item-key") || "";
9401
+ } catch {
9402
+ return "";
9403
+ }
9404
+ }
8426
9405
  function wsRunningKeys() {
8427
9406
  const keys = /* @__PURE__ */ new Set();
8428
- for (const set of runningByWs.values()) for (const k of set) keys.add(k);
9407
+ for (const set of runningByWs.values()) {
9408
+ for (const k of set) if (!k.endsWith(":active")) keys.add(k);
9409
+ }
9410
+ for (const [base, ids] of authActiveByWs) {
9411
+ for (const id of ids) keys.add(domRowKeyOf(id) || `${base}:${id}`);
9412
+ }
8429
9413
  return keys;
8430
9414
  }
8431
9415
  async function verifyWorkspaceNotRunning(ws) {
@@ -8558,6 +9542,10 @@
8558
9542
  function startWsRunningSpin() {
8559
9543
  if (installed2 || typeof document === "undefined") return;
8560
9544
  installed2 = true;
9545
+ const st = document.createElement("style");
9546
+ st.id = "__zcodepro_ws_style__";
9547
+ st.textContent = ".zcodepro-ws-loader{color:color-mix(in srgb, currentColor 85%, black) !important}";
9548
+ document.head.append(st);
8561
9549
  void refreshConfig();
8562
9550
  pollConfig();
8563
9551
  const observer2 = new MutationObserver((muts) => {
@@ -8603,7 +9591,6 @@
8603
9591
  var visibleCount = INITIAL_COUNT;
8604
9592
  var unseen = /* @__PURE__ */ new Set();
8605
9593
  var lastRunKeys = null;
8606
- var movedSinceOpen = false;
8607
9594
  var hotkeys = { ...DEFAULT_SHORTCUTS };
8608
9595
  function loadHotkeys() {
8609
9596
  return getConfig(true).then((cfg) => {
@@ -8621,7 +9608,7 @@
8621
9608
  return (tEl ? tEl.textContent : (item.innerText || "").split("\n")[0])?.trim() || "";
8622
9609
  }
8623
9610
  function workspaceOf2(key) {
8624
- const i = key.indexOf(":sess_");
9611
+ const i = key.lastIndexOf(":");
8625
9612
  return i > 0 ? key.slice(0, i) : key;
8626
9613
  }
8627
9614
  function findCurrent() {
@@ -8672,7 +9659,8 @@
8672
9659
  }, SCAN_DEBOUNCE_MS2);
8673
9660
  }
8674
9661
  async function switchTo(key) {
8675
- const find = () => document.querySelector(`[data-task-item-key="${CSS.escape(key)}"]`);
9662
+ const id = key.slice(key.lastIndexOf(":") + 1);
9663
+ const find = () => document.querySelector(`[data-task-item-key="${CSS.escape(key)}"]`) || (id ? document.querySelector(`[data-task-item-key$=":${CSS.escape(id)}"]`) : null);
8676
9664
  let item = find();
8677
9665
  if (!item) {
8678
9666
  const ws = workspaceOf2(key);
@@ -8690,23 +9678,28 @@
8690
9678
  }
8691
9679
  function attentionList() {
8692
9680
  const run = wsRunningKeys();
9681
+ const idOf = (k) => k.slice(k.lastIndexOf(":") + 1);
9682
+ const runKeyById = new Map([...run].map((k) => [idOf(k), k]));
8693
9683
  const listed = /* @__PURE__ */ new Set();
8694
9684
  const head = [];
8695
9685
  for (const k of mru) {
8696
- if (run.has(k) || unseen.has(k)) {
8697
- head.push(k);
8698
- listed.add(k);
9686
+ const id = idOf(k);
9687
+ if (listed.has(id)) continue;
9688
+ const runForm = runKeyById.get(id);
9689
+ if (run.has(k) || unseen.has(k) || runForm) {
9690
+ head.push(runForm || k);
9691
+ listed.add(id);
8699
9692
  }
8700
9693
  }
8701
9694
  const tail = [];
8702
- for (const k of run) if (!listed.has(k)) {
9695
+ const push = (k) => {
9696
+ const id = idOf(k);
9697
+ if (listed.has(id)) return;
9698
+ listed.add(id);
8703
9699
  tail.push(k);
8704
- listed.add(k);
8705
- }
8706
- for (const k of unseen) if (!listed.has(k)) {
8707
- tail.push(k);
8708
- listed.add(k);
8709
- }
9700
+ };
9701
+ for (const k of run) push(k);
9702
+ for (const k of unseen) push(k);
8710
9703
  return [...head, ...tail];
8711
9704
  }
8712
9705
  function activeList() {
@@ -8727,9 +9720,23 @@
8727
9720
  function findTitle(key) {
8728
9721
  const item = document.querySelector(`[data-task-item-key="${CSS.escape(key)}"]`);
8729
9722
  if (item) titles.set(key, firstLineOf(item));
8730
- const id = key.slice(key.indexOf(":sess_") + 1);
9723
+ const id = key.slice(key.lastIndexOf(":") + 1);
8731
9724
  return titles.get(key) || `sess ${id.slice(0, 8)}`;
8732
9725
  }
9726
+ async function fetchMissingTitles(keys) {
9727
+ const sessIdOf3 = (k) => k.slice(k.lastIndexOf(":") + 1);
9728
+ const missing = keys.filter((k) => {
9729
+ const id = sessIdOf3(k);
9730
+ return id && !titles.get(k) && !document.querySelector(`[data-task-item-key$=":${CSS.escape(id)}"]`);
9731
+ });
9732
+ if (!missing.length) return;
9733
+ const st = await rpc("/task-statuses?ids=" + encodeURIComponent(missing.map(sessIdOf3).join(","))).catch(() => null);
9734
+ if (!st || !st.ok || !st.available || !st.statuses) return;
9735
+ for (const k of missing) {
9736
+ const rec = st.statuses[sessIdOf3(k)];
9737
+ if (rec && rec.title) titles.set(k, String(rec.title));
9738
+ }
9739
+ }
8733
9740
  function projLabelOf(key, aliases2) {
8734
9741
  const ws = workspaceOf2(key);
8735
9742
  if (!ws) return "";
@@ -8775,14 +9782,23 @@
8775
9782
  ));
8776
9783
  }
8777
9784
  }
8778
- async function openPopup(mode = "mru") {
9785
+ var openPopupInflight = null;
9786
+ function openPopup(mode = "mru") {
8779
9787
  if (popupEl) return;
9788
+ if (openPopupInflight) return openPopupInflight;
9789
+ openPopupInflight = openPopupInner(mode).finally(() => {
9790
+ openPopupInflight = null;
9791
+ });
9792
+ return openPopupInflight;
9793
+ }
9794
+ async function openPopupInner(mode) {
8780
9795
  popupMode = mode;
8781
9796
  visibleCount = INITIAL_COUNT;
8782
9797
  highlight = 0;
8783
- movedSinceOpen = false;
8784
9798
  const cfg = await getConfig().catch(() => null);
8785
9799
  aliasesCache = cfg && cfg.aliases && typeof cfg.aliases === "object" ? cfg.aliases : {};
9800
+ if (mode === "attention") await fetchMissingTitles(attentionList()).catch(() => {
9801
+ });
8786
9802
  ensureStyle();
8787
9803
  const L = t();
8788
9804
  popupEl = h(
@@ -8817,7 +9833,6 @@
8817
9833
  const len = Math.min(activeList().length, visibleCount);
8818
9834
  if (len < 2) return;
8819
9835
  highlight = highlight > 0 ? highlight - 1 : len - 1;
8820
- movedSinceOpen = true;
8821
9836
  renderPopup();
8822
9837
  scrollHighlight();
8823
9838
  }
@@ -8833,7 +9848,6 @@
8833
9848
  } else {
8834
9849
  highlight = 0;
8835
9850
  }
8836
- movedSinceOpen = true;
8837
9851
  renderPopup();
8838
9852
  scrollHighlight();
8839
9853
  }
@@ -8856,8 +9870,10 @@
8856
9870
  if (document.hidden) return;
8857
9871
  const now = wsRunningKeys();
8858
9872
  if (lastRunKeys) {
9873
+ const idOf = (k) => k.slice(k.lastIndexOf(":") + 1);
9874
+ const nowIds = new Set([...now].map(idOf));
8859
9875
  for (const k of lastRunKeys) {
8860
- if (!now.has(k) && k !== current) unseen.add(k);
9876
+ if (!nowIds.has(idOf(k)) && k !== current) unseen.add(k);
8861
9877
  }
8862
9878
  }
8863
9879
  lastRunKeys = now;
@@ -8874,6 +9890,14 @@
8874
9890
  closePopup(false);
8875
9891
  return;
8876
9892
  }
9893
+ const bareK = e.key.toLowerCase();
9894
+ if (popupEl && !e.altKey && !e.ctrlKey && !e.metaKey && !e.isComposing && (bareK === hotkeys.switchPrev || bareK === hotkeys.switchNext)) {
9895
+ e.preventDefault();
9896
+ e.stopImmediatePropagation();
9897
+ if (bareK === hotkeys.switchPrev) moveUp();
9898
+ else moveDown();
9899
+ return;
9900
+ }
8877
9901
  if (popupEl && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "Enter")) {
8878
9902
  e.preventDefault();
8879
9903
  e.stopImmediatePropagation();
@@ -8899,7 +9923,7 @@
8899
9923
  if (live) record(live.getAttribute("data-task-item-key"));
8900
9924
  const target = live ? mru[0] === current ? mru[1] : mru.find((mk) => mk !== current) : mru[0];
8901
9925
  if (!target) {
8902
- showToast(t().switcherEmpty);
9926
+ showToast(t().switcherEmpty, "warning");
8903
9927
  return;
8904
9928
  }
8905
9929
  void switchTo(target).then((ok) => {
@@ -8911,28 +9935,35 @@
8911
9935
  if (e.repeat) return;
8912
9936
  closePopup(false);
8913
9937
  if (!attentionList().length) {
8914
- showToast(t().switcherAttentionEmpty);
9938
+ showToast(t().switcherAttentionEmpty, "warning");
8915
9939
  return;
8916
9940
  }
8917
9941
  await openPopup("attention");
8918
9942
  return;
8919
9943
  }
8920
- if (mru.length < 2) {
8921
- showToast(t().switcherEmpty);
8922
- return;
8923
- }
8924
9944
  if (k === hotkeys.switchRecent) {
8925
- if (!e.repeat && !popupEl) await openPopup("mru");
9945
+ if (!e.repeat && !popupEl && !openPopupInflight) {
9946
+ if (!mru.length) {
9947
+ showToast(t().switcherEmpty, "warning");
9948
+ return;
9949
+ }
9950
+ await openPopup("mru");
9951
+ }
8926
9952
  return;
8927
9953
  }
8928
- if (!popupEl) await openPopup("mru");
9954
+ if (openPopupInflight) {
9955
+ await openPopupInflight;
9956
+ } else if (!popupEl) {
9957
+ if (!mru.length) {
9958
+ showToast(t().switcherEmpty, "warning");
9959
+ return;
9960
+ }
9961
+ await openPopup("mru");
9962
+ }
8929
9963
  if (k === hotkeys.switchPrev) moveUp();
8930
9964
  else moveDown();
8931
9965
  })();
8932
9966
  }, true);
8933
- document.addEventListener("keyup", (e) => {
8934
- if (e.key === "Alt" && popupEl && movedSinceOpen) closePopup(true);
8935
- }, true);
8936
9967
  window.addEventListener("blur", () => closePopup(false));
8937
9968
  }
8938
9969
 
@@ -8997,7 +10028,7 @@
8997
10028
  const cur = rows.find((e) => (e.className + "").includes("bg-selected")) || rows[rows.length - 1];
8998
10029
  const key = cur ? cur.getAttribute("data-task-item-key") : "";
8999
10030
  if (!key) return null;
9000
- const i = key.indexOf(":sess_");
10031
+ const i = key.lastIndexOf(":");
9001
10032
  return i > 0 ? { workspacePath: key.slice(0, i), sessionId: key.slice(i + 1) } : null;
9002
10033
  }
9003
10034
  async function thirdPartySurfaces(bridge, workspacePath) {
@@ -9069,7 +10100,7 @@
9069
10100
  const sc = sessionScope();
9070
10101
  const open = findOpenSidePane();
9071
10102
  if (!sc || !open) {
9072
- showToast(L.ntpNeedSession, "error");
10103
+ showToast(L.ntpNeedSession, "warning");
9073
10104
  return;
9074
10105
  }
9075
10106
  try {
@@ -9085,7 +10116,7 @@
9085
10116
  });
9086
10117
  } catch (e) {
9087
10118
  console.warn("[zcodepro] \u6253\u5F00\u63D2\u4EF6\u9762\u677F\u5931\u8D25", e);
9088
- showToast(L.ntpNeedSession, "error");
10119
+ showToast(L.ntpNeedSession, "warning");
9089
10120
  }
9090
10121
  });
9091
10122
  grid.append(card);
@@ -9562,7 +10593,7 @@
9562
10593
  var fetching = null;
9563
10594
  var pendingKeys = /* @__PURE__ */ new Set();
9564
10595
  function sessIdOf(key) {
9565
- const i = key.indexOf(":sess_");
10596
+ const i = key.lastIndexOf(":");
9566
10597
  return i > 0 ? key.slice(i + 1) : key;
9567
10598
  }
9568
10599
  function titleElsOf(item) {
@@ -9823,7 +10854,7 @@
9823
10854
  var attempted = /* @__PURE__ */ new Set();
9824
10855
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
9825
10856
  function sessIdOf2(key) {
9826
- const i = key.indexOf(":sess_");
10857
+ const i = key.lastIndexOf(":");
9827
10858
  return i > 0 ? key.slice(i + 1) : "";
9828
10859
  }
9829
10860
  function currentKey() {
@@ -10754,70 +11785,75 @@
10754
11785
  // src/inject/features/composer-provider.js
10755
11786
  var installed6 = false;
10756
11787
  var enabled10 = true;
10757
- function labelToDisplay(label) {
10758
- const i = label.indexOf("/");
10759
- if (i <= 0) return null;
10760
- const provider = label.slice(0, i).trim();
10761
- const rest = label.slice(i + 1);
10762
- const model = rest.trim().split(/\s+/)[0];
10763
- if (!provider || !model) return null;
10764
- return `${provider} / ${model}`;
11788
+ var TRIGGER_SEL = '[data-testid="chat-model-select-trigger"]';
11789
+ function labelParts(label) {
11790
+ const text = (label || "").trim();
11791
+ if (!text) return null;
11792
+ const i = text.indexOf("/");
11793
+ if (i > 0) {
11794
+ const provider = text.slice(0, i).trim();
11795
+ const model = text.slice(i + 1).trim().split(/\s+/)[0];
11796
+ return provider && model ? { provider, model } : null;
11797
+ }
11798
+ return { provider: null, model: text.split(/\s+/)[0] };
11799
+ }
11800
+ function holdersOf(btn, model) {
11801
+ const innermost = [...btn.querySelectorAll("span[title]")].filter((sp) => !sp.querySelector("span[title]"));
11802
+ const holders = [];
11803
+ for (const sp of innermost) {
11804
+ for (const el of sp.querySelectorAll("span:not([title])")) {
11805
+ if (el.querySelector("span")) continue;
11806
+ const text = el.textContent.trim();
11807
+ if (!text) continue;
11808
+ if (text === model || text.endsWith(` / ${model}`)) holders.push(el);
11809
+ }
11810
+ }
11811
+ return holders;
11812
+ }
11813
+ function setText(el, text) {
11814
+ const node = el.firstChild;
11815
+ if (node && node.nodeType === 3 && !node.nextSibling) node.nodeValue = text;
11816
+ else el.textContent = text;
10765
11817
  }
10766
11818
  function apply3() {
10767
- if (!enabled10) {
10768
- for (const btn of document.querySelectorAll('[data-testid="chat-model-select-trigger"]')) {
10769
- if (!btn.dataset.zcodeproProviderShown) continue;
10770
- const label = btn.getAttribute("aria-label") || "";
10771
- const i = label.indexOf("/");
10772
- if (i <= 0) continue;
10773
- const model = label.slice(i + 1).trim().split(/\s+/)[0];
10774
- if (!model) continue;
10775
- for (const sp of btn.querySelectorAll("span[title]")) sp.setAttribute("title", model);
10776
- for (const el of btn.querySelectorAll("span[title] span:not([title])")) {
10777
- if (!el.querySelector("span") && el.textContent.includes("/")) el.textContent = model;
11819
+ for (const btn of document.querySelectorAll(TRIGGER_SEL)) {
11820
+ const parts = labelParts(btn.getAttribute("aria-label") || "");
11821
+ if (!parts) continue;
11822
+ const holders = holdersOf(btn, parts.model);
11823
+ if (enabled10) {
11824
+ if (!parts.provider || !holders.length) continue;
11825
+ const target = `${parts.provider} / ${parts.model}`;
11826
+ for (const el of holders) {
11827
+ if (el.textContent.trim() !== target) setText(el, target);
11828
+ }
11829
+ for (const sp of btn.querySelectorAll("span[title]")) {
11830
+ if (sp.getAttribute("title") !== target) sp.setAttribute("title", target);
11831
+ }
11832
+ btn.dataset.zcodeproProviderShown = "1";
11833
+ } else if (btn.dataset.zcodeproProviderShown) {
11834
+ for (const el of holders) {
11835
+ if (el.textContent.trim() !== parts.model) setText(el, parts.model);
10778
11836
  }
11837
+ for (const sp of btn.querySelectorAll("span[title]")) sp.setAttribute("title", parts.model);
10779
11838
  delete btn.dataset.zcodeproProviderShown;
10780
11839
  }
10781
- return;
10782
- }
10783
- for (const btn of document.querySelectorAll('[data-testid="chat-model-select-trigger"]')) {
10784
- const label = btn.getAttribute("aria-label") || "";
10785
- const display = labelToDisplay(label);
10786
- if (!display) continue;
10787
- const titleSpans = [...btn.querySelectorAll("span[title]")];
10788
- if (!titleSpans.length) continue;
10789
- const innermost = titleSpans.filter((sp) => !sp.querySelector("span[title]"));
10790
- if (!innermost.length) continue;
10791
- const holders = [];
10792
- for (const sp of innermost) {
10793
- sp.querySelectorAll("span:not([title])").forEach((el) => {
10794
- if (!el.querySelector("span") && el.textContent.trim() && !el.textContent.includes("/")) holders.push(el);
10795
- });
10796
- }
10797
- if (!holders.length) continue;
10798
- for (const sp of titleSpans) {
10799
- if (sp.getAttribute("title") !== display) sp.setAttribute("title", display);
10800
- }
10801
- for (const el of holders) el.textContent = display;
10802
- btn.dataset.zcodeproProviderShown = "1";
10803
11840
  }
10804
11841
  }
10805
11842
  function startComposerProvider() {
10806
11843
  if (installed6 || typeof document === "undefined") return;
10807
11844
  installed6 = true;
10808
- const COMPOSER_SEL = '[data-composer-layout], [data-composer-leading-content], [data-testid="chat-model-select-trigger"]';
11845
+ const COMPOSER_SEL = '[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content], [data-testid="chat-model-select-trigger"]';
10809
11846
  const relevant2 = (muts) => {
10810
11847
  for (const m of muts) {
10811
11848
  if (m.type === "childList") {
10812
11849
  for (const n of [...m.addedNodes, ...m.removedNodes]) {
10813
- if (n instanceof Element && (n.matches?.(COMPOSER_SEL) || n.querySelector?.(COMPOSER_SEL))) return true;
11850
+ if (n instanceof Element && (n.matches?.(COMPOSER_SEL) || n.querySelector?.(COMPOSER_SEL) || n.closest?.(TRIGGER_SEL))) return true;
10814
11851
  }
11852
+ } else if (m.type === "attributes") {
11853
+ if (m.target instanceof Element && m.target.closest?.(TRIGGER_SEL)) return true;
10815
11854
  } else if (m.type === "characterData") {
10816
- let el = m.target.parentElement;
10817
- while (el && el !== document.body) {
10818
- if (el.matches?.("[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content]")) return true;
10819
- el = el.parentElement;
10820
- }
11855
+ const el = m.target.parentElement?.closest?.(COMPOSER_SEL);
11856
+ if (el) return true;
10821
11857
  }
10822
11858
  }
10823
11859
  return false;
@@ -10843,7 +11879,14 @@
10843
11879
  const observer2 = new MutationObserver((muts) => {
10844
11880
  if (enabled10 && relevant2(muts)) schedule();
10845
11881
  });
10846
- observer2.observe(document.body, { childList: true, subtree: true, characterData: true });
11882
+ observer2.observe(document.body, {
11883
+ childList: true,
11884
+ subtree: true,
11885
+ characterData: true,
11886
+ attributes: true,
11887
+ attributeFilter: ["aria-label", "data-model-current-value"]
11888
+ // 这两个只有应用会写,不认 title,避免自己改 title 叫醒自己
11889
+ });
10847
11890
  apply3();
10848
11891
  }
10849
11892
 
@@ -10881,7 +11924,23 @@
10881
11924
  if (window.__zcodeproInjected) {
10882
11925
  const boot = window.__ZCODEPRO__ || {};
10883
11926
  const sameGeneration = window.__zcodeproBootedToken && boot.token && window.__zcodeproBootedToken === boot.token;
10884
- if (!sameGeneration) location.reload();
11927
+ if (!sameGeneration) {
11928
+ const key = "zcodeproReloadLog";
11929
+ let log = [];
11930
+ try {
11931
+ log = JSON.parse(sessionStorage.getItem(key) || "[]");
11932
+ } catch {
11933
+ }
11934
+ if (!Array.isArray(log)) log = [];
11935
+ log = log.filter((ts) => Date.now() - ts < 3e4);
11936
+ if (log.length < 2) {
11937
+ try {
11938
+ sessionStorage.setItem(key, JSON.stringify([...log, Date.now()]));
11939
+ } catch {
11940
+ }
11941
+ location.reload();
11942
+ }
11943
+ }
10885
11944
  return;
10886
11945
  }
10887
11946
  window.__zcodeproInjected = true;