@karlorz/codexhost-cli-linux-x64 0.21.0-1 → 0.22.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.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +1 -0
  4. package/app/console-web.js +2 -1
  5. package/app/cpa-live-voice-hook.js +213 -181
  6. package/app/desktop-controller.mjs +4 -1
  7. package/app/host-runtime.mjs +96 -26
  8. package/app/overlay-voice-bootstrap.js +1 -1616
  9. package/app/plugins/antigravity/plugin.mjs +1144 -1254
  10. package/app/plugins/claude-code/plugin.mjs +389 -80
  11. package/app/plugins/codebuddy/plugin.mjs +1 -0
  12. package/app/plugins/codex-usage/plugin.mjs +1 -0
  13. package/app/plugins/copilot/plugin.mjs +1 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +1 -0
  15. package/app/plugins/deepseek-harness/plugin.mjs +1 -0
  16. package/app/plugins/devin/plugin.mjs +1 -0
  17. package/app/plugins/grok/plugin.mjs +232 -217
  18. package/app/plugins/hermes/plugin.mjs +1 -0
  19. package/app/plugins/kimi-code/plugin.mjs +1 -0
  20. package/app/plugins/kiro-cli/plugin.mjs +1 -0
  21. package/app/plugins/omp/plugin.mjs +108 -22
  22. package/app/plugins/opencode/plugin.mjs +1 -0
  23. package/app/plugins/pi/plugin.mjs +119 -23
  24. package/app/plugins/qoder/plugin.mjs +1 -0
  25. package/app/plugins/qoder-cn/plugin.mjs +1 -0
  26. package/app/plugins/qwen-code/plugin.mjs +1 -0
  27. package/app/plugins/workbuddy/plugin.mjs +1 -0
  28. package/app/plugins/zcode/plugin.mjs +1 -0
  29. package/app/renderer-extension.js +764 -477
  30. package/app/voice-qualification.json +10 -10
  31. package/app/web/assets/index-CYo5zTz_.js +201 -0
  32. package/app/web/codexhost-settings.js +2 -1
  33. package/app/web/index.html +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +3 -3
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +9 -9
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
  40. package/app/web-modules/server.mjs +130 -74
  41. package/bin/codexhost +0 -0
  42. package/libexec/codexhost-shim +0 -0
  43. package/libexec/codexhost-updater +0 -0
  44. package/package.json +1 -1
  45. package/app/web/assets/index-DLXdvkWR.js +0 -201
@@ -16985,6 +16985,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16985
16985
  message: "A history continuation requires its connection epoch"
16986
16986
  }).optional()
16987
16987
  }),
