dsh-codex-subscription 3.2.20 → 3.2.22

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/lib/client.js CHANGED
@@ -1249,10 +1249,11 @@ window.__ModuleLoader__.load({
1249
1249
  "sketch/result",
1250
1250
  "sketch/disconnect"
1251
1251
  ]);
1252
- function createSubscriptionRpcClient(transport) {
1252
+ function createSubscriptionRpcClient(transport, incidents) {
1253
1253
  return Object.freeze({ call(channel, endpoint, payload, signal) {
1254
1254
  if (channel !== "/codex-subscription" || !RPC_ENDPOINTS.includes(endpoint)) throw new Error("Invalid subscription RPC target");
1255
- return transport.call("/api", `codex-subscription/${endpoint}`, payload, signal);
1255
+ const send = () => transport.call("/api", `codex-subscription/${endpoint}`, payload, signal);
1256
+ return incidents ? incidents.observeRpc(endpoint, send, signal) : send();
1256
1257
  } });
1257
1258
  }
1258
1259
  function unwrap(response) {
@@ -2110,6 +2111,11 @@ window.__ModuleLoader__.load({
2110
2111
  //#region src/client-languages.js
2111
2112
  const dictionaries = {
2112
2113
  zh: {
2114
+ speedShortcutTitle: "输入栏速度切换",
2115
+ speedShortcut_off: "关闭",
2116
+ speedShortcut_icon: "闪电",
2117
+ speedShortcut_hover: "悬停显示",
2118
+ speedShortcut_label: "速度名称",
2113
2119
  catalogTimeout: "模型目录读取超时。请检查网络或代理后重试。",
2114
2120
  catalogCachedTimeout: "继续使用已读取的模型目录;在线更新超时,请检查网络或代理后重试。",
2115
2121
  openSubscriptionSettings: "订阅设置",
@@ -3058,6 +3064,11 @@ window.__ModuleLoader__.load({
3058
3064
  imageRemoveAnnotation: "删除标注"
3059
3065
  },
3060
3066
  en: {
3067
+ speedShortcutTitle: "Composer speed shortcut",
3068
+ speedShortcut_off: "Off",
3069
+ speedShortcut_icon: "Lightning",
3070
+ speedShortcut_hover: "On hover",
3071
+ speedShortcut_label: "Speed name",
3061
3072
  catalogTimeout: "The model catalog request timed out. Check your network or proxy and retry.",
3062
3073
  catalogCachedTimeout: "Keeping the available model catalog; the online refresh timed out. Check your network or proxy and retry.",
3063
3074
  openSubscriptionSettings: "Subscription settings",
@@ -4888,6 +4899,11 @@ window.__ModuleLoader__.load({
4888
4899
  "composerMenuCustom": "モデルメニューの拡張が有効",
4889
4900
  "composerMenuHost": "DSH または他のプラグインのメニューを使用",
4890
4901
  "legacyModelPicker": "入力欄のモデルメニュー",
4902
+ "speedShortcutTitle": "入力欄の速度切り替え",
4903
+ "speedShortcut_off": "オフ",
4904
+ "speedShortcut_icon": "稲妻",
4905
+ "speedShortcut_hover": "ホバーで表示",
4906
+ "speedShortcut_label": "速度名",
4891
4907
  "composerMenuAuto": "自動",
4892
4908
  "composerMenuDsh": "DSH 標準",
4893
4909
  "composerMenuSubscription": "購読メニュー",
@@ -4954,6 +4970,11 @@ window.__ModuleLoader__.load({
4954
4970
  "imageRemoveAnnotation": "メモを削除"
4955
4971
  },
4956
4972
  es: {
4973
+ "speedShortcutTitle": "Atajo de velocidad en el cuadro de entrada",
4974
+ "speedShortcut_off": "Desactivado",
4975
+ "speedShortcut_icon": "Rayo",
4976
+ "speedShortcut_hover": "Al pasar el puntero",
4977
+ "speedShortcut_label": "Nombre de la velocidad",
4957
4978
  "catalogTimeout": "La solicitud del catálogo de modelos agotó el tiempo de espera. Comprueba la red o el proxy y reinténtalo.",
4958
4979
  "catalogCachedTimeout": "Se conserva el catálogo disponible; la actualización en línea agotó el tiempo de espera. Comprueba la red o el proxy y reinténtalo.",
4959
4980
  "openSubscriptionSettings": "Configuración de la suscripción",
@@ -5902,6 +5923,11 @@ window.__ModuleLoader__.load({
5902
5923
  "imageRemoveAnnotation": "Eliminar nota"
5903
5924
  },
5904
5925
  fr: {
5926
+ "speedShortcutTitle": "Raccourci de vitesse dans la zone de saisie",
5927
+ "speedShortcut_off": "Désactivé",
5928
+ "speedShortcut_icon": "Éclair",
5929
+ "speedShortcut_hover": "Au survol",
5930
+ "speedShortcut_label": "Nom de la vitesse",
5905
5931
  "catalogTimeout": "La demande du catalogue de modèles a expiré. Vérifiez le réseau ou le proxy et réessayez.",
5906
5932
  "catalogCachedTimeout": "Le catalogue disponible est conservé ; la mise à jour en ligne a expiré. Vérifiez le réseau ou le proxy et réessayez.",
5907
5933
  "openSubscriptionSettings": "Paramètres de l’abonnement",
@@ -6850,6 +6876,11 @@ window.__ModuleLoader__.load({
6850
6876
  "imageRemoveAnnotation": "Supprimer la note"
6851
6877
  },
6852
6878
  de: {
6879
+ "speedShortcutTitle": "Tempo-Kürzel im Eingabefeld",
6880
+ "speedShortcut_off": "Aus",
6881
+ "speedShortcut_icon": "Blitzsymbol",
6882
+ "speedShortcut_hover": "Beim Zeigen",
6883
+ "speedShortcut_label": "Temponame",
6853
6884
  "catalogTimeout": "Die Anfrage für den Modellkatalog hat das Zeitlimit überschritten. Netzwerk oder Proxy prüfen und erneut versuchen.",
6854
6885
  "catalogCachedTimeout": "Der vorhandene Modellkatalog bleibt verfügbar. Die Online-Aktualisierung hat das Zeitlimit überschritten. Netzwerk oder Proxy prüfen und erneut versuchen.",
6855
6886
  "openSubscriptionSettings": "Abo-Einstellungen",
@@ -7798,6 +7829,11 @@ window.__ModuleLoader__.load({
7798
7829
  "imageRemoveAnnotation": "Notiz entfernen"
7799
7830
  },
7800
7831
  ru: {
7832
+ "speedShortcutTitle": "Переключатель скорости в поле ввода",
7833
+ "speedShortcut_off": "Выкл.",
7834
+ "speedShortcut_icon": "Молния",
7835
+ "speedShortcut_hover": "При наведении",
7836
+ "speedShortcut_label": "Название скорости",
7801
7837
  "catalogTimeout": "Время ожидания каталога моделей истекло. Проверьте сеть или прокси и повторите попытку.",
7802
7838
  "catalogCachedTimeout": "Доступный каталог моделей сохранён; время онлайн-обновления истекло. Проверьте сеть или прокси и повторите попытку.",
7803
7839
  "openSubscriptionSettings": "Настройки подписки",
@@ -8746,6 +8782,11 @@ window.__ModuleLoader__.load({
8746
8782
  "imageRemoveAnnotation": "Удалить примечание"
8747
8783
  },
8748
8784
  pt: {
8785
+ "speedShortcutTitle": "Atalho de velocidade no campo de mensagem",
8786
+ "speedShortcut_off": "Desativado",
8787
+ "speedShortcut_icon": "Raio",
8788
+ "speedShortcut_hover": "Ao passar o cursor",
8789
+ "speedShortcut_label": "Nome da velocidade",
8749
8790
  "catalogTimeout": "A solicitação do catálogo de modelos excedeu o tempo limite. Verifique a rede ou o proxy e tente novamente.",
8750
8791
  "catalogCachedTimeout": "O catálogo disponível foi mantido; a atualização online excedeu o tempo limite. Verifique a rede ou o proxy e tente novamente.",
8751
8792
  "openSubscriptionSettings": "Configurações da assinatura",
@@ -9703,7 +9744,10 @@ window.__ModuleLoader__.load({
9703
9744
  .codexModelSelectTrigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3)}
9704
9745
  .codexModelSelectTrigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}
9705
9746
  .codexModelSelectBolt{display:block;flex:none;width:14px;height:14px;color:var(--dsw-alias-label-primary)}
9706
- .codexModelInlineLabel{display:inline-flex;align-items:center;gap:4px;max-width:100%;vertical-align:middle}
9747
+ .codexModelInlineLabel{display:inline}
9748
+ .codexModelInlineLabel>.codexModelSelectBolt{display:inline-block;vertical-align:-2px;margin-inline-end:4px}
9749
+ .codexModelInlineLabel[data-placement=trigger]>.codexModelCatalogBadge{margin-inline-end:4px}
9750
+ .codexModelInlineLabel:not([data-placement=trigger])>.codexModelCatalogBadge{margin-inline-start:4px}
9707
9751
  .codexModelCatalogBadge{font-size:11px;line-height:16px;padding:0 3px;border-radius:4px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}
9708
9752
  .codexModelSelectLabel{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
9709
9753
  .codexModelSelectEffort{flex:none;color:var(--dsw-alias-label-caption)}
@@ -10617,6 +10661,14 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
10617
10661
  "legacy"
10618
10662
  ]);
10619
10663
  const normalizeComposerModelPicker = (value) => COMPOSER_MODEL_PICKER_MODES.includes(value) ? value : "auto";
10664
+ const SPEED_SHORTCUT_FIELD = "speedShortcut";
10665
+ const SPEED_SHORTCUT_STYLES = Object.freeze([
10666
+ "off",
10667
+ "icon",
10668
+ "hover",
10669
+ "label"
10670
+ ]);
10671
+ const normalizeSpeedShortcut = (value) => SPEED_SHORTCUT_STYLES.includes(value) ? value : "off";
10620
10672
  const SPEED_MODE_FIELD = "speedMode";
10621
10673
  const SPEED_MODE_STANDARD = "standard";
10622
10674
  const SPEED_MODE_FAST = "fast";
@@ -10898,6 +10950,11 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
10898
10950
  default: "dsh",
10899
10951
  error: "Invalid fetch provider preference"
10900
10952
  },
10953
+ [SPEED_SHORTCUT_FIELD]: {
10954
+ choices: SPEED_SHORTCUT_STYLES,
10955
+ default: "off",
10956
+ error: "Invalid speed shortcut style"
10957
+ },
10901
10958
  [SPEED_MODE_FIELD]: {
10902
10959
  choices: [
10903
10960
  SPEED_MODE_STANDARD,
@@ -11033,6 +11090,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11033
11090
  fetchProvider: normalizeFetchProvider(value?.[FETCH_PROVIDER_FIELD]),
11034
11091
  fetchRoutingAvailable,
11035
11092
  speedMode: normalizeSpeedMode(value?.[SPEED_MODE_FIELD]),
11093
+ [SPEED_SHORTCUT_FIELD]: normalizeSpeedShortcut(value?.[SPEED_SHORTCUT_FIELD]),
11036
11094
  outputVerbosity: normalizeOutputVerbosity(value?.[OUTPUT_VERBOSITY_FIELD]),
11037
11095
  inputImageDetail: normalizeInputImageDetail(value?.[INPUT_IMAGE_DETAIL_FIELD]),
11038
11096
  reasoningSummary: normalizeReasoningSummary(value?.[REASONING_SUMMARY_FIELD]),
@@ -11100,6 +11158,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11100
11158
  remoteControl: value?.remoteControl === "on" ? "on" : "off",
11101
11159
  composerPredictions: value?.composerPredictions === "on" ? "on" : "off",
11102
11160
  composerModelPicker: normalizeComposerModelPicker(value?.composerModelPicker),
11161
+ [SPEED_SHORTCUT_FIELD]: normalizeSpeedShortcut(value?.[SPEED_SHORTCUT_FIELD]),
11103
11162
  otherModels: value?.otherModels === "off" ? "off" : "on",
11104
11163
  otherModels: value?.otherModels === "off" ? "off" : "on",
11105
11164
  compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
@@ -11559,7 +11618,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11559
11618
  /** @returns {{kind:'reset'}|{kind:'range',min:number,max:number}|{kind:'point',seconds:number}|undefined} rounded seconds. */
11560
11619
  function forecastRunway(forecast) {
11561
11620
  if (forecast?.status !== "ready") return void 0;
11562
- if (forecast.survivesReset && !forecast.provisional) return { kind: "reset" };
11621
+ if ((forecast.survivesReset === "yes" || forecast.survivesReset === true) && !forecast.provisional) return { kind: "reset" };
11563
11622
  if (!forecast.provisional && Number.isFinite(forecast.runwayMinSeconds) && Number.isFinite(forecast.runwayMaxSeconds)) {
11564
11623
  const min = roundRunwaySeconds(forecast.runwayMinSeconds), max = roundRunwaySeconds(forecast.runwayMaxSeconds);
11565
11624
  if (min > 0 && max > min) return {
@@ -11589,9 +11648,12 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11589
11648
  })) return { kind: "stale" };
11590
11649
  if (remainingPercent === 0) return { kind: "exhausted" };
11591
11650
  if (forecast?.status === "calibrating") return { kind: forecast.reason ?? "calibrating" };
11592
- if (forecast?.status === "idle") return { kind: "idle" };
11651
+ if (forecast?.status === "flat" || forecast?.status === "idle") return {
11652
+ kind: "idle",
11653
+ upperPacePerHour: forecast.upperPacePerHour
11654
+ };
11593
11655
  if (!Number.isFinite(fetchedAt)) return { kind: "calibrating" };
11594
- if (forecast?.status === "ready" && !forecast.provisional && Number.isFinite(forecast.runwayMinSeconds) && forecast.runwayMinSeconds > 0 && Number.isFinite(resetsAt) && fetchedAt + forecast.runwayMinSeconds * 1e3 >= resetsAt * 1e3) return { kind: "reset" };
11656
+ if (forecast?.status === "ready" && !forecast.provisional && (typeof forecast.survivesReset !== "string" || forecast.survivesReset === "yes") && Number.isFinite(forecast.runwayMinSeconds) && forecast.runwayMinSeconds > 0 && Number.isFinite(resetsAt) && fetchedAt + forecast.runwayMinSeconds * 1e3 >= resetsAt * 1e3) return { kind: "reset" };
11595
11657
  const rawMin = !forecast?.provisional && Number.isFinite(forecast?.runwayMinSeconds) ? forecast.runwayMinSeconds : forecast?.runwaySeconds;
11596
11658
  if (Number.isFinite(rawMin) && fetchedAt + rawMin * 1e3 <= now) return { kind: "stale" };
11597
11659
  const runway = forecastRunway({
@@ -11779,7 +11841,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11779
11841
  }
11780
11842
  //#endregion
11781
11843
  //#region src/version.js
11782
- const PACKAGE_VERSION = "3.2.20";
11844
+ const PACKAGE_VERSION = "3.2.22";
11783
11845
  //#endregion
11784
11846
  //#region src/client-recovery.js
11785
11847
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = endpoint === "usage" || endpoint.startsWith("usage/") ? 3e4 : 1e4) {
@@ -12162,6 +12224,86 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12162
12224
  }));
12163
12225
  }
12164
12226
  const ForwardRef = /*#__PURE__*/ react.forwardRef(BoltIcon);
12227
+ //#endregion
12228
+ //#region src/client-speed-shortcut.jsx
12229
+ const labels = {
12230
+ standard: "speedStandard",
12231
+ fast: "speedFast",
12232
+ ultrafast: "speedUltrafast"
12233
+ };
12234
+ function CodexSpeedShortcut({ directory, preference, t, locked }) {
12235
+ const { current } = (0, react.useSyncExternalStore)(directory.subscribe, directory.getSnapshot);
12236
+ const status = usePreferenceSnapshot(preference);
12237
+ const mode = status[SPEED_SHORTCUT_FIELD];
12238
+ const modelId = current?.model;
12239
+ const supportsFast = status.fastModels?.includes(modelId) ?? supportsCodexFastMode(modelId);
12240
+ if (mode === "off" || current?.provider !== "openai-codex" || !supportsFast || status.status !== "ready") return null;
12241
+ const speed = effectiveCodexSpeedMode(status.speedMode, modelId, {
12242
+ supportsFast,
12243
+ supportsUltrafast: status.ultrafastModels?.includes(modelId)
12244
+ });
12245
+ const next = speed === "standard" ? SPEED_MODE_FAST : SPEED_MODE_STANDARD;
12246
+ const label = t(labels[speed]);
12247
+ const hint = `${t("speedTitle")} · ${label} → ${t(labels[next])}${next === "fast" ? ` · ${t("speedFastHint")}` : ""}`;
12248
+ const toggle = () => {
12249
+ const selected = directory.getSnapshot().current;
12250
+ const saved = preference.getSnapshot();
12251
+ if (selected?.provider !== current.provider || selected?.model !== modelId || saved.speedMode !== status.speedMode || saved.saving || !saved.writable) return;
12252
+ preference.set({ [SPEED_MODE_FIELD]: next });
12253
+ };
12254
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12255
+ className: "codexSpeedShortcutSeat",
12256
+ "data-layout": mode,
12257
+ "data-speed": speed,
12258
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12259
+ type: "button",
12260
+ className: "codexSpeedShortcut",
12261
+ "data-speed": speed,
12262
+ title: hint,
12263
+ "aria-label": hint,
12264
+ "aria-pressed": speed !== SPEED_MODE_STANDARD,
12265
+ disabled: locked || status.saving || !status.writable,
12266
+ onClick: toggle,
12267
+ children: mode === "label" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12268
+ className: "codexSpeedShortcutBolt",
12269
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, { "aria-hidden": "true" })
12270
+ })
12271
+ })
12272
+ });
12273
+ }
12274
+ const SPEED_SHORTCUT_CSS = `
12275
+ .codexSpeedShortcutSeat{display:inline-flex;align-items:center;flex:none}
12276
+ .codexSpeedShortcut{display:inline-flex;align-items:center;justify-content:center;min-width:25px;min-height:27px;padding:2px 5px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,CanvasText);font:inherit;font-size:12px;line-height:1.2;white-space:nowrap;cursor:pointer}
12277
+ .codexSpeedShortcutBolt{display:grid;place-items:center}
12278
+ .codexSpeedShortcut svg{width:14px;height:14px;display:block}
12279
+ .codexSpeedShortcut[data-speed=standard] svg{fill:none;stroke:currentColor;stroke-width:.9}
12280
+ .codexSpeedShortcut:not([data-speed=standard]){color:var(--dsw-alias-label-primary,CanvasText)}
12281
+ .codexSpeedShortcut:hover:not(:disabled){background:color-mix(in srgb,currentColor 10%,transparent)}
12282
+ .codexSpeedShortcut:focus-visible{outline:2px solid currentColor;outline-offset:1px}
12283
+ .codexSpeedShortcut:disabled{cursor:default;opacity:.5}
12284
+
12285
+ [data-slot="conversation.input.right"]:has(.codexSpeedShortcutSeat:is([data-layout=icon],[data-layout=hover])){display:flex;align-items:center}
12286
+ div:has(>[data-slot="conversation.input.right"]>.codexSpeedShortcutSeat:is([data-layout=icon],[data-layout=hover])):has(>[data-slot="conversation.input.model"]){column-gap:0}
12287
+
12288
+ @media(hover:hover) and (pointer:fine){
12289
+ [data-slot="conversation.input.right"]:has(+[data-slot="conversation.input.model"])>.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]{position:relative;width:0}
12290
+ [data-slot="conversation.input.right"]:has(+[data-slot="conversation.input.model"])>.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]>.codexSpeedShortcut{
12291
+ position:absolute;inset-inline-end:0;opacity:0;visibility:hidden;background:var(--dsw-alias-bg-layer-1,Canvas);
12292
+ transition:opacity 150ms,visibility 0s 150ms
12293
+ }
12294
+ div:has(>[data-slot="conversation.input.right"]>.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]):has(>[data-slot="conversation.input.model"]:is(:hover,:focus-within)) .codexSpeedShortcut,
12295
+ .codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]:is(:hover,:focus-within)>.codexSpeedShortcut{opacity:1;visibility:visible;transition:none}
12296
+ }
12297
+
12298
+ /* Keep the labelled shortcut next to the native model trigger. */
12299
+ div:has(>[data-slot="conversation.input.right"]>.codexSpeedShortcutSeat[data-layout=label]):has(>[data-slot="conversation.input.model"]){column-gap:0}
12300
+ [data-slot="conversation.input.right"]:has(>.codexSpeedShortcutSeat[data-layout=label]):has(+[data-slot="conversation.input.model"]){display:contents}
12301
+ div:has(>[data-slot="conversation.input.right"]>.codexSpeedShortcutSeat[data-layout=label])>[data-slot="conversation.input.model"]{order:1}
12302
+ .codexSpeedShortcutSeat[data-layout=label]{order:2}
12303
+ .codexSpeedShortcutSeat[data-layout=label]>.codexSpeedShortcut{padding-inline:7px}
12304
+ .codexSpeedShortcutSeat[data-layout=label]>.codexSpeedShortcut:not([data-speed=standard]){font-weight:600}
12305
+
12306
+ `;
12165
12307
  //#endregion
12166
12308
  //#region src/client-model-select.jsx
12167
12309
  function createModelOptionsMenu() {
@@ -12190,10 +12332,14 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12190
12332
  "data-tone": model.badge.tone,
12191
12333
  children: resolveText(model.badge.text)
12192
12334
  });
12335
+ const shortcutShown = snapshot.speedShortcut && snapshot.speedShortcut !== "off" && (snapshot.fastModels?.includes(model.id) ?? supportsCodexFastMode(model.id));
12336
+ const bolt = placement === "trigger" && selected && speed !== "standard" && !shortcutShown;
12337
+ if (!badge && !bolt) return model.name;
12193
12338
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12194
12339
  className: "codexModelInlineLabel",
12340
+ "data-placement": placement,
12195
12341
  children: [
12196
- placement === "trigger" && selected && speed !== "standard" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, {
12342
+ bolt && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, {
12197
12343
  className: "codexModelSelectBolt",
12198
12344
  "aria-label": t(speed === "ultrafast" ? "speedUltrafast" : "speedFast")
12199
12345
  }),
@@ -12376,11 +12522,12 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12376
12522
  }, item.id))
12377
12523
  });
12378
12524
  }
12379
- function CodexModelSelect({ locked, available, directory, load, select, preference, t }) {
12525
+ function CodexModelSelect({ locked, available, directory, load, select, preference, t, openPickerTrace }) {
12380
12526
  const state = (0, react.useSyncExternalStore)(directory.subscribe, directory.getSnapshot);
12381
12527
  const preferenceSnapshot = usePreferenceSnapshot(preference);
12382
12528
  const [open, setOpen] = (0, react.useState)(false);
12383
12529
  const [pane, setPane] = (0, react.useState)("root");
12530
+ const trace = (0, react.useRef)(null);
12384
12531
  const [query, setQuery] = (0, react.useState)("");
12385
12532
  const menuRef = (0, react.useRef)(null);
12386
12533
  const triggerRef = (0, react.useRef)(null);
@@ -12480,6 +12627,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12480
12627
  verbositySupported
12481
12628
  ]);
12482
12629
  const close = (restoreFocus = false) => {
12630
+ trace.current?.("closed");
12631
+ trace.current = null;
12483
12632
  setOpen(false);
12484
12633
  setPane("root");
12485
12634
  setQuery("");
@@ -12499,11 +12648,13 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12499
12648
  if (accepted) close(true);
12500
12649
  };
12501
12650
  const chooseModel = (selection) => {
12651
+ trace.current?.("activated");
12502
12652
  if (state.current?.provider === selection.provider && state.current.model === selection.model) {
12653
+ trace.current?.("already-selected");
12503
12654
  close(true);
12504
12655
  return;
12505
12656
  }
12506
- select(selection).then(settleSelection);
12657
+ select(selection, trace.current).then(settleSelection);
12507
12658
  };
12508
12659
  const chooseEffort = (effort) => {
12509
12660
  if (state.current === null) return;
@@ -12525,12 +12676,13 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12525
12676
  close(true);
12526
12677
  preference.set({ [OUTPUT_VERBOSITY_FIELD]: outputVerbosity });
12527
12678
  };
12528
- const option = ({ key, label, description, selected, disabled, onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12679
+ const option = ({ key, label, description, selected, disabled, onClick, onPointerDown }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12529
12680
  type: "button",
12530
12681
  role: "menuitemradio",
12531
12682
  "aria-checked": selected,
12532
12683
  className: "codexModelSelectOption",
12533
12684
  disabled,
12685
+ onPointerDown,
12534
12686
  onClick,
12535
12687
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12536
12688
  className: "codexModelSelectOptionCopy",
@@ -12551,6 +12703,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12551
12703
  role: "menuitem",
12552
12704
  className: "codexModelSelectCell",
12553
12705
  onClick: () => {
12706
+ if (target === "model") trace.current?.("model-list");
12554
12707
  setQuery("");
12555
12708
  setPane(target);
12556
12709
  },
@@ -12627,6 +12780,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12627
12780
  label: model.name,
12628
12781
  selected: state.current?.provider === entry.id && state.current.model === model.id,
12629
12782
  disabled: busy,
12783
+ onPointerDown: () => trace.current?.("pointer-down"),
12630
12784
  onClick: () => chooseModel({
12631
12785
  provider: entry.id,
12632
12786
  model: model.id
@@ -12699,6 +12853,9 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12699
12853
  role: pane === "model" ? "group" : "menu",
12700
12854
  "aria-label": t("modelMenuAria"),
12701
12855
  "aria-busy": state.status === "loading" || busy,
12856
+ onMouseDown: (event) => {
12857
+ if (pane === "model" && event.button === 0 && event.target.closest?.("button[role=\"menuitemradio\"]") && event.currentTarget.ownerDocument.activeElement?.getAttribute("role") === "searchbox") event.preventDefault();
12858
+ },
12702
12859
  onKeyDown: (event) => {
12703
12860
  if (event.key !== "Escape") return;
12704
12861
  event.preventDefault();
@@ -12726,9 +12883,18 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12726
12883
  "aria-controls": open ? `${id}-menu` : void 0,
12727
12884
  title: fast ? `${modelLabel} · ${t(speedKey)}` : modelLabel,
12728
12885
  disabled: locked,
12729
- onClick: () => open ? close() : (setPane("root"), setOpen(true), load()),
12886
+ onClick: () => {
12887
+ if (open) {
12888
+ close();
12889
+ return;
12890
+ }
12891
+ trace.current = openPickerTrace?.();
12892
+ setPane("root");
12893
+ setOpen(true);
12894
+ load();
12895
+ },
12730
12896
  children: [
12731
- fast && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, {
12897
+ fast && (!preferenceSnapshot.speedShortcut || preferenceSnapshot.speedShortcut === "off" || !speedSupported) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, {
12732
12898
  className: "codexModelSelectBolt",
12733
12899
  "aria-hidden": "true"
12734
12900
  }),
@@ -17359,6 +17525,7 @@ void main(){
17359
17525
  error: report.error
17360
17526
  } : {},
17361
17527
  ...!report.client?.topology?.length ? { clientDiagnostics: "unavailable" } : {},
17528
+ ...report.client?.incidents && Object.keys(report.client.incidents).length ? { clientIncidents: report.client.incidents } : {},
17362
17529
  account: report.account?.status,
17363
17530
  catalog: report.catalog,
17364
17531
  configuration,
@@ -18662,29 +18829,47 @@ void main(){
18662
18829
  className: "codexComposerMenuGroup",
18663
18830
  role: "group",
18664
18831
  "aria-label": t("legacyModelPicker"),
18665
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18666
- className: "codexSubscriptionPreference",
18667
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18668
- className: "codexSubscriptionPreferenceCopy",
18669
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, {
18670
- description: t("legacyModelPickerHint"),
18671
- children: t("legacyModelPicker")
18672
- }), loaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Hint, { children: t(customMenu ? "composerMenuCustom" : "composerMenuHost") }) : null]
18673
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radios, {
18832
+ children: [
18833
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18834
+ className: "codexSubscriptionPreference",
18835
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18836
+ className: "codexSubscriptionPreferenceCopy",
18837
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, {
18838
+ description: t("legacyModelPickerHint"),
18839
+ children: t("legacyModelPicker")
18840
+ }), loaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Hint, { children: t(customMenu ? "composerMenuCustom" : "composerMenuHost") }) : null]
18841
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radios, {
18842
+ snapshot,
18843
+ preference,
18844
+ field: "composerModelPicker",
18845
+ values: COMPOSER_MODEL_PICKER_MODES,
18846
+ name: "codex-model-picker",
18847
+ label: t("legacyModelPicker"),
18848
+ text: (value) => t(menuLabels[value]),
18849
+ disabled: !loaded || snapshot.saving
18850
+ })]
18851
+ }),
18852
+ loaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpeedPreference, {
18674
18853
  snapshot,
18675
18854
  preference,
18676
- field: "composerModelPicker",
18677
- values: COMPOSER_MODEL_PICKER_MODES,
18678
- name: "codex-model-picker",
18679
- label: t("legacyModelPicker"),
18680
- text: (value) => t(menuLabels[value]),
18681
- disabled: !loaded || snapshot.saving
18682
- })]
18683
- }), loaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpeedPreference, {
18684
- snapshot,
18685
- preference,
18686
- t
18687
- }) : null]
18855
+ t
18856
+ }) : null,
18857
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
18858
+ className: "codexSubscriptionPreference",
18859
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
18860
+ className: "codexSubscriptionPreferenceCopy",
18861
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, { children: t("speedShortcutTitle") })
18862
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radios, {
18863
+ snapshot,
18864
+ preference,
18865
+ field: SPEED_SHORTCUT_FIELD,
18866
+ values: SPEED_SHORTCUT_STYLES,
18867
+ name: "codex-speed-shortcut",
18868
+ label: t("speedShortcutTitle"),
18869
+ text: (value) => t(`speedShortcut_${value}`)
18870
+ })]
18871
+ })
18872
+ ]
18688
18873
  }),
