dsh-agy-link 0.6.53 → 0.6.55

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/client.js CHANGED
@@ -37,13 +37,12 @@ window.__ModuleLoader__.load({
37
37
  "status.loading": "正在加载 Antigravity 状态...",
38
38
  "status.authRequired": "需重新登录",
39
39
  "status.cooldown": "冷却中",
40
- "status.quotaLimited": "限流中",
41
40
  "status.tosBanned": "已封禁 (ToS)",
42
41
  "status.validationRequired": "需安全验证",
43
- "account.setActive": "设为当前使用",
42
+ "account.setActive": "设为当前",
44
43
  "account.settingActive": "切换中",
45
44
  "account.activeSet": "已切换当前使用账号",
46
- "account.activeSetFailed": "该账号当前不可用(冷却、限流或需重新登录)",
45
+ "account.activeSetFailed": "该模型组下此账号当前不可用(冷却中或需重新登录)",
47
46
  "account.reauth": "重新登录",
48
47
  "account.reauthing": "重登中",
49
48
  "account.reauthTitle": "原位重新登录此账号(保留别名、代理与优先级)",
@@ -55,6 +54,57 @@ window.__ModuleLoader__.load({
55
54
  "decision.quickFill": "💬 点击选项快速填入:",
56
55
  "decision.insertTooltip": "点击填入: {text}",
57
56
  "decision.insertPayload": "我选择 {choice}",
57
+ "image.zoomHint": "{alt}(点击全屏放大)",
58
+ "image.previewTitle": "预览图片({name})",
59
+ "image.previewChip": "预览",
60
+ "image.playTitle": "播放视频({name})",
61
+ "image.playChip": "播放",
62
+ "image.lightboxHint": "点击放大预览",
63
+ "audio.toggleTitle": "播放/切换音频播放器({name})",
64
+ "audio.listenChip": "试听",
65
+ "audio.openBtn": "打开",
66
+ "embed.collapse": "收起",
67
+ "embed.expand": "展开",
68
+ "embed.source": "源码",
69
+ "file.openedInSidebar": "已在原生边栏打开:{name}",
70
+ "file.openedInSystem": "已在系统程序中打开:{name}",
71
+ "file.openFailed": "打开失败:{error}",
72
+ "file.notFound": "未找到文件",
73
+ "lightbox.zoomIn": "放大",
74
+ "lightbox.zoomOut": "缩小",
75
+ "lightbox.reset": "实际大小(1:1)",
76
+ "lightbox.openWithApp": "用系统默认应用打开",
77
+ "lightbox.reveal": "在访达 / 资源管理器中显示",
78
+ "lightbox.copyPath": "复制完整文件路径",
79
+ "lightbox.close": "关闭(ESC)",
80
+ "lightbox.unavailableTitle": "无法直接预览媒体",
81
+ "lightbox.unavailableHint": "文件可能正在生成中、已移动或格式需由外部应用呈现。",
82
+ "lightbox.revealAction": "在访达/资源管理器中查找",
83
+ "lightbox.revealed": "已在文件管理器中定位",
84
+ "lightbox.revealFailed": "无法定位文件",
85
+ "lightbox.revealFailedDetail": "定位失败:{error}",
86
+ "lightbox.openedInApp": "已在系统应用中打开",
87
+ "lightbox.openFailed": "打开失败:{error}",
88
+ "lightbox.unknownError": "未知错误",
89
+ "lightbox.pathCopied": "文件路径已复制到剪贴板",
90
+ "lightbox.hintClose": "ESC 退出 · 点击空白处关闭",
91
+ "lightbox.hintZoom": "ESC 退出 · 滚轮缩放 · 拖拽平移",
92
+ "lightbox.loading": "加载媒体中…",
93
+ "lightbox.zoomInChip": "放大",
94
+ "lightbox.zoomOutChip": "缩小",
95
+ "lightbox.openChip": "打开",
96
+ "lightbox.revealChip": "定位",
97
+ "lightbox.copyChip": "复制路径",
98
+ "lightbox.copiedChip": "✓ 已复制",
99
+ "lightbox.closeChip": "关闭",
100
+ "mermaid.viewSource": "查看源码",
101
+ "mermaid.viewDiagram": "查看图表",
102
+ "mermaid.toggle": "切换图表与原始代码",
103
+ "mermaid.parseFailed": "⚠️ Mermaid 图表解析失败,已保留原始代码呈现",
104
+ "compaction.contextCompacted": "上下文已压缩",
105
+ "question.insert": "💬 填入对话框",
106
+ "question.inserted": "✓ 已填入对话框",
107
+ "question.recorded": "已记录:{value}",
58
108
  "account.proxyPlaceholder": "专属代理 URL(如 http://127.0.0.1:7890,留空则继承全局)",
59
109
  "account.aliasPlaceholder": "账号别名(例如:备用账号 2)",
60
110
  "account.removeTitle": "移除此账号",
@@ -71,10 +121,10 @@ window.__ModuleLoader__.load({
71
121
  "account.syncing": "同步中",
72
122
  "account.syncTitle": "刷新此账号(换号后立即同步 email / 额度 / 模型)",
73
123
  "account.models": "单模型明细:",
74
- "account.cooldown": "部分模型限流中,已自动切换账号",
75
124
  "account.clearCooldown": "清除冷却",
76
- "account.localCooldown": " · 本地冷却中",
77
- "account.quotaLimitedNote": " · 限流中",
125
+ "account.clearCooldownDone": "已清除冷却限制",
126
+ "account.collapsedCoolingHint": "({families} 冷却中)",
127
+ "account.poolHeading": "账号池 ({count})",
78
128
  "account.removed": "已移除账号:{alias}",
79
129
  "quota.fiveHour": "5 小时额度",
80
130
  "quota.weekly": "周额度",
@@ -193,6 +243,11 @@ window.__ModuleLoader__.load({
193
243
  "warmup.success": "账号预热成功",
194
244
  "warmup.allSuccess": "一键预热任务已完成",
195
245
  "warmup.skipped": "当前账号或模型处于冷却中,无需预热",
246
+ "warmup.started": "正在后台预热,可关闭窗口稍后查看",
247
+ "warmup.alreadyRunning": "预热任务正在进行中,请稍候",
248
+ "warmup.progress": "预热中 {completed}/{total}",
249
+ "warmup.progressCurrent": "预热中 {completed}/{total} · {account}",
250
+ "warmup.lastRun": "上次预热 {time} · {ok} 成功 · {skipped} 跳过 · {failed} 失败",
196
251
  "config.autoWarmup": "7天周配额自动预热",
197
252
  "config.autoWarmupDesc": "周配额到达重置时间或冷启动时自动唤醒 1 次启动新周期",
198
253
  "config.autoTranslate": "自动翻译",
@@ -206,9 +261,9 @@ window.__ModuleLoader__.load({
206
261
  "config.image": "生图",
207
262
  "config.imageDesc": "agy 内置 generate_image;headless 用 dsh-agy-image,与主流程共用账号池,额度/地区失败自动换号",
208
263
  "config.imageModel": "生图模型",
209
- "config.imageModelDesc": "驱动 generate_image 的模型;默认跟随插件默认模型",
264
+ "config.imageModelDesc": "驱动 generate_image / image-generator 的模型;默认优先 Gemini 4 Hydrogen(免费号回退 Gemini 3.8 Flash)",
210
265
  "config.imageEffort": "生图思考档",
211
- "config.imageEffortDesc": "通常 low 足够,真正的开销在图片模型",
266
+ "config.imageEffortDesc": "生图与看图自检的思考档;默认 medium(均衡画质规划、自检与速度),high/xhigh 耗时更长",
212
267
  "config.imageCopy": "复制命令",
213
268
  "config.imageCopied": "命令已复制",
214
269
  "config.imageCopyFailed": "复制失败,请手动选择命令",
@@ -221,9 +276,49 @@ window.__ModuleLoader__.load({
221
276
  "config.on": "开启",
222
277
  "config.off": "关闭",
223
278
  "config.runtimeTitle": "运行方式",
224
- "config.runtimeDesc": "权限模式固定 skip(静默执行,AGY 内置保护仍然生效);推理强度由下面的「默认思考强度」决定模型下拉框的初始档位,也可在该下拉框里按模型单独切换。",
279
+ "config.runtimeDesc": "配置执行权限、终端沙箱、传输模式及默认思考强度;选定思考强度会作为模型下拉框的初始档位,仍可按模型单独覆盖。",
225
280
  "config.defaultEffort": "默认思考强度",
226
281
  "config.defaultEffortDesc": "auto = 各模型用自身默认档;选定后作为会话模型下拉框的初始档位,仍可按模型覆盖",
282
+ "config.permissionMode": "执行权限模式",
283
+ "config.permissionModeDesc": "控制 agy CLI 工具执行审批策略(auto 仅高危询问,skip 全自动免审)",
284
+ "config.modeSkip": "跳过审批 (skip)",
285
+ "config.modeAuto": "智能审查 (auto)",
286
+ "config.modeAcceptEdits": "自动改文件",
287
+ "config.modePlan": "仅规划 (plan)",
288
+ "config.sandbox": "终端沙箱 (--sandbox)",
289
+ "config.sandboxDesc": "开启 OS 级终端沙箱,隔离 ~/.ssh、凭据等敏感目录",
290
+ "config.transport": "执行传输通道",
291
+ "config.transportDesc": "cli = 单轮短进程 (-p);acp = 常驻 JSON-RPC 服务(失败自动回退 CLI)",
292
+ "config.transportCli": "CLI (-p)",
293
+ "config.transportAcp": "ACP 常驻",
294
+ "config.acpStats": "{procs} 进程 · {sessions} 会话",
295
+ "config.imageTool": "对话内生图工具 (agy_image)",
296
+ "config.imageToolDesc": "注册 agy_image 工具,让任意 DSH 模型都能直接调用 Antigravity 生图/改图",
297
+ "config.syncCustomizations": "多账号定制同步",
298
+ "config.syncCustomizationsDesc": "自动将主账号的 Plugins、MCP、Skills、Rules 与 Agents 镜像同步到隔离账号池",
299
+ "config.agent": "默认自定义 Agent (--agent)",
300
+ "config.agentDesc": "指定 Markdown 自定义 Agent 名称,留空使用 agy 默认行为",
301
+ "config.agentPlaceholder": "输入 agent 名称(留空默认)",
302
+ "config.save": "保存",
303
+ "config.clear": "清除",
304
+ "eco.heading": "Antigravity 定制生态",
305
+ "eco.desc": "主账号及工作区 Plugins · MCP · Agents · Skills · Rules(支持一键同步至隔离号池)",
306
+ "eco.expand": "展开列表",
307
+ "eco.collapse": "收起",
308
+ "eco.syncNow": "同步至号池",
309
+ "eco.syncing": "同步中…",
310
+ "eco.synced": "已同步 {accounts} 个隔离账号(更新 {copied} / 清理 {removed})",
311
+ "eco.syncFailed": "生态同步失败",
312
+ "eco.plugins": "插件 ({count})",
313
+ "eco.mcp": "MCP 服务 ({count})",
314
+ "eco.agents": "自定义 Agent ({count})",
315
+ "eco.skills": "Skills ({count})",
316
+ "eco.rules": "Rules ({count})",
317
+ "eco.empty": "未发现已安装的自定义扩展或 MCP 服务",
318
+ "eco.useAgent": "设为默认",
319
+ "eco.activeAgent": "当前使用",
320
+ "eco.pluginToggled": "插件 {id} 已更新",
321
+ "eco.toggleFailed": "插件状态切换失败",
227
322
  "tsl.badge": "Gemini 译文",
228
323
  "tsl.plain": "人话版",
229
324
  "tsl.translate": "译成人话",
@@ -274,14 +369,13 @@ window.__ModuleLoader__.load({
274
369
  "status.needsAuth": "Authentication required",
275
370
  "status.loading": "Loading Antigravity status...",
276
371
  "status.authRequired": "Sign in again required",
277
- "status.cooldown": "Cooldown",
278
- "status.quotaLimited": "Rate limited",
372
+ "status.cooldown": "Cooling down",
279
373
  "status.tosBanned": "Suspended (ToS)",
280
374
  "status.validationRequired": "Verification required",
281
- "account.setActive": "Set as in use",
375
+ "account.setActive": "Set active",
282
376
  "account.settingActive": "Switching...",
283
377
  "account.activeSet": "Active account switched",
284
- "account.activeSetFailed": "Account not currently eligible (cooldown, quota-limited, or auth required)",
378
+ "account.activeSetFailed": "Account not currently eligible for this family (cooling down or auth required)",
285
379
  "account.reauth": "Sign in again",
286
380
  "account.reauthing": "Signing in...",
287
381
  "account.reauthTitle": "Re-authenticate this account in place (keeps alias, proxy and priority)",
@@ -293,6 +387,57 @@ window.__ModuleLoader__.load({
293
387
  "decision.quickFill": "💬 Click an option to fill it in:",
294
388
  "decision.insertTooltip": "Insert: {text}",
295
389
  "decision.insertPayload": "I choose {choice}",
390
+ "image.zoomHint": "{alt} (click to view full screen)",
391
+ "image.previewTitle": "Preview ({name})",
392
+ "image.previewChip": "Preview",
393
+ "image.playTitle": "Play video ({name})",
394
+ "image.playChip": "Play",
395
+ "image.lightboxHint": "Click to open lightbox",
396
+ "audio.toggleTitle": "Play/toggle audio player ({name})",
397
+ "audio.listenChip": "Listen",
398
+ "audio.openBtn": "Open",
399
+ "embed.collapse": "Collapse",
400
+ "embed.expand": "Expand",
401
+ "embed.source": "Source",
402
+ "file.openedInSidebar": "Opened in the sidebar: {name}",
403
+ "file.openedInSystem": "Opened in the system app: {name}",
404
+ "file.openFailed": "Could not open: {error}",
405
+ "file.notFound": "file not found",
406
+ "lightbox.zoomIn": "Zoom in",
407
+ "lightbox.zoomOut": "Zoom out",
408
+ "lightbox.reset": "Actual size (1:1)",
409
+ "lightbox.openWithApp": "Open with the default app",
410
+ "lightbox.reveal": "Reveal in the file manager",
411
+ "lightbox.copyPath": "Copy the full file path",
412
+ "lightbox.close": "Close (ESC)",
413
+ "lightbox.unavailableTitle": "Preview unavailable",
414
+ "lightbox.unavailableHint": "The file may still be generating, may have moved, or needs an external app.",
415
+ "lightbox.revealAction": "Reveal in the file manager",
416
+ "lightbox.revealed": "Revealed in the file manager",
417
+ "lightbox.revealFailed": "Could not locate the file",
418
+ "lightbox.revealFailedDetail": "Could not reveal: {error}",
419
+ "lightbox.openedInApp": "Opened in the system app",
420
+ "lightbox.openFailed": "Could not open: {error}",
421
+ "lightbox.unknownError": "unknown error",
422
+ "lightbox.pathCopied": "File path copied to the clipboard",
423
+ "lightbox.hintClose": "ESC to exit · click the backdrop to close",
424
+ "lightbox.hintZoom": "ESC to exit · scroll to zoom · drag to pan",
425
+ "lightbox.loading": "Loading media…",
426
+ "lightbox.zoomInChip": "Zoom in",
427
+ "lightbox.zoomOutChip": "Zoom out",
428
+ "lightbox.openChip": "Open",
429
+ "lightbox.revealChip": "Reveal",
430
+ "lightbox.copyChip": "Copy path",
431
+ "lightbox.copiedChip": "✓ Copied",
432
+ "lightbox.closeChip": "Close",
433
+ "mermaid.viewSource": "View source",
434
+ "mermaid.viewDiagram": "View diagram",
435
+ "mermaid.toggle": "Switch between the diagram and its source",
436
+ "mermaid.parseFailed": "⚠️ This Mermaid diagram could not be rendered; the source is kept below.",
437
+ "compaction.contextCompacted": "Context compacted",
438
+ "question.insert": "💬 Insert into the chat",
439
+ "question.inserted": "✓ Inserted into the chat",
440
+ "question.recorded": "Recorded: {value}",
296
441
  "account.proxyPlaceholder": "Dedicated proxy URL (e.g. http://127.0.0.1:7890; leave blank to inherit global)",
297
442
  "account.aliasPlaceholder": "Account alias (for example: Backup account 2)",
298
443
  "account.removeTitle": "Remove this account",
@@ -309,10 +454,10 @@ window.__ModuleLoader__.load({
309
454
  "account.syncing": "Syncing...",
310
455
  "account.syncTitle": "Refresh this account (sync email, quota, and models after switching accounts)",
311
456
  "account.models": "Per-model details:",
312
- "account.cooldown": "Some models are rate-limited; the account was switched automatically",
313
457
  "account.clearCooldown": "Clear cooldown",
314
- "account.localCooldown": " · local cooldown active",
315
- "account.quotaLimitedNote": " · rate-limited",
458
+ "account.clearCooldownDone": "Cooldown cleared",
459
+ "account.collapsedCoolingHint": " ({families} cooling down)",
460
+ "account.poolHeading": "Account Pool ({count})",
316
461
  "account.removed": "Account removed: {alias}",
317
462
  "quota.fiveHour": "5-hour quota",
318
463
  "quota.weekly": "Weekly quota",
@@ -431,6 +576,11 @@ window.__ModuleLoader__.load({
431
576
  "warmup.success": "Account warmed up successfully",
432
577
  "warmup.allSuccess": "Warmup completed for all accounts",
433
578
  "warmup.skipped": "Account or model is in cooldown, no warmup needed",
579
+ "warmup.started": "Warmup running in background; you can close this window",
580
+ "warmup.alreadyRunning": "Warmup is already running",
581
+ "warmup.progress": "Warming up {completed}/{total}",
582
+ "warmup.progressCurrent": "Warming up {completed}/{total} · {account}",
583
+ "warmup.lastRun": "Last warmup {time} · {ok} ok · {skipped} skipped · {failed} failed",
434
584
  "config.autoWarmup": "7-Day Quota Auto-Warmup",
435
585
  "config.autoWarmupDesc": "Automatically trigger a 1-token probe when weekly reset time is reached",
436
586
  "config.autoTranslate": "Auto translate",
@@ -444,9 +594,9 @@ window.__ModuleLoader__.load({
444
594
  "config.image": "Image generation",
445
595
  "config.imageDesc": "Built-in agy generate_image; headless via dsh-agy-image, sharing the main account pool and rotating on quota/region failures",
446
596
  "config.imageModel": "Image model",
447
- "config.imageModelDesc": "Model that drives generate_image; defaults to the plugin default model",
597
+ "config.imageModelDesc": "Model that drives generate_image / image-generator; auto prefers Gemini 4 Hydrogen (falls back to Gemini 3.8 Flash)",
448
598
  "config.imageEffort": "Image effort",
449
- "config.imageEffortDesc": "low is usually enough; the image model is the real cost",
599
+ "config.imageEffortDesc": "Thinking effort for prompt planning and visual self-review; default medium (balanced), high/xhigh take longer",
450
600
  "config.imageCopy": "Copy command",
451
601
  "config.imageCopied": "Command copied",
452
602
  "config.imageCopyFailed": "Copy failed — select the command manually",
@@ -459,9 +609,49 @@ window.__ModuleLoader__.load({
459
609
  "config.on": "On",
460
610
  "config.off": "Off",
461
611
  "config.runtimeTitle": "Runtime",
462
- "config.runtimeDesc": "Permission mode is fixed to skip (unattended; AGY's internal protections still apply). The reasoning effort is set by “Default thinking effort” below, which seeds the session model menu — you can still switch it per model there.",
612
+ "config.runtimeDesc": "Configure permission mode, terminal sandbox, transport, and default reasoning effort (which seeds the session model picker and stays overridable per model).",
463
613
  "config.defaultEffort": "Default thinking effort",
464
614
  "config.defaultEffortDesc": "auto = each model keeps its own default; a fixed level seeds the session model menu and can still be overridden per model",
615
+ "config.permissionMode": "Permission mode",
616
+ "config.permissionModeDesc": "Tool approval policy for agy CLI (auto checks risky ops; skip runs unattended)",
617
+ "config.modeSkip": "Skip (unattended)",
618
+ "config.modeAuto": "Auto (safe review)",
619
+ "config.modeAcceptEdits": "Accept edits",
620
+ "config.modePlan": "Plan (read-only)",
621
+ "config.sandbox": "Terminal sandbox (--sandbox)",
622
+ "config.sandboxDesc": "Enable OS terminal sandboxing to protect ~/.ssh and credential directories",
623
+ "config.transport": "Execution transport",
624
+ "config.transportDesc": "cli = per-turn -p subprocess; acp = persistent JSON-RPC daemon (falls back to CLI on startup failure)",
625
+ "config.transportCli": "CLI (-p)",
626
+ "config.transportAcp": "ACP Persistent",
627
+ "config.acpStats": "{procs} proc · {sessions} sess",
628
+ "config.imageTool": "In-chat image tool (agy_image)",
629
+ "config.imageToolDesc": "Register the agy_image DSH tool so any model can generate or edit images via agy",
630
+ "config.syncCustomizations": "Multi-account ecosystem sync",
631
+ "config.syncCustomizationsDesc": "Automatically mirror primary Plugins, MCP servers, Skills, Rules, and Agents into isolated pool accounts",
632
+ "config.agent": "Default custom agent (--agent)",
633
+ "config.agentDesc": "Select a Markdown custom agent name; leave blank for the default agy agent",
634
+ "config.agentPlaceholder": "Custom agent name (blank = default)",
635
+ "config.save": "Save",
636
+ "config.clear": "Clear",
637
+ "eco.heading": "Antigravity Ecosystem",
638
+ "eco.desc": "Primary & workspace Plugins · MCP · Agents · Skills · Rules (mirrorable to pool accounts)",
639
+ "eco.expand": "Expand",
640
+ "eco.collapse": "Collapse",
641
+ "eco.syncNow": "Sync to pool",
642
+ "eco.syncing": "Syncing…",
643
+ "eco.synced": "Synced {accounts} isolated account(s) (+{copied} / -{removed})",
644
+ "eco.syncFailed": "Ecosystem sync failed",
645
+ "eco.plugins": "Plugins ({count})",
646
+ "eco.mcp": "MCP Servers ({count})",
647
+ "eco.agents": "Custom Agents ({count})",
648
+ "eco.skills": "Skills ({count})",
649
+ "eco.rules": "Rules ({count})",
650
+ "eco.empty": "No custom plugins, MCP servers, skills, rules, or agents discovered",
651
+ "eco.useAgent": "Use",
652
+ "eco.activeAgent": "Active",
653
+ "eco.pluginToggled": "Plugin {id} updated",
654
+ "eco.toggleFailed": "Failed to toggle plugin",
465
655
  "tsl.badge": "Gemini translation",
466
656
  "tsl.plain": "Plain language",
467
657
  "tsl.translate": "Translate to plain language",
@@ -513,13 +703,12 @@ window.__ModuleLoader__.load({
513
703
  "status.loading": "Carregando o status do Antigravity...",
514
704
  "status.authRequired": "É necessário entrar novamente",
515
705
  "status.cooldown": "Em espera",
516
- "status.quotaLimited": "Limitado",
517
706
  "status.tosBanned": "Suspensa (ToS)",
518
707
  "status.validationRequired": "Verificação necessária",
519
- "account.setActive": "Definir como em uso",
708
+ "account.setActive": "Usar agora",
520
709
  "account.settingActive": "Alternando...",
521
710
  "account.activeSet": "Conta em uso alterada",
522
- "account.activeSetFailed": "Conta não elegível no momento (cooldown, cota limitada ou login necessário)",
711
+ "account.activeSetFailed": "Conta não elegível agora para este grupo (em espera ou login necessário)",
523
712
  "account.reauth": "Entrar novamente",
524
713
  "account.reauthing": "Entrando...",
525
714
  "account.reauthTitle": "Reautenticar esta conta no lugar (mantém apelido, proxy e prioridade)",
@@ -531,6 +720,57 @@ window.__ModuleLoader__.load({
531
720
  "decision.quickFill": "💬 Clique numa opção para preenchê-la:",
532
721
  "decision.insertTooltip": "Inserir: {text}",
533
722
  "decision.insertPayload": "Escolho {choice}",
723
+ "image.zoomHint": "{alt} (clique para ver em tela cheia)",
724
+ "image.previewTitle": "Pré-visualizar ({name})",
725
+ "image.previewChip": "Ver",
726
+ "image.playTitle": "Reproduzir vídeo ({name})",
727
+ "image.playChip": "Reproduzir",
728
+ "image.lightboxHint": "Clique para ampliar",
729
+ "audio.toggleTitle": "Reproduzir/alternar áudio ({name})",
730
+ "audio.listenChip": "Ouvir",
731
+ "audio.openBtn": "Abrir",
732
+ "embed.collapse": "Recolher",
733
+ "embed.expand": "Expandir",
734
+ "embed.source": "Código",
735
+ "file.openedInSidebar": "Aberto na barra lateral: {name}",
736
+ "file.openedInSystem": "Aberto no app do sistema: {name}",
737
+ "file.openFailed": "Não foi possível abrir: {error}",
738
+ "file.notFound": "arquivo não encontrado",
739
+ "lightbox.zoomIn": "Ampliar",
740
+ "lightbox.zoomOut": "Reduzir",
741
+ "lightbox.reset": "Tamanho real (1:1)",
742
+ "lightbox.openWithApp": "Abrir com o app padrão",
743
+ "lightbox.reveal": "Mostrar no gerenciador de arquivos",
744
+ "lightbox.copyPath": "Copiar o caminho completo",
745
+ "lightbox.close": "Fechar (ESC)",
746
+ "lightbox.unavailableTitle": "Pré-visualização indisponível",
747
+ "lightbox.unavailableHint": "O arquivo pode estar sendo gerado, ter sido movido ou precisar de um app externo.",
748
+ "lightbox.revealAction": "Mostrar no gerenciador de arquivos",
749
+ "lightbox.revealed": "Mostrado no gerenciador de arquivos",
750
+ "lightbox.revealFailed": "Não foi possível localizar o arquivo",
751
+ "lightbox.revealFailedDetail": "Não foi possível mostrar: {error}",
752
+ "lightbox.openedInApp": "Aberto no app do sistema",
753
+ "lightbox.openFailed": "Não foi possível abrir: {error}",
754
+ "lightbox.unknownError": "erro desconhecido",
755
+ "lightbox.pathCopied": "Caminho copiado para a área de transferência",
756
+ "lightbox.hintClose": "ESC para sair · clique no fundo para fechar",
757
+ "lightbox.hintZoom": "ESC para sair · rolagem para zoom · arraste para mover",
758
+ "lightbox.loading": "Carregando mídia…",
759
+ "lightbox.zoomInChip": "Ampliar",
760
+ "lightbox.zoomOutChip": "Reduzir",
761
+ "lightbox.openChip": "Abrir",
762
+ "lightbox.revealChip": "Mostrar",
763
+ "lightbox.copyChip": "Copiar caminho",
764
+ "lightbox.copiedChip": "✓ Copiado",
765
+ "lightbox.closeChip": "Fechar",
766
+ "mermaid.viewSource": "Ver código",
767
+ "mermaid.viewDiagram": "Ver diagrama",
768
+ "mermaid.toggle": "Alternar entre o diagrama e o código",
769
+ "mermaid.parseFailed": "⚠️ Não foi possível renderizar este diagrama Mermaid; o código foi mantido abaixo.",
770
+ "compaction.contextCompacted": "Contexto compactado",
771
+ "question.insert": "💬 Inserir no chat",
772
+ "question.inserted": "✓ Inserido no chat",
773
+ "question.recorded": "Registrado: {value}",
534
774
  "account.proxyPlaceholder": "URL de proxy dedicada (ex.: http://127.0.0.1:7890; deixe vazio para herdar a global)",
535
775
  "account.aliasPlaceholder": "Apelido da conta (por exemplo: Conta reserva 2)",
536
776
  "account.removeTitle": "Remover esta conta",
@@ -547,10 +787,10 @@ window.__ModuleLoader__.load({
547
787
  "account.syncing": "Sincronizando...",
548
788
  "account.syncTitle": "Atualizar esta conta (sincroniza e-mail, cota e modelos depois de trocar de conta)",
549
789
  "account.models": "Detalhes por modelo:",
550
- "account.cooldown": "Alguns modelos estão limitados; a conta foi alternada automaticamente",
551
790
  "account.clearCooldown": "Limpar espera",
552
- "account.localCooldown": " · espera local ativa",
553
- "account.quotaLimitedNote": " · limitado",
791
+ "account.clearCooldownDone": "Espera limpa",
792
+ "account.collapsedCoolingHint": " ({families} em espera)",
793
+ "account.poolHeading": "Pool de contas ({count})",
554
794
  "account.removed": "Conta removida: {alias}",
555
795
  "quota.fiveHour": "Cota de 5 horas",
556
796
  "quota.weekly": "Cota semanal",
@@ -669,6 +909,11 @@ window.__ModuleLoader__.load({
669
909
  "warmup.success": "Conta aquecida com sucesso",
670
910
  "warmup.allSuccess": "Pré-aquecimento concluído",
671
911
  "warmup.skipped": "Conta em espera, sem necessidade de aquecimento",
912
+ "warmup.started": "Pré-aquecimento em segundo plano; pode fechar esta janela",
913
+ "warmup.alreadyRunning": "O pré-aquecimento já está em andamento",
914
+ "warmup.progress": "Aquecendo {completed}/{total}",
915
+ "warmup.progressCurrent": "Aquecendo {completed}/{total} · {account}",
916
+ "warmup.lastRun": "Último aquecimento {time} · {ok} ok · {skipped} ignoradas · {failed} falhas",
672
917
  "config.autoWarmup": "Pré-aquecimento automático de 7 dias",
673
918
  "config.autoWarmupDesc": "Ativa automaticamente um ciclo quando o tempo de redefinição semanal é atingido",
674
919
  "config.autoTranslate": "Tradução automática",
@@ -682,9 +927,9 @@ window.__ModuleLoader__.load({
682
927
  "config.image": "Geração de imagem",
683
928
  "config.imageDesc": "generate_image nativo do agy; headless via dsh-agy-image, usando o mesmo pool de contas e trocando em falhas de cota/região",
684
929
  "config.imageModel": "Modelo de imagem",
685
- "config.imageModelDesc": "Modelo que conduz o generate_image; padrão é o modelo padrão do plugin",
930
+ "config.imageModelDesc": "Modelo que conduz generate_image / image-generator; auto prefere Gemini 4 Hydrogen (ou Gemini 3.8 Flash)",
686
931
  "config.imageEffort": "Esforço da imagem",
687
- "config.imageEffortDesc": "low costuma bastar; o modelo de imagem é o custo real",
932
+ "config.imageEffortDesc": "Esforço para planejar e revisar a imagem; padrão medium (equilibrado), high/xhigh demoram mais",
688
933
  "config.imageCopy": "Copiar comando",
689
934
  "config.imageCopied": "Comando copiado",
690
935
  "config.imageCopyFailed": "Falha ao copiar — selecione o comando manualmente",
@@ -697,9 +942,49 @@ window.__ModuleLoader__.load({
697
942
  "config.on": "Ativado",
698
943
  "config.off": "Desativado",
699
944
  "config.runtimeTitle": "Execução",
700
- "config.runtimeDesc": "O modo de permissão é fixo em skip (execução sem supervisão; as proteções internas do AGY continuam ativas). A intensidade de raciocínio é definida em “Intensidade de raciocínio padrão” abaixo, que serve de valor inicial no menu de modelos da sessão — ainda pode ser trocada por modelo lá.",
945
+ "config.runtimeDesc": "Configure o modo de permissão, sandbox, transporte e esforço de raciocínio padrão (ainda substituível por modelo no seletor da sessão).",
701
946
  "config.defaultEffort": "Intensidade de raciocínio padrão",
702
947
  "config.defaultEffortDesc": "auto = cada modelo mantém o próprio padrão; um nível fixo define o valor inicial do menu de modelos da sessão e ainda pode ser substituído por modelo",
948
+ "config.permissionMode": "Modo de permissão",
949
+ "config.permissionModeDesc": "Política de aprovação de ferramentas no agy CLI (auto revisa ações críticas; skip sem supervisão)",
950
+ "config.modeSkip": "Skip (automático)",
951
+ "config.modeAuto": "Auto (seguro)",
952
+ "config.modeAcceptEdits": "Aceitar edições",
953
+ "config.modePlan": "Plan (somente leitura)",
954
+ "config.sandbox": "Sandbox de terminal (--sandbox)",
955
+ "config.sandboxDesc": "Ativa isolamento de terminal no SO para proteger ~/.ssh e credenciais",
956
+ "config.transport": "Transporte de execução",
957
+ "config.transportDesc": "cli = subprocesso -p por turno; acp = servidor JSON-RPC persistente (com fallback para CLI)",
958
+ "config.transportCli": "CLI (-p)",
959
+ "config.transportAcp": "ACP persistente",
960
+ "config.acpStats": "{procs} proc · {sessions} sess.",
961
+ "config.imageTool": "Ferramenta de imagem no chat (agy_image)",
962
+ "config.imageToolDesc": "Registra agy_image para qualquer modelo gerar ou editar imagens via agy",
963
+ "config.syncCustomizations": "Sincronização de ecossistema multi-conta",
964
+ "config.syncCustomizationsDesc": "Espelha Plugins, MCP, Skills, Rules e Agents da conta principal para contas isoladas do pool",
965
+ "config.agent": "Agente personalizado (--agent)",
966
+ "config.agentDesc": "Nome do agente Markdown personalizado; deixe em branco para usar o padrão",
967
+ "config.agentPlaceholder": "Nome do agente (vazio = padrão)",
968
+ "config.save": "Salvar",
969
+ "config.clear": "Limpar",
970
+ "eco.heading": "Ecossistema Antigravity",
971
+ "eco.desc": "Plugins · MCP · Agents · Skills · Rules principais e do workspace",
972
+ "eco.expand": "Expandir",
973
+ "eco.collapse": "Recolher",
974
+ "eco.syncNow": "Sincronizar pool",
975
+ "eco.syncing": "Sincronizando…",
976
+ "eco.synced": "{accounts} conta(s) sincronizada(s) (+{copied} / -{removed})",
977
+ "eco.syncFailed": "Falha na sincronização do ecossistema",
978
+ "eco.plugins": "Plugins ({count})",
979
+ "eco.mcp": "Servidores MCP ({count})",
980
+ "eco.agents": "Agentes ({count})",
981
+ "eco.skills": "Skills ({count})",
982
+ "eco.rules": "Regras ({count})",
983
+ "eco.empty": "Nenhum plugin, servidor MCP, skill, regra ou agente encontrado",
984
+ "eco.useAgent": "Usar",
985
+ "eco.activeAgent": "Ativo",
986
+ "eco.pluginToggled": "Plugin {id} atualizado",
987
+ "eco.toggleFailed": "Falha ao alternar plugin",
703
988
  "tsl.badge": "Tradução do Gemini",
704
989
  "tsl.plain": "Linguagem simples",
705
990
  "tsl.translate": "Traduzir para linguagem simples",
@@ -751,13 +1036,12 @@ window.__ModuleLoader__.load({
751
1036
  "status.loading": "Cargando el estado de Antigravity...",
752
1037
  "status.authRequired": "Debe iniciar sesión de nuevo",
753
1038
  "status.cooldown": "En espera",
754
- "status.quotaLimited": "Limitado",
755
1039
  "status.tosBanned": "Suspendida (ToS)",
756
1040
  "status.validationRequired": "Verificación requerida",
757
- "account.setActive": "Establecer como en uso",
1041
+ "account.setActive": "Usar ahora",
758
1042
  "account.settingActive": "Cambiando...",
759
1043
  "account.activeSet": "Cuenta en uso cambiada",
760
- "account.activeSetFailed": "Cuenta no elegible ahora (enfriamiento, límite de cuota o requiere login)",
1044
+ "account.activeSetFailed": "Cuenta no elegible ahora para este grupo (en espera o requiere login)",
761
1045
  "account.reauth": "Iniciar sesión de nuevo",
762
1046
  "account.reauthing": "Iniciando...",
763
1047
  "account.reauthTitle": "Reautenticar esta cuenta en su sitio (conserva alias, proxy y prioridad)",
@@ -769,6 +1053,57 @@ window.__ModuleLoader__.load({
769
1053
  "decision.quickFill": "💬 Haz clic en una opción para rellenarla:",
770
1054
  "decision.insertTooltip": "Insertar: {text}",
771
1055
  "decision.insertPayload": "Elijo {choice}",
1056
+ "image.zoomHint": "{alt} (clic para ver a pantalla completa)",
1057
+ "image.previewTitle": "Vista previa ({name})",
1058
+ "image.previewChip": "Ver",
1059
+ "image.playTitle": "Reproducir vídeo ({name})",
1060
+ "image.playChip": "Reproducir",
1061
+ "image.lightboxHint": "Clic para abrir vista ampliada",
1062
+ "audio.toggleTitle": "Reproducir/alternar audio ({name})",
1063
+ "audio.listenChip": "Escuchar",
1064
+ "audio.openBtn": "Abrir",
1065
+ "embed.collapse": "Contraer",
1066
+ "embed.expand": "Expandir",
1067
+ "embed.source": "Código",
1068
+ "file.openedInSidebar": "Abierto en la barra lateral: {name}",
1069
+ "file.openedInSystem": "Abierto en la app del sistema: {name}",
1070
+ "file.openFailed": "No se pudo abrir: {error}",
1071
+ "file.notFound": "archivo no encontrado",
1072
+ "lightbox.zoomIn": "Acercar",
1073
+ "lightbox.zoomOut": "Alejar",
1074
+ "lightbox.reset": "Tamaño real (1:1)",
1075
+ "lightbox.openWithApp": "Abrir con la app predeterminada",
1076
+ "lightbox.reveal": "Mostrar en el gestor de archivos",
1077
+ "lightbox.copyPath": "Copiar la ruta completa",
1078
+ "lightbox.close": "Cerrar (ESC)",
1079
+ "lightbox.unavailableTitle": "Vista previa no disponible",
1080
+ "lightbox.unavailableHint": "El archivo puede estar generándose, haberse movido o necesitar una app externa.",
1081
+ "lightbox.revealAction": "Mostrar en el gestor de archivos",
1082
+ "lightbox.revealed": "Mostrado en el gestor de archivos",
1083
+ "lightbox.revealFailed": "No se pudo localizar el archivo",
1084
+ "lightbox.revealFailedDetail": "No se pudo mostrar: {error}",
1085
+ "lightbox.openedInApp": "Abierto en la app del sistema",
1086
+ "lightbox.openFailed": "No se pudo abrir: {error}",
1087
+ "lightbox.unknownError": "error desconocido",
1088
+ "lightbox.pathCopied": "Ruta copiada al portapapeles",
1089
+ "lightbox.hintClose": "ESC para salir · clic en el fondo para cerrar",
1090
+ "lightbox.hintZoom": "ESC para salir · rueda para zoom · arrastrar para mover",
1091
+ "lightbox.loading": "Cargando contenido…",
1092
+ "lightbox.zoomInChip": "Acercar",
1093
+ "lightbox.zoomOutChip": "Alejar",
1094
+ "lightbox.openChip": "Abrir",
1095
+ "lightbox.revealChip": "Mostrar",
1096
+ "lightbox.copyChip": "Copiar ruta",
1097
+ "lightbox.copiedChip": "✓ Copiado",
1098
+ "lightbox.closeChip": "Cerrar",
1099
+ "mermaid.viewSource": "Ver código",
1100
+ "mermaid.viewDiagram": "Ver diagrama",
1101
+ "mermaid.toggle": "Alternar entre el diagrama y su código",
1102
+ "mermaid.parseFailed": "⚠️ No se pudo renderizar este diagrama Mermaid; el código se mantiene abajo.",
1103
+ "compaction.contextCompacted": "Contexto compactado",
1104
+ "question.insert": "💬 Insertar en el chat",
1105
+ "question.inserted": "✓ Insertado en el chat",
1106
+ "question.recorded": "Registrado: {value}",
772
1107
  "account.proxyPlaceholder": "URL de proxy dedicada (p. ej., http://127.0.0.1:7890; déjalo vacío para heredar la global)",
773
1108
  "account.aliasPlaceholder": "Alias de la cuenta (por ejemplo: Cuenta de respaldo 2)",
774
1109
  "account.removeTitle": "Eliminar esta cuenta",
@@ -785,10 +1120,10 @@ window.__ModuleLoader__.load({
785
1120
  "account.syncing": "Sincronizando...",
786
1121
  "account.syncTitle": "Actualizar esta cuenta (sincroniza correo, cuota y modelos tras cambiar de cuenta)",
787
1122
  "account.models": "Detalles por modelo:",
788
- "account.cooldown": "Algunos modelos tienen límite de uso; la cuenta se cambió automáticamente",
789
1123
  "account.clearCooldown": "Borrar espera",
790
- "account.localCooldown": " · espera local activa",
791
- "account.quotaLimitedNote": " · limitado",
1124
+ "account.clearCooldownDone": "Espera borrada",
1125
+ "account.collapsedCoolingHint": " ({families} en espera)",
1126
+ "account.poolHeading": "Pool de cuentas ({count})",
792
1127
  "account.removed": "Cuenta eliminada: {alias}",
793
1128
  "quota.fiveHour": "Cuota de 5 horas",
794
1129
  "quota.weekly": "Cuota semanal",
@@ -907,6 +1242,11 @@ window.__ModuleLoader__.load({
907
1242
  "warmup.success": "Cuenta calentada con éxito",
908
1243
  "warmup.allSuccess": "Precalentamiento completado",
909
1244
  "warmup.skipped": "Cuenta en espera, sin necesidad de calentar",
1245
+ "warmup.started": "Precalentamiento en segundo plano; puede cerrar esta ventana",
1246
+ "warmup.alreadyRunning": "El precalentamiento ya está en curso",
1247
+ "warmup.progress": "Calentando {completed}/{total}",
1248
+ "warmup.progressCurrent": "Calentando {completed}/{total} · {account}",
1249
+ "warmup.lastRun": "Último calentamiento {time} · {ok} ok · {skipped} omitidas · {failed} fallidas",
910
1250
  "config.autoWarmup": "Precalentamiento automático de 7 días",
911
1251
  "config.autoWarmupDesc": "Activa automáticamente un ciclo cuando se alcanza el tiempo de reinicio semanal",
912
1252
  "config.autoTranslate": "Traducción automática",
@@ -920,9 +1260,9 @@ window.__ModuleLoader__.load({
920
1260
  "config.image": "Generación de imagen",
921
1261
  "config.imageDesc": "generate_image nativo de agy; headless con dsh-agy-image, usando el mismo pool de cuentas y rotando ante fallos de cuota/región",
922
1262
  "config.imageModel": "Modelo de imagen",
923
- "config.imageModelDesc": "Modelo que impulsa generate_image; por defecto el modelo predeterminado del plugin",
1263
+ "config.imageModelDesc": "Modelo que impulsa generate_image / image-generator; auto prefiere Gemini 4 Hydrogen (o Gemini 3.8 Flash)",
924
1264
  "config.imageEffort": "Esfuerzo de imagen",
925
- "config.imageEffortDesc": "low suele bastar; el modelo de imagen es el coste real",
1265
+ "config.imageEffortDesc": "Esfuerzo para planificar y revisar la imagen; medium por defecto (equilibrado), high/xhigh tardan más",
926
1266
  "config.imageCopy": "Copiar comando",
927
1267
  "config.imageCopied": "Comando copiado",
928
1268
  "config.imageCopyFailed": "Error al copiar — selecciona el comando manualmente",
@@ -935,9 +1275,49 @@ window.__ModuleLoader__.load({
935
1275
  "config.on": "Activado",
936
1276
  "config.off": "Desactivado",
937
1277
  "config.runtimeTitle": "Ejecución",
938
- "config.runtimeDesc": "El modo de permisos está fijo en skip (ejecución desatendida; las protecciones internas de AGY siguen activas). La intensidad de razonamiento la define “Intensidad de razonamiento predeterminada” abajo, que fija el valor inicial del menú de modelos de la sesión — allí todavía puedes cambiarla por modelo.",
1278
+ "config.runtimeDesc": "Configura el modo de permisos, sandbox, transporte e intensidad de razonamiento predeterminada (ajustable por modelo en el selector de sesión).",
939
1279
  "config.defaultEffort": "Intensidad de razonamiento predeterminada",
940
1280
  "config.defaultEffortDesc": "auto = cada modelo usa su propio valor por defecto; un nivel fijo fija el valor inicial del menú de modelos de la sesión y aún puede sobrescribirse por modelo",
1281
+ "config.permissionMode": "Modo de permisos",
1282
+ "config.permissionModeDesc": "Política de aprobación de herramientas para agy CLI (auto revisa operaciones riesgosas; skip sin supervisión)",
1283
+ "config.modeSkip": "Skip (sin pausa)",
1284
+ "config.modeAuto": "Auto (seguro)",
1285
+ "config.modeAcceptEdits": "Aceptar ediciones",
1286
+ "config.modePlan": "Plan (solo lectura)",
1287
+ "config.sandbox": "Sandbox de terminal (--sandbox)",
1288
+ "config.sandboxDesc": "Activa el aislamiento de terminal del SO para proteger ~/.ssh y credenciales",
1289
+ "config.transport": "Transporte de ejecución",
1290
+ "config.transportDesc": "cli = subproceso -p por turno; acp = servidor JSON-RPC persistente (con respaldo a CLI)",
1291
+ "config.transportCli": "CLI (-p)",
1292
+ "config.transportAcp": "ACP persistente",
1293
+ "config.acpStats": "{procs} proc · {sessions} ses.",
1294
+ "config.imageTool": "Herramienta de imagen en chat (agy_image)",
1295
+ "config.imageToolDesc": "Registra agy_image para que cualquier modelo genere o edite imágenes con agy",
1296
+ "config.syncCustomizations": "Sincronización de ecosistema multi-cuenta",
1297
+ "config.syncCustomizationsDesc": "Refleja automáticamente Plugins, MCP, Skills, Rules y Agents en cuentas aisladas del pool",
1298
+ "config.agent": "Agente personalizado (--agent)",
1299
+ "config.agentDesc": "Nombre del agente Markdown personalizado; déjalo vacío para el agente predeterminado",
1300
+ "config.agentPlaceholder": "Nombre del agente (vacío = predeterminado)",
1301
+ "config.save": "Guardar",
1302
+ "config.clear": "Limpiar",
1303
+ "eco.heading": "Ecosistema Antigravity",
1304
+ "eco.desc": "Plugins · MCP · Agents · Skills · Rules principales y del espacio de trabajo",
1305
+ "eco.expand": "Expandir",
1306
+ "eco.collapse": "Contraer",
1307
+ "eco.syncNow": "Sincronizar pool",
1308
+ "eco.syncing": "Sincronizando…",
1309
+ "eco.synced": "{accounts} cuenta(s) sincronizada(s) (+{copied} / -{removed})",
1310
+ "eco.syncFailed": "Error al sincronizar ecosistema",
1311
+ "eco.plugins": "Plugins ({count})",
1312
+ "eco.mcp": "Servidores MCP ({count})",
1313
+ "eco.agents": "Agentes ({count})",
1314
+ "eco.skills": "Skills ({count})",
1315
+ "eco.rules": "Reglas ({count})",
1316
+ "eco.empty": "No se detectaron plugins, servidores MCP, skills, reglas ni agentes",
1317
+ "eco.useAgent": "Usar",
1318
+ "eco.activeAgent": "Activo",
1319
+ "eco.pluginToggled": "Plugin {id} actualizado",
1320
+ "eco.toggleFailed": "Error al cambiar estado del plugin",
941
1321
  "tsl.badge": "Traducción de Gemini",
942
1322
  "tsl.plain": "Lenguaje sencillo",
943
1323
  "tsl.translate": "Traducir a lenguaje sencillo",
@@ -1736,6 +2116,81 @@ window.__ModuleLoader__.load({
1736
2116
  fill: "currentColor"
1737
2117
  }));
1738
2118
  }
2119
+ function glyph(size, className, ...paths) {
2120
+ return hx("svg", {
2121
+ width: size,
2122
+ height: size,
2123
+ className: className || void 0,
2124
+ viewBox: "0 0 16 16",
2125
+ fill: "none",
2126
+ stroke: "currentColor",
2127
+ strokeWidth: 1.5,
2128
+ strokeLinecap: "round",
2129
+ strokeLinejoin: "round",
2130
+ style: {
2131
+ display: "block",
2132
+ flexShrink: 0
2133
+ },
2134
+ "aria-hidden": true
2135
+ }, ...paths);
2136
+ }
2137
+ function IconSwarm16(size = 14, className = "") {
2138
+ return glyph(size, className, hx("circle", {
2139
+ cx: 8,
2140
+ cy: 3.5,
2141
+ r: 1.7
2142
+ }), hx("circle", {
2143
+ cx: 3.5,
2144
+ cy: 12,
2145
+ r: 1.7
2146
+ }), hx("circle", {
2147
+ cx: 12.5,
2148
+ cy: 12,
2149
+ r: 1.7
2150
+ }), hx("path", { d: "M6.8 4.9L4.5 10.4M9.2 4.9L11.5 10.4M5.2 12h5.6" }));
2151
+ }
2152
+ function IconWorkflow16(size = 14, className = "") {
2153
+ return glyph(size, className, hx("rect", {
2154
+ x: 1.8,
2155
+ y: 2,
2156
+ width: 4.5,
2157
+ height: 3.5,
2158
+ rx: 1
2159
+ }), hx("rect", {
2160
+ x: 9.7,
2161
+ y: 2,
2162
+ width: 4.5,
2163
+ height: 3.5,
2164
+ rx: 1
2165
+ }), hx("rect", {
2166
+ x: 5.75,
2167
+ y: 10.5,
2168
+ width: 4.5,
2169
+ height: 3.5,
2170
+ rx: 1
2171
+ }), hx("path", { d: "M4 5.5V8h8V5.5M8 8v2.5" }));
2172
+ }
2173
+ function IconSchedule16(size = 14, className = "") {
2174
+ return glyph(size, className, hx("circle", {
2175
+ cx: 8,
2176
+ cy: 8,
2177
+ r: 5.8
2178
+ }), hx("path", { d: "M8 4.8V8l2.4 1.6" }));
2179
+ }
2180
+ function IconSubagent16(size = 14, className = "") {
2181
+ return glyph(size, className, hx("circle", {
2182
+ cx: 8,
2183
+ cy: 5.2,
2184
+ r: 2.5
2185
+ }), hx("path", { d: "M3.2 13.5c.6-2.4 2.3-3.6 4.8-3.6s4.2 1.2 4.8 3.6" }));
2186
+ }
2187
+ function IconBrowser16(size = 14, className = "") {
2188
+ return glyph(size, className, hx("circle", {
2189
+ cx: 8,
2190
+ cy: 8,
2191
+ r: 5.8
2192
+ }), hx("path", { d: "M2.4 8h11.2M8 2.2c1.7 1.6 2.5 3.6 2.5 5.8S9.7 12.2 8 13.8M8 2.2C6.3 3.8 5.5 5.8 5.5 8s.8 4.2 2.5 5.8" }));
2193
+ }
1739
2194
  function toolIconFor(kind, size = 14) {
1740
2195
  switch (kind) {
1741
2196
  case "terminal": return IconApiOutline14(size);
@@ -1746,6 +2201,12 @@ window.__ModuleLoader__.load({
1746
2201
  case "list": return IconSearchOutline16(size);
1747
2202
  case "question": return IconQuestionOutline16(size);
1748
2203
  case "image": return IconImageOutline16(size);
2204
+ case "swarm": return IconSwarm16(size);
2205
+ case "workflow": return IconWorkflow16(size);
2206
+ case "schedule":
2207
+ case "task": return IconSchedule16(size);
2208
+ case "subagent": return IconSubagent16(size);
2209
+ case "browser": return IconBrowser16(size);
1749
2210
  default: return IconCodeOutline16(size);
1750
2211
  }
1751
2212
  }
@@ -1841,6 +2302,37 @@ window.__ModuleLoader__.load({
1841
2302
  overlaySuspendRefs = 0;
1842
2303
  }
1843
2304
  //#endregion
2305
+ //#region src/client/i18n-bridge.ts
2306
+ /** Fill `{name}` placeholders in a template. */
2307
+ function fillTemplate(template, params) {
2308
+ return template.replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? ""));
2309
+ }
2310
+ let active = null;
2311
+ /**
2312
+ * Bind the plugin's locale service. Safe to call more than once (a plugin
2313
+ * reload replaces the binding), and tolerant of a host without `locale`.
2314
+ */
2315
+ function bindTranslator(ctx) {
2316
+ try {
2317
+ const bound = (ctx?.locale)?.bind?.(NS);
2318
+ active = typeof bound === "function" ? bound : null;
2319
+ } catch {
2320
+ active = null;
2321
+ }
2322
+ }
2323
+ /**
2324
+ * Translate a key, falling back to `fallback` (English) when no locale service is
2325
+ * bound or the key is missing. The fallback is the source of truth for copy that
2326
+ * must never render as a bare key.
2327
+ */
2328
+ function translateOr(key, fallback, params) {
2329
+ if (active !== null) try {
2330
+ const value = active(key, params);
2331
+ if (typeof value === "string" && value !== "" && value !== key) return value;
2332
+ } catch {}
2333
+ return fillTemplate(fallback, params);
2334
+ }
2335
+ //#endregion
1844
2336
  //#region src/common/timeouts.ts
1845
2337
  /** Status poll: keep the console responsive, never stack polls. */
1846
2338
  const STATUS_TIMEOUT_MS = 5e3;
@@ -1880,6 +2372,18 @@ window.__ModuleLoader__.load({
1880
2372
  return null;
1881
2373
  }
1882
2374
  }
2375
+ async function getJson(path) {
2376
+ try {
2377
+ const init = {};
2378
+ const signal = timedSignal(STATUS_TIMEOUT_MS);
2379
+ if (signal !== void 0) init.signal = signal;
2380
+ const res = await win$1.fetch?.(base$1 + path, init);
2381
+ if (!res || !res.ok) return null;
2382
+ return await res.json();
2383
+ } catch {
2384
+ return null;
2385
+ }
2386
+ }
1883
2387
  /** Small typed endpoint helper for the account-pool actions. */
1884
2388
  function postPool(action, body = {}, timeoutMs) {
1885
2389
  return postJson(`${PLUGIN_BASE}/pool/${action}`, body, timeoutMs ?? (action === "warmup" ? 9e4 : 2e4));
@@ -1921,7 +2425,13 @@ window.__ModuleLoader__.load({
1921
2425
  function isVideoFile(pathOrUrl) {
1922
2426
  if (!pathOrUrl || typeof pathOrUrl !== "string") return false;
1923
2427
  const clean = pathOrUrl.split(/[?#]/)[0] ?? "";
1924
- return /\.(mp4|webm|mov|mkv)$/i.test(clean);
2428
+ return /\.(mp4|webm|mov|mkv|ogv)$/i.test(clean);
2429
+ }
2430
+ /** Check if a URL or path is an audio file */
2431
+ function isAudioFile(pathOrUrl) {
2432
+ if (!pathOrUrl || typeof pathOrUrl !== "string") return false;
2433
+ const clean = pathOrUrl.split(/[?#]/)[0] ?? "";
2434
+ return /\.(mp3|wav|ogg|m4a|aac|flac|opus)$/i.test(clean);
1925
2435
  }
1926
2436
  /** Check if a URL or path represents a local file or relative path */
1927
2437
  function isLocalFilePath(pathOrUrl) {
@@ -2367,6 +2877,58 @@ window.__ModuleLoader__.load({
2367
2877
  color: #94a3b8;
2368
2878
  line-height: 1.5;
2369
2879
  }
2880
+
2881
+ .agy-chip-audio {
2882
+ color: #10b981;
2883
+ background: rgba(16, 185, 129, 0.1);
2884
+ border-color: rgba(16, 185, 129, 0.28);
2885
+ }
2886
+ .agy-chip-audio:hover {
2887
+ background: rgba(16, 185, 129, 0.22);
2888
+ border-color: rgba(16, 185, 129, 0.5);
2889
+ color: #34d399;
2890
+ }
2891
+ .agy-audio-card {
2892
+ display: flex;
2893
+ flex-direction: column;
2894
+ gap: 6px;
2895
+ margin: 6px 0;
2896
+ padding: 8px 10px;
2897
+ max-width: 420px;
2898
+ border-radius: 10px;
2899
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.25));
2900
+ background: var(--dsw-alias-markdown-code-block, rgba(127, 127, 127, 0.06));
2901
+ }
2902
+ .agy-audio-card-head {
2903
+ display: flex;
2904
+ align-items: center;
2905
+ justify-content: space-between;
2906
+ gap: 8px;
2907
+ }
2908
+ .agy-audio-card-title {
2909
+ font-size: 12px;
2910
+ font-weight: 600;
2911
+ color: var(--dsw-alias-label-primary, #334155);
2912
+ overflow: hidden;
2913
+ text-overflow: ellipsis;
2914
+ white-space: nowrap;
2915
+ }
2916
+ .agy-audio-card-open {
2917
+ font-size: 11px;
2918
+ padding: 1px 7px;
2919
+ border-radius: 4px;
2920
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.25));
2921
+ background: transparent;
2922
+ color: var(--dsw-alias-label-secondary, #64748b);
2923
+ cursor: pointer;
2924
+ }
2925
+ .agy-audio-card-open:hover {
2926
+ color: var(--dsw-alias-label-primary, #0f172a);
2927
+ }
2928
+ .agy-audio-player {
2929
+ width: 100%;
2930
+ height: 34px;
2931
+ }
2370
2932
  `;
2371
2933
  function injectStyles$5() {
2372
2934
  if (typeof document === "undefined") return;
@@ -2412,23 +2974,23 @@ window.__ModuleLoader__.load({
2412
2974
  if (!isVideo) {
2413
2975
  const btnZoomIn = document.createElement("button");
2414
2976
  btnZoomIn.className = "agy-lightbox-btn";
2415
- btnZoomIn.title = "放大 / Zoom In";
2416
- btnZoomIn.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line></svg></span><span class=\"agy-btn-text\">放大</span><span style=\"display:none\">🔍+</span>";
2977
+ btnZoomIn.title = translateOr("lightbox.zoomIn", "Zoom in");
2978
+ btnZoomIn.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.zoomInChip", "Zoom in") + "</span><span style=\"display:none\">🔍+</span>";
2417
2979
  btnZoomIn.onclick = (e) => {
2418
2980
  e.stopPropagation();
2419
2981
  callbacks.onZoomIn();
2420
2982
  };
2421
2983
  const btnZoomOut = document.createElement("button");
2422
2984
  btnZoomOut.className = "agy-lightbox-btn";
2423
- btnZoomOut.title = "缩小 / Zoom Out";
2424
- btnZoomOut.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line></svg></span><span class=\"agy-btn-text\">缩小</span><span style=\"display:none\">🔍-</span>";
2985
+ btnZoomOut.title = translateOr("lightbox.zoomOut", "Zoom out");
2986
+ btnZoomOut.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.zoomOutChip", "Zoom out") + "</span><span style=\"display:none\">🔍-</span>";
2425
2987
  btnZoomOut.onclick = (e) => {
2426
2988
  e.stopPropagation();
2427
2989
  callbacks.onZoomOut();
2428
2990
  };
2429
2991
  const btnReset = document.createElement("button");
2430
2992
  btnReset.className = "agy-lightbox-btn";
2431
- btnReset.title = "实际大小 / Reset (1:1)";
2993
+ btnReset.title = translateOr("lightbox.reset", "Actual size (1:1)");
2432
2994
  btnReset.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3\"></path></svg></span><span class=\"agy-btn-text\">1:1</span>";
2433
2995
  btnReset.onclick = (e) => {
2434
2996
  e.stopPropagation();
@@ -2441,37 +3003,37 @@ window.__ModuleLoader__.load({
2441
3003
  if (rawPath) {
2442
3004
  const btnOpen = document.createElement("button");
2443
3005
  btnOpen.className = "agy-lightbox-btn";
2444
- btnOpen.title = "用系统默认应用打开 / Open with default app";
2445
- btnOpen.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path><polyline points=\"15 3 21 3 21 9\"></polyline><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"></line></svg></span><span class=\"agy-btn-text\">打开</span>";
3006
+ btnOpen.title = translateOr("lightbox.openWithApp", "Open with the default app");
3007
+ btnOpen.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path><polyline points=\"15 3 21 3 21 9\"></polyline><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"></line></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.openChip", "Open") + "</span>";
2446
3008
  btnOpen.onclick = (e) => {
2447
3009
  e.stopPropagation();
2448
3010
  openInSystem(rawPath, false).then((res) => {
2449
- showToast(res.ok ? "已在系统应用中打开" : `打开失败: ${res.error || "未知错误"}`);
3011
+ showToast(res.ok ? translateOr("lightbox.openedInApp", "Opened in the system app") : translateOr("lightbox.openFailed", "Could not open: {error}", { error: res.error || translateOr("lightbox.unknownError", "unknown error") }));
2450
3012
  });
2451
3013
  };
2452
3014
  actions.appendChild(btnOpen);
2453
3015
  const btnReveal = document.createElement("button");
2454
3016
  btnReveal.className = "agy-lightbox-btn";
2455
- btnReveal.title = "在访达 / 资源管理器中显示 (Reveal in File Manager)";
2456
- btnReveal.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"></path></svg></span><span class=\"agy-btn-text\">定位</span>";
3017
+ btnReveal.title = translateOr("lightbox.reveal", "Reveal in the file manager");
3018
+ btnReveal.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"></path></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.revealChip", "Reveal") + "</span>";
2457
3019
  btnReveal.onclick = (e) => {
2458
3020
  e.stopPropagation();
2459
3021
  openInSystem(rawPath, true).then((res) => {
2460
- showToast(res.ok ? "已在文件管理器中定位" : `定位失败: ${res.error || "未知错误"}`);
3022
+ showToast(res.ok ? translateOr("lightbox.revealed", "Revealed in the file manager") : translateOr("lightbox.revealFailedDetail", "Could not reveal: {error}", { error: res.error || translateOr("lightbox.unknownError", "unknown error") }));
2461
3023
  });
2462
3024
  };
2463
3025
  actions.appendChild(btnReveal);
2464
3026
  const btnCopyPath = document.createElement("button");
2465
3027
  btnCopyPath.className = "agy-lightbox-btn";
2466
- btnCopyPath.title = "复制完整文件路径";
2467
- btnCopyPath.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg></span><span class=\"agy-btn-text\">复制路径</span>";
3028
+ btnCopyPath.title = translateOr("lightbox.copyPath", "Copy the full file path");
3029
+ btnCopyPath.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.copyChip", "Copy path") + "</span>";
2468
3030
  btnCopyPath.onclick = (e) => {
2469
3031
  e.stopPropagation();
2470
3032
  if (navigator.clipboard) navigator.clipboard.writeText(rawPath).then(() => {
2471
- showToast("文件路径已复制到剪贴板");
2472
- btnCopyPath.innerHTML = "<span class=\"agy-btn-text\">✓ 已复制</span>";
3033
+ showToast(translateOr("lightbox.pathCopied", "File path copied to the clipboard"));
3034
+ btnCopyPath.innerHTML = "<span class=\"agy-btn-text\">" + translateOr("lightbox.copiedChip", "✓ Copied") + "</span>";
2473
3035
  setTimeout(() => {
2474
- btnCopyPath.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg></span><span class=\"agy-btn-text\">复制路径</span>";
3036
+ btnCopyPath.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.copyChip", "Copy path") + "</span>";
2475
3037
  }, 1500);
2476
3038
  }).catch(() => {});
2477
3039
  };
@@ -2482,8 +3044,8 @@ window.__ModuleLoader__.load({
2482
3044
  actions.appendChild(divider);
2483
3045
  const btnClose = document.createElement("button");
2484
3046
  btnClose.className = "agy-lightbox-btn agy-lightbox-btn-close";
2485
- btnClose.title = "关闭 (ESC)";
2486
- btnClose.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></span><span class=\"agy-btn-text\">关闭</span><span style=\"display:none\">✕ 关闭</span>";
3047
+ btnClose.title = translateOr("lightbox.close", "Close (ESC)");
3048
+ btnClose.innerHTML = "<span class=\"agy-lightbox-btn-icon\"><svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></span><span class=\"agy-btn-text\">" + translateOr("lightbox.closeChip", "Close") + "</span><span style=\"display:none\">✕ " + translateOr("lightbox.closeChip", "Close") + "</span>";
2487
3049
  btnClose.onclick = (e) => {
2488
3050
  e.stopPropagation();
2489
3051
  callbacks.onClose();
@@ -2500,13 +3062,13 @@ window.__ModuleLoader__.load({
2500
3062
  errorIcon.innerHTML = "<svg width=\"36\" height=\"36\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#f87171\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line></svg>";
2501
3063
  const errorTitle = document.createElement("div");
2502
3064
  errorTitle.className = "agy-lightbox-error-title";
2503
- errorTitle.textContent = "无法直接预览媒体 / Media Preview Unavailable";
3065
+ errorTitle.textContent = translateOr("lightbox.unavailableTitle", "Preview unavailable");
2504
3066
  const errorDesc = document.createElement("div");
2505
3067
  errorDesc.className = "agy-lightbox-error-desc";
2506
3068
  errorDesc.textContent = rawPath || src;
2507
3069
  const errorHint = document.createElement("div");
2508
3070
  errorHint.className = "agy-lightbox-error-hint";
2509
- errorHint.textContent = "文件可能正在生成中、已移动或格式需由外部应用呈现。";
3071
+ errorHint.textContent = translateOr("lightbox.unavailableHint", "The file may still be generating, may have moved, or needs an external app.");
2510
3072
  errorCard.appendChild(errorIcon);
2511
3073
  errorCard.appendChild(errorTitle);
2512
3074
  errorCard.appendChild(errorDesc);
@@ -2516,10 +3078,10 @@ window.__ModuleLoader__.load({
2516
3078
  btnRow.style.cssText = "display:flex;gap:8px;margin-top:14px;";
2517
3079
  const btnOpen = document.createElement("button");
2518
3080
  btnOpen.className = "agy-lightbox-btn";
2519
- btnOpen.textContent = "在访达/资源管理器中查找";
3081
+ btnOpen.textContent = translateOr("lightbox.revealAction", "Reveal in the file manager");
2520
3082
  btnOpen.onclick = () => {
2521
3083
  openInSystem(rawPath, true).then((r) => {
2522
- showToast(r.ok ? "已在文件管理器中定位" : "无法定位文件");
3084
+ showToast(r.ok ? translateOr("lightbox.revealed", "Revealed in the file manager") : translateOr("lightbox.revealFailed", "Could not locate the file"));
2523
3085
  });
2524
3086
  };
2525
3087
  btnRow.appendChild(btnOpen);
@@ -2597,7 +3159,7 @@ window.__ModuleLoader__.load({
2597
3159
  overlay.appendChild(header);
2598
3160
  const spinner = document.createElement("div");
2599
3161
  spinner.className = "agy-lightbox-spinner";
2600
- spinner.innerHTML = "<div class=\"agy-lightbox-spinner-ring\"></div><div class=\"agy-lightbox-spinner-text\">加载媒体中...</div>";
3162
+ spinner.innerHTML = "<div class=\"agy-lightbox-spinner-ring\"></div><div class=\"agy-lightbox-spinner-text\">" + translateOr("lightbox.loading", "Loading media…") + "</div>";
2601
3163
  const errorCard = buildErrorCard(rawPath, src);
2602
3164
  if (isVideo) {
2603
3165
  const video = document.createElement("video");
@@ -2642,7 +3204,7 @@ window.__ModuleLoader__.load({
2642
3204
  body.appendChild(imgWrap);
2643
3205
  const hints = document.createElement("div");
2644
3206
  hints.className = "agy-lightbox-hints";
2645
- hints.textContent = isVideo ? "ESC 退出 · 点击空白处关闭" : "ESC 退出 · 滚轮缩放 · 拖拽平移";
3207
+ hints.textContent = isVideo ? translateOr("lightbox.hintClose", "ESC to exit · click the backdrop to close") : translateOr("lightbox.hintZoom", "ESC to exit · scroll to zoom · drag to pan");
2646
3208
  overlay.appendChild(hints);
2647
3209
  overlay.appendChild(body);
2648
3210
  overlay.onclick = (e) => {
@@ -2685,6 +3247,63 @@ window.__ModuleLoader__.load({
2685
3247
  requestAnimationFrame(() => overlay.classList.add("open"));
2686
3248
  }
2687
3249
  //#endregion
3250
+ //#region src/client/images/audio.ts
3251
+ function enhanceAudioLink(link, rawHref, resolvedHref) {
3252
+ link.dataset.agyAudioEnhanced = "true";
3253
+ const pathToUse = rawHref.startsWith("file://") ? rawHref : resolvedHref.startsWith("file://") ? resolvedHref : rawHref || resolvedHref;
3254
+ const mediaUrl = buildMediaUrl(pathToUse);
3255
+ const fileName = (pathToUse.split(/[/\\]/).pop() || link.textContent || "Audio").trim();
3256
+ if (!link.querySelector(".agy-audio-link-icon")) {
3257
+ const badge = document.createElement("span");
3258
+ badge.className = "agy-image-link-chip agy-chip-audio agy-audio-link-icon";
3259
+ badge.setAttribute("role", "button");
3260
+ badge.setAttribute("tabindex", "0");
3261
+ badge.title = translateOr("audio.toggleTitle", "Play/toggle audio player ({name})", { name: fileName });
3262
+ badge.innerHTML = "<span class=\"agy-image-chip-icon\"><svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18V5l12-2v13\"/><circle cx=\"6\" cy=\"18\" r=\"3\"/><circle cx=\"18\" cy=\"16\" r=\"3\"/></svg></span><span class=\"agy-image-chip-text\">" + translateOr("audio.listenChip", "Listen") + "</span>";
3263
+ const togglePlayer = (e) => {
3264
+ e.preventDefault();
3265
+ e.stopPropagation();
3266
+ const next = link.nextElementSibling;
3267
+ if (next && next.classList.contains("agy-audio-card")) next.style.display = next.style.display === "none" ? "flex" : "none";
3268
+ };
3269
+ badge.onclick = togglePlayer;
3270
+ badge.onkeydown = (e) => {
3271
+ if (e.key === "Enter" || e.key === " ") togglePlayer(e);
3272
+ };
3273
+ link.appendChild(badge);
3274
+ }
3275
+ const next = link.nextElementSibling;
3276
+ if (next && next.classList.contains("agy-audio-card")) return;
3277
+ const card = document.createElement("div");
3278
+ card.className = "agy-audio-card";
3279
+ const header = document.createElement("div");
3280
+ header.className = "agy-audio-card-head";
3281
+ const title = document.createElement("span");
3282
+ title.className = "agy-audio-card-title";
3283
+ title.textContent = fileName;
3284
+ title.title = pathToUse;
3285
+ const revealBtn = document.createElement("button");
3286
+ revealBtn.type = "button";
3287
+ revealBtn.className = "agy-audio-card-open";
3288
+ revealBtn.textContent = translateOr("audio.openBtn", "Open");
3289
+ revealBtn.onclick = (e) => {
3290
+ e.stopPropagation();
3291
+ openInSystem(pathToUse, true).then((res) => {
3292
+ if (!res.ok) showToast(translateOr("file.openFailed", "Could not open: {error}", { error: res.error || translateOr("file.notFound", "file not found") }));
3293
+ });
3294
+ };
3295
+ header.appendChild(title);
3296
+ header.appendChild(revealBtn);
3297
+ const audio = document.createElement("audio");
3298
+ audio.className = "agy-audio-player";
3299
+ audio.controls = true;
3300
+ audio.preload = "metadata";
3301
+ audio.src = mediaUrl;
3302
+ card.appendChild(header);
3303
+ card.appendChild(audio);
3304
+ link.insertAdjacentElement("afterend", card);
3305
+ }
3306
+ //#endregion
2688
3307
  //#region src/client/images/scanner.ts
2689
3308
  /**
2690
3309
  * Cached client context. `installImageEnhancer` receives it from `apply(ctx)` so
@@ -2923,7 +3542,7 @@ window.__ModuleLoader__.load({
2923
3542
  card.className = "agy-image-card";
2924
3543
  const thumbWrap = document.createElement("div");
2925
3544
  thumbWrap.className = "agy-image-thumb-wrap";
2926
- thumbWrap.title = `${altText || "Image"} (点击全屏放大)`;
3545
+ thumbWrap.title = translateOr("image.zoomHint", "{alt} (click to view full screen)", { alt: altText || "Image" });
2927
3546
  const img = document.createElement("img");
2928
3547
  img.className = "agy-image-thumb";
2929
3548
  img.src = mediaUrl;
@@ -2966,8 +3585,8 @@ window.__ModuleLoader__.load({
2966
3585
  badge.className = "agy-image-link-chip agy-image-link-icon";
2967
3586
  badge.setAttribute("role", "button");
2968
3587
  badge.setAttribute("tabindex", "0");
2969
- badge.title = `预览图片 / Preview (${linkText})`;
2970
- badge.innerHTML = "<span class=\"agy-image-chip-icon\"><svg width=\"12\" height=\"12\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"vertical-align:-1px;display:inline-block;\"><path d=\"M1 8s3-5.5 7-5.5S15 8 15 8s-3 5.5-7 5.5S1 8 1 8z\"/><circle cx=\"8\" cy=\"8\" r=\"2.5\"/></svg></span><span class=\"agy-image-chip-text\">预览</span>";
3588
+ badge.title = translateOr("image.previewTitle", "Preview ({name})", { name: linkText });
3589
+ badge.innerHTML = "<span class=\"agy-image-chip-icon\"><svg width=\"12\" height=\"12\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"vertical-align:-1px;display:inline-block;\"><path d=\"M1 8s3-5.5 7-5.5S15 8 15 8s-3 5.5-7 5.5S1 8 1 8z\"/><circle cx=\"8\" cy=\"8\" r=\"2.5\"/></svg></span><span class=\"agy-image-chip-text\">" + translateOr("image.previewChip", "Preview") + "</span>";
2971
3590
  badge.onclick = (e) => {
2972
3591
  e.preventDefault();
2973
3592
  e.stopPropagation();
@@ -2999,8 +3618,8 @@ window.__ModuleLoader__.load({
2999
3618
  badge.className = "agy-image-link-chip agy-chip-video agy-video-link-icon";
3000
3619
  badge.setAttribute("role", "button");
3001
3620
  badge.setAttribute("tabindex", "0");
3002
- badge.title = `播放视频 / Play Video (${linkText})`;
3003
- badge.innerHTML = "<span class=\"agy-image-chip-icon\"><svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><polygon points=\"5 3 19 12 5 21 5 3\"></polygon></svg></span><span class=\"agy-image-chip-text\">播放</span>";
3621
+ badge.title = translateOr("image.playTitle", "Play video ({name})", { name: linkText });
3622
+ badge.innerHTML = "<span class=\"agy-image-chip-icon\"><svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><polygon points=\"5 3 19 12 5 21 5 3\"></polygon></svg></span><span class=\"agy-image-chip-text\">" + translateOr("image.playChip", "Play") + "</span>";
3004
3623
  badge.onclick = (e) => {
3005
3624
  e.preventDefault();
3006
3625
  e.stopPropagation();
@@ -3025,24 +3644,26 @@ window.__ModuleLoader__.load({
3025
3644
  e.stopPropagation();
3026
3645
  const fileName = pathToUse.split(/[/\\]/).pop() || pathToUse;
3027
3646
  if (openInRightSidebar(pathToUse)) {
3028
- showToast(`已在原生边栏打开: ${fileName}`);
3647
+ showToast(translateOr("file.openedInSidebar", "Opened in the sidebar: {name}", { name: fileName }));
3029
3648
  return;
3030
3649
  }
3031
3650
  openInSystem(pathToUse, false).then((res) => {
3032
- showToast(res.ok ? `已在系统程序中打开: ${fileName}` : `打开失败: ${res.error || "未找到文件"}`);
3651
+ showToast(res.ok ? translateOr("file.openedInSystem", "Opened in the system app: {name}", { name: fileName }) : translateOr("file.openFailed", "Could not open: {error}", { error: res.error || translateOr("file.notFound", "file not found") }));
3033
3652
  });
3034
3653
  });
3035
3654
  }
3036
3655
  function enhanceLinks() {
3037
- const links = document.querySelectorAll("a[href]:not([data-agy-link-scanned]):not([data-agy-link-enhanced]):not([data-agy-video-enhanced]):not([data-agy-file-enhanced])");
3656
+ const links = document.querySelectorAll("a[href]:not([data-agy-link-scanned]):not([data-agy-link-enhanced]):not([data-agy-video-enhanced]):not([data-agy-audio-enhanced]):not([data-agy-file-enhanced])");
3038
3657
  for (let i = 0; i < links.length; i++) {
3039
3658
  const link = links[i];
3040
3659
  if (!link) continue;
3041
3660
  link.dataset.agyLinkScanned = "true";
3042
3661
  const rawHref = link.getAttribute("href") ?? "";
3043
3662
  const resolvedHref = link.href ?? "";
3663
+ if (rawHref.includes("/plugins/agy-link/embed") || resolvedHref.includes("/plugins/agy-link/embed")) continue;
3044
3664
  if (isImageFile(rawHref) || isImageFile(resolvedHref)) enhanceImageLink(link, rawHref, resolvedHref);
3045
3665
  else if (isVideoFile(rawHref) || isVideoFile(resolvedHref)) enhanceVideoLink(link, rawHref, resolvedHref);
3666
+ else if (isAudioFile(rawHref) || isAudioFile(resolvedHref)) enhanceAudioLink(link, rawHref, resolvedHref);
3046
3667
  else if (rawHref.startsWith("file://") || resolvedHref.startsWith("file://") || isLocalFilePath(rawHref)) enhanceFileLink(link, rawHref, resolvedHref);
3047
3668
  }
3048
3669
  }
@@ -3073,10 +3694,11 @@ window.__ModuleLoader__.load({
3073
3694
  const target = e.target;
3074
3695
  const a = target?.closest("a");
3075
3696
  if (!a) return;
3076
- if (a.dataset.agyLinkEnhanced === "true" || a.dataset.agyVideoEnhanced === "true" || a.dataset.agyFileEnhanced === "true") return;
3697
+ if (a.dataset.agyLinkEnhanced === "true" || a.dataset.agyVideoEnhanced === "true" || a.dataset.agyAudioEnhanced === "true" || a.dataset.agyFileEnhanced === "true") return;
3077
3698
  if (target?.closest?.(".agy-image-link-chip")) return;
3078
3699
  const rawHref = a.getAttribute("href") ?? "";
3079
3700
  const resolvedHref = a.href ?? "";
3701
+ if (rawHref.includes("/plugins/agy-link/embed") || resolvedHref.includes("/plugins/agy-link/embed")) return;
3080
3702
  if (rawHref.startsWith("file://") || resolvedHref.startsWith("file://") || isLocalFilePath(rawHref)) {
3081
3703
  const pathToUse = rawHref.startsWith("file://") ? rawHref : resolvedHref.startsWith("file://") ? resolvedHref : rawHref || resolvedHref;
3082
3704
  if (/^https?:\/\//i.test(pathToUse) && !pathToUse.includes("/plugins/agy-link/")) return;
@@ -3084,11 +3706,11 @@ window.__ModuleLoader__.load({
3084
3706
  e.stopPropagation();
3085
3707
  const fileName = pathToUse.split(/[/\\]/).pop() || pathToUse;
3086
3708
  if (openInRightSidebar(pathToUse)) {
3087
- showToast(`已在原生边栏打开: ${fileName}`);
3709
+ showToast(translateOr("file.openedInSidebar", "Opened in the sidebar: {name}", { name: fileName }));
3088
3710
  return;
3089
3711
  }
3090
3712
  openInSystem(pathToUse, false).then((res) => {
3091
- showToast(res.ok ? `已在系统程序中打开: ${fileName}` : `打开失败: ${res.error || "未找到文件"}`);
3713
+ showToast(res.ok ? translateOr("file.openedInSystem", "Opened in the system app: {name}", { name: fileName }) : translateOr("file.openFailed", "Could not open: {error}", { error: res.error || translateOr("file.notFound", "file not found") }));
3092
3714
  });
3093
3715
  }
3094
3716
  }
@@ -3259,6 +3881,197 @@ window.__ModuleLoader__.load({
3259
3881
  const settled = block;
3260
3882
  return settled.isError === true || settled.error !== void 0 && settled.error !== null;
3261
3883
  }
3884
+ const CARD_IMAGE_PATH_RE = /(?<![\w:/])(?:file:\/\/\/?)?(?:[A-Za-z]:[\\/]|\\\\wsl\.localhost\\|\/|~\/)[^\s"'`<>|)\]]+?\.(?:png|jpe?g|webp|gif|bmp|avif)\b/gi;
3885
+ /** Extract local image paths / file:// image URIs from tool output text. */
3886
+ function extractImagePathsFromText(text) {
3887
+ if (!text) return [];
3888
+ const out = [];
3889
+ const seen = /* @__PURE__ */ new Set();
3890
+ for (const m of text.matchAll(CARD_IMAGE_PATH_RE)) {
3891
+ let p = m[0].trim();
3892
+ if (p.startsWith("file://")) {
3893
+ p = p.slice(7);
3894
+ if (/^\/[A-Za-z]:/.test(p)) p = p.slice(1);
3895
+ }
3896
+ if (p === "" || seen.has(p)) continue;
3897
+ seen.add(p);
3898
+ out.push(p);
3899
+ }
3900
+ return out;
3901
+ }
3902
+ //#endregion
3903
+ //#region src/client/toolview/extended-model.ts
3904
+ const SUBAGENT_TOOLS = /* @__PURE__ */ new Set([
3905
+ "invoke_subagent",
3906
+ "define_subagent",
3907
+ "manage_subagents",
3908
+ "send_message"
3909
+ ]);
3910
+ const BROWSER_TOOLS = /* @__PURE__ */ new Set([
3911
+ "open_browser_url",
3912
+ "navigate_page",
3913
+ "take_screenshot",
3914
+ "capture_browser_screenshot",
3915
+ "read_browser_page",
3916
+ "click",
3917
+ "click_element",
3918
+ "fill",
3919
+ "fill_form",
3920
+ "type_text",
3921
+ "press_key",
3922
+ "evaluate_script",
3923
+ "list_pages",
3924
+ "new_page",
3925
+ "select_page",
3926
+ "close_page",
3927
+ "wait_for",
3928
+ "hover",
3929
+ "drag",
3930
+ "scroll",
3931
+ "browser_subagent"
3932
+ ]);
3933
+ function badge(label, tone = "neutral") {
3934
+ return label && label.trim() !== "" ? [{
3935
+ label: label.trim(),
3936
+ tone
3937
+ }] : [];
3938
+ }
3939
+ function classifyExtendedCard(tool, input, desc, out, raw, server) {
3940
+ if (tool === "swarm") {
3941
+ const action = pick(input, "action", "Action") ?? "status";
3942
+ const name = pick(input, "name", "Name", "title", "Title");
3943
+ const model = pick(input, "model", "Model");
3944
+ const workspace = pick(input, "workspace", "Workspace");
3945
+ const n = num(input, "n", "N");
3946
+ const tasks = Array.isArray(input.tasks) ? input.tasks : void 0;
3947
+ const brief = pick(input, "brief", "Brief", "title", "Title");
3948
+ const badges = [
3949
+ ...badge(action, "accent"),
3950
+ ...badge(name, "ok"),
3951
+ ...badge(workspace),
3952
+ ...badge(model),
3953
+ ...n !== void 0 ? badge(`×${n}`) : tasks ? badge(`${tasks.length} tasks`) : []
3954
+ ];
3955
+ return {
3956
+ kind: "swarm",
3957
+ tool,
3958
+ server,
3959
+ title: desc ?? (name ? `${action} · ${name}` : `swarm · ${action}`),
3960
+ badges,
3961
+ ...brief ? { brief } : {},
3962
+ output: out,
3963
+ raw
3964
+ };
3965
+ }
3966
+ if (tool === "run_workflow") {
3967
+ const scriptPath = pick(input, "ScriptPath", "script_path", "scriptPath");
3968
+ const cwd = pick(input, "Cwd", "cwd");
3969
+ const script = pick(input, "Script", "script");
3970
+ const wfDesc = pick(input, "Description", "description") ?? desc;
3971
+ const fileName = scriptPath ? scriptPath.split(/[/\\]/).pop() : void 0;
3972
+ const badges = [...badge(fileName ?? (script ? "inline python" : void 0), "accent"), ...badge(cwd)];
3973
+ return {
3974
+ kind: "workflow",
3975
+ tool,
3976
+ server,
3977
+ title: wfDesc ?? fileName ?? "Python workflow",
3978
+ badges,
3979
+ ...script ? { brief: script } : {},
3980
+ ...scriptPath ? { path: scriptPath } : {},
3981
+ output: out,
3982
+ raw
3983
+ };
3984
+ }
3985
+ if (tool === "schedule") {
3986
+ const cron = pick(input, "CronExpression", "cron_expression", "cron");
3987
+ const secs = num(input, "DurationSeconds", "duration_seconds");
3988
+ const isDaemon = input.IsDaemon === true || input.is_daemon === true;
3989
+ const cond = pick(input, "TimerCondition", "timer_condition");
3990
+ const prompt = pick(input, "Prompt", "prompt");
3991
+ const when = cron ? `cron: ${cron}` : secs !== void 0 ? `${secs}s timer` : "schedule";
3992
+ const badges = [
3993
+ ...badge(when, "accent"),
3994
+ ...isDaemon ? badge("daemon", "ok") : [],
3995
+ ...badge(cond && cond !== "never" ? `cancel: ${cond}` : void 0)
3996
+ ];
3997
+ return {
3998
+ kind: "schedule",
3999
+ tool,
4000
+ server,
4001
+ title: desc ?? when,
4002
+ badges,
4003
+ ...prompt ? { brief: prompt } : {},
4004
+ output: out,
4005
+ raw
4006
+ };
4007
+ }
4008
+ if (tool === "manage_task") {
4009
+ const action = pick(input, "Action", "action") ?? "list";
4010
+ const taskId = pick(input, "TaskId", "task_id");
4011
+ const taskInput = pick(input, "Input", "input");
4012
+ const badges = [...badge(action, action === "kill" ? "warn" : "accent"), ...badge(taskId)];
4013
+ return {
4014
+ kind: "task",
4015
+ tool,
4016
+ server,
4017
+ title: desc ?? (taskId ? `${action} · ${taskId}` : action),
4018
+ badges,
4019
+ ...taskInput ? { brief: taskInput } : {},
4020
+ output: out,
4021
+ raw
4022
+ };
4023
+ }
4024
+ if (SUBAGENT_TOOLS.has(tool)) {
4025
+ const role = pick(input, "Role", "role", "Name", "name");
4026
+ const typeName = pick(input, "TypeName", "typeName");
4027
+ const action = pick(input, "Action", "action");
4028
+ const recipient = pick(input, "Recipient", "recipient");
4029
+ const model = pick(input, "Model", "model");
4030
+ const workspace = pick(input, "Workspace", "workspace");
4031
+ const body = pick(input, "Prompt", "prompt", "Message", "message", "Description", "description");
4032
+ return {
4033
+ kind: "subagent",
4034
+ tool,
4035
+ server,
4036
+ title: desc ?? (role && typeName ? `${role} (${typeName})` : role ?? typeName ?? (recipient ? `→ ${recipient}` : action ? `${tool} · ${action}` : tool)),
4037
+ badges: [
4038
+ ...badge(tool === "invoke_subagent" ? void 0 : tool, "accent"),
4039
+ ...badge(action),
4040
+ ...badge(typeName),
4041
+ ...badge(model && model !== "inherit" ? model : void 0),
4042
+ ...badge(workspace && workspace !== "inherit" ? workspace : void 0, "ok"),
4043
+ ...badge(recipient)
4044
+ ],
4045
+ ...body ? { brief: body } : {},
4046
+ output: out,
4047
+ raw
4048
+ };
4049
+ }
4050
+ const isBrowserServer = server !== void 0 && /browser|chrome|playwright|puppeteer/i.test(server);
4051
+ if (BROWSER_TOOLS.has(tool) || isBrowserServer) {
4052
+ const url = pick(input, "Url", "url", "PageUrl", "pageUrl");
4053
+ const selector = pick(input, "Selector", "selector", "Element", "element", "Text", "text", "Value", "value");
4054
+ const script = pick(input, "Script", "script", "Function", "function", "Expression", "expression");
4055
+ const images = extractImagePathsFromText(out);
4056
+ const badges = [...badge(tool, "accent"), ...badge(server)];
4057
+ return {
4058
+ kind: "browser",
4059
+ tool,
4060
+ server,
4061
+ title: desc ?? url ?? selector ?? tool.replace(/_/g, " "),
4062
+ badges,
4063
+ ...url ? { url } : {},
4064
+ ...script || selector ? { brief: script ?? selector } : {},
4065
+ ...images[0] ? {
4066
+ imagePath: images[0],
4067
+ imagePaths: images
4068
+ } : {},
4069
+ output: out,
4070
+ raw
4071
+ };
4072
+ }
4073
+ return null;
4074
+ }
3262
4075
  //#endregion
3263
4076
  //#region src/client/toolview/format.ts
3264
4077
  function relativize(p, cwd, home) {
@@ -3315,6 +4128,12 @@ window.__ModuleLoader__.load({
3315
4128
  case "delete": return tr(t, "tv.delete", "Delete");
3316
4129
  case "question": return tr(t, "tv.question", "Question");
3317
4130
  case "image": return tr(t, "tv.image", "Image");
4131
+ case "swarm": return tr(t, "tv.swarm", "Swarm");
4132
+ case "workflow": return tr(t, "tv.workflow", "Workflow");
4133
+ case "schedule": return tr(t, "tv.schedule", "Schedule");
4134
+ case "task": return tr(t, "tv.task", "Task");
4135
+ case "subagent": return tr(t, "tv.subagent", "Subagent");
4136
+ case "browser": return tr(t, "tv.browser", "Browser");
3318
4137
  default:
3319
4138
  if (model.tool && model.tool !== "agy_tool") return model.server ? `${model.server}: ${model.tool}` : model.tool.replace(/_/g, " ");
3320
4139
  return tr(t, "tv.tool", "Tool");
@@ -3412,18 +4231,30 @@ window.__ModuleLoader__.load({
3412
4231
  if (tool === "invoke_subagent") {
3413
4232
  const directRole = pick(input, "Role", "role");
3414
4233
  const directTypeName = pick(input, "TypeName", "typeName");
3415
- const effRole = directRole && directTypeName ? `${directRole} (${directTypeName})` : directRole ?? directTypeName;
3416
- const prompt = pick(input, "Prompt", "prompt");
3417
- return {
3418
- kind: "generic",
3419
- tool,
3420
- server: info.server,
3421
- title: desc ?? (effRole ? `Subagent · ${effRole}` : "Invoke Subagent"),
3422
- command: prompt,
3423
- output: out,
3424
- raw: parsedArgsRaw(block)
3425
- };
4234
+ const prompt = pick(input, "Prompt", "prompt") ?? "";
4235
+ if (directTypeName && /image[-_\s]?gen/i.test(directTypeName) || directRole && /image[-_\s]?gen/i.test(directRole)) {
4236
+ const paths = extractImagePathsFromText(out);
4237
+ const imageName = pick(input, "ImageName", "image_name", "name") ?? (paths[0]?.split(/[/\\]/).pop() || "image");
4238
+ const ratio = pick(input, "AspectRatio", "aspect_ratio") ?? "1:1";
4239
+ return {
4240
+ kind: "image",
4241
+ tool,
4242
+ server: info.server,
4243
+ title: desc ?? `Generate Image · ${imageName}`,
4244
+ prompt,
4245
+ imageName,
4246
+ aspectRatio: ratio,
4247
+ ...paths[0] ? {
4248
+ imagePath: paths[0],
4249
+ imagePaths: paths
4250
+ } : {},
4251
+ output: out,
4252
+ raw: parsedArgsRaw(block)
4253
+ };
4254
+ }
3426
4255
  }
4256
+ const extended = classifyExtendedCard(tool, input, desc, out, parsedArgsRaw(block), info.server);
4257
+ if (extended !== null) return extended;
3427
4258
  if (QUESTION_TOOLS.has(tool)) {
3428
4259
  const questionsRaw = input.questions ?? input.Questions;
3429
4260
  const questions = Array.isArray(questionsRaw) ? questionsRaw : [];
@@ -3442,6 +4273,7 @@ window.__ModuleLoader__.load({
3442
4273
  const prompt = pick(input, "Prompt", "prompt") ?? "";
3443
4274
  const name = pick(input, "ImageName", "image_name", "name") ?? "image";
3444
4275
  const ratio = pick(input, "AspectRatio", "aspect_ratio") ?? "1:1";
4276
+ const paths = extractImagePathsFromText(out);
3445
4277
  return {
3446
4278
  kind: "image",
3447
4279
  tool,
@@ -3450,6 +4282,10 @@ window.__ModuleLoader__.load({
3450
4282
  prompt,
3451
4283
  imageName: name,
3452
4284
  aspectRatio: ratio,
4285
+ ...paths[0] ? {
4286
+ imagePath: paths[0],
4287
+ imagePaths: paths
4288
+ } : {},
3453
4289
  output: out,
3454
4290
  raw: parsedArgsRaw(block)
3455
4291
  };
@@ -3552,34 +4388,147 @@ window.__ModuleLoader__.load({
3552
4388
  };
3553
4389
  }
3554
4390
  //#endregion
4391
+ //#region src/client/toolview/extended-styles.ts
4392
+ const EXT_CSS = `
4393
+ .agy-tv-ext-wrap {
4394
+ display: flex;
4395
+ flex-direction: column;
4396
+ }
4397
+ .agy-tv-ext-badges {
4398
+ display: flex;
4399
+ flex-wrap: wrap;
4400
+ align-items: center;
4401
+ gap: 5px;
4402
+ padding: 8px 12px;
4403
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.16));
4404
+ }
4405
+ .agy-tv-ext-badge {
4406
+ display: inline-flex;
4407
+ align-items: center;
4408
+ padding: 1px 7px;
4409
+ border-radius: 999px;
4410
+ font-size: 11px;
4411
+ line-height: 16px;
4412
+ font-weight: 500;
4413
+ background: var(--dsw-alias-bg-l2, rgba(127, 127, 127, 0.1));
4414
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.22));
4415
+ color: var(--dsw-alias-label-secondary, #475569);
4416
+ }
4417
+ .agy-tv-ext-badge[data-tone="accent"] {
4418
+ color: #3b82f6;
4419
+ background: rgba(59, 130, 246, 0.1);
4420
+ border-color: rgba(59, 130, 246, 0.28);
4421
+ }
4422
+ .agy-tv-ext-badge[data-tone="ok"] {
4423
+ color: #10b981;
4424
+ background: rgba(16, 185, 129, 0.1);
4425
+ border-color: rgba(16, 185, 129, 0.28);
4426
+ }
4427
+ .agy-tv-ext-badge[data-tone="warn"] {
4428
+ color: #f59e0b;
4429
+ background: rgba(245, 158, 11, 0.12);
4430
+ border-color: rgba(245, 158, 11, 0.3);
4431
+ }
4432
+ .agy-tv-ext-url {
4433
+ padding: 6px 12px;
4434
+ font-size: 11.5px;
4435
+ color: var(--dsw-alias-state-business-primary, #2563eb);
4436
+ word-break: break-all;
4437
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.14));
4438
+ }
4439
+ .agy-tv-ext-brief {
4440
+ margin: 0;
4441
+ padding: 8px 12px;
4442
+ max-height: 180px;
4443
+ overflow: auto;
4444
+ white-space: pre-wrap;
4445
+ word-break: break-word;
4446
+ font-size: 11.5px;
4447
+ color: var(--dsw-alias-label-primary, #1e293b);
4448
+ background: var(--dsw-alias-bg-l1, rgba(127, 127, 127, 0.04));
4449
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.14));
4450
+ }
4451
+ .agy-tv-ext-shot {
4452
+ padding: 8px 12px;
4453
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.14));
4454
+ }
4455
+ `;
4456
+ function ensureExtendedToolStyles() {
4457
+ const doc = globalThis.document;
4458
+ if (!doc) return;
4459
+ const styleId = "dsh-agy-link-toolview-ext-css";
4460
+ if (doc.getElementById(styleId) === null) {
4461
+ const st = doc.createElement("style");
4462
+ st.id = styleId;
4463
+ st.textContent = EXT_CSS;
4464
+ const host = doc.head ?? doc.documentElement;
4465
+ if (host) host.appendChild(st);
4466
+ }
4467
+ }
4468
+ //#endregion
4469
+ //#region src/client/toolview/extended-cards.ts
4470
+ function ExtendedCardBody({ model, t }) {
4471
+ ensureExtendedToolStyles();
4472
+ const h = hx;
4473
+ const badges = model.badges ?? [];
4474
+ const outText = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : void 0;
4475
+ const shot = model.imagePath || model.imagePaths?.[0];
4476
+ const shotUrl = shot ? buildMediaUrl(shot) : null;
4477
+ return h("div", { className: "agy-tv-ext-wrap" }, badges.length > 0 ? h("div", { className: "agy-tv-ext-badges" }, ...badges.map((b, i) => h("span", {
4478
+ key: "b-" + i,
4479
+ className: "agy-tv-ext-badge",
4480
+ "data-tone": b.tone ?? "neutral"
4481
+ }, b.label))) : null, model.url ? h("div", { className: "agy-tv-ext-url" }, model.url) : null, model.brief ? h("pre", { className: "agy-tv-ext-brief" }, clip(model.brief, 8e3)) : null, shotUrl && shot ? h("div", { className: "agy-tv-ext-shot" }, h("div", {
4482
+ className: "agy-tv-img-preview-box",
4483
+ onClick: (e) => {
4484
+ e.stopPropagation();
4485
+ openLightbox(shotUrl, model.title, shot);
4486
+ },
4487
+ title: translateOr("image.lightboxHint", "Click to open lightbox")
4488
+ }, h("img", {
4489
+ className: "agy-tv-img-thumb",
4490
+ src: shotUrl,
4491
+ alt: model.title,
4492
+ loading: "lazy"
4493
+ }))) : null, outText !== void 0 ? h("pre", { className: "agy-tv-card-content" }, clip(outText, 16e3)) : !model.brief && !shotUrl ? h("pre", { className: "agy-tv-card-content" }, tr(t, "tv.noDetail", "(no detail)")) : null);
4494
+ }
4495
+ //#endregion
3555
4496
  //#region src/client/toolview/image-card.ts
3556
4497
  function ImageCardBody({ model }) {
3557
4498
  const h = hx;
3558
4499
  const prompt = model.prompt || "";
3559
4500
  const name = model.imageName || "image";
3560
4501
  const ratio = model.aspectRatio || "1:1";
3561
- const path = model.imagePath || model.path || "";
3562
- const mediaUrl = path ? buildMediaUrl(path) : null;
4502
+ const primary = model.imagePath || model.path || "";
4503
+ const paths = model.imagePaths && model.imagePaths.length > 0 ? model.imagePaths : primary ? [primary] : [];
4504
+ const mediaUrls = paths.map((p) => ({
4505
+ path: p,
4506
+ url: buildMediaUrl(p)
4507
+ }));
3563
4508
  return h("div", { className: "agy-tv-img-wrap" }, h("div", { className: "agy-tv-img-meta" }, h("div", {
3564
4509
  className: "agy-tv-img-prompt",
3565
4510
  title: prompt || name
3566
- }, prompt ? `"${prompt}"` : name), h("div", { className: "agy-tv-img-badges" }, h("span", { className: "agy-tv-img-badge" }, ratio), ...path ? [h("span", {
3567
- key: "path",
4511
+ }, prompt ? `"${prompt}"` : name), h("div", { className: "agy-tv-img-badges" }, h("span", { className: "agy-tv-img-badge" }, ratio), ...paths.map((p, idx) => h("span", {
4512
+ key: "path-" + idx,
3568
4513
  className: "agy-tv-img-badge",
3569
- title: path
3570
- }, path.split(/[/\\]/).pop())] : [])), mediaUrl ? h("div", {
4514
+ title: p
4515
+ }, p.split(/[/\\]/).pop())))), ...mediaUrls.map((item, idx) => h("div", {
4516
+ key: "img-" + idx,
3571
4517
  className: "agy-tv-img-preview-box",
3572
4518
  onClick: (e) => {
3573
4519
  e.stopPropagation();
3574
- openLightbox(mediaUrl, prompt || name, path);
4520
+ openLightbox(item.url, prompt || name, item.path);
3575
4521
  },
3576
- title: "点击放大预览 / Click to open lightbox"
4522
+ title: translateOr("image.lightboxHint", "Click to open lightbox")
3577
4523
  }, h("img", {
3578
4524
  className: "agy-tv-img-thumb",
3579
- src: mediaUrl,
4525
+ src: item.url,
3580
4526
  alt: prompt || name,
3581
4527
  loading: "lazy"
3582
- })) : null);
4528
+ }))), ...mediaUrls.length === 0 && model.output ? [h("pre", {
4529
+ key: "out",
4530
+ className: "agy-tv-card-content"
4531
+ }, model.output)] : []);
3583
4532
  }
3584
4533
  //#endregion
3585
4534
  //#region src/client/decisions.ts
@@ -3771,7 +4720,7 @@ window.__ModuleLoader__.load({
3771
4720
  const header = document.createElement("div");
3772
4721
  header.className = "agy-decision-header";
3773
4722
  const headerLabel = document.createElement("span");
3774
- headerLabel.textContent = activeTranslate("decision.quickFill");
4723
+ headerLabel.textContent = COPY.quickFill();
3775
4724
  header.appendChild(headerLabel);
3776
4725
  box.appendChild(header);
3777
4726
  const chips = document.createElement("div");
@@ -3780,7 +4729,7 @@ window.__ModuleLoader__.load({
3780
4729
  const chip = document.createElement("button");
3781
4730
  chip.type = "button";
3782
4731
  chip.className = "agy-decision-chip";
3783
- chip.title = activeTranslate("decision.insertTooltip", { text: opt.fullText });
4732
+ chip.title = COPY.insertTooltip(opt.fullText);
3784
4733
  const numSpan = document.createElement("span");
3785
4734
  numSpan.className = "agy-decision-chip-num";
3786
4735
  numSpan.textContent = opt.num ?? "👉";
@@ -3792,7 +4741,7 @@ window.__ModuleLoader__.load({
3792
4741
  chip.onclick = (e) => {
3793
4742
  e.stopPropagation();
3794
4743
  const cleanText = opt.fullText.replace(/^[0-9]+[、..:]\s*/, "").trim();
3795
- insertTextIntoChatComposer(activeTranslate("decision.insertPayload", { choice: (opt.num ? opt.num + " " : "") + cleanText }));
4744
+ insertTextIntoChatComposer(COPY.insertPayload((opt.num ? opt.num + " " : "") + cleanText));
3796
4745
  chip.classList.add("selected");
3797
4746
  setTimeout(() => chip.classList.remove("selected"), 1200);
3798
4747
  };
@@ -3815,24 +4764,14 @@ window.__ModuleLoader__.load({
3815
4764
  scanAndEnhanceDecisions();
3816
4765
  }, 100);
3817
4766
  }
3818
- /** Active translator for the scan pass (module scope: the scan runs outside install). */
3819
- let activeTranslate = (key, params) => {
3820
- return ({
3821
- "decision.quickFill": "💬 Click an option to fill it in:",
3822
- "decision.insertTooltip": "Insert: {text}",
3823
- "decision.insertPayload": "I choose {choice}"
3824
- }[key] ?? key).replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? ""));
4767
+ /** Chip copy: localized through the shared bridge (issue #153). */
4768
+ const COPY = {
4769
+ quickFill: () => translateOr("decision.quickFill", "💬 Click an option to fill it in:"),
4770
+ insertTooltip: (text) => translateOr("decision.insertTooltip", "Insert: {text}", { text }),
4771
+ insertPayload: (choice) => translateOr("decision.insertPayload", "I choose {choice}", { choice })
3825
4772
  };
3826
- function translatorFor(ctx) {
3827
- try {
3828
- const bound = (ctx?.locale)?.bind?.(NS);
3829
- if (typeof bound === "function") return bound;
3830
- } catch {}
3831
- return activeTranslate;
3832
- }
3833
- function installDecisionChips(ctx) {
4773
+ function installDecisionChips() {
3834
4774
  if (typeof window === "undefined" || typeof document === "undefined") return () => {};
3835
- activeTranslate = translatorFor(ctx);
3836
4775
  decisionChipsDispose?.();
3837
4776
  injectStyles$4();
3838
4777
  const observer = new MutationObserver(() => {
@@ -3935,7 +4874,7 @@ window.__ModuleLoader__.load({
3935
4874
  e.stopPropagation();
3936
4875
  onInsert();
3937
4876
  }
3938
- }, inserted ? "✓ 已填入对话框" : "💬 填入对话框 / Insert into Chat"), model.output ? h("div", { className: "agy-tv-q-answered" }, `已记录: ${model.output}`) : null));
4877
+ }, inserted ? translateOr("question.inserted", "✓ Inserted into the chat") : translateOr("question.insert", "💬 Insert into the chat")), model.output ? h("div", { className: "agy-tv-q-answered" }, translateOr("question.recorded", "Recorded: {value}", { value: String(model.output) })) : null));
3939
4878
  }
3940
4879
  //#endregion
3941
4880
  //#region src/client/toolview/card-bodies.ts
@@ -4082,6 +5021,16 @@ window.__ModuleLoader__.load({
4082
5021
  function imageCard(model, inspectNode) {
4083
5022
  return cardShell([IconImageOutline16(13), hx("span", { className: "agy-tv-card-path" }, model.imageName || "Image")], hx(CopyButton, { text: model.prompt || (model.raw ?? "") }), hx(ImageCardBody, { model }), inspectNode);
4084
5023
  }
5024
+ function extendedCard(model, t, inspectNode) {
5025
+ const copyText = model.output !== void 0 && model.output !== "" ? model.output : model.brief ?? model.raw ?? "";
5026
+ return cardShell([toolIconFor(model.kind, 13), hx("span", { className: "agy-tv-card-path" }, model.title)], hx(CopyButton, {
5027
+ text: copyText,
5028
+ t
5029
+ }), hx(ExtendedCardBody, {
5030
+ model,
5031
+ t
5032
+ }), inspectNode);
5033
+ }
4085
5034
  function genericCard(model, t, inspectNode) {
4086
5035
  const copyText = model.output !== void 0 && model.output !== "" ? model.output : model.raw ?? "";
4087
5036
  const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : model.raw !== void 0 && model.raw !== "" ? clip(model.raw, 4e3) : tr(t, "tv.noDetail", "(no detail)");
@@ -4100,6 +5049,12 @@ window.__ModuleLoader__.load({
4100
5049
  case "list": return listCard(model, t, inspectNode);
4101
5050
  case "question": return questionCard(model, inspectNode);
4102
5051
  case "image": return imageCard(model, inspectNode);
5052
+ case "swarm":
5053
+ case "workflow":
5054
+ case "schedule":
5055
+ case "task":
5056
+ case "subagent":
5057
+ case "browser": return extendedCard(model, t, inspectNode);
4103
5058
  default: return genericCard(model, t, inspectNode);
4104
5059
  }
4105
5060
  }
@@ -4693,17 +5648,17 @@ body > [id^="iagy-mmd"] .error-icon {
4693
5648
  const toggleBtn = document.createElement("button");
4694
5649
  toggleBtn.type = "button";
4695
5650
  toggleBtn.className = "agy-mermaid-toggle";
4696
- toggleBtn.textContent = "查看源码";
4697
- toggleBtn.title = "切换图表与原始代码";
5651
+ toggleBtn.textContent = translateOr("mermaid.viewSource", "View source");
5652
+ toggleBtn.title = translateOr("mermaid.toggle", "Switch between the diagram and its source");
4698
5653
  toggleBtn.addEventListener("click", (ev) => {
4699
5654
  ev.preventDefault();
4700
5655
  ev.stopPropagation();
4701
5656
  if (block.getAttribute("data-agy-mermaid-view") === "source") {
4702
5657
  block.removeAttribute("data-agy-mermaid-view");
4703
- toggleBtn.textContent = "查看源码";
5658
+ toggleBtn.textContent = translateOr("mermaid.viewSource", "View source");
4704
5659
  } else {
4705
5660
  block.setAttribute("data-agy-mermaid-view", "source");
4706
- toggleBtn.textContent = "查看图表";
5661
+ toggleBtn.textContent = translateOr("mermaid.viewDiagram", "View diagram");
4707
5662
  }
4708
5663
  });
4709
5664
  toolbar.appendChild(toggleBtn);
@@ -4719,7 +5674,7 @@ body > [id^="iagy-mmd"] .error-icon {
4719
5674
  block.setAttribute("data-agy-mermaid", "fallback");
4720
5675
  } else {
4721
5676
  block.setAttribute("data-agy-mermaid", "error");
4722
- mount.innerHTML = "<div class=\"agy-mermaid-warn\">⚠️ Mermaid 图表解析失败,已保留原始代码呈现</div>";
5677
+ mount.innerHTML = "<div class=\"agy-mermaid-warn\">" + translateOr("mermaid.parseFailed", "⚠️ This Mermaid diagram could not be rendered; the source is kept below.") + "</div>";
4723
5678
  }
4724
5679
  } finally {
4725
5680
  cleanupTempElements(id);
@@ -5032,67 +5987,318 @@ div[data-variant="think"] [class*="thinkBody"] {
5032
5987
  scanTimer = null;
5033
5988
  }
5034
5989
  }
5035
- const { createElement: h$1, useState: useState$1, useEffect: useEffect$1 } = require("react");
5036
- const win = globalThis;
5037
- const base = win.location?.origin ?? "";
5038
- const STYLE_ID = "dsh-agy-link-tsl-css-v2";
5039
- const TRANSLATION_KIND = "agy-translation";
5040
- function service(ctx, name) {
5041
- try {
5042
- const fromGet = ctx.get?.(name);
5043
- if (fromGet !== void 0 && fromGet !== null) return fromGet;
5044
- } catch {}
5045
- try {
5046
- const direct = ctx[name];
5047
- return direct === void 0 || direct === null ? void 0 : direct;
5048
- } catch {
5049
- return;
5050
- }
5051
- }
5052
- /** The session the visible conversation belongs to. */
5053
- function currentSessionId(ctx) {
5054
- const value = service(ctx, "uiSession")?.current?.value;
5055
- if (value !== void 0 && value !== null) for (const key of [
5056
- "key",
5057
- "sessionId",
5058
- "id"
5059
- ]) {
5060
- const id = value[key];
5061
- if (typeof id === "string" && id !== "") return id;
5062
- }
5063
- const byId = service(ctx, "sessions")?.list?.getSnapshot?.()?.byId;
5064
- if (byId !== void 0 && byId !== null) {
5065
- const ids = Object.keys(byId);
5066
- if (ids.length === 1 && ids[0] !== void 0) return ids[0];
5067
- }
5068
- return "";
5069
- }
5070
5990
  //#endregion
5071
- //#region src/client/brand-icons.ts
5072
- const BRAND_PATHS = {
5073
- gemini: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",
5074
- claude: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
5075
- openai: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
5076
- chrome: "M12 0C8.21 0 4.831 1.757 2.632 4.501l3.953 6.848A5.454 5.454 0 0 1 12 6.545h10.73c-.911-3.794-4.321-6.545-8.384-6.545zM1.986 6.368A11.95 11.95 0 0 0 0 12c0 6.096 4.542 11.134 10.428 11.89l3.953-6.848a5.454 5.454 0 0 1-5.836-2.585L1.986 6.368zm14.569 5.632a5.454 5.454 0 0 1-1.127 3.327l-5.365 9.293C10.784 24.873 11.385 25 12 25c6.627 0 12-5.373 12-12 0-.341-.014-.679-.042-1.013H12v.013h4.555z",
5077
- edge: "M23.95 13.91c-.13-1.68-.78-3.23-1.83-4.47-.98-1.16-2.29-1.99-3.76-2.4-.64-.18-1.3-.28-1.97-.29-2.09-.03-4.08.74-5.63 2.16-1.57 1.44-2.48 3.44-2.55 5.56.08 1.47.66 2.87 1.66 3.96.99 1.09 2.37 1.76 3.86 1.88 1.34.1 2.69-.26 3.82-1.02.44-.3.84-.66 1.18-1.07l2.87 2.87c-1.35 1.44-3.04 2.51-4.92 3.12-1.89.6-3.9.7-5.84.28-2.67-.58-5.06-2.06-6.75-4.17-1.68-2.12-2.59-4.78-2.57-7.51.02-2.85 1.04-5.6 2.89-7.77C6.88 4.31 9.53 2.85 12.44 2.38c2.19-.35 4.43-.2 6.55.45 2.13.65 4.04 1.83 5.58 3.44l-2.9 2.9c-1.12-1.19-2.52-2.06-4.07-2.54-1.55-.47-3.19-.57-4.78-.3-2.14.36-4.08 1.45-5.46 3.06-1.38 1.62-2.13 3.69-2.13 5.84 0 2.05.69 4.04 1.98 5.62 1.28 1.58 3.1 2.64 5.12 3.01 1.47.27 2.99.17 4.42-.31 1.43-.48 2.7-1.33 3.69-2.46l-4.13-4.13c-.37.28-.8.48-1.26.58-.46.1-.94.09-1.4-.02-.57-.14-1.08-.47-1.46-.93-.38-.46-.59-1.04-.59-1.64.03-.84.4-1.63 1.03-2.2.63-.57 1.45-.88 2.3-.87.87.01 1.7.35 2.32.95.62.61.98 1.43 1 2.3h4.67z"
5078
- };
5079
- const BRAND_COLORS = {
5080
- gemini: "#8E75B2",
5081
- claude: "#D97757",
5082
- openai: "#10a37f",
5083
- chrome: "#4285F4",
5084
- edge: "#0078D7"
5085
- };
5086
- const UI_PATHS = {
5087
- trash: "M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M10 11v6M14 11v6",
5088
- plus: "M12 5v14M5 12h14",
5089
- refresh: "M21.5 2v6h-6M2.5 22v-6h6M2.5 11.5a10 10 0 0 1 17.5-4.5l1.5 2M21.5 12.5a10 10 0 0 1-17.5 4.5l-1.5-2",
5090
- star: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
5091
- mail: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2zM22 6l-10 7L2 6",
5092
- globe: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",
5093
- zap: "M13 2L3 14h9l-1 8 10-12h-9l1-8z",
5094
- chevronDown: "M6 9l6 6 6-6",
5095
- chevronUp: "M18 15l-6-6-6 6",
5991
+ //#region src/client/embed.ts
5992
+ const EMBED_CSS = `
5993
+ .agy-embed-card {
5994
+ display: flex;
5995
+ flex-direction: column;
5996
+ margin: 8px 0;
5997
+ border-radius: 10px;
5998
+ overflow: hidden;
5999
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
6000
+ background: var(--dsw-alias-markdown-code-block, rgba(127, 127, 127, 0.04));
6001
+ }
6002
+ .agy-embed-header {
6003
+ display: flex;
6004
+ align-items: center;
6005
+ justify-content: space-between;
6006
+ gap: 8px;
6007
+ padding: 6px 10px;
6008
+ font-size: 11.5px;
6009
+ background: var(--dsw-alias-markdown-code-block-banner, rgba(127, 127, 127, 0.06));
6010
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.18));
6011
+ }
6012
+ .agy-embed-title {
6013
+ font-weight: 600;
6014
+ color: var(--dsw-alias-label-primary, #1e293b);
6015
+ overflow: hidden;
6016
+ text-overflow: ellipsis;
6017
+ white-space: nowrap;
6018
+ }
6019
+ .agy-embed-actions {
6020
+ display: flex;
6021
+ align-items: center;
6022
+ gap: 6px;
6023
+ flex-shrink: 0;
6024
+ }
6025
+ .agy-embed-btn {
6026
+ font-size: 11px;
6027
+ padding: 1px 7px;
6028
+ border-radius: 4px;
6029
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.25));
6030
+ background: transparent;
6031
+ color: var(--dsw-alias-label-secondary, #64748b);
6032
+ cursor: pointer;
6033
+ }
6034
+ .agy-embed-btn:hover {
6035
+ color: var(--dsw-alias-label-primary, #0f172a);
6036
+ }
6037
+ .agy-embed-frame {
6038
+ width: 100%;
6039
+ height: 220px;
6040
+ border: none;
6041
+ display: block;
6042
+ background: transparent;
6043
+ }
6044
+ `;
6045
+ function injectEmbedStyles() {
6046
+ if (typeof document === "undefined") return;
6047
+ const id = "dsh-agy-link-embed-css";
6048
+ if (document.getElementById(id) !== null) return;
6049
+ const st = document.createElement("style");
6050
+ st.id = id;
6051
+ st.textContent = EMBED_CSS;
6052
+ (document.head ?? document.documentElement)?.appendChild(st);
6053
+ }
6054
+ function readThemePayload() {
6055
+ const root = document.documentElement;
6056
+ const cs = typeof getComputedStyle === "function" ? getComputedStyle(root) : null;
6057
+ const pickVar = (names, fallback) => {
6058
+ for (const n of names) {
6059
+ const v = cs?.getPropertyValue(n)?.trim();
6060
+ if (v) return v;
6061
+ }
6062
+ return fallback;
6063
+ };
6064
+ const cls = (root.className || "").toLowerCase();
6065
+ const dt = (root.getAttribute("data-theme") || "").toLowerCase();
6066
+ const dark = cls.includes("dark") || dt === "dark" || !cls.includes("light") && dt !== "light" && typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === true;
6067
+ const bg = pickVar(["--dsw-alias-bg-base", "--background"], dark ? "#0f172a" : "#ffffff");
6068
+ const card = pickVar(["--dsw-alias-markdown-code-block", "--card"], dark ? "#1e293b" : "#f8fafc");
6069
+ const border = pickVar(["--dsw-alias-border-l2", "--border"], dark ? "#334155" : "#e2e8f0");
6070
+ const fg = pickVar(["--dsw-alias-label-primary", "--foreground"], dark ? "#f1f5f9" : "#0f172a");
6071
+ const muted = pickVar(["--dsw-alias-label-tertiary", "--muted-foreground"], dark ? "#94a3b8" : "#64748b");
6072
+ const primary = pickVar(["--dsw-alias-state-business-primary", "--primary"], "#2563eb");
6073
+ return {
6074
+ type: "agy-embed-theme",
6075
+ dark,
6076
+ vars: {
6077
+ "--background": bg,
6078
+ "--content": bg,
6079
+ "--card": card,
6080
+ "--sidebar": card,
6081
+ "--card-border": border,
6082
+ "--border": border,
6083
+ "--foreground": fg,
6084
+ "--muted-foreground": muted,
6085
+ "--placeholder": muted,
6086
+ "--code-foreground": fg,
6087
+ "--primary": primary,
6088
+ "--primary-foreground": "#ffffff",
6089
+ "--secondary": card,
6090
+ "--secondary-foreground": fg,
6091
+ "--accent": primary,
6092
+ "--link": primary,
6093
+ "--success": "#10b981",
6094
+ "--warning": "#f59e0b",
6095
+ "--error": "#ef4444",
6096
+ "--chart-1": "#3b82f6",
6097
+ "--chart-2": "#10b981",
6098
+ "--chart-3": "#f59e0b",
6099
+ "--chart-4": "#8b5cf6",
6100
+ "--chart-5": "#ec4899",
6101
+ "--chart-6": "#06b6d4"
6102
+ }
6103
+ };
6104
+ }
6105
+ let seq = 0;
6106
+ function installAgentEmbedRenderer() {
6107
+ if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener !== "function") return () => {};
6108
+ injectEmbedStyles();
6109
+ const frameMap = /* @__PURE__ */ new Map();
6110
+ let scanTimer = null;
6111
+ const pruneDisconnected = () => {
6112
+ for (const [id, frame] of frameMap) if (!frame.isConnected) frameMap.delete(id);
6113
+ };
6114
+ const postThemeToAll = () => {
6115
+ pruneDisconnected();
6116
+ const payload = readThemePayload();
6117
+ for (const frame of frameMap.values()) try {
6118
+ frame.contentWindow?.postMessage(payload, "*");
6119
+ } catch {}
6120
+ };
6121
+ const scan = () => {
6122
+ if (isInteractionLocked()) return;
6123
+ pruneDisconnected();
6124
+ const links = document.querySelectorAll("a[href*=\"/plugins/agy-link/embed\"]:not([data-agy-embed-scanned])");
6125
+ const origin = getOrigin();
6126
+ for (let i = 0; i < links.length; i++) {
6127
+ const link = links[i];
6128
+ if (!link) continue;
6129
+ link.dataset.agyEmbedScanned = "true";
6130
+ const href = link.getAttribute("href") || link.href || "";
6131
+ let rawPath = "";
6132
+ try {
6133
+ rawPath = new URL(href, "http://localhost").searchParams.get("path") ?? "";
6134
+ } catch {
6135
+ continue;
6136
+ }
6137
+ if (!rawPath) continue;
6138
+ const embedId = `agy-embed-${++seq}`;
6139
+ const iframeSrc = `${origin}/plugins/agy-link/embed?path=${encodeURIComponent(rawPath)}&id=${encodeURIComponent(embedId)}`;
6140
+ const titleText = (link.textContent || "Widget").replace(/^Widget:\s*/i, "").trim() || "Widget";
6141
+ const card = document.createElement("div");
6142
+ card.className = "agy-embed-card";
6143
+ const header = document.createElement("div");
6144
+ header.className = "agy-embed-header";
6145
+ const title = document.createElement("span");
6146
+ title.className = "agy-embed-title";
6147
+ title.textContent = titleText;
6148
+ title.title = rawPath;
6149
+ const actions = document.createElement("div");
6150
+ actions.className = "agy-embed-actions";
6151
+ const iframe = document.createElement("iframe");
6152
+ iframe.className = "agy-embed-frame";
6153
+ iframe.setAttribute("sandbox", "allow-scripts");
6154
+ iframe.loading = "lazy";
6155
+ iframe.src = iframeSrc;
6156
+ frameMap.set(embedId, iframe);
6157
+ iframe.addEventListener("load", () => {
6158
+ try {
6159
+ iframe.contentWindow?.postMessage(readThemePayload(), "*");
6160
+ } catch {}
6161
+ });
6162
+ const toggleBtn = document.createElement("button");
6163
+ toggleBtn.type = "button";
6164
+ toggleBtn.className = "agy-embed-btn";
6165
+ toggleBtn.textContent = translateOr("embed.collapse", "Collapse");
6166
+ toggleBtn.onclick = () => {
6167
+ const collapsed = iframe.style.display === "none";
6168
+ iframe.style.display = collapsed ? "block" : "none";
6169
+ toggleBtn.textContent = collapsed ? translateOr("embed.collapse", "Collapse") : translateOr("embed.expand", "Expand");
6170
+ };
6171
+ const openBtn = document.createElement("button");
6172
+ openBtn.type = "button";
6173
+ openBtn.className = "agy-embed-btn";
6174
+ openBtn.textContent = translateOr("embed.source", "Source");
6175
+ openBtn.onclick = () => {
6176
+ if (openInRightSidebar(rawPath)) {
6177
+ showToast(translateOr("file.openedInSidebar", "Opened in the sidebar: {name}", { name: titleText }));
6178
+ return;
6179
+ }
6180
+ openInSystem(rawPath, false).then((r) => {
6181
+ if (!r.ok) showToast(translateOr("file.openFailed", "Could not open: {error}", { error: r.error || translateOr("file.notFound", "file not found") }));
6182
+ });
6183
+ };
6184
+ actions.appendChild(toggleBtn);
6185
+ actions.appendChild(openBtn);
6186
+ header.appendChild(title);
6187
+ header.appendChild(actions);
6188
+ card.appendChild(header);
6189
+ card.appendChild(iframe);
6190
+ link.style.display = "none";
6191
+ link.insertAdjacentElement("afterend", card);
6192
+ }
6193
+ };
6194
+ const onMessage = (ev) => {
6195
+ const data = ev.data;
6196
+ if (!data || data.type !== "agy-embed-resize" || typeof data.id !== "string") return;
6197
+ const frame = frameMap.get(data.id);
6198
+ if (!frame || !frame.isConnected) {
6199
+ frameMap.delete(data.id);
6200
+ return;
6201
+ }
6202
+ if (ev.source !== frame.contentWindow) return;
6203
+ const h = Number(data.height);
6204
+ if (Number.isFinite(h) && h > 0) frame.style.height = `${Math.max(80, Math.min(800, Math.ceil(h)))}px`;
6205
+ };
6206
+ const scheduleScan = () => {
6207
+ if (isInteractionLocked() || scanTimer !== null) return;
6208
+ scanTimer = setTimeout(() => {
6209
+ scanTimer = null;
6210
+ scan();
6211
+ }, 100);
6212
+ };
6213
+ const domObserver = typeof MutationObserver === "function" ? new MutationObserver(() => scheduleScan()) : null;
6214
+ const themeObserver = typeof MutationObserver === "function" ? new MutationObserver(() => postThemeToAll()) : null;
6215
+ const unbindSettle = onScrollSettle(() => scheduleScan());
6216
+ window.addEventListener("message", onMessage);
6217
+ if (document.body) {
6218
+ domObserver?.observe(document.body, {
6219
+ childList: true,
6220
+ subtree: true
6221
+ });
6222
+ scan();
6223
+ }
6224
+ if (document.documentElement) themeObserver?.observe(document.documentElement, {
6225
+ attributes: true,
6226
+ attributeFilter: [
6227
+ "class",
6228
+ "data-theme",
6229
+ "style"
6230
+ ]
6231
+ });
6232
+ return () => {
6233
+ window.removeEventListener?.("message", onMessage);
6234
+ domObserver?.disconnect();
6235
+ themeObserver?.disconnect();
6236
+ unbindSettle();
6237
+ if (scanTimer !== null) clearTimeout(scanTimer);
6238
+ frameMap.clear();
6239
+ };
6240
+ }
6241
+ const { createElement: h$1, useState: useState$1, useEffect: useEffect$1 } = require("react");
6242
+ const win = globalThis;
6243
+ const base = win.location?.origin ?? "";
6244
+ const STYLE_ID = "dsh-agy-link-tsl-css-v2";
6245
+ const TRANSLATION_KIND = "agy-translation";
6246
+ function service(ctx, name) {
6247
+ try {
6248
+ const fromGet = ctx.get?.(name);
6249
+ if (fromGet !== void 0 && fromGet !== null) return fromGet;
6250
+ } catch {}
6251
+ try {
6252
+ const direct = ctx[name];
6253
+ return direct === void 0 || direct === null ? void 0 : direct;
6254
+ } catch {
6255
+ return;
6256
+ }
6257
+ }
6258
+ /** The session the visible conversation belongs to. */
6259
+ function currentSessionId(ctx) {
6260
+ const value = service(ctx, "uiSession")?.current?.value;
6261
+ if (value !== void 0 && value !== null) for (const key of [
6262
+ "key",
6263
+ "sessionId",
6264
+ "id"
6265
+ ]) {
6266
+ const id = value[key];
6267
+ if (typeof id === "string" && id !== "") return id;
6268
+ }
6269
+ const byId = service(ctx, "sessions")?.list?.getSnapshot?.()?.byId;
6270
+ if (byId !== void 0 && byId !== null) {
6271
+ const ids = Object.keys(byId);
6272
+ if (ids.length === 1 && ids[0] !== void 0) return ids[0];
6273
+ }
6274
+ return "";
6275
+ }
6276
+ //#endregion
6277
+ //#region src/client/brand-icons.ts
6278
+ const BRAND_PATHS = {
6279
+ gemini: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",
6280
+ claude: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
6281
+ openai: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
6282
+ chrome: "M12 0C8.21 0 4.831 1.757 2.632 4.501l3.953 6.848A5.454 5.454 0 0 1 12 6.545h10.73c-.911-3.794-4.321-6.545-8.384-6.545zM1.986 6.368A11.95 11.95 0 0 0 0 12c0 6.096 4.542 11.134 10.428 11.89l3.953-6.848a5.454 5.454 0 0 1-5.836-2.585L1.986 6.368zm14.569 5.632a5.454 5.454 0 0 1-1.127 3.327l-5.365 9.293C10.784 24.873 11.385 25 12 25c6.627 0 12-5.373 12-12 0-.341-.014-.679-.042-1.013H12v.013h4.555z",
6283
+ edge: "M23.95 13.91c-.13-1.68-.78-3.23-1.83-4.47-.98-1.16-2.29-1.99-3.76-2.4-.64-.18-1.3-.28-1.97-.29-2.09-.03-4.08.74-5.63 2.16-1.57 1.44-2.48 3.44-2.55 5.56.08 1.47.66 2.87 1.66 3.96.99 1.09 2.37 1.76 3.86 1.88 1.34.1 2.69-.26 3.82-1.02.44-.3.84-.66 1.18-1.07l2.87 2.87c-1.35 1.44-3.04 2.51-4.92 3.12-1.89.6-3.9.7-5.84.28-2.67-.58-5.06-2.06-6.75-4.17-1.68-2.12-2.59-4.78-2.57-7.51.02-2.85 1.04-5.6 2.89-7.77C6.88 4.31 9.53 2.85 12.44 2.38c2.19-.35 4.43-.2 6.55.45 2.13.65 4.04 1.83 5.58 3.44l-2.9 2.9c-1.12-1.19-2.52-2.06-4.07-2.54-1.55-.47-3.19-.57-4.78-.3-2.14.36-4.08 1.45-5.46 3.06-1.38 1.62-2.13 3.69-2.13 5.84 0 2.05.69 4.04 1.98 5.62 1.28 1.58 3.1 2.64 5.12 3.01 1.47.27 2.99.17 4.42-.31 1.43-.48 2.7-1.33 3.69-2.46l-4.13-4.13c-.37.28-.8.48-1.26.58-.46.1-.94.09-1.4-.02-.57-.14-1.08-.47-1.46-.93-.38-.46-.59-1.04-.59-1.64.03-.84.4-1.63 1.03-2.2.63-.57 1.45-.88 2.3-.87.87.01 1.7.35 2.32.95.62.61.98 1.43 1 2.3h4.67z"
6284
+ };
6285
+ const BRAND_COLORS = {
6286
+ gemini: "#8E75B2",
6287
+ claude: "#D97757",
6288
+ openai: "#10a37f",
6289
+ chrome: "#4285F4",
6290
+ edge: "#0078D7"
6291
+ };
6292
+ const UI_PATHS = {
6293
+ trash: "M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M10 11v6M14 11v6",
6294
+ plus: "M12 5v14M5 12h14",
6295
+ refresh: "M21.5 2v6h-6M2.5 22v-6h6M2.5 11.5a10 10 0 0 1 17.5-4.5l1.5 2M21.5 12.5a10 10 0 0 1-17.5 4.5l-1.5-2",
6296
+ star: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
6297
+ mail: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2zM22 6l-10 7L2 6",
6298
+ globe: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",
6299
+ zap: "M13 2L3 14h9l-1 8 10-12h-9l1-8z",
6300
+ chevronDown: "M6 9l6 6 6-6",
6301
+ chevronUp: "M18 15l-6-6-6 6",
5096
6302
  check: "M20 6L9 17l-5-5",
5097
6303
  x: "M18 6L6 18M6 6l12 12",
5098
6304
  externalLink: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3",
@@ -6156,12 +7362,16 @@ body.dark .agy-tsl-card,
6156
7362
  if (host) host.appendChild(st);
6157
7363
  }
6158
7364
  }
6159
- /** Check if document language is Chinese or English. */
7365
+ /**
7366
+ * Card title, from the plugin's locale binding.
7367
+ *
7368
+ * `document.documentElement.lang` used to be consulted here as a shortcut, but it
7369
+ * is DSH's page language rather than this plugin's locale, and it made the copy
7370
+ * disagree with every other surface when the two differed. The binding is the
7371
+ * authority; hosts without one get the English default (issue #153).
7372
+ */
6160
7373
  function getCompactionTitle() {
6161
- if (typeof document !== "undefined") {
6162
- if ((document.documentElement.lang || "").startsWith("en")) return "Context compacted";
6163
- }
6164
- return "上下文已压缩";
7374
+ return translateOr("compaction.contextCompacted", "Context compacted");
6165
7375
  }
6166
7376
  function buildCompactionRow(notice) {
6167
7377
  const { beforeTokens, afterTokens, summary = "" } = notice;
@@ -7857,24 +9067,38 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7857
9067
  };
7858
9068
  }
7859
9069
  function lifecycleActions(deps, actionFailed) {
7860
- const { refresh, showToast, setLoadingAction, t, setOptimisticActiveId } = deps;
7861
- const setActiveAccount = async (id) => {
7862
- setOptimisticActiveId(id);
7863
- setLoadingAction(`active:${id}`);
9070
+ const { refresh, showToast, setLoadingAction, t, setOptimisticActiveByFamily } = deps;
9071
+ const setActiveAccount = async (id, family = "google") => {
9072
+ setOptimisticActiveByFamily((prev) => ({
9073
+ ...prev,
9074
+ [family]: id
9075
+ }));
9076
+ setLoadingAction(`active:${id}:${family}`);
9077
+ const clearOpt = () => {
9078
+ setOptimisticActiveByFamily((prev) => {
9079
+ if (prev[family] !== id) return prev;
9080
+ const next = { ...prev };
9081
+ delete next[family];
9082
+ return next;
9083
+ });
9084
+ };
7864
9085
  try {
7865
- const res = await postPool("set-active", { id });
9086
+ const res = await postPool("set-active", {
9087
+ id,
9088
+ family
9089
+ });
7866
9090
  if (res && res.ok) {
7867
9091
  await refresh();
7868
9092
  showToast(t("account.activeSet"), "success");
7869
9093
  } else {
7870
- setOptimisticActiveId(null);
9094
+ clearOpt();
7871
9095
  showToast(res?.error || t("account.activeSetFailed"), "error");
7872
9096
  }
7873
9097
  } catch {
7874
- setOptimisticActiveId(null);
9098
+ clearOpt();
7875
9099
  showToast(t("account.activeSetFailed"), "error");
7876
9100
  } finally {
7877
- setOptimisticActiveId(null);
9101
+ clearOpt();
7878
9102
  setLoadingAction(null);
7879
9103
  }
7880
9104
  };
@@ -7938,15 +9162,23 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7938
9162
  setLoadingAction(id ? `warmup:${id}` : "warmup:all");
7939
9163
  try {
7940
9164
  const res = await postPool("warmup", {
7941
- id,
7942
- force: true,
7943
- ...id ? {} : { all: true }
9165
+ ...id ? { id } : { all: true },
9166
+ force: false,
9167
+ ignoreFailureBackoff: true
7944
9168
  });
7945
9169
  if (res === null || res?.ok === false) {
7946
9170
  actionFailed();
7947
9171
  return;
7948
9172
  }
7949
9173
  await refresh();
9174
+ if (res?.alreadyRunning === true) {
9175
+ showToast(t("warmup.alreadyRunning"), "info");
9176
+ return;
9177
+ }
9178
+ if (res?.pending === true) {
9179
+ showToast(t("warmup.started"), "info");
9180
+ return;
9181
+ }
7950
9182
  const results = Array.isArray(res.results) ? res.results : [];
7951
9183
  const skippedCount = results.filter((r) => r.skipped).length;
7952
9184
  const successCount = results.filter((r) => r.success && !r.skipped).length;
@@ -7975,9 +9207,12 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7975
9207
  setLoadingAction(null);
7976
9208
  showToast(t("proxy.saved"), "success");
7977
9209
  };
7978
- const clearCooldown = async (id) => {
7979
- setLoadingAction(id ? `clearCooldown:${id}` : "clearCooldown:all");
7980
- const res = await postPool("clear-cooldown", { id });
9210
+ const clearCooldown = async (id, family) => {
9211
+ setLoadingAction(`clearCooldown:${id ?? "all"}:${family ?? "all"}`);
9212
+ const res = await postPool("clear-cooldown", {
9213
+ ...id ? { id } : {},
9214
+ ...family ? { family } : {}
9215
+ });
7981
9216
  if (res === null || res?.ok === false) {
7982
9217
  setLoadingAction(null);
7983
9218
  actionFailed();
@@ -7985,7 +9220,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7985
9220
  }
7986
9221
  await refresh();
7987
9222
  setLoadingAction(null);
7988
- showToast(t("account.clearCooldown"), "success");
9223
+ showToast(t("account.clearCooldownDone"), "success");
7989
9224
  };
7990
9225
  return {
7991
9226
  refreshQuota,
@@ -8645,13 +9880,34 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8645
9880
  function accountHasActiveCooldown(acc, now) {
8646
9881
  return Object.values(acc.cooldowns ?? {}).some((cd) => Boolean(cd && cd.cooldownUntil > now));
8647
9882
  }
9883
+ /** True when a family has an active local 429 cooldown timer on this account. */
9884
+ function isFamilyInCooldown(acc, family, now) {
9885
+ const cd = acc.cooldowns?.[family];
9886
+ return Boolean(cd && cd.cooldownUntil > now);
9887
+ }
9888
+ /**
9889
+ * Single source of truth for whether one model family on an account is
9890
+ * currently cooling (either via an active 429 cooldown timer or proactive
9891
+ * low-quota benching).
9892
+ */
9893
+ function isFamilyCooling(acc, family, now) {
9894
+ return isFamilyInCooldown(acc, family, now) || isQuotaBenched(acc, family, now);
9895
+ }
9896
+ /** Known quota families explicitly tracked on this account. */
9897
+ function accountKnownFamilies(acc) {
9898
+ return QUOTA_FAMILIES.filter((fam) => {
9899
+ if (fam === "argon") return acc.quotas?.argon !== void 0 || acc.cooldowns?.argon !== void 0;
9900
+ return acc.quotas?.[fam] !== void 0 || acc.cooldowns?.[fam] !== void 0;
9901
+ });
9902
+ }
8648
9903
  /**
8649
- * True when any family reported on the account is benched by its quota snapshot.
8650
- * Skips the synthesized `argon -> google` fallback when the account has no dedicated
8651
- * `quotas.argon` row, since `google` itself already reflects that shared bucket.
9904
+ * True only when every known family on the account is cooling (drives the
9905
+ * account-level amber indicator dot without punishing healthy families).
8652
9906
  */
8653
- function accountHasQuotaBench(acc, now) {
8654
- return QUOTA_FAMILIES.some((fam) => (fam !== "argon" || acc.quotas?.argon !== void 0) && isQuotaBenched(acc, fam, now));
9907
+ function isAccountFullyCooling(acc, now) {
9908
+ const known = accountKnownFamilies(acc);
9909
+ if (known.length === 0) return accountHasActiveCooldown(acc, now);
9910
+ return known.every((fam) => isFamilyCooling(acc, fam, now));
8655
9911
  }
8656
9912
  /**
8657
9913
  * True when the account cannot operate due to auth expiration, web verification
@@ -8877,48 +10133,131 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8877
10133
  whiteSpace: "nowrap"
8878
10134
  } }, t("quota.unactivated")) : null));
8879
10135
  };
10136
+ function formatCooldownTip(t, familyKey, acc, now) {
10137
+ const cd = acc.cooldowns[familyKey];
10138
+ if (cd && cd.cooldownUntil > now) {
10139
+ const mins = Math.max(1, Math.ceil((cd.cooldownUntil - now) / 6e4));
10140
+ const hours = Math.floor(mins / 60);
10141
+ const rem = mins % 60;
10142
+ const left = hours > 0 ? `${hours}${t("duration.hour")} ${rem}${t("duration.minute")}` : `${mins}${t("duration.minute")}`;
10143
+ return `${cd.reason} · ${left}`;
10144
+ }
10145
+ return t("status.cooldown");
10146
+ }
10147
+ function renderFamilyHeaderActions(t, cooling, cooldownTip, familyActions) {
10148
+ if (cooling) return h("div", { style: {
10149
+ display: "inline-flex",
10150
+ alignItems: "center",
10151
+ gap: "4px",
10152
+ flexShrink: 0
10153
+ } }, h("span", {
10154
+ key: "cd-badge",
10155
+ title: cooldownTip,
10156
+ style: {
10157
+ ...S.badgeTag,
10158
+ background: "rgba(245, 158, 11, 0.15)",
10159
+ color: "#f59e0b",
10160
+ borderColor: "rgba(245, 158, 11, 0.4)",
10161
+ gap: "3px",
10162
+ fontSize: "10px",
10163
+ padding: "1px 5px",
10164
+ fontWeight: 700,
10165
+ whiteSpace: "nowrap"
10166
+ }
10167
+ }, uiIcon("alert", 10, "#f59e0b"), t("status.cooldown")), familyActions?.onClearCooldown ? h(Button, {
10168
+ key: "clear-cd",
10169
+ variant: "default",
10170
+ size: "sm",
10171
+ className: "agy-btn",
10172
+ style: {
10173
+ color: "var(--agy-warn-btn-text)",
10174
+ borderColor: "var(--agy-warn-btn-border)",
10175
+ background: "var(--agy-warn-btn-bg)",
10176
+ gap: "3px",
10177
+ fontSize: "10.5px",
10178
+ padding: "1px 6px",
10179
+ height: "20px"
10180
+ },
10181
+ disabled: familyActions.clearingCooldown,
10182
+ onClick: familyActions.onClearCooldown
10183
+ }, ...familyActions.clearingCooldown ? [Spinner(), t("account.clearCooldown")] : [uiIcon("zap", 10, "var(--agy-warn-btn-text)"), ` ${t("account.clearCooldown")}`]) : null);
10184
+ if (familyActions?.isActive) return h("span", {
10185
+ key: "fam-active",
10186
+ title: t("status.inUse"),
10187
+ style: {
10188
+ ...S.badgeTag,
10189
+ background: "rgba(16, 185, 129, 0.12)",
10190
+ color: "#10b981",
10191
+ borderColor: "rgba(16, 185, 129, 0.45)",
10192
+ gap: "3px",
10193
+ fontSize: "10px",
10194
+ padding: "1px 5px",
10195
+ fontWeight: 700,
10196
+ whiteSpace: "nowrap",
10197
+ flexShrink: 0
10198
+ }
10199
+ }, uiIcon("zap", 10, "#10b981"), t("status.inUse"));
10200
+ if (familyActions?.canSetActive && familyActions.onSetActive) return h(Button, {
10201
+ key: "fam-set-active",
10202
+ variant: "default",
10203
+ size: "sm",
10204
+ className: "agy-btn",
10205
+ style: {
10206
+ gap: "3px",
10207
+ fontSize: "10.5px",
10208
+ padding: "1px 6px",
10209
+ height: "20px",
10210
+ flexShrink: 0
10211
+ },
10212
+ title: t("account.setActive"),
10213
+ disabled: familyActions.settingActive,
10214
+ onClick: familyActions.onSetActive
10215
+ }, ...familyActions.settingActive ? [Spinner(), t("account.settingActive")] : [uiIcon("zap", 10), ` ${t("account.setActive")}`]);
10216
+ return null;
10217
+ }
8880
10218
  /**
8881
- * One family's quota block: brand mark + 5h/weekly bars with reset countdowns
8882
- * and cooldown notes. Module-level so the settings section and the Plugins-page
8883
- * dashboard render IDENTICAL quota visuals from one implementation.
10219
+ * One family's quota block: brand mark, per-family active/cooling controls,
10220
+ * and 5h/weekly bars with reset countdowns. Module-level so the settings
10221
+ * section and the Plugins-page dashboard render IDENTICAL quota visuals.
8884
10222
  */
8885
- function renderFamilyQuotaBar(t, label, familyKey, acc, isRefreshing = false) {
10223
+ function renderFamilyQuotaBar(t, label, familyKey, acc, isRefreshing = false, familyActions) {
8886
10224
  const info = acc.quotas[familyKey];
8887
- const cd = acc.cooldowns[familyKey];
8888
10225
  const now = Date.now();
8889
- const inCooldown = Boolean(cd && cd.cooldownUntil > now);
8890
- const clearedAt = acc.quotaGateClearedAt?.[familyKey];
8891
- const benched5h = !inCooldown && is5hQuotaBenched(info, clearedAt, now);
8892
- const benchedWeekly = !inCooldown && isWeeklyQuotaBenched(info, clearedAt, now);
10226
+ const cooling = isFamilyCooling(acc, familyKey, now);
10227
+ const cooldownTip = isFamilyInCooldown(acc, familyKey, now) ? formatCooldownTip(t, familyKey, acc, now) : t("status.cooldown");
8893
10228
  const has5h = typeof info?.remainingFraction === "number" && Number.isFinite(info.remainingFraction);
8894
10229
  const pct5h = has5h ? Math.max(0, Math.min(100, Math.round(info.remainingFraction * 100))) : -1;
8895
- const cdNote5h = inCooldown ? t("account.localCooldown") : benched5h ? t("account.quotaLimitedNote") : "";
8896
10230
  const w5h = formatQuotaWindow(t, info?.resetTime);
8897
10231
  const expiredFull5h = w5h.expired && has5h && pct5h >= 100;
8898
10232
  const hasWeekly = typeof info?.weeklyFraction === "number" && Number.isFinite(info.weeklyFraction);
8899
10233
  const pctWeekly = hasWeekly ? Math.max(0, Math.min(100, Math.round(info.weeklyFraction * 100))) : -1;
8900
- const cdNoteWeekly = benchedWeekly ? t("account.quotaLimitedNote") : "";
8901
10234
  const wWeekly = formatQuotaWindow(t, info?.weeklyResetTime);
8902
10235
  const expiredFullWeekly = wWeekly.expired && hasWeekly && pctWeekly >= 100;
8903
10236
  const c5h = getQuotaColors(pct5h);
8904
10237
  const cWeekly = getQuotaColors(pctWeekly);
8905
- const note5h = w5h.resetText ? w5h.resetText + cdNote5h : expiredFull5h ? t("quota.windowReset") + cdNote5h : cdNote5h.replace(/^ · /, "");
8906
- const noteWeekly = wWeekly.resetText ? wWeekly.resetText + cdNoteWeekly : expiredFullWeekly ? t("quota.windowReset") + cdNoteWeekly : cdNoteWeekly.replace(/^ · /, "");
10238
+ const note5h = w5h.resetText ? w5h.resetText : expiredFull5h ? t("quota.windowReset") : "";
10239
+ const noteWeekly = wWeekly.resetText ? wWeekly.resetText : expiredFullWeekly ? t("quota.windowReset") : "";
10240
+ const borderColor = Boolean(!cooling && familyActions?.isActive) ? "var(--dsw-alias-state-business-primary, #3b82f6)" : cooling ? "rgba(245, 158, 11, 0.45)" : "var(--agy-border-box)";
8907
10241
  return h("div", { style: {
8908
10242
  margin: "4px 0",
8909
10243
  padding: "5px 8px",
8910
10244
  background: "var(--agy-bg-subbox)",
8911
10245
  borderRadius: "6px",
8912
- border: "1px solid var(--agy-border-box)"
10246
+ border: `1px solid ${borderColor}`
8913
10247
  } }, h("div", { style: {
8914
10248
  display: "flex",
8915
10249
  alignItems: "center",
8916
- gap: "5px",
10250
+ justifyContent: "space-between",
10251
+ gap: "6px",
8917
10252
  fontWeight: 700,
8918
10253
  fontSize: "12px",
8919
10254
  marginBottom: "3px",
8920
10255
  color: "var(--agy-text-primary)"
8921
- } }, brandIcon(FAMILY_BRAND[familyKey], 13), h("span", null, label)), familyKey !== "argon" || has5h ? renderLine(t, t("quota.fiveHour"), pct5h, c5h, note5h, FIVE_H_MS, info?.remainingFraction, info?.resetTime, isRefreshing) : null, renderLine(t, t("quota.weekly"), pctWeekly, cWeekly, noteWeekly, SEVEN_D_MS, info?.weeklyFraction, info?.weeklyResetTime, isRefreshing));
10256
+ } }, h("div", { style: {
10257
+ display: "flex",
10258
+ alignItems: "center",
10259
+ gap: "5px"
10260
+ } }, brandIcon(FAMILY_BRAND[familyKey], 13), h("span", null, label)), renderFamilyHeaderActions(t, cooling, cooldownTip, familyActions)), familyKey !== "argon" || has5h ? renderLine(t, t("quota.fiveHour"), pct5h, c5h, note5h, FIVE_H_MS, info?.remainingFraction, info?.resetTime, isRefreshing) : null, renderLine(t, t("quota.weekly"), pctWeekly, cWeekly, noteWeekly, SEVEN_D_MS, info?.weeklyFraction, info?.weeklyResetTime, isRefreshing));
8922
10261
  }
8923
10262
  /** Short absolute stamp for "this data is from …" notes (past tense). */
8924
10263
  function formatSnapshotStamp(ms) {
@@ -8981,23 +10320,24 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8981
10320
  }
8982
10321
  //#endregion
8983
10322
  //#region src/client/sections/AccountsPanel.ts
10323
+ function resolveFamilyActiveIds(pool, optimisticActiveByFamily, optimisticActiveId) {
10324
+ const out = {};
10325
+ for (const fam of QUOTA_FAMILIES) out[fam] = optimisticActiveByFamily?.[fam] ?? (fam === "google" ? optimisticActiveId ?? void 0 : void 0) ?? pool?.resolvedActiveAccountIds?.[fam] ?? (fam === "google" ? pool?.activeAccountId ?? pool?.lastActiveAccountId ?? pool?.activeAccountIds?.google ?? pool?.primaryAccountId : pool?.activeAccountIds?.[fam]);
10326
+ return out;
10327
+ }
8984
10328
  function AccountsPanel(props) {
8985
- const { t, pool, accounts, accountModels, loadingAction, quotaRefreshing = [], proxyInputs, setProxyInputs, editingProxyId, setEditingProxyId, expandedModels, toggleExpand, optimisticActiveId, handlers } = props;
10329
+ const { t, pool, accounts, accountModels, loadingAction, quotaRefreshing = [], warmupState, proxyInputs, setProxyInputs, editingProxyId, setEditingProxyId, expandedModels, toggleExpand, optimisticActiveId, optimisticActiveByFamily, handlers } = props;
8986
10330
  const accountActionBusy = (acc, action) => loadingAction === `${action}:${acc.id}`;
8987
- const renderQuotaBar = (label, familyKey, acc) => renderFamilyQuotaBar(t, label, familyKey, acc, loadingAction === "refresh:all" || loadingAction === `refresh:${acc.id}` || quotaRefreshing.includes(acc.id));
8988
- const authoritativeActiveId = pool?.activeAccountId ?? pool?.lastActiveAccountId ?? pool?.activeAccountIds?.google ?? pool?.primaryAccountId;
8989
- const activeAccountId = optimisticActiveId ?? authoritativeActiveId;
10331
+ const activeIds = resolveFamilyActiveIds(pool, optimisticActiveByFamily, optimisticActiveId);
8990
10332
  const now = Date.now();
8991
10333
  return accounts.map((acc) => {
8992
10334
  const isPrimary = acc.id === pool?.primaryAccountId;
8993
- const hasCooldown = accountHasActiveCooldown(acc, now);
8994
- const hasQuotaBench = accountHasQuotaBench(acc, now);
8995
- const isRateLimited = hasCooldown || hasQuotaBench;
8996
10335
  const isAuthRequired = isAccountCriticalAuth(acc);
8997
- const isGoogleCooldown = Boolean(acc.cooldowns?.google && acc.cooldowns.google.cooldownUntil > now);
8998
- const isGoogleEligible = acc.enabled && !isAuthRequired && !isGoogleCooldown && !isQuotaBenched(acc, "google", now);
8999
- const isInUse = Boolean(acc.enabled && !isAuthRequired && activeAccountId !== void 0 && activeAccountId === acc.id);
9000
- const dotColor = !acc.enabled ? "#64748b" : isAuthRequired ? "#ef4444" : isRateLimited ? "#f59e0b" : "#10b981";
10336
+ const isFullyCooling = isAccountFullyCooling(acc, now);
10337
+ const isSyncing = loadingAction === `refresh:${acc.id}` || loadingAction === "refresh:all" || quotaRefreshing.includes(acc.id);
10338
+ const isWarming = loadingAction === `warmup:${acc.id}` || warmupState?.running === true && warmupState.activeAccountIds.includes(acc.id);
10339
+ const hasAnyActiveFamily = Boolean(acc.enabled && !isAuthRequired && QUOTA_FAMILIES.some((fam) => (fam !== "argon" || acc.quotas.argon !== void 0) && !isFamilyCooling(acc, fam, now) && activeIds[fam] === acc.id));
10340
+ const dotColor = !acc.enabled ? "#64748b" : isAuthRequired ? "#ef4444" : isFullyCooling ? "#f59e0b" : "#10b981";
9001
10341
  const isEditingProxy = editingProxyId === acc.id;
9002
10342
  const isExpanded = expandedModels[acc.id] ?? false;
9003
10343
  const accIndex = accounts.indexOf(acc);
@@ -9006,7 +10346,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9006
10346
  cursor: "default",
9007
10347
  padding: "10px 14px",
9008
10348
  marginBottom: "8px",
9009
- ...isInUse ? {
10349
+ ...hasAnyActiveFamily ? {
9010
10350
  borderColor: "var(--dsw-alias-state-business-primary, #3b82f6)",
9011
10351
  boxShadow: "var(--agy-shadow-card-primary)"
9012
10352
  } : {},
@@ -9015,6 +10355,20 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9015
10355
  const legacyDefault = acc.defaultAlias === void 0 && acc.systemHome && acc.alias === "主账号 (系统登录)";
9016
10356
  const displayAlias = acc.defaultAlias || legacyDefault ? acc.systemHome ? t("account.defaultAlias") : t("account.aliasDefault", { number: accIndex + 1 }) : acc.alias;
9017
10357
  const childModels = buildAccountModelRows(acc, accountModels?.[acc.id]);
10358
+ const renderQuotaBar = (label, familyKey) => {
10359
+ const cooling = isFamilyCooling(acc, familyKey, now);
10360
+ const isFamActive = Boolean(acc.enabled && !isAuthRequired && !cooling && activeIds[familyKey] === acc.id);
10361
+ const canSetFamActive = Boolean(acc.enabled && !isAuthRequired && !cooling && activeIds[familyKey] !== acc.id);
10362
+ return renderFamilyQuotaBar(t, label, familyKey, acc, isSyncing, {
10363
+ isActive: isFamActive,
10364
+ canSetActive: canSetFamActive,
10365
+ settingActive: loadingAction === `active:${acc.id}:${familyKey}`,
10366
+ clearingCooldown: loadingAction === `clearCooldown:${acc.id}:${familyKey}`,
10367
+ onSetActive: () => void handlers.setActiveAccount(acc.id, familyKey),
10368
+ onClearCooldown: () => void handlers.clearCooldown(acc.id, familyKey)
10369
+ });
10370
+ };
10371
+ const collapsedCoolingNames = ["anthropic", "openai"].filter((fam) => isFamilyCooling(acc, fam, now)).map((fam) => fam === "anthropic" ? "Claude" : "GPT-OSS");
9018
10372
  return h("div", {
9019
10373
  key: acc.id,
9020
10374
  className: "agy-card-hover",
@@ -9022,12 +10376,10 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9022
10376
  }, renderCardHeader(t, acc, {
9023
10377
  isPrimary,
9024
10378
  isAuthRequired,
9025
- hasCooldown,
9026
- hasQuotaBench,
9027
- isGoogleEligible,
9028
- isInUse,
9029
10379
  dotColor,
9030
10380
  isEditingProxy,
10381
+ isSyncing,
10382
+ isWarming,
9031
10383
  displayAlias,
9032
10384
  accIndex,
9033
10385
  accounts,
@@ -9039,16 +10391,20 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9039
10391
  }), h("div", {
9040
10392
  key: "agy-body",
9041
10393
  style: S.quotaBox
9042
- }, renderQuotaUnavailableNote(t, acc), renderQuotaBar("Gemini", "google", acc), acc.quotas.argon ? renderQuotaBar("Argon", "argon", acc) : null, h(Button, {
10394
+ }, renderQuotaUnavailableNote(t, acc), renderQuotaBar("Gemini", "google"), acc.quotas.argon ? renderQuotaBar("Argon", "argon") : null, h(Button, {
9043
10395
  variant: "dashed",
9044
10396
  style: {
9045
10397
  color: isExpanded ? "var(--dsw-alias-state-business-primary, #3b82f6)" : "var(--agy-text-secondary)",
9046
10398
  padding: "3px 8px",
9047
10399
  fontSize: "11px",
9048
- margin: "4px 0 2px 0"
10400
+ margin: "4px 0 2px 0",
10401
+ gap: "4px"
9049
10402
  },
9050
10403
  onClick: () => toggleExpand(acc.id)
9051
- }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 10), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? h("div", { key: "expanded-details" }, renderQuotaBar("Claude", "anthropic", acc), renderQuotaBar("GPT-OSS", "openai", acc), childModels.length > 0 ? renderChildModels(t, childModels) : null) : null), isRateLimited ? renderCooldownBanner(t, acc, loadingAction, accountActionBusy, handlers) : null, isEditingProxy ? renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) : null);
10404
+ }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 10), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers")), !isExpanded && collapsedCoolingNames.length > 0 ? h("span", { style: {
10405
+ color: "#f59e0b",
10406
+ fontWeight: 700
10407
+ } }, t("account.collapsedCoolingHint", { families: collapsedCoolingNames.join(", ") })) : null), isExpanded ? h("div", { key: "expanded-details" }, renderQuotaBar("Claude", "anthropic"), renderQuotaBar("GPT-OSS", "openai"), childModels.length > 0 ? renderChildModels(t, childModels) : null) : null), isEditingProxy ? renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) : null);
9052
10408
  });
9053
10409
  }
9054
10410
  function extractActionUrl(text) {
@@ -9057,7 +10413,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9057
10413
  return m ? m[0] : void 0;
9058
10414
  }
9059
10415
  function renderStatusBadges(t, acc, ctx) {
9060
- const { isAuthRequired, hasCooldown, hasQuotaBench, isInUse, pool } = ctx;
10416
+ const { isAuthRequired } = ctx;
9061
10417
  const unavailReason = acc.quotaUnavailable?.reason;
9062
10418
  const isTos = isAuthRequired && (unavailReason === "tos_violation" || /\bTOS_VIOLATION\b|violation of Terms of Service/i.test(acc.authError ?? ""));
9063
10419
  const isValidation = isAuthRequired && !isTos && (unavailReason === "validation_required" || /\bVALIDATION_REQUIRED\b/i.test(acc.authError ?? ""));
@@ -9077,36 +10433,18 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9077
10433
  },
9078
10434
  title: acc.email
9079
10435
  }, uiIcon("mail", 10, "var(--agy-badge-email-text)"), acc.email) : null,
9080
- isInUse ? h("span", {
10436
+ acc.proxyUrl ? h("span", {
9081
10437
  style: {
9082
10438
  ...S.badgeTag,
9083
- background: "rgba(16, 185, 129, 0.12)",
9084
- color: "#10b981",
9085
- borderColor: "rgba(16, 185, 129, 0.45)",
9086
- gap: "3px",
10439
+ background: "var(--agy-badge-proxy-bg)",
10440
+ color: "var(--agy-badge-proxy-text)",
10441
+ borderColor: "var(--agy-badge-proxy-border)",
10442
+ gap: "4px",
9087
10443
  fontSize: "10px",
9088
- padding: "1px 5px",
9089
- fontWeight: 700,
9090
- whiteSpace: "nowrap",
9091
- flexShrink: 0
10444
+ padding: "1px 5px"
9092
10445
  },
9093
- title: t("status.inUse")
9094
- }, uiIcon("zap", 10, "#10b981"), t("status.inUse")) : null,
9095
- (() => {
9096
- const effectiveProxy = acc.proxyUrl || pool?.systemProxy;
9097
- return effectiveProxy ? h("span", {
9098
- style: {
9099
- ...S.badgeTag,
9100
- background: "var(--agy-badge-proxy-bg)",
9101
- color: "var(--agy-badge-proxy-text)",
9102
- borderColor: "var(--agy-badge-proxy-border)",
9103
- gap: "4px",
9104
- fontSize: "10px",
9105
- padding: "1px 5px"
9106
- },
9107
- title: effectiveProxy
9108
- }, uiIcon("globe", 10, "var(--agy-badge-proxy-text)"), t("status.proxy")) : null;
9109
- })(),
10446
+ title: acc.proxyUrl
10447
+ }, uiIcon("globe", 10, "var(--agy-badge-proxy-text)"), t("status.proxy")) : null,
9110
10448
  isAuthRequired ? h(actionUrl ? "a" : "span", {
9111
10449
  ...actionUrl ? {
9112
10450
  href: actionUrl,
@@ -9128,18 +10466,6 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9128
10466
  textDecoration: actionUrl ? "underline" : "none"
9129
10467
  }
9130
10468
  }, uiIcon("alert", 10, "#ef4444"), authLabel) : null,
9131
- hasCooldown || hasQuotaBench ? h("span", { style: {
9132
- ...S.badgeTag,
9133
- background: "rgba(245, 158, 11, 0.15)",
9134
- color: "#f59e0b",
9135
- borderColor: "rgba(245, 158, 11, 0.4)",
9136
- gap: "3px",
9137
- fontSize: "10px",
9138
- padding: "1px 5px",
9139
- fontWeight: 700,
9140
- whiteSpace: "nowrap",
9141
- flexShrink: 0
9142
- } }, uiIcon("alert", 10, "#f59e0b"), hasCooldown ? t("status.cooldown") : t("status.quotaLimited")) : null,
9143
10469
  !acc.enabled ? h("span", {
9144
10470
  style: {
9145
10471
  ...S.badgeTag,
@@ -9220,15 +10546,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9220
10546
  whiteSpace: "nowrap"
9221
10547
  },
9222
10548
  title: displayAlias
9223
- }, displayAlias), h("span", { style: {
9224
- ...S.badgeTag,
9225
- background: "rgba(59, 130, 246, 0.12)",
9226
- color: "#3b82f6",
9227
- borderColor: "rgba(59, 130, 246, 0.35)",
9228
- fontSize: "10px",
9229
- padding: "1px 5px",
9230
- fontWeight: 700
9231
- } }, "AGY"));
10549
+ }, displayAlias));
9232
10550
  }
9233
10551
  function renderMetaRow(t, acc, ctx) {
9234
10552
  const badges = renderStatusBadges(t, acc, ctx).filter(Boolean);
@@ -9246,7 +10564,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9246
10564
  }, ...badges);
9247
10565
  }
9248
10566
  function renderCardHeader(t, acc, ctx) {
9249
- const { isEditingProxy, isAuthRequired, isInUse, isGoogleEligible, displayAlias, accounts, loadingAction, accountActionBusy, handlers, setEditingProxyId } = ctx;
10567
+ const { isEditingProxy, isAuthRequired, isSyncing, isWarming, displayAlias, accounts, pool, loadingAction, accountActionBusy, handlers, setEditingProxyId } = ctx;
9250
10568
  return h("div", {
9251
10569
  className: "agy-card-header",
9252
10570
  style: {
@@ -9268,10 +10586,11 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9268
10586
  }, renderHeaderBadges(t, acc, ctx), renderActionButtons(t, acc, {
9269
10587
  isEditingProxy,
9270
10588
  isAuthRequired,
9271
- isInUse,
9272
- isGoogleEligible,
10589
+ isSyncing,
10590
+ isWarming,
9273
10591
  displayAlias,
9274
10592
  showRemove: accounts.length > 1,
10593
+ pool,
9275
10594
  loadingAction,
9276
10595
  accountActionBusy,
9277
10596
  handlers,
@@ -9279,7 +10598,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9279
10598
  })), renderMetaRow(t, acc, ctx));
9280
10599
  }
9281
10600
  function renderActionButtons(t, acc, ctx) {
9282
- const { isEditingProxy, isAuthRequired, isInUse, isGoogleEligible, displayAlias, showRemove, loadingAction, accountActionBusy, handlers, setEditingProxyId } = ctx;
10601
+ const { isEditingProxy, isAuthRequired, isSyncing, isWarming, displayAlias, showRemove, pool, loadingAction, accountActionBusy, handlers, setEditingProxyId } = ctx;
10602
+ const effectiveProxy = acc.proxyUrl || pool?.systemProxy;
9283
10603
  return h("div", {
9284
10604
  className: "agy-card-actions",
9285
10605
  style: {
@@ -9313,9 +10633,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9313
10633
  justifyContent: "center"
9314
10634
  },
9315
10635
  title: t("account.syncTitle"),
9316
- disabled: accountActionBusy(acc, "refresh"),
10636
+ disabled: isSyncing,
9317
10637
  onClick: () => void handlers.refreshQuota(acc.id)
9318
- }, ...loadingAction === `refresh:${acc.id}` ? [Spinner(), t("account.syncing")] : [uiIcon("refresh", 10), ` ${t("account.sync")}`]), isAuthRequired && handlers.beginReauth ? h(Button, {
10638
+ }, ...isSyncing ? [Spinner(), t("account.syncing")] : [uiIcon("refresh", 10), ` ${t("account.sync")}`]), isAuthRequired && handlers.beginReauth ? h(Button, {
9319
10639
  variant: "primary",
9320
10640
  size: "sm",
9321
10641
  className: "agy-btn",
@@ -9340,22 +10660,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9340
10660
  justifyContent: "center"
9341
10661
  },
9342
10662
  title: t("account.warmupTitle"),
9343
- disabled: accountActionBusy(acc, "warmup"),
10663
+ disabled: isWarming,
9344
10664
  onClick: () => void handlers.warmupAccount(acc.id)
9345
- }, ...loadingAction === `warmup:${acc.id}` ? [Spinner(), t("account.warmingUp")] : [uiIcon("flame", 10, "#f97316"), ` ${t("account.warmup")}`]) : null, isGoogleEligible && !isInUse ? h(Button, {
9346
- variant: "default",
9347
- size: "sm",
9348
- className: "agy-btn",
9349
- style: {
9350
- gap: "3px",
9351
- fontSize: "11px",
9352
- padding: "1px 6px",
9353
- height: "22px"
9354
- },
9355
- title: t("account.setActive"),
9356
- disabled: accountActionBusy(acc, "active"),
9357
- onClick: () => void handlers.setActiveAccount(acc.id)
9358
- }, ...loadingAction === `active:${acc.id}` ? [Spinner(), t("account.settingActive")] : [uiIcon("zap", 10), ` ${t("account.setActive")}`]) : null, h(Button, {
10665
+ }, ...isWarming ? [Spinner(), t("account.warmingUp")] : [uiIcon("flame", 10, "#f97316"), ` ${t("account.warmup")}`]) : null, h(Button, {
9359
10666
  variant: isEditingProxy ? "primary" : "default",
9360
10667
  size: "sm",
9361
10668
  className: "agy-btn",
@@ -9365,6 +10672,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9365
10672
  padding: "1px 6px",
9366
10673
  height: "22px"
9367
10674
  },
10675
+ title: effectiveProxy || t("proxy.placeholder"),
9368
10676
  disabled: accountActionBusy(acc, "proxy"),
9369
10677
  onClick: () => setEditingProxyId(isEditingProxy ? null : acc.id)
9370
10678
  }, uiIcon("globe", 10), ` ${t("proxy.button")}`), showRemove ? h(Button, {
@@ -9447,49 +10755,15 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9447
10755
  }, `↻ ${w.resetText}`) : null));
9448
10756
  }));
9449
10757
  }
9450
- function renderCooldownBanner(t, acc, loadingAction, accountActionBusy, handlers) {
10758
+ function renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) {
9451
10759
  return h("div", {
9452
- key: "cd-body",
10760
+ key: "proxy-body",
9453
10761
  style: {
9454
- background: "var(--agy-warn-bg)",
9455
- border: "1px solid var(--agy-warn-border)",
9456
- borderRadius: "7px",
9457
- padding: "6px 10px",
9458
- color: "var(--agy-warn-text)",
9459
- fontSize: "11.5px",
9460
- fontWeight: 600,
9461
10762
  marginTop: "8px",
9462
- display: "flex",
9463
- alignItems: "center",
9464
- justifyContent: "space-between"
9465
- }
9466
- }, h("div", { style: {
9467
- display: "flex",
9468
- alignItems: "center",
9469
- gap: "6px"
9470
- } }, uiIcon("alert", 13, "var(--agy-warn-text)"), h("span", null, t("account.cooldown"))), h(Button, {
9471
- variant: "default",
9472
- size: "sm",
9473
- className: "agy-btn",
9474
- style: {
9475
- color: "var(--agy-warn-btn-text)",
9476
- borderColor: "var(--agy-warn-btn-border)",
9477
- background: "var(--agy-warn-btn-bg)",
9478
- gap: "4px"
9479
- },
9480
- disabled: accountActionBusy(acc, "clearCooldown"),
9481
- onClick: () => void handlers.clearCooldown(acc.id)
9482
- }, ...loadingAction === `clearCooldown:${acc.id}` ? [Spinner(), ""] : [uiIcon("zap", 11, "var(--agy-warn-btn-text)"), ` ${t("account.clearCooldown")}`]));
9483
- }
9484
- function renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) {
9485
- return h("div", {
9486
- key: "proxy-body",
9487
- style: {
9488
- marginTop: "8px",
9489
- padding: "10px 12px",
9490
- background: "var(--agy-bg-subbox)",
9491
- borderRadius: "7px",
9492
- border: "1px solid var(--agy-border-subbox)"
10763
+ padding: "10px 12px",
10764
+ background: "var(--agy-bg-subbox)",
10765
+ borderRadius: "7px",
10766
+ border: "1px solid var(--agy-border-subbox)"
9493
10767
  }
9494
10768
  }, h("div", { style: {
9495
10769
  display: "flex",
@@ -9515,6 +10789,226 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9515
10789
  }, t("cancel"))));
9516
10790
  }
9517
10791
  //#endregion
10792
+ //#region src/client/sections/EcosystemPanel.ts
10793
+ function summaryBadge(key, text) {
10794
+ return h("span", {
10795
+ key,
10796
+ style: S.badgeTag
10797
+ }, text);
10798
+ }
10799
+ function renderPluginsGroup(t, snap, busyId, onToggle) {
10800
+ if (snap.plugins.length === 0) return null;
10801
+ return h("div", { style: {
10802
+ display: "flex",
10803
+ flexDirection: "column",
10804
+ gap: "4px"
10805
+ } }, h("div", { style: {
10806
+ fontWeight: 600,
10807
+ fontSize: "11.5px",
10808
+ color: "var(--agy-text-secondary)"
10809
+ } }, t("eco.plugins", { count: snap.plugins.length })), ...snap.plugins.map((p) => h("div", {
10810
+ key: "pl-" + p.id,
10811
+ style: {
10812
+ display: "flex",
10813
+ alignItems: "center",
10814
+ justifyContent: "space-between",
10815
+ gap: "8px",
10816
+ padding: "4px 8px",
10817
+ borderRadius: "6px",
10818
+ background: "var(--agy-bg-subbox)",
10819
+ border: "1px solid var(--agy-border-subbox)"
10820
+ }
10821
+ }, h("div", { style: {
10822
+ minWidth: 0,
10823
+ flex: "1 1 0"
10824
+ } }, h("div", { style: {
10825
+ fontSize: "12px",
10826
+ fontWeight: 600,
10827
+ color: "var(--agy-text-primary)"
10828
+ } }, `${p.name} (${p.source})`), p.description ? h("div", { style: {
10829
+ ...S.muted,
10830
+ overflow: "hidden",
10831
+ textOverflow: "ellipsis",
10832
+ whiteSpace: "nowrap"
10833
+ } }, p.description) : null), h(Button, {
10834
+ variant: p.enabled ? "primary" : "default",
10835
+ size: "sm",
10836
+ className: "agy-btn",
10837
+ disabled: busyId === p.id,
10838
+ onClick: () => onToggle(p.id, !p.enabled)
10839
+ }, p.enabled ? t("config.on") : t("config.off")))));
10840
+ }
10841
+ function renderAgentsGroup(t, snap, currentAgent, loadingAction, setCfg) {
10842
+ if (snap.agents.length === 0) return null;
10843
+ return h("div", { style: {
10844
+ display: "flex",
10845
+ flexDirection: "column",
10846
+ gap: "4px"
10847
+ } }, h("div", { style: {
10848
+ fontWeight: 600,
10849
+ fontSize: "11.5px",
10850
+ color: "var(--agy-text-secondary)"
10851
+ } }, t("eco.agents", { count: snap.agents.length })), ...snap.agents.map((a) => {
10852
+ const active = currentAgent.trim() === a.name;
10853
+ return h("div", {
10854
+ key: "ag-" + a.name + ":" + a.source,
10855
+ style: {
10856
+ display: "flex",
10857
+ alignItems: "center",
10858
+ justifyContent: "space-between",
10859
+ gap: "8px",
10860
+ padding: "4px 8px",
10861
+ borderRadius: "6px",
10862
+ background: "var(--agy-bg-subbox)",
10863
+ border: "1px solid var(--agy-border-subbox)"
10864
+ }
10865
+ }, h("div", { style: {
10866
+ minWidth: 0,
10867
+ flex: "1 1 0"
10868
+ } }, h("div", { style: {
10869
+ fontSize: "12px",
10870
+ fontWeight: 600,
10871
+ color: "var(--agy-text-primary)"
10872
+ } }, `${a.name} (${a.source})`), a.description ? h("div", { style: S.muted }, a.description) : null), h(Button, {
10873
+ variant: active ? "primary" : "default",
10874
+ size: "sm",
10875
+ className: "agy-btn",
10876
+ disabled: loadingAction === "config:agent",
10877
+ onClick: () => void setCfg("agent", active ? "" : a.name)
10878
+ }, active ? t("eco.activeAgent") : t("eco.useAgent")));
10879
+ }));
10880
+ }
10881
+ function renderCompactSummaryList(t, snap) {
10882
+ const items = [];
10883
+ if (snap.mcpServers.length > 0) items.push(h("div", {
10884
+ key: "mcp",
10885
+ style: S.muted
10886
+ }, `${t("eco.mcp", { count: snap.mcpServers.length })}: ${snap.mcpServers.map((m) => m.name).join(", ")}`));
10887
+ if (snap.skills.length > 0) items.push(h("div", {
10888
+ key: "skills",
10889
+ style: S.muted
10890
+ }, `${t("eco.skills", { count: snap.skills.length })}: ${snap.skills.map((s) => s.name).join(", ")}`));
10891
+ if (snap.rules.length > 0) items.push(h("div", {
10892
+ key: "rules",
10893
+ style: S.muted
10894
+ }, `${t("eco.rules", { count: snap.rules.length })}: ${snap.rules.map((r) => r.name).join(", ")}`));
10895
+ if (items.length === 0 && snap.plugins.length === 0 && snap.agents.length === 0) items.push(h("div", {
10896
+ key: "empty",
10897
+ style: S.muted
10898
+ }, t("eco.empty")));
10899
+ return h("div", { style: {
10900
+ display: "flex",
10901
+ flexDirection: "column",
10902
+ gap: "3px"
10903
+ } }, ...items);
10904
+ }
10905
+ function EcosystemPanel(props) {
10906
+ const { t, currentAgent, loadingAction, setCfg, showToast } = props;
10907
+ const [expanded, setExpanded] = useState(false);
10908
+ const [snap, setSnap] = useState(null);
10909
+ const [syncing, setSyncing] = useState(false);
10910
+ const [togglingPlugin, setTogglingPlugin] = useState(null);
10911
+ const loadSnapshot = async () => {
10912
+ const data = await getJson("/plugins/agy-link/ecosystem");
10913
+ if (data && Array.isArray(data.plugins)) setSnap(data);
10914
+ };
10915
+ useEffect(() => {
10916
+ loadSnapshot();
10917
+ }, []);
10918
+ const handleSync = async () => {
10919
+ setSyncing(true);
10920
+ try {
10921
+ const res = await postJson("/plugins/agy-link/ecosystem/sync", {});
10922
+ if (res && res.ok) {
10923
+ if (res.snapshot) setSnap(res.snapshot);
10924
+ const r = res.report;
10925
+ showToast(t("eco.synced", {
10926
+ accounts: Array.isArray(r?.syncedAccounts) ? r.syncedAccounts.length : 0,
10927
+ copied: r?.copiedFiles ?? 0,
10928
+ removed: r?.removedFiles ?? 0
10929
+ }), "success");
10930
+ } else showToast(t("eco.syncFailed"), "warn");
10931
+ } finally {
10932
+ setSyncing(false);
10933
+ }
10934
+ };
10935
+ const handleTogglePlugin = async (id, enabled) => {
10936
+ setTogglingPlugin(id);
10937
+ try {
10938
+ const res = await postJson("/plugins/agy-link/ecosystem/plugin", {
10939
+ id,
10940
+ enabled
10941
+ });
10942
+ if (res && res.ok && res.snapshot) {
10943
+ setSnap(res.snapshot);
10944
+ showToast(t("eco.pluginToggled", { id }), "success");
10945
+ } else showToast(t("eco.toggleFailed"), "warn");
10946
+ } finally {
10947
+ setTogglingPlugin(null);
10948
+ }
10949
+ };
10950
+ const badges = snap ? [
10951
+ summaryBadge("pl", t("eco.plugins", { count: snap.plugins.length })),
10952
+ summaryBadge("mcp", t("eco.mcp", { count: snap.mcpServers.length })),
10953
+ summaryBadge("ag", t("eco.agents", { count: snap.agents.length })),
10954
+ summaryBadge("sk", t("eco.skills", { count: snap.skills.length })),
10955
+ summaryBadge("rl", t("eco.rules", { count: snap.rules.length }))
10956
+ ] : [];
10957
+ return h("div", { style: {
10958
+ ...S.card,
10959
+ marginTop: "4px",
10960
+ marginBottom: 0,
10961
+ display: "flex",
10962
+ flexDirection: "column",
10963
+ gap: "8px"
10964
+ } }, h("div", { style: {
10965
+ display: "flex",
10966
+ alignItems: "center",
10967
+ justifyContent: "space-between",
10968
+ gap: "8px",
10969
+ flexWrap: "wrap"
10970
+ } }, h("div", { style: {
10971
+ display: "flex",
10972
+ flexDirection: "column",
10973
+ minWidth: 0,
10974
+ flex: "1 1 0"
10975
+ } }, h("span", { style: {
10976
+ color: "var(--agy-text-primary)",
10977
+ fontWeight: 600,
10978
+ fontSize: "12.5px"
10979
+ } }, t("eco.heading")), h("span", { style: S.muted }, t("eco.desc"))), h("div", { style: {
10980
+ display: "flex",
10981
+ alignItems: "center",
10982
+ gap: "6px",
10983
+ flexShrink: 0
10984
+ } }, h(Button, {
10985
+ variant: "default",
10986
+ size: "sm",
10987
+ className: "agy-btn",
10988
+ disabled: syncing,
10989
+ onClick: () => void handleSync()
10990
+ }, syncing ? t("eco.syncing") : t("eco.syncNow")), h(Button, {
10991
+ variant: "default",
10992
+ size: "sm",
10993
+ className: "agy-btn",
10994
+ onClick: () => {
10995
+ const next = !expanded;
10996
+ setExpanded(next);
10997
+ if (next && !snap) loadSnapshot();
10998
+ }
10999
+ }, expanded ? t("eco.collapse") : t("eco.expand")))), badges.length > 0 ? h("div", { style: {
11000
+ display: "flex",
11001
+ flexWrap: "wrap",
11002
+ gap: "5px"
11003
+ } }, ...badges) : null, expanded && snap ? h("div", { style: {
11004
+ display: "flex",
11005
+ flexDirection: "column",
11006
+ gap: "8px",
11007
+ paddingTop: "4px",
11008
+ borderTop: "1px solid var(--agy-border-divider)"
11009
+ } }, renderPluginsGroup(t, snap, togglingPlugin, (id, en) => void handleTogglePlugin(id, en)), renderAgentsGroup(t, snap, currentAgent, loadingAction, setCfg), renderCompactSummaryList(t, snap)) : null);
11010
+ }
11011
+ //#endregion
9518
11012
  //#region src/client/sections/ModelsPanel.ts
9519
11013
  function ModelsPanel({ t, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, setSelectedModels }) {
9520
11014
  const unrestricted = selectedModelSet.size === 0;
@@ -9566,6 +11060,304 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9566
11060
  })), h("span", { style: S.muted }, t("models.hint")));
9567
11061
  }
9568
11062
  //#endregion
11063
+ //#region src/client/sections/RuntimeControlsRows.ts
11064
+ function rowCaption(title, desc) {
11065
+ return h("div", { style: {
11066
+ display: "flex",
11067
+ flexDirection: "column",
11068
+ minWidth: 0,
11069
+ flex: "1 1 0"
11070
+ } }, h("span", { style: {
11071
+ color: "var(--agy-text-primary)",
11072
+ fontWeight: 600,
11073
+ fontSize: "12.5px"
11074
+ } }, title), h("span", { style: S.muted }, desc));
11075
+ }
11076
+ function boolRow(opts) {
11077
+ return h(Row, {
11078
+ left: rowCaption(opts.title, opts.desc),
11079
+ right: segGroup([h(Button, {
11080
+ key: "on",
11081
+ variant: opts.value ? "segActive" : "seg",
11082
+ disabled: opts.loadingAction === "config:" + opts.cfgKey,
11083
+ onClick: () => void opts.setCfg(opts.cfgKey, true)
11084
+ }, opts.t("config.on")), h(Button, {
11085
+ key: "off",
11086
+ variant: !opts.value ? "segActive" : "seg",
11087
+ disabled: opts.loadingAction === "config:" + opts.cfgKey,
11088
+ onClick: () => void opts.setCfg(opts.cfgKey, false)
11089
+ }, opts.t("config.off"))])
11090
+ });
11091
+ }
11092
+ function renderPermissionModeRow(props) {
11093
+ const { t, status, loadingAction, setCfg } = props;
11094
+ const cur = status.permissionMode || "skip";
11095
+ const modes = [
11096
+ {
11097
+ id: "skip",
11098
+ label: t("config.modeSkip")
11099
+ },
11100
+ {
11101
+ id: "auto",
11102
+ label: t("config.modeAuto")
11103
+ },
11104
+ {
11105
+ id: "accept-edits",
11106
+ label: t("config.modeAcceptEdits")
11107
+ },
11108
+ {
11109
+ id: "plan",
11110
+ label: t("config.modePlan")
11111
+ }
11112
+ ];
11113
+ return h(Row, {
11114
+ style: {
11115
+ gap: "10px",
11116
+ flexWrap: "wrap"
11117
+ },
11118
+ left: rowCaption(t("config.permissionMode"), t("config.permissionModeDesc")),
11119
+ right: segGroup(modes.map((m) => h(Button, {
11120
+ key: m.id,
11121
+ variant: cur === m.id ? "segActive" : "seg",
11122
+ disabled: loadingAction === "config:permissionMode",
11123
+ onClick: () => void setCfg("permissionMode", m.id)
11124
+ }, m.label)))
11125
+ });
11126
+ }
11127
+ function renderTransportRow(props) {
11128
+ const { t, status, loadingAction, setCfg } = props;
11129
+ const transport = status.transport === "acp" ? "acp" : "cli";
11130
+ const acpInfo = status.acpStatus;
11131
+ return h(Row, {
11132
+ style: {
11133
+ gap: "10px",
11134
+ flexWrap: "wrap"
11135
+ },
11136
+ left: rowCaption(t("config.transport"), t("config.transportDesc")),
11137
+ right: h("div", { style: {
11138
+ display: "flex",
11139
+ alignItems: "center",
11140
+ gap: "8px",
11141
+ flexWrap: "wrap"
11142
+ } }, transport === "acp" && acpInfo ? h("span", { style: S.badgeTag }, t("config.acpStats", {
11143
+ procs: acpInfo.activeProcesses,
11144
+ sessions: acpInfo.sessions
11145
+ })) : null, segGroup([h(Button, {
11146
+ key: "cli",
11147
+ variant: transport === "cli" ? "segActive" : "seg",
11148
+ disabled: loadingAction === "config:transport",
11149
+ onClick: () => void setCfg("transport", "cli")
11150
+ }, t("config.transportCli")), h(Button, {
11151
+ key: "acp",
11152
+ variant: transport === "acp" ? "segActive" : "seg",
11153
+ disabled: loadingAction === "config:transport",
11154
+ onClick: () => void setCfg("transport", "acp")
11155
+ }, t("config.transportAcp"))]))
11156
+ });
11157
+ }
11158
+ function renderAgentRow(props) {
11159
+ const { t, status, loadingAction, setCfg, draft, setDraft } = props;
11160
+ const saved = (status.agent ?? "").trim();
11161
+ const busy = loadingAction === "config:agent";
11162
+ return h(Row, {
11163
+ style: {
11164
+ gap: "10px",
11165
+ flexWrap: "wrap"
11166
+ },
11167
+ left: rowCaption(t("config.agent"), t("config.agentDesc")),
11168
+ right: h("div", { style: {
11169
+ display: "flex",
11170
+ alignItems: "center",
11171
+ gap: "6px"
11172
+ } }, h("input", {
11173
+ style: {
11174
+ ...S.input,
11175
+ width: "165px",
11176
+ padding: "3px 8px",
11177
+ fontSize: "11.5px"
11178
+ },
11179
+ value: draft,
11180
+ placeholder: t("config.agentPlaceholder"),
11181
+ "aria-label": t("config.agent"),
11182
+ onChange: (e) => setDraft(e?.target?.value ?? "")
11183
+ }), h(Button, {
11184
+ variant: "default",
11185
+ size: "sm",
11186
+ className: "agy-btn",
11187
+ disabled: busy || draft.trim() === saved,
11188
+ onClick: () => void setCfg("agent", draft.trim())
11189
+ }, t("config.save")), saved !== "" ? h(Button, {
11190
+ variant: "default",
11191
+ size: "sm",
11192
+ className: "agy-btn",
11193
+ disabled: busy,
11194
+ onClick: () => void setCfg("agent", "")
11195
+ }, t("config.clear")) : null)
11196
+ });
11197
+ }
11198
+ function RuntimeControlsSection(props) {
11199
+ const { t, status, loadingAction, setCfg } = props;
11200
+ const [agentDraft, setAgentDraft] = useState(status.agent ?? "");
11201
+ useEffect(() => {
11202
+ setAgentDraft(status.agent ?? "");
11203
+ }, [status.agent]);
11204
+ return h("div", { style: {
11205
+ display: "flex",
11206
+ flexDirection: "column",
11207
+ gap: "10px"
11208
+ } }, renderPermissionModeRow(props), boolRow({
11209
+ t,
11210
+ title: t("config.sandbox"),
11211
+ desc: t("config.sandboxDesc"),
11212
+ cfgKey: "sandbox",
11213
+ value: status.sandbox === true,
11214
+ loadingAction,
11215
+ setCfg
11216
+ }), renderTransportRow(props), boolRow({
11217
+ t,
11218
+ title: t("config.imageTool"),
11219
+ desc: t("config.imageToolDesc"),
11220
+ cfgKey: "imageTool",
11221
+ value: status.imageTool !== false,
11222
+ loadingAction,
11223
+ setCfg
11224
+ }), boolRow({
11225
+ t,
11226
+ title: t("config.syncCustomizations"),
11227
+ desc: t("config.syncCustomizationsDesc"),
11228
+ cfgKey: "syncAccountCustomizations",
11229
+ value: status.syncAccountCustomizations !== false,
11230
+ loadingAction,
11231
+ setCfg
11232
+ }), renderAgentRow({
11233
+ ...props,
11234
+ draft: agentDraft,
11235
+ setDraft: setAgentDraft
11236
+ }));
11237
+ }
11238
+ //#endregion
11239
+ //#region src/client/sections/ImageSettingsRows.ts
11240
+ const IMAGE_CLI_SAMPLE = "dsh-agy-image -p \"…\" -a 16:9 -o ./image.jpg";
11241
+ function renderImageRow(t, status, catalogModels, loadingAction, setCfg, copyImageCommand, labels) {
11242
+ return h("div", { style: {
11243
+ display: "flex",
11244
+ flexDirection: "column",
11245
+ gap: "6px"
11246
+ } }, h("div", { style: {
11247
+ display: "flex",
11248
+ alignItems: "center",
11249
+ justifyContent: "space-between",
11250
+ gap: "10px"
11251
+ } }, h("div", { style: {
11252
+ display: "flex",
11253
+ flexDirection: "column",
11254
+ minWidth: 0,
11255
+ flex: "1 1 0"
11256
+ } }, h("span", { style: {
11257
+ color: "var(--agy-text-primary)",
11258
+ fontWeight: 600,
11259
+ fontSize: "12.5px"
11260
+ } }, t("config.image")), h("span", { style: S.muted }, t("config.imageDesc"))), h("div", { style: S.cfgRowRight }, h(Select, {
11261
+ value: status.imageModel ?? "",
11262
+ ariaLabel: t("config.imageModel"),
11263
+ title: t("config.imageModelDesc"),
11264
+ disabled: loadingAction === "config:imageModel",
11265
+ onChange: (e) => void setCfg("imageModel", e?.target?.value ?? ""),
11266
+ options: translateModelOptions(status.imageModel ?? "", geminiCatalogModels(catalogModels), t("config.translateModelAuto"))
11267
+ }), h(Select, {
11268
+ value: status.imageEffort ?? "",
11269
+ ariaLabel: t("config.imageEffort"),
11270
+ title: t("config.imageEffortDesc"),
11271
+ style: {
11272
+ minWidth: "78px",
11273
+ maxWidth: "110px"
11274
+ },
11275
+ disabled: loadingAction === "config:imageEffort",
11276
+ onChange: (e) => void setCfg("imageEffort", e?.target?.value ?? ""),
11277
+ options: translateEffortOptions(status.imageEffort ?? "", labels, status.imageModel ?? "", catalogModels)
11278
+ }))), h("div", { style: {
11279
+ display: "flex",
11280
+ alignItems: "center",
11281
+ gap: "6px",
11282
+ minWidth: 0
11283
+ } }, h("code", { style: {
11284
+ flex: "1 1 auto",
11285
+ minWidth: 0,
11286
+ overflow: "hidden",
11287
+ textOverflow: "ellipsis",
11288
+ whiteSpace: "nowrap",
11289
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
11290
+ fontSize: "11px",
11291
+ color: "var(--agy-text-secondary)",
11292
+ background: "var(--agy-bg-subbox)",
11293
+ border: "1px solid var(--agy-border-subbox)",
11294
+ borderRadius: "5px",
11295
+ padding: "3px 7px"
11296
+ } }, IMAGE_CLI_SAMPLE), h(Button, {
11297
+ variant: "default",
11298
+ size: "sm",
11299
+ className: "agy-btn",
11300
+ style: {
11301
+ flex: "0 0 auto",
11302
+ whiteSpace: "nowrap"
11303
+ },
11304
+ onClick: copyImageCommand
11305
+ }, t("config.imageCopy"))));
11306
+ }
11307
+ //#endregion
11308
+ //#region src/client/sections/WarmupStatusBar.ts
11309
+ function formatClock(ms) {
11310
+ const d = new Date(ms);
11311
+ return `${d.getHours().toString().padStart(2, "0")}:${d.getMinutes().toString().padStart(2, "0")}`;
11312
+ }
11313
+ function WarmupStatusBar(props) {
11314
+ const { t, warmupState, accounts } = props;
11315
+ if (!warmupState) return null;
11316
+ if (warmupState.running) {
11317
+ const current = warmupState.currentAccountId ? accounts.find((a) => a.id === warmupState.currentAccountId) : void 0;
11318
+ const accountLabel = current?.alias || current?.email || warmupState.currentAccountId || "";
11319
+ const label = accountLabel ? t("warmup.progressCurrent", {
11320
+ completed: warmupState.completed,
11321
+ total: warmupState.total,
11322
+ account: accountLabel
11323
+ }) : t("warmup.progress", {
11324
+ completed: warmupState.completed,
11325
+ total: warmupState.total
11326
+ });
11327
+ return h("span", {
11328
+ key: "warmup-running-badge",
11329
+ style: {
11330
+ ...S.badgeTag,
11331
+ fontSize: "11px",
11332
+ padding: "2px 7px",
11333
+ gap: "5px",
11334
+ color: "#f97316",
11335
+ borderColor: "rgba(249, 115, 22, 0.35)",
11336
+ background: "rgba(249, 115, 22, 0.08)"
11337
+ }
11338
+ }, Spinner(), label);
11339
+ }
11340
+ const last = warmupState.lastRun;
11341
+ if (!last) return null;
11342
+ const detail = last.accounts.map((a) => `${a.alias}: ok=${a.succeeded}, skip=${a.skipped}, fail=${a.failed}${a.lastError ? ` (${a.lastError.slice(0, 120)})` : ""}`).join("\n");
11343
+ return h("span", {
11344
+ key: "warmup-last-run",
11345
+ title: detail || void 0,
11346
+ style: {
11347
+ fontSize: "11px",
11348
+ color: last.failed > 0 ? "var(--agy-warn-text)" : "var(--agy-text-tertiary)",
11349
+ fontWeight: 500,
11350
+ whiteSpace: "nowrap",
11351
+ cursor: detail ? "help" : "default"
11352
+ }
11353
+ }, t("warmup.lastRun", {
11354
+ time: formatClock(last.finishedAt),
11355
+ ok: last.succeeded,
11356
+ skipped: last.skipped,
11357
+ failed: last.failed
11358
+ }));
11359
+ }
11360
+ //#endregion
9569
11361
  //#region src/client/sections/VisibilityRows.ts
9570
11362
  function visibilityRow(o) {
9571
11363
  return h(Row, {
@@ -9636,13 +11428,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9636
11428
  }
9637
11429
  //#endregion
9638
11430
  //#region src/client/sections/SettingsSection.ts
9639
- /**
9640
- * BUSY-STATE WATCHDOG. Every action sets a busy flag and clears it when its
9641
- * request settles. A host route with no .catch, a 20s `agy /usage` spawn, or a
9642
- * browser fetch with no timeout each used to leave "同步中" spinning forever.
9643
- * The request layer now bounds those; this is the final invariant — no busy
9644
- * flag may outlive BUSY_TIMEOUT_MS.
9645
- */
11431
+ /** Bound any action busy flag so a stalled fetch never leaves a spinner stuck. */
9646
11432
  function useBusyAction() {
9647
11433
  const [loadingAction, setLoadingAction] = useState(null);
9648
11434
  const timerRef = useRef(null);
@@ -9659,7 +11445,6 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9659
11445
  }, []);
9660
11446
  return [loadingAction, set];
9661
11447
  }
9662
- const IMAGE_CLI_SAMPLE = "dsh-agy-image -p \"…\" -a 16:9 -o ./image.jpg";
9663
11448
  /** Slightly longer than a bounded write, so a normal failure still shows its own toast. */
9664
11449
  const BUSY_TIMEOUT_MS = 25e3;
9665
11450
  function createSettingsSection(locale) {
@@ -9687,7 +11472,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9687
11472
  const [proxyInputs, setProxyInputs] = useState({});
9688
11473
  const [editingProxyId, setEditingProxyId] = useState(null);
9689
11474
  const [expandedModels, setExpandedModels] = useState({});
9690
- const [optimisticActiveId, setOptimisticActiveId] = useState(null);
11475
+ const [optimisticActiveByFamily, setOptimisticActiveByFamily] = useState({});
9691
11476
  useEffect(() => {
9692
11477
  return acquireOverlaySuspend();
9693
11478
  }, []);
@@ -9718,7 +11503,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9718
11503
  t,
9719
11504
  proxyInputs,
9720
11505
  setEditingProxyId,
9721
- setOptimisticActiveId
11506
+ setOptimisticActiveByFamily
9722
11507
  });
9723
11508
  const copyImageCommand = () => {
9724
11509
  const clip = win$1.navigator?.clipboard;
@@ -9742,6 +11527,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9742
11527
  const accounts = pool?.accounts ?? [];
9743
11528
  const isAuthed = authPhase === "ok" || accounts.length > 0;
9744
11529
  const isBusy = loadingAction !== null;
11530
+ const isWarmupAllBusy = loadingAction === "warmup:all" || status?.warmupState?.running === true;
11531
+ const isRefreshAllBusy = loadingAction === "refresh:all" || (status?.quotaRefreshing?.length ?? 0) > 0;
9745
11532
  if (status === null) return h("div", { style: {
9746
11533
  ...S.container,
9747
11534
  minHeight: "120px",
@@ -9752,7 +11539,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9752
11539
  return h("div", {
9753
11540
  className: "agy-console",
9754
11541
  style: S.container
9755
- }, renderHeader(t, isAuthed, auth.addingAccount, isBusy, loadingAction, {
11542
+ }, renderHeader(t, isAuthed, auth.addingAccount, isBusy, isWarmupAllBusy, isRefreshAllBusy, {
9756
11543
  onAdd: () => auth.setAddingAccount(true),
9757
11544
  onWarmupAll: () => void accountActions.warmupAccount(),
9758
11545
  onRefreshAll: () => void accountActions.refreshQuota()
@@ -9765,7 +11552,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9765
11552
  alignItems: "center",
9766
11553
  justifyContent: "space-between",
9767
11554
  marginBottom: "8px",
9768
- padding: "0 2px"
11555
+ padding: "0 2px",
11556
+ gap: "8px",
11557
+ flexWrap: "wrap"
9769
11558
  } }, h("div", { style: {
9770
11559
  display: "flex",
9771
11560
  alignItems: "center",
@@ -9774,20 +11563,25 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9774
11563
  fontWeight: 700,
9775
11564
  fontSize: "12.5px",
9776
11565
  color: "var(--agy-text-primary)"
9777
- } }, `账号池 (${accounts.length})`))), h(AccountsPanel, {
11566
+ } }, t("account.poolHeading", { count: accounts.length }))), h(WarmupStatusBar, {
11567
+ t,
11568
+ warmupState: status.warmupState ?? null,
11569
+ accounts
11570
+ })), h(AccountsPanel, {
9778
11571
  t,
9779
11572
  pool,
9780
11573
  accounts,
9781
11574
  accountModels: status.accountModels,
9782
11575
  loadingAction,
9783
11576
  quotaRefreshing: status.quotaRefreshing ?? [],
11577
+ warmupState: status.warmupState ?? null,
9784
11578
  proxyInputs,
9785
11579
  setProxyInputs,
9786
11580
  editingProxyId,
9787
11581
  setEditingProxyId,
9788
11582
  expandedModels,
9789
11583
  toggleExpand,
9790
- optimisticActiveId,
11584
+ optimisticActiveByFamily,
9791
11585
  handlers: {
9792
11586
  ...accountActions,
9793
11587
  beginReauth: auth.handleBeginReauth
@@ -9796,11 +11590,12 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9796
11590
  setCfg: config.setCfg,
9797
11591
  setMode: config.setMode,
9798
11592
  setSelectedModels: config.setSelectedModels,
9799
- copyImageCommand
11593
+ copyImageCommand,
11594
+ showToast
9800
11595
  }));
9801
11596
  };
9802
11597
  }
9803
- function renderHeader(t, isAuthed, addingAccount, isBusy, loadingAction, actions) {
11598
+ function renderHeader(t, isAuthed, addingAccount, isBusy, isWarmupAllBusy, isRefreshAllBusy, actions) {
9804
11599
  return h("div", { style: S.headerCard }, h("div", { style: {
9805
11600
  display: "flex",
9806
11601
  alignItems: "center",
@@ -9837,9 +11632,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9837
11632
  padding: "2px 8px",
9838
11633
  fontSize: "11.5px"
9839
11634
  },
9840
- disabled: isBusy,
11635
+ disabled: isBusy || isWarmupAllBusy,
9841
11636
  onClick: actions.onWarmupAll
9842
- }, ...loadingAction === "warmup:all" ? [Spinner(), t("header.warmingUp")] : [uiIcon("flame", 12, "#f97316"), ` ${t("header.warmup")}`]), h(Button, {
11637
+ }, ...isWarmupAllBusy ? [Spinner(), t("header.warmingUp")] : [uiIcon("flame", 12, "#f97316"), ` ${t("header.warmup")}`]), h(Button, {
9843
11638
  variant: "default",
9844
11639
  size: "sm",
9845
11640
  className: "agy-btn",
@@ -9849,9 +11644,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9849
11644
  padding: "2px 8px",
9850
11645
  fontSize: "11.5px"
9851
11646
  },
9852
- disabled: isBusy,
11647
+ disabled: isBusy || isRefreshAllBusy,
9853
11648
  onClick: actions.onRefreshAll
9854
- }, ...loadingAction === "refresh:all" ? [Spinner(), t("header.refreshing")] : [uiIcon("refresh", 12, "var(--agy-text-btn)"), ` ${t("header.refreshQuota")}`])));
11649
+ }, ...isRefreshAllBusy ? [Spinner(), t("header.refreshing")] : [uiIcon("refresh", 12, "var(--agy-text-btn)"), ` ${t("header.refreshQuota")}`])));
9855
11650
  }
9856
11651
  function renderTokenImportForm(t, auth, pool, isBusy, loadingAction) {
9857
11652
  return h("div", null, h("div", { style: {
@@ -10049,7 +11844,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10049
11844
  };
10050
11845
  }
10051
11846
  function renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, actions) {
10052
- const { setCfg, setMode, setSelectedModels, copyImageCommand } = actions;
11847
+ const { setCfg, setMode, setSelectedModels, copyImageCommand, showToast } = actions;
10053
11848
  const caption = (text, desc) => h("div", { style: {
10054
11849
  display: "flex",
10055
11850
  flexDirection: "column"
@@ -10137,7 +11932,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10137
11932
  onChange: (e) => void setCfg("translateEffort", e?.target?.value ?? ""),
10138
11933
  options: translateEffortOptions(status.translateEffort ?? "", effortLabels(t), status.translateModel ?? "", catalogModels)
10139
11934
  }))
10140
- }), renderImageRow(t, status, catalogModels, loadingAction, setCfg, copyImageCommand), renderVisibilityRows({
11935
+ }), renderImageRow(t, status, catalogModels, loadingAction, setCfg, copyImageCommand, effortLabels(t)), renderVisibilityRows({
10141
11936
  t,
10142
11937
  status,
10143
11938
  loadingAction,
@@ -10147,7 +11942,18 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10147
11942
  status,
10148
11943
  loadingAction,
10149
11944
  setCfg
10150
- }), renderDefaultEffortRow(t, status, catalogModels, loadingAction, setCfg), h(ModelsPanel, {
11945
+ }), renderDefaultEffortRow(t, status, catalogModels, loadingAction, setCfg), h(RuntimeControlsSection, {
11946
+ t,
11947
+ status,
11948
+ loadingAction,
11949
+ setCfg
11950
+ }), h(EcosystemPanel, {
11951
+ t,
11952
+ currentAgent: status.agent ?? "",
11953
+ loadingAction,
11954
+ setCfg,
11955
+ showToast
11956
+ }), h(ModelsPanel, {
10151
11957
  t,
10152
11958
  catalogModels,
10153
11959
  hiddenModelSet,
@@ -10189,72 +11995,6 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10189
11995
  }, labels.level(level)))])
10190
11996
  });
10191
11997
  }
10192
- function renderImageRow(t, status, catalogModels, loadingAction, setCfg, copyImageCommand) {
10193
- return h("div", { style: {
10194
- display: "flex",
10195
- flexDirection: "column",
10196
- gap: "6px"
10197
- } }, h("div", { style: {
10198
- display: "flex",
10199
- alignItems: "center",
10200
- justifyContent: "space-between",
10201
- gap: "10px"
10202
- } }, h("div", { style: {
10203
- display: "flex",
10204
- flexDirection: "column",
10205
- minWidth: 0,
10206
- flex: "1 1 0"
10207
- } }, h("span", { style: {
10208
- color: "var(--agy-text-primary)",
10209
- fontWeight: 600,
10210
- fontSize: "12.5px"
10211
- } }, t("config.image")), h("span", { style: S.muted }, t("config.imageDesc"))), h("div", { style: S.cfgRowRight }, h(Select, {
10212
- value: status.imageModel ?? "",
10213
- ariaLabel: t("config.imageModel"),
10214
- title: t("config.imageModelDesc"),
10215
- disabled: loadingAction === "config:imageModel",
10216
- onChange: (e) => void setCfg("imageModel", e?.target?.value ?? ""),
10217
- options: translateModelOptions(status.imageModel ?? "", geminiCatalogModels(catalogModels), t("config.translateModelAuto"))
10218
- }), h(Select, {
10219
- value: status.imageEffort ?? "",
10220
- ariaLabel: t("config.imageEffort"),
10221
- title: t("config.imageEffortDesc"),
10222
- style: {
10223
- minWidth: "78px",
10224
- maxWidth: "110px"
10225
- },
10226
- disabled: loadingAction === "config:imageEffort",
10227
- onChange: (e) => void setCfg("imageEffort", e?.target?.value ?? ""),
10228
- options: translateEffortOptions(status.imageEffort ?? "", effortLabels(t), status.imageModel ?? "", catalogModels)
10229
- }))), h("div", { style: {
10230
- display: "flex",
10231
- alignItems: "center",
10232
- gap: "6px",
10233
- minWidth: 0
10234
- } }, h("code", { style: {
10235
- flex: "1 1 auto",
10236
- minWidth: 0,
10237
- overflow: "hidden",
10238
- textOverflow: "ellipsis",
10239
- whiteSpace: "nowrap",
10240
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
10241
- fontSize: "11px",
10242
- color: "var(--agy-text-secondary)",
10243
- background: "var(--agy-bg-subbox)",
10244
- border: "1px solid var(--agy-border-subbox)",
10245
- borderRadius: "5px",
10246
- padding: "3px 7px"
10247
- } }, IMAGE_CLI_SAMPLE), h(Button, {
10248
- variant: "default",
10249
- size: "sm",
10250
- className: "agy-btn",
10251
- style: {
10252
- flex: "0 0 auto",
10253
- whiteSpace: "nowrap"
10254
- },
10255
- onClick: copyImageCommand
10256
- }, t("config.imageCopy"))));
10257
- }
10258
11998
  //#endregion
10259
11999
  //#region src/client/sections/SessionStatus.ts
10260
12000
  function createSessionStatus(locale, SettingsSection) {
@@ -10287,12 +12027,12 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10287
12027
  }, []);
10288
12028
  const pool = status?.pool;
10289
12029
  const accounts = pool?.accounts ?? [];
10290
- const rawActiveId = pool?.activeAccountId ?? pool?.lastActiveAccountId ?? pool?.activeAccountIds?.google ?? pool?.primaryAccountId;
12030
+ const rawActiveId = pool?.resolvedActiveAccountIds?.google ?? pool?.activeAccountId ?? pool?.lastActiveAccountId ?? pool?.activeAccountIds?.google ?? pool?.primaryAccountId;
10291
12031
  const activeAcc = rawActiveId !== void 0 ? accounts.find((a) => a.id === rawActiveId) : void 0;
10292
12032
  const now = Date.now();
10293
12033
  const activeAuthRequired = activeAcc ? isAccountCriticalAuth(activeAcc) : false;
10294
- const activeHasCooldown = activeAcc ? accountHasActiveCooldown(activeAcc, now) || accountHasQuotaBench(activeAcc, now) : false;
10295
- const allInCooldown = accounts.length > 0 && accounts.every((a) => !a.enabled || isAccountCriticalAuth(a) || accountHasActiveCooldown(a, now) || accountHasQuotaBench(a, now));
12034
+ const activeHasCooldown = activeAcc ? isFamilyCooling(activeAcc, "google", now) : false;
12035
+ const allInCooldown = accounts.length > 0 && accounts.every((a) => !a.enabled || isAccountCriticalAuth(a) || isAccountFullyCooling(a, now));
10296
12036
  const isAuthed = status?.auth?.phase === "ok" || accounts.length > 0;
10297
12037
  const color = status === null ? "#64748b" : status.dormantReason ? "#f59e0b" : allInCooldown ? "#f59e0b" : activeAuthRequired ? "#ef4444" : activeHasCooldown ? "#f59e0b" : isAuthed ? "#10b981" : "#f59e0b";
10298
12038
  const legacyDefault = activeAcc && activeAcc.defaultAlias === void 0 && activeAcc.systemHome && activeAcc.alias === "主账号 (系统登录)";
@@ -10372,6 +12112,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10372
12112
  };
10373
12113
  }, "agy-link: status polling");
10374
12114
  const locale = ctx.locale;
12115
+ bindTranslator(ctx);
10375
12116
  ctx.effect(() => {
10376
12117
  const safeAddLanguage = (lang) => {
10377
12118
  try {
@@ -10474,7 +12215,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10474
12215
  ctx.effect(() => installAutoExpandReasoning());
10475
12216
  ctx.effect(() => installMermaidRendering());
10476
12217
  ctx.effect(() => installImageEnhancer(ctx));
10477
- ctx.effect(() => installDecisionChips(ctx));
12218
+ ctx.effect(() => installAgentEmbedRenderer());
12219
+ ctx.effect(() => installDecisionChips());
10478
12220
  ctx.effect(() => installCompactionCard());
10479
12221
  ctx.effect(() => {
10480
12222
  try {