dsh-codex-subscription 3.1.8 → 3.1.9

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
@@ -1261,6 +1261,11 @@ window.__ModuleLoader__.load({
1261
1261
  "voice/interrupt",
1262
1262
  "voice/preview",
1263
1263
  "voice/catalog",
1264
+ "voice/native/probe",
1265
+ "voice/native/start",
1266
+ "voice/native/status",
1267
+ "voice/native/control",
1268
+ "voice/native/stop",
1264
1269
  "remote/status",
1265
1270
  "remote/enable",
1266
1271
  "remote/disable",
@@ -7147,6 +7152,7 @@ window.__ModuleLoader__.load({
7147
7152
  //#endregion
7148
7153
  //#region src/client-locales.js
7149
7154
  const zh = {
7155
+ voiceNativeCaptureConfirm: "允许本次通话使用此电脑的麦克风和扬声器?挂断或离开会话后会停止收音。",
7150
7156
  voiceMediaHint: "窗口不支持 WebRTC 时,可在浏览器中继续同一会话。音色试听不受影响,仍使用当前订阅,无需 API Key。",
7151
7157
  voiceBrowserContinue: "在浏览器继续此会话",
7152
7158
  voiceBrowserCall: "在浏览器继续语音通话",
@@ -7291,6 +7297,8 @@ window.__ModuleLoader__.load({
7291
7297
  connectors_write: "直接写入",
7292
7298
  defaultReasoningEffort: "默认推理等级",
7293
7299
  defaultReasoningEffortHint: "未手动选档时使用;模型不支持时跟随该模型默认值。",
7300
+ defaultUltraHint: "Ultra 是 DSH 主动分工预设,使用模型目录指定的实际推理档,不扩大权限;仅支持的模型显示。",
7301
+ defaultReasoningEffort_ultra: "Ultra(主动分工)",
7294
7302
  defaultReasoningEffort_auto: "模型默认",
7295
7303
  defaultReasoningEffort_off: "关闭推理",
7296
7304
  defaultReasoningEffort_minimal: "极低",
@@ -7733,8 +7741,6 @@ window.__ModuleLoader__.load({
7733
7741
  settingsRestartRequired: "设置已保存,重启 DSH 后生效。",
7734
7742
  historyTitle: "额度去向",
7735
7743
  historyLoading: "正在读取用量历史…",
7736
- historyUnavailable: "当前账户没有提供用量历史。",
7737
- historyEmpty: "还没有已统计完成的额度周期。官方统计有延迟,过一两天再看。",
7738
7744
  historyPeriods: "额度周期",
7739
7745
  historyUsed: "这个周期已用 {value}% 的额度",
7740
7746
  historyPartial: "(统计尚未完成)",
@@ -7881,9 +7887,6 @@ window.__ModuleLoader__.load({
7881
7887
  diagnosticsNotes: "{count} 条提示信息",
7882
7888
  diagnosticsAdvanced: "完整诊断(高级)",
7883
7889
  historyAsOf: "数据截至 {date}",
7884
- historyPending: "还在统计中",
7885
- historyPendingCurrent: "官方尚未提供这一周期的统计结果,稍后可刷新查看。",
7886
- historyPendingPast: "官方尚未统计出这一周期的用量;报告数据截至 {date},稍后可刷新查看。",
7887
7890
  triggerSketchName: "草图 · Beta",
7888
7891
  triggerSketchHint: "让 Agent 画图或改图",
7889
7892
  triggerImageName: "生图",
@@ -7965,8 +7968,8 @@ window.__ModuleLoader__.load({
7965
7968
  quotaWhenRange: "{from}至{to}",
7966
7969
  quotaWhenEarlyMorningRange: "{from}至{to}",
7967
7970
  historyRefresh: "刷新",
7971
+ historyTotalUnavailable: "官方未提供此周期的总用量",
7968
7972
  historyNoBreakdown: "官方尚未提供此周期的明细",
7969
- historyPendingPastUnknown: "官方尚未统计出此周期用量",
7970
7973
  fetchTitle: "网页读取来源",
7971
7974
  fetchDshHint: "使用 DSH 当前配置的网页读取服务;与上面的搜索来源分别设置。",
7972
7975
  fetchCodexHint: "通过 Codex 订阅读取可访问的网页文本。失败会直接提示,不会转到 DeepSeek API。",
@@ -8042,6 +8045,7 @@ window.__ModuleLoader__.load({
8042
8045
  imageRemoveAnnotation: "删除标注"
8043
8046
  };
8044
8047
  const en = {
8048
+ voiceNativeCaptureConfirm: "Use this computer’s microphone and speakers for this call? Capture stops when you hang up or leave the conversation.",
8045
8049
  voiceMediaHint: "If this window does not support WebRTC, continue the same conversation in a browser. Voice samples remain available. Your existing subscription is used; no API key is needed.",
8046
8050
  voiceBrowserContinue: "Continue this conversation in a browser",
8047
8051
  voiceBrowserCall: "Continue voice in a browser",
@@ -8186,6 +8190,8 @@ window.__ModuleLoader__.load({
8186
8190
  connectors_write: "Write directly",
8187
8191
  defaultReasoningEffort: "Default reasoning effort",
8188
8192
  defaultReasoningEffortHint: "Used when no effort is selected manually. Unsupported levels fall back to the model default.",
8193
+ defaultUltraHint: "Ultra is a DSH proactive delegation preset using the catalog-resolved model effort. It grants no additional permissions and appears only for supported models.",
8194
+ defaultReasoningEffort_ultra: "Ultra (proactive delegation)",
8189
8195
  defaultReasoningEffort_auto: "Model default",
8190
8196
  defaultReasoningEffort_off: "Off",
8191
8197
  defaultReasoningEffort_minimal: "Minimal",
@@ -8628,8 +8634,6 @@ window.__ModuleLoader__.load({
8628
8634
  settingsRestartRequired: "Saved. Restart DSH to apply it.",
8629
8635
  historyTitle: "Where the allowance went",
8630
8636
  historyLoading: "Reading usage history…",
8631
- historyUnavailable: "This account does not provide a usage history.",
8632
- historyEmpty: "No allowance period has been counted yet. The official report lags; check again in a day or two.",
8633
8637
  historyPeriods: "Allowance periods",
8634
8638
  historyUsed: "{value}% of this period's allowance used",
8635
8639
  historyPartial: "(still being counted)",
@@ -8776,9 +8780,6 @@ window.__ModuleLoader__.load({
8776
8780
  diagnosticsNotes: "{count} note(s)",
8777
8781
  diagnosticsAdvanced: "Full report (advanced)",
8778
8782
  historyAsOf: "Data as of {date}",
8779
- historyPending: "Still being counted",
8780
- historyPendingCurrent: "The official report has not provided figures for this period yet. Refresh later to check.",
8781
- historyPendingPast: "The official report has not counted this period yet. Data is as of {date}; refresh later to check.",
8782
8783
  triggerSketchName: "Sketch · Beta",
8783
8784
  triggerSketchHint: "Ask the Agent to draw or edit a sketch",
8784
8785
  triggerImageName: "Image",
@@ -8860,8 +8861,8 @@ window.__ModuleLoader__.load({
8860
8861
  quotaWhenRange: "{from}–{to}",
8861
8862
  quotaWhenEarlyMorningRange: "{latest}",
8862
8863
  historyRefresh: "Refresh",
8864
+ historyTotalUnavailable: "Official total usage is unavailable for this period",
8863
8865
  historyNoBreakdown: "Official breakdown not yet available for this period",
8864
- historyPendingPastUnknown: "Official usage for this period is not available yet",
8865
8866
  fetchTitle: "Webpage reading source",
8866
8867
  fetchDshHint: "Use the webpage reader configured in DSH, independently of the search source above.",
8867
8868
  fetchCodexHint: "Read accessible webpage text with your Codex subscription. Failures are reported directly, without falling back to the DeepSeek API.",
@@ -9383,7 +9384,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
9383
9384
  .codexFlat .codexSubscriptionResetBox{border:0;border-radius:0;padding:0}
9384
9385
  .codexFlat :is(button,summary,a):focus-visible,.codexFlat label:has(:focus-visible){outline:2px solid var(--dsw-alias-border-inverted);outline-offset:2px;box-shadow:none}
9385
9386
  .codexSettingsTabs{position:sticky;top:0;z-index:2;background:var(--dsw-alias-bg-layer-1);border-radius:0;padding:6px 0 0;margin-top:-6px;gap:18px;display:flex;overflow-x:auto;scrollbar-width:none;grid-template-columns:none;border-bottom:1px solid var(--dsw-alias-border-l2);margin-bottom:8px}
9386
- .codexSettingsTabs button{min-height:34px;padding:0 2px;border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;font-size:14px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
9387
+ .codexSettingsTabs button{flex:none;min-height:34px;padding:0 2px;border-radius:0;border-bottom:2px solid transparent;margin-bottom:-1px;font-size:14px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
9387
9388
  .codexSettingsTabs button[aria-selected=true]{background:transparent;box-shadow:none;color:var(--dsw-alias-label-primary);border-bottom-color:var(--dsw-alias-label-primary)}
9388
9389
  .codexSubscriptionNotices{display:flex;flex-direction:column;gap:6px;margin:0 0 8px}
9389
9390
  .codexSubscriptionNotices p{margin:0;padding:8px 12px;border-radius:10px;background:var(--dsw-alias-bg-module-platform)}
@@ -10836,7 +10837,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
10836
10837
  "medium",
10837
10838
  "high",
10838
10839
  "xhigh",
10839
- "max"
10840
+ "max",
10841
+ "ultra"
10840
10842
  ]);
10841
10843
  const DEFAULT_REASONING_EFFORT = "auto";
10842
10844
  const normalizeDefaultReasoningEffort = (value) => DEFAULT_REASONING_EFFORTS.includes(value) ? value : DEFAULT_REASONING_EFFORT;
@@ -11111,6 +11113,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11111
11113
  let verbosityModels = [];
11112
11114
  let fastModels;
11113
11115
  let ultrafastModels = [];
11116
+ let ultraModels = [];
11114
11117
  let catalogStatus;
11115
11118
  let modelsLoading = false;
11116
11119
  let modelError = false;
@@ -11169,6 +11172,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11169
11172
  verbosityModels,
11170
11173
  fastModels,
11171
11174
  ultrafastModels,
11175
+ ultraModels,
11172
11176
  catalogStatus,
11173
11177
  modelsLoading,
11174
11178
  modelError,
@@ -11196,6 +11200,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11196
11200
  verbosityModels = Array.isArray(value?.verbosityModels) ? value.verbosityModels : [];
11197
11201
  fastModels = Array.isArray(value?.fastModels) ? value.fastModels : void 0;
11198
11202
  ultrafastModels = Array.isArray(value?.ultrafastModels) ? value.ultrafastModels : [];
11203
+ ultraModels = Array.isArray(value?.ultraModels) ? value.ultraModels : [];
11199
11204
  catalogStatus = value?.catalogStatus;
11200
11205
  }
11201
11206
  fallback = {
@@ -11264,14 +11269,16 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11264
11269
  const nextVerbosityModels = Array.isArray(value?.verbosityModels) ? value.verbosityModels : [];
11265
11270
  const nextFastModels = Array.isArray(value?.fastModels) ? value.fastModels : void 0;
11266
11271
  const nextUltrafastModels = Array.isArray(value?.ultrafastModels) ? value.ultrafastModels : [];
11272
+ const nextUltraModels = Array.isArray(value?.ultraModels) ? value.ultraModels : [];
11267
11273
  catalogStatus = value?.catalogStatus;
11268
- const changed = !sameModels(contextModels, nextContextModels) || !sameModels(availableModels, nextAvailableModels) || !sameModels(verbosityModels, nextVerbosityModels) || JSON.stringify(fastModels) !== JSON.stringify(nextFastModels) || JSON.stringify(ultrafastModels) !== JSON.stringify(nextUltrafastModels);
11274
+ const changed = !sameModels(contextModels, nextContextModels) || !sameModels(availableModels, nextAvailableModels) || !sameModels(verbosityModels, nextVerbosityModels) || JSON.stringify(fastModels) !== JSON.stringify(nextFastModels) || JSON.stringify(ultrafastModels) !== JSON.stringify(nextUltrafastModels) || JSON.stringify(ultraModels) !== JSON.stringify(nextUltraModels);
11269
11275
  if (changed) {
11270
11276
  contextModels = nextContextModels;
11271
11277
  availableModels = nextAvailableModels;
11272
11278
  verbosityModels = nextVerbosityModels;
11273
11279
  fastModels = nextFastModels;
11274
11280
  ultrafastModels = nextUltrafastModels;
11281
+ ultraModels = nextUltraModels;
11275
11282
  publish();
11276
11283
  }
11277
11284
  return changed;
@@ -11810,7 +11817,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11810
11817
  }
11811
11818
  //#endregion
11812
11819
  //#region src/version.js
11813
- const PACKAGE_VERSION = "3.1.8";
11820
+ const PACKAGE_VERSION = "3.1.9";
11814
11821
  //#endregion
11815
11822
  //#region src/client-recovery.js
11816
11823
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
@@ -12655,8 +12662,9 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12655
12662
  //#endregion
12656
12663
  //#region src/voice-barge-in.js
12657
12664
  /** Mute playback promptly, and restore it only after interrupted audio has drained. */
12658
- function createBargeInGate({ interrupt, changed, speechMs = 120, silenceMs = 400 }) {
12665
+ function createBargeInGate({ interrupt, changed, speechMs = 120, silenceMs = 400, outputTailMs = 0 }) {
12659
12666
  let speakingAt, quietAt, outputQuietAt, suppressed = false, drained = false;
12667
+ let outputActiveAt;
12660
12668
  return { sample({ mic, output, now }) {
12661
12669
  if (mic > .12) {
12662
12670
  speakingAt ??= now;
@@ -12667,7 +12675,9 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12667
12675
  }
12668
12676
  if (output < .025) outputQuietAt ??= now;
12669
12677
  else outputQuietAt = void 0;
12670
- if (!suppressed && speakingAt !== void 0 && now - speakingAt >= speechMs && output > .025) {
12678
+ if (output > .025) outputActiveAt = now;
12679
+ const recentOutput = outputTailMs > 0 && outputActiveAt !== void 0 && now - outputActiveAt <= outputTailMs;
12680
+ if (!suppressed && speakingAt !== void 0 && now - speakingAt >= speechMs && (output > .025 || recentOutput)) {
12671
12681
  suppressed = true;
12672
12682
  drained = false;
12673
12683
  changed(true);
@@ -12699,7 +12709,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12699
12709
  return {
12700
12710
  "voice-insecure": "voiceInsecure",
12701
12711
  "voice-no-microphone": "voiceMicUnavailable",
12702
- "voice-no-webrtc": "voiceWebRTCUnavailable"
12712
+ "voice-no-webrtc": "voiceWebRTCUnavailable",
12713
+ "voice-native-unavailable": "voiceWebRTCUnavailable"
12703
12714
  }[error?.code] ?? "voiceFailed";
12704
12715
  }
12705
12716
  function voiceCallCapability(surface = globalThis) {
@@ -12907,6 +12918,111 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
12907
12918
  };
12908
12919
  }
12909
12920
  //#endregion
12921
+ //#region src/voice-native-call.js
12922
+ /** Native devices belong to this computer, never to a remote browser client. */
12923
+ function nativeVoiceEligible(surface = globalThis) {
12924
+ const agent = surface.navigator?.userAgent ?? "";
12925
+ const linuxWebKit = /Linux/u.test(agent) && /AppleWebKit/u.test(agent) && !/Chrome|Chromium|Edg\//u.test(agent);
12926
+ return surface.isSecureContext !== false && Boolean(surface.dshDesktop?.protocolVersion === 1 || surface.__TAURI_INTERNALS__ || surface.__dshWebRtcFallback || linuxWebKit) && [
12927
+ "localhost",
12928
+ "127.0.0.1",
12929
+ "[::1]"
12930
+ ].includes(surface.location?.hostname);
12931
+ }
12932
+ /** The native backend owns media; this handle carries only controls and levels. */
12933
+ async function openNativeVoiceCall({ rpc, sessionId, onEnd, signal, captureAllowed }) {
12934
+ signal?.throwIfAborted();
12935
+ if (captureAllowed !== true) throw Object.assign(/* @__PURE__ */ new Error("Microphone permission is required"), { name: "NotAllowedError" });
12936
+ const result = await rpc.call(CHANNEL, "voice/native/start", {
12937
+ sessionId,
12938
+ captureAllowed: true
12939
+ }, signal);
12940
+ if (!result?.ok) throw Object.assign(/* @__PURE__ */ new Error("Native voice could not start"), { code: result?.error?.code });
12941
+ const leaseToken = result.value?.leaseToken;
12942
+ if (typeof leaseToken !== "string" || leaseToken.length < 16) throw new Error("Invalid native voice response");
12943
+ const owner = {
12944
+ sessionId,
12945
+ leaseToken
12946
+ };
12947
+ let ended = false, timer, micMuted = false, outputMuted = false;
12948
+ let levels = {
12949
+ mic: 0,
12950
+ assistant: 0
12951
+ };
12952
+ const end = async () => {
12953
+ if (ended) return;
12954
+ ended = true;
12955
+ clearTimeout(timer);
12956
+ signal?.removeEventListener("abort", aborted);
12957
+ levels = {
12958
+ mic: 0,
12959
+ assistant: 0
12960
+ };
12961
+ try {
12962
+ await rpc.call(CHANNEL, "voice/native/stop", owner);
12963
+ } catch {}
12964
+ onEnd?.();
12965
+ };
12966
+ const aborted = () => {
12967
+ end();
12968
+ };
12969
+ signal?.addEventListener("abort", aborted, { once: true });
12970
+ if (signal?.aborted) {
12971
+ await end();
12972
+ signal.throwIfAborted();
12973
+ }
12974
+ const poll = async () => {
12975
+ if (ended) return;
12976
+ try {
12977
+ const reply = await rpc.call(CHANNEL, "voice/native/status", owner);
12978
+ if (ended) return;
12979
+ if (!reply?.ok || reply.value?.active !== true) {
12980
+ await end();
12981
+ return;
12982
+ }
12983
+ const value = reply.value.levels ?? {};
12984
+ levels = {
12985
+ mic: Number.isFinite(value.mic) ? Math.max(0, Math.min(1, value.mic)) : 0,
12986
+ assistant: Number.isFinite(value.assistant) ? Math.max(0, Math.min(1, value.assistant)) : 0
12987
+ };
12988
+ } catch {
12989
+ await end();
12990
+ return;
12991
+ }
12992
+ if (!ended) timer = setTimeout(poll, 300);
12993
+ };
12994
+ poll();
12995
+ const control = (action, muted) => {
12996
+ if (ended) return;
12997
+ rpc.call(CHANNEL, "voice/native/control", {
12998
+ ...owner,
12999
+ action,
13000
+ muted
13001
+ }).then((reply) => {
13002
+ if (!reply?.ok) end();
13003
+ }).catch(() => {
13004
+ end();
13005
+ });
13006
+ };
13007
+ return {
13008
+ stop: end,
13009
+ levels: () => ({
13010
+ mic: micMuted ? 0 : levels.mic,
13011
+ assistant: outputMuted ? 0 : levels.assistant
13012
+ }),
13013
+ isMuted: () => micMuted,
13014
+ setMuted: (value) => {
13015
+ micMuted = Boolean(value);
13016
+ control("mute", micMuted);
13017
+ },
13018
+ isOutputMuted: () => outputMuted,
13019
+ setOutputMuted: (value) => {
13020
+ outputMuted = Boolean(value);
13021
+ control("outputMute", outputMuted);
13022
+ }
13023
+ };
13024
+ }
13025
+ //#endregion
12910
13026
  //#region src/voice-browser.js
12911
13027
  const PARAM = "codexVoiceSession";
12912
13028
  const validSession = (value) => typeof value === "string" && /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,255}$/u.test(value);
@@ -13606,6 +13722,7 @@ void main(){
13606
13722
  const [browserCopied, setBrowserCopied] = (0, react.useState)(false);
13607
13723
  const [micOff, setMicOff] = (0, react.useState)(false);
13608
13724
  const [speakerOff, setSpeakerOff] = (0, react.useState)(false);
13725
+ const [nativeAvailable, setNativeAvailable] = (0, react.useState)(false);
13609
13726
  const enabled = snapshot.status === "ready" && snapshot.voiceCall === "on";
13610
13727
  const capability = enabled ? voiceCallCapability() : void 0;
13611
13728
  (0, react.useEffect)(() => {
@@ -13613,6 +13730,31 @@ void main(){
13613
13730
  setUnsupported(false);
13614
13731
  setBrowserCopied(false);
13615
13732
  }, [sessionId, capability]);
13733
+ (0, react.useEffect)(() => {
13734
+ setNativeAvailable(false);
13735
+ if (!enabled || !["voice-no-webrtc", "voice-no-microphone"].includes(capability) || !nativeVoiceEligible()) return void 0;
13736
+ const controller = new AbortController();
13737
+ let retry;
13738
+ const probe = async (attempt = 0) => {
13739
+ try {
13740
+ const result = await rpc.call(CHANNEL, "voice/native/probe", {}, controller.signal);
13741
+ if (controller.signal.aborted) return;
13742
+ if (result.value?.code === "native-voice-busy" && attempt < 3) retry = setTimeout(() => {
13743
+ probe(attempt + 1);
13744
+ }, 400);
13745
+ else setNativeAvailable(result.ok && result.value?.available === true);
13746
+ } catch {}
13747
+ };
13748
+ probe();
13749
+ return () => {
13750
+ controller.abort();
13751
+ clearTimeout(retry);
13752
+ };
13753
+ }, [
13754
+ enabled,
13755
+ capability,
13756
+ rpc
13757
+ ]);
13616
13758
  (0, react.useLayoutEffect)(() => {
13617
13759
  if (!enabled) {
13618
13760
  setPlace(void 0);
@@ -13688,6 +13830,7 @@ void main(){
13688
13830
  return () => clearTimeout(timer);
13689
13831
  }, [problem, unsupported]);
13690
13832
  const start = async () => {
13833
+ if (nativeAvailable && !window.confirm(t("voiceNativeCaptureConfirm"))) return;
13691
13834
  const controller = new AbortController();
13692
13835
  pendingCall.current?.abort();
13693
13836
  pendingCall.current = controller;
@@ -13698,19 +13841,22 @@ void main(){
13698
13841
  setMicOff(false);
13699
13842
  setSpeakerOff(false);
13700
13843
  setState("connecting");
13844
+ let attemptEnded = false;
13701
13845
  try {
13702
- const opened = await openVoiceCall({
13846
+ const opened = await (nativeAvailable ? openNativeVoiceCall : openVoiceCall)({
13703
13847
  rpc,
13704
13848
  sessionId,
13849
+ captureAllowed: nativeAvailable,
13705
13850
  signal: controller.signal,
13706
13851
  onEnd: () => {
13852
+ attemptEnded = true;
13707
13853
  if (!alive.current || controller.signal.aborted || pendingCall.current !== controller) return;
13708
13854
  call.current = null;
13709
13855
  setLiveCall(null);
13710
13856
  setState("idle");
13711
13857
  }
13712
13858
  });
13713
- if (!alive.current || controller.signal.aborted) {
13859
+ if (!alive.current || controller.signal.aborted || attemptEnded || pendingCall.current !== controller) {
13714
13860
  await opened.stop();
13715
13861
  return;
13716
13862
  }
@@ -13718,14 +13864,15 @@ void main(){
13718
13864
  setLiveCall(call.current);
13719
13865
  setState("live");
13720
13866
  } catch (error) {
13721
- if (!alive.current || controller.signal.aborted) return;
13867
+ if (!alive.current || controller.signal.aborted || pendingCall.current !== controller) return;
13722
13868
  call.current = null;
13723
13869
  setLiveCall(null);
13724
13870
  setState("idle");
13725
13871
  setUnsupported([
13726
13872
  "voice-no-webrtc",
13727
13873
  "voice-no-microphone",
13728
- "voice-insecure"
13874
+ "voice-insecure",
13875
+ "voice-native-unavailable"
13729
13876
  ].includes(error?.code) ? error.code : false);
13730
13877
  setProblem(voiceCallProblem(error));
13731
13878
  }
@@ -13757,7 +13904,7 @@ void main(){
13757
13904
  const browserUrl = capability === "voice-no-webrtc" || unsupported && unsupported !== "voice-insecure" ? voiceBrowserUrl(window.location.href, sessionId) : void 0;
13758
13905
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
13759
13906
  anchor,
13760
- visible ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [state === "idle" && capability === "voice-no-webrtc" && browserUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
13907
+ visible ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [state === "idle" && !nativeAvailable && capability === "voice-no-webrtc" && browserUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
13761
13908
  ref: button,
13762
13909
  href: browserUrl,
13763
13910
  target: "_blank",
@@ -14309,7 +14456,7 @@ void main(){
14309
14456
  });
14310
14457
  //#endregion
14311
14458
  //#region src/image-preferences.jsx
14312
- function ImageChoice({ t, label, hint, value, text, items, disabled, onSelect }) {
14459
+ function ImageChoice({ t, label, hint, title, value, text, items, disabled, onSelect }) {
14313
14460
  const [open, setOpen] = (0, react.useState)(false);
14314
14461
  const anchor = (0, react.useRef)(null);
14315
14462
  (0, react.useEffect)(() => {
@@ -14352,6 +14499,7 @@ void main(){
14352
14499
  "aria-label": label,
14353
14500
  "aria-haspopup": "menu",
14354
14501
  "aria-expanded": open && !disabled,
14502
+ title,
14355
14503
  disabled,
14356
14504
  onClick: () => setOpen((current) => !current),
14357
14505
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {})]
@@ -14368,9 +14516,10 @@ void main(){
14368
14516
  t,
14369
14517
  label: t("defaultReasoningEffort"),
14370
14518
  hint: t("defaultReasoningEffortHint"),
14519
+ title: t("defaultUltraHint"),
14371
14520
  value,
14372
14521
  text: t(`defaultReasoningEffort_${value}`),
14373
- items: DEFAULT_REASONING_EFFORTS.map((id) => ({
14522
+ items: DEFAULT_REASONING_EFFORTS.filter((id) => id !== "ultra" || snapshot.ultraModels?.length > 0).map((id) => ({
14374
14523
  id,
14375
14524
  label: t(`defaultReasoningEffort_${id}`)
14376
14525
  })),
@@ -19300,9 +19449,8 @@ void main(){
19300
19449
  }
19301
19450
  //#endregion
19302
19451
  //#region src/history-pending.js
19303
- function pendingReason(period, now = Date.now()) {
19304
- if (period.usedPercent !== void 0) return void 0;
19305
- return period.endsAt > now ? "current" : "past";
19452
+ function reportedHistoryPeriods(periods = []) {
19453
+ return periods.filter((period) => Number.isFinite(period.usedPercent) || Object.values(period.breakdowns ?? {}).some((rows) => rows.length > 0)).sort((a, b) => b.startsAt - a.startsAt);
19306
19454
  }
19307
19455
  const historyPeriodKey = (period) => `${period.startsAt}:${period.endsAt}:${period.windowMinutes ?? ""}`;
19308
19456
  function selectHistoryPeriod(periods, selected, now = Date.now()) {
@@ -19514,14 +19662,12 @@ void main(){
19514
19662
  }, row.key))]
19515
19663
  });
19516
19664
  }
19517
- function UsageHistory({ rpc, t, signedIn, resetKey, refreshKey }) {
19518
- const [open, setOpen] = (0, react.useState)(false);
19665
+ function UsageHistory({ rpc, t, signedIn, resetKey, refreshKey, forceRefreshKey }) {
19519
19666
  const [state, setState] = (0, react.useState)({ status: "idle" });
19520
19667
  const [selected, setSelected] = (0, react.useState)();
19521
19668
  const request = (0, react.useRef)(0);
19669
+ const lastForceRefresh = (0, react.useRef)(forceRefreshKey);
19522
19670
  (0, react.useEffect)(() => {
19523
- request.current += 1;
19524
- setState({ status: "idle" });
19525
19671
  setSelected(void 0);
19526
19672
  }, [signedIn, resetKey]);
19527
19673
  const load = (0, react.useCallback)((force) => {
@@ -19529,46 +19675,50 @@ void main(){
19529
19675
  const id = ++request.current;
19530
19676
  setState((previous) => ({
19531
19677
  status: "loading",
19532
- value: previous.value
19678
+ resetKey,
19679
+ value: previous.resetKey === resetKey ? previous.value : void 0
19533
19680
  }));
19534
19681
  recoveryCall(rpc, "usage/history", { force }, 2e4).then((value) => {
19535
19682
  if (request.current === id) setState({
19536
19683
  status: "ready",
19684
+ resetKey,
19537
19685
  value
19538
19686
  });
19539
19687
  }).catch((error) => {
19540
- if (request.current === id) setState({
19688
+ if (request.current === id) setState((previous) => ({
19541
19689
  status: "error",
19690
+ resetKey,
19691
+ value: previous.resetKey === resetKey ? previous.value : void 0,
19542
19692
  message: error.message
19543
- });
19693
+ }));
19544
19694
  });
19545
- }, [signedIn, rpc]);
19695
+ }, [
19696
+ signedIn,
19697
+ rpc,
19698
+ resetKey
19699
+ ]);
19546
19700
  (0, react.useEffect)(() => {
19547
- if (!open || !signedIn) return;
19548
- load(false);
19701
+ const force = lastForceRefresh.current !== forceRefreshKey;
19702
+ lastForceRefresh.current = forceRefreshKey;
19703
+ load(force);
19549
19704
  return () => {
19550
19705
  request.current += 1;
19551
19706
  };
19552
19707
  }, [
19553
- open,
19554
19708
  signedIn,
19555
19709
  resetKey,
19556
19710
  refreshKey,
19711
+ forceRefreshKey,
19557
19712
  load
19558
19713
  ]);
19559
19714
  if (!signedIn) return null;
19560
- const value = state.value;
19561
- const periods = [...value?.periods ?? []].sort((a, b) => b.startsAt - a.startsAt);
19715
+ const value = state.resetKey === resetKey ? state.value : void 0;
19716
+ const periods = value?.available === false ? [] : reportedHistoryPeriods(value?.periods);
19562
19717
  const period = selectHistoryPeriod(periods, selected);
19563
- const reason = period === void 0 ? void 0 : pendingReason(period);
19564
- const asOfDate = value?.asOf ? new Date(value.asOf).toLocaleDateString(uiLocale(), {
19565
- month: "numeric",
19566
- day: "numeric"
19567
- }) : "";
19718
+ if (period === void 0) return null;
19568
19719
  const present = DIMENSIONS.filter((dimension) => period?.breakdowns?.[dimension]?.length > 0);
19569
19720
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
19570
19721
  className: "codexSubscriptionHistory",
19571
- onToggle: (event) => setOpen(event.currentTarget.open),
19572
19722
  children: [
19573
19723
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("historyTitle") }),
19574
19724
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -19580,73 +19730,57 @@ void main(){
19580
19730
  }),
19581
19731
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
19582
19732
  "aria-live": "polite",
19583
- children: [
19584
- state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19585
- className: "codexSubscriptionEmpty",
19586
- role: "status",
19587
- children: t("historyLoading")
19588
- }) : null,
19589
- state.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19590
- className: "codexSubscriptionError",
19591
- role: "alert",
19592
- children: state.message
19593
- }) : null,
19594
- state.status === "ready" && value?.available === false ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19595
- className: "codexSubscriptionEmpty",
19596
- role: "status",
19597
- children: t("historyUnavailable")
19598
- }) : null,
19599
- state.status === "ready" && value?.available !== false && period === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19600
- className: "codexSubscriptionEmpty",
19601
- role: "status",
19602
- children: t("historyEmpty")
19603
- }) : null
19604
- ]
19605
- }),
19606
- period === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
19607
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19608
- className: "codexSubscriptionHistoryPeriods",
19609
- role: "group",
19610
- "aria-label": t("historyPeriods"),
19611
- children: periods.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
19612
- type: "button",
19613
- "aria-pressed": item === period,
19614
- title: item.usedPercent === void 0 ? t("historyPending") : void 0,
19615
- onClick: () => setSelected(historyPeriodKey(item)),
19616
- children: `${day(item.startsAt)}–${day(item.endsAt)}`
19617
- }, historyPeriodKey(item)))
19618
- }),
19619
- reason === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
19620
- className: "codexSubscriptionHistorySummary",
19621
- children: [fill(t("historyUsed"), { value: amount(period.usedPercent) }), period.complete ? "" : ` ${t("historyPartial")}`]
19622
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19733
+ children: [state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19623
19734
  className: "codexSubscriptionEmpty",
19624
19735
  role: "status",
19625
- children: fill(t(reason === "current" ? "historyPendingCurrent" : asOfDate ? "historyPendingPast" : "historyPendingPastUnknown"), { date: asOfDate })
19626
- }),
19627
- reason === void 0 && present.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19628
- className: "codexSubscriptionEmpty",
19629
- role: "status",
19630
- children: t("historyNoBreakdown")
19631
- }) : null,
19632
- present.map((dimension) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rows, {
19633
- dimension,
19634
- rows: period.breakdowns[dimension],
19635
- total: period.usedPercent,
19636
- t
19637
- }, dimension)),
19638
- value.asOf ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19639
- className: "codexSubscriptionCreditNote",
19640
- children: fill(t("historyAsOf"), { date: new Date(value.asOf).toLocaleDateString(uiLocale(), {
19641
- month: "numeric",
19642
- day: "numeric"
19643
- }) })
19644
- }) : null,
19645
- value.approximate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19646
- className: "codexSubscriptionCreditNote",
19647
- children: t("historyApproximate")
19648
- }) : null
19649
- ] })
19736
+ children: t("historyLoading")
19737
+ }) : null, state.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19738
+ className: "codexSubscriptionError",
19739
+ role: "alert",
19740
+ children: state.message
19741
+ }) : null]
19742
+ }),
19743
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19744
+ className: "codexSubscriptionHistoryPeriods",
19745
+ role: "group",
19746
+ "aria-label": t("historyPeriods"),
19747
+ children: periods.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
19748
+ type: "button",
19749
+ "aria-pressed": item === period,
19750
+ onClick: () => setSelected(historyPeriodKey(item)),
19751
+ children: `${day(item.startsAt)}–${day(item.endsAt)}`
19752
+ }, historyPeriodKey(item)))
19753
+ }),
19754
+ period.usedPercent !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
19755
+ className: "codexSubscriptionHistorySummary",
19756
+ children: [fill(t("historyUsed"), { value: amount(period.usedPercent) }), period.complete ? "" : ` ${t("historyPartial")}`]
19757
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19758
+ className: "codexSubscriptionEmpty",
19759
+ role: "status",
19760
+ children: t("historyTotalUnavailable")
19761
+ }),
19762
+ present.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19763
+ className: "codexSubscriptionEmpty",
19764
+ role: "status",
19765
+ children: t("historyNoBreakdown")
19766
+ }) : null,
19767
+ present.map((dimension) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rows, {
19768
+ dimension,
19769
+ rows: period.breakdowns[dimension],
19770
+ total: period.usedPercent,
19771
+ t
19772
+ }, dimension)),
19773
+ value.asOf ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19774
+ className: "codexSubscriptionCreditNote",
19775
+ children: fill(t("historyAsOf"), { date: new Date(value.asOf).toLocaleDateString(uiLocale(), {
19776
+ month: "numeric",
19777
+ day: "numeric"
19778
+ }) })
19779
+ }) : null,
19780
+ value.approximate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
19781
+ className: "codexSubscriptionCreditNote",
19782
+ children: t("historyApproximate")
19783
+ }) : null
19650
19784
  ]
