@karlorz/codexhost-cli-win32-x64 0.18.0-0 → 0.18.0-1
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.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +258 -57
- package/app/console-web.js +1813 -137
- package/app/cpa-live-voice-hook.js +1879 -426
- package/app/desktop-controller.mjs +1783 -192
- package/app/host-runtime.mjs +2595 -1088
- package/app/overlay-voice-bootstrap.js +1616 -0
- package/app/plugins/antigravity/plugin.mjs +257 -56
- package/app/plugins/claude-code/plugin.mjs +257 -56
- package/app/plugins/codebuddy/plugin.mjs +257 -56
- package/app/plugins/codex-usage/plugin.mjs +257 -56
- package/app/plugins/copilot/plugin.mjs +257 -56
- package/app/plugins/cursor-cli/plugin.mjs +257 -56
- package/app/plugins/deepseek-harness/plugin.mjs +257 -56
- package/app/plugins/devin/plugin.mjs +257 -56
- package/app/plugins/grok/plugin.mjs +257 -56
- package/app/plugins/hermes/plugin.mjs +257 -56
- package/app/plugins/kimi-code/plugin.mjs +257 -56
- package/app/plugins/kiro-cli/plugin.mjs +257 -56
- package/app/plugins/omp/plugin.mjs +257 -56
- package/app/plugins/opencode/plugin.mjs +257 -56
- package/app/plugins/pi/plugin.mjs +257 -56
- package/app/plugins/qoder/plugin.mjs +257 -56
- package/app/plugins/qoder-cn/plugin.mjs +257 -56
- package/app/plugins/qwen-code/plugin.mjs +257 -56
- package/app/plugins/workbuddy/plugin.mjs +257 -56
- package/app/plugins/zcode/plugin.mjs +257 -56
- package/app/renderer-extension.js +22195 -19283
- package/app/voice-profile-pins.json +25 -0
- package/app/voice-qualification.json +4 -0
- package/app/web/assets/index-py6Ho-Dy.js +199 -0
- package/app/web/codexhost-settings.js +1762 -129
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
- package/app/web-modules/server.mjs +956 -180
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-Bs17Kuah.js +0 -199
|
@@ -728,9 +728,9 @@
|
|
|
728
728
|
return ratio - roundedRatio;
|
|
729
729
|
}
|
|
730
730
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
731
|
-
function defineLazy(
|
|
731
|
+
function defineLazy(object5, key, getter) {
|
|
732
732
|
let value = void 0;
|
|
733
|
-
Object.defineProperty(
|
|
733
|
+
Object.defineProperty(object5, key, {
|
|
734
734
|
get() {
|
|
735
735
|
if (value === EVALUATING) {
|
|
736
736
|
return void 0;
|
|
@@ -742,7 +742,7 @@
|
|
|
742
742
|
return value;
|
|
743
743
|
},
|
|
744
744
|
set(v) {
|
|
745
|
-
Object.defineProperty(
|
|
745
|
+
Object.defineProperty(object5, key, {
|
|
746
746
|
value: v
|
|
747
747
|
// configurable: true,
|
|
748
748
|
});
|
|
@@ -14547,7 +14547,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14547
14547
|
origin: goalOriginSchema
|
|
14548
14548
|
});
|
|
14549
14549
|
|
|
14550
|
-
// ../shared-contracts/dist/realtime-call.js
|
|
14550
|
+
// ../shared-contracts/dist/realtime-call-core.js
|
|
14551
14551
|
var REALTIME_CALL_METHOD = "codexhost/realtime/call";
|
|
14552
14552
|
var REALTIME_CALL_FORWARDED_HEADERS = [
|
|
14553
14553
|
"openai-alpha",
|
|
@@ -14566,7 +14566,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14566
14566
|
}
|
|
14567
14567
|
return result;
|
|
14568
14568
|
}
|
|
14569
|
-
var REALTIME_CALL_ID_PATTERN = /^
|
|
14569
|
+
var REALTIME_CALL_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/u;
|
|
14570
14570
|
function isRealtimeCallId(value) {
|
|
14571
14571
|
return typeof value === "string" && REALTIME_CALL_ID_PATTERN.test(value);
|
|
14572
14572
|
}
|
|
@@ -14576,6 +14576,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14576
14576
|
return path;
|
|
14577
14577
|
return /\/(?:calls|live)\/([A-Za-z0-9_-]{1,128})$/u.exec(path)?.[1];
|
|
14578
14578
|
}
|
|
14579
|
+
|
|
14580
|
+
// ../shared-contracts/dist/realtime-call.js
|
|
14579
14581
|
var requestId = external_exports.string().min(1).max(128);
|
|
14580
14582
|
var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
|
|
14581
14583
|
external_exports.object({
|
|
@@ -14630,12 +14632,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14630
14632
|
var RELAY_PUBLIC_RESOURCE = `${RELAY_PUBLIC_ORIGIN}/mcp`;
|
|
14631
14633
|
var RELAY_WAIT_TIMEOUT_MAX_MS = 25e3;
|
|
14632
14634
|
var RELAY_MAX_BODY_BYTES = 2 * 1024 * 1024;
|
|
14633
|
-
var RELAY_ALLOWED_ROUTES = [
|
|
14634
|
-
"/v1/enroll/status",
|
|
14635
|
-
"/v1/thread/read",
|
|
14636
|
-
"/v1/thread/wait",
|
|
14637
|
-
"/v1/thread/send"
|
|
14638
|
-
];
|
|
14639
14635
|
var relayLinkHelloSchema = external_exports.strictObject({
|
|
14640
14636
|
v: external_exports.literal(RELAY_LINK_PROTOCOL_VERSION),
|
|
14641
14637
|
secret: external_exports.string().min(1).max(4096)
|
|
@@ -14647,8 +14643,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14647
14643
|
var relayLinkRequestSchema = external_exports.strictObject({
|
|
14648
14644
|
requestId: external_exports.string().min(1).max(128),
|
|
14649
14645
|
deadlineMs: external_exports.number().int().positive(),
|
|
14650
|
-
route: external_exports.
|
|
14651
|
-
body: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
14646
|
+
route: external_exports.string().min(1).max(128),
|
|
14647
|
+
body: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
14648
|
+
operationalClient: external_exports.string().min(1).max(64).optional(),
|
|
14649
|
+
oauthClientId: external_exports.string().min(1).max(128).optional(),
|
|
14650
|
+
dispatchGrant: external_exports.enum(["legacy-four", "full-dispatch"]).optional()
|
|
14652
14651
|
});
|
|
14653
14652
|
var relayLinkErrorSchema = external_exports.strictObject({
|
|
14654
14653
|
code: external_exports.string().min(1).max(64),
|
|
@@ -14692,6 +14691,204 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14692
14691
|
runtime: external_exports.enum(["reachable", "unreachable"])
|
|
14693
14692
|
});
|
|
14694
14693
|
|
|
14694
|
+
// ../shared-contracts/dist/external-clients.js
|
|
14695
|
+
var EXTERNAL_CLIENT_NAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/u;
|
|
14696
|
+
var externalClientNameSchema = external_exports.string().trim().min(1).max(64).regex(EXTERNAL_CLIENT_NAME_PATTERN);
|
|
14697
|
+
var externalClientAccessSchema = external_exports.enum(["all-threads", "selected-workspaces"]);
|
|
14698
|
+
var externalClientConnectionModeSchema = external_exports.enum(["public-relay", "local", "direct"]);
|
|
14699
|
+
var externalClientDispatchGrantSchema = external_exports.enum(["legacy-four", "full-dispatch"]);
|
|
14700
|
+
var workspacePathSchema = external_exports.string().trim().min(1).max(4096);
|
|
14701
|
+
var directUrlSchema = external_exports.string().trim().max(2048);
|
|
14702
|
+
var externalClientPublicViewSchema = external_exports.strictObject({
|
|
14703
|
+
name: externalClientNameSchema,
|
|
14704
|
+
createdAt: external_exports.string().min(1).max(64),
|
|
14705
|
+
access: externalClientAccessSchema,
|
|
14706
|
+
workspaces: external_exports.array(workspacePathSchema).max(64),
|
|
14707
|
+
connectionMode: externalClientConnectionModeSchema,
|
|
14708
|
+
dispatchGrant: externalClientDispatchGrantSchema,
|
|
14709
|
+
oauthClientId: external_exports.string().trim().min(1).max(128).optional(),
|
|
14710
|
+
directUrl: directUrlSchema.optional(),
|
|
14711
|
+
mcpUrl: external_exports.string().min(1).max(2048).optional(),
|
|
14712
|
+
mcpUrlNote: external_exports.string().min(1).max(512).optional()
|
|
14713
|
+
});
|
|
14714
|
+
var externalClientListParamsSchema = external_exports.strictObject({});
|
|
14715
|
+
var externalClientListResultSchema = external_exports.strictObject({
|
|
14716
|
+
clients: external_exports.array(externalClientPublicViewSchema).max(256)
|
|
14717
|
+
});
|
|
14718
|
+
var externalClientWriteFieldsSchema = external_exports.strictObject({
|
|
14719
|
+
access: externalClientAccessSchema.optional(),
|
|
14720
|
+
workspaces: external_exports.array(workspacePathSchema).max(64).optional(),
|
|
14721
|
+
connectionMode: externalClientConnectionModeSchema.optional(),
|
|
14722
|
+
dispatchGrant: externalClientDispatchGrantSchema.optional(),
|
|
14723
|
+
oauthClientId: external_exports.string().trim().min(1).max(128).optional(),
|
|
14724
|
+
directUrl: directUrlSchema.optional()
|
|
14725
|
+
});
|
|
14726
|
+
var externalClientCreateParamsSchema = externalClientWriteFieldsSchema.extend({
|
|
14727
|
+
name: externalClientNameSchema
|
|
14728
|
+
});
|
|
14729
|
+
var externalClientCreateResultSchema = externalClientPublicViewSchema.extend({
|
|
14730
|
+
token: external_exports.string().min(1).max(256).optional()
|
|
14731
|
+
});
|
|
14732
|
+
var externalClientUpdateParamsSchema = externalClientWriteFieldsSchema.extend({
|
|
14733
|
+
name: externalClientNameSchema,
|
|
14734
|
+
clearOauthClientId: external_exports.literal(true).optional()
|
|
14735
|
+
});
|
|
14736
|
+
var externalClientRevokeParamsSchema = external_exports.strictObject({
|
|
14737
|
+
name: externalClientNameSchema
|
|
14738
|
+
});
|
|
14739
|
+
var externalClientRevokeResultSchema = external_exports.strictObject({
|
|
14740
|
+
name: externalClientNameSchema,
|
|
14741
|
+
revoked: external_exports.literal(true)
|
|
14742
|
+
});
|
|
14743
|
+
var stringProp = (description) => ({ type: "string", description });
|
|
14744
|
+
var integerProp = (description) => ({
|
|
14745
|
+
type: "integer",
|
|
14746
|
+
minimum: 0,
|
|
14747
|
+
description
|
|
14748
|
+
});
|
|
14749
|
+
var threadProp = stringProp("Thread id or codex://threads/<id> link");
|
|
14750
|
+
var EXTERNAL_MCP_TOOL_DESCRIPTORS = [
|
|
14751
|
+
{
|
|
14752
|
+
name: "harness_list",
|
|
14753
|
+
description: "List the Harnesses this codexhost can delegate to.",
|
|
14754
|
+
inputSchema: { type: "object", properties: {} }
|
|
14755
|
+
},
|
|
14756
|
+
{
|
|
14757
|
+
name: "harness_inspect",
|
|
14758
|
+
description: "Read a Harness's Models, Thinking options and defaults; use the returned ids when delegating.",
|
|
14759
|
+
inputSchema: {
|
|
14760
|
+
type: "object",
|
|
14761
|
+
properties: {
|
|
14762
|
+
harnessId: stringProp("Harness id from harness_list"),
|
|
14763
|
+
cwd: stringProp("Absolute workspace path"),
|
|
14764
|
+
refresh: { type: "boolean" }
|
|
14765
|
+
},
|
|
14766
|
+
required: ["harnessId"]
|
|
14767
|
+
}
|
|
14768
|
+
},
|
|
14769
|
+
{
|
|
14770
|
+
name: "delegate_start",
|
|
14771
|
+
description: "Start a task in a new Thread and return at once. Without parentThread the work belongs to this client and cwd is required. watch=true records an event for this client when the Thread stops (read it with events_poll or the SSE stream).",
|
|
14772
|
+
inputSchema: {
|
|
14773
|
+
type: "object",
|
|
14774
|
+
properties: {
|
|
14775
|
+
harnessId: stringProp("Harness id from harness_list"),
|
|
14776
|
+
task: stringProp("The full task text"),
|
|
14777
|
+
taskName: stringProp("Short display name"),
|
|
14778
|
+
cwd: stringProp("Absolute workspace path"),
|
|
14779
|
+
model: stringProp("Model id from harness_inspect"),
|
|
14780
|
+
thinking: stringProp("Thinking option id from harness_inspect"),
|
|
14781
|
+
parentThread: stringProp("Optional parent Thread"),
|
|
14782
|
+
requestId: stringProp("Reuse to retry idempotently"),
|
|
14783
|
+
refs: {
|
|
14784
|
+
type: "array",
|
|
14785
|
+
items: { type: "string" },
|
|
14786
|
+
description: "Absolute URIs of where the work came from"
|
|
14787
|
+
},
|
|
14788
|
+
watch: { type: "boolean", description: "Record an event when the Thread stops" },
|
|
14789
|
+
watchTimeoutMs: integerProp("How long to watch; default 29 minutes")
|
|
14790
|
+
},
|
|
14791
|
+
required: ["harnessId", "task"]
|
|
14792
|
+
}
|
|
14793
|
+
},
|
|
14794
|
+
{
|
|
14795
|
+
name: "thread_read",
|
|
14796
|
+
description: "Read a Thread's status and latest result, or page its visible messages (view=messages). Never changes the Thread.",
|
|
14797
|
+
inputSchema: {
|
|
14798
|
+
type: "object",
|
|
14799
|
+
properties: {
|
|
14800
|
+
thread: threadProp,
|
|
14801
|
+
view: { type: "string", enum: ["result", "messages"] },
|
|
14802
|
+
cursor: stringProp("Message cursor"),
|
|
14803
|
+
limit: integerProp("Messages per page, at most 100")
|
|
14804
|
+
},
|
|
14805
|
+
required: ["thread"]
|
|
14806
|
+
}
|
|
14807
|
+
},
|
|
14808
|
+
{
|
|
14809
|
+
name: "thread_wait",
|
|
14810
|
+
description: "Wait up to timeoutMs (at most 60000) for a Thread to stop, then return the same snapshot as thread_read plus timedOut.",
|
|
14811
|
+
inputSchema: {
|
|
14812
|
+
type: "object",
|
|
14813
|
+
properties: {
|
|
14814
|
+
thread: threadProp,
|
|
14815
|
+
timeoutMs: integerProp("At most 60000; default 30000"),
|
|
14816
|
+
view: { type: "string", enum: ["result", "messages"] }
|
|
14817
|
+
},
|
|
14818
|
+
required: ["thread"]
|
|
14819
|
+
}
|
|
14820
|
+
},
|
|
14821
|
+
{
|
|
14822
|
+
name: "thread_list",
|
|
14823
|
+
description: "List Threads: by workspace (cwd), by parent Thread, by the client that started them, or by reference.",
|
|
14824
|
+
inputSchema: {
|
|
14825
|
+
type: "object",
|
|
14826
|
+
properties: {
|
|
14827
|
+
cwd: stringProp("Absolute workspace path"),
|
|
14828
|
+
parent: stringProp("Parent Thread"),
|
|
14829
|
+
client: stringProp("Client name"),
|
|
14830
|
+
ref: stringProp("Reference URI"),
|
|
14831
|
+
limit: integerProp("At most 100; default 25"),
|
|
14832
|
+
cursor: stringProp("Cursor from a previous page"),
|
|
14833
|
+
sort: {
|
|
14834
|
+
type: "string",
|
|
14835
|
+
enum: [
|
|
14836
|
+
"created-asc",
|
|
14837
|
+
"created-desc",
|
|
14838
|
+
"updated-asc",
|
|
14839
|
+
"updated-desc",
|
|
14840
|
+
"recency-asc",
|
|
14841
|
+
"recency-desc"
|
|
14842
|
+
]
|
|
14843
|
+
}
|
|
14844
|
+
}
|
|
14845
|
+
}
|
|
14846
|
+
},
|
|
14847
|
+
{
|
|
14848
|
+
name: "thread_send",
|
|
14849
|
+
description: "Start a new Turn in an idle Thread. THREAD_BUSY means its current Turn is still running; messages are not queued.",
|
|
14850
|
+
inputSchema: {
|
|
14851
|
+
type: "object",
|
|
14852
|
+
properties: { thread: threadProp, message: stringProp("Message text") },
|
|
14853
|
+
required: ["thread", "message"]
|
|
14854
|
+
}
|
|
14855
|
+
},
|
|
14856
|
+
{
|
|
14857
|
+
name: "thread_cancel",
|
|
14858
|
+
description: "Cancel a Thread's active Turn, keeping the Thread and its history.",
|
|
14859
|
+
inputSchema: { type: "object", properties: { thread: threadProp }, required: ["thread"] }
|
|
14860
|
+
},
|
|
14861
|
+
{
|
|
14862
|
+
name: "thread_watch",
|
|
14863
|
+
description: "Record one event for this client when the Thread stops or the watch expires.",
|
|
14864
|
+
inputSchema: {
|
|
14865
|
+
type: "object",
|
|
14866
|
+
properties: { thread: threadProp, timeoutMs: integerProp("Default 29 minutes") },
|
|
14867
|
+
required: ["thread"]
|
|
14868
|
+
}
|
|
14869
|
+
},
|
|
14870
|
+
{
|
|
14871
|
+
name: "thread_watches",
|
|
14872
|
+
description: "List watches that have not been delivered yet.",
|
|
14873
|
+
inputSchema: { type: "object", properties: {} }
|
|
14874
|
+
},
|
|
14875
|
+
{
|
|
14876
|
+
name: "events_poll",
|
|
14877
|
+
description: "Read this client's events after a cursor (0 for all retained). Waits up to timeoutMs (at most 60000) for the first one. Pass the returned cursor back next time. CURSOR_EXPIRED: reconcile with thread_list client=<this client>.",
|
|
14878
|
+
inputSchema: {
|
|
14879
|
+
type: "object",
|
|
14880
|
+
properties: {
|
|
14881
|
+
after: integerProp("Cursor; 0 for all retained"),
|
|
14882
|
+
timeoutMs: integerProp("At most 60000; default 0"),
|
|
14883
|
+
limit: integerProp("At most 100")
|
|
14884
|
+
}
|
|
14885
|
+
}
|
|
14886
|
+
}
|
|
14887
|
+
];
|
|
14888
|
+
|
|
14889
|
+
// ../shared-contracts/dist/external-mcp-map.js
|
|
14890
|
+
var DEFAULT_WATCH_MS = 29 * 6e4;
|
|
14891
|
+
|
|
14695
14892
|
// ../shared-contracts/dist/grok-computer-use.js
|
|
14696
14893
|
var grokComputerUseGetSchema = external_exports.object({}).strict();
|
|
14697
14894
|
var grokComputerUseSetSchema = external_exports.object({
|
|
@@ -15289,6 +15486,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15289
15486
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15290
15487
|
}).strict();
|
|
15291
15488
|
|
|
15489
|
+
// ../shared-contracts/dist/voice-settings.js
|
|
15490
|
+
var VOICE_GATEWAY_STATUS_METHOD = "codexhost/voice/gateway-status";
|
|
15491
|
+
var voiceRoutesSchema = external_exports.strictObject({
|
|
15492
|
+
chatExperience: external_exports.enum(["chatgpt", "codex"]),
|
|
15493
|
+
chatConnection: external_exports.enum(["desktop", "gateway"]),
|
|
15494
|
+
workConnection: external_exports.enum(["desktop", "gateway"])
|
|
15495
|
+
});
|
|
15496
|
+
var DEFAULT_VOICE_ROUTES = Object.freeze({
|
|
15497
|
+
chatExperience: "chatgpt",
|
|
15498
|
+
chatConnection: "desktop",
|
|
15499
|
+
workConnection: "gateway"
|
|
15500
|
+
});
|
|
15501
|
+
var voiceSettingsSchema = voiceRoutesSchema.extend({ inject: external_exports.boolean() });
|
|
15502
|
+
var voiceSettingsRequestSchema = external_exports.discriminatedUnion("operation", [
|
|
15503
|
+
external_exports.strictObject({
|
|
15504
|
+
operation: external_exports.literal("get"),
|
|
15505
|
+
runtime: external_exports.strictObject({
|
|
15506
|
+
id: external_exports.string().uuid(),
|
|
15507
|
+
revision: external_exports.string().max(64),
|
|
15508
|
+
activeCall: external_exports.boolean()
|
|
15509
|
+
}).optional()
|
|
15510
|
+
}),
|
|
15511
|
+
external_exports.strictObject({ operation: external_exports.literal("migrate"), routes: voiceRoutesSchema }),
|
|
15512
|
+
external_exports.strictObject({
|
|
15513
|
+
operation: external_exports.literal("set"),
|
|
15514
|
+
settings: voiceSettingsSchema,
|
|
15515
|
+
revision: external_exports.string().max(64)
|
|
15516
|
+
}),
|
|
15517
|
+
external_exports.strictObject({ operation: external_exports.literal("restart"), confirm: external_exports.literal(true) })
|
|
15518
|
+
]);
|
|
15519
|
+
var voiceSettingsStateSchema = external_exports.strictObject({
|
|
15520
|
+
settings: voiceSettingsSchema,
|
|
15521
|
+
initialized: external_exports.boolean(),
|
|
15522
|
+
revision: external_exports.string(),
|
|
15523
|
+
activeInject: external_exports.boolean().nullable(),
|
|
15524
|
+
envOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
15525
|
+
activeEnvOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
15526
|
+
routesActive: external_exports.boolean().nullable(),
|
|
15527
|
+
activeCall: external_exports.boolean().nullable(),
|
|
15528
|
+
gatewayReady: external_exports.boolean().nullable(),
|
|
15529
|
+
restartAvailable: external_exports.boolean(),
|
|
15530
|
+
restart: external_exports.strictObject({
|
|
15531
|
+
phase: external_exports.enum(["idle", "restarting", "succeeded", "failed"]),
|
|
15532
|
+
error: external_exports.string().nullable()
|
|
15533
|
+
})
|
|
15534
|
+
});
|
|
15535
|
+
|
|
15292
15536
|
// ../shared-contracts/dist/client-channel.js
|
|
15293
15537
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15294
15538
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -16066,6 +16310,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16066
16310
|
"codexhost/voice/gateway-status",
|
|
16067
16311
|
"codexhost/enrollment/list",
|
|
16068
16312
|
"codexhost/enrollment/revoke",
|
|
16313
|
+
"codexhost/external-clients/list",
|
|
16314
|
+
"codexhost/external-clients/create",
|
|
16315
|
+
"codexhost/external-clients/update",
|
|
16316
|
+
"codexhost/external-clients/revoke",
|
|
16069
16317
|
"codexhost/console/remote-connections",
|
|
16070
16318
|
"codexhost/runtime/status",
|
|
16071
16319
|
"codexhost/remote/ssh-setup",
|
|
@@ -16766,53 +17014,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16766
17014
|
var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
|
|
16767
17015
|
var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
|
|
16768
17016
|
|
|
16769
|
-
// ../shared-contracts/dist/voice-settings.js
|
|
16770
|
-
var VOICE_GATEWAY_STATUS_METHOD = "codexhost/voice/gateway-status";
|
|
16771
|
-
var voiceRoutesSchema = external_exports.strictObject({
|
|
16772
|
-
chatExperience: external_exports.enum(["chatgpt", "codex"]),
|
|
16773
|
-
chatConnection: external_exports.enum(["desktop", "gateway"]),
|
|
16774
|
-
workConnection: external_exports.enum(["desktop", "gateway"])
|
|
16775
|
-
});
|
|
16776
|
-
var DEFAULT_VOICE_ROUTES = Object.freeze({
|
|
16777
|
-
chatExperience: "chatgpt",
|
|
16778
|
-
chatConnection: "desktop",
|
|
16779
|
-
workConnection: "gateway"
|
|
16780
|
-
});
|
|
16781
|
-
var voiceSettingsSchema = voiceRoutesSchema.extend({ inject: external_exports.boolean() });
|
|
16782
|
-
var voiceSettingsRequestSchema = external_exports.discriminatedUnion("operation", [
|
|
16783
|
-
external_exports.strictObject({
|
|
16784
|
-
operation: external_exports.literal("get"),
|
|
16785
|
-
runtime: external_exports.strictObject({
|
|
16786
|
-
id: external_exports.string().uuid(),
|
|
16787
|
-
revision: external_exports.string().max(64),
|
|
16788
|
-
activeCall: external_exports.boolean()
|
|
16789
|
-
}).optional()
|
|
16790
|
-
}),
|
|
16791
|
-
external_exports.strictObject({ operation: external_exports.literal("migrate"), routes: voiceRoutesSchema }),
|
|
16792
|
-
external_exports.strictObject({
|
|
16793
|
-
operation: external_exports.literal("set"),
|
|
16794
|
-
settings: voiceSettingsSchema,
|
|
16795
|
-
revision: external_exports.string().max(64)
|
|
16796
|
-
}),
|
|
16797
|
-
external_exports.strictObject({ operation: external_exports.literal("restart"), confirm: external_exports.literal(true) })
|
|
16798
|
-
]);
|
|
16799
|
-
var voiceSettingsStateSchema = external_exports.strictObject({
|
|
16800
|
-
settings: voiceSettingsSchema,
|
|
16801
|
-
initialized: external_exports.boolean(),
|
|
16802
|
-
revision: external_exports.string(),
|
|
16803
|
-
activeInject: external_exports.boolean().nullable(),
|
|
16804
|
-
envOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
16805
|
-
activeEnvOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
16806
|
-
routesActive: external_exports.boolean().nullable(),
|
|
16807
|
-
activeCall: external_exports.boolean().nullable(),
|
|
16808
|
-
gatewayReady: external_exports.boolean().nullable(),
|
|
16809
|
-
restartAvailable: external_exports.boolean(),
|
|
16810
|
-
restart: external_exports.strictObject({
|
|
16811
|
-
phase: external_exports.enum(["idle", "restarting", "succeeded", "failed"]),
|
|
16812
|
-
error: external_exports.string().nullable()
|
|
16813
|
-
})
|
|
16814
|
-
});
|
|
16815
|
-
|
|
16816
17017
|
// ../shared-contracts/dist/background-activity.js
|
|
16817
17018
|
var backgroundActivitySchema = external_exports.strictObject({
|
|
16818
17019
|
id: external_exports.string().min(1),
|
|
@@ -16847,30 +17048,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16847
17048
|
// ../shared-contracts/dist/index.js
|
|
16848
17049
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16849
17050
|
|
|
16850
|
-
// src/renderer-
|
|
16851
|
-
var voiceStateOwner = globalThis;
|
|
16852
|
-
var { sharedRoutes, gatewayReady } = voiceStateOwner.__codexhostVoicePreferenceStateV1 ??= {
|
|
16853
|
-
sharedRoutes: /* @__PURE__ */ new WeakMap(),
|
|
16854
|
-
gatewayReady: /* @__PURE__ */ new WeakMap()
|
|
16855
|
-
};
|
|
17051
|
+
// src/renderer-voice-routes-cache.ts
|
|
16856
17052
|
var SHARED_VOICE_CACHE = "codexhost.voice-routes-cache.v1";
|
|
16857
|
-
|
|
17053
|
+
var CPA_LIVE_VOICE_STORAGE_KEY = "codexhost.cpa-live-voice.v1";
|
|
17054
|
+
var CHAT_LIVE_VOICE_STORAGE_KEY = "codexhost.chat-live-voice.v1";
|
|
17055
|
+
var voiceStateOwner = globalThis;
|
|
17056
|
+
function voicePreferenceState() {
|
|
17057
|
+
return voiceStateOwner.__codexhostVoicePreferenceStateV1 ??= {
|
|
17058
|
+
sharedRoutes: /* @__PURE__ */ new WeakMap(),
|
|
17059
|
+
gatewayReady: /* @__PURE__ */ new WeakMap()
|
|
17060
|
+
};
|
|
17061
|
+
}
|
|
17062
|
+
function parseVoiceRoutes(value) {
|
|
17063
|
+
if (value === null || typeof value !== "object") return;
|
|
17064
|
+
const record5 = value;
|
|
17065
|
+
if (record5.chatExperience !== "chatgpt" && record5.chatExperience !== "codex" || record5.chatConnection !== "desktop" && record5.chatConnection !== "gateway" || record5.workConnection !== "desktop" && record5.workConnection !== "gateway")
|
|
17066
|
+
return;
|
|
17067
|
+
return {
|
|
17068
|
+
chatExperience: record5.chatExperience,
|
|
17069
|
+
chatConnection: record5.chatConnection,
|
|
17070
|
+
workConnection: record5.workConnection
|
|
17071
|
+
};
|
|
17072
|
+
}
|
|
17073
|
+
function cachedVoiceRoutes(owner) {
|
|
17074
|
+
const { sharedRoutes } = voicePreferenceState();
|
|
16858
17075
|
const memory = sharedRoutes.get(owner);
|
|
16859
17076
|
if (memory) return memory;
|
|
16860
17077
|
try {
|
|
16861
17078
|
const storage = owner.localStorage;
|
|
16862
|
-
const parsed =
|
|
16863
|
-
JSON.parse(storage?.getItem(SHARED_VOICE_CACHE) ?? "null")
|
|
16864
|
-
).data;
|
|
17079
|
+
const parsed = parseVoiceRoutes(JSON.parse(storage?.getItem(SHARED_VOICE_CACHE) ?? "null"));
|
|
16865
17080
|
if (parsed) sharedRoutes.set(owner, parsed);
|
|
16866
17081
|
return parsed;
|
|
16867
17082
|
} catch {
|
|
16868
17083
|
return void 0;
|
|
16869
17084
|
}
|
|
16870
17085
|
}
|
|
16871
|
-
|
|
16872
|
-
var CHAT_LIVE_VOICE_STORAGE_KEY = "codexhost.chat-live-voice.v1";
|
|
16873
|
-
function readFlag(owner, key, enabledWhenUnset) {
|
|
17086
|
+
function readVoiceStorageFlag(owner, key, enabledWhenUnset) {
|
|
16874
17087
|
const storage = owner.localStorage;
|
|
16875
17088
|
if (!storage) return enabledWhenUnset;
|
|
16876
17089
|
try {
|
|
@@ -16880,13 +17093,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16880
17093
|
return enabledWhenUnset;
|
|
16881
17094
|
}
|
|
16882
17095
|
}
|
|
17096
|
+
function nativeChatVoicePreferenceAllowsStart(owner) {
|
|
17097
|
+
const routes = cachedVoiceRoutes(owner);
|
|
17098
|
+
return routes ? routes.chatExperience === "chatgpt" : !readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
|
|
17099
|
+
}
|
|
17100
|
+
|
|
17101
|
+
// src/renderer-cpa-live-voice-preference.ts
|
|
16883
17102
|
function readCpaLiveVoicePreference(owner) {
|
|
16884
|
-
const routes =
|
|
16885
|
-
return routes ? routes.workConnection === "gateway" :
|
|
17103
|
+
const routes = cachedVoiceRoutes(owner);
|
|
17104
|
+
return routes ? routes.workConnection === "gateway" : readVoiceStorageFlag(owner, CPA_LIVE_VOICE_STORAGE_KEY, true);
|
|
16886
17105
|
}
|
|
16887
17106
|
function readChatLiveVoicePreference(owner) {
|
|
16888
|
-
const routes =
|
|
16889
|
-
return routes ? routes.chatExperience === "codex" && routes.chatConnection === "gateway" :
|
|
17107
|
+
const routes = cachedVoiceRoutes(owner);
|
|
17108
|
+
return routes ? routes.chatExperience === "codex" && routes.chatConnection === "gateway" : readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
|
|
16890
17109
|
}
|
|
16891
17110
|
function cpaLiveVoicePreferenceAllowsInstall(globalObject) {
|
|
16892
17111
|
return readCpaLiveVoicePreference(globalObject);
|
|
@@ -16895,13 +17114,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16895
17114
|
return readChatLiveVoicePreference(globalObject);
|
|
16896
17115
|
}
|
|
16897
17116
|
|
|
16898
|
-
// src/renderer-cpa-live-voice-
|
|
17117
|
+
// src/renderer-cpa-live-voice-config.ts
|
|
16899
17118
|
var CPA_LIVE_VOICE_HOOK_GLOBAL = "__codexhostCpaLiveVoiceHookV1";
|
|
16900
|
-
var
|
|
16901
|
-
var
|
|
16902
|
-
var
|
|
16903
|
-
|
|
16904
|
-
|
|
17119
|
+
var ISOLATED_VOICE_PATHS = ["chat", "work-codex", "work-grok"];
|
|
17120
|
+
var PRODUCTION_DESKTOP_APP_PATH = "/Applications/ChatGPT.app";
|
|
17121
|
+
var PRODUCTION_WINDOWS_APPX_PATH = /(?:^|[\\/])WindowsApps[\\/]OpenAI\.(?:Codex|ChatGPT)_/i;
|
|
17122
|
+
function isProductionDesktopAppPath(appPath) {
|
|
17123
|
+
if (typeof appPath !== "string" || appPath.length === 0) return false;
|
|
17124
|
+
if (appPath === PRODUCTION_DESKTOP_APP_PATH) return true;
|
|
17125
|
+
return PRODUCTION_WINDOWS_APPX_PATH.test(appPath);
|
|
17126
|
+
}
|
|
16905
17127
|
function isRecord(value) {
|
|
16906
17128
|
return typeof value === "object" && value !== null;
|
|
16907
17129
|
}
|
|
@@ -16916,8 +17138,59 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16916
17138
|
auditedDesktopVersion: value.auditedDesktopVersion,
|
|
16917
17139
|
auditedAppInitialAsset: value.auditedAppInitialAsset,
|
|
16918
17140
|
...typeof value.desktopPlatform === "string" ? { desktopPlatform: value.desktopPlatform } : {},
|
|
16919
|
-
...typeof value.desktopVersion === "string" ? { desktopVersion: value.desktopVersion } : {}
|
|
16920
|
-
|
|
17141
|
+
...typeof value.desktopVersion === "string" ? { desktopVersion: value.desktopVersion } : {},
|
|
17142
|
+
...typeof value.desktopBuild === "string" ? { desktopBuild: value.desktopBuild } : {},
|
|
17143
|
+
...typeof value.asarDigest === "string" ? { asarDigest: value.asarDigest } : {},
|
|
17144
|
+
...typeof value.implementationRevision === "string" ? { implementationRevision: value.implementationRevision } : {},
|
|
17145
|
+
...typeof value.desktopAppPath === "string" ? { desktopAppPath: value.desktopAppPath } : {},
|
|
17146
|
+
...Array.isArray(value.voiceEvidence) ? { voiceEvidence: value.voiceEvidence } : {},
|
|
17147
|
+
...isIsolatedVoiceQualification(value.isolatedQualification) ? { isolatedQualification: value.isolatedQualification } : {}
|
|
17148
|
+
};
|
|
17149
|
+
}
|
|
17150
|
+
function isIsolatedVoicePath(value) {
|
|
17151
|
+
return value === "chat" || value === "work-codex" || value === "work-grok";
|
|
17152
|
+
}
|
|
17153
|
+
function isIsolatedDesktopPlatform(value) {
|
|
17154
|
+
return value === "darwin" || value === "win32" || value === "linux";
|
|
17155
|
+
}
|
|
17156
|
+
function isolatedQualificationExpiresAtMs(expiresAt) {
|
|
17157
|
+
if (typeof expiresAt !== "string" || expiresAt.length === 0) return void 0;
|
|
17158
|
+
const parsed = Date.parse(expiresAt);
|
|
17159
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
17160
|
+
}
|
|
17161
|
+
function isolatedQualificationPathSet(value) {
|
|
17162
|
+
if (!isRecord(value)) return void 0;
|
|
17163
|
+
const pathsPresent = value.paths !== void 0;
|
|
17164
|
+
const pathPresent = value.path !== void 0;
|
|
17165
|
+
let listed;
|
|
17166
|
+
if (pathsPresent) {
|
|
17167
|
+
if (!Array.isArray(value.paths) || value.paths.length === 0) return void 0;
|
|
17168
|
+
if (value.paths.some((path) => !isIsolatedVoicePath(path))) return void 0;
|
|
17169
|
+
if (new Set(value.paths).size !== value.paths.length) return void 0;
|
|
17170
|
+
listed = ISOLATED_VOICE_PATHS.filter((path) => value.paths.includes(path));
|
|
17171
|
+
if (listed.length !== value.paths.length) return void 0;
|
|
17172
|
+
} else if (pathPresent) {
|
|
17173
|
+
if (!isIsolatedVoicePath(value.path)) return void 0;
|
|
17174
|
+
listed = [value.path];
|
|
17175
|
+
} else {
|
|
17176
|
+
return void 0;
|
|
17177
|
+
}
|
|
17178
|
+
if (pathPresent) {
|
|
17179
|
+
if (!isIsolatedVoicePath(value.path) || !listed.includes(value.path)) return void 0;
|
|
17180
|
+
}
|
|
17181
|
+
return listed;
|
|
17182
|
+
}
|
|
17183
|
+
function isolatedQualificationPaths(isolated) {
|
|
17184
|
+
return isolatedQualificationPathSet(isolated) ?? [];
|
|
17185
|
+
}
|
|
17186
|
+
function isIsolatedVoiceQualification(value, now = Date.now()) {
|
|
17187
|
+
if (!isRecord(value)) return false;
|
|
17188
|
+
const paths = isolatedQualificationPathSet(value);
|
|
17189
|
+
if (!paths || paths.length === 0) return false;
|
|
17190
|
+
if (typeof value.appPath === "string" && isProductionDesktopAppPath(value.appPath)) return false;
|
|
17191
|
+
const expiresAtMs = isolatedQualificationExpiresAtMs(value.expiresAt);
|
|
17192
|
+
if (expiresAtMs === void 0 || expiresAtMs <= now) return false;
|
|
17193
|
+
return typeof value.run === "string" && value.run.length > 0 && isIsolatedDesktopPlatform(value.desktopPlatform) && typeof value.desktopVersion === "string" && typeof value.desktopBuild === "string" && typeof value.asarDigest === "string" && typeof value.appPath === "string" && typeof value.implementationRevision === "string" && value.label === "unqualified-isolated";
|
|
16921
17194
|
}
|
|
16922
17195
|
function auditedAppInitialAssetPresent(resourceNames, asset) {
|
|
16923
17196
|
return resourceNames.some((name) => {
|
|
@@ -16954,132 +17227,215 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16954
17227
|
}
|
|
16955
17228
|
return names;
|
|
16956
17229
|
}
|
|
16957
|
-
function statsigClients(globalObject) {
|
|
16958
|
-
const registry2 = globalObject.__STATSIG__;
|
|
16959
|
-
if (!isRecord(registry2)) return [];
|
|
16960
|
-
const clients = new Set(
|
|
16961
|
-
isRecord(registry2.instances) ? Object.values(registry2.instances) : []
|
|
16962
|
-
);
|
|
16963
|
-
if (registry2.firstInstance) clients.add(registry2.firstInstance);
|
|
16964
|
-
return [...clients].filter(
|
|
16965
|
-
(client) => isRecord(client) && typeof client.checkGate === "function"
|
|
16966
|
-
);
|
|
16967
|
-
}
|
|
16968
|
-
function wrapCheckGate(client) {
|
|
16969
|
-
if (originalCheckGate.has(client)) return false;
|
|
16970
|
-
const original = client.checkGate;
|
|
16971
|
-
originalCheckGate.set(client, original);
|
|
16972
|
-
client.checkGate = function(name, ...rest) {
|
|
16973
|
-
return name === THREAD_REALTIME_EXISTING_CALL_GATE ? false : original.call(this, name, ...rest);
|
|
16974
|
-
};
|
|
16975
|
-
return true;
|
|
16976
|
-
}
|
|
16977
|
-
function restoreCheckGate(client) {
|
|
16978
|
-
const original = originalCheckGate.get(client);
|
|
16979
|
-
if (!original) return;
|
|
16980
|
-
client.checkGate = original;
|
|
16981
|
-
originalCheckGate.delete(client);
|
|
16982
|
-
}
|
|
16983
|
-
function configAllowsInstall(config2, resourceNames) {
|
|
16984
|
-
if (config2.desktopVersion !== void 0 && config2.desktopVersion !== config2.auditedDesktopVersion) {
|
|
16985
|
-
return false;
|
|
16986
|
-
}
|
|
16987
|
-
if (config2.auditedDesktopVersion !== AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION) return false;
|
|
16988
|
-
if (config2.auditedAppInitialAsset !== AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET) return false;
|
|
16989
|
-
return auditedAppInitialAssetPresent(resourceNames, config2.auditedAppInitialAsset);
|
|
16990
|
-
}
|
|
16991
|
-
function installCpaLiveVoiceHook(options = {}) {
|
|
16992
|
-
const globalObject = options.globalThis ?? globalThis;
|
|
16993
|
-
const config2 = options.config === void 0 ? readCpaLiveVoiceHookConfig(globalObject) : options.config;
|
|
16994
|
-
if (!config2?.enabled || !cpaLiveVoicePreferenceAllowsInstall(globalObject)) {
|
|
16995
|
-
return { status: "disabled", dispose() {
|
|
16996
|
-
} };
|
|
16997
|
-
}
|
|
16998
|
-
const root = options.document ?? globalObject.document;
|
|
16999
|
-
const wrapped = [];
|
|
17000
|
-
let disposed = false;
|
|
17001
|
-
let auditedAssetFound = false;
|
|
17002
|
-
const handle = {
|
|
17003
|
-
status: "pending",
|
|
17004
|
-
dispose() {
|
|
17005
|
-
disposed = true;
|
|
17006
|
-
for (const client of wrapped) restoreCheckGate(client);
|
|
17007
|
-
wrapped.length = 0;
|
|
17008
|
-
}
|
|
17009
|
-
};
|
|
17010
|
-
const attempt = () => {
|
|
17011
|
-
if (!auditedAssetFound) {
|
|
17012
|
-
const resourceNames = options.resourceNames ?? loadedAssetNames(root);
|
|
17013
|
-
auditedAssetFound = configAllowsInstall(config2, resourceNames);
|
|
17014
|
-
if (!auditedAssetFound) return false;
|
|
17015
|
-
}
|
|
17016
|
-
for (const client of statsigClients(globalObject)) {
|
|
17017
|
-
if (wrapCheckGate(client)) wrapped.push(client);
|
|
17018
|
-
}
|
|
17019
|
-
if (wrapped.length === 0) return false;
|
|
17020
|
-
handle.status = "active";
|
|
17021
|
-
return true;
|
|
17022
|
-
};
|
|
17023
|
-
if (attempt()) return handle;
|
|
17024
|
-
if (options.resourceNames && !configAllowsInstall(config2, options.resourceNames)) {
|
|
17025
|
-
handle.status = "unsupported";
|
|
17026
|
-
return handle;
|
|
17027
|
-
}
|
|
17028
|
-
const started = Date.now();
|
|
17029
|
-
const tick = () => {
|
|
17030
|
-
if (disposed || attempt()) return;
|
|
17031
|
-
if (Date.now() - started > DISCOVERY_TIMEOUT_MS) {
|
|
17032
|
-
handle.status = "unsupported";
|
|
17033
|
-
return;
|
|
17034
|
-
}
|
|
17035
|
-
globalThis.setTimeout(tick, 250);
|
|
17036
|
-
};
|
|
17037
|
-
globalThis.setTimeout(tick, 250);
|
|
17038
|
-
return handle;
|
|
17039
|
-
}
|
|
17040
17230
|
|
|
17041
|
-
// src/renderer-voice-
|
|
17042
|
-
|
|
17043
|
-
return version2 === void 0 || profiles.some((profile) => profile.version === version2);
|
|
17044
|
-
}
|
|
17045
|
-
function selectVoiceAssets(profiles, names, version2, platform) {
|
|
17046
|
-
const present = profiles.filter(
|
|
17047
|
-
(profile) => [profile.initial, profile.shared].some((asset) => auditedAppInitialAssetPresent(names, asset))
|
|
17048
|
-
);
|
|
17049
|
-
const matchesMetadata = (profile) => (version2 === void 0 || profile.version === version2) && (platform === void 0 || profile.platform === platform);
|
|
17050
|
-
if (present.length > 0) {
|
|
17051
|
-
const profile = present.length === 1 ? present[0] : void 0;
|
|
17052
|
-
if (!profile || !matchesMetadata(profile)) return void 0;
|
|
17053
|
-
const initialPresent = auditedAppInitialAssetPresent(names, profile.initial);
|
|
17054
|
-
const sharedPresent = auditedAppInitialAssetPresent(names, profile.shared);
|
|
17055
|
-
return sharedPresent && (initialPresent || version2 !== void 0 && platform !== void 0) ? profile : void 0;
|
|
17056
|
-
}
|
|
17057
|
-
if (version2 === void 0) return void 0;
|
|
17058
|
-
const candidates = profiles.filter(matchesMetadata);
|
|
17059
|
-
return candidates.length === 1 ? candidates[0] : void 0;
|
|
17060
|
-
}
|
|
17231
|
+
// src/renderer-voice-implementation-revision.generated.ts
|
|
17232
|
+
var VOICE_IMPLEMENTATION_REVISION = "0a2ee1b441686523";
|
|
17061
17233
|
|
|
17062
|
-
// src/renderer-
|
|
17063
|
-
var
|
|
17064
|
-
var
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17234
|
+
// src/renderer-voice-profiles.ts
|
|
17235
|
+
var NATIVE_CHAT_VOICE_VERSION = "26.1027.61615";
|
|
17236
|
+
var NATIVE_CHAT_INITIAL_ASSET = "app-initial-18b189e867e7.js";
|
|
17237
|
+
var START_ASSET = "start-voice-221a396d38a5.js";
|
|
17238
|
+
var BASELINE_NAMED_CHAT_ROLES = {
|
|
17239
|
+
initializeFrom: "initial",
|
|
17240
|
+
initialize: "oT",
|
|
17241
|
+
startShape: "module",
|
|
17242
|
+
voiceSessionSelector: "SPn",
|
|
17243
|
+
reactFactory: "FBt",
|
|
17244
|
+
reactDomFactory: "PNt",
|
|
17245
|
+
prewarmController: "VoiceInstantConnectCacheController",
|
|
17246
|
+
initial: {
|
|
17247
|
+
MOr: "MOr",
|
|
17248
|
+
CDr: "CDr",
|
|
17249
|
+
B1n: "B1n",
|
|
17250
|
+
SPn: "SPn",
|
|
17251
|
+
oTFrom: "initial",
|
|
17252
|
+
oT: "oT",
|
|
17253
|
+
aTFrom: "initial",
|
|
17254
|
+
aT: "aT",
|
|
17255
|
+
Ycr: "Ycr",
|
|
17256
|
+
Nir: "Nir",
|
|
17257
|
+
n0n: "n0n",
|
|
17258
|
+
Y1n: "Y1n",
|
|
17259
|
+
HJt: "HJt"
|
|
17260
|
+
},
|
|
17261
|
+
shared: { Qst: "Qst", FBt: "FBt", PNt: "PNt", Vot: "Vot" }
|
|
17262
|
+
};
|
|
17263
|
+
var NAMED_CHAT_ROLES_26_1027_61615 = {
|
|
17264
|
+
initializeFrom: "primary",
|
|
17265
|
+
initialize: "Qp",
|
|
17266
|
+
startShape: "module",
|
|
17267
|
+
voiceSessionSelector: "etn",
|
|
17268
|
+
reactFactory: "pWt",
|
|
17269
|
+
reactDomFactory: "GFt",
|
|
17270
|
+
prewarmController: "VoiceInstantConnectCacheController",
|
|
17271
|
+
initial: {
|
|
17272
|
+
MOr: "p5n",
|
|
17273
|
+
CDr: "w6n",
|
|
17274
|
+
B1n: "_On",
|
|
17275
|
+
SPn: "etn",
|
|
17276
|
+
oTFrom: "primary",
|
|
17277
|
+
oT: "Qp",
|
|
17278
|
+
aTFrom: "primary",
|
|
17279
|
+
aT: "Zp",
|
|
17280
|
+
Ycr: "ofr",
|
|
17281
|
+
Nir: "yEn",
|
|
17282
|
+
n0n: "FOn",
|
|
17283
|
+
Y1n: "JOn",
|
|
17284
|
+
HJt: "Z6"
|
|
17285
|
+
},
|
|
17286
|
+
shared: { Qst: "klt", FBt: "pWt", PNt: "GFt", Vot: "_ct" }
|
|
17287
|
+
};
|
|
17288
|
+
var NAMED_CHAT_ROLES_26_1027_30824 = {
|
|
17289
|
+
initializeFrom: "primary",
|
|
17290
|
+
initialize: "Yp",
|
|
17291
|
+
startShape: "module",
|
|
17292
|
+
voiceSessionSelector: "Xen",
|
|
17293
|
+
reactFactory: "pWt",
|
|
17294
|
+
reactDomFactory: "GFt",
|
|
17295
|
+
prewarmController: "VoiceInstantConnectCacheController",
|
|
17296
|
+
initial: {
|
|
17297
|
+
MOr: "l5n",
|
|
17298
|
+
CDr: "b6n",
|
|
17299
|
+
B1n: "pOn",
|
|
17300
|
+
SPn: "Xen",
|
|
17301
|
+
oTFrom: "primary",
|
|
17302
|
+
oT: "Yp",
|
|
17303
|
+
aTFrom: "primary",
|
|
17304
|
+
aT: "Jp",
|
|
17305
|
+
Ycr: "nfr",
|
|
17306
|
+
Nir: "hEn",
|
|
17307
|
+
n0n: "jOn",
|
|
17308
|
+
Y1n: "wOn",
|
|
17309
|
+
HJt: "J6"
|
|
17310
|
+
},
|
|
17311
|
+
shared: { Qst: "klt", FBt: "pWt", PNt: "GFt", Vot: "_ct" }
|
|
17312
|
+
};
|
|
17313
|
+
var NAMED_CHAT_ROLES_26_1023_51421 = {
|
|
17314
|
+
initializeFrom: "primary",
|
|
17315
|
+
initialize: "gm",
|
|
17316
|
+
startShape: "module",
|
|
17317
|
+
voiceSessionSelector: "s$t",
|
|
17318
|
+
reactFactory: "OHt",
|
|
17319
|
+
reactDomFactory: "wPt",
|
|
17320
|
+
prewarmController: "VoiceInstantConnectCacheController",
|
|
17321
|
+
initial: {
|
|
17322
|
+
MOr: "x1n",
|
|
17323
|
+
CDr: "MQn",
|
|
17324
|
+
B1n: "Opn",
|
|
17325
|
+
SPn: "s$t",
|
|
17326
|
+
oTFrom: "primary",
|
|
17327
|
+
oT: "gm",
|
|
17328
|
+
aTFrom: "primary",
|
|
17329
|
+
aT: "hm",
|
|
17330
|
+
Ycr: "Zir",
|
|
17331
|
+
Nir: "ejn",
|
|
17332
|
+
n0n: "Kpn",
|
|
17333
|
+
Y1n: "zpn",
|
|
17334
|
+
HJt: "k3"
|
|
17335
|
+
},
|
|
17336
|
+
shared: { Qst: "uct", FBt: "OHt", PNt: "wPt", Vot: "ast" }
|
|
17337
|
+
};
|
|
17338
|
+
var NAMED_CHAT_ROLES_26_1021_31345 = {
|
|
17339
|
+
initializeFrom: "primary",
|
|
17340
|
+
initialize: "um",
|
|
17341
|
+
startShape: "entityBusiness",
|
|
17342
|
+
startT: "r",
|
|
17343
|
+
startN: "i",
|
|
17344
|
+
voiceSessionSelector: "qXt",
|
|
17345
|
+
reactFactory: "XVt",
|
|
17346
|
+
reactDomFactory: "KNt",
|
|
17347
|
+
prewarmController: "VoiceInstantConnectCacheController",
|
|
17348
|
+
initial: {
|
|
17349
|
+
MOr: "CQn",
|
|
17350
|
+
CDr: "PXn",
|
|
17351
|
+
B1n: "tdn",
|
|
17352
|
+
SPn: "qXt",
|
|
17353
|
+
oTFrom: "primary",
|
|
17354
|
+
oT: "um",
|
|
17355
|
+
aTFrom: "primary",
|
|
17356
|
+
aT: "lm",
|
|
17357
|
+
Ycr: "Xkn",
|
|
17358
|
+
Nir: "yAn",
|
|
17359
|
+
n0n: "ydn",
|
|
17360
|
+
Y1n: "fdn",
|
|
17361
|
+
HJt: "R2"
|
|
17362
|
+
},
|
|
17363
|
+
shared: { Qst: "Bst", FBt: "XVt", PNt: "KNt", Vot: "Fot" }
|
|
17364
|
+
};
|
|
17365
|
+
var NATIVE_CHAT_VOICE_ASSETS = [
|
|
17366
|
+
{
|
|
17367
|
+
platform: "darwin",
|
|
17368
|
+
version: NATIVE_CHAT_VOICE_VERSION,
|
|
17369
|
+
initial: NATIVE_CHAT_INITIAL_ASSET,
|
|
17370
|
+
shared: "app-shared-601019a330d7.js",
|
|
17371
|
+
primary: "app-primary-75d53eef2374.js",
|
|
17372
|
+
start: START_ASSET,
|
|
17373
|
+
prewarm: "voice-prewarm-a7cd5160219e.js",
|
|
17374
|
+
settings: "voice-settings-320cf1212f2c.js",
|
|
17375
|
+
roles: NAMED_CHAT_ROLES_26_1027_61615
|
|
17376
|
+
},
|
|
17377
|
+
{
|
|
17378
|
+
platform: "darwin",
|
|
17379
|
+
version: "26.1027.30824",
|
|
17380
|
+
initial: "app-initial-60f141238751.js",
|
|
17381
|
+
shared: "app-shared-7815d5a1a42a.js",
|
|
17382
|
+
primary: "app-primary-95a0e6d83f1e.js",
|
|
17383
|
+
start: "start-voice-4c77215aa289.js",
|
|
17384
|
+
prewarm: "voice-prewarm-e49220ad61bd.js",
|
|
17385
|
+
roles: NAMED_CHAT_ROLES_26_1027_30824
|
|
17386
|
+
},
|
|
17387
|
+
{
|
|
17388
|
+
platform: "darwin",
|
|
17389
|
+
version: "26.1023.51421",
|
|
17390
|
+
initial: "app-initial-bc8256c3cccb.js",
|
|
17391
|
+
shared: "app-shared-e9f258fd3588.js",
|
|
17392
|
+
primary: "app-primary-b7f335b763ca.js",
|
|
17393
|
+
start: "start-voice-a0564cefdc95.js",
|
|
17394
|
+
prewarm: "voice-prewarm-53aefded152c.js",
|
|
17395
|
+
settings: "voice-settings-1a9f68eb7ae8.js",
|
|
17396
|
+
roles: NAMED_CHAT_ROLES_26_1023_51421
|
|
17397
|
+
},
|
|
17398
|
+
{
|
|
17399
|
+
platform: "darwin",
|
|
17400
|
+
version: "26.1021.31345",
|
|
17401
|
+
initial: "app-initial-feb30b196d11.js",
|
|
17402
|
+
shared: "app-shared-2cae01273bae.js",
|
|
17403
|
+
primary: "app-primary-7d7313419f84.js",
|
|
17404
|
+
start: "entity-business-profile-reference-b68063dfc05d.js",
|
|
17405
|
+
prewarm: "voice-prewarm-d672f1245523.js",
|
|
17406
|
+
settings: "voice-settings-14000f5c9fc2.js",
|
|
17407
|
+
roles: NAMED_CHAT_ROLES_26_1021_31345
|
|
17408
|
+
},
|
|
17409
|
+
{
|
|
17410
|
+
platform: "win32",
|
|
17411
|
+
version: "26.1021.31345",
|
|
17412
|
+
initial: "app-initial-438d1df57f70.js",
|
|
17413
|
+
shared: "app-shared-955d52676f9c.js",
|
|
17414
|
+
primary: "app-primary-844e405f2b90.js",
|
|
17415
|
+
start: "entity-business-profile-reference-241c52d811f4.js",
|
|
17416
|
+
prewarm: "voice-prewarm-8b47c50a17ae.js",
|
|
17417
|
+
settings: "voice-settings-b1c1633136a5.js",
|
|
17418
|
+
roles: NAMED_CHAT_ROLES_26_1021_31345
|
|
17419
|
+
},
|
|
17420
|
+
{
|
|
17421
|
+
platform: "darwin",
|
|
17422
|
+
version: "26.1016.62342",
|
|
17423
|
+
initial: "app-initial-dddef47d6ef6.js",
|
|
17424
|
+
shared: "app-shared-fc3316d48427.js",
|
|
17425
|
+
start: "start-voice-7cbf0a39d53b.js",
|
|
17426
|
+
prewarm: "voice-prewarm-5d107129ac1c.js",
|
|
17427
|
+
roles: BASELINE_NAMED_CHAT_ROLES
|
|
17428
|
+
},
|
|
17429
|
+
{
|
|
17430
|
+
platform: "darwin",
|
|
17431
|
+
version: "26.1016.61520",
|
|
17432
|
+
initial: "app-initial-c95ddb62696e.js",
|
|
17433
|
+
shared: "app-shared-2eda13eb7044.js",
|
|
17434
|
+
start: "start-voice-18b08f0acdd7.js",
|
|
17435
|
+
prewarm: "voice-prewarm-94271e581c1b.js",
|
|
17436
|
+
roles: BASELINE_NAMED_CHAT_ROLES
|
|
17075
17437
|
}
|
|
17076
|
-
|
|
17077
|
-
}
|
|
17078
|
-
|
|
17079
|
-
// src/renderer-new-thread-preference.ts
|
|
17080
|
-
var RENDERER_NEW_THREAD_PREFERENCE_KEY = "codexhost.new-thread-preference.v1";
|
|
17081
|
-
|
|
17082
|
-
// src/renderer-client-owned-voice.ts
|
|
17438
|
+
];
|
|
17083
17439
|
var CLIENT_OWNED_VOICE_VERSION = "26.1027.61615";
|
|
17084
17440
|
var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-18b189e867e7.js";
|
|
17085
17441
|
var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-601019a330d7.js";
|
|
@@ -17193,60 +17549,864 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17193
17549
|
inferenceGateFamily: "uBr"
|
|
17194
17550
|
}
|
|
17195
17551
|
];
|
|
17196
|
-
var
|
|
17197
|
-
var
|
|
17198
|
-
var
|
|
17199
|
-
|
|
17552
|
+
var HISTORICAL_CPA_LIVE_VOICE_DESKTOP_VERSION = "26.1007.30912";
|
|
17553
|
+
var HISTORICAL_CPA_LIVE_VOICE_APP_INITIAL_ASSET = "app-initial-6350d04672d0.js";
|
|
17554
|
+
var HASHED_WEBPACK_VOICE_VERSION = "26.1106.51428";
|
|
17555
|
+
var HASHED_WEBPACK_VOICE_RUNTIME_ASSET = "348410.1a97dde15f.js";
|
|
17556
|
+
var HASHED_NATIVE_CHAT_START_ASSET = "530142.1e51e7f4b2.js";
|
|
17557
|
+
var HASHED_NATIVE_CHAT_PREWARM_ASSET = "586788.c871bb9b7d.js";
|
|
17558
|
+
var NATIVE_CHAT_VOICE_CHUNKS = [
|
|
17559
|
+
157963,
|
|
17560
|
+
74692,
|
|
17561
|
+
198336,
|
|
17562
|
+
543449,
|
|
17563
|
+
904485,
|
|
17564
|
+
459859,
|
|
17565
|
+
822019,
|
|
17566
|
+
431137,
|
|
17567
|
+
108823,
|
|
17568
|
+
208490,
|
|
17569
|
+
384218,
|
|
17570
|
+
843292,
|
|
17571
|
+
652289,
|
|
17572
|
+
907652,
|
|
17573
|
+
796195,
|
|
17574
|
+
144338,
|
|
17575
|
+
140959,
|
|
17576
|
+
587936,
|
|
17577
|
+
904817,
|
|
17578
|
+
426774,
|
|
17579
|
+
452048,
|
|
17580
|
+
490954,
|
|
17581
|
+
445991,
|
|
17582
|
+
612928,
|
|
17583
|
+
42903,
|
|
17584
|
+
363341,
|
|
17585
|
+
997826,
|
|
17586
|
+
223736,
|
|
17587
|
+
21878,
|
|
17588
|
+
89655,
|
|
17589
|
+
333490,
|
|
17590
|
+
422391,
|
|
17591
|
+
792483,
|
|
17592
|
+
530142
|
|
17593
|
+
];
|
|
17594
|
+
var HASHED_NATIVE_CHAT_ROLES = {
|
|
17595
|
+
startModuleId: "j9r7",
|
|
17596
|
+
prewarmModuleId: "oWM3",
|
|
17597
|
+
appScopeModuleId: "OWtl",
|
|
17598
|
+
appScopeExport: "u",
|
|
17599
|
+
routeScopeModuleId: "Oj9r",
|
|
17600
|
+
routeScopeExport: "GD",
|
|
17601
|
+
composerScopeModuleId: "Sd8U",
|
|
17602
|
+
composerScopeExport: "PR",
|
|
17603
|
+
storeModuleId: "bgok",
|
|
17604
|
+
storeExport: "MH",
|
|
17605
|
+
runtimeModuleId: "cY1t",
|
|
17606
|
+
runtimeEnableExport: "Iy",
|
|
17607
|
+
runtimeLoaderExport: "Re",
|
|
17608
|
+
reactModuleId: "zd8w",
|
|
17609
|
+
reactDomModuleId: "CE87",
|
|
17610
|
+
startInitializeExport: "initializeVoiceSession",
|
|
17611
|
+
prewarmControllerExport: "VoiceInstantConnectCacheController",
|
|
17612
|
+
/** Conversation store: adopted backend ID, transcript mapping, current node. */
|
|
17613
|
+
conversationModuleId: "MrGp",
|
|
17614
|
+
backendConversationExport: "jS",
|
|
17615
|
+
transcriptMappingExport: "Jv",
|
|
17616
|
+
currentNodeExport: "Od",
|
|
17617
|
+
/** App location atom used as the draft-selection origin. */
|
|
17618
|
+
locationModuleId: "nlNF",
|
|
17619
|
+
locationExport: "x2",
|
|
17620
|
+
/** AppNavigation.navigate(scope, location). */
|
|
17621
|
+
navigationModuleId: "E8Sp",
|
|
17622
|
+
navigationExport: "oo",
|
|
17623
|
+
/** `/c/:conversationId` builder; not a GPT `/g/` path. */
|
|
17624
|
+
conversationPathModuleId: "jAnS",
|
|
17625
|
+
conversationPathExport: "mv"
|
|
17626
|
+
};
|
|
17627
|
+
var HASHED_OVERLAY_VOICE_ROLES = {
|
|
17628
|
+
fetchFactoryId: "GDNt",
|
|
17629
|
+
fetchExport: "_n",
|
|
17630
|
+
bridgeModuleId: "TL6G",
|
|
17631
|
+
bridgeExport: "O1",
|
|
17632
|
+
responseErrorModuleId: "eShZ",
|
|
17633
|
+
responseErrorExport: "s1",
|
|
17634
|
+
capabilityModuleId: "ChYf",
|
|
17635
|
+
capabilityExport: "G",
|
|
17636
|
+
inferenceGateModuleId: "OMIV",
|
|
17637
|
+
inferenceGateExport: "JW",
|
|
17638
|
+
/** Workspace voice access derived atom `P` via `zTeN.un`; Instant Connect ANDs `Y3.status`. */
|
|
17639
|
+
voiceAccessModuleId: "eFn4",
|
|
17640
|
+
voiceAccessExport: "Y3"
|
|
17641
|
+
};
|
|
17642
|
+
function hashedVoiceCandidateOwner(config2) {
|
|
17643
|
+
return config2.desktopVersion === HASHED_WEBPACK_VOICE_VERSION && (config2.desktopPlatform === "darwin" || config2.desktopPlatform === "win32");
|
|
17644
|
+
}
|
|
17645
|
+
function hashedVoiceProfileSupported(config2) {
|
|
17646
|
+
return config2.desktopVersion === HASHED_WEBPACK_VOICE_VERSION && config2.desktopPlatform === "darwin";
|
|
17647
|
+
}
|
|
17648
|
+
function reviewedOverlayHookDesktopVersions() {
|
|
17649
|
+
const versions = /* @__PURE__ */ new Set([
|
|
17650
|
+
HISTORICAL_CPA_LIVE_VOICE_DESKTOP_VERSION,
|
|
17651
|
+
HASHED_WEBPACK_VOICE_VERSION
|
|
17652
|
+
]);
|
|
17653
|
+
for (const profile of NATIVE_CHAT_VOICE_ASSETS) versions.add(profile.version);
|
|
17654
|
+
for (const profile of CLIENT_OWNED_VOICE_ASSETS) versions.add(profile.version);
|
|
17655
|
+
return [...versions].sort();
|
|
17656
|
+
}
|
|
17657
|
+
var VOICE_PROFILE_PINS = {
|
|
17658
|
+
workVersion: CLIENT_OWNED_VOICE_VERSION,
|
|
17659
|
+
workInitial: CLIENT_OWNED_VOICE_INITIAL_ASSET,
|
|
17660
|
+
workShared: CLIENT_OWNED_VOICE_SHARED_ASSET,
|
|
17661
|
+
overlayAsset: CLIENT_OWNED_VOICE_OVERLAY_ASSET,
|
|
17662
|
+
chatVersion: NATIVE_CHAT_VOICE_VERSION,
|
|
17663
|
+
chatInitial: NATIVE_CHAT_INITIAL_ASSET,
|
|
17664
|
+
chatStart: START_ASSET,
|
|
17665
|
+
hashedVersion: HASHED_WEBPACK_VOICE_VERSION,
|
|
17666
|
+
hashedRuntimeAsset: HASHED_WEBPACK_VOICE_RUNTIME_ASSET,
|
|
17667
|
+
hashedStartAsset: HASHED_NATIVE_CHAT_START_ASSET,
|
|
17668
|
+
hashedPrewarmAsset: HASHED_NATIVE_CHAT_PREWARM_ASSET,
|
|
17669
|
+
historicalCpaVersion: HISTORICAL_CPA_LIVE_VOICE_DESKTOP_VERSION,
|
|
17670
|
+
historicalCpaInitial: HISTORICAL_CPA_LIVE_VOICE_APP_INITIAL_ASSET
|
|
17671
|
+
};
|
|
17672
|
+
var voiceProfilePins = {
|
|
17673
|
+
...VOICE_PROFILE_PINS,
|
|
17674
|
+
overlayHookDesktopVersions: reviewedOverlayHookDesktopVersions()
|
|
17675
|
+
};
|
|
17676
|
+
function nativeChatVoiceKind(config2) {
|
|
17677
|
+
if (!config2.desktopVersion) return void 0;
|
|
17678
|
+
if (hashedVoiceProfileSupported(config2)) return "hashed";
|
|
17679
|
+
if (NATIVE_CHAT_VOICE_ASSETS.some(
|
|
17680
|
+
(profile) => profile.version === config2.desktopVersion && (config2.desktopPlatform === void 0 || profile.platform === config2.desktopPlatform)
|
|
17681
|
+
)) {
|
|
17682
|
+
return "named";
|
|
17683
|
+
}
|
|
17684
|
+
return void 0;
|
|
17685
|
+
}
|
|
17686
|
+
function nativeChatVoiceUnavailableReason(config2) {
|
|
17687
|
+
if (nativeChatVoiceKind(config2)) return void 0;
|
|
17688
|
+
if (!config2.desktopVersion) return "Chat voice is waiting for Desktop identity.";
|
|
17689
|
+
if (config2.desktopVersion === HASHED_WEBPACK_VOICE_VERSION && config2.desktopPlatform === "win32") {
|
|
17690
|
+
return "Chat voice is not qualified on this Windows Desktop.";
|
|
17691
|
+
}
|
|
17692
|
+
return "Chat voice is not qualified on this Desktop.";
|
|
17693
|
+
}
|
|
17694
|
+
function workVoiceUnavailableReason(config2) {
|
|
17695
|
+
if (hashedVoiceProfileSupported(config2)) return void 0;
|
|
17696
|
+
if (config2.desktopVersion !== void 0 && CLIENT_OWNED_VOICE_ASSETS.some(
|
|
17697
|
+
(profile) => profile.version === config2.desktopVersion && (config2.desktopPlatform === void 0 || profile.platform === config2.desktopPlatform)
|
|
17698
|
+
)) {
|
|
17699
|
+
return void 0;
|
|
17700
|
+
}
|
|
17701
|
+
if (!config2.desktopVersion) return "Work voice is waiting for Desktop identity.";
|
|
17702
|
+
if (config2.desktopVersion === HASHED_WEBPACK_VOICE_VERSION && config2.desktopPlatform === "win32") {
|
|
17703
|
+
return "Work voice is not qualified on this Windows Desktop.";
|
|
17704
|
+
}
|
|
17705
|
+
return "Work voice is not qualified on this Desktop.";
|
|
17706
|
+
}
|
|
17707
|
+
function profileIdentityKey(product, platform, version2) {
|
|
17708
|
+
return `${product}:${platform ?? "unknown"}:${version2 ?? "unknown"}`;
|
|
17709
|
+
}
|
|
17710
|
+
function fnv1aHex(value) {
|
|
17711
|
+
let hash2 = 0xcbf29ce484222325n;
|
|
17712
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
17713
|
+
hash2 ^= BigInt(value.charCodeAt(index));
|
|
17714
|
+
hash2 = hash2 * 0x100000001b3n & 0xffffffffffffffffn;
|
|
17715
|
+
}
|
|
17716
|
+
return hash2.toString(16).padStart(16, "0");
|
|
17717
|
+
}
|
|
17718
|
+
function digestJson(value) {
|
|
17719
|
+
return fnv1aHex(JSON.stringify(value));
|
|
17720
|
+
}
|
|
17721
|
+
function legacyRetainedVoiceLanes() {
|
|
17722
|
+
return [
|
|
17723
|
+
...NATIVE_CHAT_VOICE_ASSETS.map((profile) => ({
|
|
17724
|
+
path: "chat",
|
|
17725
|
+
platform: profile.platform,
|
|
17726
|
+
version: profile.version
|
|
17727
|
+
})),
|
|
17728
|
+
...CLIENT_OWNED_VOICE_ASSETS.map((profile) => ({
|
|
17729
|
+
path: "work-codex",
|
|
17730
|
+
platform: profile.platform,
|
|
17731
|
+
version: profile.version
|
|
17732
|
+
}))
|
|
17733
|
+
];
|
|
17734
|
+
}
|
|
17735
|
+
function voiceProfileOwner(product, platform, version2) {
|
|
17736
|
+
if (product === "chat") {
|
|
17737
|
+
if (hashedVoiceCandidateOwner({ desktopVersion: version2, desktopPlatform: platform })) {
|
|
17738
|
+
return {
|
|
17739
|
+
kind: "hashed-chat",
|
|
17740
|
+
platform,
|
|
17741
|
+
version: version2,
|
|
17742
|
+
roles: HASHED_NATIVE_CHAT_ROLES,
|
|
17743
|
+
chunks: [...NATIVE_CHAT_VOICE_CHUNKS],
|
|
17744
|
+
webpack: HASHED_WEBPACK_VOICE_RUNTIME_ASSET,
|
|
17745
|
+
start: HASHED_NATIVE_CHAT_START_ASSET,
|
|
17746
|
+
prewarm: HASHED_NATIVE_CHAT_PREWARM_ASSET
|
|
17747
|
+
};
|
|
17748
|
+
}
|
|
17749
|
+
const named = NATIVE_CHAT_VOICE_ASSETS.find(
|
|
17750
|
+
(profile) => profile.platform === platform && profile.version === version2
|
|
17751
|
+
);
|
|
17752
|
+
if (!named) return void 0;
|
|
17753
|
+
return {
|
|
17754
|
+
kind: "named-chat",
|
|
17755
|
+
platform: named.platform,
|
|
17756
|
+
version: named.version,
|
|
17757
|
+
initial: named.initial,
|
|
17758
|
+
shared: named.shared,
|
|
17759
|
+
primary: named.primary ?? null,
|
|
17760
|
+
start: named.start,
|
|
17761
|
+
prewarm: named.prewarm,
|
|
17762
|
+
settings: named.settings ?? null,
|
|
17763
|
+
roles: named.roles
|
|
17764
|
+
};
|
|
17765
|
+
}
|
|
17766
|
+
const namedWork = CLIENT_OWNED_VOICE_ASSETS.find(
|
|
17767
|
+
(profile) => profile.platform === platform && profile.version === version2
|
|
17768
|
+
);
|
|
17769
|
+
if (namedWork) {
|
|
17770
|
+
return {
|
|
17771
|
+
kind: "named-work",
|
|
17772
|
+
platform: namedWork.platform,
|
|
17773
|
+
version: namedWork.version,
|
|
17774
|
+
initial: namedWork.initial,
|
|
17775
|
+
shared: namedWork.shared,
|
|
17776
|
+
overlay: namedWork.overlay,
|
|
17777
|
+
init: namedWork.init ?? null,
|
|
17778
|
+
fetch: namedWork.fetch,
|
|
17779
|
+
fetchFrom: namedWork.fetchFrom ?? null,
|
|
17780
|
+
bridge: namedWork.bridge,
|
|
17781
|
+
services: namedWork.services,
|
|
17782
|
+
responseError: namedWork.responseError ?? null,
|
|
17783
|
+
responseErrorFrom: namedWork.responseErrorFrom ?? null,
|
|
17784
|
+
capabilityInit: namedWork.capabilityInit,
|
|
17785
|
+
capabilityFamily: namedWork.capabilityFamily,
|
|
17786
|
+
inferenceGateFamily: namedWork.inferenceGateFamily
|
|
17787
|
+
};
|
|
17788
|
+
}
|
|
17789
|
+
if (hashedVoiceCandidateOwner({ desktopVersion: version2, desktopPlatform: platform })) {
|
|
17790
|
+
return {
|
|
17791
|
+
kind: "hashed-work",
|
|
17792
|
+
platform,
|
|
17793
|
+
version: version2,
|
|
17794
|
+
overlay: HASHED_OVERLAY_VOICE_ROLES,
|
|
17795
|
+
webpack: HASHED_WEBPACK_VOICE_RUNTIME_ASSET
|
|
17796
|
+
};
|
|
17797
|
+
}
|
|
17798
|
+
return void 0;
|
|
17799
|
+
}
|
|
17800
|
+
function voiceProfileDigest(product, platform, version2) {
|
|
17801
|
+
const owner = voiceProfileOwner(product, platform, version2);
|
|
17802
|
+
return owner ? digestJson(owner) : void 0;
|
|
17803
|
+
}
|
|
17804
|
+
function voiceImplementationRevision() {
|
|
17805
|
+
return VOICE_IMPLEMENTATION_REVISION;
|
|
17806
|
+
}
|
|
17807
|
+
|
|
17808
|
+
// src/renderer-cpa-live-voice-hook.ts
|
|
17809
|
+
var AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION = HISTORICAL_CPA_LIVE_VOICE_DESKTOP_VERSION;
|
|
17810
|
+
var AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET = HISTORICAL_CPA_LIVE_VOICE_APP_INITIAL_ASSET;
|
|
17811
|
+
var THREAD_REALTIME_EXISTING_CALL_GATE = "206132468";
|
|
17812
|
+
var originalCheckGate = /* @__PURE__ */ new WeakMap();
|
|
17813
|
+
var DISCOVERY_TIMEOUT_MS = 6e4;
|
|
17814
|
+
function isRecord2(value) {
|
|
17815
|
+
return typeof value === "object" && value !== null;
|
|
17816
|
+
}
|
|
17817
|
+
function statsigClients(globalObject) {
|
|
17818
|
+
const registry2 = globalObject.__STATSIG__;
|
|
17819
|
+
if (!isRecord2(registry2)) return [];
|
|
17820
|
+
const clients = new Set(
|
|
17821
|
+
isRecord2(registry2.instances) ? Object.values(registry2.instances) : []
|
|
17822
|
+
);
|
|
17823
|
+
if (registry2.firstInstance) clients.add(registry2.firstInstance);
|
|
17824
|
+
return [...clients].filter(
|
|
17825
|
+
(client) => isRecord2(client) && typeof client.checkGate === "function"
|
|
17826
|
+
);
|
|
17827
|
+
}
|
|
17828
|
+
function wrapCheckGate(client) {
|
|
17829
|
+
if (originalCheckGate.has(client)) return false;
|
|
17830
|
+
const original = client.checkGate;
|
|
17831
|
+
originalCheckGate.set(client, original);
|
|
17832
|
+
client.checkGate = function(name, ...rest) {
|
|
17833
|
+
return name === THREAD_REALTIME_EXISTING_CALL_GATE ? false : original.call(this, name, ...rest);
|
|
17834
|
+
};
|
|
17835
|
+
return true;
|
|
17836
|
+
}
|
|
17837
|
+
function restoreCheckGate(client) {
|
|
17838
|
+
const original = originalCheckGate.get(client);
|
|
17839
|
+
if (!original) return;
|
|
17840
|
+
client.checkGate = original;
|
|
17841
|
+
originalCheckGate.delete(client);
|
|
17842
|
+
}
|
|
17843
|
+
function configAllowsInstall(config2, resourceNames) {
|
|
17844
|
+
if (config2.desktopVersion !== void 0 && config2.desktopVersion !== config2.auditedDesktopVersion) {
|
|
17845
|
+
return false;
|
|
17846
|
+
}
|
|
17847
|
+
if (config2.auditedDesktopVersion !== AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION) return false;
|
|
17848
|
+
if (config2.auditedAppInitialAsset !== AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET) return false;
|
|
17849
|
+
return auditedAppInitialAssetPresent(resourceNames, config2.auditedAppInitialAsset);
|
|
17850
|
+
}
|
|
17851
|
+
function installCpaLiveVoiceHook(options = {}) {
|
|
17852
|
+
const globalObject = options.globalThis ?? globalThis;
|
|
17853
|
+
const config2 = options.config === void 0 ? readCpaLiveVoiceHookConfig(globalObject) : options.config;
|
|
17854
|
+
if (!config2?.enabled || !cpaLiveVoicePreferenceAllowsInstall(globalObject)) {
|
|
17855
|
+
return { status: "disabled", dispose() {
|
|
17856
|
+
} };
|
|
17857
|
+
}
|
|
17858
|
+
const root = options.document ?? globalObject.document;
|
|
17859
|
+
const wrapped = [];
|
|
17860
|
+
let disposed = false;
|
|
17861
|
+
let auditedAssetFound = false;
|
|
17862
|
+
const handle = {
|
|
17863
|
+
status: "pending",
|
|
17864
|
+
dispose() {
|
|
17865
|
+
disposed = true;
|
|
17866
|
+
for (const client of wrapped) restoreCheckGate(client);
|
|
17867
|
+
wrapped.length = 0;
|
|
17868
|
+
}
|
|
17869
|
+
};
|
|
17870
|
+
const attempt = () => {
|
|
17871
|
+
if (!auditedAssetFound) {
|
|
17872
|
+
const resourceNames = options.resourceNames ?? loadedAssetNames(root);
|
|
17873
|
+
auditedAssetFound = configAllowsInstall(config2, resourceNames);
|
|
17874
|
+
if (!auditedAssetFound) return false;
|
|
17875
|
+
}
|
|
17876
|
+
for (const client of statsigClients(globalObject)) {
|
|
17877
|
+
if (wrapCheckGate(client)) wrapped.push(client);
|
|
17878
|
+
}
|
|
17879
|
+
if (wrapped.length === 0) return false;
|
|
17880
|
+
handle.status = "active";
|
|
17881
|
+
return true;
|
|
17882
|
+
};
|
|
17883
|
+
if (attempt()) return handle;
|
|
17884
|
+
if (options.resourceNames && !configAllowsInstall(config2, options.resourceNames)) {
|
|
17885
|
+
handle.status = "unsupported";
|
|
17886
|
+
return handle;
|
|
17887
|
+
}
|
|
17888
|
+
const started = Date.now();
|
|
17889
|
+
const tick = () => {
|
|
17890
|
+
if (disposed || attempt()) return;
|
|
17891
|
+
if (Date.now() - started > DISCOVERY_TIMEOUT_MS) {
|
|
17892
|
+
handle.status = "unsupported";
|
|
17893
|
+
return;
|
|
17894
|
+
}
|
|
17895
|
+
globalThis.setTimeout(tick, 250);
|
|
17896
|
+
};
|
|
17897
|
+
globalThis.setTimeout(tick, 250);
|
|
17898
|
+
return handle;
|
|
17899
|
+
}
|
|
17900
|
+
|
|
17901
|
+
// src/renderer-voice-assets.ts
|
|
17902
|
+
function supportsVoiceVersion(profiles, version2) {
|
|
17903
|
+
return version2 === void 0 || profiles.some((profile) => profile.version === version2);
|
|
17904
|
+
}
|
|
17905
|
+
function selectVoiceAssets(profiles, names, version2, platform) {
|
|
17906
|
+
const present = profiles.filter(
|
|
17907
|
+
(profile) => [profile.initial, profile.shared].some((asset) => auditedAppInitialAssetPresent(names, asset))
|
|
17908
|
+
);
|
|
17909
|
+
const matchesMetadata = (profile) => (version2 === void 0 || profile.version === version2) && (platform === void 0 || profile.platform === platform);
|
|
17910
|
+
if (present.length > 0) {
|
|
17911
|
+
const profile = present.length === 1 ? present[0] : void 0;
|
|
17912
|
+
if (!profile || !matchesMetadata(profile)) return void 0;
|
|
17913
|
+
const initialPresent = auditedAppInitialAssetPresent(names, profile.initial);
|
|
17914
|
+
const sharedPresent = auditedAppInitialAssetPresent(names, profile.shared);
|
|
17915
|
+
return sharedPresent && (initialPresent || version2 !== void 0 && platform !== void 0) ? profile : void 0;
|
|
17916
|
+
}
|
|
17917
|
+
if (version2 === void 0) return void 0;
|
|
17918
|
+
const candidates = profiles.filter(matchesMetadata);
|
|
17919
|
+
return candidates.length === 1 ? candidates[0] : void 0;
|
|
17920
|
+
}
|
|
17921
|
+
|
|
17922
|
+
// src/renderer-voice-evidence.ts
|
|
17923
|
+
var VOICE_EVIDENCE_STAGES = [
|
|
17924
|
+
"structural",
|
|
17925
|
+
"activation",
|
|
17926
|
+
"connection",
|
|
17927
|
+
"identity",
|
|
17928
|
+
"speech",
|
|
17929
|
+
"cleanup"
|
|
17930
|
+
];
|
|
17931
|
+
var REQUIRED_STAGES = VOICE_EVIDENCE_STAGES;
|
|
17932
|
+
function recordObject(value) {
|
|
17200
17933
|
return value !== null && typeof value === "object";
|
|
17201
17934
|
}
|
|
17202
|
-
function
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17935
|
+
function missingStages(record5) {
|
|
17936
|
+
return REQUIRED_STAGES.filter((stage) => record5.stages[stage] !== true);
|
|
17937
|
+
}
|
|
17938
|
+
function productForPath(path) {
|
|
17939
|
+
return path === "chat" ? "chat" : "work";
|
|
17940
|
+
}
|
|
17941
|
+
function evaluateVoiceEvidence(record5) {
|
|
17942
|
+
const expectedKey = profileIdentityKey(
|
|
17943
|
+
productForPath(record5.path),
|
|
17944
|
+
record5.platform,
|
|
17945
|
+
record5.desktopVersion
|
|
17946
|
+
);
|
|
17947
|
+
if (record5.profileKey !== expectedKey) {
|
|
17948
|
+
return {
|
|
17949
|
+
outcome: "mismatch",
|
|
17950
|
+
qualified: false,
|
|
17951
|
+
missing: missingStages(record5),
|
|
17952
|
+
reason: "evidence-profile-mismatch"
|
|
17953
|
+
};
|
|
17954
|
+
}
|
|
17955
|
+
if (typeof record5.implementationRevision !== "string" || record5.implementationRevision === "") {
|
|
17956
|
+
return {
|
|
17957
|
+
outcome: "mismatch",
|
|
17958
|
+
qualified: false,
|
|
17959
|
+
missing: missingStages(record5),
|
|
17960
|
+
reason: "missing-implementation-revision"
|
|
17961
|
+
};
|
|
17962
|
+
}
|
|
17963
|
+
if (record5.policy !== "legacy-retained" && record5.implementationRevision !== voiceImplementationRevision()) {
|
|
17964
|
+
return {
|
|
17965
|
+
outcome: "mismatch",
|
|
17966
|
+
qualified: false,
|
|
17967
|
+
missing: missingStages(record5),
|
|
17968
|
+
reason: "implementation-revision-mismatch"
|
|
17969
|
+
};
|
|
17970
|
+
}
|
|
17971
|
+
if (record5.policy !== "legacy-retained") {
|
|
17972
|
+
if (typeof record5.desktopBuild !== "string" || record5.desktopBuild === "" || typeof record5.asarDigest !== "string" || record5.asarDigest === "") {
|
|
17973
|
+
return {
|
|
17974
|
+
outcome: "mismatch",
|
|
17975
|
+
qualified: false,
|
|
17976
|
+
missing: missingStages(record5),
|
|
17977
|
+
reason: "missing-native-identity"
|
|
17978
|
+
};
|
|
17979
|
+
}
|
|
17980
|
+
}
|
|
17981
|
+
if (typeof record5.profileDigest !== "string" || record5.profileDigest === "") {
|
|
17982
|
+
return {
|
|
17983
|
+
outcome: "mismatch",
|
|
17984
|
+
qualified: false,
|
|
17985
|
+
missing: missingStages(record5),
|
|
17986
|
+
reason: "missing-profile-digest"
|
|
17987
|
+
};
|
|
17988
|
+
}
|
|
17989
|
+
const expectedDigest = voiceProfileDigest(
|
|
17990
|
+
productForPath(record5.path),
|
|
17991
|
+
record5.platform,
|
|
17992
|
+
record5.desktopVersion
|
|
17993
|
+
);
|
|
17994
|
+
if (!expectedDigest || record5.profileDigest !== expectedDigest) {
|
|
17995
|
+
return {
|
|
17996
|
+
outcome: "mismatch",
|
|
17997
|
+
qualified: false,
|
|
17998
|
+
missing: missingStages(record5),
|
|
17999
|
+
reason: "stale-profile-digest"
|
|
18000
|
+
};
|
|
18001
|
+
}
|
|
18002
|
+
if (record5.startAcknowledged === true && record5.connected !== true) {
|
|
18003
|
+
return {
|
|
18004
|
+
outcome: "incomplete",
|
|
18005
|
+
qualified: false,
|
|
18006
|
+
missing: missingStages(record5).length > 0 ? missingStages(record5) : ["connection"],
|
|
18007
|
+
reason: "start-acknowledged-without-connection"
|
|
18008
|
+
};
|
|
18009
|
+
}
|
|
18010
|
+
if (record5.path !== "chat" && record5.gatewayOwned !== true && record5.stages.connection === true) {
|
|
18011
|
+
return {
|
|
18012
|
+
outcome: "incomplete",
|
|
18013
|
+
qualified: false,
|
|
18014
|
+
missing: missingStages(record5).length > 0 ? missingStages(record5) : ["connection"],
|
|
18015
|
+
reason: "route-only-without-connected-gateway"
|
|
18016
|
+
};
|
|
18017
|
+
}
|
|
18018
|
+
if (record5.speech?.attended === true && (!record5.speech.witness || !record5.speech.run)) {
|
|
18019
|
+
return {
|
|
18020
|
+
outcome: "incomplete",
|
|
18021
|
+
qualified: false,
|
|
18022
|
+
missing: missingStages(record5).includes("speech") ? missingStages(record5) : ["speech"],
|
|
18023
|
+
reason: "attended-speech-missing-provenance"
|
|
18024
|
+
};
|
|
18025
|
+
}
|
|
18026
|
+
if (record5.speech && record5.speech.attended !== true) {
|
|
18027
|
+
return {
|
|
18028
|
+
outcome: "incomplete",
|
|
18029
|
+
qualified: false,
|
|
18030
|
+
missing: missingStages(record5),
|
|
18031
|
+
reason: "synthetic-speech-is-not-qualification"
|
|
18032
|
+
};
|
|
18033
|
+
}
|
|
18034
|
+
const missing = missingStages(record5);
|
|
18035
|
+
if (missing.length > 0) {
|
|
18036
|
+
return {
|
|
18037
|
+
outcome: "incomplete",
|
|
18038
|
+
qualified: false,
|
|
18039
|
+
missing,
|
|
18040
|
+
reason: `missing:${missing.join(",")}`
|
|
18041
|
+
};
|
|
18042
|
+
}
|
|
18043
|
+
if (record5.connected !== true || record5.conversationMatched !== true || (record5.path === "chat" ? record5.harnessMatched !== void 0 && record5.harnessMatched !== true : record5.harnessMatched !== true) || record5.speech?.attended !== true || record5.speech.bothDirections !== true || record5.cleanup?.ended !== true || record5.cleanup.microphoneReleased !== true) {
|
|
18044
|
+
return {
|
|
18045
|
+
outcome: "fail",
|
|
18046
|
+
qualified: false,
|
|
18047
|
+
missing: [],
|
|
18048
|
+
reason: "required-assertions-failed"
|
|
18049
|
+
};
|
|
18050
|
+
}
|
|
18051
|
+
return { outcome: "pass", qualified: true, missing: [], reason: "qualified" };
|
|
18052
|
+
}
|
|
18053
|
+
function evidenceMatchesRuntime(record5, config2) {
|
|
18054
|
+
if (record5.platform !== config2.desktopPlatform) return false;
|
|
18055
|
+
if (record5.desktopVersion !== config2.desktopVersion) return false;
|
|
18056
|
+
if (record5.implementationRevision !== config2.implementationRevision) return false;
|
|
18057
|
+
if (record5.policy === "legacy-retained") return true;
|
|
18058
|
+
if (typeof record5.desktopBuild !== "string" || record5.desktopBuild === "" || typeof record5.asarDigest !== "string" || record5.asarDigest === "" || typeof config2.desktopBuild !== "string" || config2.desktopBuild === "" || typeof config2.asarDigest !== "string" || config2.asarDigest === "" || typeof config2.implementationRevision !== "string" || config2.implementationRevision === "") {
|
|
18059
|
+
return false;
|
|
18060
|
+
}
|
|
18061
|
+
return record5.desktopBuild === config2.desktopBuild && record5.asarDigest === config2.asarDigest;
|
|
18062
|
+
}
|
|
18063
|
+
function isolatedVoicePathEnabled(config2, path) {
|
|
18064
|
+
return isolatedQualificationMatches(path, config2);
|
|
18065
|
+
}
|
|
18066
|
+
function isolatedQualificationMatches(path, config2) {
|
|
18067
|
+
const isolated = config2.isolatedQualification;
|
|
18068
|
+
if (!isIsolatedVoiceQualification(isolated)) return false;
|
|
18069
|
+
if (!isolatedQualificationPaths(isolated).includes(path)) return false;
|
|
18070
|
+
if (isProductionDesktopAppPath(isolated.appPath) || isProductionDesktopAppPath(config2.desktopAppPath))
|
|
18071
|
+
return false;
|
|
18072
|
+
if (isolated.desktopPlatform !== config2.desktopPlatform) return false;
|
|
18073
|
+
return isolated.desktopVersion === config2.desktopVersion && isolated.desktopBuild === config2.desktopBuild && isolated.asarDigest === config2.asarDigest && isolated.appPath === config2.desktopAppPath && isolated.implementationRevision === config2.implementationRevision && typeof config2.desktopBuild === "string" && config2.desktopBuild !== "" && typeof config2.asarDigest === "string" && config2.asarDigest !== "" && typeof config2.desktopAppPath === "string" && config2.desktopAppPath !== "" && typeof config2.implementationRevision === "string" && config2.implementationRevision !== "";
|
|
18074
|
+
}
|
|
18075
|
+
function unsupportedReason(path, config2) {
|
|
18076
|
+
if (path === "chat") {
|
|
18077
|
+
return nativeChatVoiceUnavailableReason(config2) ?? "Chat voice is not qualified on this Desktop.";
|
|
18078
|
+
}
|
|
18079
|
+
return workVoiceUnavailableReason(config2) ?? "Work voice is not qualified on this Desktop.";
|
|
18080
|
+
}
|
|
18081
|
+
function decidePath(path, config2, records) {
|
|
18082
|
+
if (!config2.desktopVersion || !config2.desktopPlatform) {
|
|
18083
|
+
return { enabled: false, policy: "unreviewed", reason: "waiting-for-identity" };
|
|
18084
|
+
}
|
|
18085
|
+
const pathRecords = records.filter((record5) => record5.path === path);
|
|
18086
|
+
if (pathRecords.length > 0) {
|
|
18087
|
+
const matching = pathRecords.filter((record6) => evidenceMatchesRuntime(record6, config2));
|
|
18088
|
+
if (matching.length === 0) {
|
|
18089
|
+
return { enabled: false, policy: "unreviewed", reason: "stale-or-wrong-platform-evidence" };
|
|
18090
|
+
}
|
|
18091
|
+
for (const record6 of matching) {
|
|
18092
|
+
const evaluation = evaluateVoiceEvidence(record6);
|
|
18093
|
+
if (!evaluation.qualified) {
|
|
18094
|
+
return { enabled: false, policy: "unreviewed", reason: evaluation.reason };
|
|
18095
|
+
}
|
|
18096
|
+
}
|
|
18097
|
+
const record5 = matching[0];
|
|
18098
|
+
if (!record5) {
|
|
18099
|
+
return { enabled: false, policy: "unreviewed", reason: "missing-evidence" };
|
|
18100
|
+
}
|
|
18101
|
+
if (hashedVoiceCandidateOwner(config2) && !hashedVoiceProfileSupported(config2)) {
|
|
18102
|
+
} else {
|
|
18103
|
+
return {
|
|
18104
|
+
enabled: true,
|
|
18105
|
+
policy: record5.policy === "legacy-retained" ? "legacy-retained" : "reviewed"
|
|
18106
|
+
};
|
|
18107
|
+
}
|
|
18108
|
+
}
|
|
18109
|
+
const digest = voiceProfileDigest(
|
|
18110
|
+
productForPath(path),
|
|
18111
|
+
config2.desktopPlatform,
|
|
18112
|
+
config2.desktopVersion
|
|
18113
|
+
);
|
|
18114
|
+
if (!digest) {
|
|
18115
|
+
return { enabled: false, policy: "unreviewed", reason: unsupportedReason(path, config2) };
|
|
18116
|
+
}
|
|
18117
|
+
const legacy = legacyRetainedVoiceLanes().find(
|
|
18118
|
+
(lane) => lane.path === path && lane.platform === config2.desktopPlatform && lane.version === config2.desktopVersion
|
|
18119
|
+
);
|
|
18120
|
+
if (legacy) {
|
|
18121
|
+
return {
|
|
18122
|
+
enabled: true,
|
|
18123
|
+
policy: "legacy-retained",
|
|
18124
|
+
reason: "legacy-retained-named-profile"
|
|
18125
|
+
};
|
|
18126
|
+
}
|
|
18127
|
+
if (isolatedQualificationMatches(path, config2)) {
|
|
18128
|
+
return {
|
|
18129
|
+
enabled: true,
|
|
18130
|
+
policy: "unreviewed",
|
|
18131
|
+
reason: "isolated-qualification"
|
|
18132
|
+
};
|
|
18133
|
+
}
|
|
18134
|
+
return { enabled: false, policy: "unreviewed", reason: "missing-evidence" };
|
|
18135
|
+
}
|
|
18136
|
+
function isVoiceEvidenceRecord(value) {
|
|
18137
|
+
if (!recordObject(value)) return false;
|
|
18138
|
+
return typeof value.profileKey === "string" && typeof value.platform === "string" && typeof value.desktopVersion === "string" && typeof value.implementationRevision === "string" && typeof value.profileDigest === "string" && (value.path === "chat" || value.path === "work-codex" || value.path === "work-grok") && recordObject(value.stages);
|
|
18139
|
+
}
|
|
18140
|
+
function voiceEvidenceRecordsFromConfig(config2) {
|
|
18141
|
+
return (config2.voiceEvidence ?? []).filter(isVoiceEvidenceRecord);
|
|
18142
|
+
}
|
|
18143
|
+
function startupVoiceGate(config2) {
|
|
18144
|
+
const records = [
|
|
18145
|
+
...voiceEvidenceRecordsFromConfig(config2),
|
|
18146
|
+
...config2.evidence && isVoiceEvidenceRecord(config2.evidence) ? [config2.evidence] : []
|
|
18147
|
+
];
|
|
18148
|
+
const chat = decidePath("chat", config2, records);
|
|
18149
|
+
const workCodex = decidePath("work-codex", config2, records);
|
|
18150
|
+
const workGrok = decidePath("work-grok", config2, records);
|
|
18151
|
+
return {
|
|
18152
|
+
chat,
|
|
18153
|
+
"work-codex": workCodex,
|
|
18154
|
+
"work-grok": workGrok,
|
|
18155
|
+
work: workCodex
|
|
18156
|
+
};
|
|
18157
|
+
}
|
|
18158
|
+
function chatVoiceQualified(config2) {
|
|
18159
|
+
return startupVoiceGate(config2).chat.enabled;
|
|
18160
|
+
}
|
|
18161
|
+
function workVoiceLaneEnabled(owner, path) {
|
|
18162
|
+
return workVoicePathDecision(owner, path).enabled;
|
|
18163
|
+
}
|
|
18164
|
+
function workVoicePathDecision(owner, path) {
|
|
18165
|
+
const config2 = readCpaLiveVoiceHookConfig(owner);
|
|
18166
|
+
if (!config2) {
|
|
18167
|
+
return {
|
|
18168
|
+
enabled: false,
|
|
18169
|
+
policy: "unreviewed",
|
|
18170
|
+
reason: workVoiceUnavailableReason({}) ?? "Work voice is not qualified on this Desktop."
|
|
17206
18171
|
};
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
18172
|
+
}
|
|
18173
|
+
return startupVoiceGate(config2)[path];
|
|
18174
|
+
}
|
|
18175
|
+
function workVoiceUserFacingUnavailable(owner, path) {
|
|
18176
|
+
void path;
|
|
18177
|
+
const config2 = readCpaLiveVoiceHookConfig(owner) ?? {};
|
|
18178
|
+
return workVoiceUnavailableReason(config2) ?? "Work voice is not qualified on this Desktop.";
|
|
18179
|
+
}
|
|
18180
|
+
function chatVoiceUserFacingUnavailable(owner) {
|
|
18181
|
+
const config2 = readCpaLiveVoiceHookConfig(owner) ?? {};
|
|
18182
|
+
return nativeChatVoiceUnavailableReason(config2) ?? "Chat voice is not qualified on this Desktop.";
|
|
18183
|
+
}
|
|
18184
|
+
function chatVoiceQualifiedOnOwner(owner) {
|
|
18185
|
+
const config2 = readCpaLiveVoiceHookConfig(owner);
|
|
18186
|
+
return config2 ? chatVoiceQualified(config2) : false;
|
|
18187
|
+
}
|
|
18188
|
+
|
|
18189
|
+
// src/renderer-chat-voice-debug.ts
|
|
18190
|
+
var CHAT_VOICE_DEBUG_GLOBAL = "__codexhostChatVoiceDebug";
|
|
18191
|
+
var CHAT_VOICE_DEBUG_STORAGE_KEY = "codexhost.chat-voice-debug.v1";
|
|
18192
|
+
function chatVoiceDebug(event, detail = {}) {
|
|
18193
|
+
const entry = { t: Date.now(), event, ...detail };
|
|
18194
|
+
const owner = globalThis;
|
|
18195
|
+
const log = Array.isArray(owner[CHAT_VOICE_DEBUG_GLOBAL]) ? owner[CHAT_VOICE_DEBUG_GLOBAL] : [];
|
|
18196
|
+
log.push(entry);
|
|
18197
|
+
while (log.length > 40) log.shift();
|
|
18198
|
+
owner[CHAT_VOICE_DEBUG_GLOBAL] = log;
|
|
18199
|
+
try {
|
|
18200
|
+
owner.localStorage?.setItem(CHAT_VOICE_DEBUG_STORAGE_KEY, JSON.stringify(log));
|
|
18201
|
+
} catch {
|
|
18202
|
+
}
|
|
18203
|
+
owner.console?.info?.("[codexhost-chat-voice]", event, detail);
|
|
18204
|
+
}
|
|
18205
|
+
|
|
18206
|
+
// src/renderer-voice-gateway-wrap.ts
|
|
18207
|
+
function object2(value) {
|
|
18208
|
+
return value !== null && typeof value === "object";
|
|
18209
|
+
}
|
|
18210
|
+
var HOST_MCP_TIMEOUT_MESSAGE = "Host request timed out";
|
|
18211
|
+
var HOST_MCP_UNAVAILABLE_MESSAGE = "Local Host connection is unavailable";
|
|
18212
|
+
var DIRECT_VOICE_HOST_GLOBAL = "__codexhostVoiceHostV1";
|
|
18213
|
+
function resolveDirectVoiceHost(owner = globalThis) {
|
|
18214
|
+
const value = Reflect.get(owner, DIRECT_VOICE_HOST_GLOBAL);
|
|
18215
|
+
if (!value || typeof value !== "object") return null;
|
|
18216
|
+
const request = Reflect.get(value, "request");
|
|
18217
|
+
return typeof request === "function" ? { request: request.bind(value) } : null;
|
|
18218
|
+
}
|
|
18219
|
+
function hostMcpStage(value) {
|
|
18220
|
+
return value === "config" || value === "request" || value === "transport" || value === "identity" || value === "cancel" ? value : "rpc";
|
|
18221
|
+
}
|
|
18222
|
+
function requestVoiceHost(_bridge, params, method = REALTIME_CALL_METHOD) {
|
|
18223
|
+
const host = resolveDirectVoiceHost();
|
|
18224
|
+
if (!host) {
|
|
18225
|
+
chatVoiceDebug("gateway-create", { stage: "rpc", cause: "host-unavailable" });
|
|
18226
|
+
return Promise.reject(new Error("Voice gateway Host connection is unavailable"));
|
|
18227
|
+
}
|
|
18228
|
+
return host.request(method, params).then(
|
|
18229
|
+
(result) => result,
|
|
18230
|
+
(error51) => {
|
|
18231
|
+
const message = error51 instanceof Error ? error51.message : "";
|
|
18232
|
+
if (message === HOST_MCP_TIMEOUT_MESSAGE || /timed out/i.test(message)) {
|
|
18233
|
+
chatVoiceDebug("gateway-create", { stage: "rpc", cause: "timeout" });
|
|
18234
|
+
throw new Error("Voice gateway did not answer in time");
|
|
18235
|
+
}
|
|
18236
|
+
if (message === HOST_MCP_UNAVAILABLE_MESSAGE) {
|
|
18237
|
+
chatVoiceDebug("gateway-create", { stage: "rpc", cause: "host-unavailable" });
|
|
18238
|
+
throw new Error("Voice gateway Host connection is unavailable");
|
|
18239
|
+
}
|
|
18240
|
+
const stage = error51 instanceof Error && "stage" in error51 ? hostMcpStage(error51.stage) : "rpc";
|
|
18241
|
+
chatVoiceDebug("gateway-create", { stage, cause: "failed" });
|
|
18242
|
+
throw new Error("Configured voice gateway request failed");
|
|
18243
|
+
}
|
|
18244
|
+
);
|
|
18245
|
+
}
|
|
18246
|
+
function parseRealtimeCallResponse(value) {
|
|
18247
|
+
if (value === null || typeof value !== "object")
|
|
18248
|
+
throw new Error("Invalid voice gateway response");
|
|
18249
|
+
const record5 = value;
|
|
18250
|
+
if (typeof record5.status !== "number" || !Number.isInteger(record5.status) || record5.status < 200 || record5.status > 599 || typeof record5.body !== "string" || record5.headers === null || typeof record5.headers !== "object" || Array.isArray(record5.headers)) {
|
|
18251
|
+
throw new Error("Invalid voice gateway response");
|
|
18252
|
+
}
|
|
18253
|
+
const headers = {};
|
|
18254
|
+
for (const [name, header] of Object.entries(record5.headers)) {
|
|
18255
|
+
if (typeof header === "string") headers[name] = header;
|
|
18256
|
+
}
|
|
18257
|
+
return { status: record5.status, body: record5.body, headers };
|
|
18258
|
+
}
|
|
18259
|
+
function backendModelName(headers) {
|
|
18260
|
+
const raw = new Headers(headers).get("x-codex-turn-metadata");
|
|
18261
|
+
if (!raw) return "";
|
|
18262
|
+
try {
|
|
18263
|
+
const parsed = JSON.parse(raw);
|
|
18264
|
+
return typeof parsed.backend_model_name === "string" ? parsed.backend_model_name : "";
|
|
18265
|
+
} catch {
|
|
18266
|
+
return "";
|
|
18267
|
+
}
|
|
18268
|
+
}
|
|
18269
|
+
function isWorkBackendModel(name) {
|
|
18270
|
+
const model2 = name.toLowerCase();
|
|
18271
|
+
if (!model2) return false;
|
|
18272
|
+
if (model2.startsWith("codexhost/")) return true;
|
|
18273
|
+
return model2.includes("codex") && !model2.includes("gpt-live");
|
|
18274
|
+
}
|
|
18275
|
+
var lastVoiceProductExperience;
|
|
18276
|
+
var VOICE_LAUNCH_EXPERIENCE_STORAGE_KEY = "codexhost.voice-launch-experience.v1";
|
|
18277
|
+
function launchStorage(owner) {
|
|
18278
|
+
return owner.localStorage;
|
|
18279
|
+
}
|
|
18280
|
+
function storedVoiceProductExperience(owner) {
|
|
18281
|
+
try {
|
|
18282
|
+
const stored = launchStorage(owner)?.getItem(VOICE_LAUNCH_EXPERIENCE_STORAGE_KEY);
|
|
18283
|
+
return stored === "chat" || stored === "work" || stored === "codex" ? stored : void 0;
|
|
18284
|
+
} catch {
|
|
18285
|
+
return void 0;
|
|
18286
|
+
}
|
|
18287
|
+
}
|
|
18288
|
+
function rememberVoiceProductExperience(request, owner = globalThis) {
|
|
18289
|
+
const experience = object2(request) ? request.productExperience : void 0;
|
|
18290
|
+
lastVoiceProductExperience = experience === "chat" || experience === "work" || experience === "codex" ? experience : void 0;
|
|
18291
|
+
try {
|
|
18292
|
+
const storage = launchStorage(owner);
|
|
18293
|
+
if (!storage) return;
|
|
18294
|
+
if (lastVoiceProductExperience)
|
|
18295
|
+
storage.setItem(VOICE_LAUNCH_EXPERIENCE_STORAGE_KEY, lastVoiceProductExperience);
|
|
18296
|
+
else storage.removeItem(VOICE_LAUNCH_EXPERIENCE_STORAGE_KEY);
|
|
18297
|
+
} catch {
|
|
18298
|
+
}
|
|
18299
|
+
}
|
|
18300
|
+
function lastVoiceLaunchProductExperience(owner = globalThis) {
|
|
18301
|
+
return lastVoiceProductExperience ?? storedVoiceProductExperience(owner);
|
|
18302
|
+
}
|
|
18303
|
+
function wrapClientOwnedVoiceFetch(client, bridge, workOverride, responseError, chatOverride = () => false, workSurface = () => false, externalHarness = () => false, overlayExistingCall = () => false, externalLane = () => true, workLane = () => true, unavailableReason = (kind) => kind === "chat" ? "Chat voice is not qualified on this Desktop." : "Work voice is not qualified on this Desktop.", chatLane = () => true, allowChatNativeWham = () => true, chatgptInstantConnect = () => true) {
|
|
18304
|
+
const original = client.fetch;
|
|
18305
|
+
const wrapped = async function(url2, options) {
|
|
18306
|
+
if (typeof url2 !== "string" || url2.split("?")[0] !== "/wham/realtime/calls" || options?.method !== "POST")
|
|
18307
|
+
return original.call(this, url2, options);
|
|
18308
|
+
const experience = lastVoiceLaunchProductExperience();
|
|
18309
|
+
const model2 = backendModelName(options.headers);
|
|
18310
|
+
const originator = new Headers(options.headers).get("originator");
|
|
18311
|
+
const overlayWork = originator === "codex_work_desktop" && experience !== "chat";
|
|
18312
|
+
const overlayHostCreate = overlayExistingCall() && workOverride() && experience !== "chat";
|
|
18313
|
+
const chat = experience === "chat" && !overlayWork && !overlayHostCreate;
|
|
18314
|
+
const work = overlayWork || overlayHostCreate || !chat && (experience === "work" || experience === "codex" || isWorkBackendModel(model2) || workSurface());
|
|
18315
|
+
const external = !chat && (model2.startsWith("codexhost/") || externalHarness());
|
|
18316
|
+
const intendedGateway = external ? true : work ? workOverride() : chatOverride();
|
|
18317
|
+
const chatQualified = chatLane();
|
|
18318
|
+
const qualified = external ? externalLane() : work ? workLane() : chat ? chatQualified : true;
|
|
18319
|
+
const chatgptNative = chat && chatgptInstantConnect();
|
|
18320
|
+
const nativeChatWham = chatgptNative && !intendedGateway && allowChatNativeWham() && chatQualified;
|
|
18321
|
+
let route;
|
|
18322
|
+
if (chatgptNative && !chatQualified) route = "blocked";
|
|
18323
|
+
else if (chatgptNative && !intendedGateway && !nativeChatWham) route = "blocked";
|
|
18324
|
+
else if (chat && intendedGateway && !chatQualified) route = "blocked";
|
|
18325
|
+
else if (!intendedGateway) route = "desktop";
|
|
18326
|
+
else if (qualified) route = "gateway";
|
|
18327
|
+
else route = "blocked";
|
|
18328
|
+
chatVoiceDebug("wham-create", {
|
|
18329
|
+
work,
|
|
18330
|
+
external,
|
|
18331
|
+
route,
|
|
18332
|
+
productExperience: experience ?? "unset",
|
|
18333
|
+
originator: originator ?? "unset",
|
|
18334
|
+
overlayWork,
|
|
18335
|
+
overlayHostCreate
|
|
18336
|
+
});
|
|
18337
|
+
if (route === "blocked") {
|
|
18338
|
+
if (chat) {
|
|
18339
|
+
throw new Error(
|
|
18340
|
+
chatQualified ? "Native Chat voice is unavailable" : unavailableReason("chat")
|
|
18341
|
+
);
|
|
18342
|
+
}
|
|
18343
|
+
throw new Error(unavailableReason(external ? "external" : "work"));
|
|
18344
|
+
}
|
|
18345
|
+
if (route === "desktop") {
|
|
18346
|
+
if (!external && !work)
|
|
18347
|
+
chatVoiceDebug("chat-native-passthrough", {
|
|
18348
|
+
hasThreadId: new Headers(options.headers).has("Thread-Id")
|
|
18349
|
+
});
|
|
18350
|
+
return original.call(this, url2, options);
|
|
18351
|
+
}
|
|
18352
|
+
if (typeof options.body !== "string") throw new Error("Unsupported native voice call request");
|
|
18353
|
+
options.signal?.throwIfAborted();
|
|
18354
|
+
const requestId2 = crypto.randomUUID();
|
|
18355
|
+
let cancelled = false;
|
|
18356
|
+
const cancel = () => {
|
|
18357
|
+
if (cancelled) return;
|
|
18358
|
+
cancelled = true;
|
|
18359
|
+
void requestVoiceHost(bridge, { operation: "cancel", requestId: requestId2 }).catch(() => void 0);
|
|
17214
18360
|
};
|
|
17215
|
-
|
|
17216
|
-
if (!object2(event) || event.hostId !== "local" || !object2(event.message) || event.message.id !== id)
|
|
17217
|
-
return;
|
|
17218
|
-
done();
|
|
17219
|
-
if (event.message.error) reject(new Error("Configured voice gateway request failed"));
|
|
17220
|
-
else resolve(event.message.result);
|
|
17221
|
-
});
|
|
18361
|
+
options.signal?.addEventListener("abort", cancel, { once: true });
|
|
17222
18362
|
try {
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
18363
|
+
let result;
|
|
18364
|
+
try {
|
|
18365
|
+
result = parseRealtimeCallResponse(
|
|
18366
|
+
await requestVoiceHost(bridge, {
|
|
18367
|
+
operation: "create",
|
|
18368
|
+
requestId: requestId2,
|
|
18369
|
+
body: options.body,
|
|
18370
|
+
headers: filterRealtimeCallHeaders(Object.fromEntries(new Headers(options.headers)))
|
|
18371
|
+
})
|
|
18372
|
+
);
|
|
18373
|
+
} catch (error51) {
|
|
18374
|
+
if (error51 instanceof Error && error51.message === "Invalid voice gateway response")
|
|
18375
|
+
chatVoiceDebug("gateway-create", { stage: "response", cause: "invalid" });
|
|
18376
|
+
throw error51;
|
|
18377
|
+
}
|
|
18378
|
+
chatVoiceDebug("gateway-create", {
|
|
18379
|
+
stage: "status",
|
|
18380
|
+
status: result.status,
|
|
18381
|
+
ok: result.status >= 200 && result.status < 300
|
|
17226
18382
|
});
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
18383
|
+
if (options.signal?.aborted) {
|
|
18384
|
+
const callId = realtimeCallIdFromLocation(result.headers.location ?? "");
|
|
18385
|
+
if (result.status >= 200 && result.status < 300 && isRealtimeCallId(callId))
|
|
18386
|
+
await requestVoiceHost(bridge, { operation: "hangup", callId });
|
|
18387
|
+
options.signal.throwIfAborted();
|
|
18388
|
+
}
|
|
18389
|
+
const response = new Response(result.status === 204 ? null : result.body, {
|
|
18390
|
+
status: result.status,
|
|
18391
|
+
headers: result.headers
|
|
18392
|
+
});
|
|
18393
|
+
if (!response.ok) throw await responseError(response, url2);
|
|
18394
|
+
return response;
|
|
18395
|
+
} catch (error51) {
|
|
18396
|
+
cancel();
|
|
18397
|
+
throw error51;
|
|
18398
|
+
} finally {
|
|
18399
|
+
options.signal?.removeEventListener("abort", cancel);
|
|
17230
18400
|
}
|
|
17231
|
-
}
|
|
18401
|
+
};
|
|
18402
|
+
client.fetch = wrapped;
|
|
18403
|
+
return () => {
|
|
18404
|
+
if (client.fetch === wrapped) client.fetch = original;
|
|
18405
|
+
};
|
|
17232
18406
|
}
|
|
18407
|
+
|
|
18408
|
+
// src/renderer-work-composer-surface.ts
|
|
17233
18409
|
var HOME_COMPOSER_MODE_STORAGE_KEY = "home-composer-mode-v1";
|
|
17234
|
-
function backendModelName(headers) {
|
|
17235
|
-
const raw = new Headers(headers).get("x-codex-turn-metadata");
|
|
17236
|
-
if (!raw) return "";
|
|
17237
|
-
try {
|
|
17238
|
-
const parsed = JSON.parse(raw);
|
|
17239
|
-
return typeof parsed.backend_model_name === "string" ? parsed.backend_model_name : "";
|
|
17240
|
-
} catch {
|
|
17241
|
-
return "";
|
|
17242
|
-
}
|
|
17243
|
-
}
|
|
17244
|
-
function isWorkBackendModel(name) {
|
|
17245
|
-
const model2 = name.toLowerCase();
|
|
17246
|
-
if (!model2) return false;
|
|
17247
|
-
if (model2.startsWith("codexhost/")) return true;
|
|
17248
|
-
return model2.includes("codex") && !model2.includes("gpt-live");
|
|
17249
|
-
}
|
|
17250
18410
|
function visibleWorkComposer(owner) {
|
|
17251
18411
|
const document = owner.document;
|
|
17252
18412
|
if (!document?.querySelectorAll) return false;
|
|
@@ -17292,134 +18452,402 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17292
18452
|
}
|
|
17293
18453
|
return selectedWorkTab(owner) || visibleWorkComposer(owner);
|
|
17294
18454
|
}
|
|
17295
|
-
|
|
17296
|
-
|
|
18455
|
+
|
|
18456
|
+
// src/renderer-hashed-overlay-voice.ts
|
|
18457
|
+
var HOOK_GLOBAL = "__codexhostClientOwnedVoiceV1";
|
|
18458
|
+
var SHARED_VOICE_CACHE2 = "codexhost.voice-routes-cache.v1";
|
|
18459
|
+
var WORK_GATEWAY_FLAG = "codexhost.cpa-live-voice.v1";
|
|
18460
|
+
var CHAT_GATEWAY_FLAG = "codexhost.chat-live-voice.v1";
|
|
18461
|
+
function object3(value) {
|
|
18462
|
+
return value !== null && typeof value === "object";
|
|
18463
|
+
}
|
|
18464
|
+
function overlayCompactVoiceDocument(target2) {
|
|
17297
18465
|
try {
|
|
17298
|
-
const
|
|
17299
|
-
return
|
|
18466
|
+
const href = target2.location?.href ?? globalThis.location?.href ?? "";
|
|
18467
|
+
return href.includes("avatar-overlay");
|
|
17300
18468
|
} catch {
|
|
17301
|
-
return
|
|
18469
|
+
return false;
|
|
17302
18470
|
}
|
|
17303
18471
|
}
|
|
17304
|
-
|
|
17305
|
-
|
|
17306
|
-
|
|
17307
|
-
|
|
18472
|
+
function visibleComposerLaunchExperience(target2) {
|
|
18473
|
+
const document = target2.document;
|
|
18474
|
+
if (!document?.querySelectorAll) return;
|
|
18475
|
+
const visible = (element) => {
|
|
18476
|
+
const box = element.getBoundingClientRect?.() ?? { width: 0 };
|
|
18477
|
+
return box.width > 0 && !element.closest?.("[hidden], [inert]");
|
|
18478
|
+
};
|
|
18479
|
+
const chat = [...document.querySelectorAll("[data-chatgpt-composer]")].some(visible);
|
|
18480
|
+
const work = [...document.querySelectorAll("[data-codex-composer-root]")].some(visible);
|
|
18481
|
+
if (chat && !work) return "chat";
|
|
18482
|
+
if (work && !chat) return "work";
|
|
18483
|
+
}
|
|
18484
|
+
function publishComposerLaunchExperience(target2) {
|
|
18485
|
+
if (overlayCompactVoiceDocument(target2)) return;
|
|
18486
|
+
rememberVoiceProductExperience(
|
|
18487
|
+
{
|
|
18488
|
+
productExperience: visibleComposerLaunchExperience(target2) ?? (isWorkComposerSurface(target2) ? "work" : "chat")
|
|
18489
|
+
},
|
|
18490
|
+
target2
|
|
18491
|
+
);
|
|
18492
|
+
}
|
|
18493
|
+
function hashedOverlayVoiceSupported(config2) {
|
|
18494
|
+
if (hashedVoiceProfileSupported(config2)) return true;
|
|
18495
|
+
if (!hashedVoiceCandidateOwner(config2)) return false;
|
|
18496
|
+
return isolatedVoicePathEnabled(config2, "work-codex") || isolatedVoicePathEnabled(config2, "work-grok");
|
|
18497
|
+
}
|
|
18498
|
+
function hashedWebpackVoiceSupported(config2) {
|
|
18499
|
+
return hashedOverlayVoiceSupported(config2);
|
|
18500
|
+
}
|
|
18501
|
+
function cachedConnection(owner, field2) {
|
|
18502
|
+
try {
|
|
18503
|
+
const parsed = JSON.parse(
|
|
18504
|
+
owner.localStorage?.getItem(SHARED_VOICE_CACHE2) ?? "null"
|
|
18505
|
+
);
|
|
18506
|
+
return object3(parsed) ? parsed[field2] : void 0;
|
|
18507
|
+
} catch {
|
|
18508
|
+
return void 0;
|
|
18509
|
+
}
|
|
17308
18510
|
}
|
|
17309
|
-
function
|
|
17310
|
-
|
|
18511
|
+
function cachedChatExperience(owner) {
|
|
18512
|
+
try {
|
|
18513
|
+
const parsed = JSON.parse(
|
|
18514
|
+
owner.localStorage?.getItem(SHARED_VOICE_CACHE2) ?? "null"
|
|
18515
|
+
);
|
|
18516
|
+
return object3(parsed) ? parsed.chatExperience : void 0;
|
|
18517
|
+
} catch {
|
|
18518
|
+
return void 0;
|
|
18519
|
+
}
|
|
17311
18520
|
}
|
|
17312
|
-
function
|
|
18521
|
+
function storageFlag(owner, key, enabledWhenUnset) {
|
|
17313
18522
|
const storage = owner.localStorage;
|
|
17314
|
-
if (!storage) return
|
|
18523
|
+
if (!storage) return enabledWhenUnset;
|
|
17315
18524
|
try {
|
|
17316
|
-
const
|
|
17317
|
-
return
|
|
18525
|
+
const value = storage.getItem(key);
|
|
18526
|
+
return enabledWhenUnset ? value !== "0" : value === "1";
|
|
17318
18527
|
} catch {
|
|
17319
|
-
return
|
|
18528
|
+
return enabledWhenUnset;
|
|
17320
18529
|
}
|
|
17321
18530
|
}
|
|
17322
|
-
function
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
if (lastVoiceProductExperience === "codex") return false;
|
|
17326
|
-
if (lastVoiceProductExperience !== "work" && !isWorkComposerSurface(owner)) return false;
|
|
17327
|
-
return lastAgentIsExternalHarness(owner);
|
|
18531
|
+
function workGatewayPreference(owner) {
|
|
18532
|
+
const connection = cachedConnection(owner, "workConnection");
|
|
18533
|
+
return connection !== void 0 ? connection === "gateway" : storageFlag(owner, WORK_GATEWAY_FLAG, true);
|
|
17328
18534
|
}
|
|
17329
|
-
function
|
|
17330
|
-
const
|
|
17331
|
-
const
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
|
|
17346
|
-
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
|
|
17352
|
-
|
|
17353
|
-
|
|
17354
|
-
|
|
17355
|
-
|
|
17356
|
-
|
|
17357
|
-
|
|
17358
|
-
|
|
17359
|
-
|
|
17360
|
-
|
|
17361
|
-
|
|
17362
|
-
|
|
18535
|
+
function chatGatewayEnabled(owner) {
|
|
18536
|
+
const experience = cachedChatExperience(owner);
|
|
18537
|
+
const connection = cachedConnection(owner, "chatConnection");
|
|
18538
|
+
if (experience !== void 0 || connection !== void 0)
|
|
18539
|
+
return experience === "codex" && connection === "gateway";
|
|
18540
|
+
return storageFlag(owner, CHAT_GATEWAY_FLAG, false);
|
|
18541
|
+
}
|
|
18542
|
+
function nativeVoiceOwner(value) {
|
|
18543
|
+
return value !== null && (typeof value === "object" || typeof value === "function") ? value : void 0;
|
|
18544
|
+
}
|
|
18545
|
+
function nativeVoiceInstance(value) {
|
|
18546
|
+
const owner = nativeVoiceOwner(value);
|
|
18547
|
+
if (!owner) return value;
|
|
18548
|
+
const getInstance = Reflect.get(owner, "getInstance");
|
|
18549
|
+
return typeof getInstance === "function" ? getInstance.call(owner) : owner;
|
|
18550
|
+
}
|
|
18551
|
+
function nativeVoiceFetch(value) {
|
|
18552
|
+
const instance = nativeVoiceInstance(value);
|
|
18553
|
+
if (!object3(instance) || typeof instance.fetch !== "function") return void 0;
|
|
18554
|
+
return instance;
|
|
18555
|
+
}
|
|
18556
|
+
function nativeVoiceBridge(value) {
|
|
18557
|
+
const instance = nativeVoiceInstance(value);
|
|
18558
|
+
if (!object3(instance) || typeof instance.dispatchMessage !== "function" || typeof instance.subscribe !== "function") {
|
|
18559
|
+
return void 0;
|
|
18560
|
+
}
|
|
18561
|
+
return instance;
|
|
18562
|
+
}
|
|
18563
|
+
function isWebpackRequire(value) {
|
|
18564
|
+
return typeof value === "function";
|
|
18565
|
+
}
|
|
18566
|
+
function peekWebpackExport(req, id) {
|
|
18567
|
+
return req.c?.[id]?.exports;
|
|
18568
|
+
}
|
|
18569
|
+
function unpoisonIncompleteWebpackModule(req, id, usable) {
|
|
18570
|
+
const cache = req.c;
|
|
18571
|
+
const cached2 = cache?.[id];
|
|
18572
|
+
if (!cache || !cached2 || usable(cached2.exports)) return;
|
|
18573
|
+
try {
|
|
18574
|
+
Reflect.deleteProperty(cache, id);
|
|
18575
|
+
} catch {
|
|
18576
|
+
}
|
|
18577
|
+
}
|
|
18578
|
+
function safeWebpackRequire(req, id) {
|
|
18579
|
+
const existing = peekWebpackExport(req, id);
|
|
18580
|
+
if (object3(existing) && Object.keys(existing).length > 0) return existing;
|
|
18581
|
+
try {
|
|
18582
|
+
return req(id);
|
|
18583
|
+
} catch {
|
|
18584
|
+
unpoisonIncompleteWebpackModule(
|
|
18585
|
+
req,
|
|
18586
|
+
id,
|
|
18587
|
+
(value) => object3(value) && Object.keys(value).length > 0
|
|
18588
|
+
);
|
|
18589
|
+
return void 0;
|
|
18590
|
+
}
|
|
18591
|
+
}
|
|
18592
|
+
function readGdntExports(req) {
|
|
18593
|
+
const factoryId = HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId;
|
|
18594
|
+
const fetchExport = HASHED_OVERLAY_VOICE_ROLES.fetchExport;
|
|
18595
|
+
const peeked = peekWebpackExport(req, factoryId);
|
|
18596
|
+
if (nativeVoiceFetch(object3(peeked) ? peeked[fetchExport] : void 0)) return peeked;
|
|
18597
|
+
unpoisonIncompleteWebpackModule(
|
|
18598
|
+
req,
|
|
18599
|
+
factoryId,
|
|
18600
|
+
(value) => Boolean(nativeVoiceFetch(object3(value) ? value[fetchExport] : void 0))
|
|
18601
|
+
);
|
|
18602
|
+
if (typeof req.m?.[factoryId] !== "function") return safeWebpackRequire(req, factoryId);
|
|
18603
|
+
return void 0;
|
|
18604
|
+
}
|
|
18605
|
+
function hookWebpackVoiceFactory(req, onExports) {
|
|
18606
|
+
const modules = req.m;
|
|
18607
|
+
const factoryId = HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId;
|
|
18608
|
+
const original = modules?.[factoryId];
|
|
18609
|
+
if (!modules || typeof original !== "function") return false;
|
|
18610
|
+
if (original.__codexhostVoiceFactory) return true;
|
|
18611
|
+
const wrapped = function(module, exports, webpackRequire) {
|
|
17363
18612
|
try {
|
|
17364
|
-
|
|
17365
|
-
await requestVoiceHost(bridge, {
|
|
17366
|
-
operation: "create",
|
|
17367
|
-
requestId: requestId2,
|
|
17368
|
-
body: options.body,
|
|
17369
|
-
// Drop Desktop OAuth, ChatGPT account identity and cookies at the bridge
|
|
17370
|
-
// boundary; the Host allowlist repeats this check before sending.
|
|
17371
|
-
headers: filterRealtimeCallHeaders(Object.fromEntries(new Headers(options.headers)))
|
|
17372
|
-
})
|
|
17373
|
-
);
|
|
17374
|
-
if (options.signal?.aborted) {
|
|
17375
|
-
const callId = realtimeCallIdFromLocation(result.headers.location ?? "");
|
|
17376
|
-
if (result.status >= 200 && result.status < 300 && isRealtimeCallId(callId))
|
|
17377
|
-
await requestVoiceHost(bridge, { operation: "hangup", callId });
|
|
17378
|
-
options.signal.throwIfAborted();
|
|
17379
|
-
}
|
|
17380
|
-
const response = new Response(result.status === 204 ? null : result.body, {
|
|
17381
|
-
status: result.status,
|
|
17382
|
-
headers: result.headers
|
|
17383
|
-
});
|
|
17384
|
-
if (!response.ok) throw await responseError(response, url2);
|
|
17385
|
-
return response;
|
|
17386
|
-
} catch (error51) {
|
|
17387
|
-
cancel();
|
|
17388
|
-
throw error51;
|
|
18613
|
+
return original.apply(this, [module, exports, webpackRequire]);
|
|
17389
18614
|
} finally {
|
|
17390
|
-
|
|
18615
|
+
onExports(exports ?? module?.exports);
|
|
17391
18616
|
}
|
|
17392
18617
|
};
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
18618
|
+
wrapped.__codexhostVoiceFactory = true;
|
|
18619
|
+
modules[factoryId] = wrapped;
|
|
18620
|
+
return true;
|
|
18621
|
+
}
|
|
18622
|
+
async function resolveHashedWebpackVoice(importModule) {
|
|
18623
|
+
const runtime = await importModule(`app://-/assets/${HASHED_WEBPACK_VOICE_RUNTIME_ASSET}`);
|
|
18624
|
+
const req = runtime?.__webpack_require__;
|
|
18625
|
+
if (!isWebpackRequire(req)) return null;
|
|
18626
|
+
const roles = HASHED_OVERLAY_VOICE_ROLES;
|
|
18627
|
+
const gdnt = readGdntExports(req);
|
|
18628
|
+
const client = nativeVoiceFetch(object3(gdnt) ? gdnt[roles.fetchExport] : void 0);
|
|
18629
|
+
const hostBridge = safeWebpackRequire(req, roles.bridgeModuleId);
|
|
18630
|
+
const bridged = nativeVoiceBridge(
|
|
18631
|
+
object3(hostBridge) ? hostBridge[roles.bridgeExport] : void 0
|
|
18632
|
+
);
|
|
18633
|
+
const errorModule = safeWebpackRequire(req, roles.responseErrorModuleId);
|
|
18634
|
+
const responseError = object3(errorModule) ? errorModule[roles.responseErrorExport] : void 0;
|
|
18635
|
+
if (!bridged || typeof responseError !== "function") return null;
|
|
18636
|
+
if (client)
|
|
18637
|
+
return {
|
|
18638
|
+
client,
|
|
18639
|
+
bridge: bridged,
|
|
18640
|
+
responseError
|
|
18641
|
+
};
|
|
18642
|
+
if (typeof req.m?.[HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId] !== "function") return null;
|
|
18643
|
+
return {
|
|
18644
|
+
bridge: bridged,
|
|
18645
|
+
responseError,
|
|
18646
|
+
require: req
|
|
17396
18647
|
};
|
|
17397
18648
|
}
|
|
17398
|
-
function
|
|
18649
|
+
function installHashedOverlayVoiceHook(options = {}) {
|
|
17399
18650
|
const target2 = options.target ?? globalThis;
|
|
17400
18651
|
const existing = target2[HOOK_GLOBAL];
|
|
17401
18652
|
if (existing) return existing;
|
|
17402
18653
|
const config2 = readCpaLiveVoiceHookConfig(target2);
|
|
17403
18654
|
if (!config2) return { status: "disabled", dispose() {
|
|
17404
18655
|
} };
|
|
17405
|
-
if (!
|
|
17406
|
-
|
|
17407
|
-
} };
|
|
18656
|
+
if (!hashedWebpackVoiceSupported(config2)) return { status: "unsupported", dispose() {
|
|
18657
|
+
} };
|
|
17408
18658
|
const importModule = options.importModule ?? ((url2) => import(url2));
|
|
17409
18659
|
let disposed = false;
|
|
17410
18660
|
let timer;
|
|
18661
|
+
let surfaceTimer;
|
|
17411
18662
|
let restore;
|
|
17412
18663
|
const started = Date.now();
|
|
18664
|
+
const activation = {
|
|
18665
|
+
assetSeen: false,
|
|
18666
|
+
importStarted: false,
|
|
18667
|
+
importResolved: false,
|
|
18668
|
+
factoryHooked: false,
|
|
18669
|
+
wrapperActive: false
|
|
18670
|
+
};
|
|
18671
|
+
const pointerTarget = target2.document;
|
|
18672
|
+
const onPointerDown = () => publishComposerLaunchExperience(target2);
|
|
17413
18673
|
const handle = {
|
|
17414
18674
|
status: "pending",
|
|
18675
|
+
activation,
|
|
17415
18676
|
dispose() {
|
|
17416
18677
|
disposed = true;
|
|
17417
18678
|
if (timer !== void 0) target2.clearTimeout(timer);
|
|
18679
|
+
if (surfaceTimer !== void 0) target2.clearTimeout(surfaceTimer);
|
|
18680
|
+
pointerTarget?.removeEventListener?.("pointerdown", onPointerDown, true);
|
|
17418
18681
|
restore?.();
|
|
17419
18682
|
if (target2[HOOK_GLOBAL] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL);
|
|
17420
18683
|
}
|
|
17421
18684
|
};
|
|
17422
18685
|
target2[HOOK_GLOBAL] = handle;
|
|
18686
|
+
pointerTarget?.addEventListener?.("pointerdown", onPointerDown, true);
|
|
18687
|
+
const publishLoop = () => {
|
|
18688
|
+
if (disposed) return;
|
|
18689
|
+
publishComposerLaunchExperience(target2);
|
|
18690
|
+
surfaceTimer = target2.setTimeout(publishLoop, 250);
|
|
18691
|
+
};
|
|
18692
|
+
publishLoop();
|
|
18693
|
+
const activate = (client, bridge, responseError) => {
|
|
18694
|
+
restore = wrapClientOwnedVoiceFetch(
|
|
18695
|
+
client,
|
|
18696
|
+
bridge,
|
|
18697
|
+
() => workGatewayPreference(target2),
|
|
18698
|
+
responseError,
|
|
18699
|
+
() => chatGatewayEnabled(target2),
|
|
18700
|
+
() => !overlayCompactVoiceDocument(target2) && isWorkComposerSurface(target2),
|
|
18701
|
+
() => false,
|
|
18702
|
+
() => overlayCompactVoiceDocument(target2),
|
|
18703
|
+
() => workVoiceLaneEnabled(target2, "work-grok"),
|
|
18704
|
+
() => workVoiceLaneEnabled(target2, "work-codex"),
|
|
18705
|
+
(kind) => kind === "chat" ? chatVoiceUserFacingUnavailable(target2) : workVoiceUserFacingUnavailable(
|
|
18706
|
+
target2,
|
|
18707
|
+
kind === "external" ? "work-grok" : "work-codex"
|
|
18708
|
+
),
|
|
18709
|
+
() => chatVoiceQualifiedOnOwner(target2),
|
|
18710
|
+
() => false,
|
|
18711
|
+
() => nativeChatVoicePreferenceAllowsStart(target2)
|
|
18712
|
+
);
|
|
18713
|
+
activation.wrapperActive = true;
|
|
18714
|
+
handle.status = "active";
|
|
18715
|
+
};
|
|
18716
|
+
const attempt = async () => {
|
|
18717
|
+
if (disposed || handle.status === "active") return;
|
|
18718
|
+
publishComposerLaunchExperience(target2);
|
|
18719
|
+
const names = loadedAssetNames(target2.document, target2.performance);
|
|
18720
|
+
const hashedAssetSeen = names.some((name) => name.includes(HASHED_WEBPACK_VOICE_RUNTIME_ASSET));
|
|
18721
|
+
if (hashedAssetSeen) activation.assetSeen = true;
|
|
18722
|
+
if (hashedAssetSeen) {
|
|
18723
|
+
activation.importStarted = true;
|
|
18724
|
+
try {
|
|
18725
|
+
const resolved = await resolveHashedWebpackVoice(importModule);
|
|
18726
|
+
if (disposed || activation.wrapperActive) return;
|
|
18727
|
+
if (resolved?.client) {
|
|
18728
|
+
activation.importResolved = true;
|
|
18729
|
+
delete activation.importFailed;
|
|
18730
|
+
activate(resolved.client, resolved.bridge, resolved.responseError);
|
|
18731
|
+
return;
|
|
18732
|
+
}
|
|
18733
|
+
const webpackRequire = resolved?.require;
|
|
18734
|
+
if (webpackRequire && hookWebpackVoiceFactory(webpackRequire, (exports) => {
|
|
18735
|
+
if (disposed || activation.wrapperActive) return;
|
|
18736
|
+
const client = nativeVoiceFetch(
|
|
18737
|
+
object3(exports) ? exports[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
|
|
18738
|
+
);
|
|
18739
|
+
if (!client) {
|
|
18740
|
+
unpoisonIncompleteWebpackModule(
|
|
18741
|
+
webpackRequire,
|
|
18742
|
+
HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId,
|
|
18743
|
+
(value) => Boolean(
|
|
18744
|
+
nativeVoiceFetch(
|
|
18745
|
+
object3(value) ? value[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
|
|
18746
|
+
)
|
|
18747
|
+
)
|
|
18748
|
+
);
|
|
18749
|
+
return;
|
|
18750
|
+
}
|
|
18751
|
+
activate(client, resolved.bridge, resolved.responseError);
|
|
18752
|
+
})) {
|
|
18753
|
+
activation.importResolved = true;
|
|
18754
|
+
activation.factoryHooked = true;
|
|
18755
|
+
delete activation.importFailed;
|
|
18756
|
+
return;
|
|
18757
|
+
}
|
|
18758
|
+
activation.importFailed = "hashed-exports-missing";
|
|
18759
|
+
} catch {
|
|
18760
|
+
activation.importFailed = "hashed-import-failed";
|
|
18761
|
+
}
|
|
18762
|
+
}
|
|
18763
|
+
timer = target2.setTimeout(() => void attempt(), Date.now() - started >= 5e3 ? 1e3 : 250);
|
|
18764
|
+
};
|
|
18765
|
+
void attempt();
|
|
18766
|
+
return handle;
|
|
18767
|
+
}
|
|
18768
|
+
|
|
18769
|
+
// src/renderer-client-owned-voice.ts
|
|
18770
|
+
var SHARED_INIT = "Oit";
|
|
18771
|
+
var SHARED_RESPONSE_ERROR = "Mit";
|
|
18772
|
+
var HOOK_GLOBAL2 = "__codexhostClientOwnedVoiceV1";
|
|
18773
|
+
function selectedComposerModel(owner) {
|
|
18774
|
+
const routing = owner.__codexhostHostRoutingV1;
|
|
18775
|
+
try {
|
|
18776
|
+
const model2 = routing?.forComposer()?.policy.selectedModel();
|
|
18777
|
+
return typeof model2 === "string" ? model2 : "";
|
|
18778
|
+
} catch {
|
|
18779
|
+
return "";
|
|
18780
|
+
}
|
|
18781
|
+
}
|
|
18782
|
+
function isExternalHarnessComposer(owner = globalThis) {
|
|
18783
|
+
const experience = lastVoiceLaunchProductExperience();
|
|
18784
|
+
if (experience === "chat") return false;
|
|
18785
|
+
return selectedComposerModel(owner).startsWith("codexhost/");
|
|
18786
|
+
}
|
|
18787
|
+
function object4(value) {
|
|
18788
|
+
return value !== null && typeof value === "object";
|
|
18789
|
+
}
|
|
18790
|
+
function installClientOwnedVoiceHook(options = {}) {
|
|
18791
|
+
const target2 = options.target ?? globalThis;
|
|
18792
|
+
const existing = target2[HOOK_GLOBAL2];
|
|
18793
|
+
if (existing) return existing;
|
|
18794
|
+
const config2 = readCpaLiveVoiceHookConfig(target2);
|
|
18795
|
+
if (!config2) return { status: "disabled", dispose() {
|
|
18796
|
+
} };
|
|
18797
|
+
if (hashedOverlayVoiceSupported(config2)) {
|
|
18798
|
+
return installHashedOverlayVoiceHook({
|
|
18799
|
+
target: target2,
|
|
18800
|
+
...options.importModule ? { importModule: options.importModule } : {}
|
|
18801
|
+
});
|
|
18802
|
+
}
|
|
18803
|
+
if (!supportsVoiceVersion(CLIENT_OWNED_VOICE_ASSETS, config2.desktopVersion))
|
|
18804
|
+
return { status: "unsupported", dispose() {
|
|
18805
|
+
} };
|
|
18806
|
+
const importModule = options.importModule ?? ((url2) => import(url2));
|
|
18807
|
+
let disposed = false;
|
|
18808
|
+
let timer;
|
|
18809
|
+
let restore;
|
|
18810
|
+
const started = Date.now();
|
|
18811
|
+
const activation = {
|
|
18812
|
+
assetSeen: false,
|
|
18813
|
+
importStarted: false,
|
|
18814
|
+
importResolved: false,
|
|
18815
|
+
wrapperActive: false
|
|
18816
|
+
};
|
|
18817
|
+
const handle = {
|
|
18818
|
+
status: "pending",
|
|
18819
|
+
activation,
|
|
18820
|
+
dispose() {
|
|
18821
|
+
disposed = true;
|
|
18822
|
+
if (timer !== void 0) target2.clearTimeout(timer);
|
|
18823
|
+
restore?.();
|
|
18824
|
+
if (target2[HOOK_GLOBAL2] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL2);
|
|
18825
|
+
}
|
|
18826
|
+
};
|
|
18827
|
+
target2[HOOK_GLOBAL2] = handle;
|
|
18828
|
+
const activate = (client, bridge, responseError) => {
|
|
18829
|
+
restore = wrapClientOwnedVoiceFetch(
|
|
18830
|
+
client,
|
|
18831
|
+
bridge,
|
|
18832
|
+
() => cpaLiveVoicePreferenceAllowsInstall(target2),
|
|
18833
|
+
responseError,
|
|
18834
|
+
() => chatLiveVoicePreferenceAllowsOverride(target2),
|
|
18835
|
+
() => isWorkComposerSurface(target2),
|
|
18836
|
+
() => isExternalHarnessComposer(target2),
|
|
18837
|
+
() => false,
|
|
18838
|
+
() => workVoiceLaneEnabled(target2, "work-grok"),
|
|
18839
|
+
() => workVoiceLaneEnabled(target2, "work-codex"),
|
|
18840
|
+
(kind) => kind === "chat" ? chatVoiceUserFacingUnavailable(target2) : workVoiceUserFacingUnavailable(
|
|
18841
|
+
target2,
|
|
18842
|
+
kind === "external" ? "work-grok" : "work-codex"
|
|
18843
|
+
),
|
|
18844
|
+
() => chatVoiceQualifiedOnOwner(target2),
|
|
18845
|
+
() => !hashedOverlayVoiceSupported(config2),
|
|
18846
|
+
() => nativeChatVoicePreferenceAllowsStart(target2)
|
|
18847
|
+
);
|
|
18848
|
+
activation.wrapperActive = true;
|
|
18849
|
+
handle.status = "active";
|
|
18850
|
+
};
|
|
17423
18851
|
const attempt = async () => {
|
|
17424
18852
|
if (disposed) return;
|
|
17425
18853
|
const names = loadedAssetNames(target2.document, target2.performance);
|
|
@@ -17429,7 +18857,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17429
18857
|
config2.desktopVersion,
|
|
17430
18858
|
config2.desktopPlatform
|
|
17431
18859
|
);
|
|
17432
|
-
if (assets) {
|
|
18860
|
+
if (handle.status !== "active" && assets) {
|
|
17433
18861
|
try {
|
|
17434
18862
|
const sharedModule = await importModule(`app://-/assets/${assets.shared}`);
|
|
17435
18863
|
const fetchFrom = "fetchFrom" in assets ? assets.fetchFrom : "shared";
|
|
@@ -17446,8 +18874,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17446
18874
|
}
|
|
17447
18875
|
const fetchClass = typeof fetchName === "string" ? fetchModule[fetchName] : void 0;
|
|
17448
18876
|
const bridgeClass = typeof bridgeName === "string" ? sharedModule[bridgeName] : void 0;
|
|
17449
|
-
if (!
|
|
17450
|
-
if (!
|
|
18877
|
+
if (!object4(fetchClass) && typeof fetchClass !== "function") throw new Error();
|
|
18878
|
+
if (!object4(bridgeClass) && typeof bridgeClass !== "function") throw new Error();
|
|
17451
18879
|
const client = Reflect.get(fetchClass, "getInstance").call(fetchClass);
|
|
17452
18880
|
const bridge = Reflect.get(bridgeClass, "getInstance").call(bridgeClass);
|
|
17453
18881
|
const errorModule = "responseErrorFrom" in assets && assets.responseErrorFrom === "initial" ? fetchModule : sharedModule;
|
|
@@ -17456,16 +18884,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17456
18884
|
};
|
|
17457
18885
|
if (typeof client?.fetch !== "function" || typeof bridge?.dispatchMessage !== "function" || typeof bridge?.subscribe !== "function")
|
|
17458
18886
|
throw new Error();
|
|
17459
|
-
|
|
17460
|
-
client,
|
|
17461
|
-
bridge,
|
|
17462
|
-
() => cpaLiveVoicePreferenceAllowsInstall(target2),
|
|
17463
|
-
responseError,
|
|
17464
|
-
() => chatLiveVoicePreferenceAllowsOverride(target2),
|
|
17465
|
-
() => isWorkComposerSurface(target2),
|
|
17466
|
-
() => isExternalHarnessComposer(target2)
|
|
17467
|
-
);
|
|
17468
|
-
handle.status = "active";
|
|
18887
|
+
activate(client, bridge, responseError);
|
|
17469
18888
|
} catch {
|
|
17470
18889
|
}
|
|
17471
18890
|
}
|
|
@@ -17561,7 +18980,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17561
18980
|
}
|
|
17562
18981
|
|
|
17563
18982
|
// src/renderer-external-queue.ts
|
|
17564
|
-
function
|
|
18983
|
+
function isRecord3(value) {
|
|
17565
18984
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
17566
18985
|
}
|
|
17567
18986
|
function notificationTarget(manager) {
|
|
@@ -17569,11 +18988,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17569
18988
|
return manager;
|
|
17570
18989
|
}
|
|
17571
18990
|
const nested = manager.requestClient;
|
|
17572
|
-
return
|
|
18991
|
+
return isRecord3(nested) && typeof nested.addNotificationCallback === "function" ? nested : null;
|
|
17573
18992
|
}
|
|
17574
18993
|
function notificationParams(notification) {
|
|
17575
|
-
if (!
|
|
17576
|
-
return
|
|
18994
|
+
if (!isRecord3(notification)) return null;
|
|
18995
|
+
return isRecord3(notification.params) ? notification.params : notification;
|
|
17577
18996
|
}
|
|
17578
18997
|
function notificationThreadId(notification) {
|
|
17579
18998
|
const params = notificationParams(notification);
|
|
@@ -17588,25 +19007,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17588
19007
|
if (!params) return null;
|
|
17589
19008
|
if (typeof params.status === "string") return params.status;
|
|
17590
19009
|
const turn = params.turn;
|
|
17591
|
-
return
|
|
19010
|
+
return isRecord3(turn) && typeof turn.status === "string" ? turn.status : null;
|
|
17592
19011
|
}
|
|
17593
19012
|
function isExternalConversation(conversation, threadId) {
|
|
17594
|
-
return
|
|
19013
|
+
return isRecord3(conversation) && conversation.id === threadId && conversation.modelProvider === "codexhost";
|
|
17595
19014
|
}
|
|
17596
19015
|
function firstQueuedItemId(items) {
|
|
17597
19016
|
if (!Array.isArray(items)) return null;
|
|
17598
19017
|
for (const item of items) {
|
|
17599
|
-
if (!
|
|
19018
|
+
if (!isRecord3(item) || item.pausedReason != null) continue;
|
|
17600
19019
|
if (typeof item.id === "string" && item.id) return item.id;
|
|
17601
19020
|
}
|
|
17602
19021
|
return null;
|
|
17603
19022
|
}
|
|
17604
19023
|
function removeQueuedItem(coordinator, threadId, queuedSubmissionId) {
|
|
17605
|
-
if (!
|
|
19024
|
+
if (!isRecord3(coordinator) || typeof coordinator.mutate !== "function") return;
|
|
17606
19025
|
try {
|
|
17607
19026
|
coordinator.mutate.call(coordinator, threadId, (current) => {
|
|
17608
19027
|
if (!Array.isArray(current)) return current;
|
|
17609
|
-
return current.filter((item) => !
|
|
19028
|
+
return current.filter((item) => !isRecord3(item) || item.id !== queuedSubmissionId);
|
|
17610
19029
|
});
|
|
17611
19030
|
} catch (error51) {
|
|
17612
19031
|
console.error("codexhost could not reconcile the submitted local follow-up", error51);
|
|
@@ -17625,24 +19044,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17625
19044
|
const isExternalOwner = (threadId) => {
|
|
17626
19045
|
if (!isExternalConversation(getConversation.call(target2, threadId), threadId)) return false;
|
|
17627
19046
|
const role = getStreamRole.call(target2, threadId);
|
|
17628
|
-
return !(
|
|
19047
|
+
return !(isRecord3(role) && role.role === "follower");
|
|
17629
19048
|
};
|
|
17630
19049
|
const isIdle = (threadId, coordinator) => {
|
|
17631
|
-
const options =
|
|
17632
|
-
const host =
|
|
17633
|
-
if (
|
|
19050
|
+
const options = isRecord3(coordinator) ? coordinator.options : null;
|
|
19051
|
+
const host = isRecord3(options) ? options.submissionHost : null;
|
|
19052
|
+
if (isRecord3(host) && typeof host.getActiveTurnId === "function" && typeof host.hasPendingTurnStart === "function") {
|
|
17634
19053
|
return host.getActiveTurnId.call(host, threadId) == null && host.hasPendingTurnStart.call(host, threadId) !== true;
|
|
17635
19054
|
}
|
|
17636
19055
|
const conversation = getConversation.call(target2, threadId);
|
|
17637
|
-
return
|
|
19056
|
+
return isRecord3(conversation) && isRecord3(conversation.threadRuntimeStatus) && conversation.threadRuntimeStatus.type === "idle";
|
|
17638
19057
|
};
|
|
17639
19058
|
const queuedSubmissionId = (coordinator, threadId) => {
|
|
17640
|
-
if (
|
|
19059
|
+
if (isRecord3(coordinator) && typeof coordinator.readMessages === "function") {
|
|
17641
19060
|
const messages = coordinator.readMessages.call(coordinator, threadId);
|
|
17642
19061
|
if (Array.isArray(messages)) return firstQueuedItemId(messages);
|
|
17643
19062
|
}
|
|
17644
|
-
const queue =
|
|
17645
|
-
if (
|
|
19063
|
+
const queue = isRecord3(coordinator) ? coordinator.serverQueue : null;
|
|
19064
|
+
if (isRecord3(queue) && typeof queue.read === "function") {
|
|
17646
19065
|
return firstQueuedItemId(queue.read.call(queue, threadId));
|
|
17647
19066
|
}
|
|
17648
19067
|
return null;
|
|
@@ -17671,7 +19090,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17671
19090
|
};
|
|
17672
19091
|
const onNotification = (notification) => {
|
|
17673
19092
|
if (disposed) return;
|
|
17674
|
-
const method =
|
|
19093
|
+
const method = isRecord3(notification) && typeof notification.method === "string" ? notification.method : null;
|
|
17675
19094
|
const threadId = notificationThreadId(notification);
|
|
17676
19095
|
if (!threadId) return;
|
|
17677
19096
|
if (method === "turn/completed") {
|
|
@@ -17692,10 +19111,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17692
19111
|
};
|
|
17693
19112
|
}
|
|
17694
19113
|
function installRendererExternalQueue(target2) {
|
|
17695
|
-
if (!
|
|
19114
|
+
if (!isRecord3(target2) || typeof target2.getTurnCoordinator !== "function") return null;
|
|
17696
19115
|
const coordinator = target2.getTurnCoordinator();
|
|
17697
|
-
const queue =
|
|
17698
|
-
if (!
|
|
19116
|
+
const queue = isRecord3(coordinator) ? coordinator.serverQueue : null;
|
|
19117
|
+
if (!isRecord3(queue) || typeof queue.isEnabled !== "function") return null;
|
|
17699
19118
|
if (typeof target2.getConversation === "function" && typeof target2.getStreamRole === "function") {
|
|
17700
19119
|
return installServerQueueDrain(target2);
|
|
17701
19120
|
}
|
|
@@ -17703,13 +19122,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17703
19122
|
}
|
|
17704
19123
|
|
|
17705
19124
|
// src/renderer-native-thread.ts
|
|
17706
|
-
function
|
|
19125
|
+
function isRecord4(value) {
|
|
17707
19126
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17708
19127
|
}
|
|
17709
19128
|
async function verifyNativeCodexThread(sendRequest, threadId) {
|
|
17710
19129
|
const native = await sendRequest("thread/read", { threadId, includeTurns: false });
|
|
17711
|
-
const thread2 =
|
|
17712
|
-
if (!
|
|
19130
|
+
const thread2 = isRecord4(native) ? native.thread : null;
|
|
19131
|
+
if (!isRecord4(thread2) || thread2.id !== threadId || typeof thread2.modelProvider !== "string" || !thread2.modelProvider || thread2.modelProvider === "codexhost" || typeof thread2.cliVersion !== "string" || !thread2.cliVersion || thread2.cliVersion === "codexhost") {
|
|
17713
19132
|
throw new Error("Native Thread response cannot establish Codex ownership");
|
|
17714
19133
|
}
|
|
17715
19134
|
}
|
|
@@ -17747,59 +19166,59 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17747
19166
|
}
|
|
17748
19167
|
|
|
17749
19168
|
// src/renderer-external-steering.ts
|
|
17750
|
-
function
|
|
19169
|
+
function isRecord5(value) {
|
|
17751
19170
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
17752
19171
|
}
|
|
17753
19172
|
function conversationIdFrom(request) {
|
|
17754
19173
|
if (typeof request === "string" && request) return request;
|
|
17755
|
-
if (!
|
|
19174
|
+
if (!isRecord5(request)) return null;
|
|
17756
19175
|
if (typeof request.conversationId === "string" && request.conversationId)
|
|
17757
19176
|
return request.conversationId;
|
|
17758
19177
|
if (typeof request.threadId === "string" && request.threadId) return request.threadId;
|
|
17759
19178
|
return null;
|
|
17760
19179
|
}
|
|
17761
19180
|
function isHostExternalConversation(conversation, threadId) {
|
|
17762
|
-
return
|
|
19181
|
+
return isRecord5(conversation) && conversation.id === threadId && conversation.modelProvider === "codexhost";
|
|
17763
19182
|
}
|
|
17764
19183
|
function isManager(value) {
|
|
17765
|
-
return
|
|
19184
|
+
return isRecord5(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
|
|
17766
19185
|
(key) => typeof value[key] === "function"
|
|
17767
19186
|
);
|
|
17768
19187
|
}
|
|
17769
19188
|
function inputText(input) {
|
|
17770
19189
|
if (!Array.isArray(input)) return "";
|
|
17771
19190
|
return input.filter(
|
|
17772
|
-
(item) =>
|
|
19191
|
+
(item) => isRecord5(item) && typeof item.text === "string"
|
|
17773
19192
|
).map((item) => item.text).join("\n");
|
|
17774
19193
|
}
|
|
17775
19194
|
function queuedFollowUpText(message) {
|
|
17776
|
-
if (!
|
|
19195
|
+
if (!isRecord5(message)) return "";
|
|
17777
19196
|
if (typeof message.text === "string" && message.text.trim()) return message.text;
|
|
17778
19197
|
const context = message.context;
|
|
17779
|
-
if (
|
|
19198
|
+
if (isRecord5(context) && typeof context.prompt === "string" && context.prompt.trim()) {
|
|
17780
19199
|
return context.prompt;
|
|
17781
19200
|
}
|
|
17782
19201
|
return "";
|
|
17783
19202
|
}
|
|
17784
19203
|
function restoreQueuedTurnStartText(manager, params) {
|
|
17785
|
-
if (!isManager(manager) || !
|
|
19204
|
+
if (!isManager(manager) || !isRecord5(params) || typeof params.threadId !== "string")
|
|
17786
19205
|
return params;
|
|
17787
19206
|
if (inputText(params.input).trim()) return params;
|
|
17788
19207
|
const messageId = params.clientUserMessageId;
|
|
17789
19208
|
if (typeof messageId !== "string" || !messageId) return params;
|
|
17790
19209
|
const coordinator = manager.getTurnCoordinator();
|
|
17791
|
-
if (!
|
|
19210
|
+
if (!isRecord5(coordinator) || typeof coordinator.readMessages !== "function") return params;
|
|
17792
19211
|
const messages = coordinator.readMessages.call(coordinator, params.threadId);
|
|
17793
19212
|
if (!Array.isArray(messages)) return params;
|
|
17794
|
-
const match = messages.find((message) =>
|
|
19213
|
+
const match = messages.find((message) => isRecord5(message) && message.id === messageId);
|
|
17795
19214
|
const text = queuedFollowUpText(match);
|
|
17796
19215
|
if (!text) return params;
|
|
17797
19216
|
return { ...params, input: [{ type: "text", text, text_elements: [] }] };
|
|
17798
19217
|
}
|
|
17799
19218
|
function installExternalQueueUi(manager) {
|
|
17800
19219
|
const coordinator = manager.getTurnCoordinator();
|
|
17801
|
-
const options =
|
|
17802
|
-
if (!
|
|
19220
|
+
const options = isRecord5(coordinator) ? coordinator.options : null;
|
|
19221
|
+
if (!isRecord5(options) || typeof options.getMessageQueueMode !== "function") return null;
|
|
17803
19222
|
const descriptor = Object.getOwnPropertyDescriptor(options, "getMessageQueueMode");
|
|
17804
19223
|
if (!descriptor?.writable) return null;
|
|
17805
19224
|
const original = options.getMessageQueueMode;
|
|
@@ -17819,9 +19238,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17819
19238
|
}
|
|
17820
19239
|
function submissionHost(manager) {
|
|
17821
19240
|
const coordinator = manager.getTurnCoordinator();
|
|
17822
|
-
const options =
|
|
17823
|
-
const host =
|
|
17824
|
-
if (!
|
|
19241
|
+
const options = isRecord5(coordinator) ? coordinator.options : null;
|
|
19242
|
+
const host = isRecord5(options) ? options.submissionHost : null;
|
|
19243
|
+
if (!isRecord5(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
|
|
17825
19244
|
throw new Error("Desktop turn submission binding is unavailable");
|
|
17826
19245
|
}
|
|
17827
19246
|
return {
|
|
@@ -17865,20 +19284,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17865
19284
|
var INTERRUPTED_QUEUE_REASON = "Interrupted before the steer was accepted.";
|
|
17866
19285
|
async function preserveQueuedFollowUps(manager, threadId) {
|
|
17867
19286
|
const coordinator = manager.getTurnCoordinator();
|
|
17868
|
-
if (!
|
|
19287
|
+
if (!isRecord5(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
|
|
17869
19288
|
throw new Error("Desktop follow-up queue binding is unavailable");
|
|
17870
19289
|
}
|
|
17871
19290
|
await coordinator.loadMessages.call(coordinator, threadId);
|
|
17872
19291
|
const messages = coordinator.readMessages.call(coordinator, threadId);
|
|
17873
19292
|
if (!Array.isArray(messages)) throw new Error("Desktop follow-up queue is unavailable");
|
|
17874
19293
|
const alreadyPaused = new Set(
|
|
17875
|
-
messages.filter((message) =>
|
|
19294
|
+
messages.filter((message) => isRecord5(message) && message.pausedReason != null).map((message) => message.id)
|
|
17876
19295
|
);
|
|
17877
19296
|
return () => {
|
|
17878
19297
|
coordinator.mutate.call(coordinator, threadId, (current) => {
|
|
17879
19298
|
if (!Array.isArray(current)) return current;
|
|
17880
19299
|
return current.map((message) => {
|
|
17881
|
-
if (!
|
|
19300
|
+
if (!isRecord5(message) || alreadyPaused.has(message.id) || message.pausedReason !== INTERRUPTED_QUEUE_REASON)
|
|
17882
19301
|
return message;
|
|
17883
19302
|
const resumed = { ...message };
|
|
17884
19303
|
delete resumed.pausedReason;
|
|
@@ -17904,16 +19323,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17904
19323
|
if (method === "turn/start" || method === "turn/steer") {
|
|
17905
19324
|
params = restoreQueuedTurnStartText(manager, params);
|
|
17906
19325
|
}
|
|
17907
|
-
const messageId =
|
|
17908
|
-
const route = typeof messageId === "string" &&
|
|
17909
|
-
if (method !== "turn/start" || !
|
|
19326
|
+
const messageId = isRecord5(params) ? params.clientUserMessageId : null;
|
|
19327
|
+
const route = typeof messageId === "string" && isRecord5(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
|
|
19328
|
+
if (method !== "turn/start" || !isRecord5(params) || !route || route.threadId !== params.threadId) {
|
|
17910
19329
|
if (method === "turn/start" && sendTurnStart) {
|
|
17911
19330
|
return sendTurnStart(params, (input) => {
|
|
17912
19331
|
if (disposed) throw new Error("External submission binding was disposed");
|
|
17913
19332
|
return originalSend.call(manager, method, input, options);
|
|
17914
19333
|
});
|
|
17915
19334
|
}
|
|
17916
|
-
if (method === "turn/steer" &&
|
|
19335
|
+
if (method === "turn/steer" && isRecord5(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
|
|
17917
19336
|
params = { ...params, [THREAD_STEER_DELIVERY_PARAM]: "activeTurn" };
|
|
17918
19337
|
}
|
|
17919
19338
|
return originalSend.call(manager, method, params, options);
|
|
@@ -17936,7 +19355,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17936
19355
|
options
|
|
17937
19356
|
)
|
|
17938
19357
|
).then((response) => {
|
|
17939
|
-
if (!
|
|
19358
|
+
if (!isRecord5(response) || typeof response.turnId !== "string" || !response.turnId) {
|
|
17940
19359
|
throw new Error("External steering returned no replacement Turn identity");
|
|
17941
19360
|
}
|
|
17942
19361
|
return {
|
|
@@ -17974,7 +19393,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17974
19393
|
] = args;
|
|
17975
19394
|
if (typeof threadId !== "string") return originalSteer.apply(manager, args);
|
|
17976
19395
|
const role = manager.getStreamRole?.(threadId);
|
|
17977
|
-
if (
|
|
19396
|
+
if (isRecord5(role) && role.role === "follower") return originalSteer.apply(manager, args);
|
|
17978
19397
|
let host = null;
|
|
17979
19398
|
let expectedTurnId;
|
|
17980
19399
|
try {
|
|
@@ -17998,21 +19417,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17998
19417
|
}
|
|
17999
19418
|
if (!host) throw new Error("Desktop turn submission binding is unavailable");
|
|
18000
19419
|
const currentRole = manager.getStreamRole?.(threadId);
|
|
18001
|
-
if (
|
|
19420
|
+
if (isRecord5(currentRole) && currentRole.role === "follower")
|
|
18002
19421
|
return originalSteer.apply(manager, args);
|
|
18003
19422
|
if (!Array.isArray(input) || input.length === 0 || input.some((item) => {
|
|
18004
|
-
if (!
|
|
19423
|
+
if (!isRecord5(item)) return true;
|
|
18005
19424
|
if (item.type === "text") return typeof item.text !== "string";
|
|
18006
19425
|
if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
|
|
18007
19426
|
if (item.type === "image") return typeof item.url !== "string" || !item.url;
|
|
18008
19427
|
return true;
|
|
18009
19428
|
}) || !input.some(
|
|
18010
|
-
(item) =>
|
|
19429
|
+
(item) => isRecord5(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
|
|
18011
19430
|
)) {
|
|
18012
19431
|
throw new Error("External steering requires non-empty text or image input");
|
|
18013
19432
|
}
|
|
18014
19433
|
if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
|
|
18015
|
-
if (!
|
|
19434
|
+
if (!isRecord5(restoreMessage) || !isRecord5(restoreMessage.context)) {
|
|
18016
19435
|
throw new Error("Desktop steering message context is unavailable");
|
|
18017
19436
|
}
|
|
18018
19437
|
const messageId = typeof clientUserMessageId === "string" && clientUserMessageId ? clientUserMessageId : typeof restoreMessage.id === "string" && restoreMessage.id ? restoreMessage.id : crypto.randomUUID();
|
|
@@ -18062,7 +19481,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18062
19481
|
},
|
|
18063
19482
|
onMessageAdded
|
|
18064
19483
|
);
|
|
18065
|
-
if (!
|
|
19484
|
+
if (!isRecord5(response) || !isRecord5(response.turn) || typeof response.turn.id !== "string") {
|
|
18066
19485
|
throw new Error("Desktop returned no replacement Turn identity");
|
|
18067
19486
|
}
|
|
18068
19487
|
try {
|
|
@@ -18084,7 +19503,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18084
19503
|
const threadId = args[0];
|
|
18085
19504
|
if (typeof threadId === "string" && typeof manager.getConversation === "function") {
|
|
18086
19505
|
const conversation = manager.getConversation(threadId);
|
|
18087
|
-
if (
|
|
19506
|
+
if (isRecord5(conversation) && conversation.id === threadId && conversation.modelProvider === "codexhost") {
|
|
18088
19507
|
return externalOwnerRole;
|
|
18089
19508
|
}
|
|
18090
19509
|
}
|
|
@@ -18111,7 +19530,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18111
19530
|
}
|
|
18112
19531
|
|
|
18113
19532
|
// src/renderer-overlay-thread-isolation.ts
|
|
18114
|
-
function
|
|
19533
|
+
function isRecord6(value) {
|
|
18115
19534
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18116
19535
|
}
|
|
18117
19536
|
var BLOCKED_METHODS = /* @__PURE__ */ new Set(["thread/started"]);
|
|
@@ -18135,10 +19554,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18135
19554
|
return method.startsWith("turn/") || method.startsWith("item/");
|
|
18136
19555
|
}
|
|
18137
19556
|
function notificationThreadId2(params) {
|
|
18138
|
-
if (!
|
|
19557
|
+
if (!isRecord6(params)) return void 0;
|
|
18139
19558
|
if (typeof params.threadId === "string" && params.threadId.length > 0) return params.threadId;
|
|
18140
19559
|
const thread2 = params.thread;
|
|
18141
|
-
if (
|
|
19560
|
+
if (isRecord6(thread2) && typeof thread2.id === "string" && thread2.id.length > 0) {
|
|
18142
19561
|
return thread2.id;
|
|
18143
19562
|
}
|
|
18144
19563
|
return void 0;
|
|
@@ -18156,7 +19575,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18156
19575
|
const voiceThreadIds = /* @__PURE__ */ new Set();
|
|
18157
19576
|
const listener = (event) => {
|
|
18158
19577
|
const message = event.data;
|
|
18159
|
-
if (!
|
|
19578
|
+
if (!isRecord6(message) || message.type !== "mcp-notification") return;
|
|
18160
19579
|
if (typeof message.method !== "string") return;
|
|
18161
19580
|
const threadId = notificationThreadId2(message.params);
|
|
18162
19581
|
if (message.method === "thread/realtime/started" && threadId) {
|
|
@@ -18181,17 +19600,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18181
19600
|
var DISCOVERY_MS = 6e4;
|
|
18182
19601
|
var INTERVAL_MS = 50;
|
|
18183
19602
|
var HOOK_WALK_LIMIT = 120;
|
|
18184
|
-
function
|
|
19603
|
+
function isRecord7(value) {
|
|
18185
19604
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18186
19605
|
}
|
|
18187
19606
|
function isFollowUpManager(value) {
|
|
18188
|
-
return
|
|
19607
|
+
return isRecord7(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator", "getConversation"].every(
|
|
18189
19608
|
(key) => typeof value[key] === "function"
|
|
18190
19609
|
);
|
|
18191
19610
|
}
|
|
18192
19611
|
function managerFromHookState(value) {
|
|
18193
19612
|
if (isFollowUpManager(value)) return value;
|
|
18194
|
-
return
|
|
19613
|
+
return isRecord7(value) && isFollowUpManager(value.manager) ? value.manager : null;
|
|
18195
19614
|
}
|
|
18196
19615
|
function overlayFollowUpManagers(document) {
|
|
18197
19616
|
const managers = /* @__PURE__ */ new Set();
|
|
@@ -18269,7 +19688,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18269
19688
|
var VOICE_REGION_SELECTOR = '[data-avatar-overlay-hit-region="realtime-voice"]';
|
|
18270
19689
|
var HIDE_SELECTOR = `${MASCOT_SELECTOR}, ${TRANSCRIPT_SELECTOR}, ${QUICK_CHAT_ORB_SELECTOR}`;
|
|
18271
19690
|
var OVERLAY_VOICE_MIN_EDGE = 40;
|
|
18272
|
-
function
|
|
19691
|
+
function isRecord8(value) {
|
|
18273
19692
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18274
19693
|
}
|
|
18275
19694
|
function overlayOwnsVoiceControls(document) {
|
|
@@ -18322,7 +19741,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18322
19741
|
};
|
|
18323
19742
|
const listener = (event) => {
|
|
18324
19743
|
const message = event.data;
|
|
18325
|
-
if (!
|
|
19744
|
+
if (!isRecord8(message) || message.type !== "mcp-notification") return;
|
|
18326
19745
|
if (typeof message.method !== "string") return;
|
|
18327
19746
|
const threadId = notificationThreadId2(message.params);
|
|
18328
19747
|
if (!threadId) return;
|
|
@@ -18421,7 +19840,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18421
19840
|
}
|
|
18422
19841
|
return hook == null ? result : [];
|
|
18423
19842
|
}
|
|
18424
|
-
function bindVoiceCapabilitySubscriptions(currentFibers, family, gates, allowed, realtimeOnly = false, names = ["voice.realtime", "voice.thread"]) {
|
|
19843
|
+
function bindVoiceCapabilitySubscriptions(currentFibers, family, gates, allowed, realtimeOnly = false, names = ["voice.realtime", "voice.thread"], project2) {
|
|
18425
19844
|
const fibers = currentFibers();
|
|
18426
19845
|
const restores = [];
|
|
18427
19846
|
const bindings = [];
|
|
@@ -18457,12 +19876,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18457
19876
|
subscriber.getSnapshot()
|
|
18458
19877
|
) || !equal(subscriber.getSnapshot(), instance.getSnapshot()) || subscriber.createRender?.() != null)
|
|
18459
19878
|
throw new Error("Unsupported voice subscription");
|
|
18460
|
-
for (const [
|
|
19879
|
+
for (const [object5, key] of [
|
|
18461
19880
|
[store, "sub"],
|
|
18462
19881
|
[subscriber, "getSnapshot"],
|
|
18463
19882
|
[instance, "getSnapshot"]
|
|
18464
19883
|
])
|
|
18465
|
-
if (Object.getOwnPropertyDescriptor(
|
|
19884
|
+
if (Object.getOwnPropertyDescriptor(object5, key)?.writable !== true)
|
|
18466
19885
|
throw new Error("Voice subscription is not writable");
|
|
18467
19886
|
let notify;
|
|
18468
19887
|
const sub = store.sub;
|
|
@@ -18484,7 +19903,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18484
19903
|
const snapshot = () => {
|
|
18485
19904
|
const native = original.call(subscriber);
|
|
18486
19905
|
if (!allowed()) return native;
|
|
18487
|
-
const projected =
|
|
19906
|
+
const projected = project2 ? project2({
|
|
19907
|
+
native,
|
|
19908
|
+
store,
|
|
19909
|
+
atom: signal.atom,
|
|
19910
|
+
gate,
|
|
19911
|
+
node,
|
|
19912
|
+
chain
|
|
19913
|
+
}) : replayVoiceCapability(store, signal.atom, gate);
|
|
18488
19914
|
if (!projected || !projected.isCapable) return native;
|
|
18489
19915
|
if (!previous || !equal(previous, projected)) previous = projected;
|
|
18490
19916
|
return previous;
|
|
@@ -18554,13 +19980,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18554
19980
|
const mode = request.activeCollaborationMode;
|
|
18555
19981
|
const settings = record4(mode) ? mode.settings : void 0;
|
|
18556
19982
|
const model2 = record4(settings) ? settings.model : void 0;
|
|
18557
|
-
|
|
19983
|
+
if (typeof model2 === "string" && model2.startsWith("codexhost/")) return externalHarness;
|
|
19984
|
+
return workGateway || externalHarness;
|
|
18558
19985
|
}
|
|
18559
19986
|
function wrapGatewayVoiceStarter(start, options) {
|
|
18560
19987
|
let active;
|
|
18561
19988
|
return {
|
|
18562
19989
|
async start(...args) {
|
|
18563
|
-
|
|
19990
|
+
const request = args[0];
|
|
19991
|
+
const qualified = options.qualifies(request);
|
|
19992
|
+
const wantsGateway = options.configured?.(request) ?? qualified;
|
|
19993
|
+
if (!wantsGateway) return start(...args);
|
|
19994
|
+
if (!qualified) {
|
|
19995
|
+
throw new Error(
|
|
19996
|
+
options.unavailable?.(request) ?? "Work voice is not qualified on this Desktop."
|
|
19997
|
+
);
|
|
19998
|
+
}
|
|
18564
19999
|
if (active) throw new Error("Voice gateway start is already pending");
|
|
18565
20000
|
const attempt = {};
|
|
18566
20001
|
active = attempt;
|
|
@@ -18653,12 +20088,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18653
20088
|
if (typeof start !== "function" || typeof cancel !== "function")
|
|
18654
20089
|
throw new Error("Voice starter callback unavailable");
|
|
18655
20090
|
const wrapper = wrapGatewayVoiceStarter(start, {
|
|
20091
|
+
configured: (request) => {
|
|
20092
|
+
const mode = record4(request) ? request.activeCollaborationMode : void 0;
|
|
20093
|
+
const settings = record4(mode) ? mode.settings : void 0;
|
|
20094
|
+
const model2 = record4(settings) ? settings.model : void 0;
|
|
20095
|
+
return gatewayVoiceStartRequest(
|
|
20096
|
+
request,
|
|
20097
|
+
cpaLiveVoicePreferenceAllowsInstall(target2),
|
|
20098
|
+
chatLiveVoicePreferenceAllowsOverride(target2),
|
|
20099
|
+
typeof model2 === "string" && model2.startsWith("codexhost/")
|
|
20100
|
+
);
|
|
20101
|
+
},
|
|
18656
20102
|
qualifies: (request) => !disposed && !!readCpaLiveVoiceHookConfig(target2) && gatewayVoiceStartRequest(
|
|
18657
20103
|
request,
|
|
18658
|
-
cpaLiveVoicePreferenceAllowsInstall(target2),
|
|
20104
|
+
cpaLiveVoicePreferenceAllowsInstall(target2) && workVoiceLaneEnabled(target2, "work-codex"),
|
|
18659
20105
|
chatLiveVoicePreferenceAllowsOverride(target2),
|
|
18660
|
-
|
|
20106
|
+
workVoiceLaneEnabled(target2, "work-grok")
|
|
18661
20107
|
),
|
|
20108
|
+
unavailable: (request) => {
|
|
20109
|
+
const mode = record4(request) ? request.activeCollaborationMode : void 0;
|
|
20110
|
+
const settings = record4(mode) ? mode.settings : void 0;
|
|
20111
|
+
const model2 = record4(settings) ? settings.model : void 0;
|
|
20112
|
+
const path = typeof model2 === "string" && model2.startsWith("codexhost/") ? "work-grok" : "work-codex";
|
|
20113
|
+
return workVoiceUserFacingUnavailable(target2, path);
|
|
20114
|
+
},
|
|
18662
20115
|
ready: async () => {
|
|
18663
20116
|
const hook = target2.__codexhostClientOwnedVoiceV1;
|
|
18664
20117
|
if (!record4(hook) || hook.status !== "active") return false;
|