18689
18874
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PickerModelsPreference, {
18690
18875
  preference,
@@ -20937,6 +21122,141 @@ void main(){
20937
21122
  return typeof navigation?.openBundle === "function" ? () => navigation.openBundle(name) : void 0;
20938
21123
  }
20939
21124
  //#endregion
21125
+ //#region src/client-incident-diagnostics.js
21126
+ const knownCodes = /* @__PURE__ */ new Set([
21127
+ "unavailable",
21128
+ "invalid-input",
21129
+ "not-found",
21130
+ "internal",
21131
+ "operation-error",
21132
+ "timeout"
21133
+ ]);
21134
+ const pickerStages = /* @__PURE__ */ new Set([
21135
+ "opened",
21136
+ "model-list",
21137
+ "pointer-down",
21138
+ "activated",
21139
+ "already-selected",
21140
+ "submitted",
21141
+ "rejected",
21142
+ "threw",
21143
+ "matched-at-return",
21144
+ "different-at-return",
21145
+ "readback-unavailable",
21146
+ "closed"
21147
+ ]);
21148
+ function createClientIncidentDiagnostics(now = Date.now) {
21149
+ const failures = /* @__PURE__ */ new Map();
21150
+ const pending = /* @__PURE__ */ new Set();
21151
+ const modelPicker = [];
21152
+ let activeCount = 0;
21153
+ let menuId = 0;
21154
+ let pickerTruncated = false;
21155
+ return {
21156
+ openPicker() {
21157
+ const id = ++menuId;
21158
+ const record = (stage) => {
21159
+ if (!pickerStages.has(stage)) return;
21160
+ modelPicker.push({
21161
+ id,
21162
+ stage,
21163
+ at: now()
21164
+ });
21165
+ if (modelPicker.length > 32) {
21166
+ modelPicker.shift();
21167
+ pickerTruncated = true;
21168
+ }
21169
+ };
21170
+ record("opened");
21171
+ return record;
21172
+ },
21173
+ async observeRpc(endpoint, run, signal) {
21174
+ if (!RPC_ENDPOINTS.includes(endpoint) || endpoint === "diagnostics") return run();
21175
+ const start = now();
21176
+ const entry = {
21177
+ endpoint,
21178
+ start
21179
+ };
21180
+ activeCount++;
21181
+ if (pending.size < 32) pending.add(entry);
21182
+ let active = true;
21183
+ const finish = () => {
21184
+ if (active) {
21185
+ active = false;
21186
+ activeCount--;
21187
+ pending.delete(entry);
21188
+ }
21189
+ };
21190
+ const fail = (kind, code) => failures.set(endpoint, {
21191
+ endpoint,
21192
+ kind,
21193
+ at: now(),
21194
+ durationMs: Math.max(0, now() - start),
21195
+ ...knownCodes.has(code) ? { code } : {}
21196
+ });
21197
+ const aborted = () => {
21198
+ finish();
21199
+ if (signal.reason?.code === "timeout" || signal.reason?.name === "TimeoutError") fail("timeout");
21200
+ };
21201
+ if (signal?.aborted) aborted();
21202
+ else signal?.addEventListener("abort", aborted, { once: true });
21203
+ try {
21204
+ const result = await run();
21205
+ if (!signal?.aborted) if (result?.ok !== true) fail(result?.ok === false ? "rpc-rejected" : "invalid-response", result?.error?.code);
21206
+ else {
21207
+ const last = failures.get(endpoint);
21208
+ if (last && last.nextSuccessAt === void 0) last.nextSuccessAt = now();
21209
+ }
21210
+ return result;
21211
+ } catch (error) {
21212
+ if (!signal?.aborted) fail("transport-threw", error?.code);
21213
+ throw error;
21214
+ } finally {
21215
+ signal?.removeEventListener("abort", aborted);
21216
+ finish();
21217
+ }
21218
+ },
21219
+ snapshot() {
21220
+ const at = now();
21221
+ const active = Array.from(pending).slice(0, 32);
21222
+ return {
21223
+ ...failures.size ? { rpcFailures: Array.from(failures.values(), (value) => ({ ...value })) } : {},
21224
+ ...active.length ? { inFlight: active.map(({ endpoint, start }) => ({
21225
+ endpoint,
21226
+ ageMs: Math.max(0, at - start)
21227
+ })) } : {},
21228
+ ...modelPicker.length ? { modelPicker: modelPicker.slice() } : {},
21229
+ ...pickerTruncated || activeCount > active.length ? { truncated: true } : {}
21230
+ };
21231
+ }
21232
+ };
21233
+ }
21234
+ async function selectWithDiagnostics(directory, selection, record) {
21235
+ record?.("submitted");
21236
+ let result;
21237
+ try {
21238
+ result = await directory.select(selection);
21239
+ } catch {
21240
+ record?.("threw");
21241
+ return false;
21242
+ }
21243
+ if (result?.ok === false) {
21244
+ record?.("rejected");
21245
+ return false;
21246
+ }
21247
+ if (record) {
21248
+ let current;
21249
+ try {
21250
+ current = directory.store.getSnapshot().current;
21251
+ } catch {
21252
+ record("readback-unavailable");
21253
+ return true;
21254
+ }
21255
+ record(current?.provider === selection.provider && current?.model === selection.model && (selection.reasoningEffort === void 0 || current?.reasoningEffort === selection.reasoningEffort) ? "matched-at-return" : "different-at-return");
21256
+ }
21257
+ return true;
21258
+ }
21259
+ //#endregion
20940
21260
  //#region src/diagnostic-checks.js
20941
21261
  const states = /* @__PURE__ */ new Set([
20942
21262
  "pass",
@@ -21043,7 +21363,7 @@ void main(){
21043
21363
  };
21044
21364
  });
21045
21365
  }