19651
19785
  });
19652
19786
  }
@@ -19895,9 +20029,12 @@ void main(){
19895
20029
  }
19896
20030
  function UsageCard({ rpc, t, signedIn, resetKey, preference }) {
19897
20031
  const { usage, busy, error, now, refresh } = useQuotaUsage(rpc, signedIn);
20032
+ const [historyRefreshKey, setHistoryRefreshKey] = (0, react.useState)(0);
19898
20033
  const forecastMode = usePreferenceSnapshot(preference).quickQuotaMode === QUICK_QUOTA_MODE_FORECAST;
19899
20034
  const load = (force) => {
19900
- if (signedIn) refresh(force).catch(() => {});
20035
+ if (!signedIn) return;
20036
+ if (force) setHistoryRefreshKey((value) => value + 1);
20037
+ refresh(force).catch(() => {});
19901
20038
  };
19902
20039
  const usageRefreshGeneration = usage?.fetchedAt ?? 0;
19903
20040
  const visibleUsage = signedIn ? usage : void 0;
@@ -20007,7 +20144,8 @@ void main(){
20007
20144
  t,
20008
20145
  signedIn,
20009
20146
  resetKey,
20010
- refreshKey: usageRefreshGeneration
20147
+ refreshKey: usageRefreshGeneration,
20148
+ forceRefreshKey: historyRefreshKey
20011
20149
  }),
20012
20150
  visibleUsage?.chatPass === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
20013
20151
  className: "codexSubscriptionLimits",