dsh-agy-link 0.5.0 → 0.5.2

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
@@ -40,6 +40,70 @@ window.__ModuleLoader__.load({
40
40
  flame: "M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"
41
41
  };
42
42
  //#endregion
43
+ //#region src/client/config-options.ts
44
+ /** Thinking levels the translation call accepts, in ascending order. */
45
+ const EFFORT_LEVELS = [
46
+ "low",
47
+ "medium",
48
+ "high"
49
+ ];
50
+ /**
51
+ * Translation-model dropdown: `''` (host fallback chain: gemini-3.8-flash →
52
+ * newest gemini-*-flash → conversation default) plus every catalog model.
53
+ */
54
+ function translateModelOptions(current, models, autoLabel) {
55
+ const options = [{
56
+ value: "",
57
+ label: autoLabel
58
+ }];
59
+ const seen = /* @__PURE__ */ new Set([""]);
60
+ for (const model of models) {
61
+ const id = typeof model?.id === "string" ? model.id.trim() : "";
62
+ if (id === "" || seen.has(id)) continue;
63
+ seen.add(id);
64
+ const name = typeof model?.name === "string" ? model.name.trim() : "";
65
+ options.push({
66
+ value: id,
67
+ label: name === "" ? id : name
68
+ });
69
+ }
70
+ const wanted = typeof current === "string" ? current.trim() : "";
71
+ if (wanted !== "" && !seen.has(wanted)) options.push({
72
+ value: wanted,
73
+ label: wanted
74
+ });
75
+ return options;
76
+ }
77
+ /**
78
+ * The dropdown offers the Gemini family only: the card is branded "Gemini 译文",
79
+ * so picking e.g. Claude there would make the label a lie. A model configured by
80
+ * hand is still appended by `translateModelOptions`, so the state stays honest.
81
+ */
82
+ function geminiCatalogModels(models) {
83
+ return models.filter((model) => typeof model?.id === "string" && /gemini/i.test(model.id));
84
+ }
85
+ /**
86
+ * Thinking-effort dropdown: `''` (follow the default effort) plus the levels
87
+ * agy understands; an unrecognised configured level is appended verbatim so the
88
+ * select can display it rather than pretending the value is unset.
89
+ */
90
+ function translateEffortOptions(current, labels) {
91
+ const options = [{
92
+ value: "",
93
+ label: labels.auto
94
+ }];
95
+ for (const level of EFFORT_LEVELS) options.push({
96
+ value: level,
97
+ label: labels[level]
98
+ });
99
+ const wanted = typeof current === "string" ? current.trim().toLowerCase() : "";
100
+ if (wanted !== "" && !options.some((option) => option.value === wanted)) options.push({
101
+ value: wanted,
102
+ label: wanted
103
+ });
104
+ return options;
105
+ }
106
+ //#endregion
43
107
  //#region src/client/locales.ts
44
108
  /** Native DSH locale dictionaries for the Antigravity UI. */
45
109
  const NS = "agy-link";
@@ -195,6 +259,12 @@ window.__ModuleLoader__.load({
195
259
  "config.autoWarmupDesc": "周配额到达重置时间或冷启动时自动唤醒 1 次启动新周期",
196
260
  "config.autoTranslate": "自动翻译",
197
261
  "config.autoTranslateDesc": "每个回合结束后,用 Gemini 把最后的回复翻成大白话,显示在该回复下方",
262
+ "config.translateModel": "翻译模型",
263
+ "config.translateModelDesc": "翻译调用使用哪个模型;默认自动从 Gemini Flash 里挑最新的一个",
264
+ "config.translateModelAuto": "默认(自动)",
265
+ "config.translateEffort": "思考强度",
266
+ "config.translateEffortDesc": "翻译调用使用的思考档;默认跟随下面的「默认思考强度」",
267
+ "config.translateEffortAuto": "跟随默认",
198
268
  "config.on": "开启",
199
269
  "config.off": "关闭",
200
270
  "config.runtimeTitle": "运行方式",
@@ -203,7 +273,6 @@ window.__ModuleLoader__.load({
203
273
  "config.defaultEffortDesc": "auto = 各模型用自身默认档;选定后作为会话模型下拉框的初始档位,仍可按模型覆盖",
204
274
  "tsl.badge": "Gemini 译文",
205
275
  "tsl.plain": "人话版",
206
- "tsl.byGemini": "由 Gemini 翻译",
207
276
  "tsl.translate": "译成人话",
208
277
  "tsl.actionTip": "用 Gemini 把这条回复译成人话",
209
278
  "tsl.translating": "翻译中…",
@@ -371,6 +440,12 @@ window.__ModuleLoader__.load({
371
440
  "config.autoWarmupDesc": "Automatically trigger a 1-token probe when weekly reset time is reached",
372
441
  "config.autoTranslate": "Auto translate",
373
442
  "config.autoTranslateDesc": "After each turn, Gemini rewrites the final answer in plain language and shows it under that reply",
443
+ "config.translateModel": "Translation model",
444
+ "config.translateModelDesc": "Model used for the translation call; the default picks the newest Gemini Flash automatically",
445
+ "config.translateModelAuto": "Default (auto)",
446
+ "config.translateEffort": "Thinking effort",
447
+ "config.translateEffortDesc": "Effort used for the translation call; the default follows “Default thinking effort” below",
448
+ "config.translateEffortAuto": "Follow default",
374
449
  "config.on": "On",
375
450
  "config.off": "Off",
376
451
  "config.runtimeTitle": "Runtime",
@@ -379,7 +454,6 @@ window.__ModuleLoader__.load({
379
454
  "config.defaultEffortDesc": "auto = each model keeps its own default; a fixed level seeds the session model menu and can still be overridden per model",
380
455
  "tsl.badge": "Gemini translation",
381
456
  "tsl.plain": "Plain language",
382
- "tsl.byGemini": "Translated by Gemini",
383
457
  "tsl.translate": "Translate to plain language",
384
458
  "tsl.actionTip": "Rewrite this reply in plain language with Gemini",
385
459
  "tsl.translating": "Translating…",
@@ -547,6 +621,12 @@ window.__ModuleLoader__.load({
547
621
  "config.autoWarmupDesc": "Ativa automaticamente um ciclo quando o tempo de redefinição semanal é atingido",
548
622
  "config.autoTranslate": "Tradução automática",
549
623
  "config.autoTranslateDesc": "Ao fim de cada turno, o Gemini reescreve a resposta final em linguagem simples e mostra abaixo dela",
624
+ "config.translateModel": "Modelo de tradução",
625
+ "config.translateModelDesc": "Modelo usado na chamada de tradução; o padrão escolhe automaticamente o Gemini Flash mais recente",
626
+ "config.translateModelAuto": "Padrão (auto)",
627
+ "config.translateEffort": "Intensidade de raciocínio",
628
+ "config.translateEffortDesc": "Intensidade usada na chamada de tradução; o padrão segue “Intensidade de raciocínio padrão” abaixo",
629
+ "config.translateEffortAuto": "Seguir padrão",
550
630
  "config.on": "Ativado",
551
631
  "config.off": "Desativado",
552
632
  "config.runtimeTitle": "Execução",
@@ -555,7 +635,6 @@ window.__ModuleLoader__.load({
555
635
  "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",
556
636
  "tsl.badge": "Tradução do Gemini",
557
637
  "tsl.plain": "Linguagem simples",
558
- "tsl.byGemini": "Traduzido pelo Gemini",
559
638
  "tsl.translate": "Traduzir para linguagem simples",
560
639
  "tsl.actionTip": "Reescrever esta resposta em linguagem simples com o Gemini",
561
640
  "tsl.translating": "Traduzindo…",
@@ -723,6 +802,12 @@ window.__ModuleLoader__.load({
723
802
  "config.autoWarmupDesc": "Activa automáticamente un ciclo cuando se alcanza el tiempo de reinicio semanal",
724
803
  "config.autoTranslate": "Traducción automática",
725
804
  "config.autoTranslateDesc": "Al terminar cada turno, Gemini reescribe la respuesta final en lenguaje sencillo y la muestra debajo de esa respuesta",
805
+ "config.translateModel": "Modelo de traducción",
806
+ "config.translateModelDesc": "Modelo usado en la llamada de traducción; el valor por defecto elige automáticamente el Gemini Flash más reciente",
807
+ "config.translateModelAuto": "Predeterminado (auto)",
808
+ "config.translateEffort": "Intensidad de razonamiento",
809
+ "config.translateEffortDesc": "Intensidad usada en la llamada de traducción; el valor por defecto sigue “Intensidad de razonamiento predeterminada” abajo",
810
+ "config.translateEffortAuto": "Seguir predeterminado",
726
811
  "config.on": "Activado",
727
812
  "config.off": "Desactivado",
728
813
  "config.runtimeTitle": "Ejecución",
@@ -731,7 +816,6 @@ window.__ModuleLoader__.load({
731
816
  "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",
732
817
  "tsl.badge": "Traducción de Gemini",
733
818
  "tsl.plain": "Lenguaje sencillo",
734
- "tsl.byGemini": "Traducido por Gemini",
735
819
  "tsl.translate": "Traducir a lenguaje sencillo",
736
820
  "tsl.actionTip": "Reescribir esta respuesta en lenguaje sencillo con Gemini",
737
821
  "tsl.translating": "Traduciendo…",
@@ -3920,44 +4004,101 @@ div[data-variant="think"] [class*="thinkBody"] {
3920
4004
  const STYLE_ID = "dsh-agy-link-tsl-css-v2";
3921
4005
  const TRANSLATION_KIND = "agy-translation";
3922
4006
  const CSS = `
4007
+ /* Card surface. It has to read as a HOST component, not a plugin banner: the
4008
+ recipe is DSH's own tool card (the console's agy-tv-card) — a hairline l1
4009
+ stroke, the markdown code-block fill, a 12px radius and a banner header.
4010
+ Nothing here is brand-themed. The only Gemini signal is one monochrome spark
4011
+ plus the "Gemini 译文" label; every colour is a DSH token, so light and dark
4012
+ come from the host theme instead of from this sheet. */
3923
4013
  .agy-tsl-card {
3924
- margin: 8px 0 2px 0;
3925
- border-radius: 10px;
3926
- border: 1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.28));
3927
- border-left: 3px solid #8b5cf6;
3928
- background: linear-gradient(180deg, rgba(99,102,241,.09), rgba(139,92,246,.04));
4014
+ --agy-tsl-hairline: var(--dsw-alias-border-l1, rgba(127,127,127,.2));
4015
+ --agy-tsl-surface: var(--dsw-alias-markdown-code-block, rgba(127,127,127,.06));
4016
+ --agy-tsl-banner: var(--dsw-alias-markdown-code-block-banner, rgba(127,127,127,.04));
4017
+ margin: 12px 0 4px 0;
4018
+ border: 0.5px solid var(--agy-tsl-hairline);
4019
+ border-radius: var(--dsw-radius-md, 12px);
4020
+ background: var(--agy-tsl-surface);
3929
4021
  overflow: hidden;
3930
4022
  }
4023
+ /* Explicit dark-theme fallbacks: DSH already flips every token, these only keep
4024
+ the card legible if a token is ever renamed or missing. */
4025
+ body[data-ds-dark-theme] .agy-tsl-card,
4026
+ body.dark .agy-tsl-card,
4027
+ [data-theme="dark"] .agy-tsl-card {
4028
+ --agy-tsl-hairline: var(--dsw-alias-border-l1, rgba(255,255,255,.10));
4029
+ --agy-tsl-surface: var(--dsw-alias-markdown-code-block, rgba(255,255,255,.04));
4030
+ --agy-tsl-banner: var(--dsw-alias-markdown-code-block-banner, rgba(255,255,255,.03));
4031
+ }
3931
4032
  .agy-tsl-head {
3932
4033
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
3933
- padding: 7px 10px; font-size: 12px; color: var(--dsw-alias-label-secondary, #aaa);
3934
- border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(127,127,127,.18));
3935
- }
3936
- .agy-tsl-badge {
3937
- display: inline-flex; align-items: center; gap: 5px;
3938
- font-weight: 700; font-size: 12px; color: #a78bfa;
3939
- background: rgba(139,92,246,.14); border: 1px solid rgba(139,92,246,.35);
3940
- padding: 2px 8px; border-radius: 999px;
3941
- }
3942
- .agy-tsl-meta { opacity: .85; font-variant-numeric: tabular-nums; }
3943
- .agy-tsl-spacer { flex: 1 1 auto; }
4034
+ min-height: 32px; padding: 4px 8px 4px 12px;
4035
+ background: var(--agy-tsl-banner);
4036
+ border-bottom: 0.5px solid var(--agy-tsl-hairline);
4037
+ font-size: 12px; line-height: 20px;
4038
+ color: var(--dsw-alias-label-tertiary, #8a8f98);
4039
+ }
4040
+ .agy-tsl-badge { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
4041
+ /* Monochrome spark: identity by shape, accent by token — no gradient <defs>. */
4042
+ .agy-tsl-mark { display: block; width: 14px; height: 14px; flex: 0 0 auto; color: inherit; }
4043
+ .agy-tsl-badge > .agy-tsl-mark { color: var(--dsw-alias-state-business-primary, #4176e6); }
4044
+ .agy-tsl-label {
4045
+ font-size: 12px; font-weight: 500; white-space: nowrap;
4046
+ color: var(--dsw-alias-label-secondary, #4a4c55);
4047
+ }
4048
+ .agy-tsl-meta {
4049
+ flex: 1 1 auto; min-width: 0; font-size: 11.5px; font-variant-numeric: tabular-nums;
4050
+ color: var(--dsw-alias-label-caption, #8a8f98);
4051
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
4052
+ }
4053
+ /* Actions wrap as ONE unit, so a narrow panel truncates the meta instead of
4054
+ splitting "copy" from "collapse" across two lines. */
4055
+ .agy-tsl-actions {
4056
+ display: inline-flex; align-items: center; gap: 2px;
4057
+ flex: 0 0 auto; margin-left: auto;
4058
+ }
4059
+ /* Flat text buttons, same treatment as the console/tool-card copy button. */
3944
4060
  .agy-tsl-btn {
3945
- background: transparent; border: 1px solid transparent; color: var(--dsw-alias-label-secondary, #aaa);
3946
- border-radius: 6px; cursor: pointer; font-size: 12px; padding: 2px 7px;
3947
- }
3948
- .agy-tsl-btn:hover { background: var(--dsw-alias-interactive-bg-hover-solid, rgba(127,127,127,.16)); color: var(--dsw-alias-label-primary, #eee); }
3949
- .agy-tsl-body { padding: 9px 12px; font-size: 13.5px; line-height: 1.65; color: var(--dsw-alias-label-primary, #eee); }
3950
- .agy-tsl-body p { margin: 0 0 7px 0; }
4061
+ display: inline-flex; align-items: center; gap: 4px;
4062
+ margin: 0; padding: 2px 6px; border: 0; border-radius: var(--dsw-radius-xs, 4px);
4063
+ background: transparent; color: var(--dsw-alias-label-tertiary, #8a8f98);
4064
+ font: inherit; font-size: 11.5px; line-height: 16px; cursor: pointer;
4065
+ transition: background-color .1s ease, color .1s ease;
4066
+ }
4067
+ .agy-tsl-btn:hover {
4068
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,.12));
4069
+ color: var(--dsw-alias-label-primary, #1a1c21);
4070
+ }
4071
+ .agy-tsl-btn[data-active="true"] { color: var(--dsw-alias-label-primary, #1a1c21); }
4072
+ .agy-tsl-body {
4073
+ padding: 10px 14px 12px 14px;
4074
+ font-size: var(--dsw-font-markdown-base-font-size, 14px);
4075
+ line-height: var(--dsw-font-markdown-base-line-height, 24px);
4076
+ color: var(--dsw-alias-label-primary, #1a1c21);
4077
+ overflow-wrap: break-word;
4078
+ }
4079
+ .agy-tsl-body p { margin: 0 0 8px 0; }
3951
4080
  .agy-tsl-body p:last-child { margin-bottom: 0; }
3952
- .agy-tsl-body ul, .agy-tsl-body ol { margin: 0 0 7px 0; padding-left: 20px; }
4081
+ .agy-tsl-body ul, .agy-tsl-body ol { margin: 0 0 8px 0; padding-left: 22px; }
3953
4082
  .agy-tsl-body li { margin: 2px 0; }
3954
- .agy-tsl-body h4, .agy-tsl-body h5 { margin: 8px 0 5px 0; font-size: 13.5px; }
3955
- .agy-tsl-body code { background: rgba(127,127,127,.18); border-radius: 4px; padding: 1px 4px; font-size: 12.5px; }
3956
- .agy-tsl-body pre { background: rgba(127,127,127,.14); border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: 0 0 7px 0; }
3957
- .agy-tsl-body pre code { background: transparent; padding: 0; }
4083
+ .agy-tsl-body h4, .agy-tsl-body h5 { margin: 12px 0 6px 0; font-size: 14px; line-height: 22px; }
4084
+ .agy-tsl-body code {
4085
+ font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
4086
+ font-size: .9em; padding: 1px 4px; border-radius: var(--dsw-radius-xs, 4px);
4087
+ background: var(--dsw-alias-markdown-inline-code, rgba(127,127,127,.16));
4088
+ }
4089
+ .agy-tsl-body pre {
4090
+ margin: 0 0 8px 0; padding: 10px 12px; overflow-x: auto;
4091
+ border: 0.5px solid var(--agy-tsl-hairline);
4092
+ border-radius: var(--dsw-radius-sm, 8px);
4093
+ background: var(--agy-tsl-banner);
4094
+ }
4095
+ .agy-tsl-body pre code { background: transparent; padding: 0; font-size: 12.5px; }
3958
4096
  .agy-tsl-original {
3959
- margin: 0; padding: 8px 12px; border-top: 1px dashed var(--dsw-alias-border-l2, rgba(127,127,127,.28));
3960
- font-size: 12.5px; color: var(--dsw-alias-label-secondary, #aaa); white-space: pre-wrap; max-height: 260px; overflow: auto;
4097
+ margin: 0; padding: 10px 14px;
4098
+ border-top: 0.5px dashed var(--dsw-alias-border-l2, rgba(127,127,127,.28));
4099
+ font-size: 12.5px; line-height: 1.6;
4100
+ color: var(--dsw-alias-label-secondary, #4a4c55);
4101
+ white-space: pre-wrap; max-height: 260px; overflow: auto;
3961
4102
  }
3962
4103
  /* Icon-only action that sits in the same strip as copy / thumbs / link, with
3963
4104
  the same neutral tint so it reads as part of that group. */
@@ -3968,13 +4109,13 @@ div[data-variant="think"] [class*="thinkBody"] {
3968
4109
  cursor: pointer; transition: background .15s ease, color .15s ease;
3969
4110
  }
3970
4111
  .agy-tsl-icon:hover:not(:disabled) {
3971
- background: var(--dsw-alias-interactive-bg-hover-solid, rgba(127,127,127,.14));
3972
- color: var(--dsw-alias-label-primary, #eee);
4112
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,.14));
4113
+ color: var(--dsw-alias-label-primary, #1a1c21);
3973
4114
  }
3974
4115
  .agy-tsl-icon:disabled { cursor: default; }
3975
4116
  .agy-tsl-icon[data-state="working"] { color: var(--dsw-alias-state-business-primary, #2563eb); cursor: wait; }
3976
- .agy-tsl-icon[data-state="done"] { color: #10b981; }
3977
- .agy-tsl-icon[data-state="error"] { color: #ef4444; }
4117
+ .agy-tsl-icon[data-state="done"] { color: var(--dsw-alias-state-success-primary, #22c55e); }
4118
+ .agy-tsl-icon[data-state="error"] { color: var(--dsw-alias-state-error-primary, #ef4444); }
3978
4119
  .agy-tsl-icon svg { width: 15px; height: 15px; display: block; }
3979
4120
  @keyframes agy-tsl-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
3980
4121
  /* Own tooltip: the native title bubble never showed inside the desktop shell,
@@ -4145,6 +4286,28 @@ div[data-variant="think"] [class*="thinkBody"] {
4145
4286
  }
4146
4287
  return h$1("div", null, blocks);
4147
4288
  }
4289
+ /**
4290
+ * The Gemini four-point spark. Drawn monochrome (`currentColor`) on purpose:
4291
+ * the card belongs to DSH's design system, so the brand shows up as one tinted
4292
+ * glyph in the header instead of a gradient-filled widget. Without <defs> there
4293
+ * is no per-render gradient id either, so several cards can coexist untouched.
4294
+ */
4295
+ function geminiMark() {
4296
+ return h$1("svg", {
4297
+ viewBox: "0 0 24 24",
4298
+ className: "agy-tsl-mark",
4299
+ "aria-hidden": "true",
4300
+ focusable: "false"
4301
+ }, h$1("path", {
4302
+ d: BRAND_PATHS.gemini,
4303
+ fill: "currentColor"
4304
+ }));
4305
+ }
4306
+ /**
4307
+ * One native-looking card: banner header (spark + "Gemini 译文", model/effort as
4308
+ * caption meta, and the three flat actions) over DSH-markdown body text. Every
4309
+ * colour is a DSH token — the host theme decides light or dark.
4310
+ */
4148
4311
  const TranslationCard = (props) => {
4149
4312
  const data = (props?.node ?? {}).data ?? {};
4150
4313
  const t = (key, fallback) => {
@@ -4173,45 +4336,25 @@ div[data-variant="think"] [class*="thinkBody"] {
4173
4336
  setTimeout(() => setCopied(false), 1500);
4174
4337
  }).catch(() => void 0);
4175
4338
  };
4339
+ const action = (key, label, onClick, active) => h$1("button", {
4340
+ key,
4341
+ type: "button",
4342
+ className: "agy-tsl-btn",
4343
+ ...active === void 0 ? null : { "data-active": active ? "true" : "false" },
4344
+ onClick
4345
+ }, label);
4346
+ const badge = t("tsl.badge", "Gemini translation");
4176
4347
  return h$1("div", {
4177
4348
  className: "agy-tsl-card",
4178
4349
  "data-agy-translation": "gemini",
4179
- "aria-label": t("tsl.badge", "Gemini translation")
4180
- }, h$1("div", { className: "agy-tsl-head" }, h$1("span", { className: "agy-tsl-badge" }, "✨ " + t("tsl.badge", "Gemini translation")), h$1("span", { className: "agy-tsl-meta" }, meta.join(" · ")), h$1("span", { className: "agy-tsl-spacer" }), h$1("button", {
4181
- type: "button",
4182
- className: "agy-tsl-btn",
4183
- onClick: copy
4184
- }, copied ? t("tsl.copied", "Copied") : t("tsl.copy", "Copy")), h$1("button", {
4185
- type: "button",
4186
- className: "agy-tsl-btn",
4187
- onClick: () => setOpen(!open)
4188
- }, open ? t("tsl.collapse", "收起") : t("tsl.expand", "展开"))), open ? h$1("div", { className: "agy-tsl-body" }, renderMarkdown(text)) : null, original !== "" ? h$1("div", {
4189
- className: "agy-tsl-head",
4190
- style: {
4191
- borderBottom: "none",
4192
- paddingTop: "0",
4193
- paddingBottom: "6px"
4194
- }
4195
- }, h$1("button", {
4196
- type: "button",
4197
- className: "agy-tsl-btn",
4198
- onClick: () => setShowOriginal(!showOriginal)
4199
- }, showOriginal ? t("tsl.hideOriginal", "Hide original") : t("tsl.showOriginal", "Show original"))) : null, showOriginal && original !== "" ? h$1("pre", { className: "agy-tsl-original" }, original) : null);
4350
+ "aria-label": badge
4351
+ }, h$1("div", { className: "agy-tsl-head" }, h$1("span", { className: "agy-tsl-badge" }, geminiMark(), h$1("span", { className: "agy-tsl-label" }, badge)), meta.length === 0 ? null : h$1("span", {
4352
+ className: "agy-tsl-meta",
4353
+ title: meta.join(" · ")
4354
+ }, meta.join(" · ")), h$1("span", { className: "agy-tsl-actions" }, original === "" ? null : action("original", showOriginal ? t("tsl.hideOriginal", "Hide original") : t("tsl.showOriginal", "Show original"), () => setShowOriginal(!showOriginal), showOriginal), action("copy", copied ? t("tsl.copied", "Copied") : t("tsl.copy", "Copy"), copy), action("collapse", open ? t("tsl.collapse", "Collapse") : t("tsl.expand", "Expand"), () => setOpen(!open)))), open ? h$1("div", { className: "agy-tsl-body" }, renderMarkdown(text)) : null, showOriginal && original !== "" ? h$1("pre", { className: "agy-tsl-original" }, original) : null);
4200
4355
  };
4201
- /** Four-point Gemini spark, filled with `currentColor` so it inherits the icon
4202
- * tint of DSH's action strip and looks native next to copy/thumbs/link. */
4203
- const GEMINI_STAR = "M12 2 Q13.1 9.2 22 12 Q13.1 14.8 12 22 Q10.9 14.8 2 12 Q10.9 9.2 12 2 Z";
4204
4356
  function geminiGlyph() {
4205
- return h$1("svg", {
4206
- viewBox: "0 0 24 24",
4207
- fill: "currentColor",
4208
- "aria-hidden": "true",
4209
- style: {
4210
- width: "15px",
4211
- height: "15px",
4212
- display: "block"
4213
- }
4214
- }, h$1("path", { d: GEMINI_STAR }));
4357
+ return geminiMark();
4215
4358
  }
4216
4359
  function spinnerGlyph() {
4217
4360
  return h$1("svg", {
@@ -4317,6 +4460,7 @@ div[data-variant="think"] [class*="thinkBody"] {
4317
4460
  const created = doc.createElement("div");
4318
4461
  created?.setAttribute?.("id", TIP_ID);
4319
4462
  created?.setAttribute?.("role", "tooltip");
4463
+ created?.setAttribute?.("class", "agy-tsl-tip");
4320
4464
  if (created !== void 0 && created !== null) {
4321
4465
  created.style.cssText = "position:fixed;display:none;pointer-events:none;z-index:1100";
4322
4466
  created.isConnected = true;
@@ -4343,6 +4487,8 @@ div[data-variant="think"] [class*="thinkBody"] {
4343
4487
  const box = anchorBox(el);
4344
4488
  if (node === null || node === void 0 || box === null) return;
4345
4489
  node.textContent = text;
4490
+ node.setAttribute?.("class", "agy-tsl-tip");
4491
+ node.style.position = "fixed";
4346
4492
  node.style.display = "inline-flex";
4347
4493
  const size = node.getBoundingClientRect?.() ?? {
4348
4494
  width: 0,
@@ -4376,12 +4522,47 @@ div[data-variant="think"] [class*="thinkBody"] {
4376
4522
  }
4377
4523
  /**
4378
4524
  * Per-reply action state, kept outside React so it survives a remount: the chat
4379
- * timeline virtualises nodes and DSH re-creates the whole panel when the window
4380
- * regains focus, which used to reset the button to `idle` mid-flight. The map is
4381
- * the in-page truth; the host's durable record is the truth across page loads.
4525
+ * timeline virtualises nodes, and DSH re-creates the whole panel whenever a new
4526
+ * card lands in the transcript. The map is the in-page truth; the host's durable
4527
+ * record is the truth across page loads.
4528
+ *
4529
+ * The bug this shape fixes: a remount that happens *while* a translation is in
4530
+ * flight re-initialises to `working`, and the promise that finishes belongs to
4531
+ * the unmounted instance — whose `setState` is a no-op. The spinner then never
4532
+ * stopped even though the card had rendered. Publishing to every mounted
4533
+ * instance is what lets the survivor settle to `done`.
4382
4534
  */
4383
4535
  const ACTION_STATE = /* @__PURE__ */ new Map();
4384
4536
  const ACTION_INFLIGHT = /* @__PURE__ */ new Set();
4537
+ const ACTION_LISTENERS = /* @__PURE__ */ new Map();
4538
+ function actionKey(sessionId, messageId) {
4539
+ return sessionId + "\0" + messageId;
4540
+ }
4541
+ /** Current state of one action; `working` whenever a request is in flight. */
4542
+ function actionStateOf(key) {
4543
+ return ACTION_INFLIGHT.has(key) ? "working" : ACTION_STATE.get(key) ?? "idle";
4544
+ }
4545
+ /** Publish a state to every mounted instance of this action. */
4546
+ function setActionState(key, next) {
4547
+ ACTION_STATE.set(key, next);
4548
+ if (next === "working") ACTION_INFLIGHT.add(key);
4549
+ else ACTION_INFLIGHT.delete(key);
4550
+ const listeners = ACTION_LISTENERS.get(key);
4551
+ if (listeners === void 0) return;
4552
+ for (const listener of [...listeners]) try {
4553
+ listener(next);
4554
+ } catch {}
4555
+ }
4556
+ /** Subscribe one mounted action instance; the returned function unsubscribes. */
4557
+ function subscribeActionState(key, listener) {
4558
+ const listeners = ACTION_LISTENERS.get(key) ?? /* @__PURE__ */ new Set();
4559
+ listeners.add(listener);
4560
+ ACTION_LISTENERS.set(key, listeners);
4561
+ return () => {
4562
+ listeners.delete(listener);
4563
+ if (listeners.size === 0) ACTION_LISTENERS.delete(key);
4564
+ };
4565
+ }
4385
4566
  /**
4386
4567
  * Icon-only "translate with Gemini" action rendered into the assistant action
4387
4568
  * strip (`conversation.chat.assistant-actions`), so it lines up with copy,
@@ -4392,8 +4573,9 @@ div[data-variant="think"] [class*="thinkBody"] {
4392
4573
  const injectedSession = typeof props?.sessionId === "string" ? props.sessionId : "";
4393
4574
  const ctx = props?.ctx;
4394
4575
  const sessionId = injectedSession !== "" ? injectedSession : ctx === void 0 ? "" : currentSessionId(ctx);
4395
- const key = sessionId + "\0" + messageId;
4396
- const [state, setState] = useState$1(() => ACTION_INFLIGHT.has(key) ? "working" : ACTION_STATE.get(key) ?? "idle");
4576
+ const key = actionKey(sessionId, messageId);
4577
+ const [state, setState] = useState$1(() => actionStateOf(key));
4578
+ useEffect$1(() => subscribeActionState(key, (next) => setState(next)), [key]);
4397
4579
  useEffect$1(() => {
4398
4580
  if (messageId === "" || sessionId === "") return;
4399
4581
  let alive = true;
@@ -4401,9 +4583,7 @@ div[data-variant="think"] [class*="thinkBody"] {
4401
4583
  if (!alive || res === null) return;
4402
4584
  const next = res.state === "ready" ? "done" : res.state === "busy" ? "working" : null;
4403
4585
  if (next === null) return;
4404
- ACTION_STATE.set(key, next);
4405
- if (next === "working") ACTION_INFLIGHT.add(key);
4406
- setState((prev) => prev === next ? prev : next);
4586
+ setActionState(key, next);
4407
4587
  });
4408
4588
  return () => {
4409
4589
  alive = false;
@@ -4415,22 +4595,19 @@ div[data-variant="think"] [class*="thinkBody"] {
4415
4595
  ]);
4416
4596
  if (messageId === "" || sessionId === "") return null;
4417
4597
  const apply = (next) => {
4418
- ACTION_STATE.set(key, next);
4419
- setState(next);
4598
+ setActionState(key, next);
4420
4599
  };
4421
4600
  const run = (e) => {
4422
4601
  e?.stopPropagation?.();
4423
4602
  e?.preventDefault?.();
4424
4603
  hideTip();
4425
4604
  if (state === "working") return;
4426
- ACTION_INFLIGHT.add(key);
4427
4605
  apply("working");
4428
4606
  postTranslate({
4429
4607
  sessionId,
4430
4608
  messageId,
4431
4609
  persist: true
4432
4610
  }).then((res) => {
4433
- ACTION_INFLIGHT.delete(key);
4434
4611
  if (res?.ok === true) {
4435
4612
  apply("done");
4436
4613
  return;
@@ -4440,7 +4617,6 @@ div[data-variant="think"] [class*="thinkBody"] {
4440
4617
  if (!ACTION_INFLIGHT.has(key)) apply("idle");
4441
4618
  }, 3e3);
4442
4619
  }).catch(() => {
4443
- ACTION_INFLIGHT.delete(key);
4444
4620
  apply("error");
4445
4621
  setTimeout(() => {
4446
4622
  if (!ACTION_INFLIGHT.has(key)) apply("idle");
@@ -4472,7 +4648,7 @@ div[data-variant="think"] [class*="thinkBody"] {
4472
4648
  border: "none",
4473
4649
  borderRadius: "6px",
4474
4650
  background: "transparent",
4475
- color: state === "working" ? "var(--dsw-alias-state-business-primary, #2563eb)" : state === "done" ? "#10b981" : state === "error" ? "#ef4444" : "var(--dsw-alias-label-tertiary, #8a8f98)",
4651
+ color: state === "working" ? "var(--dsw-alias-state-business-primary, #2563eb)" : state === "done" ? "var(--dsw-alias-state-success-primary, #22c55e)" : state === "error" ? "var(--dsw-alias-state-error-primary, #ef4444)" : "var(--dsw-alias-label-tertiary, #8a8f98)",
4476
4652
  cursor: state === "working" ? "wait" : "pointer"
4477
4653
  }
4478
4654
  }, glyph));
@@ -5083,17 +5259,21 @@ div[data-variant="think"] [class*="thinkBody"] {
5083
5259
  const renderLine = (windowName, percent, c, resetStr, rawFraction, rawReset) => {
5084
5260
  const isShimmer = percent < 0 || isRefreshing;
5085
5261
  const tooltipText = typeof rawFraction === "number" ? `${(rawFraction * 100).toFixed(1)}% (raw: ${rawFraction})${rawReset ? ` · reset: ${rawReset}` : ""}` : resetStr ? `↻ ${resetStr}` : void 0;
5086
- return h("div", { style: {
5087
- display: "flex",
5088
- alignItems: "center",
5089
- fontSize: "11.5px",
5090
- margin: "4px 0"
5091
- } }, h("span", { style: {
5092
- width: "52px",
5262
+ return h("div", {
5263
+ className: "agy-quota-line",
5264
+ style: {
5265
+ display: "flex",
5266
+ alignItems: "center",
5267
+ fontSize: "11.5px",
5268
+ margin: "4px 0"
5269
+ }
5270
+ }, h("span", { style: {
5271
+ width: "64px",
5093
5272
  color: "var(--agy-text-window-label)",
5094
5273
  fontSize: "11px",
5095
5274
  fontWeight: 700,
5096
- flexShrink: 0
5275
+ flexShrink: 0,
5276
+ whiteSpace: "nowrap"
5097
5277
  } }, windowName), h("div", {
5098
5278
  className: isShimmer ? "agy-shimmer-track" : "",
5099
5279
  style: S.progressBarBg
@@ -5485,8 +5665,10 @@ body.dark,
5485
5665
  position: absolute;
5486
5666
  top: 0; left: 0; right: 0; bottom: 0;
5487
5667
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
5488
- transform: translateX(-100%) translateZ(0);
5489
- will-change: transform;
5668
+ transform: translateX(-100%);
5669
+ /* No will-change: transform: it pins a compositing layer for a decorative
5670
+ loop even while it is idle, and inside the overlay that layer is another
5671
+ thing the compositor can drop mid-scroll. */
5490
5672
  animation: agy-shimmer 1.8s infinite ease-in-out;
5491
5673
  pointer-events: none;
5492
5674
  }
@@ -5513,6 +5695,15 @@ html.agy-modal-open [data-conversation-scroll] {
5513
5695
  overflow: hidden !important;
5514
5696
  overscroll-behavior: contain;
5515
5697
  }
5698
+ /* Belt for the shell itself: if the host page (or a shell wrapper) is the thing
5699
+ that scrolls, locking only the conversation scroller leaves a scroller free
5700
+ behind the overlay. The wheel/touch blocker in the dialog is the primary fix;
5701
+ this makes the intent explicit for any element that follows the document. */
5702
+ html.agy-modal-open,
5703
+ html.agy-modal-open body {
5704
+ overflow: hidden !important;
5705
+ overscroll-behavior: none;
5706
+ }
5516
5707
  .agy-modal-panel {
5517
5708
  position: relative;
5518
5709
  width: 100%;
@@ -5527,8 +5718,13 @@ html.agy-modal-open [data-conversation-scroll] {
5527
5718
  overflow: hidden;
5528
5719
  color: var(--agy-text-primary);
5529
5720
  font-family: var(--agy-font-family);
5530
- transform: translateZ(0);
5531
- contain: content;
5721
+ /* NO compositing hints here (2026-11-04, "滚动还是频繁闪屏"):
5722
+ contain: content implies PAINT containment, and paint containment on an
5723
+ ancestor of a scrolling subtree is the classic Chromium flicker trap — the
5724
+ backing layer is dropped and rebuilt while the body scrolls, so the panel
5725
+ blinks over the translucent backdrop. A forced translateZ(0) layer makes
5726
+ it worse (big fixed layer + shadow re-composited per frame). A 640px panel
5727
+ needs neither hint; plain overflow: hidden already clips it. */
5532
5728
  }
5533
5729
  .agy-submodel-row {
5534
5730
  display: flex;
@@ -5542,6 +5738,120 @@ html.agy-modal-open [data-conversation-scroll] {
5542
5738
  margin: 4px 0;
5543
5739
  color: var(--agy-text-primary);
5544
5740
  }
5741
+
5742
+ /* Native dropdowns: the closed control carries inline colours, but the popup
5743
+ list follows color-scheme, so mirror the shell theme here too. */
5744
+ select.agy-select { color-scheme: light; }
5745
+ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
5746
+
5747
+ /* ------------------------------------------------------------------
5748
+ Phone web. Below 680px the console becomes a full-height sheet and
5749
+ every inline flex row is allowed to wrap: the layout is written with
5750
+ style attributes, and only an !important rule can beat those, so the
5751
+ overrides here are deliberately blunt.
5752
+ ------------------------------------------------------------------ */
5753
+ @media (max-width: 680px) {
5754
+ .agy-modal-backdrop {
5755
+ padding: 0 !important;
5756
+ align-items: stretch !important;
5757
+ justify-content: stretch !important;
5758
+ }
5759
+ .agy-modal-panel {
5760
+ width: 100% !important;
5761
+ max-width: none !important;
5762
+ height: 100dvh !important;
5763
+ max-height: 100dvh !important;
5764
+ border: 0 !important;
5765
+ border-radius: 0 !important;
5766
+ }
5767
+ .agy-modal-head {
5768
+ padding: 12px 14px !important;
5769
+ padding-top: max(12px, env(safe-area-inset-top)) !important;
5770
+ }
5771
+ .agy-modal-body {
5772
+ padding: 14px 12px calc(18px + env(safe-area-inset-bottom)) !important;
5773
+ -webkit-overflow-scrolling: touch;
5774
+ }
5775
+
5776
+ /* A flex row may wrap instead of pushing the panel sideways. */
5777
+ .agy-console [style*="display: flex"] { flex-wrap: wrap !important; }
5778
+ /* Label on its own line, the control underneath it. */
5779
+ .agy-console [style*="justify-content: space-between"] {
5780
+ flex-direction: column !important;
5781
+ align-items: stretch !important;
5782
+ gap: 8px !important;
5783
+ }
5784
+ /* Segmented controls fill the row; every segment shares the width. */
5785
+ .agy-console [style*="agy-seg-group-border"] {
5786
+ display: flex !important;
5787
+ width: 100% !important;
5788
+ box-sizing: border-box !important;
5789
+ }
5790
+ .agy-console [style*="agy-seg-group-border"] > button {
5791
+ flex: 1 1 0 !important;
5792
+ min-width: 0 !important;
5793
+ padding-left: 6px !important;
5794
+ padding-right: 6px !important;
5795
+ }
5796
+ /* Inputs shrink; buttons keep a comfortable tap area. */
5797
+ .agy-console input { min-width: 0 !important; flex: 1 1 140px !important; }
5798
+ /* Settings dropdowns share their row and stretch on a phone. */
5799
+ .agy-console .agy-select { flex: 1 1 0 !important; min-width: 0 !important; max-width: none !important; height: 34px !important; }
5800
+ .agy-console .agy-btn { min-height: 34px; }
5801
+ /* The family label no longer reserves 140px of a 360px screen. */
5802
+ .agy-console [style*="min-width: 140px"] { min-width: 0 !important; }
5803
+ /* Per-model rows may wrap their value under the name. */
5804
+ .agy-console .agy-submodel-row { flex-wrap: wrap; gap: 4px 8px; }
5805
+
5806
+ /* Quota line: window name and badge share the first row, the bar takes
5807
+ the second one — 52px of label plus a 140px badge cluster leaves no
5808
+ room for a bar on a 360px screen. */
5809
+ .agy-quota-line {
5810
+ display: grid !important;
5811
+ grid-template-columns: minmax(0, 1fr) auto;
5812
+ grid-template-areas: "label cluster" "bar bar";
5813
+ align-items: center;
5814
+ gap: 5px 8px;
5815
+ }
5816
+ .agy-quota-line > span:first-child {
5817
+ grid-area: label;
5818
+ width: auto !important;
5819
+ white-space: nowrap;
5820
+ }
5821
+ .agy-quota-line > div:nth-child(2) { grid-area: bar; margin: 0 !important; }
5822
+ .agy-quota-line > div:nth-child(3) { grid-area: cluster; min-width: 0 !important; }
5823
+
5824
+ /* Header actions: the primary action keeps a full row, the two
5825
+ secondary ones share the next. */
5826
+ .agy-header-actions {
5827
+ display: grid !important;
5828
+ grid-template-columns: 1fr 1fr;
5829
+ gap: 6px;
5830
+ width: 100%;
5831
+ }
5832
+ .agy-header-actions > button:first-child { grid-column: 1 / -1; }
5833
+ .agy-header-actions > button { width: 100%; justify-content: center; }
5834
+
5835
+ /* Account actions: equal-width buttons instead of one ragged line. */
5836
+ .agy-card-actions {
5837
+ display: grid !important;
5838
+ grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
5839
+ gap: 6px;
5840
+ width: 100%;
5841
+ align-items: stretch;
5842
+ }
5843
+ .agy-card-actions > button { width: 100%; justify-content: center; }
5844
+ }
5845
+
5846
+ @media (max-width: 420px) {
5847
+ .agy-console { font-size: 12.5px; }
5848
+ .agy-modal-head {
5849
+ padding: 10px 12px !important;
5850
+ padding-top: max(10px, env(safe-area-inset-top)) !important;
5851
+ }
5852
+ .agy-modal-body { padding: 12px 10px calc(16px + env(safe-area-inset-bottom)) !important; }
5853
+ .agy-console [style*="justify-content: space-between"] { gap: 6px !important; }
5854
+ }
5545
5855
  `;
5546
5856
  function injectGlobalStyles() {
5547
5857
  if (typeof document === "undefined") return;
@@ -5765,6 +6075,36 @@ html.agy-modal-open [data-conversation-scroll] {
5765
6075
  color: "var(--agy-text-tertiary)",
5766
6076
  fontSize: "11.5px"
5767
6077
  },
6078
+ cfgRowRight: {
6079
+ display: "flex",
6080
+ alignItems: "center",
6081
+ justifyContent: "flex-end",
6082
+ flexWrap: "wrap",
6083
+ gap: "6px",
6084
+ minWidth: 0,
6085
+ flex: "0 0 auto"
6086
+ },
6087
+ select: {
6088
+ appearance: "none",
6089
+ WebkitAppearance: "none",
6090
+ height: "28px",
6091
+ padding: "0 22px 0 8px",
6092
+ borderRadius: "6px",
6093
+ border: "1px solid var(--agy-border-btn)",
6094
+ backgroundColor: "var(--agy-bg-input)",
6095
+ color: "var(--agy-text-primary)",
6096
+ fontFamily: "inherit",
6097
+ fontSize: "11.5px",
6098
+ fontWeight: 600,
6099
+ cursor: "pointer",
6100
+ minWidth: "104px",
6101
+ maxWidth: "190px",
6102
+ textOverflow: "ellipsis",
6103
+ backgroundImage: "linear-gradient(45deg, transparent 50%, var(--agy-text-tertiary) 50%), linear-gradient(135deg, var(--agy-text-tertiary) 50%, transparent 50%)",
6104
+ backgroundPosition: "calc(100% - 13px) calc(50% + 1px), calc(100% - 9px) calc(50% + 1px)",
6105
+ backgroundSize: "4px 4px, 4px 4px",
6106
+ backgroundRepeat: "no-repeat"
6107
+ },
5768
6108
  noticeBanner: {
5769
6109
  display: "flex",
5770
6110
  alignItems: "center",
@@ -6356,12 +6696,15 @@ html.agy-modal-open [data-conversation-scroll] {
6356
6696
  fontWeight: 700
6357
6697
  },
6358
6698
  title: t("status.disabled")
6359
- }, uiIcon("power", 10, "#64748b"), t("status.disabled")) : null), h("div", { style: {
6360
- display: "flex",
6361
- gap: "4px",
6362
- alignItems: "center",
6363
- flexShrink: 0
6364
- } }, h("button", {
6699
+ }, uiIcon("power", 10, "#64748b"), t("status.disabled")) : null), h("div", {
6700
+ className: "agy-card-actions",
6701
+ style: {
6702
+ display: "flex",
6703
+ gap: "4px",
6704
+ alignItems: "center",
6705
+ flexShrink: 0
6706
+ }
6707
+ }, h("button", {
6365
6708
  type: "button",
6366
6709
  className: "agy-btn",
6367
6710
  style: acc.enabled ? {
@@ -6687,7 +7030,10 @@ html.agy-modal-open [data-conversation-scroll] {
6687
7030
  alignItems: "center",
6688
7031
  justifyContent: "center"
6689
7032
  } }, h("span", { style: S.muted }, [renderSpinner(), t("status.loading")]));
6690
- return h("div", { style: S.container }, h("div", { style: S.headerCard }, h("div", { style: {
7033
+ return h("div", {
7034
+ className: "agy-console",
7035
+ style: S.container
7036
+ }, h("div", { style: S.headerCard }, h("div", { style: {
6691
7037
  display: "flex",
6692
7038
  alignItems: "center",
6693
7039
  gap: "8px"
@@ -6695,11 +7041,14 @@ html.agy-modal-open [data-conversation-scroll] {
6695
7041
  fontWeight: 700,
6696
7042
  fontSize: "14px",
6697
7043
  color: "var(--agy-text-primary)"
6698
- } }, "Antigravity"), h("span", { style: isAuthed ? S.badgeReady : S.badgeUnready }, isAuthed ? t("status.ready") : t("status.needsAuth"))), h("div", { style: {
6699
- display: "flex",
6700
- gap: "6px",
6701
- alignItems: "center"
6702
- } }, !addingAccount ? h("button", {
7044
+ } }, "Antigravity"), h("span", { style: isAuthed ? S.badgeReady : S.badgeUnready }, isAuthed ? t("status.ready") : t("status.needsAuth"))), h("div", {
7045
+ className: "agy-header-actions",
7046
+ style: {
7047
+ display: "flex",
7048
+ gap: "6px",
7049
+ alignItems: "center"
7050
+ }
7051
+ }, !addingAccount ? h("button", {
6703
7052
  type: "button",
6704
7053
  className: "agy-btn",
6705
7054
  style: {
@@ -6795,15 +7144,18 @@ html.agy-modal-open [data-conversation-scroll] {
6795
7144
  }, t("config.off")))), h("div", { style: {
6796
7145
  display: "flex",
6797
7146
  alignItems: "center",
6798
- justifyContent: "space-between"
7147
+ justifyContent: "space-between",
7148
+ gap: "10px"
6799
7149
  } }, h("div", { style: {
6800
7150
  display: "flex",
6801
- flexDirection: "column"
7151
+ flexDirection: "column",
7152
+ minWidth: 0,
7153
+ flex: "1 1 0"
6802
7154
  } }, h("span", { style: {
6803
7155
  color: "var(--agy-text-primary)",
6804
7156
  fontWeight: 600,
6805
7157
  fontSize: "12.5px"
6806
- } }, t("config.autoTranslate")), h("span", { style: S.muted }, t("config.autoTranslateDesc"))), h("div", { style: S.segGroup }, h("button", {
7158
+ } }, t("config.autoTranslate")), h("span", { style: S.muted }, t("config.autoTranslateDesc"))), h("div", { style: S.cfgRowRight }, h("div", { style: S.segGroup }, h("button", {
6807
7159
  type: "button",
6808
7160
  style: status?.autoTranslate === true ? S.segBtnActive : S.segBtn,
6809
7161
  disabled: loadingAction === "config:autoTranslate",
@@ -6813,7 +7165,38 @@ html.agy-modal-open [data-conversation-scroll] {
6813
7165
  style: status?.autoTranslate !== true ? S.segBtnActive : S.segBtn,
6814
7166
  disabled: loadingAction === "config:autoTranslate",
6815
7167
  onClick: () => void setCfg("autoTranslate", false)
6816
- }, t("config.off")))), h("div", { style: {
7168
+ }, t("config.off"))), h("select", {
7169
+ className: "agy-select",
7170
+ "aria-label": t("config.translateModel"),
7171
+ title: t("config.translateModelDesc"),
7172
+ style: S.select,
7173
+ value: status?.translateModel ?? "",
7174
+ disabled: loadingAction === "config:translateModel",
7175
+ onChange: (e) => void setCfg("translateModel", e?.target?.value ?? "")
7176
+ }, translateModelOptions(status?.translateModel ?? "", geminiCatalogModels(catalogModels), t("config.translateModelAuto")).map((option) => h("option", {
7177
+ key: option.value,
7178
+ value: option.value
7179
+ }, option.label))), h("select", {
7180
+ className: "agy-select",
7181
+ "aria-label": t("config.translateEffort"),
7182
+ title: t("config.translateEffortDesc"),
7183
+ style: {
7184
+ ...S.select,
7185
+ minWidth: "78px",
7186
+ maxWidth: "110px"
7187
+ },
7188
+ value: status?.translateEffort ?? "",
7189
+ disabled: loadingAction === "config:translateEffort",
7190
+ onChange: (e) => void setCfg("translateEffort", e?.target?.value ?? "")
7191
+ }, translateEffortOptions(status?.translateEffort ?? "", {
7192
+ auto: t("config.translateEffortAuto"),
7193
+ low: t("effort.low"),
7194
+ medium: t("effort.medium"),
7195
+ high: t("effort.high")
7196
+ }).map((option) => h("option", {
7197
+ key: option.value,
7198
+ value: option.value
7199
+ }, option.label))))), h("div", { style: {
6817
7200
  display: "flex",
6818
7201
  alignItems: "center",
6819
7202
  justifyContent: "space-between"
@@ -6885,6 +7268,28 @@ html.agy-modal-open [data-conversation-scroll] {
6885
7268
  win.addEventListener?.("keydown", onKey, true);
6886
7269
  return () => win.removeEventListener?.("keydown", onKey, true);
6887
7270
  }, []);
7271
+ useEffect(() => {
7272
+ if (typeof document === "undefined") return;
7273
+ const block = (e) => {
7274
+ const target = e?.target;
7275
+ if (typeof target?.closest !== "function") return;
7276
+ if (target.closest(".agy-modal-backdrop") === null) return;
7277
+ if (target.closest(".agy-modal-body") !== null) return;
7278
+ e.preventDefault?.();
7279
+ };
7280
+ document.addEventListener("wheel", block, {
7281
+ passive: false,
7282
+ capture: true
7283
+ });
7284
+ document.addEventListener("touchmove", block, {
7285
+ passive: false,
7286
+ capture: true
7287
+ });
7288
+ return () => {
7289
+ document.removeEventListener("wheel", block, true);
7290
+ document.removeEventListener("touchmove", block, true);
7291
+ };
7292
+ }, []);
6888
7293
  return h("div", {
6889
7294
  className: "agy-modal-backdrop",
6890
7295
  onClick: (e) => {
@@ -6895,15 +7300,18 @@ html.agy-modal-open [data-conversation-scroll] {
6895
7300
  role: "dialog",
6896
7301
  "aria-modal": true,
6897
7302
  "aria-labelledby": "agy-console-title"
7303
+ }, h("div", {
7304
+ className: "agy-modal-head",
7305
+ style: {
7306
+ display: "flex",
7307
+ alignItems: "center",
7308
+ justifyContent: "space-between",
7309
+ padding: "14px 18px",
7310
+ borderBottom: "1px solid var(--agy-border-card)",
7311
+ background: "var(--agy-bg-header)",
7312
+ color: "var(--agy-text-primary)"
7313
+ }
6898
7314
  }, h("div", { style: {
6899
- display: "flex",
6900
- alignItems: "center",
6901
- justifyContent: "space-between",
6902
- padding: "14px 18px",
6903
- borderBottom: "1px solid var(--agy-border-card)",
6904
- background: "var(--agy-bg-header)",
6905
- color: "var(--agy-text-primary)"
6906
- } }, h("div", { style: {
6907
7315
  display: "flex",
6908
7316
  alignItems: "center",
6909
7317
  gap: "8px"
@@ -6929,13 +7337,17 @@ html.agy-modal-open [data-conversation-scroll] {
6929
7337
  alignItems: "center"
6930
7338
  },
6931
7339
  onClick: () => agyModalStore.setOpen(false)
6932
- }, uiIcon("x", 14, "var(--agy-text-btn)"))), h("div", { style: {
6933
- overflowY: "auto",
6934
- overscrollBehavior: "contain",
6935
- padding: "18px",
6936
- flex: "1",
6937
- background: "var(--agy-bg-panel)"
6938
- } }, h(AgySettingsSection, {
7340
+ }, uiIcon("x", 14, "var(--agy-text-btn)"))), h("div", {
7341
+ className: "agy-modal-body",
7342
+ style: {
7343
+ overflowY: "auto",
7344
+ overscrollBehavior: "contain",
7345
+ padding: "18px",
7346
+ flex: "1",
7347
+ minHeight: 0,
7348
+ background: "var(--agy-bg-panel)"
7349
+ }
7350
+ }, h(AgySettingsSection, {
6939
7351
  isModal: true,
6940
7352
  onClose: () => agyModalStore.setOpen(false)
6941
7353
  }))));