21046
- function createHostDiagnostics() {
21366
+ function createHostDiagnostics(incidents) {
21047
21367
  const scopes = /* @__PURE__ */ new Map();
21048
21368
  let sequence = 0;
21049
21369
  return {
@@ -21088,6 +21408,7 @@ void main(){
21088
21408
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
21089
21409
  checks,
21090
21410
  topology,
21411
+ incidents: incidents?.snapshot(),
21091
21412
  truncated: scopes.size > active.length,
21092
21413
  interpretation: "host-selection-not-visual-or-execution-proof"
21093
21414
  };
@@ -21636,7 +21957,11 @@ void main(){
21636
21957
  "uiConversation",
21637
21958
  "sessions"
21638
21959
  ];
21639
- const ComposerRight = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexComposerQuota, { ...props }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceCallButton, { ...props })] });
21960
+ const ComposerRight = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
21961
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexComposerQuota, { ...props }),
21962
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceCallButton, { ...props }),
21963
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexSpeedShortcut, { ...props })
21964
+ ] });
21640
21965
  function apply(ctx) {
21641
21966
  if (new URL(window.location.href).searchParams.has("codexVoiceSession")) ctx.inject(["uiWorkspace", "sessions"], (scope) => scope.effect(() => {
21642
21967
  const sessions = scope.get("sessions"), controller = new AbortController();
@@ -21659,18 +21984,19 @@ void main(){
21659
21984
  unsubscribe();
21660
21985
  };
21661
21986
  }, "codex-subscription: browser voice conversation"));
21662
- const diagnostics = createHostDiagnostics();
21987
+ const incidents = createClientIncidentDiagnostics();
21988
+ const diagnostics = createHostDiagnostics(incidents);
21663
21989
  ctx.effect(() => diagnostics.register(ctx.slots), "codex-subscription: host inspection");
21664
21990
  const imageViewer = new SubscriptionImageViewerService();
21665
21991
  ctx.effect(() => ctx.locale.register(NS, dictionaries), "codex-subscription: copy");
21666
21992
  ctx.effect(() => {
21667
21993
  const tag = document.createElement("style");
21668
21994
  tag.dataset.plugin = "dsh-codex-subscription";
21669
- tag.textContent = STYLE + IMAGE_PREVIEWS_CSS + PREDICTION_CSS;
21995
+ tag.textContent = STYLE + IMAGE_PREVIEWS_CSS + PREDICTION_CSS + SPEED_SHORTCUT_CSS;
21670
21996
  document.head.append(tag);
21671
21997
  return () => tag.remove();
21672
21998
  }, "codex-subscription: style");
21673
- const rpc = createSubscriptionRpcClient(ctx.get("connection").rpc);
21999
+ const rpc = createSubscriptionRpcClient(ctx.get("connection").rpc, incidents);
21674
22000
  const preference = createPreferenceController(rpc);
21675
22001
  const quotaUsage = quotaUsageController(rpc);
21676
22002
  ctx.effect(() => {
@@ -21784,14 +22110,8 @@ void main(){
21784
22110
  load: () => {
21785
22111
  if (available) directory.load().catch(() => {});
21786
22112
  },
21787
- select: async (selection) => {
21788
- if (!available) return false;
21789
- try {
21790
- return (await directory.select(selection))?.ok !== false;
21791
- } catch {
21792
- return false;
21793
- }
21794
- }
22113
+ openPickerTrace: incidents.openPicker,
22114
+ select: async (selection, trace) => available && selectWithDiagnostics(directory, selection, trace)
21795
22115
  };
21796
22116
  }, CodexModelSelect, CodexNativeModelOptions, CodexModelLabel, () => watchComposerModelPickerConflict(scope.get("remote.pluginManager"), scope.get("remote"), preference.setComposerModelPickerConflict, (refresh) => scope.on("connection/reset", refresh)));
21797
22117
  };