dsh-codex-subscription 3.1.3 → 3.1.5
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/README.en.md +160 -100
- package/README.md +153 -105
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/compatibility.json +3 -2
- package/lib/client.js +272 -15
- package/lib/index.js +7523 -6555
- package/package.json +37 -37
package/lib/client.js
CHANGED
|
@@ -995,7 +995,7 @@ window.__ModuleLoader__.load({
|
|
|
995
995
|
const hasImage = (block) => block?.content?.some((part) => part.type === "image" && part.attachment);
|
|
996
996
|
const isImage = (part) => part?.type === "image" && part.attachment;
|
|
997
997
|
const resultsOf = (event) => {
|
|
998
|
-
if (event?.type !== "tool/result" || event.data.meta?.kind
|
|
998
|
+
if (event?.type !== "tool/result" || !["codex-subscription-image", "codex-subscription-sketch-finish"].includes(event.data.meta?.kind) || event.data.message?.isError) return [];
|
|
999
999
|
const content = event.data.message?.content ?? [];
|
|
1000
1000
|
const wrapped = content.filter((block) => block.type === "tool-result" && !block.isError && hasImage(block));
|
|
1001
1001
|
if (wrapped.length > 0) return wrapped;
|
|
@@ -1258,6 +1258,7 @@ window.__ModuleLoader__.load({
|
|
|
1258
1258
|
"voice/start",
|
|
1259
1259
|
"voice/stop",
|
|
1260
1260
|
"voice/status",
|
|
1261
|
+
"voice/interrupt",
|
|
1261
1262
|
"voice/preview",
|
|
1262
1263
|
"voice/catalog",
|
|
1263
1264
|
"remote/status",
|
|
@@ -4001,7 +4002,7 @@ window.__ModuleLoader__.load({
|
|
|
4001
4002
|
}
|
|
4002
4003
|
if (request.revision === void 0) throw stale("revision is required: copy it from the last result");
|
|
4003
4004
|
if (request.revision !== current.revision || adapter.busy()) throw stale("Sketch changed or is being edited; inspect again");
|
|
4004
|
-
let changedObjects, progress, previousError;
|
|
4005
|
+
let changedObjects, progress, previousError, png, delivery;
|
|
4005
4006
|
const report = {};
|
|
4006
4007
|
const measureNow = async () => {
|
|
4007
4008
|
try {
|
|
@@ -4051,7 +4052,13 @@ window.__ModuleLoader__.load({
|
|
|
4051
4052
|
if (request.name !== void 0 && (typeof request.name !== "string" || request.name.length > 60)) throw Error("Invalid draft name");
|
|
4052
4053
|
pending = true;
|
|
4053
4054
|
try {
|
|
4055
|
+
if (request.finalPreview) png = await adapter.preview({ drawingOnly: true });
|
|
4054
4056
|
await adapter.save(request.name);
|
|
4057
|
+
if (request.finalPreview) delivery = {
|
|
4058
|
+
status: "saved",
|
|
4059
|
+
documentId: current.documentId,
|
|
4060
|
+
revision: current.revision
|
|
4061
|
+
};
|
|
4055
4062
|
} finally {
|
|
4056
4063
|
pending = false;
|
|
4057
4064
|
}
|
|
@@ -4071,7 +4078,11 @@ window.__ModuleLoader__.load({
|
|
|
4071
4078
|
} : {},
|
|
4072
4079
|
...report?.warnings?.length ? { warnings: report.warnings } : {},
|
|
4073
4080
|
...report?.clampedPoints ? { clampedPoints: report.clampedPoints } : {},
|
|
4074
|
-
...progress ? { progress } : {}
|
|
4081
|
+
...progress ? { progress } : {},
|
|
4082
|
+
...png ? {
|
|
4083
|
+
png,
|
|
4084
|
+
delivery
|
|
4085
|
+
} : {}
|
|
4075
4086
|
};
|
|
4076
4087
|
completed.set(key, {
|
|
4077
4088
|
fingerprint,
|
|
@@ -4082,10 +4093,10 @@ window.__ModuleLoader__.load({
|
|
|
4082
4093
|
revision: result.revision
|
|
4083
4094
|
}
|
|
4084
4095
|
});
|
|
4085
|
-
cachedCharacters += fingerprint.length;
|
|
4096
|
+
cachedCharacters += fingerprint.length + (png?.length ?? 0);
|
|
4086
4097
|
while (completed.size > 1 && (completed.size > 128 || cachedCharacters > 4e6)) {
|
|
4087
4098
|
const oldest = completed.keys().next().value;
|
|
4088
|
-
cachedCharacters -= completed.get(oldest).fingerprint.length;
|
|
4099
|
+
cachedCharacters -= completed.get(oldest).fingerprint.length + (completed.get(oldest).result.png?.length ?? 0);
|
|
4089
4100
|
completed.delete(oldest);
|
|
4090
4101
|
}
|
|
4091
4102
|
if (request.action === "apply" && request.look === true && typeof adapter.preview === "function") {
|
|
@@ -4691,7 +4702,7 @@ window.__ModuleLoader__.load({
|
|
|
4691
4702
|
grid(context, surface.width, surface.height);
|
|
4692
4703
|
return surface.toDataURL("image/png");
|
|
4693
4704
|
}
|
|
4694
|
-
const surface = render(doc);
|
|
4705
|
+
const surface = render(options.drawingOnly ? drawingOf(doc) : doc);
|
|
4695
4706
|
grid(surface.getContext("2d"), surface.width, surface.height);
|
|
4696
4707
|
return surface.toDataURL("image/png");
|
|
4697
4708
|
}
|
|
@@ -5482,7 +5493,8 @@ window.__ModuleLoader__.load({
|
|
|
5482
5493
|
}
|
|
5483
5494
|
const value = await execute(request.action === "finish" ? {
|
|
5484
5495
|
...request,
|
|
5485
|
-
action: "save"
|
|
5496
|
+
action: "save",
|
|
5497
|
+
finalPreview: true
|
|
5486
5498
|
} : request);
|
|
5487
5499
|
if (version !== generation) throw Error("Drawing interrupted");
|
|
5488
5500
|
if (request.action !== "finish") return {
|
|
@@ -7264,6 +7276,12 @@ window.__ModuleLoader__.load({
|
|
|
7264
7276
|
connectors_write: "直接写入",
|
|
7265
7277
|
reasoningSummary: "推理摘要",
|
|
7266
7278
|
reasoningSummaryHint: "让模型在会话的“思考”部分给出推理摘要。自动由模型决定;简洁更短;详细更完整;关闭则不要摘要。",
|
|
7279
|
+
reasoningCache: "切换推理强度时复用缓存",
|
|
7280
|
+
reasoningCache_off: "关闭",
|
|
7281
|
+
reasoningCache_on: "开启",
|
|
7282
|
+
reasoningCacheHint: "默认开启,仅对支持的模型生效,切换推理强度时尽量复用此前缓存。关闭后仍有普通缓存;不保证每次命中或提速。",
|
|
7283
|
+
reasoningCacheCloud: "当前使用云端自动压缩,此优化暂不生效。切回 DSH 压缩后按此开关的选择生效;不会自动更改压缩设置。",
|
|
7284
|
+
reasoningCacheRetry: "当前使用无限重试,此优化暂不生效。切回普通重试策略后按此开关的选择生效;不会自动更改重试设置。",
|
|
7267
7285
|
retryPolicy: "请求重试",
|
|
7268
7286
|
retryPolicyHint: "请求因网络或服务端错误失败时的自动重试次数。默认沿用 DSH 的标准重试;无限会一直重试直到成功或手动停止。",
|
|
7269
7287
|
retryPolicy_default: "默认",
|
|
@@ -7322,6 +7340,7 @@ window.__ModuleLoader__.load({
|
|
|
7322
7340
|
voiceLang_de: "Deutsch",
|
|
7323
7341
|
voiceLang_pt: "Português",
|
|
7324
7342
|
voiceLang_ru: "Русский",
|
|
7343
|
+
voicePreviewHint: "切换回答语言会播放该语言的试听;选择自动跟随时,试听使用英语。",
|
|
7325
7344
|
remoteHint: "开启后,这台电脑上的 DSH 会出现在 ChatGPT 手机 App 的 Codex 主机列表里,可用手机查看对话、发消息、切换模型和审批。需要订阅账号登录;电脑要保持开机和联网。",
|
|
7326
7345
|
remoteConnected: "电脑已连上 ChatGPT,还没有手机连接",
|
|
7327
7346
|
remoteConnecting: "正在连接",
|
|
@@ -8107,6 +8126,12 @@ window.__ModuleLoader__.load({
|
|
|
8107
8126
|
connectors_write: "Write directly",
|
|
8108
8127
|
reasoningSummary: "Reasoning summary",
|
|
8109
8128
|
reasoningSummaryHint: "Shows a summary of the reasoning in the Thinking section of the conversation. Auto lets the model decide; concise is shorter; detailed is fuller; off asks for none.",
|
|
8129
|
+
reasoningCache: "Reuse cache when changing effort",
|
|
8130
|
+
reasoningCache_off: "Off",
|
|
8131
|
+
reasoningCache_on: "On",
|
|
8132
|
+
reasoningCacheHint: "On by default for supported models. Tries to reuse earlier cache when you change reasoning effort. Ordinary caching still works when off; cache hits and faster replies are not guaranteed.",
|
|
8133
|
+
reasoningCacheCloud: "Paused while cloud auto-compaction is selected. With DSH compaction, this switch applies again. Your compaction setting is never changed automatically.",
|
|
8134
|
+
reasoningCacheRetry: "Paused while Unlimited retries is selected. With a normal retry policy, this switch applies again. Your retry setting is never changed automatically.",
|
|
8110
8135
|
retryPolicy: "Request retries",
|
|
8111
8136
|
retryPolicyHint: "How many times a request is retried after a network or server error. Default keeps the standard DSH retries; Unlimited keeps retrying until it succeeds or you stop it.",
|
|
8112
8137
|
retryPolicy_default: "Default",
|
|
@@ -8165,6 +8190,7 @@ window.__ModuleLoader__.load({
|
|
|
8165
8190
|
voiceLang_de: "Deutsch",
|
|
8166
8191
|
voiceLang_pt: "Português",
|
|
8167
8192
|
voiceLang_ru: "Русский",
|
|
8193
|
+
voicePreviewHint: "Changing the answer language plays a sample in that language. Auto uses an English sample.",
|
|
8168
8194
|
remoteHint: "When on, this computer's DSH appears as a host in the ChatGPT mobile app's Codex list, so you can follow conversations, send messages, switch models and approve actions from your phone. Needs a signed-in subscription account; the computer must stay on and online.",
|
|
8169
8195
|
remoteConnected: "This computer is online with ChatGPT; no phone connected yet",
|
|
8170
8196
|
remoteConnecting: "Connecting",
|
|
@@ -10645,6 +10671,8 @@ window.__ModuleLoader__.load({
|
|
|
10645
10671
|
const DEFAULT_SEARCH_PROVIDER = SEARCH_PROVIDER_AUTO;
|
|
10646
10672
|
const SPEED_MODE_FIELD = "speedMode";
|
|
10647
10673
|
const SPEED_MODE_STANDARD = "standard";
|
|
10674
|
+
const SPEED_MODE_FAST = "fast";
|
|
10675
|
+
const SPEED_MODE_ULTRAFAST = "ultrafast";
|
|
10648
10676
|
const DEFAULT_SPEED_MODE = SPEED_MODE_STANDARD;
|
|
10649
10677
|
const OUTPUT_VERBOSITY_FIELD = "outputVerbosity";
|
|
10650
10678
|
const OUTPUT_VERBOSITY_DEFAULT = "default";
|
|
@@ -10814,6 +10842,134 @@ window.__ModuleLoader__.load({
|
|
|
10814
10842
|
"forecast"
|
|
10815
10843
|
].includes(value) ? value : legacyVisible === true ? QUICK_QUOTA_MODE_PERCENT : "off";
|
|
10816
10844
|
const supportsCodexFastMode = (modelId) => typeof modelId === "string" && (/^gpt-5\.(?:5|6)(?:$|-)/u.test(modelId) || modelId === "gpt-5.4" || modelId === "gpt-6-astra");
|
|
10845
|
+
Object.freeze({
|
|
10846
|
+
compactionMode: {
|
|
10847
|
+
choices: ["dsh", "cloud"],
|
|
10848
|
+
default: "dsh",
|
|
10849
|
+
error: "Invalid compaction mode"
|
|
10850
|
+
},
|
|
10851
|
+
reasoningCache: {
|
|
10852
|
+
choices: [
|
|
10853
|
+
"off",
|
|
10854
|
+
"on",
|
|
10855
|
+
"sol"
|
|
10856
|
+
],
|
|
10857
|
+
default: "on",
|
|
10858
|
+
error: "Invalid reasoning cache preference"
|
|
10859
|
+
},
|
|
10860
|
+
connectionMode: {
|
|
10861
|
+
choices: ["sse", "websocket"],
|
|
10862
|
+
default: "sse",
|
|
10863
|
+
error: "Invalid connection mode"
|
|
10864
|
+
},
|
|
10865
|
+
reviewModel: {
|
|
10866
|
+
choices: ["session", "official"],
|
|
10867
|
+
default: "session",
|
|
10868
|
+
error: "Invalid review model"
|
|
10869
|
+
},
|
|
10870
|
+
remoteControl: {
|
|
10871
|
+
choices: ["off", "on"],
|
|
10872
|
+
default: "off",
|
|
10873
|
+
error: "Invalid Remote Control setting"
|
|
10874
|
+
},
|
|
10875
|
+
otherModels: {
|
|
10876
|
+
choices: ["on", "off"],
|
|
10877
|
+
default: "on",
|
|
10878
|
+
error: "Invalid other-models setting"
|
|
10879
|
+
},
|
|
10880
|
+
subagentBackend: {
|
|
10881
|
+
choices: ["dsh", "codex"],
|
|
10882
|
+
default: "dsh",
|
|
10883
|
+
error: "Invalid subagent backend"
|
|
10884
|
+
},
|
|
10885
|
+
[QUICK_QUOTA_MODE_FIELD]: {
|
|
10886
|
+
choices: [
|
|
10887
|
+
"off",
|
|
10888
|
+
QUICK_QUOTA_MODE_PERCENT,
|
|
10889
|
+
"bar",
|
|
10890
|
+
QUICK_QUOTA_MODE_FORECAST
|
|
10891
|
+
],
|
|
10892
|
+
error: "Invalid quick quota preference"
|
|
10893
|
+
},
|
|
10894
|
+
[SEARCH_PROVIDER_FIELD]: {
|
|
10895
|
+
choices: [
|
|
10896
|
+
SEARCH_PROVIDER_AUTO,
|
|
10897
|
+
"dsh",
|
|
10898
|
+
SEARCH_PROVIDER_CODEX
|
|
10899
|
+
],
|
|
10900
|
+
default: DEFAULT_SEARCH_PROVIDER,
|
|
10901
|
+
error: "Invalid search provider preference"
|
|
10902
|
+
},
|
|
10903
|
+
[SPEED_MODE_FIELD]: {
|
|
10904
|
+
choices: [
|
|
10905
|
+
SPEED_MODE_STANDARD,
|
|
10906
|
+
SPEED_MODE_FAST,
|
|
10907
|
+
SPEED_MODE_ULTRAFAST
|
|
10908
|
+
],
|
|
10909
|
+
default: DEFAULT_SPEED_MODE,
|
|
10910
|
+
error: "Invalid speed mode preference"
|
|
10911
|
+
},
|
|
10912
|
+
[OUTPUT_VERBOSITY_FIELD]: {
|
|
10913
|
+
choices: [
|
|
10914
|
+
OUTPUT_VERBOSITY_DEFAULT,
|
|
10915
|
+
"low",
|
|
10916
|
+
OUTPUT_VERBOSITY_MEDIUM,
|
|
10917
|
+
OUTPUT_VERBOSITY_HIGH
|
|
10918
|
+
],
|
|
10919
|
+
default: DEFAULT_OUTPUT_VERBOSITY,
|
|
10920
|
+
error: "Invalid output verbosity preference"
|
|
10921
|
+
},
|
|
10922
|
+
[REASONING_SUMMARY_FIELD]: {
|
|
10923
|
+
choices: REASONING_SUMMARIES,
|
|
10924
|
+
default: DEFAULT_REASONING_SUMMARY,
|
|
10925
|
+
error: "Invalid reasoning summary preference"
|
|
10926
|
+
},
|
|
10927
|
+
[RETRY_POLICY_FIELD]: {
|
|
10928
|
+
choices: RETRY_POLICIES,
|
|
10929
|
+
default: DEFAULT_RETRY_POLICY,
|
|
10930
|
+
error: "Invalid retry policy preference"
|
|
10931
|
+
},
|
|
10932
|
+
[CONNECTORS_FIELD]: {
|
|
10933
|
+
choices: CONNECTOR_MODES,
|
|
10934
|
+
default: "off",
|
|
10935
|
+
error: "Invalid connectors preference"
|
|
10936
|
+
},
|
|
10937
|
+
[INPUT_IMAGE_DETAIL_FIELD]: {
|
|
10938
|
+
choices: INPUT_IMAGE_DETAILS,
|
|
10939
|
+
default: DEFAULT_INPUT_IMAGE_DETAIL,
|
|
10940
|
+
error: "Invalid input image detail preference"
|
|
10941
|
+
},
|
|
10942
|
+
[STREAM_IDLE_TIMEOUT_MINUTES_FIELD]: {
|
|
10943
|
+
choices: STREAM_IDLE_TIMEOUT_MINUTES,
|
|
10944
|
+
default: 10,
|
|
10945
|
+
error: "Invalid stream idle timeout preference"
|
|
10946
|
+
},
|
|
10947
|
+
[VOICE_CALL_FIELD]: {
|
|
10948
|
+
choices: ["off", "on"],
|
|
10949
|
+
default: "off",
|
|
10950
|
+
error: "Invalid voice call setting"
|
|
10951
|
+
},
|
|
10952
|
+
[VOICE_VOICE_FIELD]: {
|
|
10953
|
+
choices: VOICE_VOICES,
|
|
10954
|
+
default: "cove",
|
|
10955
|
+
error: "Invalid voice preference"
|
|
10956
|
+
},
|
|
10957
|
+
[VOICE_LANGUAGE_FIELD]: {
|
|
10958
|
+
choices: VOICE_LANGUAGES,
|
|
10959
|
+
default: "auto",
|
|
10960
|
+
error: "Invalid voice language preference"
|
|
10961
|
+
},
|
|
10962
|
+
[CONTEXT_MODE_FIELD]: {
|
|
10963
|
+
choices: [
|
|
10964
|
+
CONTEXT_MODE_STANDARD,
|
|
10965
|
+
CONTEXT_MODE_EXTENDED,
|
|
10966
|
+
CONTEXT_MODE_CUSTOM
|
|
10967
|
+
],
|
|
10968
|
+
default: DEFAULT_CONTEXT_MODE,
|
|
10969
|
+
error: "Invalid context mode preference"
|
|
10970
|
+
}
|
|
10971
|
+
});
|
|
10972
|
+
const normalizeReasoningCache = (value) => value === void 0 || value === "on" || value === "sol" ? "on" : "off";
|
|
10817
10973
|
//#endregion
|
|
10818
10974
|
//#region src/preference-controller.js
|
|
10819
10975
|
function createPreferenceController(rpc) {
|
|
@@ -10854,6 +11010,7 @@ window.__ModuleLoader__.load({
|
|
|
10854
11010
|
remoteControl: value?.remoteControl === "on" ? "on" : "off",
|
|
10855
11011
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10856
11012
|
compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
|
|
11013
|
+
reasoningCache: normalizeReasoningCache(value?.reasoningCache),
|
|
10857
11014
|
subagentBackend: value?.subagentBackend === "codex" ? "codex" : "dsh",
|
|
10858
11015
|
subagentBackendAvailable,
|
|
10859
11016
|
subagentRuntimeInstalled,
|
|
@@ -10920,6 +11077,7 @@ window.__ModuleLoader__.load({
|
|
|
10920
11077
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10921
11078
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10922
11079
|
compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
|
|
11080
|
+
reasoningCache: normalizeReasoningCache(value?.reasoningCache),
|
|
10923
11081
|
subagentBackend: value?.subagentBackend === "codex" ? "codex" : "dsh",
|
|
10924
11082
|
...readCapabilitySettings(value),
|
|
10925
11083
|
[QUICK_QUOTA_MODE_FIELD]: normalizeQuickQuotaMode(value?.[QUICK_QUOTA_MODE_FIELD], value?.[LEGACY_QUICK_QUOTA_FIELD]),
|
|
@@ -11478,7 +11636,7 @@ window.__ModuleLoader__.load({
|
|
|
11478
11636
|
}
|
|
11479
11637
|
//#endregion
|
|
11480
11638
|
//#region src/version.js
|
|
11481
|
-
const PACKAGE_VERSION = "3.1.
|
|
11639
|
+
const PACKAGE_VERSION = "3.1.5";
|
|
11482
11640
|
//#endregion
|
|
11483
11641
|
//#region src/client-recovery.js
|
|
11484
11642
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
|
|
@@ -12216,6 +12374,35 @@ window.__ModuleLoader__.load({
|
|
|
12216
12374
|
});
|
|
12217
12375
|
}
|
|
12218
12376
|
//#endregion
|
|
12377
|
+
//#region src/voice-barge-in.js
|
|
12378
|
+
/** Mute playback promptly, and restore it only after interrupted audio has drained. */
|
|
12379
|
+
function createBargeInGate({ interrupt, changed, speechMs = 120, silenceMs = 400 }) {
|
|
12380
|
+
let speakingAt, quietAt, outputQuietAt, suppressed = false, drained = false;
|
|
12381
|
+
return { sample({ mic, output, now }) {
|
|
12382
|
+
if (mic > .12) {
|
|
12383
|
+
speakingAt ??= now;
|
|
12384
|
+
quietAt = void 0;
|
|
12385
|
+
} else {
|
|
12386
|
+
speakingAt = void 0;
|
|
12387
|
+
quietAt ??= now;
|
|
12388
|
+
}
|
|
12389
|
+
if (output < .025) outputQuietAt ??= now;
|
|
12390
|
+
else outputQuietAt = void 0;
|
|
12391
|
+
if (!suppressed && speakingAt !== void 0 && now - speakingAt >= speechMs && output > .025) {
|
|
12392
|
+
suppressed = true;
|
|
12393
|
+
drained = false;
|
|
12394
|
+
changed(true);
|
|
12395
|
+
interrupt();
|
|
12396
|
+
}
|
|
12397
|
+
if (suppressed && outputQuietAt !== void 0 && now - outputQuietAt >= 250) drained = true;
|
|
12398
|
+
if (suppressed && drained && quietAt !== void 0 && now - quietAt >= silenceMs) {
|
|
12399
|
+
suppressed = false;
|
|
12400
|
+
speakingAt = void 0;
|
|
12401
|
+
changed(false);
|
|
12402
|
+
}
|
|
12403
|
+
} };
|
|
12404
|
+
}
|
|
12405
|
+
//#endregion
|
|
12219
12406
|
//#region src/voice-call.js
|
|
12220
12407
|
const ICE_WAIT_MS = 3e3;
|
|
12221
12408
|
const waitForCandidates = (connection) => new Promise((resolve) => {
|
|
@@ -12302,9 +12489,11 @@ window.__ModuleLoader__.load({
|
|
|
12302
12489
|
for (const track of stream.getTracks()) connection.addTrack(track, stream);
|
|
12303
12490
|
connection.createDataChannel("oai-events");
|
|
12304
12491
|
let ended = false;
|
|
12492
|
+
let monitor;
|
|
12305
12493
|
const end = async () => {
|
|
12306
12494
|
if (ended) return;
|
|
12307
12495
|
ended = true;
|
|
12496
|
+
clearInterval(monitor);
|
|
12308
12497
|
if (context) chime(context, [740, 520]);
|
|
12309
12498
|
for (const track of stream.getTracks()) track.stop();
|
|
12310
12499
|
sound.srcObject = null;
|
|
@@ -12354,6 +12543,22 @@ window.__ModuleLoader__.load({
|
|
|
12354
12543
|
assistant: /* @__PURE__ */ new Uint8Array(512)
|
|
12355
12544
|
};
|
|
12356
12545
|
let muted = false;
|
|
12546
|
+
let outputMuted = false;
|
|
12547
|
+
let interrupted = false;
|
|
12548
|
+
const gate = createBargeInGate({
|
|
12549
|
+
changed: (value) => {
|
|
12550
|
+
interrupted = value;
|
|
12551
|
+
sound.muted = outputMuted || interrupted;
|
|
12552
|
+
},
|
|
12553
|
+
interrupt: () => {
|
|
12554
|
+
rpc.call(CHANNEL, "voice/interrupt", { sessionId }).catch(() => {});
|
|
12555
|
+
}
|
|
12556
|
+
});
|
|
12557
|
+
if (context) monitor = setInterval(() => gate.sample({
|
|
12558
|
+
mic: muted ? 0 : loudness(analysers.mic, buffers.mic),
|
|
12559
|
+
output: loudness(analysers.assistant, buffers.assistant),
|
|
12560
|
+
now: performance.now()
|
|
12561
|
+
}), 30);
|
|
12357
12562
|
return {
|
|
12358
12563
|
stop: end,
|
|
12359
12564
|
isMuted: () => muted,
|
|
@@ -12361,9 +12566,10 @@ window.__ModuleLoader__.load({
|
|
|
12361
12566
|
muted = value;
|
|
12362
12567
|
for (const track of stream.getAudioTracks()) track.enabled = !value;
|
|
12363
12568
|
},
|
|
12364
|
-
isOutputMuted: () =>
|
|
12569
|
+
isOutputMuted: () => outputMuted,
|
|
12365
12570
|
setOutputMuted: (value) => {
|
|
12366
|
-
|
|
12571
|
+
outputMuted = value;
|
|
12572
|
+
sound.muted = outputMuted || interrupted;
|
|
12367
12573
|
},
|
|
12368
12574
|
/** How loud the person (mic) and the model (voice) are right now, 0..1 each. */
|
|
12369
12575
|
levels: () => ({
|
|
@@ -13253,6 +13459,7 @@ void main(){
|
|
|
13253
13459
|
/** Settings for the composer's voice button: on or off, the voice (with a short sample to listen to) and the answer language. */
|
|
13254
13460
|
function VoiceCallCard({ rpc, preference, snapshot, t }) {
|
|
13255
13461
|
const audio = (0, react.useRef)();
|
|
13462
|
+
const previewSequence = (0, react.useRef)(0);
|
|
13256
13463
|
const alive = (0, react.useRef)(false);
|
|
13257
13464
|
const [offered, setOffered] = (0, react.useState)();
|
|
13258
13465
|
const [sample, setSample] = (0, react.useState)({
|
|
@@ -13277,15 +13484,19 @@ void main(){
|
|
|
13277
13484
|
})();
|
|
13278
13485
|
}, [on]);
|
|
13279
13486
|
/** Play a short clip of a voice; picking a voice plays it too, so it can be heard before it is used. */
|
|
13280
|
-
const playVoice = async (voice) => {
|
|
13487
|
+
const playVoice = async (voice, language = snapshot.voiceLanguage) => {
|
|
13488
|
+
const sequence = ++previewSequence.current;
|
|
13281
13489
|
audio.current?.pause();
|
|
13282
13490
|
setSample({
|
|
13283
13491
|
state: "loading",
|
|
13284
13492
|
note: ""
|
|
13285
13493
|
});
|
|
13286
13494
|
try {
|
|
13287
|
-
const result = await rpc.call(CHANNEL, "voice/preview", {
|
|
13288
|
-
|
|
13495
|
+
const result = await rpc.call(CHANNEL, "voice/preview", {
|
|
13496
|
+
voice,
|
|
13497
|
+
language
|
|
13498
|
+
});
|
|
13499
|
+
if (!alive.current || sequence !== previewSequence.current) return;
|
|
13289
13500
|
if (!result.ok) {
|
|
13290
13501
|
setSample({
|
|
13291
13502
|
state: "missing",
|
|
@@ -13296,7 +13507,7 @@ void main(){
|
|
|
13296
13507
|
const clip = new Audio(result.value.audio);
|
|
13297
13508
|
audio.current = clip;
|
|
13298
13509
|
clip.onended = () => {
|
|
13299
|
-
if (alive.current) setSample((current) => ({
|
|
13510
|
+
if (alive.current && sequence === previewSequence.current) setSample((current) => ({
|
|
13300
13511
|
...current,
|
|
13301
13512
|
state: "idle"
|
|
13302
13513
|
}));
|
|
@@ -13307,7 +13518,7 @@ void main(){
|
|
|
13307
13518
|
});
|
|
13308
13519
|
await clip.play();
|
|
13309
13520
|
} catch {
|
|
13310
|
-
if (alive.current) setSample({
|
|
13521
|
+
if (alive.current && sequence === previewSequence.current) setSample({
|
|
13311
13522
|
state: "missing",
|
|
13312
13523
|
note: ""
|
|
13313
13524
|
});
|
|
@@ -13398,7 +13609,12 @@ void main(){
|
|
|
13398
13609
|
items: languages,
|
|
13399
13610
|
onSelect: (value) => {
|
|
13400
13611
|
preference.set({ [VOICE_LANGUAGE_FIELD]: value });
|
|
13612
|
+
playVoice(snapshot.voiceVoice, value);
|
|
13401
13613
|
}
|
|
13614
|
+
}),
|
|
13615
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13616
|
+
className: "codexSubscriptionHelp",
|
|
13617
|
+
children: t("voicePreviewHint")
|
|
13402
13618
|
})
|
|
13403
13619
|
] }) : null]
|
|
13404
13620
|
});
|
|
@@ -16886,6 +17102,42 @@ void main(){
|
|
|
16886
17102
|
})]
|
|
16887
17103
|
});
|
|
16888
17104
|
}
|
|
17105
|
+
function ReasoningCachePreference({ preference, t }) {
|
|
17106
|
+
const snapshot = usePreferenceSnapshot(preference);
|
|
17107
|
+
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
17108
|
+
const blocked = snapshot.compactionMode === "cloud" || snapshot.retryPolicy === "unlimited";
|
|
17109
|
+
const hint = snapshot.compactionMode === "cloud" ? "reasoningCacheCloud" : snapshot.retryPolicy === "unlimited" ? "reasoningCacheRetry" : "reasoningCacheHint";
|
|
17110
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17111
|
+
className: "codexSubscriptionPreference",
|
|
17112
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17113
|
+
className: "codexSubscriptionPreferenceCopy",
|
|
17114
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
17115
|
+
className: "codexSubscriptionPreferenceLabel",
|
|
17116
|
+
children: t("reasoningCache")
|
|
17117
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Hint, {
|
|
17118
|
+
t,
|
|
17119
|
+
children: t(hint)
|
|
17120
|
+
})]
|
|
17121
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17122
|
+
className: "codexSubscriptionQuotaModes",
|
|
17123
|
+
role: "radiogroup",
|
|
17124
|
+
"aria-label": t("reasoningCache"),
|
|
17125
|
+
"aria-busy": snapshot.saving || void 0,
|
|
17126
|
+
children: ["off", "on"].map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
17127
|
+
className: "codexSubscriptionQuotaMode",
|
|
17128
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
17129
|
+
type: "radio",
|
|
17130
|
+
name: "codex-reasoning-cache",
|
|
17131
|
+
checked: snapshot.reasoningCache === value,
|
|
17132
|
+
disabled: !writable || value === "on" && blocked,
|
|
17133
|
+
onChange: () => {
|
|
17134
|
+
preference.set({ reasoningCache: value });
|
|
17135
|
+
}
|
|
17136
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(`reasoningCache_${value}`) })]
|
|
17137
|
+
}, value))
|
|
17138
|
+
})]
|
|
17139
|
+
});
|
|
17140
|
+
}
|
|
16889
17141
|
function RetryPolicyPreference({ preference, t }) {
|
|
16890
17142
|
const snapshot = usePreferenceSnapshot(preference);
|
|
16891
17143
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
@@ -17593,6 +17845,11 @@ void main(){
|
|
|
17593
17845
|
t
|
|
17594
17846
|
}),
|
|
17595
17847
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "codexSubscriptionDivider" }),
|
|
17848
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReasoningCachePreference, {
|
|
17849
|
+
preference,
|
|
17850
|
+
t
|
|
17851
|
+
}),
|
|
17852
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "codexSubscriptionDivider" }),
|
|
17596
17853
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RetryPolicyPreference, {
|
|
17597
17854
|
preference,
|
|
17598
17855
|
t
|