dsh-agy-link 0.6.52 → 0.6.54
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/CHANGELOG.md +36 -0
- package/dist/cli-image.mjs +198 -3
- package/dist/client.js +358 -86
- package/dist/index.js +221 -8
- package/docs/ARCHITECTURE.md +2 -1
- package/docs/CONFIGURATION.md +2 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -55,6 +55,50 @@ window.__ModuleLoader__.load({
|
|
|
55
55
|
"decision.quickFill": "💬 点击选项快速填入:",
|
|
56
56
|
"decision.insertTooltip": "点击填入: {text}",
|
|
57
57
|
"decision.insertPayload": "我选择 {choice}",
|
|
58
|
+
"image.zoomHint": "{alt}(点击全屏放大)",
|
|
59
|
+
"image.previewTitle": "预览图片({name})",
|
|
60
|
+
"image.previewChip": "预览",
|
|
61
|
+
"image.playTitle": "播放视频({name})",
|
|
62
|
+
"image.playChip": "播放",
|
|
63
|
+
"file.openedInSidebar": "已在原生边栏打开:{name}",
|
|
64
|
+
"file.openedInSystem": "已在系统程序中打开:{name}",
|
|
65
|
+
"file.openFailed": "打开失败:{error}",
|
|
66
|
+
"file.notFound": "未找到文件",
|
|
67
|
+
"lightbox.zoomIn": "放大",
|
|
68
|
+
"lightbox.zoomOut": "缩小",
|
|
69
|
+
"lightbox.reset": "实际大小(1:1)",
|
|
70
|
+
"lightbox.openWithApp": "用系统默认应用打开",
|
|
71
|
+
"lightbox.reveal": "在访达 / 资源管理器中显示",
|
|
72
|
+
"lightbox.copyPath": "复制完整文件路径",
|
|
73
|
+
"lightbox.close": "关闭(ESC)",
|
|
74
|
+
"lightbox.unavailableTitle": "无法直接预览媒体",
|
|
75
|
+
"lightbox.unavailableHint": "文件可能正在生成中、已移动或格式需由外部应用呈现。",
|
|
76
|
+
"lightbox.revealAction": "在访达/资源管理器中查找",
|
|
77
|
+
"lightbox.revealed": "已在文件管理器中定位",
|
|
78
|
+
"lightbox.revealFailed": "无法定位文件",
|
|
79
|
+
"lightbox.revealFailedDetail": "定位失败:{error}",
|
|
80
|
+
"lightbox.openedInApp": "已在系统应用中打开",
|
|
81
|
+
"lightbox.openFailed": "打开失败:{error}",
|
|
82
|
+
"lightbox.unknownError": "未知错误",
|
|
83
|
+
"lightbox.pathCopied": "文件路径已复制到剪贴板",
|
|
84
|
+
"lightbox.hintClose": "ESC 退出 · 点击空白处关闭",
|
|
85
|
+
"lightbox.hintZoom": "ESC 退出 · 滚轮缩放 · 拖拽平移",
|
|
86
|
+
"lightbox.loading": "加载媒体中…",
|
|
87
|
+
"lightbox.zoomInChip": "放大",
|
|
88
|
+
"lightbox.zoomOutChip": "缩小",
|
|
89
|
+
"lightbox.openChip": "打开",
|
|
90
|
+
"lightbox.revealChip": "定位",
|
|
91
|
+
"lightbox.copyChip": "复制路径",
|
|
92
|
+
"lightbox.copiedChip": "✓ 已复制",
|
|
93
|
+
"lightbox.closeChip": "关闭",
|
|
94
|
+
"mermaid.viewSource": "查看源码",
|
|
95
|
+
"mermaid.viewDiagram": "查看图表",
|
|
96
|
+
"mermaid.toggle": "切换图表与原始代码",
|
|
97
|
+
"mermaid.parseFailed": "⚠️ Mermaid 图表解析失败,已保留原始代码呈现",
|
|
98
|
+
"compaction.contextCompacted": "上下文已压缩",
|
|
99
|
+
"question.insert": "💬 填入对话框",
|
|
100
|
+
"question.inserted": "✓ 已填入对话框",
|
|
101
|
+
"question.recorded": "已记录:{value}",
|
|
58
102
|
"account.proxyPlaceholder": "专属代理 URL(如 http://127.0.0.1:7890,留空则继承全局)",
|
|
59
103
|
"account.aliasPlaceholder": "账号别名(例如:备用账号 2)",
|
|
60
104
|
"account.removeTitle": "移除此账号",
|
|
@@ -156,9 +200,10 @@ window.__ModuleLoader__.load({
|
|
|
156
200
|
"pool.label": "号池调度:",
|
|
157
201
|
"pool.sequential": "顺次耗尽",
|
|
158
202
|
"pool.roundRobin": "轮询均衡",
|
|
159
|
-
"models.label": "
|
|
203
|
+
"models.label": "模型显示(已选 {selected} / {total}):",
|
|
160
204
|
"models.empty": "模型目录还没有可用模型,发一次对话或点“刷新额度”后再来管理",
|
|
161
|
-
"models.
|
|
205
|
+
"models.deniedHint": "该模型被 hiddenModels 黑名单禁用,勾选也不会出现在模型选择器中。",
|
|
206
|
+
"models.hint": "点击勾选要显示的模型;一个都不勾表示全部显示。进行中的会话不受影响。",
|
|
162
207
|
"header.refreshQuota": "刷新额度",
|
|
163
208
|
"header.refreshing": "刷新中",
|
|
164
209
|
"console.close": "关闭(Esc)",
|
|
@@ -292,6 +337,50 @@ window.__ModuleLoader__.load({
|
|
|
292
337
|
"decision.quickFill": "💬 Click an option to fill it in:",
|
|
293
338
|
"decision.insertTooltip": "Insert: {text}",
|
|
294
339
|
"decision.insertPayload": "I choose {choice}",
|
|
340
|
+
"image.zoomHint": "{alt} (click to view full screen)",
|
|
341
|
+
"image.previewTitle": "Preview ({name})",
|
|
342
|
+
"image.previewChip": "Preview",
|
|
343
|
+
"image.playTitle": "Play video ({name})",
|
|
344
|
+
"image.playChip": "Play",
|
|
345
|
+
"file.openedInSidebar": "Opened in the sidebar: {name}",
|
|
346
|
+
"file.openedInSystem": "Opened in the system app: {name}",
|
|
347
|
+
"file.openFailed": "Could not open: {error}",
|
|
348
|
+
"file.notFound": "file not found",
|
|
349
|
+
"lightbox.zoomIn": "Zoom in",
|
|
350
|
+
"lightbox.zoomOut": "Zoom out",
|
|
351
|
+
"lightbox.reset": "Actual size (1:1)",
|
|
352
|
+
"lightbox.openWithApp": "Open with the default app",
|
|
353
|
+
"lightbox.reveal": "Reveal in the file manager",
|
|
354
|
+
"lightbox.copyPath": "Copy the full file path",
|
|
355
|
+
"lightbox.close": "Close (ESC)",
|
|
356
|
+
"lightbox.unavailableTitle": "Preview unavailable",
|
|
357
|
+
"lightbox.unavailableHint": "The file may still be generating, may have moved, or needs an external app.",
|
|
358
|
+
"lightbox.revealAction": "Reveal in the file manager",
|
|
359
|
+
"lightbox.revealed": "Revealed in the file manager",
|
|
360
|
+
"lightbox.revealFailed": "Could not locate the file",
|
|
361
|
+
"lightbox.revealFailedDetail": "Could not reveal: {error}",
|
|
362
|
+
"lightbox.openedInApp": "Opened in the system app",
|
|
363
|
+
"lightbox.openFailed": "Could not open: {error}",
|
|
364
|
+
"lightbox.unknownError": "unknown error",
|
|
365
|
+
"lightbox.pathCopied": "File path copied to the clipboard",
|
|
366
|
+
"lightbox.hintClose": "ESC to exit · click the backdrop to close",
|
|
367
|
+
"lightbox.hintZoom": "ESC to exit · scroll to zoom · drag to pan",
|
|
368
|
+
"lightbox.loading": "Loading media…",
|
|
369
|
+
"lightbox.zoomInChip": "Zoom in",
|
|
370
|
+
"lightbox.zoomOutChip": "Zoom out",
|
|
371
|
+
"lightbox.openChip": "Open",
|
|
372
|
+
"lightbox.revealChip": "Reveal",
|
|
373
|
+
"lightbox.copyChip": "Copy path",
|
|
374
|
+
"lightbox.copiedChip": "✓ Copied",
|
|
375
|
+
"lightbox.closeChip": "Close",
|
|
376
|
+
"mermaid.viewSource": "View source",
|
|
377
|
+
"mermaid.viewDiagram": "View diagram",
|
|
378
|
+
"mermaid.toggle": "Switch between the diagram and its source",
|
|
379
|
+
"mermaid.parseFailed": "⚠️ This Mermaid diagram could not be rendered; the source is kept below.",
|
|
380
|
+
"compaction.contextCompacted": "Context compacted",
|
|
381
|
+
"question.insert": "💬 Insert into the chat",
|
|
382
|
+
"question.inserted": "✓ Inserted into the chat",
|
|
383
|
+
"question.recorded": "Recorded: {value}",
|
|
295
384
|
"account.proxyPlaceholder": "Dedicated proxy URL (e.g. http://127.0.0.1:7890; leave blank to inherit global)",
|
|
296
385
|
"account.aliasPlaceholder": "Account alias (for example: Backup account 2)",
|
|
297
386
|
"account.removeTitle": "Remove this account",
|
|
@@ -393,9 +482,10 @@ window.__ModuleLoader__.load({
|
|
|
393
482
|
"pool.label": "Account-pool scheduling:",
|
|
394
483
|
"pool.sequential": "Use sequentially",
|
|
395
484
|
"pool.roundRobin": "Round-robin",
|
|
396
|
-
"models.label": "Model visibility:",
|
|
485
|
+
"models.label": "Model visibility ({selected} of {total} selected):",
|
|
397
486
|
"models.empty": "No models in the catalog yet — send a message or click \"Refresh quota\", then come back to manage them",
|
|
398
|
-
"models.
|
|
487
|
+
"models.deniedHint": "This model is blocked by the hiddenModels deny-list; ticking it will not add it to the picker.",
|
|
488
|
+
"models.hint": "Click to tick the models to show; ticking none shows them all. Ongoing sessions are unaffected.",
|
|
399
489
|
"header.refreshQuota": "Refresh quota",
|
|
400
490
|
"header.refreshing": "Refreshing...",
|
|
401
491
|
"console.close": "Close (Esc)",
|
|
@@ -529,6 +619,50 @@ window.__ModuleLoader__.load({
|
|
|
529
619
|
"decision.quickFill": "💬 Clique numa opção para preenchê-la:",
|
|
530
620
|
"decision.insertTooltip": "Inserir: {text}",
|
|
531
621
|
"decision.insertPayload": "Escolho {choice}",
|
|
622
|
+
"image.zoomHint": "{alt} (clique para ver em tela cheia)",
|
|
623
|
+
"image.previewTitle": "Pré-visualizar ({name})",
|
|
624
|
+
"image.previewChip": "Ver",
|
|
625
|
+
"image.playTitle": "Reproduzir vídeo ({name})",
|
|
626
|
+
"image.playChip": "Reproduzir",
|
|
627
|
+
"file.openedInSidebar": "Aberto na barra lateral: {name}",
|
|
628
|
+
"file.openedInSystem": "Aberto no app do sistema: {name}",
|
|
629
|
+
"file.openFailed": "Não foi possível abrir: {error}",
|
|
630
|
+
"file.notFound": "arquivo não encontrado",
|
|
631
|
+
"lightbox.zoomIn": "Ampliar",
|
|
632
|
+
"lightbox.zoomOut": "Reduzir",
|
|
633
|
+
"lightbox.reset": "Tamanho real (1:1)",
|
|
634
|
+
"lightbox.openWithApp": "Abrir com o app padrão",
|
|
635
|
+
"lightbox.reveal": "Mostrar no gerenciador de arquivos",
|
|
636
|
+
"lightbox.copyPath": "Copiar o caminho completo",
|
|
637
|
+
"lightbox.close": "Fechar (ESC)",
|
|
638
|
+
"lightbox.unavailableTitle": "Pré-visualização indisponível",
|
|
639
|
+
"lightbox.unavailableHint": "O arquivo pode estar sendo gerado, ter sido movido ou precisar de um app externo.",
|
|
640
|
+
"lightbox.revealAction": "Mostrar no gerenciador de arquivos",
|
|
641
|
+
"lightbox.revealed": "Mostrado no gerenciador de arquivos",
|
|
642
|
+
"lightbox.revealFailed": "Não foi possível localizar o arquivo",
|
|
643
|
+
"lightbox.revealFailedDetail": "Não foi possível mostrar: {error}",
|
|
644
|
+
"lightbox.openedInApp": "Aberto no app do sistema",
|
|
645
|
+
"lightbox.openFailed": "Não foi possível abrir: {error}",
|
|
646
|
+
"lightbox.unknownError": "erro desconhecido",
|
|
647
|
+
"lightbox.pathCopied": "Caminho copiado para a área de transferência",
|
|
648
|
+
"lightbox.hintClose": "ESC para sair · clique no fundo para fechar",
|
|
649
|
+
"lightbox.hintZoom": "ESC para sair · rolagem para zoom · arraste para mover",
|
|
650
|
+
"lightbox.loading": "Carregando mídia…",
|
|
651
|
+
"lightbox.zoomInChip": "Ampliar",
|
|
652
|
+
"lightbox.zoomOutChip": "Reduzir",
|
|
653
|
+
"lightbox.openChip": "Abrir",
|
|
654
|
+
"lightbox.revealChip": "Mostrar",
|
|
655
|
+
"lightbox.copyChip": "Copiar caminho",
|
|
656
|
+
"lightbox.copiedChip": "✓ Copiado",
|
|
657
|
+
"lightbox.closeChip": "Fechar",
|
|
658
|
+
"mermaid.viewSource": "Ver código",
|
|
659
|
+
"mermaid.viewDiagram": "Ver diagrama",
|
|
660
|
+
"mermaid.toggle": "Alternar entre o diagrama e o código",
|
|
661
|
+
"mermaid.parseFailed": "⚠️ Não foi possível renderizar este diagrama Mermaid; o código foi mantido abaixo.",
|
|
662
|
+
"compaction.contextCompacted": "Contexto compactado",
|
|
663
|
+
"question.insert": "💬 Inserir no chat",
|
|
664
|
+
"question.inserted": "✓ Inserido no chat",
|
|
665
|
+
"question.recorded": "Registrado: {value}",
|
|
532
666
|
"account.proxyPlaceholder": "URL de proxy dedicada (ex.: http://127.0.0.1:7890; deixe vazio para herdar a global)",
|
|
533
667
|
"account.aliasPlaceholder": "Apelido da conta (por exemplo: Conta reserva 2)",
|
|
534
668
|
"account.removeTitle": "Remover esta conta",
|
|
@@ -630,9 +764,10 @@ window.__ModuleLoader__.load({
|
|
|
630
764
|
"pool.label": "Agendamento do pool de contas:",
|
|
631
765
|
"pool.sequential": "Usar em sequência",
|
|
632
766
|
"pool.roundRobin": "Rodízio",
|
|
633
|
-
"models.label": "Visibilidade dos modelos:",
|
|
767
|
+
"models.label": "Visibilidade dos modelos ({selected} de {total} selecionados):",
|
|
634
768
|
"models.empty": "Ainda não há modelos no catálogo — envie uma mensagem ou clique em \"Atualizar cota\" e volte para gerenciá-los",
|
|
635
|
-
"models.
|
|
769
|
+
"models.deniedHint": "Este modelo está bloqueado pela lista hiddenModels; marcá-lo não o adicionará ao seletor.",
|
|
770
|
+
"models.hint": "Clique para marcar os modelos que deseja exibir; sem nenhum marcado, todos aparecem. As sessões em andamento não são afetadas.",
|
|
636
771
|
"header.refreshQuota": "Atualizar cota",
|
|
637
772
|
"header.refreshing": "Atualizando...",
|
|
638
773
|
"console.close": "Fechar (Esc)",
|
|
@@ -766,6 +901,50 @@ window.__ModuleLoader__.load({
|
|
|
766
901
|
"decision.quickFill": "💬 Haz clic en una opción para rellenarla:",
|
|
767
902
|
"decision.insertTooltip": "Insertar: {text}",
|
|
768
903
|
"decision.insertPayload": "Elijo {choice}",
|
|
904
|
+
"image.zoomHint": "{alt} (clic para ver a pantalla completa)",
|
|
905
|
+
"image.previewTitle": "Vista previa ({name})",
|
|
906
|
+
"image.previewChip": "Ver",
|
|
907
|
+
"image.playTitle": "Reproducir vídeo ({name})",
|
|
908
|
+
"image.playChip": "Reproducir",
|
|
909
|
+
"file.openedInSidebar": "Abierto en la barra lateral: {name}",
|
|
910
|
+
"file.openedInSystem": "Abierto en la app del sistema: {name}",
|
|
911
|
+
"file.openFailed": "No se pudo abrir: {error}",
|
|
912
|
+
"file.notFound": "archivo no encontrado",
|
|
913
|
+
"lightbox.zoomIn": "Acercar",
|
|
914
|
+
"lightbox.zoomOut": "Alejar",
|
|
915
|
+
"lightbox.reset": "Tamaño real (1:1)",
|
|
916
|
+
"lightbox.openWithApp": "Abrir con la app predeterminada",
|
|
917
|
+
"lightbox.reveal": "Mostrar en el gestor de archivos",
|
|
918
|
+
"lightbox.copyPath": "Copiar la ruta completa",
|
|
919
|
+
"lightbox.close": "Cerrar (ESC)",
|
|
920
|
+
"lightbox.unavailableTitle": "Vista previa no disponible",
|
|
921
|
+
"lightbox.unavailableHint": "El archivo puede estar generándose, haberse movido o necesitar una app externa.",
|
|
922
|
+
"lightbox.revealAction": "Mostrar en el gestor de archivos",
|
|
923
|
+
"lightbox.revealed": "Mostrado en el gestor de archivos",
|
|
924
|
+
"lightbox.revealFailed": "No se pudo localizar el archivo",
|
|
925
|
+
"lightbox.revealFailedDetail": "No se pudo mostrar: {error}",
|
|
926
|
+
"lightbox.openedInApp": "Abierto en la app del sistema",
|
|
927
|
+
"lightbox.openFailed": "No se pudo abrir: {error}",
|
|
928
|
+
"lightbox.unknownError": "error desconocido",
|
|
929
|
+
"lightbox.pathCopied": "Ruta copiada al portapapeles",
|
|
930
|
+
"lightbox.hintClose": "ESC para salir · clic en el fondo para cerrar",
|
|
931
|
+
"lightbox.hintZoom": "ESC para salir · rueda para zoom · arrastrar para mover",
|
|
932
|
+
"lightbox.loading": "Cargando contenido…",
|
|
933
|
+
"lightbox.zoomInChip": "Acercar",
|
|
934
|
+
"lightbox.zoomOutChip": "Alejar",
|
|
935
|
+
"lightbox.openChip": "Abrir",
|
|
936
|
+
"lightbox.revealChip": "Mostrar",
|
|
937
|
+
"lightbox.copyChip": "Copiar ruta",
|
|
938
|
+
"lightbox.copiedChip": "✓ Copiado",
|
|
939
|
+
"lightbox.closeChip": "Cerrar",
|
|
940
|
+
"mermaid.viewSource": "Ver código",
|
|
941
|
+
"mermaid.viewDiagram": "Ver diagrama",
|
|
942
|
+
"mermaid.toggle": "Alternar entre el diagrama y su código",
|
|
943
|
+
"mermaid.parseFailed": "⚠️ No se pudo renderizar este diagrama Mermaid; el código se mantiene abajo.",
|
|
944
|
+
"compaction.contextCompacted": "Contexto compactado",
|
|
945
|
+
"question.insert": "💬 Insertar en el chat",
|
|
946
|
+
"question.inserted": "✓ Insertado en el chat",
|
|
947
|
+
"question.recorded": "Registrado: {value}",
|
|
769
948
|
"account.proxyPlaceholder": "URL de proxy dedicada (p. ej., http://127.0.0.1:7890; déjalo vacío para heredar la global)",
|
|
770
949
|
"account.aliasPlaceholder": "Alias de la cuenta (por ejemplo: Cuenta de respaldo 2)",
|
|
771
950
|
"account.removeTitle": "Eliminar esta cuenta",
|
|
@@ -867,9 +1046,10 @@ window.__ModuleLoader__.load({
|
|
|
867
1046
|
"pool.label": "Programación del pool de cuentas:",
|
|
868
1047
|
"pool.sequential": "Usar en secuencia",
|
|
869
1048
|
"pool.roundRobin": "Turno rotativo",
|
|
870
|
-
"models.label": "Visibilidad de modelos:",
|
|
1049
|
+
"models.label": "Visibilidad de modelos ({selected} de {total} seleccionados):",
|
|
871
1050
|
"models.empty": "Aún no hay modelos en el catálogo: envía un mensaje o haz clic en \"Actualizar cuota\" y vuelve para gestionarlos",
|
|
872
|
-
"models.
|
|
1051
|
+
"models.deniedHint": "Este modelo está bloqueado por la lista hiddenModels; marcarlo no lo añadirá al selector.",
|
|
1052
|
+
"models.hint": "Haz clic para marcar los modelos que quieres ver; sin ninguno marcado se muestran todos. Las sesiones en curso no se ven afectadas.",
|
|
873
1053
|
"header.refreshQuota": "Actualizar cuota",
|
|
874
1054
|
"header.refreshing": "Actualizando...",
|
|
875
1055
|
"console.close": "Cerrar (Esc)",
|
|
@@ -1837,6 +2017,37 @@ window.__ModuleLoader__.load({
|
|
|
1837
2017
|
overlaySuspendRefs = 0;
|
|
1838
2018
|
}
|
|
1839
2019
|
//#endregion
|
|
2020
|
+
//#region src/client/i18n-bridge.ts
|
|
2021
|
+
/** Fill `{name}` placeholders in a template. */
|
|
2022
|
+
function fillTemplate(template, params) {
|
|
2023
|
+
return template.replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? ""));
|
|
2024
|
+
}
|
|
2025
|
+
let active = null;
|
|
2026
|
+
/**
|
|
2027
|
+
* Bind the plugin's locale service. Safe to call more than once (a plugin
|
|
2028
|
+
* reload replaces the binding), and tolerant of a host without `locale`.
|
|
2029
|
+
*/
|
|
2030
|
+
function bindTranslator(ctx) {
|
|
2031
|
+
try {
|
|
2032
|
+
const bound = (ctx?.locale)?.bind?.(NS);
|
|
2033
|
+
active = typeof bound === "function" ? bound : null;
|
|
2034
|
+
} catch {
|
|
2035
|
+
active = null;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Translate a key, falling back to `fallback` (English) when no locale service is
|
|
2040
|
+
* bound or the key is missing. The fallback is the source of truth for copy that
|
|
2041
|
+
* must never render as a bare key.
|
|
2042
|
+
*/
|
|
2043
|
+
function translateOr(key, fallback, params) {
|
|
2044
|
+
if (active !== null) try {
|
|
2045
|
+
const value = active(key, params);
|
|
2046
|
+
if (typeof value === "string" && value !== "" && value !== key) return value;
|
|
2047
|
+
} catch {}
|
|
2048
|
+
return fillTemplate(fallback, params);
|
|
2049
|
+
}
|
|
2050
|
+
//#endregion
|
|
1840
2051
|
//#region src/common/timeouts.ts
|
|
1841
2052
|
/** Status poll: keep the console responsive, never stack polls. */
|
|
1842
2053
|
const STATUS_TIMEOUT_MS = 5e3;
|
|
@@ -2408,23 +2619,23 @@ window.__ModuleLoader__.load({
|
|
|
2408
2619
|
if (!isVideo) {
|
|
2409
2620
|
const btnZoomIn = document.createElement("button");
|
|
2410
2621
|
btnZoomIn.className = "agy-lightbox-btn";
|
|
2411
|
-
btnZoomIn.title = "
|
|
2412
|
-
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\"
|
|
2622
|
+
btnZoomIn.title = translateOr("lightbox.zoomIn", "Zoom in");
|
|
2623
|
+
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>";
|
|
2413
2624
|
btnZoomIn.onclick = (e) => {
|
|
2414
2625
|
e.stopPropagation();
|
|
2415
2626
|
callbacks.onZoomIn();
|
|
2416
2627
|
};
|
|
2417
2628
|
const btnZoomOut = document.createElement("button");
|
|
2418
2629
|
btnZoomOut.className = "agy-lightbox-btn";
|
|
2419
|
-
btnZoomOut.title = "
|
|
2420
|
-
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\"
|
|
2630
|
+
btnZoomOut.title = translateOr("lightbox.zoomOut", "Zoom out");
|
|
2631
|
+
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>";
|
|
2421
2632
|
btnZoomOut.onclick = (e) => {
|
|
2422
2633
|
e.stopPropagation();
|
|
2423
2634
|
callbacks.onZoomOut();
|
|
2424
2635
|
};
|
|
2425
2636
|
const btnReset = document.createElement("button");
|
|
2426
2637
|
btnReset.className = "agy-lightbox-btn";
|
|
2427
|
-
btnReset.title = "
|
|
2638
|
+
btnReset.title = translateOr("lightbox.reset", "Actual size (1:1)");
|
|
2428
2639
|
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>";
|
|
2429
2640
|
btnReset.onclick = (e) => {
|
|
2430
2641
|
e.stopPropagation();
|
|
@@ -2437,37 +2648,37 @@ window.__ModuleLoader__.load({
|
|
|
2437
2648
|
if (rawPath) {
|
|
2438
2649
|
const btnOpen = document.createElement("button");
|
|
2439
2650
|
btnOpen.className = "agy-lightbox-btn";
|
|
2440
|
-
btnOpen.title = "
|
|
2441
|
-
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\"
|
|
2651
|
+
btnOpen.title = translateOr("lightbox.openWithApp", "Open with the default app");
|
|
2652
|
+
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>";
|
|
2442
2653
|
btnOpen.onclick = (e) => {
|
|
2443
2654
|
e.stopPropagation();
|
|
2444
2655
|
openInSystem(rawPath, false).then((res) => {
|
|
2445
|
-
showToast(res.ok ? "
|
|
2656
|
+
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") }));
|
|
2446
2657
|
});
|
|
2447
2658
|
};
|
|
2448
2659
|
actions.appendChild(btnOpen);
|
|
2449
2660
|
const btnReveal = document.createElement("button");
|
|
2450
2661
|
btnReveal.className = "agy-lightbox-btn";
|
|
2451
|
-
btnReveal.title = "
|
|
2452
|
-
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\"
|
|
2662
|
+
btnReveal.title = translateOr("lightbox.reveal", "Reveal in the file manager");
|
|
2663
|
+
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>";
|
|
2453
2664
|
btnReveal.onclick = (e) => {
|
|
2454
2665
|
e.stopPropagation();
|
|
2455
2666
|
openInSystem(rawPath, true).then((res) => {
|
|
2456
|
-
showToast(res.ok ? "
|
|
2667
|
+
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") }));
|
|
2457
2668
|
});
|
|
2458
2669
|
};
|
|
2459
2670
|
actions.appendChild(btnReveal);
|
|
2460
2671
|
const btnCopyPath = document.createElement("button");
|
|
2461
2672
|
btnCopyPath.className = "agy-lightbox-btn";
|
|
2462
|
-
btnCopyPath.title = "
|
|
2463
|
-
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\"
|
|
2673
|
+
btnCopyPath.title = translateOr("lightbox.copyPath", "Copy the full file path");
|
|
2674
|
+
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>";
|
|
2464
2675
|
btnCopyPath.onclick = (e) => {
|
|
2465
2676
|
e.stopPropagation();
|
|
2466
2677
|
if (navigator.clipboard) navigator.clipboard.writeText(rawPath).then(() => {
|
|
2467
|
-
showToast("
|
|
2468
|
-
btnCopyPath.innerHTML = "<span class=\"agy-btn-text\"
|
|
2678
|
+
showToast(translateOr("lightbox.pathCopied", "File path copied to the clipboard"));
|
|
2679
|
+
btnCopyPath.innerHTML = "<span class=\"agy-btn-text\">" + translateOr("lightbox.copiedChip", "✓ Copied") + "</span>";
|
|
2469
2680
|
setTimeout(() => {
|
|
2470
|
-
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\"
|
|
2681
|
+
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>";
|
|
2471
2682
|
}, 1500);
|
|
2472
2683
|
}).catch(() => {});
|
|
2473
2684
|
};
|
|
@@ -2478,8 +2689,8 @@ window.__ModuleLoader__.load({
|
|
|
2478
2689
|
actions.appendChild(divider);
|
|
2479
2690
|
const btnClose = document.createElement("button");
|
|
2480
2691
|
btnClose.className = "agy-lightbox-btn agy-lightbox-btn-close";
|
|
2481
|
-
btnClose.title = "
|
|
2482
|
-
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\"
|
|
2692
|
+
btnClose.title = translateOr("lightbox.close", "Close (ESC)");
|
|
2693
|
+
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>";
|
|
2483
2694
|
btnClose.onclick = (e) => {
|
|
2484
2695
|
e.stopPropagation();
|
|
2485
2696
|
callbacks.onClose();
|
|
@@ -2496,13 +2707,13 @@ window.__ModuleLoader__.load({
|
|
|
2496
2707
|
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>";
|
|
2497
2708
|
const errorTitle = document.createElement("div");
|
|
2498
2709
|
errorTitle.className = "agy-lightbox-error-title";
|
|
2499
|
-
errorTitle.textContent = "
|
|
2710
|
+
errorTitle.textContent = translateOr("lightbox.unavailableTitle", "Preview unavailable");
|
|
2500
2711
|
const errorDesc = document.createElement("div");
|
|
2501
2712
|
errorDesc.className = "agy-lightbox-error-desc";
|
|
2502
2713
|
errorDesc.textContent = rawPath || src;
|
|
2503
2714
|
const errorHint = document.createElement("div");
|
|
2504
2715
|
errorHint.className = "agy-lightbox-error-hint";
|
|
2505
|
-
errorHint.textContent = "
|
|
2716
|
+
errorHint.textContent = translateOr("lightbox.unavailableHint", "The file may still be generating, may have moved, or needs an external app.");
|
|
2506
2717
|
errorCard.appendChild(errorIcon);
|
|
2507
2718
|
errorCard.appendChild(errorTitle);
|
|
2508
2719
|
errorCard.appendChild(errorDesc);
|
|
@@ -2512,10 +2723,10 @@ window.__ModuleLoader__.load({
|
|
|
2512
2723
|
btnRow.style.cssText = "display:flex;gap:8px;margin-top:14px;";
|
|
2513
2724
|
const btnOpen = document.createElement("button");
|
|
2514
2725
|
btnOpen.className = "agy-lightbox-btn";
|
|
2515
|
-
btnOpen.textContent = "
|
|
2726
|
+
btnOpen.textContent = translateOr("lightbox.revealAction", "Reveal in the file manager");
|
|
2516
2727
|
btnOpen.onclick = () => {
|
|
2517
2728
|
openInSystem(rawPath, true).then((r) => {
|
|
2518
|
-
showToast(r.ok ? "
|
|
2729
|
+
showToast(r.ok ? translateOr("lightbox.revealed", "Revealed in the file manager") : translateOr("lightbox.revealFailed", "Could not locate the file"));
|
|
2519
2730
|
});
|
|
2520
2731
|
};
|
|
2521
2732
|
btnRow.appendChild(btnOpen);
|
|
@@ -2593,7 +2804,7 @@ window.__ModuleLoader__.load({
|
|
|
2593
2804
|
overlay.appendChild(header);
|
|
2594
2805
|
const spinner = document.createElement("div");
|
|
2595
2806
|
spinner.className = "agy-lightbox-spinner";
|
|
2596
|
-
spinner.innerHTML = "<div class=\"agy-lightbox-spinner-ring\"></div><div class=\"agy-lightbox-spinner-text\"
|
|
2807
|
+
spinner.innerHTML = "<div class=\"agy-lightbox-spinner-ring\"></div><div class=\"agy-lightbox-spinner-text\">" + translateOr("lightbox.loading", "Loading media…") + "</div>";
|
|
2597
2808
|
const errorCard = buildErrorCard(rawPath, src);
|
|
2598
2809
|
if (isVideo) {
|
|
2599
2810
|
const video = document.createElement("video");
|
|
@@ -2638,7 +2849,7 @@ window.__ModuleLoader__.load({
|
|
|
2638
2849
|
body.appendChild(imgWrap);
|
|
2639
2850
|
const hints = document.createElement("div");
|
|
2640
2851
|
hints.className = "agy-lightbox-hints";
|
|
2641
|
-
hints.textContent = isVideo ? "ESC
|
|
2852
|
+
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");
|
|
2642
2853
|
overlay.appendChild(hints);
|
|
2643
2854
|
overlay.appendChild(body);
|
|
2644
2855
|
overlay.onclick = (e) => {
|
|
@@ -2919,7 +3130,7 @@ window.__ModuleLoader__.load({
|
|
|
2919
3130
|
card.className = "agy-image-card";
|
|
2920
3131
|
const thumbWrap = document.createElement("div");
|
|
2921
3132
|
thumbWrap.className = "agy-image-thumb-wrap";
|
|
2922
|
-
thumbWrap.title =
|
|
3133
|
+
thumbWrap.title = translateOr("image.zoomHint", "{alt} (click to view full screen)", { alt: altText || "Image" });
|
|
2923
3134
|
const img = document.createElement("img");
|
|
2924
3135
|
img.className = "agy-image-thumb";
|
|
2925
3136
|
img.src = mediaUrl;
|
|
@@ -2962,8 +3173,8 @@ window.__ModuleLoader__.load({
|
|
|
2962
3173
|
badge.className = "agy-image-link-chip agy-image-link-icon";
|
|
2963
3174
|
badge.setAttribute("role", "button");
|
|
2964
3175
|
badge.setAttribute("tabindex", "0");
|
|
2965
|
-
badge.title =
|
|
2966
|
-
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\"
|
|
3176
|
+
badge.title = translateOr("image.previewTitle", "Preview ({name})", { name: linkText });
|
|
3177
|
+
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>";
|
|
2967
3178
|
badge.onclick = (e) => {
|
|
2968
3179
|
e.preventDefault();
|
|
2969
3180
|
e.stopPropagation();
|
|
@@ -2995,8 +3206,8 @@ window.__ModuleLoader__.load({
|
|
|
2995
3206
|
badge.className = "agy-image-link-chip agy-chip-video agy-video-link-icon";
|
|
2996
3207
|
badge.setAttribute("role", "button");
|
|
2997
3208
|
badge.setAttribute("tabindex", "0");
|
|
2998
|
-
badge.title =
|
|
2999
|
-
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\"
|
|
3209
|
+
badge.title = translateOr("image.playTitle", "Play video ({name})", { name: linkText });
|
|
3210
|
+
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>";
|
|
3000
3211
|
badge.onclick = (e) => {
|
|
3001
3212
|
e.preventDefault();
|
|
3002
3213
|
e.stopPropagation();
|
|
@@ -3021,11 +3232,11 @@ window.__ModuleLoader__.load({
|
|
|
3021
3232
|
e.stopPropagation();
|
|
3022
3233
|
const fileName = pathToUse.split(/[/\\]/).pop() || pathToUse;
|
|
3023
3234
|
if (openInRightSidebar(pathToUse)) {
|
|
3024
|
-
showToast(
|
|
3235
|
+
showToast(translateOr("file.openedInSidebar", "Opened in the sidebar: {name}", { name: fileName }));
|
|
3025
3236
|
return;
|
|
3026
3237
|
}
|
|
3027
3238
|
openInSystem(pathToUse, false).then((res) => {
|
|
3028
|
-
showToast(res.ok ?
|
|
3239
|
+
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") }));
|
|
3029
3240
|
});
|
|
3030
3241
|
});
|
|
3031
3242
|
}
|
|
@@ -3080,11 +3291,11 @@ window.__ModuleLoader__.load({
|
|
|
3080
3291
|
e.stopPropagation();
|
|
3081
3292
|
const fileName = pathToUse.split(/[/\\]/).pop() || pathToUse;
|
|
3082
3293
|
if (openInRightSidebar(pathToUse)) {
|
|
3083
|
-
showToast(
|
|
3294
|
+
showToast(translateOr("file.openedInSidebar", "Opened in the sidebar: {name}", { name: fileName }));
|
|
3084
3295
|
return;
|
|
3085
3296
|
}
|
|
3086
3297
|
openInSystem(pathToUse, false).then((res) => {
|
|
3087
|
-
showToast(res.ok ?
|
|
3298
|
+
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") }));
|
|
3088
3299
|
});
|
|
3089
3300
|
}
|
|
3090
3301
|
}
|
|
@@ -3767,7 +3978,7 @@ window.__ModuleLoader__.load({
|
|
|
3767
3978
|
const header = document.createElement("div");
|
|
3768
3979
|
header.className = "agy-decision-header";
|
|
3769
3980
|
const headerLabel = document.createElement("span");
|
|
3770
|
-
headerLabel.textContent =
|
|
3981
|
+
headerLabel.textContent = COPY.quickFill();
|
|
3771
3982
|
header.appendChild(headerLabel);
|
|
3772
3983
|
box.appendChild(header);
|
|
3773
3984
|
const chips = document.createElement("div");
|
|
@@ -3776,7 +3987,7 @@ window.__ModuleLoader__.load({
|
|
|
3776
3987
|
const chip = document.createElement("button");
|
|
3777
3988
|
chip.type = "button";
|
|
3778
3989
|
chip.className = "agy-decision-chip";
|
|
3779
|
-
chip.title =
|
|
3990
|
+
chip.title = COPY.insertTooltip(opt.fullText);
|
|
3780
3991
|
const numSpan = document.createElement("span");
|
|
3781
3992
|
numSpan.className = "agy-decision-chip-num";
|
|
3782
3993
|
numSpan.textContent = opt.num ?? "👉";
|
|
@@ -3788,7 +3999,7 @@ window.__ModuleLoader__.load({
|
|
|
3788
3999
|
chip.onclick = (e) => {
|
|
3789
4000
|
e.stopPropagation();
|
|
3790
4001
|
const cleanText = opt.fullText.replace(/^[0-9]+[、..:]\s*/, "").trim();
|
|
3791
|
-
insertTextIntoChatComposer(
|
|
4002
|
+
insertTextIntoChatComposer(COPY.insertPayload((opt.num ? opt.num + " " : "") + cleanText));
|
|
3792
4003
|
chip.classList.add("selected");
|
|
3793
4004
|
setTimeout(() => chip.classList.remove("selected"), 1200);
|
|
3794
4005
|
};
|
|
@@ -3811,24 +4022,14 @@ window.__ModuleLoader__.load({
|
|
|
3811
4022
|
scanAndEnhanceDecisions();
|
|
3812
4023
|
}, 100);
|
|
3813
4024
|
}
|
|
3814
|
-
/**
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
"decision.insertPayload": "I choose {choice}"
|
|
3820
|
-
}[key] ?? key).replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? ""));
|
|
4025
|
+
/** Chip copy: localized through the shared bridge (issue #153). */
|
|
4026
|
+
const COPY = {
|
|
4027
|
+
quickFill: () => translateOr("decision.quickFill", "💬 Click an option to fill it in:"),
|
|
4028
|
+
insertTooltip: (text) => translateOr("decision.insertTooltip", "Insert: {text}", { text }),
|
|
4029
|
+
insertPayload: (choice) => translateOr("decision.insertPayload", "I choose {choice}", { choice })
|
|
3821
4030
|
};
|
|
3822
|
-
function
|
|
3823
|
-
try {
|
|
3824
|
-
const bound = (ctx?.locale)?.bind?.(NS);
|
|
3825
|
-
if (typeof bound === "function") return bound;
|
|
3826
|
-
} catch {}
|
|
3827
|
-
return activeTranslate;
|
|
3828
|
-
}
|
|
3829
|
-
function installDecisionChips(ctx) {
|
|
4031
|
+
function installDecisionChips() {
|
|
3830
4032
|
if (typeof window === "undefined" || typeof document === "undefined") return () => {};
|
|
3831
|
-
activeTranslate = translatorFor(ctx);
|
|
3832
4033
|
decisionChipsDispose?.();
|
|
3833
4034
|
injectStyles$4();
|
|
3834
4035
|
const observer = new MutationObserver(() => {
|
|
@@ -3931,7 +4132,7 @@ window.__ModuleLoader__.load({
|
|
|
3931
4132
|
e.stopPropagation();
|
|
3932
4133
|
onInsert();
|
|
3933
4134
|
}
|
|
3934
|
-
}, inserted ? "✓
|
|
4135
|
+
}, 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));
|
|
3935
4136
|
}
|
|
3936
4137
|
//#endregion
|
|
3937
4138
|
//#region src/client/toolview/card-bodies.ts
|
|
@@ -4689,17 +4890,17 @@ body > [id^="iagy-mmd"] .error-icon {
|
|
|
4689
4890
|
const toggleBtn = document.createElement("button");
|
|
4690
4891
|
toggleBtn.type = "button";
|
|
4691
4892
|
toggleBtn.className = "agy-mermaid-toggle";
|
|
4692
|
-
toggleBtn.textContent = "
|
|
4693
|
-
toggleBtn.title = "
|
|
4893
|
+
toggleBtn.textContent = translateOr("mermaid.viewSource", "View source");
|
|
4894
|
+
toggleBtn.title = translateOr("mermaid.toggle", "Switch between the diagram and its source");
|
|
4694
4895
|
toggleBtn.addEventListener("click", (ev) => {
|
|
4695
4896
|
ev.preventDefault();
|
|
4696
4897
|
ev.stopPropagation();
|
|
4697
4898
|
if (block.getAttribute("data-agy-mermaid-view") === "source") {
|
|
4698
4899
|
block.removeAttribute("data-agy-mermaid-view");
|
|
4699
|
-
toggleBtn.textContent = "
|
|
4900
|
+
toggleBtn.textContent = translateOr("mermaid.viewSource", "View source");
|
|
4700
4901
|
} else {
|
|
4701
4902
|
block.setAttribute("data-agy-mermaid-view", "source");
|
|
4702
|
-
toggleBtn.textContent = "
|
|
4903
|
+
toggleBtn.textContent = translateOr("mermaid.viewDiagram", "View diagram");
|
|
4703
4904
|
}
|
|
4704
4905
|
});
|
|
4705
4906
|
toolbar.appendChild(toggleBtn);
|
|
@@ -4715,7 +4916,7 @@ body > [id^="iagy-mmd"] .error-icon {
|
|
|
4715
4916
|
block.setAttribute("data-agy-mermaid", "fallback");
|
|
4716
4917
|
} else {
|
|
4717
4918
|
block.setAttribute("data-agy-mermaid", "error");
|
|
4718
|
-
mount.innerHTML = "<div class=\"agy-mermaid-warn\"
|
|
4919
|
+
mount.innerHTML = "<div class=\"agy-mermaid-warn\">" + translateOr("mermaid.parseFailed", "⚠️ This Mermaid diagram could not be rendered; the source is kept below.") + "</div>";
|
|
4719
4920
|
}
|
|
4720
4921
|
} finally {
|
|
4721
4922
|
cleanupTempElements(id);
|
|
@@ -6152,12 +6353,16 @@ body.dark .agy-tsl-card,
|
|
|
6152
6353
|
if (host) host.appendChild(st);
|
|
6153
6354
|
}
|
|
6154
6355
|
}
|
|
6155
|
-
/**
|
|
6356
|
+
/**
|
|
6357
|
+
* Card title, from the plugin's locale binding.
|
|
6358
|
+
*
|
|
6359
|
+
* `document.documentElement.lang` used to be consulted here as a shortcut, but it
|
|
6360
|
+
* is DSH's page language rather than this plugin's locale, and it made the copy
|
|
6361
|
+
* disagree with every other surface when the two differed. The binding is the
|
|
6362
|
+
* authority; hosts without one get the English default (issue #153).
|
|
6363
|
+
*/
|
|
6156
6364
|
function getCompactionTitle() {
|
|
6157
|
-
|
|
6158
|
-
if ((document.documentElement.lang || "").startsWith("en")) return "Context compacted";
|
|
6159
|
-
}
|
|
6160
|
-
return "上下文已压缩";
|
|
6365
|
+
return translateOr("compaction.contextCompacted", "Context compacted");
|
|
6161
6366
|
}
|
|
6162
6367
|
function buildCompactionRow(notice) {
|
|
6163
6368
|
const { beforeTokens, afterTokens, summary = "" } = notice;
|
|
@@ -8138,6 +8343,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
8138
8343
|
//#region src/client/hooks/useConfig.ts
|
|
8139
8344
|
function useConfig({ status, refresh, showToast, setLoadingAction, t }) {
|
|
8140
8345
|
const hiddenPendingRef = useRef(null);
|
|
8346
|
+
const selectedPendingRef = useRef(null);
|
|
8141
8347
|
const actionFailed = () => {
|
|
8142
8348
|
showToast(t("api.genericError"), "error");
|
|
8143
8349
|
};
|
|
@@ -8163,6 +8369,27 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
8163
8369
|
if (hiddenPendingRef.current === next) hiddenPendingRef.current = null;
|
|
8164
8370
|
}
|
|
8165
8371
|
};
|
|
8372
|
+
/**
|
|
8373
|
+
* Replace the picker-facing allow-list in ONE write.
|
|
8374
|
+
*
|
|
8375
|
+
* An EMPTY list means "no restriction" (every model shows) — that is the
|
|
8376
|
+
* shipped default, and it is also why the panel computes the whole next set
|
|
8377
|
+
* itself instead of toggling one id at a time: leaving "no restriction"
|
|
8378
|
+
* state requires knowing what was implicitly visible.
|
|
8379
|
+
*
|
|
8380
|
+
* The PENDING array is written before the request and read by rapid
|
|
8381
|
+
* follow-up clicks, so two fast clicks compose instead of the second
|
|
8382
|
+
* overwriting the first with a stale snapshot.
|
|
8383
|
+
*/
|
|
8384
|
+
const setSelectedModels = async (ids) => {
|
|
8385
|
+
const next = [...ids];
|
|
8386
|
+
selectedPendingRef.current = next;
|
|
8387
|
+
try {
|
|
8388
|
+
await setCfg("selectedModels", next);
|
|
8389
|
+
} finally {
|
|
8390
|
+
if (selectedPendingRef.current === next) selectedPendingRef.current = null;
|
|
8391
|
+
}
|
|
8392
|
+
};
|
|
8166
8393
|
const setMode = async (mode) => {
|
|
8167
8394
|
setLoadingAction(`mode:${mode}`);
|
|
8168
8395
|
const res = await postPool("mode", { mode });
|
|
@@ -8177,6 +8404,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
8177
8404
|
return {
|
|
8178
8405
|
setCfg,
|
|
8179
8406
|
toggleModelHidden,
|
|
8407
|
+
setSelectedModels,
|
|
8180
8408
|
setMode
|
|
8181
8409
|
};
|
|
8182
8410
|
}
|
|
@@ -8377,6 +8605,28 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
8377
8605
|
if (id.startsWith("gpt-") || id.startsWith("openai/") || id.includes("gpt-oss")) return "openai";
|
|
8378
8606
|
return "unknown";
|
|
8379
8607
|
}
|
|
8608
|
+
const EFFORT_SUFFIX_RE = /-(?:tiered-)?(?:low|medium|high|xhigh|tiered|thinking)$/i;
|
|
8609
|
+
/**
|
|
8610
|
+
* Return the un-tiered base model slug (e.g. claude-opus-4-6-thinking -> claude-opus-4-6,
|
|
8611
|
+
* claude-opus-5-5-high -> claude-opus-5-5).
|
|
8612
|
+
*/
|
|
8613
|
+
function baseModelSlug(id) {
|
|
8614
|
+
const s = id.trim().toLowerCase().replace(/\./g, "-");
|
|
8615
|
+
if (s === "claude-opus-4-6" || s === "claude-opus-4-8" || s === "claude-opus-4-5") return "claude-opus-4-6";
|
|
8616
|
+
if (s === "claude-sonnet-4-5") return "claude-sonnet-4-6";
|
|
8617
|
+
return s.replace(EFFORT_SUFFIX_RE, "");
|
|
8618
|
+
}
|
|
8619
|
+
/**
|
|
8620
|
+
* Test whether a requested model matches a candidate model id (accounting for
|
|
8621
|
+
* aliases, effort variants, and base model families).
|
|
8622
|
+
*/
|
|
8623
|
+
function modelMatches(requestedModel, candidateModelId) {
|
|
8624
|
+
if (!requestedModel || !candidateModelId) return false;
|
|
8625
|
+
const r = requestedModel.trim().toLowerCase();
|
|
8626
|
+
const c = candidateModelId.trim().toLowerCase();
|
|
8627
|
+
if (r === c) return true;
|
|
8628
|
+
return baseModelSlug(r) === baseModelSlug(c);
|
|
8629
|
+
}
|
|
8380
8630
|
//#endregion
|
|
8381
8631
|
//#region src/common/account-models.ts
|
|
8382
8632
|
const FAMILY_LABELS = {
|
|
@@ -9467,7 +9717,22 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
9467
9717
|
}
|
|
9468
9718
|
//#endregion
|
|
9469
9719
|
//#region src/client/sections/ModelsPanel.ts
|
|
9470
|
-
function ModelsPanel({ t, catalogModels, hiddenModelSet, loadingAction,
|
|
9720
|
+
function ModelsPanel({ t, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, setSelectedModels }) {
|
|
9721
|
+
const unrestricted = selectedModelSet.size === 0;
|
|
9722
|
+
const selected = Array.from(selectedModelSet);
|
|
9723
|
+
const isTicked = (id) => unrestricted || selected.some((want) => modelMatches(want, id));
|
|
9724
|
+
const isVisible = (id) => !hiddenModelSet.has(id) && isTicked(id);
|
|
9725
|
+
const visibleCount = catalogModels.filter((m) => isVisible(m.id)).length;
|
|
9726
|
+
const busy = loadingAction === "config:selectedModels";
|
|
9727
|
+
const onChipClick = (id) => {
|
|
9728
|
+
if (!unrestricted) {
|
|
9729
|
+
const next = new Set(selected.filter((want) => !modelMatches(want, id)));
|
|
9730
|
+
if (!isTicked(id)) next.add(id);
|
|
9731
|
+
setSelectedModels(Array.from(next));
|
|
9732
|
+
return;
|
|
9733
|
+
}
|
|
9734
|
+
setSelectedModels(catalogModels.filter((m) => !hiddenModelSet.has(m.id) && m.id !== id).map((m) => m.id));
|
|
9735
|
+
};
|
|
9471
9736
|
return h("div", { style: {
|
|
9472
9737
|
display: "flex",
|
|
9473
9738
|
flexDirection: "column",
|
|
@@ -9476,24 +9741,28 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
9476
9741
|
color: "var(--agy-text-primary)",
|
|
9477
9742
|
fontWeight: 600,
|
|
9478
9743
|
fontSize: "12.5px"
|
|
9479
|
-
} }, t("models.label"
|
|
9744
|
+
} }, t("models.label", {
|
|
9745
|
+
selected: visibleCount,
|
|
9746
|
+
total: catalogModels.length
|
|
9747
|
+
})), catalogModels.length === 0 ? h("span", { style: S.muted }, t("models.empty")) : h("div", { style: {
|
|
9480
9748
|
display: "flex",
|
|
9481
9749
|
flexWrap: "wrap",
|
|
9482
9750
|
gap: "6px"
|
|
9483
9751
|
} }, catalogModels.map((m) => {
|
|
9484
|
-
const
|
|
9752
|
+
const denied = hiddenModelSet.has(m.id);
|
|
9753
|
+
const ticked = isVisible(m.id);
|
|
9485
9754
|
const efforts = (m.efforts ?? []).map((id) => effortLabel(id));
|
|
9486
|
-
const title = efforts.length > 0 ? m.id + " · " + efforts.join(" / ") : m.id;
|
|
9755
|
+
const title = (efforts.length > 0 ? m.id + " · " + efforts.join(" / ") : m.id) + (denied ? "\n" + t("models.deniedHint") : "");
|
|
9487
9756
|
return h(Button, {
|
|
9488
9757
|
key: m.id,
|
|
9489
|
-
variant:
|
|
9758
|
+
variant: ticked ? "segActive" : "seg",
|
|
9490
9759
|
title,
|
|
9491
|
-
disabled:
|
|
9492
|
-
style:
|
|
9760
|
+
disabled: busy,
|
|
9761
|
+
style: ticked ? void 0 : {
|
|
9493
9762
|
opacity: .45,
|
|
9494
9763
|
textDecoration: "line-through"
|
|
9495
|
-
}
|
|
9496
|
-
onClick: () =>
|
|
9764
|
+
},
|
|
9765
|
+
onClick: () => onChipClick(m.id)
|
|
9497
9766
|
}, m.name);
|
|
9498
9767
|
})), h("span", { style: S.muted }, t("models.hint")));
|
|
9499
9768
|
}
|
|
@@ -9670,6 +9939,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
9670
9939
|
const pool = status?.pool;
|
|
9671
9940
|
const catalogModels = status?.catalogModels ?? [];
|
|
9672
9941
|
const hiddenModelSet = new Set(status?.hiddenModels ?? []);
|
|
9942
|
+
const selectedModelSet = new Set(status?.selectedModels ?? []);
|
|
9673
9943
|
const accounts = pool?.accounts ?? [];
|
|
9674
9944
|
const isAuthed = authPhase === "ok" || accounts.length > 0;
|
|
9675
9945
|
const isBusy = loadingAction !== null;
|
|
@@ -9723,10 +9993,10 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
9723
9993
|
...accountActions,
|
|
9724
9994
|
beginReauth: auth.handleBeginReauth
|
|
9725
9995
|
}
|
|
9726
|
-
}), renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, loadingAction, {
|
|
9996
|
+
}), renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, {
|
|
9727
9997
|
setCfg: config.setCfg,
|
|
9728
9998
|
setMode: config.setMode,
|
|
9729
|
-
|
|
9999
|
+
setSelectedModels: config.setSelectedModels,
|
|
9730
10000
|
copyImageCommand
|
|
9731
10001
|
}));
|
|
9732
10002
|
};
|
|
@@ -9979,8 +10249,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
9979
10249
|
}
|
|
9980
10250
|
};
|
|
9981
10251
|
}
|
|
9982
|
-
function renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, loadingAction, actions) {
|
|
9983
|
-
const { setCfg, setMode,
|
|
10252
|
+
function renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, actions) {
|
|
10253
|
+
const { setCfg, setMode, setSelectedModels, copyImageCommand } = actions;
|
|
9984
10254
|
const caption = (text, desc) => h("div", { style: {
|
|
9985
10255
|
display: "flex",
|
|
9986
10256
|
flexDirection: "column"
|
|
@@ -10082,8 +10352,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
10082
10352
|
t,
|
|
10083
10353
|
catalogModels,
|
|
10084
10354
|
hiddenModelSet,
|
|
10355
|
+
selectedModelSet,
|
|
10085
10356
|
loadingAction,
|
|
10086
|
-
|
|
10357
|
+
setSelectedModels
|
|
10087
10358
|
})));
|
|
10088
10359
|
}
|
|
10089
10360
|
/**
|
|
@@ -10302,6 +10573,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
10302
10573
|
};
|
|
10303
10574
|
}, "agy-link: status polling");
|
|
10304
10575
|
const locale = ctx.locale;
|
|
10576
|
+
bindTranslator(ctx);
|
|
10305
10577
|
ctx.effect(() => {
|
|
10306
10578
|
const safeAddLanguage = (lang) => {
|
|
10307
10579
|
try {
|
|
@@ -10404,7 +10676,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
10404
10676
|
ctx.effect(() => installAutoExpandReasoning());
|
|
10405
10677
|
ctx.effect(() => installMermaidRendering());
|
|
10406
10678
|
ctx.effect(() => installImageEnhancer(ctx));
|
|
10407
|
-
ctx.effect(() => installDecisionChips(
|
|
10679
|
+
ctx.effect(() => installDecisionChips());
|
|
10408
10680
|
ctx.effect(() => installCompactionCard());
|
|
10409
10681
|
ctx.effect(() => {
|
|
10410
10682
|
try {
|