zcode-pro 1.5.1 → 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",
@@ -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",
@@ -429,7 +478,11 @@
429
478
  tabVision: "Vision",
430
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",
431
480
  visionEnabled: "\u542F\u7528",
432
- 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",
433
486
  visionMode: "\u94FE\u6A21\u5F0F",
434
487
  visionModeFallback: "\u4F9D\u6B21\u5C1D\u8BD5",
435
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",
@@ -619,6 +672,39 @@
619
672
  tabProxy: "Proxy",
620
673
  tabBehavior: "Behavior",
621
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).",
622
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.",
623
709
  agentsPlaceholder: "Instructions followed by all projects by default; save empty to remove the global prompt",
624
710
  agentsSave: "Save",
@@ -660,7 +746,7 @@
660
746
  syncIncludeZcp: "ZCode Pro settings",
661
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).",
662
748
  syncIncludeModel: "Model settings",
663
- 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.",
664
750
  syncUpload: "Upload",
665
751
  syncDownload: "Download",
666
752
  syncUploading: "Uploading\u2026",
@@ -812,7 +898,7 @@
812
898
  themeBgRegionLeft: "Left sidebar",
813
899
  themeBgRegionCenter: "Center area",
814
900
  themeBgRegionRight: "Right sidebar",
815
- themeBgPane: "Background",
901
+ themeBgPane: "Wallpaper",
816
902
  themeSkinTitle: "Skins",
817
903
  themeSkinDesc: 'Famous editor theme palettes, auto-matching ZCode\u2019s light / dark mode; "Default" keeps ZCode as-is, "Custom" is tuned below.',
818
904
  themeSkinCustom: "Custom",
@@ -825,39 +911,55 @@
825
911
  themeCustomFg: "Text",
826
912
  themeCustomMuted: "Muted text",
827
913
  themeCustomAccent: "Accent",
828
- 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).",
829
915
  themeBgModeNone: "None",
830
916
  themeBgModeLibrary: "Library",
831
917
  themeBgModeFolder: "Folder",
832
- themeBgModeUrl: "URL",
918
+ themeBgModeUrl: "Image URL",
919
+ themeBgModeWeb: "Web page",
833
920
  themeBgLibrary: "My library",
834
- themeBgUpload: "Upload",
835
- 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)",
836
923
  themeBgDelete: "Delete",
837
- 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.",
838
925
  themeBgFolderPick: "Browse",
839
926
  themeBgFolderPickTitle: "Choose a wallpaper folder",
840
- 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.",
841
928
  themeBgFolderRandom: "Random order",
842
929
  themeBgIntervalHint: "Switch interval (minutes)",
843
930
  themeBgIntervalUnit: "min, 0 = off",
844
- themeBgFolderCount: "{n} images in the folder, rotating on the timer.",
845
- 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.",
846
933
  themeBgUrlHint: "Timed refresh suits random-image APIs (each request returns a new image); a cache-buster is appended on refresh.",
847
934
  themeBgUrlIntervalHint: "Refresh interval (minutes)",
848
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.",
849
937
  themeBgFit: "Fit",
850
938
  themeBgFitCover: "Fill",
851
939
  themeBgFitContain: "Fit",
852
940
  themeBgFitFill: "Stretch",
853
941
  themeBgFitTile: "Tile",
854
942
  themeBgMask: "Mask opacity",
855
- themeBgMaskHint: "Higher values fade the image toward the theme background color for clearer text",
856
- themeBgMaskHint2: "How much the image fades toward the theme background color",
857
- 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",
858
946
  themeBgPanel: "Panel opacity",
859
- themeBgPanelHint: "Opacity of sidebar, panels and tab bar. Lower reveals more of the image.",
860
- 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",
861
963
  tableCopyBtn: "Copy table",
862
964
  tableCopied: "Table copied",
863
965
  sbItemCtx: "Context usage",
@@ -939,7 +1041,11 @@
939
1041
  tabVision: "Vision",
940
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).",
941
1043
  visionEnabled: "Enable",
942
- 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)",
943
1049
  visionMode: "Chain mode",
944
1050
  visionModeFallback: "Fallback",
945
1051
  visionModeFallbackDesc: "Try in order until one succeeds (primary + backup).",
@@ -1260,21 +1366,36 @@
1260
1366
 
1261
1367
  // src/inject/ui.js
1262
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
+ };
1263
1375
  function showToast(text, kind = "info") {
1264
1376
  document.getElementById("__zcodepro_toast__")?.remove();
1265
- const el = h(
1377
+ clearTimeout(toastTimer);
1378
+ const v = TOAST_KINDS[kind === "ok" ? "success" : kind] || TOAST_KINDS.info;
1379
+ const chip = h(
1266
1380
  "div",
1267
1381
  {
1268
- id: "__zcodepro_toast__",
1269
- 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"),
1270
- // left 用内联样式:ZCode 的 Tailwind 未编译 left-6/right-6 工具类(bottom-6 有)
1271
- 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;"
1272
1384
  },
1385
+ h("span", { class: "zcodepro-toast-glyph" }, v.glyph),
1273
1386
  h("span", { class: "truncate" }, text)
1274
1387
  );
1275
- document.body.append(el);
1276
- clearTimeout(toastTimer);
1277
- 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);
1278
1399
  }
1279
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";
1280
1401
  var overlayClassBare = "fixed inset-0 isolate z-50 flex items-start justify-center duration-100 p-4 platform-linux-desktop:top-12";
@@ -1285,6 +1406,13 @@
1285
1406
  const prevActive = document.activeElement;
1286
1407
  let cleanupDrag = null;
1287
1408
  const close = () => {
1409
+ const active = document.activeElement;
1410
+ if (active && overlayEl.contains(active)) {
1411
+ try {
1412
+ active.blur();
1413
+ } catch {
1414
+ }
1415
+ }
1288
1416
  overlayEl.remove();
1289
1417
  dialogStack = dialogStack.filter((e) => e !== overlayEl);
1290
1418
  document.removeEventListener("keydown", onKey);
@@ -1349,11 +1477,34 @@
1349
1477
  titleEl.style.cursor = "move";
1350
1478
  titleEl.style.userSelect = "none";
1351
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));
1352
1501
  const clampPos = (x, y) => {
1353
- const ob = overlayEl.getBoundingClientRect();
1354
- const mx = Math.max(0, (ob.width - content.offsetWidth) / 2 - 8);
1355
- const my = Math.max(0, (ob.height - content.offsetHeight) / 2 - 8);
1356
- 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
+ ];
1357
1508
  };
