zcode-pro 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -2
- package/README.md +5 -3
- package/dist/inject.js +1372 -313
- package/package.json +2 -2
- package/src/host/helper.mjs +705 -96
- package/src/host/main.mjs +53 -5
- package/src/host/setup.mjs +3 -3
- package/src/host/skill-stats.mjs +158 -0
- package/src/host/taskIndex.mjs +11 -7
- package/src/host/wallpaper.mjs +311 -0
- package/src/inject/core.js +148 -46
- package/src/inject/features/alias-migration.js +3 -3
- package/src/inject/features/alias.js +2 -2
- package/src/inject/features/composer-provider.js +82 -63
- package/src/inject/features/copy-path.js +1 -1
- package/src/inject/features/file-menu.js +3 -1
- package/src/inject/features/image-menu.js +2 -2
- package/src/inject/features/newtab-panels.js +5 -3
- package/src/inject/features/project-menu.js +1 -1
- package/src/inject/features/relocate-dialog.js +2 -1
- package/src/inject/features/session-switch.js +94 -32
- package/src/inject/features/settings-dialog.js +344 -91
- package/src/inject/features/task-order.js +1 -1
- package/src/inject/features/theme.js +586 -98
- package/src/inject/features/title-gen.js +3 -2
- package/src/inject/features/title-lock.js +3 -2
- package/src/inject/features/ws-running.js +61 -8
- package/src/inject/index.js +13 -1
- package/src/inject/ui.js +85 -17
package/src/inject/core.js
CHANGED
|
@@ -122,6 +122,39 @@ const zh = {
|
|
|
122
122
|
tabProxy: '代理',
|
|
123
123
|
tabBehavior: '行为',
|
|
124
124
|
tabAgents: '全局提示词',
|
|
125
|
+
tabZcode: 'ZCode CLI',
|
|
126
|
+
zcodeDesc: 'ZCode 自身的行为配置(写入 ~/.zcode/cli/config.json),保存后对新会话生效。',
|
|
127
|
+
zcodeStatsTitle: '技能清单检查',
|
|
128
|
+
zcodeStatsCounts: '技能 {total} 个(本地 {user} · 插件 {plugin})',
|
|
129
|
+
zcodeStatsChars: '完整清单约 {n} 字符',
|
|
130
|
+
zcodeBudgetDefaultTag: '(默认值)',
|
|
131
|
+
zcodeStatsDegraded: '超出预算:完整清单放不下,降级为仅名称,模型看不到技能描述',
|
|
132
|
+
zcodeStatsOk: '预算充足:清单带完整描述注入新会话',
|
|
133
|
+
zcodeStatsSuggest: '建议预算 {n} 字符(留 20% 余量)',
|
|
134
|
+
zcodeBudgetApply: '用建议值',
|
|
135
|
+
zcodeBudgetApplied: '清单预算已保存',
|
|
136
|
+
zcodeStatsNote: '按当前磁盘状态估算,不含各项目内的技能目录。',
|
|
137
|
+
zcodeSkillEnabled: '技能系统',
|
|
138
|
+
zcodeSkillEnabledDesc: 'skills.enabled:关闭后 ZCode 不再发现与注入任何技能',
|
|
139
|
+
zcodeSkillIncludeInstructions: '技能说明注入',
|
|
140
|
+
zcodeSkillIncludeInstructionsDesc: 'skills.includeInstructions:技能说明是否随清单一起注入',
|
|
141
|
+
zcodeSkillBudget: '技能清单预算(字符)',
|
|
142
|
+
zcodeSkillBudgetDesc: 'skills.metadataBudget:完整清单超过该长度就降级为仅名称,默认 20000',
|
|
143
|
+
zcodeSkillRoots: '额外技能目录',
|
|
144
|
+
zcodeSkillRootsDesc: 'skills.roots:每行一个目录,目录下的技能会被发现(~/.zcode/skills、~/.agents/skills 之外的补充)',
|
|
145
|
+
zcodeSave: '保存',
|
|
146
|
+
zcodeRootsSaved: '技能目录已保存',
|
|
147
|
+
zcodeFeatCompact: '会话压缩',
|
|
148
|
+
zcodeFeatCompactDesc: 'features.compact:上下文过长时压缩早期会话内容',
|
|
149
|
+
zcodeFeatRewind: '会话回溯',
|
|
150
|
+
zcodeFeatRewindDesc: 'features.rewind:回退到较早节点重新继续',
|
|
151
|
+
zcodeFeatSubagent: '子代理',
|
|
152
|
+
zcodeFeatSubagentDesc: 'features.subagent:派出子代理处理子任务',
|
|
153
|
+
zcodeFeatSkill: '技能工具',
|
|
154
|
+
zcodeFeatSkillDesc: 'features.skill:Skill 工具可用(还需开启技能系统)',
|
|
155
|
+
zcodeFeatMcp: 'MCP 工具',
|
|
156
|
+
zcodeFeatMcpDesc: 'features.mcp:使用 MCP 服务器提供的工具',
|
|
157
|
+
zcodeMemoryHint: '记忆不在此处:工作区记忆在官方 设置 → Agent 能力 → 记忆 中开关(含记忆详情查看)。',
|
|
125
158
|
agentsDesc: '写入 ~/.zcode/AGENTS.md,作为默认指令用于所有项目的每次会话;保存后从新会话起生效,项目内的 AGENTS.md 可补充或覆盖。内容超过 100KB 会被应用截断。',
|
|
126
159
|
agentsPlaceholder: '填写希望所有项目默认遵循的指令;清空并保存即移除全局提示词',
|
|
127
160
|
agentsSave: '保存',
|
|
@@ -163,7 +196,7 @@ const zh = {
|
|
|
163
196
|
syncIncludeZcp: 'ZCode Pro 设置',
|
|
164
197
|
syncIncludeZcpDesc: '功能开关、样式调整与代理设置;同步配置与凭据本身不参与同步。项目别名不同步(官方已支持改项目名)。',
|
|
165
198
|
syncIncludeModel: '模型设置',
|
|
166
|
-
syncIncludeModelDesc: '自定义供应商与模型配置(config.json 与 provider_config.json,含 API Key
|
|
199
|
+
syncIncludeModelDesc: '自定义供应商与模型配置(config.json 与 provider_config.json,含 API Key)与 Headroom 供应商映射(headroom.json,key 仅以 keyHash 存储、不含明文)。账号登录的凭据(如 BigModel 订阅)不参与同步,各机器用各自账号登录。',
|
|
167
200
|
syncUpload: '上传到云端',
|
|
168
201
|
syncDownload: '从云端下载',
|
|
169
202
|
syncUploading: '上传中…',
|
|
@@ -281,7 +314,7 @@ const zh = {
|
|
|
281
314
|
featureSandboxReclaimDesc: '沙箱满 64 个时自动释放最早的,新卡片不再打不开;旧卡重新打开所在会话即可恢复。',
|
|
282
315
|
featurePluginCardRetry: '插件卡片自动重试',
|
|
283
316
|
featurePluginCardRetryDesc: '因名额上限加载失败的插件卡片自动点击重新加载,名额空出后自动恢复。',
|
|
284
|
-
visionCardUi: '
|
|
317
|
+
visionCardUi: '思考过程显示 Vision 卡片',
|
|
285
318
|
pinnedToggleAria: '折叠/展开已置顶',
|
|
286
319
|
sidebarProjectSpacingName: '项目间距',
|
|
287
320
|
sidebarProjectSpacingDesc: '侧边栏中相邻项目行之间的视觉间距(含行内留白);设置后各分区(已置顶/项目/任务)之间的间距也统一为该值。',
|
|
@@ -293,14 +326,14 @@ const zh = {
|
|
|
293
326
|
userFontDesc: '会话中提问内容的字体;选“默认”时跟随界面字体。',
|
|
294
327
|
assistantFontName: '回答字体',
|
|
295
328
|
assistantFontDesc: '会话中回答正文的字体(代码块仍用等宽字体);选“默认”时跟随界面字体。',
|
|
296
|
-
switcherHint: '{prev} / {next} 或 ↑ / ↓ 选择,Enter
|
|
329
|
+
switcherHint: '{prev} / {next} 或 ↑ / ↓ 选择,Enter 或点击行切换,Esc 取消',
|
|
297
330
|
switcherCurrent: '当前',
|
|
298
331
|
switcherEmpty: '暂无上次会话(切换过会话后可用)',
|
|
299
332
|
switcherFailed: '未能切换到该会话(可能已删除)',
|
|
300
333
|
switcherMore: '还有 {n} 条 · 按 c 加载',
|
|
301
334
|
switcherRunning: '运行中',
|
|
302
335
|
switcherUnseen: '未查看',
|
|
303
|
-
switcherAttentionHint: '运行中 / 运行完未查看的任务 · {prev} / {next} 或 ↑ / ↓ 选择,Enter
|
|
336
|
+
switcherAttentionHint: '运行中 / 运行完未查看的任务 · {prev} / {next} 或 ↑ / ↓ 选择,Enter 或点击行切换',
|
|
304
337
|
switcherAttentionEmpty: '暂无运行中或未查看的任务',
|
|
305
338
|
featureNewtabPanels: '新标签页插件面板入口',
|
|
306
339
|
featureNewtabPanelsDesc: '新标签页加入第三方插件(headroom、rtk 等)的面板卡片,点击在侧边面板打开。',
|
|
@@ -315,7 +348,7 @@ const zh = {
|
|
|
315
348
|
themeBgRegionLeft: '左侧边栏',
|
|
316
349
|
themeBgRegionCenter: '中间区域',
|
|
317
350
|
themeBgRegionRight: '右侧边栏',
|
|
318
|
-
themeBgPane: '
|
|
351
|
+
themeBgPane: '壁纸',
|
|
319
352
|
themeSkinTitle: '皮肤',
|
|
320
353
|
themeSkinDesc: '知名编辑器主题配色,自动匹配 ZCode 的浅色 / 深色模式;默认保持 ZCode 原样,自定义在下方自行调色。',
|
|
321
354
|
themeSkinCustom: '自定义',
|
|
@@ -328,39 +361,55 @@ const zh = {
|
|
|
328
361
|
themeCustomFg: '正文',
|
|
329
362
|
themeCustomMuted: '次级文字',
|
|
330
363
|
themeCustomAccent: '强调色',
|
|
331
|
-
themeBgDesc: '
|
|
332
|
-
themeBgModeNone: '
|
|
364
|
+
themeBgDesc: '壁纸支持图片、视频、网页三类,铺在界面后方;来源可选本地图库、文件夹(定时轮换)、图片网址(定时刷新)或网页地址,左栏 / 中栏 / 右栏可分区独立设置(仅静态图);侧栏、会话流、输入框透出画面,弹窗菜单保持不透明保可读。本地图库随 WebDAV 同步上传(覆盖式,不留历史版本)。',
|
|
365
|
+
themeBgModeNone: '无壁纸',
|
|
333
366
|
themeBgModeLibrary: '本地图库',
|
|
334
367
|
themeBgModeFolder: '文件夹',
|
|
335
|
-
themeBgModeUrl: '
|
|
368
|
+
themeBgModeUrl: '图片网址',
|
|
369
|
+
themeBgModeWeb: '网页',
|
|
336
370
|
themeBgLibrary: '我的图库',
|
|
337
|
-
themeBgUpload: '
|
|
338
|
-
themeBgEmpty: '
|
|
371
|
+
themeBgUpload: '上传图片/视频',
|
|
372
|
+
themeBgEmpty: '还没有上传文件;图片支持 png / jpg / webp / gif / bmp / avif(10MB 以内),视频支持 mp4 / webm / mov(200MB 以内)',
|
|
339
373
|
themeBgDelete: '删除',
|
|
340
|
-
themeBgNoneHint: '
|
|
374
|
+
themeBgNoneHint: '选择一种壁纸来源;图库和文件夹可定时轮换,图片网址可配合随机图 API 定时刷新。',
|
|
341
375
|
themeBgFolderPick: '浏览',
|
|
342
|
-
themeBgFolderPickTitle: '
|
|
343
|
-
themeBgFolderHint: '
|
|
376
|
+
themeBgFolderPickTitle: '选择壁纸文件夹',
|
|
377
|
+
themeBgFolderHint: '选择一个装壁纸的文件夹,文件原地读取不复制。',
|
|
344
378
|
themeBgFolderRandom: '随机顺序',
|
|
345
379
|
themeBgIntervalHint: '切换间隔(分钟)',
|
|
346
380
|
themeBgIntervalUnit: '分钟,0 = 不切换',
|
|
347
|
-
themeBgFolderCount: '文件夹里有 {n}
|
|
348
|
-
themeBgFolderMissing: '
|
|
381
|
+
themeBgFolderCount: '文件夹里有 {n} 个壁纸文件,定时轮换中。',
|
|
382
|
+
themeBgFolderMissing: '文件夹不存在或里面没有壁纸文件。',
|
|
349
383
|
themeBgUrlHint: '定时刷新适合随机图 API(每次请求返回不同图);刷新时带缓存参数避免命中缓存。',
|
|
350
384
|
themeBgUrlIntervalHint: '刷新间隔(分钟)',
|
|
351
385
|
themeBgUrlInvalid: '网址需以 http(s):// 开头',
|
|
386
|
+
themeBgWebHint: '网页壁纸用沙箱 iframe 铺在界面后方,页面需自行播放动画或视频;仅页面自身透明底时能透出壁纸,部分依赖登录态的页面无法显示。',
|
|
352
387
|
themeBgFit: '缩放方式',
|
|
353
388
|
themeBgFitCover: '填满',
|
|
354
389
|
themeBgFitContain: '适应',
|
|
355
390
|
themeBgFitFill: '拉伸',
|
|
356
391
|
themeBgFitTile: '平铺',
|
|
357
392
|
themeBgMask: '遮罩不透明度',
|
|
358
|
-
themeBgMaskHint: '
|
|
359
|
-
themeBgMaskHint2: '
|
|
360
|
-
themeBgBlur: '
|
|
393
|
+
themeBgMaskHint: '数值越高,画面越向主题背景色淡化,文字对比越清晰',
|
|
394
|
+
themeBgMaskHint2: '画面向主题背景色淡化的程度',
|
|
395
|
+
themeBgBlur: '画面模糊',
|
|
361
396
|
themeBgPanel: '面板不透明度',
|
|
362
|
-
themeBgPanelHint: '
|
|
363
|
-
|
|
397
|
+
themeBgPanelHint: '侧栏、面板与标签栏的不透明程度。越低,透出的画面越多。',
|
|
398
|
+
themeBgPlayback: '播放',
|
|
399
|
+
themeBgVolume: '音量',
|
|
400
|
+
themeBgVolumeHint: '视频壁纸的音轨音量,0 = 静音(默认)',
|
|
401
|
+
themeBgRate: '倍速',
|
|
402
|
+
themeBgFps: '帧率上限',
|
|
403
|
+
themeBgFpsOff: '原始帧率',
|
|
404
|
+
themeBgFpsHint: '对视频壁纸重编码抽帧以省资源,需要 ffmpeg;未安装时保持原始帧率。',
|
|
405
|
+
themeBgTransition: '切换转场',
|
|
406
|
+
themeBgTransitionCut: '硬切',
|
|
407
|
+
themeBgTransitionFade: '淡入淡出',
|
|
408
|
+
themeBgPause: '暂停条件',
|
|
409
|
+
themeBgPauseHidden: '窗口最小化时',
|
|
410
|
+
themeBgPauseBlur: '窗口失焦时',
|
|
411
|
+
themeBgPauseBattery: '电池供电时',
|
|
412
|
+
themeBgDeletedActive: '当前壁纸已删除,已自动停用壁纸',
|
|
364
413
|
tableCopyBtn: '复制表格',
|
|
365
414
|
tableCopied: '表格已复制',
|
|
366
415
|
sbItemCtx: '上下文占用',
|
|
@@ -397,8 +446,6 @@ const zh = {
|
|
|
397
446
|
hkArrow: '弹窗打开时移动高亮(与 alt + {prev} / alt + {next} 同规则)',
|
|
398
447
|
hkEnter: '确认切换到高亮的会话',
|
|
399
448
|
hkEsc: '取消并关闭弹窗',
|
|
400
|
-
hkRelease: '移动过高亮时松开即切换;从未移动则弹窗保持打开,继续选择',
|
|
401
|
-
hkReleaseKey: '松开 alt',
|
|
402
449
|
hkModify: '修改',
|
|
403
450
|
hkRecording: '按下新键…',
|
|
404
451
|
hkInvalid: '快捷键只支持单个字母或数字',
|
|
@@ -444,7 +491,11 @@ const zh = {
|
|
|
444
491
|
tabVision: 'Vision',
|
|
445
492
|
visionDesc: '主模型不支持图片输入时(如 glm-5.3),自动把消息里的图片交给下面的视觉模型识别,把描述带给主模型(zcode-vision 插件;/vision-* 命令编辑同一配置)。',
|
|
446
493
|
visionEnabled: '启用',
|
|
447
|
-
visionForceIntercept: '
|
|
494
|
+
visionForceIntercept: '主模型',
|
|
495
|
+
visionForceInterceptAuto: '不能识图就使用插件',
|
|
496
|
+
visionForceInterceptTrue: '始终使用插件',
|
|
497
|
+
visionForceInterceptFalse: '不使用插件',
|
|
498
|
+
visionForceInterceptHint: '不能识图就使用插件 = 跟随 ZCode「模型设置」里该模型的图片开关:开 = 模型自看不重复识别,关 = 走识别代理(tool 模式出识别卡片);始终使用插件 = 能看图也强制走识别代理(双重识别换卡片);不使用插件 = 能看图就放行(不能识图的模型仍走识别代理)',
|
|
448
499
|
visionMode: '链模式',
|
|
449
500
|
visionModeFallback: '依次尝试',
|
|
450
501
|
visionModeFallbackDesc: '前一个失败才试下一个,任一成功即止(主力 + 备用)。',
|
|
@@ -491,7 +542,7 @@ const zh = {
|
|
|
491
542
|
headroomDesc: 'Headroom 插件:本地压缩代理驻留 127.0.0.1(默认 8787 端口),压缩发往模型的上下文以省 token(/hr-* 命令编辑同一配置)。切换设备会重启代理,正在处理的请求可能中断一次。',
|
|
492
543
|
headroomBinMissing: '未找到 headroom 程序,代理无法启动;安装 headroom 后以下设置自动生效',
|
|
493
544
|
hrInstallBin: '安装 headroom 本体',
|
|
494
|
-
hrBinInstalled: 'headroom
|
|
545
|
+
hrBinInstalled: 'headroom 本体已安装;重新打开应用或会话后代理可用(SessionStart 钩子自动拉起)',
|
|
495
546
|
headroomInstallTitle: '未安装 headroom 插件',
|
|
496
547
|
headroomInstallDesc: '从 zcode-plugins 市场安装后即可在此管理压缩代理;重启会话后生效。',
|
|
497
548
|
headroomInstall: '安装',
|
|
@@ -635,6 +686,39 @@ const en = {
|
|
|
635
686
|
tabProxy: 'Proxy',
|
|
636
687
|
tabBehavior: 'Behavior',
|
|
637
688
|
tabAgents: 'Global Prompt',
|
|
689
|
+
tabZcode: 'ZCode CLI',
|
|
690
|
+
zcodeDesc: 'ZCode behavior settings (written to ~/.zcode/cli/config.json); takes effect for new sessions.',
|
|
691
|
+
zcodeStatsTitle: 'Skill listing check',
|
|
692
|
+
zcodeStatsCounts: '{total} skills ({user} local · {plugin} plugin)',
|
|
693
|
+
zcodeStatsChars: 'Full listing ≈ {n} characters',
|
|
694
|
+
zcodeBudgetDefaultTag: ' (default)',
|
|
695
|
+
zcodeStatsDegraded: 'Over budget: the listing degrades to names only, so the model cannot see skill descriptions',
|
|
696
|
+
zcodeStatsOk: 'Within budget: the full listing with descriptions is injected into new sessions',
|
|
697
|
+
zcodeStatsSuggest: 'Suggested budget {n} characters (with 20% margin)',
|
|
698
|
+
zcodeBudgetApply: 'Use suggested',
|
|
699
|
+
zcodeBudgetApplied: 'Listing budget saved.',
|
|
700
|
+
zcodeStatsNote: 'Estimated from the current disk state; per-project skill directories are not counted.',
|
|
701
|
+
zcodeSkillEnabled: 'Skill system',
|
|
702
|
+
zcodeSkillEnabledDesc: 'skills.enabled: when off, ZCode discovers and injects no skills',
|
|
703
|
+
zcodeSkillIncludeInstructions: 'Skill instructions injection',
|
|
704
|
+
zcodeSkillIncludeInstructionsDesc: 'skills.includeInstructions: whether skill instructions are injected along with the listing',
|
|
705
|
+
zcodeSkillBudget: 'Skill listing budget (characters)',
|
|
706
|
+
zcodeSkillBudgetDesc: 'skills.metadataBudget: the listing degrades to names only beyond this length; default 20000',
|
|
707
|
+
zcodeSkillRoots: 'Extra skill directories',
|
|
708
|
+
zcodeSkillRootsDesc: 'skills.roots: one directory per line; skills under them are discovered (beyond ~/.zcode/skills and ~/.agents/skills)',
|
|
709
|
+
zcodeSave: 'Save',
|
|
710
|
+
zcodeRootsSaved: 'Skill directories saved.',
|
|
711
|
+
zcodeFeatCompact: 'Compaction',
|
|
712
|
+
zcodeFeatCompactDesc: 'features.compact: compact earlier conversation when the context grows too long',
|
|
713
|
+
zcodeFeatRewind: 'Rewind',
|
|
714
|
+
zcodeFeatRewindDesc: 'features.rewind: roll back to an earlier point and continue from there',
|
|
715
|
+
zcodeFeatSubagent: 'Subagents',
|
|
716
|
+
zcodeFeatSubagentDesc: 'features.subagent: dispatch subagents for subtasks',
|
|
717
|
+
zcodeFeatSkill: 'Skill tool',
|
|
718
|
+
zcodeFeatSkillDesc: 'features.skill: the Skill tool is available (the skill system must also be on)',
|
|
719
|
+
zcodeFeatMcp: 'MCP tools',
|
|
720
|
+
zcodeFeatMcpDesc: 'features.mcp: use tools provided by MCP servers',
|
|
721
|
+
zcodeMemoryHint: 'Memory is not here: workspace memory is toggled in the official settings under Settings → Agent capabilities → Memory (with the memory viewer).',
|
|
638
722
|
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.',
|
|
639
723
|
agentsPlaceholder: 'Instructions followed by all projects by default; save empty to remove the global prompt',
|
|
640
724
|
agentsSave: 'Save',
|
|
@@ -676,7 +760,7 @@ const en = {
|
|
|
676
760
|
syncIncludeZcp: 'ZCode Pro settings',
|
|
677
761
|
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).',
|
|
678
762
|
syncIncludeModel: 'Model settings',
|
|
679
|
-
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.',
|
|
763
|
+
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.',
|
|
680
764
|
syncUpload: 'Upload',
|
|
681
765
|
syncDownload: 'Download',
|
|
682
766
|
syncUploading: 'Uploading…',
|
|
@@ -806,14 +890,14 @@ const en = {
|
|
|
806
890
|
userFontDesc: 'Font of question text in conversations; "default" follows the UI font.',
|
|
807
891
|
assistantFontName: 'Answer font',
|
|
808
892
|
assistantFontDesc: 'Font of answer text in conversations (code blocks stay monospaced); "default" follows the UI font.',
|
|
809
|
-
switcherHint: '{prev} / {next} or ↑ / ↓ to choose, Enter or
|
|
893
|
+
switcherHint: '{prev} / {next} or ↑ / ↓ to choose, Enter or click a row to switch, Esc to cancel',
|
|
810
894
|
switcherCurrent: 'current',
|
|
811
895
|
switcherEmpty: 'No previous session yet (available after you switch sessions)',
|
|
812
896
|
switcherFailed: 'Failed to switch to that session (it may have been deleted)',
|
|
813
897
|
switcherMore: '{n} more · press c to load',
|
|
814
898
|
switcherRunning: 'running',
|
|
815
899
|
switcherUnseen: 'unseen',
|
|
816
|
-
switcherAttentionHint: 'Running / finished but unseen tasks · {prev} / {next} or ↑ / ↓ to choose, Enter or
|
|
900
|
+
switcherAttentionHint: 'Running / finished but unseen tasks · {prev} / {next} or ↑ / ↓ to choose, Enter or click a row to switch',
|
|
817
901
|
switcherAttentionEmpty: 'No running or unseen tasks',
|
|
818
902
|
featureNewtabPanels: 'Plugin panels on the new tab page',
|
|
819
903
|
featureNewtabPanelsDesc: "Adds third-party plugin panels (headroom, rtk, ...) to the new tab page; click to open in the side pane.",
|
|
@@ -828,9 +912,9 @@ const en = {
|
|
|
828
912
|
themeBgRegionLeft: 'Left sidebar',
|
|
829
913
|
themeBgRegionCenter: 'Center area',
|
|
830
914
|
themeBgRegionRight: 'Right sidebar',
|
|
831
|
-
themeBgPane: '
|
|
915
|
+
themeBgPane: 'Wallpaper',
|
|
832
916
|
themeSkinTitle: 'Skins',
|
|
833
|
-
themeSkinDesc: 'Famous editor theme palettes, auto-matching ZCode
|
|
917
|
+
themeSkinDesc: 'Famous editor theme palettes, auto-matching ZCode’s light / dark mode; "Default" keeps ZCode as-is, "Custom" is tuned below.',
|
|
834
918
|
themeSkinCustom: 'Custom',
|
|
835
919
|
themeCustomTitle: 'Custom theme',
|
|
836
920
|
themeCustomHint: 'Color changes apply live (auto-switches to the custom skin); set light and dark separately — pick 5 colors and the whole palette is derived.',
|
|
@@ -841,39 +925,55 @@ const en = {
|
|
|
841
925
|
themeCustomFg: 'Text',
|
|
842
926
|
themeCustomMuted: 'Muted text',
|
|
843
927
|
themeCustomAccent: 'Accent',
|
|
844
|
-
themeBgDesc: 'Sources: local library, folder (rotate on a timer)
|
|
928
|
+
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).',
|
|
845
929
|
themeBgModeNone: 'None',
|
|
846
930
|
themeBgModeLibrary: 'Library',
|
|
847
931
|
themeBgModeFolder: 'Folder',
|
|
848
|
-
themeBgModeUrl: 'URL',
|
|
932
|
+
themeBgModeUrl: 'Image URL',
|
|
933
|
+
themeBgModeWeb: 'Web page',
|
|
849
934
|
themeBgLibrary: 'My library',
|
|
850
|
-
themeBgUpload: 'Upload',
|
|
851
|
-
themeBgEmpty: '
|
|
935
|
+
themeBgUpload: 'Upload images/videos',
|
|
936
|
+
themeBgEmpty: 'Nothing uploaded yet. Images: png / jpg / webp / gif / bmp / avif (up to 10MB); videos: mp4 / webm / mov (up to 200MB)',
|
|
852
937
|
themeBgDelete: 'Delete',
|
|
853
|
-
themeBgNoneHint: 'Pick a
|
|
938
|
+
themeBgNoneHint: 'Pick a wallpaper source; library and folder rotate on a timer, image URLs refresh on a timer for random-image APIs.',
|
|
854
939
|
themeBgFolderPick: 'Browse',
|
|
855
940
|
themeBgFolderPickTitle: 'Choose a wallpaper folder',
|
|
856
|
-
themeBgFolderHint: 'Pick a folder of wallpapers;
|
|
941
|
+
themeBgFolderHint: 'Pick a folder of wallpapers; files are read in place, not copied.',
|
|
857
942
|
themeBgFolderRandom: 'Random order',
|
|
858
943
|
themeBgIntervalHint: 'Switch interval (minutes)',
|
|
859
944
|
themeBgIntervalUnit: 'min, 0 = off',
|
|
860
|
-
themeBgFolderCount: '{n}
|
|
861
|
-
themeBgFolderMissing: 'Folder missing or contains no
|
|
945
|
+
themeBgFolderCount: '{n} wallpaper files in the folder, rotating on the timer.',
|
|
946
|
+
themeBgFolderMissing: 'Folder missing or contains no wallpaper files.',
|
|
862
947
|
themeBgUrlHint: 'Timed refresh suits random-image APIs (each request returns a new image); a cache-buster is appended on refresh.',
|
|
863
948
|
themeBgUrlIntervalHint: 'Refresh interval (minutes)',
|
|
864
949
|
themeBgUrlInvalid: 'URL must start with http(s)://',
|
|
950
|
+
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.',
|
|
865
951
|
themeBgFit: 'Fit',
|
|
866
952
|
themeBgFitCover: 'Fill',
|
|
867
953
|
themeBgFitContain: 'Fit',
|
|
868
954
|
themeBgFitFill: 'Stretch',
|
|
869
955
|
themeBgFitTile: 'Tile',
|
|
870
956
|
themeBgMask: 'Mask opacity',
|
|
871
|
-
themeBgMaskHint: 'Higher values fade the
|
|
872
|
-
themeBgMaskHint2: 'How much the
|
|
873
|
-
themeBgBlur: '
|
|
957
|
+
themeBgMaskHint: 'Higher values fade the wallpaper toward the theme background color for clearer text',
|
|
958
|
+
themeBgMaskHint2: 'How much the wallpaper fades toward the theme background color',
|
|
959
|
+
themeBgBlur: 'Wallpaper blur',
|
|
874
960
|
themeBgPanel: 'Panel opacity',
|
|
875
|
-
themeBgPanelHint: 'Opacity of sidebar, panels and tab bar. Lower reveals more of the
|
|
876
|
-
|
|
961
|
+
themeBgPanelHint: 'Opacity of sidebar, panels and tab bar. Lower reveals more of the wallpaper.',
|
|
962
|
+
themeBgPlayback: 'Playback',
|
|
963
|
+
themeBgVolume: 'Volume',
|
|
964
|
+
themeBgVolumeHint: 'Audio track volume of video wallpapers, 0 = muted (default)',
|
|
965
|
+
themeBgRate: 'Speed',
|
|
966
|
+
themeBgFps: 'FPS cap',
|
|
967
|
+
themeBgFpsOff: 'Native',
|
|
968
|
+
themeBgFpsHint: 'Re-encodes video wallpapers to a lower frame rate to save resources; needs ffmpeg, otherwise the native rate is kept.',
|
|
969
|
+
themeBgTransition: 'Transition',
|
|
970
|
+
themeBgTransitionCut: 'Cut',
|
|
971
|
+
themeBgTransitionFade: 'Fade',
|
|
972
|
+
themeBgPause: 'Pause when',
|
|
973
|
+
themeBgPauseHidden: 'Window minimized',
|
|
974
|
+
themeBgPauseBlur: 'Window unfocused',
|
|
975
|
+
themeBgPauseBattery: 'On battery',
|
|
976
|
+
themeBgDeletedActive: 'Active wallpaper was deleted; wallpaper disabled',
|
|
877
977
|
tableCopyBtn: 'Copy table',
|
|
878
978
|
tableCopied: 'Table copied',
|
|
879
979
|
sbItemCtx: 'Context usage',
|
|
@@ -910,8 +1010,6 @@ const en = {
|
|
|
910
1010
|
hkArrow: 'Move the highlight while the popup is open (same rules as alt + {prev} / alt + {next})',
|
|
911
1011
|
hkEnter: 'Switch to the highlighted session',
|
|
912
1012
|
hkEsc: 'Cancel and close the popup',
|
|
913
|
-
hkRelease: 'Releasing alt switches once the highlight has moved; otherwise the popup stays open for further selection',
|
|
914
|
-
hkReleaseKey: 'release alt',
|
|
915
1013
|
hkModify: 'Change',
|
|
916
1014
|
hkRecording: 'press a key…',
|
|
917
1015
|
hkInvalid: 'Shortcuts accept a single letter or digit only',
|
|
@@ -957,7 +1055,11 @@ const en = {
|
|
|
957
1055
|
tabVision: 'Vision',
|
|
958
1056
|
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).',
|
|
959
1057
|
visionEnabled: 'Enable',
|
|
960
|
-
visionForceIntercept: '
|
|
1058
|
+
visionForceIntercept: 'Main model',
|
|
1059
|
+
visionForceInterceptAuto: "Use plugin only if model can't see images",
|
|
1060
|
+
visionForceInterceptTrue: 'Always use plugin',
|
|
1061
|
+
visionForceInterceptFalse: 'Never use plugin',
|
|
1062
|
+
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)",
|
|
961
1063
|
visionMode: 'Chain mode',
|
|
962
1064
|
visionModeFallback: 'Fallback',
|
|
963
1065
|
visionModeFallbackDesc: 'Try in order until one succeeds (primary + backup).',
|
|
@@ -1004,7 +1106,7 @@ const en = {
|
|
|
1004
1106
|
headroomDesc: 'Headroom plugin: a local compression proxy on 127.0.0.1 (port 8787 by default) that compresses context sent to the model to save tokens (/hr-* commands edit the same file). Switching the device restarts the proxy, so requests in progress may be interrupted once.',
|
|
1005
1107
|
headroomBinMissing: 'The headroom program was not found, so the proxy cannot start. The settings below take effect once it is installed.',
|
|
1006
1108
|
hrInstallBin: 'Install headroom binary',
|
|
1007
|
-
hrBinInstalled: 'headroom installed; reopen a session and the
|
|
1109
|
+
hrBinInstalled: 'headroom installed; reopen the app or a session and the proxy will start automatically',
|
|
1008
1110
|
headroomInstallTitle: 'headroom plugin not installed',
|
|
1009
1111
|
headroomInstallDesc: 'Install it from the zcode-plugins marketplace to manage the compression proxy here; takes effect after a session restart.',
|
|
1010
1112
|
headroomInstall: 'Install',
|
|
@@ -311,7 +311,7 @@ export function openMigrationDialog() {
|
|
|
311
311
|
clearConfigCache();
|
|
312
312
|
renderList();
|
|
313
313
|
window.dispatchEvent(new CustomEvent('zcodepro:aliases-changed'));
|
|
314
|
-
if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace('{n}', String(ok)));
|
|
314
|
+
if (ok === dead.length) showToast(L.aliasMigrateDeadCleared.replace('{n}', String(ok)), 'success');
|
|
315
315
|
else showToast(L.aliasMigrateDeadClearFailed, 'error');
|
|
316
316
|
};
|
|
317
317
|
|
|
@@ -351,9 +351,9 @@ export function openMigrationDialog() {
|
|
|
351
351
|
decide();
|
|
352
352
|
close();
|
|
353
353
|
if (!failed.length) {
|
|
354
|
-
showToast(L.aliasMigrateDone.replace('{n}', String(ok)), '
|
|
354
|
+
showToast(L.aliasMigrateDone.replace('{n}', String(ok)), 'success');
|
|
355
355
|
} else if (ok) {
|
|
356
|
-
showToast(L.aliasMigratePartial.replace('{n}', String(ok)).replace('{m}', String(failed.length)), '
|
|
356
|
+
showToast(L.aliasMigratePartial.replace('{n}', String(ok)).replace('{m}', String(failed.length)), 'warning');
|
|
357
357
|
} else {
|
|
358
358
|
showToast(L.aliasMigrateAllFailed, 'error');
|
|
359
359
|
}
|
|
@@ -174,7 +174,7 @@ export function openAliasDialog(project) {
|
|
|
174
174
|
close();
|
|
175
175
|
clearConfigCache();
|
|
176
176
|
await refreshAliases();
|
|
177
|
-
showToast(name ? L.aliasSaved : L.aliasCleared);
|
|
177
|
+
showToast(name ? L.aliasSaved : L.aliasCleared, 'success');
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
showToast((L.failed) + ': ' + (errText(res) || L.retryHint), 'error');
|
|
@@ -203,7 +203,7 @@ export function openAliasDialog(project) {
|
|
|
203
203
|
close();
|
|
204
204
|
clearConfigCache();
|
|
205
205
|
await refreshAliases();
|
|
206
|
-
showToast(L.aliasCleared);
|
|
206
|
+
showToast(L.aliasCleared, 'success');
|
|
207
207
|
} else showToast((L.failed) + ': ' + (errText(res) || L.retryHint), 'error');
|
|
208
208
|
}));
|
|
209
209
|
}
|
|
@@ -8,86 +8,99 @@ import { t, getConfig } from '../core.js';
|
|
|
8
8
|
let installed = false;
|
|
9
9
|
let enabled = true; // helper features.composerProvider(默认开)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const TRIGGER_SEL = '[data-testid="chat-model-select-trigger"]';
|
|
12
|
+
|
|
13
|
+
// 从 aria-label 拆出 “供应商 / 模型”。label 形态:
|
|
14
|
+
// "<供应商>/<模型名> <附加说明(如 最高)>";有的供应商名本身不含 /、
|
|
15
|
+
// 有的官方项整条没有 /(旧版内置项)——没有 / 时 provider 为 null:
|
|
16
|
+
// 补名没得补(调用方跳过),但还原还认得出模型名
|
|
17
|
+
function labelParts(label) {
|
|
18
|
+
const text = (label || '').trim();
|
|
19
|
+
if (!text) return null;
|
|
20
|
+
const i = text.indexOf('/');
|
|
21
|
+
if (i > 0) {
|
|
22
|
+
const provider = text.slice(0, i).trim();
|
|
23
|
+
const model = text.slice(i + 1).trim().split(/\s+/)[0];
|
|
24
|
+
return provider && model ? { provider, model } : null;
|
|
25
|
+
}
|
|
26
|
+
return { provider: null, model: text.split(/\s+/)[0] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 模型名文本 span:官方结构是 外层 title 容器 > 内层 title 层 > 纯文本 span,
|
|
30
|
+
// 按“在最内层 title 层里、自己不带 title、没有子元素”识别;同级的
|
|
31
|
+
// “最高/开启”说明 span 不在 title 层里,不能碰(首版误把它也替换成全名)。
|
|
32
|
+
// 换模型时旧文本可能还在退场动画里没摘掉,按文本内容认目标:等于模型名
|
|
33
|
+
//(官方原文)、或以 “ / 模型名” 结尾(此前补过供应商名的文本)才算
|
|
34
|
+
function holdersOf(btn, model) {
|
|
35
|
+
const innermost = [...btn.querySelectorAll('span[title]')].filter((sp) => !sp.querySelector('span[title]'));
|
|
36
|
+
const holders = [];
|
|
37
|
+
for (const sp of innermost) {
|
|
38
|
+
for (const el of sp.querySelectorAll('span:not([title])')) {
|
|
39
|
+
if (el.querySelector('span')) continue;
|
|
40
|
+
const text = el.textContent.trim();
|
|
41
|
+
if (!text) continue;
|
|
42
|
+
if (text === model || text.endsWith(` / ${model}`)) holders.push(el);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return holders;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 改文本优先改文本节点本身:直接 textContent 覆盖会把应用持有的文本节点换成
|
|
49
|
+
// 新节点,它后续的更新就落不到可见文本上了
|
|
50
|
+
function setText(el, text) {
|
|
51
|
+
const node = el.firstChild;
|
|
52
|
+
if (node && node.nodeType === 3 && !node.nextSibling) node.nodeValue = text;
|
|
53
|
+
else el.textContent = text;
|
|
22
54
|
}
|
|
23
55
|
|
|
24
56
|
function apply() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!model) continue;
|
|
35
|
-
for (const sp of btn.querySelectorAll('span[title]')) sp.setAttribute('title', model);
|
|
36
|
-
for (const el of btn.querySelectorAll('span[title] span:not([title])')) {
|
|
37
|
-
if (!el.querySelector('span') && el.textContent.includes('/')) el.textContent = model;
|
|
57
|
+
for (const btn of document.querySelectorAll(TRIGGER_SEL)) {
|
|
58
|
+
const parts = labelParts(btn.getAttribute('aria-label') || '');
|
|
59
|
+
if (!parts) continue;
|
|
60
|
+
const holders = holdersOf(btn, parts.model);
|
|
61
|
+
if (enabled) {
|
|
62
|
+
if (!parts.provider || !holders.length) continue;
|
|
63
|
+
const target = `${parts.provider} / ${parts.model}`;
|
|
64
|
+
for (const el of holders) {
|
|
65
|
+
if (el.textContent.trim() !== target) setText(el, target);
|
|
38
66
|
}
|
|
67
|
+
// title 跟显示文本一致,悬停可见全名
|
|
68
|
+
for (const sp of btn.querySelectorAll('span[title]')) {
|
|
69
|
+
if (sp.getAttribute('title') !== target) sp.setAttribute('title', target);
|
|
70
|
+
}
|
|
71
|
+
btn.dataset.zcodeproProviderShown = '1';
|
|
72
|
+
} else if (btn.dataset.zcodeproProviderShown) {
|
|
73
|
+
// 关闭时把补过的文本与 title 还原为官方模型名,不必等应用重渲染
|
|
74
|
+
for (const el of holders) {
|
|
75
|
+
if (el.textContent.trim() !== parts.model) setText(el, parts.model);
|
|
76
|
+
}
|
|
77
|
+
for (const sp of btn.querySelectorAll('span[title]')) sp.setAttribute('title', parts.model);
|
|
39
78
|
delete btn.dataset.zcodeproProviderShown;
|
|
40
79
|
}
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
for (const btn of document.querySelectorAll('[data-testid="chat-model-select-trigger"]')) {
|
|
44
|
-
// 只处理 a[data-composer-combined-model] 主触发器;aria-label 缺失时跳过
|
|
45
|
-
const label = btn.getAttribute('aria-label') || '';
|
|
46
|
-
const display = labelToDisplay(label);
|
|
47
|
-
if (!display) continue;
|
|
48
|
-
// 显示 span 是嵌套两层的 title 结构(外层裁剪容器 + 内层相对定位层),
|
|
49
|
-
// 文本都在最内层 span;只改文本与 title,不动结构
|
|
50
|
-
// 官方结构:外层 title 容器 > 内层 title 层 > 纯文本 span(模型名)。
|
|
51
|
-
// 只改 title 链内的文本——按“祖先带 title”识别模型名文本;同级的
|
|
52
|
-
// “最高/开启”说明 span(无 title 祖先链上的 title 层)不属于模型名,
|
|
53
|
-
// 不能碰(首版误把它也替换成全名)
|
|
54
|
-
const titleSpans = [...btn.querySelectorAll('span[title]')];
|
|
55
|
-
if (!titleSpans.length) continue;
|
|
56
|
-
const innermost = titleSpans.filter((sp) => !sp.querySelector('span[title]'));
|
|
57
|
-
if (!innermost.length) continue;
|
|
58
|
-
const holders = [];
|
|
59
|
-
for (const sp of innermost) {
|
|
60
|
-
sp.querySelectorAll('span:not([title])').forEach((el) => {
|
|
61
|
-
if (!el.querySelector('span') && el.textContent.trim() && !el.textContent.includes('/')) holders.push(el);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (!holders.length) continue;
|
|
65
|
-
for (const sp of titleSpans) {
|
|
66
|
-
if (sp.getAttribute('title') !== display) sp.setAttribute('title', display);
|
|
67
|
-
}
|
|
68
|
-
for (const el of holders) el.textContent = display;
|
|
69
|
-
btn.dataset.zcodeproProviderShown = '1';
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
export function startComposerProvider() {
|
|
74
84
|
if (installed || typeof document === 'undefined') return;
|
|
75
85
|
installed = true;
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
const COMPOSER_SEL = '[data-composer-layout], [data-composer-leading-content], [data-testid="chat-model-select-trigger"]';
|
|
86
|
+
// 先过滤再调度:无关变更直接忽略,连去抖定时器都不排——流式输出的高频
|
|
87
|
+
// 文本变更不会叫醒本模块
|
|
88
|
+
const COMPOSER_SEL = '[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content], [data-testid="chat-model-select-trigger"]';
|
|
79
89
|
const relevant = (muts) => {
|
|
80
90
|
for (const m of muts) {
|
|
81
91
|
if (m.type === 'childList') {
|
|
82
92
|
for (const n of [...m.addedNodes, ...m.removedNodes]) {
|
|
83
|
-
|
|
93
|
+
// 触发器内部的节点增删也算:换模型、开合下拉都把整段标签换成新节点,
|
|
94
|
+
// 那一批次里没有别的动静,漏掉就等不到下次补名
|
|
95
|
+
if (n instanceof Element && (n.matches?.(COMPOSER_SEL) || n.querySelector?.(COMPOSER_SEL) || n.closest?.(TRIGGER_SEL))) return true;
|
|
84
96
|
}
|
|
97
|
+
} else if (m.type === 'attributes') {
|
|
98
|
+
// 只认触发器按钮身上的属性(换模型就改它的 aria-label /
|
|
99
|
+
// data-model-current-value);同名模型换供应商时文本一动不动,全靠这里
|
|
100
|
+
if (m.target instanceof Element && m.target.closest?.(TRIGGER_SEL)) return true;
|
|
85
101
|
} else if (m.type === 'characterData') {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (el.matches?.('[data-composer-layout], [data-composer-leading-actions], [data-composer-leading-content]')) return true;
|
|
89
|
-
el = el.parentElement;
|
|
90
|
-
}
|
|
102
|
+
const el = m.target.parentElement?.closest?.(COMPOSER_SEL);
|
|
103
|
+
if (el) return true;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
return false;
|
|
@@ -107,6 +120,12 @@ export function startComposerProvider() {
|
|
|
107
120
|
}).catch(() => {});
|
|
108
121
|
});
|
|
109
122
|
const observer = new MutationObserver((muts) => { if (enabled && relevant(muts)) schedule(); });
|
|
110
|
-
observer.observe(document.body, {
|
|
123
|
+
observer.observe(document.body, {
|
|
124
|
+
childList: true,
|
|
125
|
+
subtree: true,
|
|
126
|
+
characterData: true,
|
|
127
|
+
attributes: true,
|
|
128
|
+
attributeFilter: ['aria-label', 'data-model-current-value'], // 这两个只有应用会写,不认 title,避免自己改 title 叫醒自己
|
|
129
|
+
});
|
|
111
130
|
apply();
|
|
112
131
|
}
|
|
@@ -28,7 +28,7 @@ export async function appendCopyPathItem(menu, anchorItem, project) {
|
|
|
28
28
|
|
|
29
29
|
async function copyText(text) {
|
|
30
30
|
const L = t();
|
|
31
|
-
if (await copyToClipboard(text)) showToast(L.pathCopied);
|
|
31
|
+
if (await copyToClipboard(text)) showToast(L.pathCopied, 'success');
|
|
32
32
|
else showToast(L.pathCopyFailed, 'error');
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -58,7 +58,9 @@ function pathFromReactFiber(el) {
|
|
|
58
58
|
try {
|
|
59
59
|
const key = Object.keys(el).find((k) => k.startsWith('__reactFiber$'));
|
|
60
60
|
let fiber = key ? el[key] : null;
|
|
61
|
-
|
|
61
|
+
// 层数上限 100:预览卡片“打开 ▾”下拉的触发器到 OpenSplitButton(target.path)实测 41 层,
|
|
62
|
+
// Radix 的 provider/Slot 中间层多,40 会差一层拿不到路径
|
|
63
|
+
for (let i = 0; fiber && i < 100; i++, fiber = fiber.return) {
|
|
62
64
|
const props = fiber.memoizedProps;
|
|
63
65
|
if (!props || typeof props !== 'object') continue;
|
|
64
66
|
for (const k of ['target', 'fileLink', 'row']) {
|
|
@@ -116,11 +116,11 @@ async function copyImage(img, preBlob) {
|
|
|
116
116
|
if (!blob) throw new Error('empty image');
|
|
117
117
|
if (blob.type !== 'image/png') blob = await toPng(blob);
|
|
118
118
|
await navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);
|
|
119
|
-
showToast(L.imageCopied);
|
|
119
|
+
showToast(L.imageCopied, 'success');
|
|
120
120
|
} catch {
|
|
121
121
|
// 部分 Electron/Linux 组合上 navigator.clipboard 写图片报 DataError(写文本正常),
|
|
122
122
|
// 回退 execCommand:选中 <img> 后复制,Chromium 会把图片本体写入剪贴板
|
|
123
|
-
if (copyViaSelection(img)) showToast(L.imageCopied);
|
|
123
|
+
if (copyViaSelection(img)) showToast(L.imageCopied, 'success');
|
|
124
124
|
else showToast(L.imageCopyFailed, 'error');
|
|
125
125
|
}
|
|
126
126
|
}
|