16988
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
16988
16989
  external_exports.strictObject({
16989
16990
  kind: external_exports.literal("configure"),
16990
16991
  ...thread,
@@ -17159,13 +17160,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17159
17160
  }
17160
17161
  function parseVoiceRoutes(value) {
17161
17162
  if (value === null || typeof value !== "object") return;
17162
- const record5 = value;
17163
- if (record5.chatExperience !== "chatgpt" && record5.chatExperience !== "codex" || record5.chatConnection !== "desktop" && record5.chatConnection !== "gateway" || record5.workConnection !== "desktop" && record5.workConnection !== "gateway")
17163
+ const record6 = value;
17164
+ if (record6.chatExperience !== "chatgpt" && record6.chatExperience !== "codex" || record6.chatConnection !== "desktop" && record6.chatConnection !== "gateway" || record6.workConnection !== "desktop" && record6.workConnection !== "gateway")
17164
17165
  return;
17165
17166
  return {
17166
- chatExperience: record5.chatExperience,
17167
- chatConnection: record5.chatConnection,
17168
- workConnection: record5.workConnection
17167
+ chatExperience: record6.chatExperience,
17168
+ chatConnection: record6.chatConnection,
17169
+ workConnection: record6.workConnection
17169
17170
  };
17170
17171
  }
17171
17172
  function cachedVoiceRoutes(owner) {
@@ -17195,8 +17196,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17195
17196
  const routes = cachedVoiceRoutes(owner);
17196
17197
  return routes ? routes.chatExperience === "chatgpt" : !readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
17197
17198
  }
17198
-
17199
- // src/renderer-cpa-live-voice-preference.ts
17200
17199
  function readCpaLiveVoicePreference(owner) {
17201
17200
  const routes = cachedVoiceRoutes(owner);
17202
17201
  return routes ? routes.workConnection === "gateway" : readVoiceStorageFlag(owner, CPA_LIVE_VOICE_STORAGE_KEY, true);
@@ -17327,7 +17326,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17327
17326
  }
17328
17327
 
17329
17328
  // src/renderer-voice-implementation-revision.generated.ts
17330
- var VOICE_IMPLEMENTATION_REVISION = "496ea96312a2e7b6";
17329
+ var VOICE_IMPLEMENTATION_REVISION = "8c002fd4e12c0ecb";
17331
17330
 
17332
17331
  // src/renderer-voice-profiles.ts
17333
17332
  var NATIVE_CHAT_VOICE_VERSION = "26.1027.61615";
@@ -18030,106 +18029,106 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18030
18029
  function recordObject(value) {
18031
18030
  return value !== null && typeof value === "object";
18032
18031
  }
18033
- function missingStages(record5) {
18034
- return REQUIRED_STAGES.filter((stage) => record5.stages[stage] !== true);
18032
+ function missingStages(record6) {
18033
+ return REQUIRED_STAGES.filter((stage) => record6.stages[stage] !== true);
18035
18034
  }
18036
18035
  function productForPath(path) {
18037
18036
  return path === "chat" ? "chat" : "work";
18038
18037
  }
18039
- function evaluateVoiceEvidence(record5) {
18038
+ function evaluateVoiceEvidence(record6) {
18040
18039
  const expectedKey = profileIdentityKey(
18041
- productForPath(record5.path),
18042
- record5.platform,
18043
- record5.desktopVersion
18040
+ productForPath(record6.path),
18041
+ record6.platform,
18042
+ record6.desktopVersion
18044
18043
  );
18045
- if (record5.profileKey !== expectedKey) {
18044
+ if (record6.profileKey !== expectedKey) {
18046
18045
  return {
18047
18046
  outcome: "mismatch",
18048
18047
  qualified: false,
18049
- missing: missingStages(record5),
18048
+ missing: missingStages(record6),
18050
18049
  reason: "evidence-profile-mismatch"
18051
18050
  };
18052
18051
  }
18053
- if (typeof record5.implementationRevision !== "string" || record5.implementationRevision === "") {
18052
+ if (typeof record6.implementationRevision !== "string" || record6.implementationRevision === "") {
18054
18053
  return {
18055
18054
  outcome: "mismatch",
18056
18055
  qualified: false,
18057
- missing: missingStages(record5),
18056
+ missing: missingStages(record6),
18058
18057
  reason: "missing-implementation-revision"
18059
18058
  };
18060
18059
  }
18061
- if (record5.policy !== "legacy-retained" && record5.implementationRevision !== voiceImplementationRevision()) {
18060
+ if (record6.policy !== "legacy-retained" && record6.implementationRevision !== voiceImplementationRevision()) {
18062
18061
  return {
18063
18062
  outcome: "mismatch",
18064
18063
  qualified: false,
18065
- missing: missingStages(record5),
18064
+ missing: missingStages(record6),
18066
18065
  reason: "implementation-revision-mismatch"
18067
18066
  };
18068
18067
  }
18069
- if (record5.policy !== "legacy-retained") {
18070
- if (typeof record5.desktopBuild !== "string" || record5.desktopBuild === "" || typeof record5.asarDigest !== "string" || record5.asarDigest === "") {
18068
+ if (record6.policy !== "legacy-retained") {
18069
+ if (typeof record6.desktopBuild !== "string" || record6.desktopBuild === "" || typeof record6.asarDigest !== "string" || record6.asarDigest === "") {
18071
18070
  return {
18072
18071
  outcome: "mismatch",
18073
18072
  qualified: false,
18074
- missing: missingStages(record5),
18073
+ missing: missingStages(record6),
18075
18074
  reason: "missing-native-identity"
18076
18075
  };
18077
18076
  }
18078
18077
  }
18079
- if (typeof record5.profileDigest !== "string" || record5.profileDigest === "") {
18078
+ if (typeof record6.profileDigest !== "string" || record6.profileDigest === "") {
18080
18079
  return {
18081
18080
  outcome: "mismatch",
18082
18081
  qualified: false,
18083
- missing: missingStages(record5),
18082
+ missing: missingStages(record6),
18084
18083
  reason: "missing-profile-digest"
18085
18084
  };
18086
18085
  }
18087
18086
  const expectedDigest = voiceProfileDigest(
18088
- productForPath(record5.path),
18089
- record5.platform,
18090
- record5.desktopVersion
18087
+ productForPath(record6.path),
18088
+ record6.platform,
18089
+ record6.desktopVersion
18091
18090
  );
18092
- if (!expectedDigest || record5.profileDigest !== expectedDigest) {
18091
+ if (!expectedDigest || record6.profileDigest !== expectedDigest) {
18093
18092
  return {
18094
18093
  outcome: "mismatch",
18095
18094
  qualified: false,
18096
- missing: missingStages(record5),
18095
+ missing: missingStages(record6),
18097
18096
  reason: "stale-profile-digest"
18098
18097
  };
18099
18098
  }
18100
- if (record5.startAcknowledged === true && record5.connected !== true) {
18099
+ if (record6.startAcknowledged === true && record6.connected !== true) {
18101
18100
  return {
18102
18101
  outcome: "incomplete",
18103
18102
  qualified: false,
18104
- missing: missingStages(record5).length > 0 ? missingStages(record5) : ["connection"],
18103
+ missing: missingStages(record6).length > 0 ? missingStages(record6) : ["connection"],
18105
18104
  reason: "start-acknowledged-without-connection"
18106
18105
  };
18107
18106
  }
18108
- if (record5.path !== "chat" && record5.gatewayOwned !== true && record5.stages.connection === true) {
18107
+ if (record6.path !== "chat" && record6.gatewayOwned !== true && record6.stages.connection === true) {
18109
18108
  return {
18110
18109
  outcome: "incomplete",
18111
18110
  qualified: false,
18112
- missing: missingStages(record5).length > 0 ? missingStages(record5) : ["connection"],
18111
+ missing: missingStages(record6).length > 0 ? missingStages(record6) : ["connection"],
18113
18112
  reason: "route-only-without-connected-gateway"
18114
18113
  };
18115
18114
  }
18116
- if (record5.speech?.attended === true && (!record5.speech.witness || !record5.speech.run)) {
18115
+ if (record6.speech?.attended === true && (!record6.speech.witness || !record6.speech.run)) {
18117
18116
  return {
18118
18117
  outcome: "incomplete",
18119
18118
  qualified: false,
18120
- missing: missingStages(record5).includes("speech") ? missingStages(record5) : ["speech"],
18119
+ missing: missingStages(record6).includes("speech") ? missingStages(record6) : ["speech"],
18121
18120
  reason: "attended-speech-missing-provenance"
18122
18121
  };
18123
18122
  }
18124
- if (record5.speech && record5.speech.attended !== true) {
18123
+ if (record6.speech && record6.speech.attended !== true) {
18125
18124
  return {
18126
18125
  outcome: "incomplete",
18127
18126
  qualified: false,
18128
- missing: missingStages(record5),
18127
+ missing: missingStages(record6),
18129
18128
  reason: "synthetic-speech-is-not-qualification"
18130
18129
  };
18131
18130
  }
18132
- const missing = missingStages(record5);
18131
+ const missing = missingStages(record6);
18133
18132
  if (missing.length > 0) {
18134
18133
  return {
18135
18134
  outcome: "incomplete",
@@ -18138,7 +18137,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18138
18137
  reason: `missing:${missing.join(",")}`
18139
18138
  };
18140
18139
  }
18141
- 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) {
18140
+ if (record6.connected !== true || record6.conversationMatched !== true || (record6.path === "chat" ? record6.harnessMatched !== void 0 && record6.harnessMatched !== true : record6.harnessMatched !== true) || record6.speech?.attended !== true || record6.speech.bothDirections !== true || record6.cleanup?.ended !== true || record6.cleanup.microphoneReleased !== true) {
18142
18141
  return {
18143
18142
  outcome: "fail",
18144
18143
  qualified: false,
@@ -18148,15 +18147,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18148
18147
  }
18149
18148
  return { outcome: "pass", qualified: true, missing: [], reason: "qualified" };
18150
18149
  }
18151
- function evidenceMatchesRuntime(record5, config2) {
18152
- if (record5.platform !== config2.desktopPlatform) return false;
18153
- if (record5.desktopVersion !== config2.desktopVersion) return false;
18154
- if (record5.implementationRevision !== config2.implementationRevision) return false;
18155
- if (record5.policy === "legacy-retained") return true;
18156
- 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 === "") {
18150
+ function evidenceMatchesRuntime(record6, config2) {
18151
+ if (record6.platform !== config2.desktopPlatform) return false;
18152
+ if (record6.desktopVersion !== config2.desktopVersion) return false;
18153
+ if (record6.implementationRevision !== config2.implementationRevision) return false;
18154
+ if (record6.policy === "legacy-retained") return true;
18155
+ if (typeof record6.desktopBuild !== "string" || record6.desktopBuild === "" || typeof record6.asarDigest !== "string" || record6.asarDigest === "" || typeof config2.desktopBuild !== "string" || config2.desktopBuild === "" || typeof config2.asarDigest !== "string" || config2.asarDigest === "" || typeof config2.implementationRevision !== "string" || config2.implementationRevision === "") {
18157
18156
  return false;
18158
18157
  }
18159
- return record5.desktopBuild === config2.desktopBuild && record5.asarDigest === config2.asarDigest;
18158
+ return record6.desktopBuild === config2.desktopBuild && record6.asarDigest === config2.asarDigest;
18160
18159
  }
18161
18160
  function isolatedVoicePathEnabled(config2, path) {
18162
18161
  return isolatedQualificationMatches(path, config2);
@@ -18180,27 +18179,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18180
18179
  if (!config2.desktopVersion || !config2.desktopPlatform) {
18181
18180
  return { enabled: false, policy: "unreviewed", reason: "waiting-for-identity" };
18182
18181
  }
18183
- const pathRecords = records.filter((record5) => record5.path === path);
18182
+ const pathRecords = records.filter((record6) => record6.path === path);
18184
18183
  if (pathRecords.length > 0) {
18185
- const matching = pathRecords.filter((record6) => evidenceMatchesRuntime(record6, config2));
18184
+ const matching = pathRecords.filter((record7) => evidenceMatchesRuntime(record7, config2));
18186
18185
  if (matching.length === 0) {
18187
18186
  return { enabled: false, policy: "unreviewed", reason: "stale-or-wrong-platform-evidence" };
18188
18187
  }
18189
- for (const record6 of matching) {
18190
- const evaluation = evaluateVoiceEvidence(record6);
18188
+ for (const record7 of matching) {
18189
+ const evaluation = evaluateVoiceEvidence(record7);
18191
18190
  if (!evaluation.qualified) {
18192
18191
  return { enabled: false, policy: "unreviewed", reason: evaluation.reason };
18193
18192
  }
18194
18193
  }
18195
- const record5 = matching[0];
18196
- if (!record5) {
18194
+ const record6 = matching[0];
18195
+ if (!record6) {
18197
18196
  return { enabled: false, policy: "unreviewed", reason: "missing-evidence" };
18198
18197
  }
18199
18198
  if (hashedVoiceCandidateOwner(config2) && !hashedVoiceProfileSupported(config2)) {
18200
18199
  } else {
18201
18200
  return {
18202
18201
  enabled: true,
18203
- policy: record5.policy === "legacy-retained" ? "legacy-retained" : "reviewed"
18202
+ policy: record6.policy === "legacy-retained" ? "legacy-retained" : "reviewed"
18204
18203
  };
18205
18204
  }
18206
18205
  }
@@ -18344,15 +18343,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18344
18343
  function parseRealtimeCallResponse(value) {
18345
18344
  if (value === null || typeof value !== "object")
18346
18345
  throw new Error("Invalid voice gateway response");
18347
- const record5 = value;
18348
- 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)) {
18346
+ const record6 = value;
18347
+ if (typeof record6.status !== "number" || !Number.isInteger(record6.status) || record6.status < 200 || record6.status > 599 || typeof record6.body !== "string" || record6.headers === null || typeof record6.headers !== "object" || Array.isArray(record6.headers)) {
18349
18348
  throw new Error("Invalid voice gateway response");
18350
18349
  }
18351
18350
  const headers = {};
18352
- for (const [name, header] of Object.entries(record5.headers)) {
18351
+ for (const [name, header] of Object.entries(record6.headers)) {
18353
18352
  if (typeof header === "string") headers[name] = header;
18354
18353
  }
18355
- return { status: record5.status, body: record5.body, headers };
18354
+ return { status: record6.status, body: record6.body, headers };
18356
18355
  }
18357
18356
  function backendModelName(headers) {
18358
18357
  const raw = new Headers(headers).get("x-codex-turn-metadata");
@@ -18703,19 +18702,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18703
18702
  function hookWebpackVoiceFactory(req, onExports) {
18704
18703
  const modules = req.m;
18705
18704
  const factoryId = HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId;
18706
- const original = modules?.[factoryId];
18707
- if (!modules || typeof original !== "function") return false;
18708
- if (original.__codexhostVoiceFactory) return true;
18709
- const wrapped = function(module, exports, webpackRequire) {
18705
+ const installed = modules?.[factoryId];
18706
+ if (!modules || typeof installed !== "function") return void 0;
18707
+ const owned = installed.__codexhostVoiceFactory === true && typeof installed.__codexhostVoiceOriginal === "function";
18708
+ const original = owned ? installed.__codexhostVoiceOriginal : installed;
18709
+ const wrapped = owned ? installed : function(module, exports, webpackRequire) {
18710
18710
  try {
18711
18711
  return original.apply(this, [module, exports, webpackRequire]);
18712
18712
  } finally {
18713
- onExports(exports ?? module?.exports);
18713
+ try {
18714
+ wrapped.__codexhostVoiceSubscriber?.(exports ?? module?.exports);
18715
+ } catch {
18716
+ }
18714
18717
  }
18715
18718
  };
18716
18719
  wrapped.__codexhostVoiceFactory = true;
18717
- modules[factoryId] = wrapped;
18718
- return true;
18720
+ wrapped.__codexhostVoiceOriginal = original;
18721
+ wrapped.__codexhostVoiceSubscriber = onExports;
18722
+ if (!owned) modules[factoryId] = wrapped;
18723
+ return () => {
18724
+ if (wrapped.__codexhostVoiceSubscriber !== onExports) return;
18725
+ Reflect.deleteProperty(wrapped, "__codexhostVoiceSubscriber");
18726
+ if (modules[factoryId] === wrapped) modules[factoryId] = original;
18727
+ };
18719
18728
  }
18720
18729
  async function resolveHashedWebpackVoice(importModule) {
18721
18730
  const runtime = await importModule(`app://-/assets/${HASHED_WEBPACK_VOICE_RUNTIME_ASSET}`);
@@ -18735,7 +18744,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18735
18744
  return {
18736
18745
  client,
18737
18746
  bridge: bridged,
18738
- responseError
18747
+ responseError,
18748
+ require: req
18739
18749
  };
18740
18750
  if (typeof req.m?.[HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId] !== "function") return null;
18741
18751
  return {
@@ -18758,6 +18768,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18758
18768
  let timer;
18759
18769
  let surfaceTimer;
18760
18770
  let restore;
18771
+ let restoreFactory;
18772
+ const wrappedClients = /* @__PURE__ */ new WeakSet();
18761
18773
  const started = Date.now();
18762
18774
  const activation = {
18763
18775
  assetSeen: false,
@@ -18776,6 +18788,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18776
18788
  if (timer !== void 0) target2.clearTimeout(timer);
18777
18789
  if (surfaceTimer !== void 0) target2.clearTimeout(surfaceTimer);
18778
18790
  pointerTarget?.removeEventListener?.("pointerdown", onPointerDown, true);
18791
+ restoreFactory?.();
18779
18792
  restore?.();
18780
18793
  if (target2[HOOK_GLOBAL] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL);
18781
18794
  }
@@ -18789,7 +18802,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18789
18802
  };
18790
18803
  publishLoop();
18791
18804
  const activate = (client, bridge, responseError) => {
18792
- restore = wrapClientOwnedVoiceFetch(
18805
+ if (wrappedClients.has(client)) {
18806
+ activation.wrapperActive = true;
18807
+ handle.status = "active";
18808
+ return;
18809
+ }
18810
+ wrappedClients.add(client);
18811
+ const disposeWrap = wrapClientOwnedVoiceFetch(
18793
18812
  client,
18794
18813
  bridge,
18795
18814
  () => workGatewayPreference(target2),
@@ -18808,11 +18827,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18808
18827
  () => false,
18809
18828
  () => nativeChatVoicePreferenceAllowsStart(target2)
18810
18829
  );
18830
+ const previous = restore;
18831
+ restore = () => {
18832
+ disposeWrap();
18833
+ previous?.();
18834
+ };
18811
18835
  activation.wrapperActive = true;
18812
18836
  handle.status = "active";
18813
18837
  };
18814
18838
  const attempt = async () => {
18815
- if (disposed || handle.status === "active") return;
18839
+ if (disposed || activation.wrapperActive && activation.factoryHooked) return;
18816
18840
  publishComposerLaunchExperience(target2);
18817
18841
  const names = loadedAssetNames(target2.document, target2.performance);
18818
18842
  const hashedAssetSeen = names.some((name) => name.includes(HASHED_WEBPACK_VOICE_RUNTIME_ASSET));
@@ -18821,38 +18845,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18821
18845
  activation.importStarted = true;
18822
18846
  try {
18823
18847
  const resolved = await resolveHashedWebpackVoice(importModule);
18824
- if (disposed || activation.wrapperActive) return;
18825
- if (resolved?.client) {
18826
- activation.importResolved = true;
18827
- delete activation.importFailed;
18828
- activate(resolved.client, resolved.bridge, resolved.responseError);
18829
- return;
18830
- }
18831
- const webpackRequire = resolved?.require;
18832
- if (webpackRequire && hookWebpackVoiceFactory(webpackRequire, (exports) => {
18833
- if (disposed || activation.wrapperActive) return;
18834
- const client = nativeVoiceFetch(
18835
- object3(exports) ? exports[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
18836
- );
18837
- if (!client) {
18838
- unpoisonIncompleteWebpackModule(
18839
- webpackRequire,
18840
- HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId,
18841
- (value) => Boolean(
18842
- nativeVoiceFetch(
18843
- object3(value) ? value[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
18844
- )
18845
- )
18848
+ if (disposed || !resolved) {
18849
+ if (!disposed) activation.importFailed = "hashed-exports-missing";
18850
+ } else {
18851
+ const wrapExports = (exports) => {
18852
+ if (disposed) return;
18853
+ const client = nativeVoiceFetch(
18854
+ object3(exports) ? exports[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
18846
18855
  );
18847
- return;
18856
+ if (!client) {
18857
+ if (resolved.require)
18858
+ unpoisonIncompleteWebpackModule(
18859
+ resolved.require,
18860
+ HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId,
18861
+ (value) => Boolean(
18862
+ nativeVoiceFetch(
18863
+ object3(value) ? value[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
18864
+ )
18865
+ )
18866
+ );
18867
+ return;
18868
+ }
18869
+ activate(client, resolved.bridge, resolved.responseError);
18870
+ };
18871
+ if (resolved.client) {
18872
+ activation.importResolved = true;
18873
+ delete activation.importFailed;
18874
+ activate(resolved.client, resolved.bridge, resolved.responseError);
18875
+ }
18876
+ const disposeFactory = resolved.require ? hookWebpackVoiceFactory(resolved.require, wrapExports) : void 0;
18877
+ if (disposeFactory) {
18878
+ restoreFactory = disposeFactory;
18879
+ activation.importResolved = true;
18880
+ activation.factoryHooked = true;
18881
+ delete activation.importFailed;
18848
18882
  }
18849
- activate(client, resolved.bridge, resolved.responseError);
18850
- })) {
18851
- activation.importResolved = true;
18852
- activation.factoryHooked = true;
18853
- delete activation.importFailed;
18854
- return;
18855
18883
  }
18884
+ if (activation.wrapperActive || activation.factoryHooked) return;
18856
18885
  activation.importFailed = "hashed-exports-missing";
18857
18886
  } catch {
18858
18887
  activation.importFailed = "hashed-import-failed";
@@ -19874,10 +19903,80 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19874
19903
  return handle;
19875
19904
  }
19876
19905
 
19877
- // src/renderer-voice-capability.ts
19906
+ // src/renderer-voice-starter-core.ts
19907
+ var record3 = (v) => v !== null && typeof v === "object";
19908
+ function gatewayVoiceStartRequest(request, workGateway, chatGateway = false, externalHarness = false) {
19909
+ if (!record3(request) || request.productExperience !== "work" && request.productExperience !== "codex" && request.productExperience !== "chat")
19910
+ return false;
19911
+ if (request.source === "composer_button_existing_thread") {
19912
+ if (!record3(request.locator) || request.locator.hostId !== "local") return false;
19913
+ } else if (request.source !== "composer_button_new_thread" || (request.hostId ?? "local") !== "local")
19914
+ return false;
19915
+ if (request.productExperience === "chat") return chatGateway;
19916
+ const mode = request.activeCollaborationMode;
19917
+ const settings = record3(mode) ? mode.settings : void 0;
19918
+ const model2 = record3(settings) ? settings.model : void 0;
19919
+ if (typeof model2 === "string" && model2.startsWith("codexhost/")) return externalHarness;
19920
+ return workGateway || externalHarness;
19921
+ }
19922
+ function wrapGatewayVoiceStarter(start, options) {
19923
+ let active;
19924
+ return {
19925
+ async start(...args) {
19926
+ const request = args[0];
19927
+ const qualified = options.qualifies(request);
19928
+ const wantsGateway = options.configured?.(request) ?? qualified;
19929
+ if (!wantsGateway) return start(...args);
19930
+ if (!qualified) {
19931
+ throw new Error(
19932
+ options.unavailable?.(request) ?? "Work voice is not qualified on this Desktop."
19933
+ );
19934
+ }
19935
+ if (active) {
19936
+ active.binding?.dispose();
19937
+ active = void 0;
19938
+ }
19939
+ const attempt = {};
19940
+ active = attempt;
19941
+ const allowed = () => active === attempt && options.qualifies(args[0]);
19942
+ try {
19943
+ if (!await options.ready()) throw new Error("Voice gateway is not ready");
19944
+ if (!allowed()) throw new Error("Voice gateway start was cancelled");
19945
+ attempt.binding = await options.prepare(allowed);
19946
+ await options.committed(attempt.binding);
19947
+ if (!allowed()) throw new Error("Voice gateway start was cancelled");
19948
+ if (!attempt.binding.current()) throw new Error("Voice starter subscription changed");
19949
+ rememberVoiceProductExperience(args[0]);
19950
+ return await start(...args);
19951
+ } finally {
19952
+ attempt.binding?.dispose();
19953
+ if (active === attempt) active = void 0;
19954
+ }
19955
+ },
19956
+ cancel() {
19957
+ active?.binding?.dispose();
19958
+ active = void 0;
19959
+ }
19960
+ };
19961
+ }
19962
+ function overlayVoiceStarterFibers(document, page) {
19963
+ const fibers = /* @__PURE__ */ new Set();
19964
+ for (const element of document.querySelectorAll("[data-avatar-overlay-native-surface-id]")) {
19965
+ const key = Object.getOwnPropertyNames(element).find((key2) => key2.startsWith("__reactFiber$"));
19966
+ const ancestors = committedReactAncestors(
19967
+ key && Object.getOwnPropertyDescriptor(element, key)?.value
19968
+ );
19969
+ const boundary = ancestors.findIndex((fiber) => record3(fiber) && fiber.type === page);
19970
+ if (boundary < 0) continue;
19971
+ for (const fiber of ancestors.slice(0, boundary)) if (record3(fiber)) fibers.add(fiber);
19972
+ }
19973
+ return fibers;
19974
+ }
19975
+
19976
+ // src/renderer-voice-capability-subscriptions.ts
19878
19977
  var INFERENCE_GATE = "3683713372";
19879
- var record3 = (value) => value !== null && typeof value === "object";
19880
- var capable = (value) => record3(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
19978
+ var record4 = (value) => value !== null && typeof value === "object";
19979
+ var capable = (value) => record4(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
19881
19980
  var equal = (a, b) => a.isLoading === b.isLoading && a.isError === b.isError && a.isCapable === b.isCapable;
19882
19981
  function replayVoiceCapability(store, atom, gate) {
19883
19982
  const evaluate = (override) => {
@@ -19915,7 +20014,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19915
20014
  }
19916
20015
  }
19917
20016
  function isFamily(value) {
19918
- return record3(value) && record3(value.scope) && typeof value.resolve === "function";
20017
+ return record4(value) && record4(value.scope) && typeof value.resolve === "function";
19919
20018
  }
19920
20019
  function initializeVoiceCapabilityFamilies(module, assets) {
19921
20020
  const initialize = module[assets.capabilityInit];
@@ -19931,7 +20030,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19931
20030
  const result = [];
19932
20031
  const seen = /* @__PURE__ */ new Set();
19933
20032
  let hook = fiber.memoizedState;
19934
- while (record3(hook) && result.length < 4096 && !seen.has(hook)) {
20033
+ while (record4(hook) && result.length < 4096 && !seen.has(hook)) {
19935
20034
  seen.add(hook);
19936
20035
  result.push(hook);
19937
20036
  hook = hook.next;
@@ -19947,7 +20046,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19947
20046
  const list = hooks(fiber);
19948
20047
  for (const memo of list) {
19949
20048
  const [signal, deps] = Array.isArray(memo.memoizedState) ? memo.memoizedState : [];
19950
- if (!record3(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
20049
+ if (!record4(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
19951
20050
  continue;
19952
20051
  const chain = deps[1];
19953
20052
  const node = chain.get(family.scope.id);
@@ -19956,7 +20055,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19956
20055
  const matches = [...members].filter(([, member]) => member.cacheKey === deps[0]);
19957
20056
  if (matches.length !== 1 || typeof matches[0]?.[0] !== "string") continue;
19958
20057
  const parameter = JSON.parse(matches[0][0]);
19959
- if (!record3(parameter) || Object.keys(parameter).some((key) => key !== "name" && key !== "hostId") || !names.some((name) => parameter.name === name) || realtimeOnly && parameter.name !== "voice.realtime" || parameter.hostId !== void 0 && parameter.hostId !== "local" || parameter.name === "voice.thread" && parameter.hostId !== "local")
20058
+ if (!record4(parameter) || Object.keys(parameter).some((key) => key !== "name" && key !== "hostId") || !names.some((name) => parameter.name === name) || realtimeOnly && parameter.name !== "voice.realtime" || parameter.hostId !== void 0 && parameter.hostId !== "local" || parameter.name === "voice.thread" && parameter.hostId !== "local")
19960
20059
  continue;
19961
20060
  const subscriptions = list.filter((hook2) => {
19962
20061
  const state = hook2.memoizedState;
@@ -19969,7 +20068,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19969
20068
  const effect = hook.next?.next?.memoizedState;
19970
20069
  const store = signal.store;
19971
20070
  const gate = gates.resolve(node, chain, INFERENCE_GATE)?.atom;
19972
- if (!gate || !instance || !record3(effect) || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || typeof instance.getSnapshot !== "function" || !capable(store.get(signal.atom)) || !capable(subscriber.getSnapshot()) || !capable(instance.getSnapshot()) || !equal(
20071
+ if (!gate || !instance || !record4(effect) || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || typeof instance.getSnapshot !== "function" || !capable(store.get(signal.atom)) || !capable(subscriber.getSnapshot()) || !capable(instance.getSnapshot()) || !equal(
19973
20072
  store.get(signal.atom),
19974
20073
  subscriber.getSnapshot()
19975
20074
  ) || !equal(subscriber.getSnapshot(), instance.getSnapshot()) || subscriber.createRender?.() != null)
@@ -20066,74 +20165,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20066
20165
 
20067
20166
  // src/renderer-voice-start-capability.ts
20068
20167
  var GLOBAL2 = "__codexhostVoiceStartCapabilityV1";
20069
- var record4 = (v) => v !== null && typeof v === "object";
20070
- function gatewayVoiceStartRequest(request, workGateway, chatGateway = false, externalHarness = false) {
20071
- if (!record4(request) || request.productExperience !== "work" && request.productExperience !== "codex" && request.productExperience !== "chat")
20072
- return false;
20073
- if (request.source === "composer_button_existing_thread") {
20074
- if (!record4(request.locator) || request.locator.hostId !== "local") return false;
20075
- } else if (request.source !== "composer_button_new_thread" || (request.hostId ?? "local") !== "local")
20076
- return false;
20077
- if (request.productExperience === "chat") return chatGateway;
20078
- const mode = request.activeCollaborationMode;
20079
- const settings = record4(mode) ? mode.settings : void 0;
20080
- const model2 = record4(settings) ? settings.model : void 0;
20081
- if (typeof model2 === "string" && model2.startsWith("codexhost/")) return externalHarness;
20082
- return workGateway || externalHarness;
20083
- }
20084
- function wrapGatewayVoiceStarter(start, options) {
20085
- let active;
20086
- return {
20087
- async start(...args) {
20088
- const request = args[0];
20089
- const qualified = options.qualifies(request);
20090
- const wantsGateway = options.configured?.(request) ?? qualified;
20091
- if (!wantsGateway) return start(...args);
20092
- if (!qualified) {
20093
- throw new Error(
20094
- options.unavailable?.(request) ?? "Work voice is not qualified on this Desktop."
20095
- );
20096
- }
20097
- if (active) {
20098
- active.binding?.dispose();
20099
- active = void 0;
20100
- }
20101
- const attempt = {};
20102
- active = attempt;
20103
- const allowed = () => active === attempt && options.qualifies(args[0]);
20104
- try {
20105
- if (!await options.ready()) throw new Error("Voice gateway is not ready");
20106
- if (!allowed()) throw new Error("Voice gateway start was cancelled");
20107
- attempt.binding = await options.prepare(allowed);
20108
- await options.committed(attempt.binding);
20109
- if (!allowed()) throw new Error("Voice gateway start was cancelled");
20110
- if (!attempt.binding.current()) throw new Error("Voice starter subscription changed");
20111
- rememberVoiceProductExperience(args[0]);
20112
- return await start(...args);
20113
- } finally {
20114
- attempt.binding?.dispose();
20115
- if (active === attempt) active = void 0;
20116
- }
20117
- },
20118
- cancel() {
20119
- active?.binding?.dispose();
20120
- active = void 0;
20121
- }
20122
- };
20123
- }
20124
- function overlayVoiceStarterFibers(document, page) {
20125
- const fibers = /* @__PURE__ */ new Set();
20126
- for (const element of document.querySelectorAll("[data-avatar-overlay-native-surface-id]")) {
20127
- const key = Object.getOwnPropertyNames(element).find((key2) => key2.startsWith("__reactFiber$"));
20128
- const ancestors = committedReactAncestors(
20129
- key && Object.getOwnPropertyDescriptor(element, key)?.value
20130
- );
20131
- const boundary = ancestors.findIndex((fiber) => record4(fiber) && fiber.type === page);
20132
- if (boundary < 0) continue;
20133
- for (const fiber of ancestors.slice(0, boundary)) if (record4(fiber)) fibers.add(fiber);
20134
- }
20135
- return fibers;
20136
- }
20168
+ var record5 = (v) => v !== null && typeof v === "object";
20137
20169
  function installVoiceStartCapabilityHook(options = {}) {
20138
20170
  const target2 = options.target ?? globalThis;
20139
20171
  if (target2[GLOBAL2]) return target2[GLOBAL2];
@@ -20178,7 +20210,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20178
20210
  shared[init]();
20179
20211
  }
20180
20212
  const services = shared[assets.services];
20181
- if (record4(services) && (record4(services.realtimeVoiceRuntime) || typeof services.realtimeVoiceRuntime === "function")) {
20213
+ if (record5(services) && (record5(services.realtimeVoiceRuntime) || typeof services.realtimeVoiceRuntime === "function")) {
20182
20214
  const original = services.realtimeVoiceRuntime;
20183
20215
  const register = Reflect.get(original, "registerRealtimeStarter");
20184
20216
  if (typeof register !== "function") throw new Error("Voice starter unavailable");
@@ -20190,9 +20222,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20190
20222
  throw new Error("Voice starter callback unavailable");
20191
20223
  const wrapper = wrapGatewayVoiceStarter(start, {
20192
20224
  configured: (request) => {
20193
- const mode = record4(request) ? request.activeCollaborationMode : void 0;
20194
- const settings = record4(mode) ? mode.settings : void 0;
20195
- const model2 = record4(settings) ? settings.model : void 0;
20225
+ const mode = record5(request) ? request.activeCollaborationMode : void 0;
20226
+ const settings = record5(mode) ? mode.settings : void 0;
20227
+ const model2 = record5(settings) ? settings.model : void 0;
20196
20228
  return gatewayVoiceStartRequest(
20197
20229
  request,
20198
20230
  cpaLiveVoicePreferenceAllowsInstall(target2),
@@ -20207,15 +20239,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20207
20239
  workVoiceLaneEnabled(target2, "work-grok")
20208
20240
  ),
20209
20241
  unavailable: (request) => {
20210
- const mode = record4(request) ? request.activeCollaborationMode : void 0;
20211
- const settings = record4(mode) ? mode.settings : void 0;
20212
- const model2 = record4(settings) ? settings.model : void 0;
20242
+ const mode = record5(request) ? request.activeCollaborationMode : void 0;
20243
+ const settings = record5(mode) ? mode.settings : void 0;
20244
+ const model2 = record5(settings) ? settings.model : void 0;
20213
20245
  const path = typeof model2 === "string" && model2.startsWith("codexhost/") ? "work-grok" : "work-codex";
20214
20246
  return workVoiceUserFacingUnavailable(target2, path);
20215
20247
  },
20216
20248
  ready: async () => {
20217
20249
  const hook = target2.__codexhostClientOwnedVoiceV1;
20218
- if (!record4(hook) || hook.status !== "active") return false;
20250
+ if (!record5(hook) || hook.status !== "active") return false;
20219
20251
  const bridgeClass = shared[assets.bridge];
20220
20252
  const result = await requestVoiceHost(
20221
20253
  bridgeClass.getInstance(),