1358
1509
  const applyPos = () => {
1359
1510
  content.style.transform = ox || oy ? `translate(${ox}px, ${oy}px)` : "";
@@ -1645,6 +1796,23 @@
1645
1796
  if (!root) return;
1646
1797
  root.append(h("style", { id: "__zcodepro_style__" }, `
1647
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); }
1648
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 */
1649
1817
  .zcodepro-overlay { background-color: rgba(0, 0, 0, 0.6); }
1650
1818
  .zcodepro-overlay[data-overlay="none"] { background-color: transparent; }
@@ -1748,7 +1916,7 @@
1748
1916
  }
1749
1917
  .zcodepro-bg-card:hover { filter: brightness(1.15); }
1750
1918
  .zcodepro-bg-card[data-state="active"] { border-color: var(--color-primary, #333); }
1751
- .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; }
1752
1920
  .zcodepro-bg-del {
1753
1921
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
1754
1922
  border-radius: 6px; border: none; cursor: pointer; font-size: 11px; line-height: 1;
@@ -2155,7 +2323,7 @@
2155
2323
  }
2156
2324
  async function copyText(text) {
2157
2325
  const L = t();
2158
- if (await copyToClipboard(text)) showToast(L.pathCopied);
2326
+ if (await copyToClipboard(text)) showToast(L.pathCopied, "success");
2159
2327
  else showToast(L.pathCopyFailed, "error");
2160
2328
  }
2161
2329
  async function copyToClipboard(text) {
@@ -2351,7 +2519,7 @@
2351
2519
  close();
2352
2520
  clearConfigCache();
2353
2521
  await refreshAliases();
2354
- showToast(name ? L.aliasSaved : L.aliasCleared);
2522
+ showToast(name ? L.aliasSaved : L.aliasCleared, "success");
2355
2523
  return;
2356
2524
  }
2357
2525
  showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
@@ -2387,7 +2555,7 @@
2387
2555
  close();
2388
2556
  clearConfigCache();
2389
2557
  await refreshAliases();
2390
- showToast(L.aliasCleared);
2558
+ showToast(L.aliasCleared, "success");
2391
2559
  } else showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
2392
2560
  }));
2393
2561
  }
@@ -2519,7 +2687,10 @@
2519
2687
  submitBtn.removeAttribute("disabled");
2520
2688
  if (res.ok) {
2521
2689
  close();
2522
- 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
+ );
2523
2694
  setTimeout(() => location.reload(), 900);
2524
2695
  return;
2525
2696
  }
@@ -2791,7 +2962,7 @@
2791
2962
  content.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: true, cancelable: true }));
2792
2963
  } catch {
2793
2964
  }
2794
- 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"));
2795
2966
  });
2796
2967
  openItem.after(copyItem);
2797
2968
  }
@@ -2863,7 +3034,7 @@
2863
3034
  try {
2864
3035
  const key = Object.keys(el).find((k) => k.startsWith("__reactFiber$"));
2865
3036
  let fiber = key ? el[key] : null;
2866
- for (let i = 0; fiber && i < 40; i++, fiber = fiber.return) {
3037
+ for (let i = 0; fiber && i < 100; i++, fiber = fiber.return) {
2867
3038
  const props = fiber.memoizedProps;
2868
3039
  if (!props || typeof props !== "object") continue;
2869
3040
  for (const k of ["target", "fileLink", "row"]) {
@@ -3065,9 +3236,9 @@
3065
3236
  if (!blob) throw new Error("empty image");
3066
3237
  if (blob.type !== "image/png") blob = await toPng(blob);
3067
3238
  await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
3068
- showToast(L.imageCopied);
3239
+ showToast(L.imageCopied, "success");
3069
3240
  } catch {
3070
- if (copyViaSelection(img)) showToast(L.imageCopied);
3241
+ if (copyViaSelection(img)) showToast(L.imageCopied, "success");
3071
3242
  else showToast(L.imageCopyFailed, "error");
3072
3243
  }
3073
3244
  }
@@ -3537,7 +3708,7 @@
3537
3708
  clearConfigCache();
3538
3709
  renderList();
3539
3710
  window.dispatchEvent(new CustomEvent("zcodepro:aliases-changed"));
3540
- if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace("{n}", String(ok)));
3711
+ if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace("{n}", String(ok)), "success");
3541
3712
  else showToast(L.aliasMigrateDeadClearFailed, "error");
3542
3713
  };
3543
3714
  const goBtn = btnPrimary(L.aliasMigrateGo, () => {
@@ -3577,9 +3748,9 @@
3577
3748
  decide();
3578
3749
  close();
3579
3750
  if (!failed.length) {
3580
- showToast(L.aliasMigrateDone.replace("{n}", String(ok)), "ok");
3751
+ showToast(L.aliasMigrateDone.replace("{n}", String(ok)), "success");
3581
3752
  } else if (ok) {
3582
- 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");
3583
3754
  } else {
3584
3755
  showToast(L.aliasMigrateAllFailed, "error");
3585
3756
  }
@@ -4165,16 +4336,27 @@
4165
4336
  var classObserver = null;
4166
4337
  var currentTheme = { skin: "default", custom: null, bg: { mode: "none", maskOpacity: 0.82, blurPx: 0, panelOpacity: 0.3 } };
4167
4338
  var lastModeSig = "";
4339
+ var lastThemeSig = "";
4340
+ var themePollTimer = null;
4168
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;
4169
4350
  var regionStyleEl = null;
4170
- var regionTimers = [];
4171
4351
  var regionFolderIdx = { left: -1, center: -1, right: -1 };
4172
4352
  var REGION_SELECTORS = {
4173
4353
  left: 'div[class*="workspace-sidebar-panel-width"]',
4174
4354
  center: '[data-testid="conversation-column"]',
4175
4355
  right: '[data-testid="conversation-column"] ~ [data-testid="browser"]'
4176
4356
  };
4177
- var folderIdx = -1;
4357
+ var rotateIdx = -1;
4358
+ var wpTickFn = null;
4359
+ var wpItem = null;
4178
4360
  var urlTick = 0;
4179
4361
  var applySeq = 0;
4180
4362
  var SURFACE_TOKENS = [
@@ -4189,6 +4371,7 @@
4189
4371
  "--color-input-focused",
4190
4372
  "--color-highspeed-composer-surface"
4191
4373
  ];
4374
+ var sameName = (a, b) => String(a).normalize("NFC").toLowerCase() === String(b).normalize("NFC").toLowerCase();
4192
4375
  var isDarkMode = () => document.documentElement.classList.contains("theme-zai-dark") || document.documentElement.classList.contains("dark");
4193
4376
  var probeEl = null;
4194
4377
  function resolvedColor(token) {
@@ -4200,12 +4383,38 @@
4200
4383
  }
4201
4384
  probeEl.style.color = "";
4202
4385
  probeEl.style.color = `var(${token})`;
4386
+ if (!getComputedStyle(probeEl).getPropertyValue(token).trim()) return "";
4203
4387
  const v = getComputedStyle(probeEl).color;
4204
- return /^rgba?\(/.test(v) ? v : "";
4388
+ return /^[a-z-]+\(/.test(v) ? v : "";
4205
4389
  } catch {
4206
4390
  return "";
4207
4391
  }
4208
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
+ }
4209
4418
  function ensureEl(id) {
4210
4419
  let el = document.getElementById(id);
4211
4420
  if (!el || !el.isConnected) {
@@ -4255,19 +4464,237 @@
4255
4464
  for (const k of injectedKeys) root.style.removeProperty(k);
4256
4465
  injectedKeys = /* @__PURE__ */ new Set();
4257
4466
  }
4258
- async function applyBackground(bg) {
4259
- const seq = ++applySeq;
4260
- bgStyleEl = ensureEl("__zcodepro_bg__");
4261
- 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() {
4487
+ if (bgTimer) {
4488
+ clearInterval(bgTimer);
4489
+ bgTimer = null;
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;
4262
4602
  if (bgTimer) {
4263
4603
  clearInterval(bgTimer);
4264
4604
  bgTimer = null;
4265
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;
4266
4685
  root.classList.remove("zcodepro-bg-on");
4267
4686
  clearBgOverrides();
4268
4687
  const bgActive = !!(bg && bg.mode && bg.mode !== "none");
4269
4688
  const anyRegion = !!(bg && bg.regions && (bg.regions.left || bg.regions.center || bg.regions.right));
4270
- 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
+ }
4271
4698
  if (!bgActive && !anyRegion) {
4272
4699
  await applyRegionBackgrounds(bg);
4273
4700
  return;
@@ -4278,144 +4705,343 @@
4278
4705
  const blurPx = typeof bg.blurPx === "number" && Number.isFinite(bg.blurPx) ? Math.min(24, Math.max(0, Math.round(bg.blurPx))) : 0;
4279
4706
  const panelOpacity = num01(bg.panelOpacity, 0.3);
4280
4707
  const resolvedBg = resolvedColor("--color-background");
4281
- const mHex = resolvedBg.match(/^rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)/);
4282
- 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");
4283
4709
  const panelMix = Math.round(panelOpacity * 100);
4284
- if (panelMix < 100) {
4285
- for (const t2 of SURFACE_TOKENS) {
4286
- const v = resolvedColor(t2);
4287
- if (v) {
4288
- root.style.setProperty(t2, `color-mix(in srgb, ${v} ${panelMix}%, transparent)`);
4289
- injectedKeys.add(t2);
4290
- }
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);
4291
4718
  }
4292
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;}`;
4293
4721
  await applyRegionBackgrounds(bg, { rgb, alpha, fit: bg.fit, seq });
4294
4722
  if (seq !== applySeq) return;
4295
4723
  if (!bgActive) return;
4296
- const FIT_CSS = {
4297
- cover: "background-size:100% 100%,cover !important;background-repeat:no-repeat !important;",
4298
- contain: "background-size:100% 100%,contain !important;background-repeat:no-repeat !important;",
4299
- fill: "background-size:100% 100%,100% 100% !important;background-repeat:no-repeat !important;",
4300
- tile: "background-size:100% 100%,auto !important;background-repeat:no-repeat,repeat !important;"
4301
- };
4302
- const fitCss = FIT_CSS[bg.fit] || FIT_CSS.cover;
4303
- const blurCss = blurPx > 0 ? `filter:blur(${blurPx}px);` : "";
4304
- const spread = blurPx > 0 ? Math.max(20, blurPx * 2) : 0;
4305
- const setImage = (image) => {
4306
- 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;}`;
4307
4727
  root.classList.add("zcodepro-bg-on");
4308
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();
4309
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
+ };
4310
4860
  if (bg.mode === "library") {
4311
- if (!bg.file) {
4312
- bgStyleEl.textContent = "";
4861
+ const res = await rpc("/bg");
4862
+ if (seq !== applySeq) return;
4863
+ if (!res.ok) {
4864
+ lastThemeSig = "";
4313
4865
  return;
4314
4866
  }
4315
- setImage(`url("${helperUrl}/bg/file/${encodeURIComponent(bg.file)}")`);
4867
+ commit();
4868
+ const files = Array.isArray(res.files) ? res.files.filter((f) => f && f.name) : [];
4869
+ if (!files.length) {
4870
+ clearWallpaper();
4871
+ return;
4872
+ }
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);
4316
4886
  return;
4317
4887
  }
4318
4888
  if (bg.mode === "folder") {
4319
4889
  const res = await rpc("/bg/folder/list");
4320
4890
  if (seq !== applySeq) return;
4321
- 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) : [];
4322
4897
  if (!files.length) {
4323
- bgStyleEl.textContent = "";
4324
- root.classList.remove("zcodepro-bg-on");
4898
+ clearWallpaper();
4325
4899
  return;
4326
4900
  }
4327
- const pick = () => {
4328
- let idx = 0;
4329
- if (bg.folderRandom) idx = files.length > 1 ? Math.floor(Math.random() * files.length) : 0;
4330
- else {
4331
- folderIdx = (folderIdx + 1) % files.length;
4332
- idx = folderIdx;
4333
- }
4334
- setImage(`url("${helperUrl}/bg/folder/file/${encodeURIComponent(files[idx].name)}")`);
4335
- };
4336
- pick();
4337
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4338
- if (ms >= 3e4) bgTimer = setInterval(pick, ms);
4901
+ const tick6 = () => showFile(files[nextIdx(files.length)], "folder");
4902
+ wpTickFn = tick6;
4903
+ tick6();
4904
+ armRotateTimer(bg);
4339
4905
  return;
4340
4906
  }
4341
4907
  if (bg.mode === "url") {
4908
+ commit();
4342
4909
  const u0 = /^https?:\/\/\S+$/i.test(bg.url || "") && !/[<>"'\\]/.test(bg.url) ? bg.url : "";
4343
4910
  if (!u0) {
4344
- bgStyleEl.textContent = "";
4911
+ clearWallpaper();
4345
4912
  return;
4346
4913
  }
4347
4914
  const bust = () => {
4348
4915
  urlTick += 1;
4349
4916
  const sep = u0.includes("?") ? "&" : "?";
4350
- setImage(`url("${u0}${sep}_zcp=${urlTick}")`);
4917
+ setImage(`${u0}${sep}_zcp=${urlTick}`);
4351
4918
  };
4919
+ wpTickFn = bust;
4352
4920
  bust();
4353
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4354
- 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();
4355
4936
  }
4356
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" };
4357
4941
  async function applyRegionBackgrounds(bg, pre) {
4358
4942
  regionStyleEl = ensureEl("__zcodepro_bg_regions__");
4359
- for (const t2 of regionTimers) clearInterval(t2);
4360
- regionTimers = [];
4361
- const rules = /* @__PURE__ */ new Map();
4362
4943
  const flush = () => {
4363
- regionStyleEl.textContent = [...rules.values()].join("");
4944
+ regionStyleEl.textContent = [...regionRules.values()].join("");
4364
4945
  };
4365
- const alpha = pre ? pre.alpha : 0.82;
4366
- 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";
4367
4948
  const FIT_CSS = {
4368
4949
  cover: "100% 100%,cover",
4369
4950
  contain: "100% 100%,contain",
4370
4951
  fill: "100% 100%,100% 100%",
4371
4952
  tile: "100% 100%,auto"
4372
4953
  };
4373
- const sizeVal = FIT_CSS[bg && bg.fit] || FIT_CSS.cover;
4374
- 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";
4375
4956
  const helperUrl = liveBoot().helperUrl || HELPER_URL;
4376
4957
  const safeUrl = (u) => /^https?:\/\/\S+$/i.test(u || "") && !/[<>"'\\]/.test(u) ? u : "";
4377
4958
  const addRule = (region, image) => {
4378
4959
  if (!image) return;
4379
- 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;}`);
4380
4961
  };
4381
4962
  const seq = applySeq;
4963
+ const ms = Math.max(0, Number(bg && bg.intervalMin) || 0) * 6e4;
4382
4964
  for (const region of ["left", "center", "right"]) {
4383
4965
  const r = bg && bg.regions && bg.regions[region];
4384
- 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
+ };
4385
5000
  if (r.mode === "library") {
4386
- 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();
4387
5003
  } else if (r.mode === "url") {
4388
5004
  const u = safeUrl(r.url);
4389
- if (u) addRule(region, `url("${u}")`);
5005
+ if (u) setState(`url("${u}")`, null);
5006
+ else drop();
4390
5007
  } else if (r.mode === "folder" && r.folder) {
4391
5008
  const res = await rpc("/bg/folder/list?dir=" + encodeURIComponent(r.folder));
4392
5009
  if (seq !== applySeq) return;
4393
- 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)) : [];
4394
5011
  if (!files.length) continue;
4395
5012
  const pick = () => {
4396
5013
  let idx = 0;
4397
- 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;
4398
5015
  else {
4399
5016
  regionFolderIdx[region] = (regionFolderIdx[region] + 1) % files.length;
4400
5017
  idx = regionFolderIdx[region];
4401
5018
  }
4402
- 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);
4403
5022
  flush();
4404
5023
  };
5024
+ setState(null, pick);
4405
5025
  pick();
4406
- const ms = Math.max(0, Number(bg.intervalMin) || 0) * 6e4;
4407
- 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();
4408
5032
  }
4409
5033
  }
4410
5034
  flush();
4411
5035
  }
4412
5036
  function applyAll(theme) {
4413
5037
  if (theme && typeof theme === "object") currentTheme = theme;
5038
+ lastThemeSig = JSON.stringify(currentTheme);
4414
5039
  applySkin(currentTheme.skin || "default", currentTheme.custom);
4415
5040
  void applyBackground(currentTheme.bg);
4416
5041
  }
4417
5042
  function startTheme() {
4418
5043
  if (!document.head && !document.documentElement) return;
5044
+ applyWebviewTransparency();
4419
5045
  applyAll({ skin: "default", custom: null, bg: { mode: "none", maskOpacity: 0.82, blurPx: 0, panelOpacity: 0.3 } });
4420
5046
  void getConfig().then((cfg) => applyAll(cfg.theme)).catch(() => {
4421
5047
  });
@@ -4423,6 +5049,38 @@
4423
5049
  void getConfig(true).then((cfg) => applyAll(cfg.theme)).catch(() => {
4424
5050
  });
4425
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
+ }
4426
5084
  if (!classObserver) {
4427
5085
  lastModeSig = isDarkMode() ? "d" : "l";
4428
5086
  classObserver = new MutationObserver(() => {
@@ -4442,6 +5100,7 @@
4442
5100
  } catch {
4443
5101
  }
4444
5102
  }
5103
+ var sameName2 = (a, b) => String(a).normalize("NFC").toLowerCase() === String(b).normalize("NFC").toLowerCase();
4445
5104
  var PLUGINS_REPO_URL = "https://github.com/duanluan/zcode-plugins";
4446
5105
  function makeUpgradeControls({ endpoint, metaRefresh, idleText }) {
4447
5106
  const L = t();
@@ -4581,7 +5240,7 @@
4581
5240
  // sm:max-w-3xl 不存在会失去约束拉满全屏;max-w-3xl=48rem 存在——英文界面
4582
5241
  // 标签栏较长,42rem 会挤出一块空白并触发横向滚动
4583
5242
  width: "max-w-3xl",
4584
- bodyClass: "mt-1",
5243
+ bodyClass: "mt-0",
4585
5244
  overlay: "none",
4586
5245
  draggable: true,
4587
5246
  posKey: "settings",
@@ -4591,7 +5250,9 @@
4591
5250
  if (rtkUpgradePollStop) rtkUpgradePollStop();
4592
5251
  },
4593
5252
  onMount: async ({ body, close, content }) => {
5253
+ if (content) content.setAttribute("data-zcodepro-settings", "1");
4594
5254
  const titleEl = content && content.firstElementChild;
5255
+ let titleLeft = null;
4595
5256
  if (titleEl && titleEl.tagName === "H2") {
4596
5257
  titleEl.classList.add("flex", "w-full", "items-center", "justify-between");
4597
5258
  const ns2 = "http://www.w3.org/2000/svg";
@@ -4612,7 +5273,7 @@
4612
5273
  }
4613
5274
  return svg;
4614
5275
  };
4615
- 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);
4616
5277
  if (typeof window.zcode?.openExternal === "function") {
4617
5278
  const REPO_URL = "https://github.com/duanluan/zcode-pro";
4618
5279
  titleLeft.replaceChildren(
@@ -4638,7 +5299,7 @@
4638
5299
  }, "\u2715");
4639
5300
  titleEl.replaceChildren(titleLeft, closeX);
4640
5301
  }
4641
- 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([
4642
5303
  rpc("/health"),
4643
5304
  getConfig(true),
4644
5305
  rpc("/agents"),
@@ -4646,7 +5307,8 @@
4646
5307
  rpc("/title-gen"),
4647
5308
  rpc("/title-gen/providers"),
4648
5309
  rpc("/rtk"),
4649
- rpc("/headroom")
5310
+ rpc("/headroom"),
5311
+ rpc("/zcode-config")
4650
5312
  ]);
4651
5313
  const titleGenProviders = titleGenProvidersRes.ok && Array.isArray(titleGenProvidersRes.providers) ? titleGenProvidersRes.providers : [];
4652
5314
  const setFeature = async (key, value) => {
@@ -4654,7 +5316,7 @@
4654
5316
  clearConfigCache();
4655
5317
  window.dispatchEvent(new CustomEvent("zcodepro:config-changed"));
4656
5318
  if (!res.ok) {
4657
- body.querySelector("[data-zcodepro-status]").replaceChildren(
5319
+ statusLine.replaceChildren(
4658
5320
  h("span", { class: "text-ui-sm text-destructive" }, L.failed + ": " + errText(res))
4659
5321
  );
4660
5322
  return false;
@@ -4664,16 +5326,17 @@
4664
5326
  const statusLine = h(
4665
5327
  "div",
4666
5328
  {
4667
- 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",
4668
5330
  "data-zcodepro-status": "1"
4669
5331
  },
4670
5332
  h("span", { class: "inline-block size-2 rounded-full bg-emerald-500" }),
4671
- 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}`)
4672
5334
  );
5335
+ if (titleLeft) titleLeft.append(statusLine);
4673
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" });
4674
5337
  const pluginsStatusLine = h("span", { class: "max-w-40 truncate text-ui-xs/relaxed text-foreground-subtle" }, "\u2026");
4675
5338
  const setPluginsStatus = (text) => {
4676
- setPluginsStatus(text);
5339
+ pluginsStatusLine.textContent = text;
4677
5340
  pluginsStatusLine.setAttribute("title", text);
4678
5341
  };
4679
5342
  const pluginsBtn = btnSmall(L.pluginsCheckNow, () => {
@@ -4879,14 +5542,15 @@
4879
5542
  L.wechatGroupDesc.replaceAll("{id}", WECHAT_ID),
4880
5543
  () => hCopyIcon("size-4 shrink-0 text-foreground-subtle"),
4881
5544
  async () => {
4882
- if (await copyToClipboard(WECHAT_ID)) showToast(L.wechatIdCopied);
5545
+ if (await copyToClipboard(WECHAT_ID)) showToast(L.wechatIdCopied, "success");
4883
5546
  }
4884
5547
  )
4885
5548
  );
4886
5549
  let activeTab = "features";
5550
+ const subTabBars = {};
4887
5551
  const paneFeatures = h(
4888
5552
  "div",
4889
- { role: "tabpanel", class: "mt-4" },
5553
+ { role: "tabpanel", class: "mt-2" },
4890
5554
  h("div", {}, rows),
4891
5555
  communityCards
4892
5556
  );
@@ -4948,14 +5612,14 @@
4948
5612
  }
4949
5613
  const k = e.key.toLowerCase();
4950
5614
  if (!/^[a-z0-9]$/.test(k)) {
4951
- showToast(L.hkInvalid, "error");
5615
+ showToast(L.hkInvalid, "warning");
4952
5616
  return;
4953
5617
  }
4954
5618
  const keys = hkKeys();
4955
5619
  const names = hkNames();
4956
5620
  const conflict = HK_ACTIONS.find(([a2]) => a2 !== hkRecording && keys[a2] === k);
4957
5621
  if (conflict) {
4958
- 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");
4959
5623
  return;
4960
5624
  }
4961
5625
  const a = hkRecording;
@@ -4998,7 +5662,7 @@
4998
5662
  };
4999
5663
  const paneShortcuts = h(
5000
5664
  "div",
5001
- { role: "tabpanel", class: "mt-4", style: "display:none" },
5665
+ { role: "tabpanel", style: "display:none" },
5002
5666
  h("div", { class: "mb-2 text-ui-sm font-medium" }, L.hkTitle),
5003
5667
  h(
5004
5668
  "div",
@@ -5010,16 +5674,16 @@
5010
5674
  ),
5011
5675
  hkCard
5012
5676
  );
5013
- const paneStyles = h("div", { role: "tabpanel", class: "mt-2", style: "display:none" });
5014
- const panePerf = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5015
- const paneAgents = h("div", { role: "tabpanel", class: "mt-2", style: "display:none" });
5016
- const paneProxy = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5017
- const paneSync = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5018
- const paneVision = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5019
- const paneRtk = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5020
- const paneHeadroom = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5021
- const paneTitleGen = h("div", { role: "tabpanel", class: "mt-4", style: "display:none" });
5022
- 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" });
5023
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 };
5024
5688
  const tabDefs = [
5025
5689
  ["features", L.tabFeatures],
@@ -5049,6 +5713,7 @@
5049
5713
  activeTab = name;
5050
5714
  if (name !== "shortcuts" && hkRecording) stopHkRecording();
5051
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";
5052
5717
  renderTabs();
5053
5718
  };
5054
5719
  renderTabs();
@@ -5225,10 +5890,10 @@
5225
5890
  for (const c of fontCells) c.setOptions(list);
5226
5891
  })();
5227
5892
  renderToolbarSwitch();
5228
- const paneStylesSub1 = h("div", { class: "mt-4" });
5229
- const paneStylesSub2 = h("div", { class: "mt-4", style: "display:none" });
5230
- const paneStylesSub3 = h("div", { class: "mt-4", style: "display:none" });
5231
- 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" });
5232
5897
  const ITEM_NAMES = {
5233
5898
  ctx: "sbItemCtx",
5234
5899
  questions: "sbItemQuestions",
@@ -5439,12 +6104,23 @@
5439
6104
  renderThemeBg();
5440
6105
  const res = await rpc("/bg");
5441
6106
  bgLoading = false;
5442
- if (res.ok && Array.isArray(res.files)) bgFiles = res.files;
5443
- if (themeCfg.bg.mode === "library" && themeCfg.bg.file && !bgFiles.some((f) => f.name === themeCfg.bg.file)) {
5444
- themeCfg = { ...themeCfg, bg: { ...themeCfg.bg, file: "" } };
5445
- await saveTheme({ bg: { file: "" } });
5446
- showToast(L.themeBgDeletedActive, "success");
5447
- 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
+ }
5448
6124
  }
5449
6125
  renderThemeBg();
5450
6126
  };
@@ -5458,7 +6134,7 @@
5458
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 };
5459
6135
  renderThemeBg();
5460
6136
  };
5461
- 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" });
5462
6138
  bgInput.addEventListener("change", () => {
5463
6139
  const files = [...bgInput.files || []];
5464
6140
  bgInput.value = "";
@@ -5466,20 +6142,29 @@
5466
6142
  void (async () => {
5467
6143
  let first = themeCfg.bg.file;
5468
6144
  for (const f of files) {
5469
- const dataUrl = await new Promise((resolve) => {
5470
- const r = new FileReader();
5471
- r.onload = () => resolve(String(r.result || ""));
5472
- r.onerror = () => resolve("");
5473
- r.readAsDataURL(f);
5474
- });
5475
- if (!dataUrl) continue;
5476
- const res = await rpc("/bg", { method: "POST", body: { name: f.name, data: dataUrl } });
5477
- if (!res.ok) {
5478
- 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");
5479
6164
  continue;
5480
6165
  }
5481
6166
  if (Array.isArray(res.files)) bgFiles = res.files;
5482
- if (!first) first = f.name;
6167
+ if (!first) first = res.name || f.name;
5483
6168
  }
5484
6169
  if (first && first !== themeCfg.bg.file) await saveTheme({ bg: { file: first } });
5485
6170
  else renderThemeBg();
@@ -5606,20 +6291,28 @@
5606
6291
  if (mode === "library") {
5607
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" });
5608
6293
  sel.append(h("option", { value: "" }, "\u2014"));
5609
- 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
+ }
5610
6298
  sel.value = cur && cur.file || "";
5611
6299
  sel.addEventListener("change", () => setRegion(region, { ...cur, file: sel.value }));
5612
6300
  valueCtrl = sel;
5613
6301
  } else if (mode === "folder") {
5614
6302
  const inp = h("input", { type: "text", value: cur && cur.folder || "", class: themeInputCls.replace("h-8", "h-7"), placeholder: "/path/to/wallpapers" });
5615
6303
  inp.addEventListener("change", () => {
5616
- if (inp.value.trim()) setRegion(region, { ...cur, folder: inp.value.trim() });
6304
+ setRegion(region, { ...cur, folder: inp.value.trim() });
5617
6305
  });
5618
6306
  valueCtrl = inp;
5619
6307
  } else if (mode === "url") {
5620
6308
  const inp = h("input", { type: "url", value: cur && cur.url || "", class: themeInputCls.replace("h-8", "h-7"), placeholder: "https://..." });
5621
6309
  inp.addEventListener("change", () => {
5622
- 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
+ }
5623
6316
  });
5624
6317
  valueCtrl = inp;
5625
6318
  }
@@ -5710,7 +6403,11 @@
5710
6403
  type: "button",
5711
6404
  class: "zcodepro-tab",
5712
6405
  "data-state": themeCfg.bg.mode === id ? "active" : "inactive",
5713
- 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
+ }
5714
6411
  }, label);
5715
6412
  const folderInput = h("input", { type: "text", value: themeCfg.bg.folder, class: themeInputCls, placeholder: "/path/to/wallpapers" });
5716
6413
  const applyFolder = async (dir) => {
@@ -5754,13 +6451,27 @@
5754
6451
  void saveTheme({ bg: { mode: "none", url: "" } });
5755
6452
  return;
5756
6453
  }
5757
- if (!/^https?:\/\/\S+$/.test(v)) {
5758
- showToast(L.themeBgUrlInvalid, "error");
6454
+ if (!/^https?:\/\/\S+$/.test(v) || /[<>"'\\]/.test(v)) {
6455
+ showToast(L.themeBgUrlInvalid, "warning");
5759
6456
  renderThemeBg();
5760
6457
  return;
5761
6458
  }
5762
6459
  void saveTheme({ bg: { mode: "url", url: v } });
5763
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
+ });
5764
6475
  const libCard = (f) => {
5765
6476
  const del = h("button", {
5766
6477
  type: "button",
@@ -5779,13 +6490,14 @@
5779
6490
  })();
5780
6491
  }
5781
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" });
5782
6494
  return h("button", {
5783
6495
  type: "button",
5784
6496
  class: "zcodepro-bg-card",
5785
- "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",
5786
6498
  title: f.name,
5787
6499
  onClick: () => void saveTheme({ bg: { mode: "library", file: themeCfg.bg.file === f.name ? "" : f.name } })
5788
- }, h("img", { src: bgUrl(f.name), alt: "", loading: "lazy" }), del);
6500
+ }, thumb, del);
5789
6501
  };
5790
6502
  const section = (titleText, body2) => h(
5791
6503
  "div",
@@ -5807,7 +6519,16 @@
5807
6519
  "div",
5808
6520
  { class: "grid grid-cols-4 gap-2", style: "max-height:13.5rem;overflow-y:auto;" },
5809
6521
  ...bgFiles.map(libCard)
5810
- ) : 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
+ )
5811
6532
  ))
5812
6533
  ] : themeCfg.bg.mode === "folder" ? [
5813
6534
  section(L.themeBgModeFolder, h(
@@ -5844,6 +6565,13 @@
5844
6565
  ),
5845
6566
  h("p", { class: "text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgUrlHint)
5846
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
+ ))
5847
6575
  ] : [h("p", { class: "mt-3 text-ui-xs/relaxed text-foreground-subtle" }, L.themeBgNoneHint)];
5848
6576
  const fitBtn = (id, label) => h("button", {
5849
6577
  type: "button",
@@ -5851,6 +6579,66 @@
5851
6579
  "data-state": (themeCfg.bg.fit || "cover") === id ? "active" : "inactive",
5852
6580
  onClick: () => void saveTheme({ bg: { fit: id } })
5853
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
+ );
5854
6642
  paneStylesSub4.replaceChildren(
5855
6643
  h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.themeBgDesc),
5856
6644
  h(
@@ -5859,7 +6647,8 @@
5859
6647
  modeBtn("none", L.themeBgModeNone),
5860
6648
  modeBtn("library", L.themeBgModeLibrary),
5861
6649
  modeBtn("folder", L.themeBgModeFolder),
5862
- modeBtn("url", L.themeBgModeUrl)
6650
+ modeBtn("url", L.themeBgModeUrl),
6651
+ modeBtn("web", L.themeBgModeWeb)
5863
6652
  ),
5864
6653
  ...modeArea,
5865
6654
  section(L.themeBgRegions, h(
@@ -5878,6 +6667,21 @@
5878
6667
  fitBtn("fill", L.themeBgFitFill),
5879
6668
  fitBtn("tile", L.themeBgFitTile)
5880
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
+ ),
5881
6685
  h(
5882
6686
  "div",
5883
6687
  { class: "mt-3 flex flex-col gap-2" },
@@ -5885,6 +6689,13 @@
5885
6689
  blurRow(),
5886
6690
  panelRow()
5887
6691
  ),
6692
+ section(L.themeBgPlayback, h(
6693
+ "div",
6694
+ { class: "flex flex-col gap-2" },
6695
+ volumeRow(),
6696
+ rateRow(),
6697
+ fpsRow()
6698
+ )),
5888
6699
  bgInput
5889
6700
  );
5890
6701
  };
@@ -5915,7 +6726,8 @@
5915
6726
  }
5916
6727
  }, label)));
5917
6728
  renderStylesSubTabs();
5918
- paneStyles.append(stylesSubTablist, paneStylesSub1, paneStylesSub2, paneStylesSub3, paneStylesSub4);
6729
+ subTabBars.styles = stylesSubTablist;
6730
+ paneStyles.append(paneStylesSub1, paneStylesSub2, paneStylesSub3, paneStylesSub4);
5919
6731
  paneStylesSub1.append(
5920
6732
  toolbarSwitchWrap,
5921
6733
  h(
@@ -5963,24 +6775,149 @@
5963
6775
  const res = await rpc("/agents", { method: "POST", body: { content: agentsArea.value } });
5964
6776
  if (res.ok) {
5965
6777
  agentsOriginal = typeof res.content === "string" ? res.content : agentsArea.value;
5966
- showToast(L.agentsSaved);
6778
+ showToast(L.agentsSaved, "success");
5967
6779
  } else {
5968
6780
  showToast(L.failed + ": " + errText(res), "error");
5969
6781
  agentsSaveBtn.disabled = false;
5970
6782
  }
5971
6783
  };
5972
- 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" });
5973
6909
  agentsPromptPane.append(
5974
6910
  h("p", { class: "text-ui-sm/relaxed text-foreground-subtle" }, L.agentsDesc),
5975
6911
  ...agentsFailed ? [h("p", { class: "mt-2 text-ui-sm text-destructive" }, L.agentsLoadFailed + ": " + errText(agentsRes))] : [],
5976
6912
  h("div", { class: "mt-3" }, agentsArea),
5977
6913
  h("div", { class: "mt-3 flex justify-end" }, agentsSaveBtn)
5978
6914
  );
5979
- let agentsSubTab = "prompt";
5980
- const agentsSubPanes = { prompt: agentsPromptPane, titleGen: paneTitleGen };
6915
+ let agentsSubTab = "zcode";
6916
+ const agentsSubPanes = { zcode: paneZcode, prompt: agentsPromptPane, titleGen: paneTitleGen };
5981
6917
  const agentsSubList = h("div", { role: "tablist", "aria-orientation": "horizontal", class: "zcodepro-tablist" });
5982
6918
  const renderAgentsSubTabs = () => {
5983
6919
  agentsSubList.replaceChildren(...[
6920
+ ["zcode", L.tabZcode],
5984
6921
  ["prompt", L.tabAgents],
5985
6922
  ["titleGen", L.tabTitleGen]
5986
6923
  ].map(([id, label]) => h("button", {
@@ -5998,7 +6935,8 @@
5998
6935
  };
5999
6936
  for (const [pid, pane] of Object.entries(agentsSubPanes)) pane.style.display = pid === agentsSubTab ? "" : "none";
6000
6937
  renderAgentsSubTabs();
6001
- paneAgents.append(agentsSubList, agentsPromptPane, paneTitleGen);
6938
+ subTabBars.agents = agentsSubList;
6939
+ paneAgents.append(paneZcode, agentsPromptPane, paneTitleGen);
6002
6940
  const savedProxy = typeof config.proxy === "string" ? config.proxy : "";
6003
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";
6004
6942
  const proxyInput = h("input", { type: "text", value: savedProxy, placeholder: L.proxyPlaceholder, spellcheck: "false", class: proxyInputCls + " min-w-0 flex-1" });
@@ -6016,7 +6954,7 @@
6016
6954
  if (res.ok) {
6017
6955
  proxyOriginal = res.config && typeof res.config.proxy === "string" ? res.config.proxy : proxyInput.value.trim();
6018
6956
  proxyInput.value = proxyOriginal;
6019
- showToast(L.proxySaved);
6957
+ showToast(L.proxySaved, "success");
6020
6958
  } else {
6021
6959
  proxySaveBtn.disabled = false;
6022
6960
  showToast(L.failed + ": " + errText(res), "error");
@@ -6216,7 +7154,7 @@
6216
7154
  syncLoginInput.value = res.sync.login;
6217
7155
  syncPasswordInput.value = res.sync.password;
6218
7156
  syncHistoryInput.value = syncFormOriginal.historyLimit;
6219
- showToast(L.syncSaved);
7157
+ showToast(L.syncSaved, "success");
6220
7158
  } else {
6221
7159
  showToast(L.failed + ": " + errText(res), "error");
6222
7160
  syncCheckDirty();
@@ -6607,8 +7545,8 @@
6607
7545
  // 视觉上游冷启动可能近 2 分钟,与插件 DEFAULT_CONFIG 一致
6608
7546
  compressThresholdKB: 1024,
6609
7547
  skipAfterFailures: 2,
6610
- skipMinutes: 30,
6611
- forceIntercept: true
7548
+ skipMinutes: 30
7549
+ // forceIntercept 不写:缺省 = 自动(跟随宿主「模型设置」图片开关,zcode-vision ≥1.7.9)
6612
7550
  };
6613
7551
  let visionCfg = visionRes.ok && visionRes.config && typeof visionRes.config === "object" ? structuredClone(visionRes.config) : null;
6614
7552
  let visionAutoInitTried = false;
@@ -6895,32 +7833,51 @@
6895
7833
  )
6896
7834
  )
6897
7835
  ),
6898
- // 链模式 + 强制拦截开关合到一行(启用开关已上移信息卡)
7836
+ // 链模式 / 主模型策略 / 识图卡片 三项均分一行、各格内容左对齐(启用开关已上移信息卡)
6899
7837
  h(
6900
7838
  "div",
6901
- { class: "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-border p-1" },
6902
- h("span", { class: "ml-1.5 shrink-0 text-ui-sm font-medium text-foreground" }, L.visionMode),
6903
- modeBtn("fallback", L.visionModeFallback, L.visionModeFallbackDesc),
6904
- 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" },
6905
7840
  h(
6906
7841
  "div",
6907
- { 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" },
6908
7870
  settingRow(L.visionCardUi, "", visionCfg.cardUi !== false, async () => {
6909
7871
  visionCfg.cardUi = !(visionCfg.cardUi !== false);
6910
7872
  await persistVision();
6911
7873
  renderVision();
6912
- }),
6913
- settingRow(L.visionForceIntercept, "", visionCfg.forceIntercept !== false, async () => {
6914
- visionCfg.forceIntercept = !(visionCfg.forceIntercept !== false);
6915
- await persistVision();
6916
- renderVision();
6917
7874
  })
6918
7875
  )
6919
7876
  ),
6920
- // 压缩阈值 / 连续失败次数 / 跳过分钟数 三个数字一行
7877
+ // 压缩阈值 / 连续失败次数 / 跳过分钟数 三个数字一行(p-2 与上方信息卡对齐)
6921
7878
  h(
6922
7879
  "div",
6923
- { 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" },
6924
7881
  (() => {
6925
7882
  const n = h("input", {
6926
7883
  type: "number",
@@ -7073,7 +8030,7 @@
7073
8030
  const v = input.value.trim();
7074
8031
  if (!v) return;
7075
8032
  if (!/^(git:)?[A-Za-z0-9._-]+$/.test(v) || rtkCfg.whitelist.includes(v)) {
7076
- showToast(L.rtkWhitelistInvalid, "error");
8033
+ showToast(L.rtkWhitelistInvalid, "warning");
7077
8034
  return;
7078
8035
  }
7079
8036
  if (await persistRtk({ whitelist: [...rtkCfg.whitelist, v] })) {
@@ -7201,7 +8158,7 @@
7201
8158
  if (await persistRtk({ whitelist: [] })) {
7202
8159
  rtkCfg.whitelist = [];
7203
8160
  renderRtk();
7204
- showToast(L.rtkWhitelistCleared);
8161
+ showToast(L.rtkWhitelistCleared, "success");
7205
8162
  }
7206
8163
  })();
7207
8164
  }, "shrink-0")
@@ -7317,7 +8274,7 @@
7317
8274
  clearInterval(timerIv);
7318
8275
  hrBusy = false;
7319
8276
  await hrRefresh();
7320
- showToast(doneMsg, isStart ? "success" : void 0);
8277
+ showToast(doneMsg, "success");
7321
8278
  return;
7322
8279
  }
7323
8280
  }
@@ -7336,7 +8293,7 @@
7336
8293
  return false;
7337
8294
  }
7338
8295
  if (res.config) Object.assign(hrCfg, res.config);
7339
- if (warn) showToast(warn);
8296
+ if (warn) showToast(warn, "warning");
7340
8297
  if (!isStart && !isStop) {
7341
8298
  hrBusy = false;
7342
8299
  setTimeout(() => {
@@ -7416,7 +8373,7 @@
7416
8373
  }
7417
8374
  if (res.usage) headroomRes.usage = res.usage;
7418
8375
  renderHrUsageSwitch();
7419
- 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");
7420
8377
  })
7421
8378
  );
7422
8379
  };
@@ -7800,9 +8757,13 @@
7800
8757
  );
7801
8758
  };
7802
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);
7803
8766
  body.append(
7804
- statusLine,
7805
- tablist,
7806
8767
  paneFeatures,
7807
8768
  paneShortcuts,
7808
8769
  paneAgents,
@@ -7887,7 +8848,7 @@
7887
8848
  const scope = workspaces.size === 1 ? "workspace" : "group-members";
7888
8849
  const res = await rpc("/task-order", { method: "POST", body: { scope, ordered } });
7889
8850
  if (res && res.ok) {
7890
- showToast(L.taskOrderSaved);
8851
+ showToast(L.taskOrderSaved, "success");
7891
8852
  setTimeout(() => location.reload(), 600);
7892
8853
  } else {
7893
8854
  showToast(L.failed + ": " + (errText(res) || L.retryHint), "error");
@@ -8581,6 +9542,10 @@
8581
9542
  function startWsRunningSpin() {
8582
9543
  if (installed2 || typeof document === "undefined") return;
8583
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);
8584
9549
  void refreshConfig();
8585
9550
  pollConfig();
8586
9551
  const observer2 = new MutationObserver((muts) => {
@@ -8958,7 +9923,7 @@
8958
9923
  if (live) record(live.getAttribute("data-task-item-key"));
8959
9924
  const target = live ? mru[0] === current ? mru[1] : mru.find((mk) => mk !== current) : mru[0];
8960
9925
  if (!target) {
8961
- showToast(t().switcherEmpty);
9926
+ showToast(t().switcherEmpty, "warning");
8962
9927
  return;
8963
9928
  }
8964
9929
  void switchTo(target).then((ok) => {
@@ -8970,7 +9935,7 @@
8970
9935
  if (e.repeat) return;
8971
9936
  closePopup(false);
8972
9937
  if (!attentionList().length) {
8973
- showToast(t().switcherAttentionEmpty);
9938
+ showToast(t().switcherAttentionEmpty, "warning");
8974
9939
  return;
8975
9940
  }
8976
9941
  await openPopup("attention");
@@ -8979,7 +9944,7 @@
8979
9944
  if (k === hotkeys.switchRecent) {
8980
9945
  if (!e.repeat && !popupEl && !openPopupInflight) {
8981
9946
  if (!mru.length) {
8982
- showToast(t().switcherEmpty);
9947
+ showToast(t().switcherEmpty, "warning");
8983
9948
  return;
8984
9949
  }
8985
9950
  await openPopup("mru");
@@ -8990,7 +9955,7 @@
8990
9955
  await openPopupInflight;
8991
9956
  } else if (!popupEl) {
8992
9957
  if (!mru.length) {
8993
- showToast(t().switcherEmpty);
9958
+ showToast(t().switcherEmpty, "warning");
8994
9959
  return;
8995
9960
  }
8996
9961
  await openPopup("mru");
@@ -9135,7 +10100,7 @@
9135
10100
  const sc = sessionScope();
9136
10101
  const open = findOpenSidePane();
9137
10102
  if (!sc || !open) {
9138
- showToast(L.ntpNeedSession, "error");
10103
+ showToast(L.ntpNeedSession, "warning");
9139
10104
  return;
9140
10105
  }
9141
10106
  try {
@@ -9151,7 +10116,7 @@
9151
10116
  });
9152
10117
  } catch (e) {
9153
10118
  console.warn("[zcodepro] \u6253\u5F00\u63D2\u4EF6\u9762\u677F\u5931\u8D25", e);
9154
- showToast(L.ntpNeedSession, "error");
10119
+ showToast(L.ntpNeedSession, "warning");
9155
10120
  }
9156
10121
  });
9157
10122
  grid.append(card);
@@ -10820,70 +11785,75 @@
10820
11785
  // src/inject/features/composer-provider.js
10821
11786
  var installed6 = false;
10822
11787
  var enabled10 = true;
10823
- function labelToDisplay(label) {
10824
- const i = label.indexOf("/");
10825
- if (i <= 0) return null;
10826
- const provider = label.slice(0, i).trim();
10827
- const rest = label.slice(i + 1);
10828
- const model = rest.trim().split(/\s+/)[0];
10829
- if (!provider || !model) return null;
10830
- 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;
10831
11817
  }
10832
11818
  function apply3() {
10833
- if (!enabled10) {
10834
- for (const btn of document.querySelectorAll('[data-testid="chat-model-select-trigger"]')) {
10835
- if (!btn.dataset.zcodeproProviderShown) continue;
10836
- const label = btn.getAttribute("aria-label") || "";
10837
- const i = label.indexOf("/");
10838
- if (i <= 0) continue;
10839
- const model = label.slice(i + 1).trim().split(/\s+/)[0];
10840
- if (!model) continue;
10841
- for (const sp of btn.querySelectorAll("span[title]")) sp.setAttribute("title", model);
10842
- for (const el of btn.querySelectorAll("span[title] span:not([title])")) {
10843
- 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);
10844
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);
11836
+ }
11837
+ for (const sp of btn.querySelectorAll("span[title]")) sp.setAttribute("title", parts.model);
10845
11838
  delete btn.dataset.zcodeproProviderShown;
10846
11839
  }
10847
- return;
10848
- }
10849
- for (const btn of document.querySelectorAll('[data-testid="chat-model-select-trigger"]')) {
10850
- const label = btn.getAttribute("aria-label") || "";
10851
- const display = labelToDisplay(label);
10852
- if (!display) continue;
10853
- const titleSpans = [...btn.querySelectorAll("span[title]")];
10854
- if (!titleSpans.length) continue;
10855
- const innermost = titleSpans.filter((sp) => !sp.querySelector("span[title]"));
10856
- if (!innermost.length) continue;
10857
- const holders = [];
10858
- for (const sp of innermost) {
10859
- sp.querySelectorAll("span:not([title])").forEach((el) => {
10860
- if (!el.querySelector("span") && el.textContent.trim() && !el.textContent.includes("/")) holders.push(el);
10861
- });
10862
- }
10863
- if (!holders.length) continue;
10864
- for (const sp of titleSpans) {
10865
- if (sp.getAttribute("title") !== display) sp.setAttribute("title", display);
10866
- }
10867
- for (const el of holders) el.textContent = display;
10868
- btn.dataset.zcodeproProviderShown = "1";
10869
11840
  }
10870
11841
  }
10871
11842
  function startComposerProvider() {
10872
11843
  if (installed6 || typeof document === "undefined") return;
10873
11844
  installed6 = true;
10874
- 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"]';
10875
11846
  const relevant2 = (muts) => {
10876
11847
  for (const m of muts) {
10877
11848
  if (m.type === "childList") {
10878
11849
  for (const n of [...m.addedNodes, ...m.removedNodes]) {
10879
- 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;
10880
11851
  }
11852
+ } else if (m.type === "attributes") {
11853
+ if (m.target instanceof Element && m.target.closest?.(TRIGGER_SEL)) return true;
10881
11854
  } else if (m.type === "characterData") {
10882
- let el = m.target.parentElement;
10883
- while (el && el !== document.body) {
10884
- if (el.matches?.("[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content]")) return true;
10885
- el = el.parentElement;
10886
- }
11855
+ const el = m.target.parentElement?.closest?.(COMPOSER_SEL);
11856
+ if (el) return true;
10887
11857
  }
10888
11858
  }
10889
11859
  return false;
@@ -10909,7 +11879,14 @@
10909
11879
  const observer2 = new MutationObserver((muts) => {
10910
11880
  if (enabled10 && relevant2(muts)) schedule();
10911
11881
  });
10912
- 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
+ });
10913
11890
  apply3();
10914
11891
  }
10915
11892
 
@@ -10947,7 +11924,23 @@
10947
11924
  if (window.__zcodeproInjected) {
10948
11925
  const boot = window.__ZCODEPRO__ || {};
10949
11926
  const sameGeneration = window.__zcodeproBootedToken && boot.token && window.__zcodeproBootedToken === boot.token;
10950
- 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
+ }
10951
11944
  return;
10952
11945
  }
10953
11946
  window.__zcodeproInjected = true;