@karlorz/codexhost-cli-linux-x64 0.21.0-1 → 0.22.0-0

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
@@ -291,15 +291,15 @@
291
291
  function parseRealtimeCallResponse(value) {
292
292
  if (value === null || typeof value !== "object")
293
293
  throw new Error("Invalid voice gateway response");
294
- const record24 = value;
295
- if (typeof record24.status !== "number" || !Number.isInteger(record24.status) || record24.status < 200 || record24.status > 599 || typeof record24.body !== "string" || record24.headers === null || typeof record24.headers !== "object" || Array.isArray(record24.headers)) {
294
+ const record27 = value;
295
+ if (typeof record27.status !== "number" || !Number.isInteger(record27.status) || record27.status < 200 || record27.status > 599 || typeof record27.body !== "string" || record27.headers === null || typeof record27.headers !== "object" || Array.isArray(record27.headers)) {
296
296
  throw new Error("Invalid voice gateway response");
297
297
  }
298
298
  const headers = {};
299
- for (const [name, header] of Object.entries(record24.headers)) {
299
+ for (const [name, header] of Object.entries(record27.headers)) {
300
300
  if (typeof header === "string") headers[name] = header;
301
301
  }
302
- return { status: record24.status, body: record24.body, headers };
302
+ return { status: record27.status, body: record27.body, headers };
303
303
  }
304
304
  function backendModelName(headers) {
305
305
  const raw = new Headers(headers).get("x-codex-turn-metadata");
@@ -345,7 +345,7 @@
345
345
  function lastVoiceLaunchProductExperience(owner = globalThis) {
346
346
  return lastVoiceProductExperience ?? storedVoiceProductExperience(owner);
347
347
  }
348
- 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) {
348
+ function wrapClientOwnedVoiceFetch(client, bridge, workOverride, responseError, chatOverride = () => false, workSurface = () => false, externalHarness = () => false, overlayExistingCall = () => false, externalLane = () => true, workLane2 = () => 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) {
349
349
  const original = client.fetch;
350
350
  const wrapped = async function(url2, options) {
351
351
  if (typeof url2 !== "string" || url2.split("?")[0] !== "/wham/realtime/calls" || options?.method !== "POST")
@@ -360,7 +360,7 @@
360
360
  const external = !chat && (model2.startsWith("codexhost/") || externalHarness());
361
361
  const intendedGateway = external ? true : work ? workOverride() : chatOverride();
362
362
  const chatQualified = chatLane();
363
- const qualified = external ? externalLane() : work ? workLane() : chat ? chatQualified : true;
363
+ const qualified = external ? externalLane() : work ? workLane2() : chat ? chatQualified : true;
364
364
  const chatgptNative = chat && chatgptInstantConnect();
365
365
  const nativeChatWham = chatgptNative && !intendedGateway && allowChatNativeWham() && chatQualified;
366
366
  let route;
@@ -450,6 +450,54 @@
450
450
  };
451
451
  }
452
452
 
453
+ // src/renderer-work-composer-surface.ts
454
+ var HOME_COMPOSER_MODE_STORAGE_KEY = "home-composer-mode-v1";
455
+ function visibleWorkComposer(owner) {
456
+ const document2 = owner.document;
457
+ if (!document2?.querySelectorAll) return false;
458
+ const visible2 = (element) => {
459
+ const box = element.getBoundingClientRect?.() ?? { width: 0 };
460
+ return box.width > 0 && !element.closest?.("[hidden], [inert]");
461
+ };
462
+ return [...document2.querySelectorAll("[data-codex-composer-root]")].some(visible2) && ![...document2.querySelectorAll("[data-chatgpt-composer]")].some(visible2);
463
+ }
464
+ function selectedWorkTab(owner) {
465
+ const document2 = owner.document;
466
+ if (!document2?.querySelectorAll) return false;
467
+ const controls = document2.querySelectorAll("button, [role='tab'], a");
468
+ let workSelected = false;
469
+ let chatSelected = false;
470
+ for (const element of controls) {
471
+ const name = (element.textContent ?? "").replace(/\s+/gu, " ").trim();
472
+ if (name !== "Chat" && name !== "Work") continue;
473
+ const selected = element.getAttribute("aria-selected") === "true" || element.getAttribute("aria-pressed") === "true" || element.getAttribute("data-state") === "active" || element.getAttribute("data-state") === "on";
474
+ if (!selected) continue;
475
+ if (name === "Work") workSelected = true;
476
+ if (name === "Chat") chatSelected = true;
477
+ }
478
+ return workSelected && !chatSelected;
479
+ }
480
+ function isWorkComposerSurface(owner = globalThis) {
481
+ const storage = owner.localStorage;
482
+ try {
483
+ const raw = storage?.getItem(HOME_COMPOSER_MODE_STORAGE_KEY);
484
+ if (raw != null && raw !== "") {
485
+ let value = raw;
486
+ if (raw.startsWith("{") || raw.startsWith('"') || raw.startsWith("[")) {
487
+ try {
488
+ value = JSON.parse(raw);
489
+ } catch {
490
+ value = raw;
491
+ }
492
+ }
493
+ if (value === "work") return true;
494
+ if (value === "chat") return false;
495
+ }
496
+ } catch {
497
+ }
498
+ return selectedWorkTab(owner) || visibleWorkComposer(owner);
499
+ }
500
+
453
501
  // src/renderer-voice-routes-cache.ts
454
502
  var SHARED_VOICE_CACHE = "codexhost.voice-routes-cache.v1";
455
503
  var CPA_LIVE_VOICE_STORAGE_KEY = "codexhost.cpa-live-voice.v1";
@@ -463,13 +511,13 @@
463
511
  }
464
512
  function parseVoiceRoutes(value) {
465
513
  if (value === null || typeof value !== "object") return;
466
- const record24 = value;
467
- if (record24.chatExperience !== "chatgpt" && record24.chatExperience !== "codex" || record24.chatConnection !== "desktop" && record24.chatConnection !== "gateway" || record24.workConnection !== "desktop" && record24.workConnection !== "gateway")
514
+ const record27 = value;
515
+ if (record27.chatExperience !== "chatgpt" && record27.chatExperience !== "codex" || record27.chatConnection !== "desktop" && record27.chatConnection !== "gateway" || record27.workConnection !== "desktop" && record27.workConnection !== "gateway")
468
516
  return;
469
517
  return {
470
- chatExperience: record24.chatExperience,
471
- chatConnection: record24.chatConnection,
472
- workConnection: record24.workConnection
518
+ chatExperience: record27.chatExperience,
519
+ chatConnection: record27.chatConnection,
520
+ workConnection: record27.workConnection
473
521
  };
474
522
  }
475
523
  function cachedVoiceRoutes(owner) {
@@ -502,6 +550,20 @@
502
550
  const routes = cachedVoiceRoutes(owner);
503
551
  return routes ? routes.chatExperience === "chatgpt" : !readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
504
552
  }
553
+ function readCpaLiveVoicePreference(owner) {
554
+ const routes = cachedVoiceRoutes(owner);
555
+ return routes ? routes.workConnection === "gateway" : readVoiceStorageFlag(owner, CPA_LIVE_VOICE_STORAGE_KEY, true);
556
+ }
557
+ function readChatLiveVoicePreference(owner) {
558
+ const routes = cachedVoiceRoutes(owner);
559
+ return routes ? routes.chatExperience === "codex" && routes.chatConnection === "gateway" : readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
560
+ }
561
+ function cpaLiveVoicePreferenceAllowsInstall(globalObject) {
562
+ return readCpaLiveVoicePreference(globalObject);
563
+ }
564
+ function chatLiveVoicePreferenceAllowsOverride(globalObject) {
565
+ return readChatLiveVoicePreference(globalObject);
566
+ }
505
567
 
506
568
  // src/renderer-native-chat-voice-selection.ts
507
569
  var UUID = /^[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}$/i;
@@ -604,7 +666,7 @@
604
666
  }
605
667
 
606
668
  // src/renderer-voice-implementation-revision.generated.ts
607
- var VOICE_IMPLEMENTATION_REVISION = "496ea96312a2e7b6";
669
+ var VOICE_IMPLEMENTATION_REVISION = "af0ca16ef25a57ae";
608
670
 
609
671
  // src/renderer-voice-profiles.ts
610
672
  var NATIVE_CHAT_VOICE_VERSION = "26.1027.61615";
@@ -1205,106 +1267,106 @@
1205
1267
  function recordObject(value) {
1206
1268
  return value !== null && typeof value === "object";
1207
1269
  }
1208
- function missingStages(record24) {
1209
- return REQUIRED_STAGES.filter((stage) => record24.stages[stage] !== true);
1270
+ function missingStages(record27) {
1271
+ return REQUIRED_STAGES.filter((stage) => record27.stages[stage] !== true);
1210
1272
  }
1211
1273
  function productForPath(path) {
1212
1274
  return path === "chat" ? "chat" : "work";
1213
1275
  }
1214
- function evaluateVoiceEvidence(record24) {
1276
+ function evaluateVoiceEvidence(record27) {
1215
1277
  const expectedKey = profileIdentityKey(
1216
- productForPath(record24.path),
1217
- record24.platform,
1218
- record24.desktopVersion
1278
+ productForPath(record27.path),
1279
+ record27.platform,
1280
+ record27.desktopVersion
1219
1281
  );
1220
- if (record24.profileKey !== expectedKey) {
1282
+ if (record27.profileKey !== expectedKey) {
1221
1283
  return {
1222
1284
  outcome: "mismatch",
1223
1285
  qualified: false,
1224
- missing: missingStages(record24),
1286
+ missing: missingStages(record27),
1225
1287
  reason: "evidence-profile-mismatch"
1226
1288
  };
1227
1289
  }
1228
- if (typeof record24.implementationRevision !== "string" || record24.implementationRevision === "") {
1290
+ if (typeof record27.implementationRevision !== "string" || record27.implementationRevision === "") {
1229
1291
  return {
1230
1292
  outcome: "mismatch",
1231
1293
  qualified: false,
1232
- missing: missingStages(record24),
1294
+ missing: missingStages(record27),
1233
1295
  reason: "missing-implementation-revision"
1234
1296
  };
1235
1297
  }
1236
- if (record24.policy !== "legacy-retained" && record24.implementationRevision !== voiceImplementationRevision()) {
1298
+ if (record27.policy !== "legacy-retained" && record27.implementationRevision !== voiceImplementationRevision()) {
1237
1299
  return {
1238
1300
  outcome: "mismatch",
1239
1301
  qualified: false,
1240
- missing: missingStages(record24),
1302
+ missing: missingStages(record27),
1241
1303
  reason: "implementation-revision-mismatch"
1242
1304
  };
1243
1305
  }
1244
- if (record24.policy !== "legacy-retained") {
1245
- if (typeof record24.desktopBuild !== "string" || record24.desktopBuild === "" || typeof record24.asarDigest !== "string" || record24.asarDigest === "") {
1306
+ if (record27.policy !== "legacy-retained") {
1307
+ if (typeof record27.desktopBuild !== "string" || record27.desktopBuild === "" || typeof record27.asarDigest !== "string" || record27.asarDigest === "") {
1246
1308
  return {
1247
1309
  outcome: "mismatch",
1248
1310
  qualified: false,
1249
- missing: missingStages(record24),
1311
+ missing: missingStages(record27),
1250
1312
  reason: "missing-native-identity"
1251
1313
  };
1252
1314
  }
1253
1315
  }
1254
- if (typeof record24.profileDigest !== "string" || record24.profileDigest === "") {
1316
+ if (typeof record27.profileDigest !== "string" || record27.profileDigest === "") {
1255
1317
  return {
1256
1318
  outcome: "mismatch",
1257
1319
  qualified: false,
1258
- missing: missingStages(record24),
1320
+ missing: missingStages(record27),
1259
1321
  reason: "missing-profile-digest"
1260
1322
  };
1261
1323
  }
1262
1324
  const expectedDigest = voiceProfileDigest(
1263
- productForPath(record24.path),
1264
- record24.platform,
1265
- record24.desktopVersion
1325
+ productForPath(record27.path),
1326
+ record27.platform,
1327
+ record27.desktopVersion
1266
1328
  );
1267
- if (!expectedDigest || record24.profileDigest !== expectedDigest) {
1329
+ if (!expectedDigest || record27.profileDigest !== expectedDigest) {
1268
1330
  return {
1269
1331
  outcome: "mismatch",
1270
1332
  qualified: false,
1271
- missing: missingStages(record24),
1333
+ missing: missingStages(record27),
1272
1334
  reason: "stale-profile-digest"
1273
1335
  };
1274
1336
  }
1275
- if (record24.startAcknowledged === true && record24.connected !== true) {
1337
+ if (record27.startAcknowledged === true && record27.connected !== true) {
1276
1338
  return {
1277
1339
  outcome: "incomplete",
1278
1340
  qualified: false,
1279
- missing: missingStages(record24).length > 0 ? missingStages(record24) : ["connection"],
1341
+ missing: missingStages(record27).length > 0 ? missingStages(record27) : ["connection"],
1280
1342
  reason: "start-acknowledged-without-connection"
1281
1343
  };
1282
1344
  }
1283
- if (record24.path !== "chat" && record24.gatewayOwned !== true && record24.stages.connection === true) {
1345
+ if (record27.path !== "chat" && record27.gatewayOwned !== true && record27.stages.connection === true) {
1284
1346
  return {
1285
1347
  outcome: "incomplete",
1286
1348
  qualified: false,
1287
- missing: missingStages(record24).length > 0 ? missingStages(record24) : ["connection"],
1349
+ missing: missingStages(record27).length > 0 ? missingStages(record27) : ["connection"],
1288
1350
  reason: "route-only-without-connected-gateway"
1289
1351
  };
1290
1352
  }
1291
- if (record24.speech?.attended === true && (!record24.speech.witness || !record24.speech.run)) {
1353
+ if (record27.speech?.attended === true && (!record27.speech.witness || !record27.speech.run)) {
1292
1354
  return {
1293
1355
  outcome: "incomplete",
1294
1356
  qualified: false,
1295
- missing: missingStages(record24).includes("speech") ? missingStages(record24) : ["speech"],
1357
+ missing: missingStages(record27).includes("speech") ? missingStages(record27) : ["speech"],
1296
1358
  reason: "attended-speech-missing-provenance"
1297
1359
  };
1298
1360
  }
1299
- if (record24.speech && record24.speech.attended !== true) {
1361
+ if (record27.speech && record27.speech.attended !== true) {
1300
1362
  return {
1301
1363
  outcome: "incomplete",
1302
1364
  qualified: false,
1303
- missing: missingStages(record24),
1365
+ missing: missingStages(record27),
1304
1366
  reason: "synthetic-speech-is-not-qualification"
1305
1367
  };
1306
1368
  }
1307
- const missing = missingStages(record24);
1369
+ const missing = missingStages(record27);
1308
1370
  if (missing.length > 0) {
1309
1371
  return {
1310
1372
  outcome: "incomplete",
@@ -1313,7 +1375,7 @@
1313
1375
  reason: `missing:${missing.join(",")}`
1314
1376
  };
1315
1377
  }
1316
- if (record24.connected !== true || record24.conversationMatched !== true || (record24.path === "chat" ? record24.harnessMatched !== void 0 && record24.harnessMatched !== true : record24.harnessMatched !== true) || record24.speech?.attended !== true || record24.speech.bothDirections !== true || record24.cleanup?.ended !== true || record24.cleanup.microphoneReleased !== true) {
1378
+ if (record27.connected !== true || record27.conversationMatched !== true || (record27.path === "chat" ? record27.harnessMatched !== void 0 && record27.harnessMatched !== true : record27.harnessMatched !== true) || record27.speech?.attended !== true || record27.speech.bothDirections !== true || record27.cleanup?.ended !== true || record27.cleanup.microphoneReleased !== true) {
1317
1379
  return {
1318
1380
  outcome: "fail",
1319
1381
  qualified: false,
@@ -1323,15 +1385,15 @@
1323
1385
  }
1324
1386
  return { outcome: "pass", qualified: true, missing: [], reason: "qualified" };
1325
1387
  }
1326
- function evidenceMatchesRuntime(record24, config2) {
1327
- if (record24.platform !== config2.desktopPlatform) return false;
1328
- if (record24.desktopVersion !== config2.desktopVersion) return false;
1329
- if (record24.implementationRevision !== config2.implementationRevision) return false;
1330
- if (record24.policy === "legacy-retained") return true;
1331
- if (typeof record24.desktopBuild !== "string" || record24.desktopBuild === "" || typeof record24.asarDigest !== "string" || record24.asarDigest === "" || typeof config2.desktopBuild !== "string" || config2.desktopBuild === "" || typeof config2.asarDigest !== "string" || config2.asarDigest === "" || typeof config2.implementationRevision !== "string" || config2.implementationRevision === "") {
1388
+ function evidenceMatchesRuntime(record27, config2) {
1389
+ if (record27.platform !== config2.desktopPlatform) return false;
1390
+ if (record27.desktopVersion !== config2.desktopVersion) return false;
1391
+ if (record27.implementationRevision !== config2.implementationRevision) return false;
1392
+ if (record27.policy === "legacy-retained") return true;
1393
+ if (typeof record27.desktopBuild !== "string" || record27.desktopBuild === "" || typeof record27.asarDigest !== "string" || record27.asarDigest === "" || typeof config2.desktopBuild !== "string" || config2.desktopBuild === "" || typeof config2.asarDigest !== "string" || config2.asarDigest === "" || typeof config2.implementationRevision !== "string" || config2.implementationRevision === "") {
1332
1394
  return false;
1333
1395
  }
1334
- return record24.desktopBuild === config2.desktopBuild && record24.asarDigest === config2.asarDigest;
1396
+ return record27.desktopBuild === config2.desktopBuild && record27.asarDigest === config2.asarDigest;
1335
1397
  }
1336
1398
  function isolatedVoicePathEnabled(config2, path) {
1337
1399
  return isolatedQualificationMatches(path, config2);
@@ -1355,27 +1417,27 @@
1355
1417
  if (!config2.desktopVersion || !config2.desktopPlatform) {
1356
1418
  return { enabled: false, policy: "unreviewed", reason: "waiting-for-identity" };
1357
1419
  }
1358
- const pathRecords = records.filter((record24) => record24.path === path);
1420
+ const pathRecords = records.filter((record27) => record27.path === path);
1359
1421
  if (pathRecords.length > 0) {
1360
- const matching = pathRecords.filter((record25) => evidenceMatchesRuntime(record25, config2));
1422
+ const matching = pathRecords.filter((record28) => evidenceMatchesRuntime(record28, config2));
1361
1423
  if (matching.length === 0) {
1362
1424
  return { enabled: false, policy: "unreviewed", reason: "stale-or-wrong-platform-evidence" };
1363
1425
  }
1364
- for (const record25 of matching) {
1365
- const evaluation = evaluateVoiceEvidence(record25);
1426
+ for (const record28 of matching) {
1427
+ const evaluation = evaluateVoiceEvidence(record28);
1366
1428
  if (!evaluation.qualified) {
1367
1429
  return { enabled: false, policy: "unreviewed", reason: evaluation.reason };
1368
1430
  }
1369
1431
  }
1370
- const record24 = matching[0];
1371
- if (!record24) {
1432
+ const record27 = matching[0];
1433
+ if (!record27) {
1372
1434
  return { enabled: false, policy: "unreviewed", reason: "missing-evidence" };
1373
1435
  }
1374
1436
  if (hashedVoiceCandidateOwner(config2) && !hashedVoiceProfileSupported(config2)) {
1375
1437
  } else {
1376
1438
  return {
1377
1439
  enabled: true,
1378
- policy: record24.policy === "legacy-retained" ? "legacy-retained" : "reviewed"
1440
+ policy: record27.policy === "legacy-retained" ? "legacy-retained" : "reviewed"
1379
1441
  };
1380
1442
  }
1381
1443
  }
@@ -2233,6 +2295,28 @@
2233
2295
  };
2234
2296
  }
2235
2297
  }
2298
+ function detectWorkInstantConnectBinding(composer, native) {
2299
+ const key = Object.getOwnPropertyNames(composer).find((key2) => key2.startsWith("__reactFiber$"));
2300
+ if (!key) return;
2301
+ const ancestors2 = committedReactAncestors(Object.getOwnPropertyDescriptor(composer, key)?.value);
2302
+ for (const owner of ancestors2) {
2303
+ const scopes = scopeRefs(owner, native.scopeDefinition);
2304
+ if (scopes.size !== 1) continue;
2305
+ const scope = [...scopes.values()][0];
2306
+ if (!scope) continue;
2307
+ const appNode = scope.chain.get(native.scopeDefinition.id);
2308
+ if (!record2(appNode)) continue;
2309
+ return {
2310
+ composer,
2311
+ appNode,
2312
+ props: { conversationId: "work" },
2313
+ scope,
2314
+ context: {},
2315
+ composerContext: { context: {}, chain: scope.chain },
2316
+ backendConversationId: void 0
2317
+ };
2318
+ }
2319
+ }
2236
2320
  function startNativeChatVoiceForRequest(request, target2 = globalThis) {
2237
2321
  if (!record2(request) || request.productExperience !== "chat" || !nativeChatVoicePreferenceAllowsStart(target2))
2238
2322
  return;
@@ -2314,7 +2398,8 @@
2314
2398
  return forms.length === 1 ? forms[0] : void 0;
2315
2399
  };
2316
2400
  const leftoverInstantConnectStarting = () => {
2317
- if (!boundScope || !modules || typeof modules.initial.SPn !== "function") return false;
2401
+ if (lastVoiceLaunchProductExperience(target2) !== "chat" || !boundScope || !modules || typeof modules.initial.SPn !== "function")
2402
+ return false;
2318
2403
  try {
2319
2404
  const state = modules.initial.SPn(boundScope).getState();
2320
2405
  if (state.isVoiceModeActive !== true) return false;
@@ -2556,18 +2641,28 @@
2556
2641
  if (hashed && !visibleComposer()) {
2557
2642
  selectDraft?.();
2558
2643
  if (starting) return;
2644
+ const workSurface = isWorkComposerSurface(target2);
2559
2645
  if (leftoverInstantConnectStarting()) {
2560
2646
  endLeftoverInstantConnect();
2647
+ if (workSurface) {
2648
+ rememberVoiceProductExperience({ productExperience: "work" }, target2);
2649
+ handle.status = "pending";
2650
+ return;
2651
+ }
2561
2652
  releaseChatLaunchOwnership();
2562
2653
  release();
2563
2654
  handle.status = "pending";
2564
2655
  return;
2565
2656
  }
2566
2657
  if (handle.activeCall) return;
2567
- releaseChatLaunchOwnership();
2568
- release();
2569
- handle.status = "pending";
2570
- return;
2658
+ if (workSurface) {
2659
+ rememberVoiceProductExperience({ productExperience: "work" }, target2);
2660
+ } else {
2661
+ releaseChatLaunchOwnership();
2662
+ release();
2663
+ handle.status = "pending";
2664
+ return;
2665
+ }
2571
2666
  }
2572
2667
  if (renderFailed) throw new Error();
2573
2668
  if (!modules) {
@@ -2607,6 +2702,32 @@
2607
2702
  return;
2608
2703
  }
2609
2704
  }
2705
+ if (hashed && !visibleComposer() && isWorkComposerSurface(target2)) {
2706
+ const work = [...doc.querySelectorAll("[data-codex-composer-root]")].find((element) => {
2707
+ const box = element.getBoundingClientRect?.() ?? { width: 0 };
2708
+ return box.width > 0 && !element.closest?.("[hidden], [inert]");
2709
+ });
2710
+ const current2 = work ? detectWorkInstantConnectBinding(work, {
2711
+ scopeDefinition: modules.shared.Qst
2712
+ }) : void 0;
2713
+ if (current2) {
2714
+ if (mounted && current2.appNode !== mounted.node) release();
2715
+ boundScope = current2.scope;
2716
+ if (!mounted) {
2717
+ mounted = mountNativeChatVoiceRuntime({
2718
+ adapter,
2719
+ binding: current2,
2720
+ modules,
2721
+ document: doc,
2722
+ onRenderFailed() {
2723
+ renderFailed = true;
2724
+ }
2725
+ });
2726
+ }
2727
+ }
2728
+ handle.status = "pending";
2729
+ return;
2730
+ }
2610
2731
  const current = findBinding();
2611
2732
  selectDraft?.();
2612
2733
  if (mounted && current && current.appNode !== mounted.node) {
@@ -19960,6 +20081,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19960
20081
  message: "A history continuation requires its connection epoch"
19961
20082
  }).optional()
19962
20083
  }),
20084
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
19963
20085
  external_exports.strictObject({
19964
20086
  kind: external_exports.literal("configure"),
19965
20087
  ...thread,
@@ -20154,20 +20276,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20154
20276
  workConnection: readVoiceStorageFlag(owner, CPA_LIVE_VOICE_STORAGE_KEY, true) ? "gateway" : "desktop"
20155
20277
  };
20156
20278
  }
20157
- function readCpaLiveVoicePreference(owner) {
20158
- const routes = cachedVoiceRoutes(owner);
20159
- return routes ? routes.workConnection === "gateway" : readVoiceStorageFlag(owner, CPA_LIVE_VOICE_STORAGE_KEY, true);
20160
- }
20161
- function readChatLiveVoicePreference(owner) {
20162
- const routes = cachedVoiceRoutes(owner);
20163
- return routes ? routes.chatExperience === "codex" && routes.chatConnection === "gateway" : readVoiceStorageFlag(owner, CHAT_LIVE_VOICE_STORAGE_KEY, false);
20164
- }
20165
- function cpaLiveVoicePreferenceAllowsInstall(globalObject) {
20166
- return readCpaLiveVoicePreference(globalObject);
20167
- }
20168
- function chatLiveVoicePreferenceAllowsOverride(globalObject) {
20169
- return readChatLiveVoicePreference(globalObject);
20170
- }
20171
20279
 
20172
20280
  // src/renderer-cpa-live-voice-hook.ts
20173
20281
  var AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION = HISTORICAL_CPA_LIVE_VOICE_DESKTOP_VERSION;
@@ -20262,54 +20370,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20262
20370
  return handle;
20263
20371
  }
20264
20372
 
20265
- // src/renderer-work-composer-surface.ts
20266
- var HOME_COMPOSER_MODE_STORAGE_KEY = "home-composer-mode-v1";
20267
- function visibleWorkComposer(owner) {
20268
- const document2 = owner.document;
20269
- if (!document2?.querySelectorAll) return false;
20270
- const visible2 = (element) => {
20271
- const box = element.getBoundingClientRect?.() ?? { width: 0 };
20272
- return box.width > 0 && !element.closest?.("[hidden], [inert]");
20273
- };
20274
- return [...document2.querySelectorAll("[data-codex-composer-root]")].some(visible2) && ![...document2.querySelectorAll("[data-chatgpt-composer]")].some(visible2);
20275
- }
20276
- function selectedWorkTab(owner) {
20277
- const document2 = owner.document;
20278
- if (!document2?.querySelectorAll) return false;
20279
- const controls = document2.querySelectorAll("button, [role='tab'], a");
20280
- let workSelected = false;
20281
- let chatSelected = false;
20282
- for (const element of controls) {
20283
- const name = (element.textContent ?? "").replace(/\s+/gu, " ").trim();
20284
- if (name !== "Chat" && name !== "Work") continue;
20285
- const selected = element.getAttribute("aria-selected") === "true" || element.getAttribute("aria-pressed") === "true" || element.getAttribute("data-state") === "active" || element.getAttribute("data-state") === "on";
20286
- if (!selected) continue;
20287
- if (name === "Work") workSelected = true;
20288
- if (name === "Chat") chatSelected = true;
20289
- }
20290
- return workSelected && !chatSelected;
20291
- }
20292
- function isWorkComposerSurface(owner = globalThis) {
20293
- const storage = owner.localStorage;
20294
- try {
20295
- const raw = storage?.getItem(HOME_COMPOSER_MODE_STORAGE_KEY);
20296
- if (raw != null && raw !== "") {
20297
- let value = raw;
20298
- if (raw.startsWith("{") || raw.startsWith('"') || raw.startsWith("[")) {
20299
- try {
20300
- value = JSON.parse(raw);
20301
- } catch {
20302
- value = raw;
20303
- }
20304
- }
20305
- if (value === "work") return true;
20306
- if (value === "chat") return false;
20307
- }
20308
- } catch {
20309
- }
20310
- return selectedWorkTab(owner) || visibleWorkComposer(owner);
20311
- }
20312
-
20313
20373
  // src/renderer-hashed-overlay-voice.ts
20314
20374
  var HOOK_GLOBAL2 = "__codexhostClientOwnedVoiceV1";
20315
20375
  var SHARED_VOICE_CACHE2 = "codexhost.voice-routes-cache.v1";
@@ -20462,19 +20522,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20462
20522
  function hookWebpackVoiceFactory(req, onExports) {
20463
20523
  const modules = req.m;
20464
20524
  const factoryId = HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId;
20465
- const original = modules?.[factoryId];
20466
- if (!modules || typeof original !== "function") return false;
20467
- if (original.__codexhostVoiceFactory) return true;
20468
- const wrapped = function(module, exports, webpackRequire) {
20525
+ const installed = modules?.[factoryId];
20526
+ if (!modules || typeof installed !== "function") return void 0;
20527
+ const owned = installed.__codexhostVoiceFactory === true && typeof installed.__codexhostVoiceOriginal === "function";
20528
+ const original = owned ? installed.__codexhostVoiceOriginal : installed;
20529
+ const wrapped = owned ? installed : function(module, exports, webpackRequire) {
20469
20530
  try {
20470
20531
  return original.apply(this, [module, exports, webpackRequire]);
20471
20532
  } finally {
20472
- onExports(exports ?? module?.exports);
20533
+ try {
20534
+ wrapped.__codexhostVoiceSubscriber?.(exports ?? module?.exports);
20535
+ } catch {
20536
+ }
20473
20537
  }
20474
20538
  };
20475
20539
  wrapped.__codexhostVoiceFactory = true;
20476
- modules[factoryId] = wrapped;
20477
- return true;
20540
+ wrapped.__codexhostVoiceOriginal = original;
20541
+ wrapped.__codexhostVoiceSubscriber = onExports;
20542
+ if (!owned) modules[factoryId] = wrapped;
20543
+ return () => {
20544
+ if (wrapped.__codexhostVoiceSubscriber !== onExports) return;
20545
+ Reflect.deleteProperty(wrapped, "__codexhostVoiceSubscriber");
20546
+ if (modules[factoryId] === wrapped) modules[factoryId] = original;
20547
+ };
20478
20548
  }
20479
20549
  async function resolveHashedWebpackVoice(importModule) {
20480
20550
  const runtime = await importModule(`app://-/assets/${HASHED_WEBPACK_VOICE_RUNTIME_ASSET}`);
@@ -20494,7 +20564,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20494
20564
  return {
20495
20565
  client,
20496
20566
  bridge: bridged,
20497
- responseError
20567
+ responseError,
20568
+ require: req
20498
20569
  };
20499
20570
  if (typeof req.m?.[HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId] !== "function") return null;
20500
20571
  return {
@@ -20517,6 +20588,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20517
20588
  let timer;
20518
20589
  let surfaceTimer;
20519
20590
  let restore;
20591
+ let restoreFactory;
20592
+ const wrappedClients = /* @__PURE__ */ new WeakSet();
20520
20593
  const started = Date.now();
20521
20594
  const activation = {
20522
20595
  assetSeen: false,
@@ -20535,6 +20608,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20535
20608
  if (timer !== void 0) target2.clearTimeout(timer);
20536
20609
  if (surfaceTimer !== void 0) target2.clearTimeout(surfaceTimer);
20537
20610
  pointerTarget?.removeEventListener?.("pointerdown", onPointerDown, true);
20611
+ restoreFactory?.();
20538
20612
  restore?.();
20539
20613
  if (target2[HOOK_GLOBAL2] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL2);
20540
20614
  }
@@ -20548,7 +20622,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20548
20622
  };
20549
20623
  publishLoop();
20550
20624
  const activate = (client, bridge, responseError) => {
20551
- restore = wrapClientOwnedVoiceFetch(
20625
+ if (wrappedClients.has(client)) {
20626
+ activation.wrapperActive = true;
20627
+ handle.status = "active";
20628
+ return;
20629
+ }
20630
+ wrappedClients.add(client);
20631
+ const disposeWrap = wrapClientOwnedVoiceFetch(
20552
20632
  client,
20553
20633
  bridge,
20554
20634
  () => workGatewayPreference(target2),
@@ -20567,11 +20647,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20567
20647
  () => false,
20568
20648
  () => nativeChatVoicePreferenceAllowsStart(target2)
20569
20649
  );
20650
+ const previous = restore;
20651
+ restore = () => {
20652
+ disposeWrap();
20653
+ previous?.();
20654
+ };
20570
20655
  activation.wrapperActive = true;
20571
20656
  handle.status = "active";
20572
20657
  };
20573
20658
  const attempt = async () => {
20574
- if (disposed || handle.status === "active") return;
20659
+ if (disposed || activation.wrapperActive && activation.factoryHooked) return;
20575
20660
  publishComposerLaunchExperience(target2);
20576
20661
  const names = loadedAssetNames(target2.document, target2.performance);
20577
20662
  const hashedAssetSeen = names.some((name) => name.includes(HASHED_WEBPACK_VOICE_RUNTIME_ASSET));
@@ -20580,38 +20665,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20580
20665
  activation.importStarted = true;
20581
20666
  try {
20582
20667
  const resolved = await resolveHashedWebpackVoice(importModule);
20583
- if (disposed || activation.wrapperActive) return;
20584
- if (resolved?.client) {
20585
- activation.importResolved = true;
20586
- delete activation.importFailed;
20587
- activate(resolved.client, resolved.bridge, resolved.responseError);
20588
- return;
20589
- }
20590
- const webpackRequire = resolved?.require;
20591
- if (webpackRequire && hookWebpackVoiceFactory(webpackRequire, (exports) => {
20592
- if (disposed || activation.wrapperActive) return;
20593
- const client = nativeVoiceFetch(
20594
- object4(exports) ? exports[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
20595
- );
20596
- if (!client) {
20597
- unpoisonIncompleteWebpackModule(
20598
- webpackRequire,
20599
- HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId,
20600
- (value) => Boolean(
20601
- nativeVoiceFetch(
20602
- object4(value) ? value[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
20603
- )
20604
- )
20668
+ if (disposed || !resolved) {
20669
+ if (!disposed) activation.importFailed = "hashed-exports-missing";
20670
+ } else {
20671
+ const wrapExports = (exports) => {
20672
+ if (disposed) return;
20673
+ const client = nativeVoiceFetch(
20674
+ object4(exports) ? exports[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
20605
20675
  );
20606
- return;
20676
+ if (!client) {
20677
+ if (resolved.require)
20678
+ unpoisonIncompleteWebpackModule(
20679
+ resolved.require,
20680
+ HASHED_OVERLAY_VOICE_ROLES.fetchFactoryId,
20681
+ (value) => Boolean(
20682
+ nativeVoiceFetch(
20683
+ object4(value) ? value[HASHED_OVERLAY_VOICE_ROLES.fetchExport] : void 0
20684
+ )
20685
+ )
20686
+ );
20687
+ return;
20688
+ }
20689
+ activate(client, resolved.bridge, resolved.responseError);
20690
+ };
20691
+ if (resolved.client) {
20692
+ activation.importResolved = true;
20693
+ delete activation.importFailed;
20694
+ activate(resolved.client, resolved.bridge, resolved.responseError);
20695
+ }
20696
+ const disposeFactory = resolved.require ? hookWebpackVoiceFactory(resolved.require, wrapExports) : void 0;
20697
+ if (disposeFactory) {
20698
+ restoreFactory = disposeFactory;
20699
+ activation.importResolved = true;
20700
+ activation.factoryHooked = true;
20701
+ delete activation.importFailed;
20607
20702
  }
20608
- activate(client, resolved.bridge, resolved.responseError);
20609
- })) {
20610
- activation.importResolved = true;
20611
- activation.factoryHooked = true;
20612
- delete activation.importFailed;
20613
- return;
20614
20703
  }
20704
+ if (activation.wrapperActive || activation.factoryHooked) return;
20615
20705
  activation.importFailed = "hashed-exports-missing";
20616
20706
  } catch {
20617
20707
  activation.importFailed = "hashed-import-failed";
@@ -21031,15 +21121,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21031
21121
  // ../desktop-control/dist/renderer-host-rpc-discovery.js
21032
21122
  function findRendererAppScopeStore(root) {
21033
21123
  const MAX_VISITED_FIBERS = 5e4;
21034
- const record24 = (value) => typeof value === "object" && value !== null;
21124
+ const record27 = (value) => typeof value === "object" && value !== null;
21035
21125
  const container = root.getElementById?.("root");
21036
- if (!record24(container))
21126
+ if (!record27(container))
21037
21127
  return null;
21038
21128
  const key = Object.getOwnPropertyNames(container).find((name) => name.startsWith("__reactContainer$"));
21039
21129
  const first = key ? container[key] : null;
21040
- if (!record24(first))
21130
+ if (!record27(first))
21041
21131
  return null;
21042
- const isScopeHandle = (value) => record24(value) && record24(value.node) && "chain" in value && "scope" in value && typeof value.get === "function" && typeof value.set === "function" && typeof value.watch === "function";
21132
+ const isScopeHandle = (value) => record27(value) && record27(value.node) && "chain" in value && "scope" in value && typeof value.get === "function" && typeof value.set === "function" && typeof value.watch === "function";
21043
21133
  const stack = [first];
21044
21134
  const seen = /* @__PURE__ */ new Set();
21045
21135
  while (stack.length && seen.size < MAX_VISITED_FIBERS) {
@@ -21048,43 +21138,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21048
21138
  continue;
21049
21139
  seen.add(fiber);
21050
21140
  let hook = fiber.memoizedState;
21051
- for (let index = 0; record24(hook) && "next" in hook && index < 150; index += 1) {
21141
+ for (let index = 0; record27(hook) && "next" in hook && index < 150; index += 1) {
21052
21142
  const state = hook.memoizedState;
21053
- const handle = record24(state) ? state.current : null;
21143
+ const handle = record27(state) ? state.current : null;
21054
21144
  if (isScopeHandle(handle)) {
21055
21145
  let node = handle.node;
21056
21146
  const nodes = /* @__PURE__ */ new Set();
21057
- while (record24(node.parent) && !nodes.has(node.parent)) {
21147
+ while (record27(node.parent) && !nodes.has(node.parent)) {
21058
21148
  nodes.add(node);
21059
21149
  node = node.parent;
21060
21150
  }
21061
21151
  const bindings = node.familyBindings;
21062
- return record24(bindings) && typeof bindings.get === "function" && typeof bindings.entries === "function" ? node : null;
21152
+ return record27(bindings) && typeof bindings.get === "function" && typeof bindings.entries === "function" ? node : null;
21063
21153
  }
21064
21154
  hook = hook.next;
21065
21155
  }
21066
- if (record24(fiber.sibling))
21156
+ if (record27(fiber.sibling))
21067
21157
  stack.push(fiber.sibling);
21068
- if (record24(fiber.child))
21158
+ if (record27(fiber.child))
21069
21159
  stack.push(fiber.child);
21070
21160
  }
21071
21161
  return null;
21072
21162
  }
21073
21163
  function findRendererHostRpcFamily(store) {
21074
- const record24 = (value) => typeof value === "object" && value !== null;
21164
+ const record27 = (value) => typeof value === "object" && value !== null;
21075
21165
  const families = /* @__PURE__ */ new Set();
21076
21166
  for (const [definition, members] of store.familyBindings) {
21077
- if (!record24(definition) || definition.kind !== "signal-family")
21167
+ if (!record27(definition) || definition.kind !== "signal-family")
21078
21168
  continue;
21079
- if (!record24(members) || typeof members.get !== "function")
21169
+ if (!record27(members) || typeof members.get !== "function")
21080
21170
  continue;
21081
21171
  for (const [hostId2, member] of members) {
21082
21172
  if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:]|ssh:)/u.test(hostId2))
21083
21173
  continue;
21084
- if (!record24(member))
21174
+ if (!record27(member))
21085
21175
  continue;
21086
21176
  const signal = member.value;
21087
- if (!record24(signal) || typeof signal.get !== "function")
21177
+ if (!record27(signal) || typeof signal.get !== "function")
21088
21178
  continue;
21089
21179
  let value;
21090
21180
  try {
@@ -21092,7 +21182,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21092
21182
  } catch {
21093
21183
  continue;
21094
21184
  }
21095
- if (record24(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record24(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
21185
+ if (record27(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record27(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
21096
21186
  families.add(members);
21097
21187
  break;
21098
21188
  }
@@ -21105,9 +21195,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21105
21195
  function resolveRendererHostRpc(discovery, hostId2) {
21106
21196
  if (hostId2 === "durable")
21107
21197
  return null;
21108
- const record24 = (value2) => typeof value2 === "object" && value2 !== null;
21198
+ const record27 = (value2) => typeof value2 === "object" && value2 !== null;
21109
21199
  const signal = discovery.family.get(hostId2)?.value;
21110
- if (!record24(signal) || typeof signal.get !== "function")
21200
+ if (!record27(signal) || typeof signal.get !== "function")
21111
21201
  return null;
21112
21202
  let value;
21113
21203
  try {
@@ -21115,10 +21205,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21115
21205
  } catch {
21116
21206
  return null;
21117
21207
  }
21118
- if (!record24(value) || value.status !== "ready" || !record24(value.client) || value.client.hostId !== hostId2)
21208
+ if (!record27(value) || value.status !== "ready" || !record27(value.client) || value.client.hostId !== hostId2)
21119
21209
  return null;
21120
21210
  const rpc = value.client.rpc;
21121
- return typeof rpc === "function" || record24(rpc) ? rpc : null;
21211
+ return typeof rpc === "function" || record27(rpc) ? rpc : null;
21122
21212
  }
21123
21213
  function rendererHostRpcUsesExternalQueue(store, conversationId) {
21124
21214
  const providers = /* @__PURE__ */ new Map();
@@ -21606,14 +21696,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21606
21696
 
21607
21697
  // ../desktop-control/dist/renderer-host-discovery.js
21608
21698
  function requestManagerFromHookState(value, hostId2) {
21609
- const record24 = (candidate) => typeof candidate === "object" && candidate !== null;
21699
+ const record27 = (candidate) => typeof candidate === "object" && candidate !== null;
21610
21700
  const manager = (candidate) => {
21611
- if (!record24(candidate) || !record24(candidate.requestClient) || !record24(candidate.prewarmedThreadManager))
21701
+ if (!record27(candidate) || !record27(candidate.requestClient) || !record27(candidate.prewarmedThreadManager))
21612
21702
  return null;
21613
21703
  const bridge = candidate.requestClient;
21614
21704
  return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
21615
21705
  };
21616
- if (!record24(value))
21706
+ if (!record27(value))
21617
21707
  return null;
21618
21708
  const direct = manager(value) ?? manager(value.manager);
21619
21709
  if (direct)
@@ -23416,7 +23506,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23416
23506
  body.append(group);
23417
23507
  }
23418
23508
  }
23419
- function createQuestionCard(document2, question, submit, initial = {}, record24) {
23509
+ function createQuestionCard(document2, question, submit, initial = {}, record27) {
23420
23510
  const icon2 = (node) => document2.adoptNode(
23421
23511
  createElement(node, {
23422
23512
  width: 16,
@@ -23433,9 +23523,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23433
23523
  return selected;
23434
23524
  };
23435
23525
  const root = document2.createElement("section");
23436
- if (record24) {
23526
+ if (record27) {
23437
23527
  root.dataset.codexhostQuestionRecord = question.interactionId;
23438
- root.dataset.outcome = record24.outcome;
23528
+ root.dataset.outcome = record27.outcome;
23439
23529
  } else {
23440
23530
  root.dataset.codexhostQuestion = question.interactionId;
23441
23531
  }
@@ -23502,8 +23592,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23502
23592
  style.textContent = QUESTION_CARD_CSS;
23503
23593
  const surface = document2.createElement("div");
23504
23594
  surface.className = "card";
23505
- const historyMode = record24?.history ?? (record24 ? "selected" : void 0);
23506
- if (record24) {
23595
+ const historyMode = record27?.history ?? (record27 ? "selected" : void 0);
23596
+ if (record27) {
23507
23597
  root.dataset.history = historyMode ?? "selected";
23508
23598
  surface.classList.add("record");
23509
23599
  if (historyMode === "selected") surface.classList.add("compact");
@@ -23541,8 +23631,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23541
23631
  dismiss.setAttribute("aria-label", "Dismiss question");
23542
23632
  const outcome = document2.createElement("span");
23543
23633
  outcome.className = "outcome";
23544
- if (record24) {
23545
- outcome.textContent = RECORD_OUTCOME_LABEL[record24.outcome];
23634
+ if (record27) {
23635
+ outcome.textContent = RECORD_OUTCOME_LABEL[record27.outcome];
23546
23636
  title.append(titleIcon, titleText, outcome);
23547
23637
  } else {
23548
23638
  title.append(titleIcon, titleText, countdown, dismiss);
@@ -23664,7 +23754,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23664
23754
  actions.className = "actions";
23665
23755
  const readAnswers = () => Object.fromEntries([...readers].map(([id, read]) => [id, read()]));
23666
23756
  const interaction = { restoreFocus, bodyScrollTop, setBodyScrollTop };
23667
- if (record24) {
23757
+ if (record27) {
23668
23758
  for (const control of controls) control.disabled = true;
23669
23759
  if (footer.childNodes.length > 0) surface.append(footer);
23670
23760
  return {
@@ -24463,30 +24553,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24463
24553
  const syncRecords = (current, closed, liveId) => {
24464
24554
  const document2 = current.composer.ownerDocument;
24465
24555
  const visible2 = /* @__PURE__ */ new Set();
24466
- for (const record24 of closed) {
24467
- if (record24.interactionId === liveId) continue;
24468
- const mount = findVisibleHistoryMount(document2, record24.itemId, record24.turnId);
24556
+ for (const record27 of closed) {
24557
+ if (record27.interactionId === liveId) continue;
24558
+ const mount = findVisibleHistoryMount(document2, record27.itemId, record27.turnId);
24469
24559
  if (!mount) continue;
24470
24560
  const host = ensureQuestionHistorySlot(document2, mount);
24471
- visible2.add(record24.interactionId);
24472
- const existing = records.get(record24.interactionId);
24561
+ visible2.add(record27.interactionId);
24562
+ const existing = records.get(record27.interactionId);
24473
24563
  if (existing?.root.isConnected && existing.root.parentElement === host && existing.historyMode === historyMode)
24474
24564
  continue;
24475
24565
  existing?.dispose();
24476
24566
  const view = createQuestionCard(
24477
24567
  document2,
24478
24568
  {
24479
- interactionId: record24.interactionId,
24480
- turnId: record24.turnId,
24481
- ...record24.title !== void 0 ? { title: record24.title } : {},
24482
- questions: record24.questions
24569
+ interactionId: record27.interactionId,
24570
+ turnId: record27.turnId,
24571
+ ...record27.title !== void 0 ? { title: record27.title } : {},
24572
+ questions: record27.questions
24483
24573
  },
24484
24574
  async () => void 0,
24485
- record24.answers,
24486
- { outcome: record24.outcome, history: historyMode }
24575
+ record27.answers,
24576
+ { outcome: record27.outcome, history: historyMode }
24487
24577
  );
24488
24578
  host.append(view.root);
24489
- records.set(record24.interactionId, view);
24579
+ records.set(record27.interactionId, view);
24490
24580
  }
24491
24581
  for (const [id, view] of records) {
24492
24582
  if (visible2.has(id) && view.root.isConnected) continue;
@@ -42130,7 +42220,7 @@ ${detail}` : ""}`
42130
42220
  }
42131
42221
  function defaultImportName(source, existing) {
42132
42222
  const base = source.provider === "openai-codex" ? "codex" : "grok";
42133
- const used = new Set(existing.map((record24) => record24.name));
42223
+ const used = new Set(existing.map((record27) => record27.name));
42134
42224
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
42135
42225
  if (!used.has(base)) return base;
42136
42226
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -42153,7 +42243,7 @@ ${detail}` : ""}`
42153
42243
  const shown = (text) => accountDisplayText(text, hideEmails);
42154
42244
  const targetButtons = /* @__PURE__ */ new Map();
42155
42245
  const importedRecords = () => snapshot.targets.find((target2) => target2.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
42156
- const sourceOf = (record24) => snapshot.sources.find((source) => source.id === record24.source.id);
42246
+ const sourceOf = (record27) => snapshot.sources.find((source) => source.id === record27.source.id);
42157
42247
  const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
42158
42248
  const compatibleSources = () => {
42159
42249
  const target2 = piTarget();
@@ -42191,7 +42281,7 @@ ${detail}` : ""}`
42191
42281
  sectionImport.addEventListener("click", () => {
42192
42282
  const sources = compatibleSources();
42193
42283
  const free = sources.find(
42194
- (source2) => !importedRecords().some((record24) => record24.source.id === source2.id)
42284
+ (source2) => !importedRecords().some((record27) => record27.source.id === source2.id)
42195
42285
  );
42196
42286
  const source = free ?? sources[0];
42197
42287
  if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
@@ -42241,30 +42331,30 @@ ${detail}` : ""}`
42241
42331
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
42242
42332
  return mark;
42243
42333
  };
42244
- const renderRow = (record24) => {
42334
+ const renderRow = (record27) => {
42245
42335
  const row = document2.createElement("div");
42246
42336
  row.className = "settings-pi-accounts__row";
42247
42337
  row.tabIndex = -1;
42248
- row.dataset.importName = record24.name;
42249
- row.setAttribute("aria-label", shown(record24.source.label));
42250
- const agent = record24.source.harnessId;
42338
+ row.dataset.importName = record27.name;
42339
+ row.setAttribute("aria-label", shown(record27.source.label));
42340
+ const agent = record27.source.harnessId;
42251
42341
  const mark = createMark(agent);
42252
42342
  const identity3 = document2.createElement("div");
42253
42343
  identity3.className = "settings-pi-accounts__identity";
42254
42344
  const label = document2.createElement("strong");
42255
42345
  label.className = "settings-account-email";
42256
- label.textContent = shown(record24.source.label);
42346
+ label.textContent = shown(record27.source.label);
42257
42347
  label.title = label.textContent;
42258
42348
  label.translate = false;
42259
42349
  const meta3 = document2.createElement("div");
42260
42350
  meta3.className = "settings-account-metadata";
42261
- const source = sourceOf(record24);
42351
+ const source = sourceOf(record27);
42262
42352
  const parts = [
42263
42353
  metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
42264
- metaPart(`${record24.name}/\u2026`, void 0, true),
42354
+ metaPart(`${record27.name}/\u2026`, void 0, true),
42265
42355
  metaPart(messages.copied)
42266
42356
  ];
42267
- const time3 = formatImportedAt(record24.importedAt);
42357
+ const time3 = formatImportedAt(record27.importedAt);
42268
42358
  if (time3) parts.push(metaPart(time3));
42269
42359
  parts.forEach((part, index) => {
42270
42360
  if (index > 0) {
@@ -42281,23 +42371,23 @@ ${detail}` : ""}`
42281
42371
  reimport.type = "button";
42282
42372
  reimport.className = "settings-account-action";
42283
42373
  reimport.textContent = messages.rowReimport;
42284
- reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record24.source.label)}`);
42374
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record27.source.label)}`);
42285
42375
  reimport.disabled = busy || !source;
42286
42376
  reimport.title = messages.reimport;
42287
42377
  reimport.addEventListener("click", () => {
42288
- if (source) openDialog("reimport", { source, record: record24 }, `row:${record24.name}`);
42378
+ if (source) openDialog("reimport", { source, record: record27 }, `row:${record27.name}`);
42289
42379
  });
42290
42380
  const remove = document2.createElement("button");
42291
42381
  remove.type = "button";
42292
42382
  remove.className = "settings-account-action settings-pi-accounts__remove";
42293
42383
  remove.textContent = messages.rowRemove;
42294
- remove.setAttribute("aria-label", `${messages.remove}: ${shown(record24.source.label)}`);
42384
+ remove.setAttribute("aria-label", `${messages.remove}: ${shown(record27.source.label)}`);
42295
42385
  remove.disabled = busy;
42296
- remove.addEventListener("click", () => openDialog("remove", { record: record24 }, `row:${record24.name}`));
42386
+ remove.addEventListener("click", () => openDialog("remove", { record: record27 }, `row:${record27.name}`));
42297
42387
  if (source) actions.append(reimport);
42298
42388
  actions.append(remove);
42299
42389
  row.append(mark, identity3, actions);
42300
- rows.set(record24.name, row);
42390
+ rows.set(record27.name, row);
42301
42391
  return row;
42302
42392
  };
42303
42393
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -42450,7 +42540,7 @@ ${detail}` : ""}`
42450
42540
  const label = document2.createElement("strong");
42451
42541
  label.textContent = shown(choice.label);
42452
42542
  label.translate = false;
42453
- const existing = importedRecords().find((record24) => record24.source.id === choice.id);
42543
+ const existing = importedRecords().find((record27) => record27.source.id === choice.id);
42454
42544
  const agent = choice.harnessId;
42455
42545
  const detail = document2.createElement("span");
42456
42546
  detail.textContent = [
@@ -42491,7 +42581,7 @@ ${detail}` : ""}`
42491
42581
  const name = request.action === "list" ? void 0 : request.name;
42492
42582
  state = {
42493
42583
  source: state.source,
42494
- record: importedRecords().find((record24) => record24.name === name) ?? state.record
42584
+ record: importedRecords().find((record27) => record27.name === name) ?? state.record
42495
42585
  };
42496
42586
  show(next);
42497
42587
  } else {
@@ -42505,12 +42595,12 @@ ${detail}` : ""}`
42505
42595
  sourceRadios = [];
42506
42596
  body.replaceChildren();
42507
42597
  controls.replaceChildren();
42508
- const { source, record: record24 } = state;
42598
+ const { source, record: record27 } = state;
42509
42599
  const close = () => modal.close();
42510
42600
  if (mode2 === "add" || mode2 === "reimport") {
42511
42601
  title.textContent = mode2 === "add" ? messages.add : messages.reimport;
42512
42602
  modal.setAttribute("aria-label", title.textContent);
42513
- const active = source ?? record24?.source;
42603
+ const active = source ?? record27?.source;
42514
42604
  const choices = mode2 === "add" && state.choose ? compatibleSources() : [];
42515
42605
  if (choices.length > 1) body.append(sourcePicker(choices));
42516
42606
  else if (active) body.append(line(messages.source, shown(active.label)));
@@ -42519,8 +42609,8 @@ ${detail}` : ""}`
42519
42609
  input.maxLength = 48;
42520
42610
  input.autocomplete = "off";
42521
42611
  input.spellcheck = false;
42522
- input.value = record24?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
42523
- input.readOnly = Boolean(record24);
42612
+ input.value = record27?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
42613
+ input.readOnly = Boolean(record27);
42524
42614
  input.addEventListener("input", () => {
42525
42615
  nameEdited = true;
42526
42616
  });
@@ -42554,7 +42644,7 @@ ${detail}` : ""}`
42554
42644
  {
42555
42645
  action: mode2 === "reimport" ? "reimport" : "import",
42556
42646
  sourceId: source2.id,
42557
- name: record24?.name ?? input.value,
42647
+ name: record27?.name ?? input.value,
42558
42648
  confirmed: true
42559
42649
  },
42560
42650
  "done"
@@ -42564,16 +42654,16 @@ ${detail}` : ""}`
42564
42654
  )
42565
42655
  );
42566
42656
  (mode2 === "add" ? input : controls.children[0]).focus();
42567
- } else if (mode2 === "remove" && record24) {
42657
+ } else if (mode2 === "remove" && record27) {
42568
42658
  title.textContent = messages.remove;
42569
42659
  modal.setAttribute("aria-label", title.textContent);
42570
- body.append(note(messages.removeWarning.replace("{name}", record24.name)));
42660
+ body.append(note(messages.removeWarning.replace("{name}", record27.name)));
42571
42661
  const cancel = command(messages.cancel, close);
42572
42662
  controls.append(
42573
42663
  cancel,
42574
42664
  command(
42575
42665
  messages.remove,
42576
- () => submit({ action: "remove", name: record24.name, confirmed: true }, null),
42666
+ () => submit({ action: "remove", name: record27.name, confirmed: true }, null),
42577
42667
  "danger"
42578
42668
  )
42579
42669
  );
@@ -42581,7 +42671,7 @@ ${detail}` : ""}`
42581
42671
  } else {
42582
42672
  title.textContent = messages.doneTitle;
42583
42673
  modal.setAttribute("aria-label", title.textContent);
42584
- const name = record24?.name;
42674
+ const name = record27?.name;
42585
42675
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
42586
42676
  body.append(note(messages.done));
42587
42677
  const done = command(messages.close, close, "primary");
@@ -42628,21 +42718,21 @@ ${detail}` : ""}`
42628
42718
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
42629
42719
  );
42630
42720
  if (!source || !target2) return null;
42631
- const record24 = target2.imports.find((candidate) => candidate.source.id === source.id);
42721
+ const record27 = target2.imports.find((candidate) => candidate.source.id === source.id);
42632
42722
  const key = `${harnessId}:${accountLabel}:import`;
42633
42723
  const button2 = document2.createElement("button");
42634
42724
  button2.type = "button";
42635
42725
  button2.className = "settings-account-pi-import";
42636
42726
  button2.dataset.accountFocus = key;
42637
42727
  button2.disabled = busy;
42638
- const hint = record24 ? messages.importedHint.replace("{name}", record24.name) : messages.add;
42728
+ const hint = record27 ? messages.importedHint.replace("{name}", record27.name) : messages.add;
42639
42729
  button2.title = hint;
42640
42730
  button2.setAttribute("aria-label", hint);
42641
42731
  button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
42642
- if (record24) {
42732
+ if (record27) {
42643
42733
  button2.dataset.state = "imported";
42644
42734
  const name = document2.createElement("code");
42645
- name.textContent = `${record24.name}/\u2026`;
42735
+ name.textContent = `${record27.name}/\u2026`;
42646
42736
  name.translate = false;
42647
42737
  button2.append(name, createRendererSettingsIcon("check", 12));
42648
42738
  } else {
@@ -42650,7 +42740,7 @@ ${detail}` : ""}`
42650
42740
  button2.append(messages.add);
42651
42741
  }
42652
42742
  button2.addEventListener("click", () => {
42653
- if (!record24) {
42743
+ if (!record27) {
42654
42744
  openDialog("add", { source }, key);
42655
42745
  return;
42656
42746
  }
@@ -42659,7 +42749,7 @@ ${detail}` : ""}`
42659
42749
  renderSection();
42660
42750
  sectionToggle.setAttribute("aria-expanded", "true");
42661
42751
  }
42662
- const row = rows.get(record24.name);
42752
+ const row = rows.get(record27.name);
42663
42753
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
42664
42754
  row?.focus();
42665
42755
  });
@@ -49979,7 +50069,7 @@ th[aria-sort] .console-usage-sort__mark {
49979
50069
  place();
49980
50070
  const observer = ownerWindow ? new ownerWindow.MutationObserver((records) => {
49981
50071
  const titlebar = source?.closest("[data-app-shell-titlebar]");
49982
- if (!source?.isConnected || records.some((record24) => titlebar?.contains(record24.target))) {
50072
+ if (!source?.isConnected || records.some((record27) => titlebar?.contains(record27.target))) {
49983
50073
  place();
49984
50074
  }
49985
50075
  }) : null;
@@ -55192,168 +55282,67 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55192
55282
  return binding;
55193
55283
  }
55194
55284
 
55195
- // src/renderer-external-voice-launch.ts
55196
- var HOOK_GLOBAL4 = "__codexhostExternalVoiceLaunchV1";
55197
- var SHARED_ASSET = "app-shared-8bd9d0399038.js";
55198
- var LAUNCH_ASSETS = [
55199
- ...CLIENT_OWNED_VOICE_ASSETS,
55200
- {
55201
- platform: "darwin",
55202
- version: AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION,
55203
- initial: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET,
55204
- shared: SHARED_ASSET,
55205
- services: "fN"
55206
- }
55207
- ];
55208
- function isRecord17(value) {
55209
- return typeof value === "object" && value !== null && !Array.isArray(value);
55210
- }
55211
- function hashedAppServices(value) {
55212
- return isRecord17(value) && isRecord17(value.appServices) ? value.appServices : void 0;
55213
- }
55214
- function routeExternalVoiceLaunch(request, routing, owner = globalThis) {
55215
- rememberVoiceProductExperience(request, owner);
55216
- if (!routing || !isRecord17(request) || request.source !== "composer_button_new_thread")
55217
- return request;
55218
- if (request.productExperience === "chat") return request;
55219
- const hostId2 = request.hostId ?? "local";
55220
- if (typeof hostId2 !== "string" || !hostId2) return request;
55221
- const route = routing.forComposer();
55222
- if (!route || route.hostId !== hostId2 || routing.forHost(hostId2) !== route) return request;
55223
- const model2 = route.policy.selectedModel();
55224
- if (typeof model2 !== "string" || !model2.startsWith("codexhost/")) return request;
55285
+ // src/renderer-voice-starter-core.ts
55286
+ var record18 = (v) => v !== null && typeof v === "object";
55287
+ function gatewayVoiceStartRequest(request, workGateway, chatGateway = false, externalHarness = false) {
55288
+ if (!record18(request) || request.productExperience !== "work" && request.productExperience !== "codex" && request.productExperience !== "chat")
55289
+ return false;
55290
+ if (request.source === "composer_button_existing_thread") {
55291
+ if (!record18(request.locator) || request.locator.hostId !== "local") return false;
55292
+ } else if (request.source !== "composer_button_new_thread" || (request.hostId ?? "local") !== "local")
55293
+ return false;
55294
+ if (request.productExperience === "chat") return chatGateway;
55225
55295
  const mode2 = request.activeCollaborationMode;
55226
- if (mode2 !== void 0 && mode2 !== null && !isRecord17(mode2)) return request;
55227
- const settings = isRecord17(mode2) ? mode2.settings : void 0;
55228
- if (settings !== void 0 && settings !== null && !isRecord17(settings)) return request;
55229
- return {
55230
- ...request,
55231
- activeCollaborationMode: {
55232
- ...isRecord17(mode2) ? mode2 : { mode: "default" },
55233
- settings: {
55234
- reasoning_effort: null,
55235
- developer_instructions: null,
55236
- ...isRecord17(settings) ? settings : {},
55237
- model: model2
55238
- }
55239
- }
55240
- };
55296
+ const settings = record18(mode2) ? mode2.settings : void 0;
55297
+ const model2 = record18(settings) ? settings.model : void 0;
55298
+ if (typeof model2 === "string" && model2.startsWith("codexhost/")) return externalHarness;
55299
+ return workGateway || externalHarness;
55241
55300
  }
55242
- function ownedChatgptChatStartUnavailable(request, owner = globalThis) {
55243
- if (!isRecord17(request) || request.productExperience !== "chat") return;
55244
- if (!nativeChatVoicePreferenceAllowsStart(owner)) return;
55245
- if (!readCpaLiveVoiceHookConfig(owner)) return;
55246
- return chatVoiceQualifiedOnOwner(owner) ? "Native Chat voice is unavailable" : chatVoiceUserFacingUnavailable(owner);
55247
- }
55248
- function installExternalVoiceLaunchHook(options = {}) {
55249
- const target2 = options.target ?? globalThis;
55250
- const existing = target2[HOOK_GLOBAL4];
55251
- if (existing) return existing;
55252
- const config2 = readCpaLiveVoiceHookConfig(target2);
55253
- if (!config2) return { status: "disabled", dispose() {
55254
- } };
55255
- const hashed = hashedNativeChatVoiceSupported(config2);
55256
- if (!hashed && (config2.auditedDesktopVersion !== AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION || config2.auditedAppInitialAsset !== AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET || config2.desktopVersion !== void 0 && config2.desktopVersion !== config2.auditedDesktopVersion && !supportsVoiceVersion(CLIENT_OWNED_VOICE_ASSETS, config2.desktopVersion)))
55257
- return { status: "unsupported", dispose() {
55258
- } };
55259
- const importModule = options.importModule ?? ((url2) => import(url2));
55260
- let disposed = false;
55261
- let timer;
55262
- let restore;
55263
- let module;
55264
- const started = Date.now();
55265
- const handle = {
55266
- status: "pending",
55267
- dispose() {
55268
- disposed = true;
55269
- if (timer !== void 0) target2.clearTimeout(timer);
55270
- restore?.();
55271
- if (target2[HOOK_GLOBAL4] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL4);
55272
- }
55273
- };
55274
- target2[HOOK_GLOBAL4] = handle;
55275
- const attempt = async () => {
55276
- if (disposed) return;
55277
- try {
55278
- const names = loadedAssetNames(target2.document, target2.performance);
55279
- const wrapRuntime = (services) => {
55280
- const original = services.realtimeVoiceRuntime;
55281
- if (typeof original !== "function" && !isRecord17(original)) return false;
55282
- const start = Reflect.get(original, "requestRealtimeStart");
55283
- if (typeof start !== "function") return false;
55284
- const launch = (...args) => {
55285
- let request = args[0];
55286
- const chatStart = startNativeChatVoiceForRequest(request, target2);
55287
- if (chatStart) return chatStart;
55288
- const ownedChatUnavailable = ownedChatgptChatStartUnavailable(request, target2);
55289
- if (ownedChatUnavailable) {
55290
- rememberVoiceProductExperience(request, target2);
55291
- throw new Error(ownedChatUnavailable);
55292
- }
55293
- try {
55294
- request = routeExternalVoiceLaunch(request, target2.__codexhostHostRoutingV1, target2);
55295
- } catch {
55296
- }
55297
- return Reflect.apply(start, original, [request, ...args.slice(1)]);
55298
- };
55299
- const wrapped = new Proxy(original, {
55300
- get(service, key, receiver) {
55301
- return key === "requestRealtimeStart" ? launch : Reflect.get(service, key, receiver);
55302
- }
55303
- });
55304
- if (!Reflect.set(services, "realtimeVoiceRuntime", wrapped)) return false;
55305
- restore = () => {
55306
- if (services.realtimeVoiceRuntime === wrapped) services.realtimeVoiceRuntime = original;
55307
- };
55308
- handle.status = "active";
55309
- return true;
55310
- };
55311
- if (hashed) {
55312
- if (names.some((name) => name.includes(HASHED_WEBPACK_VOICE_RUNTIME_ASSET))) {
55313
- const req = await resolveHashedWebpackRequire(importModule);
55314
- if (disposed) return;
55315
- let ga;
55316
- try {
55317
- ga = req?.("GaA7");
55318
- } catch {
55319
- ga = void 0;
55320
- }
55321
- const services = hashedAppServices(ga);
55322
- if (services && wrapRuntime(services)) return;
55323
- }
55324
- } else {
55325
- const assets = selectVoiceAssets(
55326
- LAUNCH_ASSETS,
55327
- names,
55328
- config2.desktopVersion,
55329
- config2.desktopPlatform
55301
+ function wrapGatewayVoiceStarter(start, options) {
55302
+ let active;
55303
+ return {
55304
+ async start(...args) {
55305
+ const request = args[0];
55306
+ const qualified = options.qualifies(request);
55307
+ const wantsGateway = options.configured?.(request) ?? qualified;
55308
+ if (!wantsGateway) return start(...args);
55309
+ if (!qualified) {
55310
+ throw new Error(
55311
+ options.unavailable?.(request) ?? "Work voice is not qualified on this Desktop."
55330
55312
  );
55331
- if (assets) {
55332
- module ??= await importModule(`app://-/assets/${assets.shared}`);
55333
- if (disposed) return;
55334
- const services = module?.[assets.services];
55335
- if (isRecord17(services) && wrapRuntime(services)) return;
55336
- }
55337
55313
  }
55338
- } catch {
55339
- handle.status = "unsupported";
55340
- return;
55341
- }
55342
- if (Date.now() - started >= 6e4) {
55343
- handle.status = "unsupported";
55344
- return;
55314
+ if (active) {
55315
+ active.binding?.dispose();
55316
+ active = void 0;
55317
+ }
55318
+ const attempt = {};
55319
+ active = attempt;
55320
+ const allowed = () => active === attempt && options.qualifies(args[0]);
55321
+ try {
55322
+ if (!await options.ready()) throw new Error("Voice gateway is not ready");
55323
+ if (!allowed()) throw new Error("Voice gateway start was cancelled");
55324
+ attempt.binding = await options.prepare(allowed);
55325
+ await options.committed(attempt.binding);
55326
+ if (!allowed()) throw new Error("Voice gateway start was cancelled");
55327
+ if (!attempt.binding.current()) throw new Error("Voice starter subscription changed");
55328
+ rememberVoiceProductExperience(args[0]);
55329
+ return await start(...args);
55330
+ } finally {
55331
+ attempt.binding?.dispose();
55332
+ if (active === attempt) active = void 0;
55333
+ }
55334
+ },
55335
+ cancel() {
55336
+ active?.binding?.dispose();
55337
+ active = void 0;
55345
55338
  }
55346
- timer = target2.setTimeout(() => void attempt(), 250);
55347
55339
  };
55348
- void attempt();
55349
- return handle;
55350
55340
  }
55351
55341
 
55352
- // src/renderer-voice-capability.ts
55353
- var GLOBAL = "__codexhostVoiceCapabilityV1";
55342
+ // src/renderer-voice-capability-subscriptions.ts
55354
55343
  var INFERENCE_GATE = "3683713372";
55355
- var record18 = (value) => value !== null && typeof value === "object";
55356
- var capable = (value) => record18(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
55344
+ var record19 = (value) => value !== null && typeof value === "object";
55345
+ var capable = (value) => record19(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
55357
55346
  var equal = (a, b) => a.isLoading === b.isLoading && a.isError === b.isError && a.isCapable === b.isCapable;
55358
55347
  function replayVoiceCapability(store, atom, gate) {
55359
55348
  const evaluate = (override) => {
@@ -55391,7 +55380,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55391
55380
  }
55392
55381
  }
55393
55382
  function isFamily(value) {
55394
- return record18(value) && record18(value.scope) && typeof value.resolve === "function";
55383
+ return record19(value) && record19(value.scope) && typeof value.resolve === "function";
55395
55384
  }
55396
55385
  function isReadableCapabilityFamily(value) {
55397
55386
  return isFamily(value) && value.kind === "readable-family" && typeof value.read === "function";
@@ -55400,7 +55389,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55400
55389
  return isFamily(value) && value.kind === "signal-family";
55401
55390
  }
55402
55391
  function isDerivedAccessFactory(value) {
55403
- return record18(value) && record18(value.scope) && (typeof value.cache === "string" || record18(value.cache)) && typeof value.resolve === "function" && typeof value.createSubscriberAtom === "function" && typeof value.read !== "function" && value.kind == null;
55392
+ return record19(value) && record19(value.scope) && (typeof value.cache === "string" || record19(value.cache)) && typeof value.resolve === "function" && typeof value.createSubscriberAtom === "function" && typeof value.read !== "function" && value.kind == null;
55404
55393
  }
55405
55394
  function hashedVoiceCapabilityFamilies(req) {
55406
55395
  const roles = HASHED_OVERLAY_VOICE_ROLES;
@@ -55422,9 +55411,9 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55422
55411
  } catch {
55423
55412
  return { reason: "access-shape" };
55424
55413
  }
55425
- const family = record18(capabilityExports) ? capabilityExports[roles.capabilityExport] : void 0;
55426
- const gates = record18(gateExports) ? gateExports[roles.inferenceGateExport] : void 0;
55427
- const access = record18(accessExports) ? accessExports[roles.voiceAccessExport] : void 0;
55414
+ const family = record19(capabilityExports) ? capabilityExports[roles.capabilityExport] : void 0;
55415
+ const gates = record19(gateExports) ? gateExports[roles.inferenceGateExport] : void 0;
55416
+ const access = record19(accessExports) ? accessExports[roles.voiceAccessExport] : void 0;
55428
55417
  if (!isReadableCapabilityFamily(family) || !isSignalGateFamily(gates)) return;
55429
55418
  if (!isDerivedAccessFactory(access)) return { reason: "access-shape" };
55430
55419
  return { family, gates, access };
@@ -55432,7 +55421,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55432
55421
  function resolveDerivedAccessAtom(factory, node, chain) {
55433
55422
  try {
55434
55423
  const resolved = factory.resolve(node, chain);
55435
- if (record18(resolved) && typeof resolved.read === "function" && !("atom" in resolved))
55424
+ if (record19(resolved) && typeof resolved.read === "function" && !("atom" in resolved))
55436
55425
  return resolved;
55437
55426
  return void 0;
55438
55427
  } catch {
@@ -55441,7 +55430,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55441
55430
  }
55442
55431
  var ALLOWED_ACCESS = { status: "allowed" };
55443
55432
  function unsupportedAuthAccess(value) {
55444
- return record18(value) && value.status === "denied" && value.reason === HASHED_26_1106_VOICE_EVALUATOR.unsupportedAuthReason;
55433
+ return record19(value) && value.status === "denied" && value.reason === HASHED_26_1106_VOICE_EVALUATOR.unsupportedAuthReason;
55445
55434
  }
55446
55435
  function replayHashedWorkAccessCapability(store, atom, access) {
55447
55436
  const evaluate = (override) => {
@@ -55493,49 +55482,13 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55493
55482
  const result = [];
55494
55483
  const seen = /* @__PURE__ */ new Set();
55495
55484
  let hook = fiber.memoizedState;
55496
- while (record18(hook) && result.length < 4096 && !seen.has(hook)) {
55485
+ while (record19(hook) && result.length < 4096 && !seen.has(hook)) {
55497
55486
  seen.add(hook);
55498
55487
  result.push(hook);
55499
55488
  hook = hook.next;
55500
55489
  }
55501
55490
  return hook == null ? result : [];
55502
55491
  }
55503
- function composerFibers(composer, chat = false) {
55504
- const fibers = /* @__PURE__ */ new Set();
55505
- const rootKey = Object.getOwnPropertyNames(composer).find(
55506
- (key) => key.startsWith("__reactFiber$")
55507
- );
55508
- const ancestors2 = rootKey ? committedReactAncestors(Object.getOwnPropertyDescriptor(composer, rootKey)?.value) : [];
55509
- let root = ancestors2[0];
55510
- if (chat) {
55511
- const owners = ancestors2.filter(
55512
- ({ memoizedProps: props }) => record18(props) && props.isWorkConversation === false && props.isTemporaryChat === false && props.shouldBlockExternalEgress === false && props.readOnly !== true && typeof props.conversationId === "string" && record18(props.composerSelectionContext) && props.composerSelectionContext.conversationId === props.conversationId
55513
- );
55514
- if (owners.length !== 1) return fibers;
55515
- root = owners[0];
55516
- }
55517
- if (!root) return fibers;
55518
- for (const element of [composer, ...composer.querySelectorAll("*")].slice(0, 2048)) {
55519
- const key = Object.getOwnPropertyNames(element).find((key2) => key2.startsWith("__reactFiber$"));
55520
- if (!key) continue;
55521
- const ancestors3 = committedReactAncestors(Object.getOwnPropertyDescriptor(element, key)?.value);
55522
- const boundary = ancestors3.indexOf(root);
55523
- if (boundary < 0) continue;
55524
- for (const fiber of ancestors3.slice(0, boundary + 1)) if (record18(fiber)) fibers.add(fiber);
55525
- }
55526
- return fibers;
55527
- }
55528
- function bindComposerVoiceCapability(composer, family, gates, allowed, chat = false, project3) {
55529
- return bindVoiceCapabilitySubscriptions(
55530
- () => composerFibers(composer, chat),
55531
- family,
55532
- gates,
55533
- allowed,
55534
- false,
55535
- ["voice.realtime", "voice.thread"],
55536
- project3
55537
- );
55538
- }
55539
55492
  function bindVoiceCapabilitySubscriptions(currentFibers, family, gates, allowed, realtimeOnly = false, names = ["voice.realtime", "voice.thread"], project3) {
55540
55493
  const fibers = currentFibers();
55541
55494
  const restores = [];
@@ -55545,7 +55498,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55545
55498
  const list = hooks2(fiber);
55546
55499
  for (const memo of list) {
55547
55500
  const [signal, deps] = Array.isArray(memo.memoizedState) ? memo.memoizedState : [];
55548
- if (!record18(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
55501
+ if (!record19(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
55549
55502
  continue;
55550
55503
  const chain = deps[1];
55551
55504
  const node = chain.get(family.scope.id);
@@ -55554,7 +55507,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55554
55507
  const matches = [...members].filter(([, member]) => member.cacheKey === deps[0]);
55555
55508
  if (matches.length !== 1 || typeof matches[0]?.[0] !== "string") continue;
55556
55509
  const parameter = JSON.parse(matches[0][0]);
55557
- if (!record18(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")
55510
+ if (!record19(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")
55558
55511
  continue;
55559
55512
  const subscriptions = list.filter((hook2) => {
55560
55513
  const state = hook2.memoizedState;
@@ -55567,7 +55520,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55567
55520
  const effect = hook.next?.next?.memoizedState;
55568
55521
  const store = signal.store;
55569
55522
  const gate = gates.resolve(node, chain, INFERENCE_GATE)?.atom;
55570
- if (!gate || !instance || !record18(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(
55523
+ if (!gate || !instance || !record19(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(
55571
55524
  store.get(signal.atom),
55572
55525
  subscriber.getSnapshot()
55573
55526
  ) || !equal(subscriber.getSnapshot(), instance.getSnapshot()) || subscriber.createRender?.() != null)
@@ -55661,6 +55614,46 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55661
55614
  }
55662
55615
  };
55663
55616
  }
55617
+
55618
+ // src/renderer-voice-capability.ts
55619
+ var GLOBAL = "__codexhostVoiceCapabilityV1";
55620
+ var record20 = (value) => value !== null && typeof value === "object";
55621
+ function composerFibers(composer, chat = false) {
55622
+ const fibers = /* @__PURE__ */ new Set();
55623
+ const rootKey = Object.getOwnPropertyNames(composer).find(
55624
+ (key) => key.startsWith("__reactFiber$")
55625
+ );
55626
+ const ancestors2 = rootKey ? committedReactAncestors(Object.getOwnPropertyDescriptor(composer, rootKey)?.value) : [];
55627
+ let root = ancestors2[0];
55628
+ if (chat) {
55629
+ const owners = ancestors2.filter(
55630
+ ({ memoizedProps: props }) => record20(props) && props.isWorkConversation === false && props.isTemporaryChat === false && props.shouldBlockExternalEgress === false && props.readOnly !== true && typeof props.conversationId === "string" && record20(props.composerSelectionContext) && props.composerSelectionContext.conversationId === props.conversationId
55631
+ );
55632
+ if (owners.length !== 1) return fibers;
55633
+ root = owners[0];
55634
+ }
55635
+ if (!root) return fibers;
55636
+ for (const element of [composer, ...composer.querySelectorAll("*")].slice(0, 2048)) {
55637
+ const key = Object.getOwnPropertyNames(element).find((key2) => key2.startsWith("__reactFiber$"));
55638
+ if (!key) continue;
55639
+ const ancestors3 = committedReactAncestors(Object.getOwnPropertyDescriptor(element, key)?.value);
55640
+ const boundary = ancestors3.indexOf(root);
55641
+ if (boundary < 0) continue;
55642
+ for (const fiber of ancestors3.slice(0, boundary + 1)) if (record20(fiber)) fibers.add(fiber);
55643
+ }
55644
+ return fibers;
55645
+ }
55646
+ function bindComposerVoiceCapability(composer, family, gates, allowed, chat = false, project3) {
55647
+ return bindVoiceCapabilitySubscriptions(
55648
+ () => composerFibers(composer, chat),
55649
+ family,
55650
+ gates,
55651
+ allowed,
55652
+ false,
55653
+ ["voice.realtime", "voice.thread"],
55654
+ project3
55655
+ );
55656
+ }
55664
55657
  function installVoiceCapabilityProjection(options = {}) {
55665
55658
  const target2 = options.target ?? globalThis;
55666
55659
  const revision = voiceImplementationRevision();
@@ -55684,6 +55677,9 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55684
55677
  status: "pending",
55685
55678
  reason: "pending",
55686
55679
  revision,
55680
+ current() {
55681
+ return !disposed && allowed() && binding?.current() === true;
55682
+ },
55687
55683
  dispose() {
55688
55684
  disposed = true;
55689
55685
  target2.clearTimeout(timer);
@@ -55703,7 +55699,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55703
55699
  target2[GLOBAL] = handle;
55704
55700
  const hookActive = (key) => {
55705
55701
  const hook = target2[key];
55706
- return record18(hook) && hook.status === "active";
55702
+ return record20(hook) && hook.status === "active";
55707
55703
  };
55708
55704
  const currentRoute = () => {
55709
55705
  try {
@@ -55814,8 +55810,299 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55814
55810
  return handle;
55815
55811
  }
55816
55812
 
55813
+ // src/renderer-hashed-gateway-start.ts
55814
+ var record21 = (v) => v !== null && typeof v === "object";
55815
+ var OVERLAY_CAPABILITY = "__codexhostVoiceCapabilityV1";
55816
+ var COMMIT_POLL_MS = 50;
55817
+ var COMMIT_POLLS = 40;
55818
+ function committedCapability(target2) {
55819
+ const capability = target2[OVERLAY_CAPABILITY];
55820
+ if (!record21(capability) || capability.status !== "active" || typeof capability.current !== "function" || typeof capability.dispose !== "function")
55821
+ return;
55822
+ return capability;
55823
+ }
55824
+ function workLane(request) {
55825
+ const mode2 = record21(request) ? request.activeCollaborationMode : void 0;
55826
+ const settings = record21(mode2) ? mode2.settings : void 0;
55827
+ const model2 = record21(settings) ? settings.model : void 0;
55828
+ return typeof model2 === "string" && model2.startsWith("codexhost/") ? "work-grok" : "work-codex";
55829
+ }
55830
+ function hashedGatewayStarterOptions(target2, workGateway = () => cpaLiveVoicePreferenceAllowsInstall(target2), chatGateway = () => chatLiveVoicePreferenceAllowsOverride(target2), external = () => false) {
55831
+ const configured = (request) => gatewayVoiceStartRequest(
55832
+ request,
55833
+ workGateway(),
55834
+ chatGateway(),
55835
+ external() || workLane(request) === "work-grok"
55836
+ );
55837
+ return {
55838
+ configured,
55839
+ qualifies: (request) => {
55840
+ const lane = workLane(request);
55841
+ return gatewayVoiceStartRequest(
55842
+ request,
55843
+ lane === "work-codex" && workGateway() && workVoiceLaneEnabled(target2, "work-codex"),
55844
+ chatGateway(),
55845
+ lane === "work-grok" && workVoiceLaneEnabled(target2, "work-grok")
55846
+ );
55847
+ },
55848
+ unavailable: (request) => workVoiceUserFacingUnavailable(target2, workLane(request)),
55849
+ ready: async () => {
55850
+ for (let i = 0; i < COMMIT_POLLS; i += 1) {
55851
+ const client = target2.__codexhostClientOwnedVoiceV1;
55852
+ if (record21(client) && client.status === "active" && committedCapability(target2) !== void 0)
55853
+ return true;
55854
+ await new Promise((resolve) => target2.setTimeout(resolve, COMMIT_POLL_MS));
55855
+ }
55856
+ return false;
55857
+ },
55858
+ prepare: async () => {
55859
+ const capability = committedCapability(target2);
55860
+ if (!capability) throw new Error("Overlay voice capability is not ready");
55861
+ return {
55862
+ // The capability install owns the subscription; a start only reads it.
55863
+ dispose() {
55864
+ },
55865
+ current: () => target2[OVERLAY_CAPABILITY] === capability && capability.current()
55866
+ };
55867
+ },
55868
+ committed: async (binding) => {
55869
+ for (let i = 0; i < COMMIT_POLLS && !binding.current(); i += 1)
55870
+ await new Promise((resolve) => target2.setTimeout(resolve, COMMIT_POLL_MS));
55871
+ }
55872
+ };
55873
+ }
55874
+
55875
+ // src/renderer-external-voice-launch.ts
55876
+ var HOOK_GLOBAL4 = "__codexhostExternalVoiceLaunchV1";
55877
+ var SHARED_ASSET = "app-shared-8bd9d0399038.js";
55878
+ var LAUNCH_ASSETS = [
55879
+ ...CLIENT_OWNED_VOICE_ASSETS,
55880
+ {
55881
+ platform: "darwin",
55882
+ version: AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION,
55883
+ initial: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET,
55884
+ shared: SHARED_ASSET,
55885
+ services: "fN"
55886
+ }
55887
+ ];
55888
+ function isRecord17(value) {
55889
+ return typeof value === "object" && value !== null && !Array.isArray(value);
55890
+ }
55891
+ function hashedAppServices(value) {
55892
+ return isRecord17(value) && isRecord17(value.appServices) ? value.appServices : void 0;
55893
+ }
55894
+ function routeExternalVoiceLaunch(request, routing, owner = globalThis) {
55895
+ rememberVoiceProductExperience(request, owner);
55896
+ if (!routing || !isRecord17(request) || request.source !== "composer_button_new_thread")
55897
+ return request;
55898
+ if (request.productExperience === "chat") return request;
55899
+ const hostId2 = request.hostId ?? "local";
55900
+ if (typeof hostId2 !== "string" || !hostId2) return request;
55901
+ const route = routing.forComposer();
55902
+ if (!route || route.hostId !== hostId2 || routing.forHost(hostId2) !== route) return request;
55903
+ const model2 = route.policy.selectedModel();
55904
+ if (typeof model2 !== "string" || !model2.startsWith("codexhost/")) return request;
55905
+ const mode2 = request.activeCollaborationMode;
55906
+ if (mode2 !== void 0 && mode2 !== null && !isRecord17(mode2)) return request;
55907
+ const settings = isRecord17(mode2) ? mode2.settings : void 0;
55908
+ if (settings !== void 0 && settings !== null && !isRecord17(settings)) return request;
55909
+ return {
55910
+ ...request,
55911
+ activeCollaborationMode: {
55912
+ ...isRecord17(mode2) ? mode2 : { mode: "default" },
55913
+ settings: {
55914
+ reasoning_effort: null,
55915
+ developer_instructions: null,
55916
+ ...isRecord17(settings) ? settings : {},
55917
+ model: model2
55918
+ }
55919
+ }
55920
+ };
55921
+ }
55922
+ function ownedChatgptChatStartUnavailable(request, owner = globalThis) {
55923
+ if (!isRecord17(request) || request.productExperience !== "chat") return;
55924
+ if (!nativeChatVoicePreferenceAllowsStart(owner)) return;
55925
+ if (!readCpaLiveVoiceHookConfig(owner)) return;
55926
+ return chatVoiceQualifiedOnOwner(owner) ? "Native Chat voice is unavailable" : chatVoiceUserFacingUnavailable(owner);
55927
+ }
55928
+ function installExternalVoiceLaunchHook(options = {}) {
55929
+ const target2 = options.target ?? globalThis;
55930
+ const existing = target2[HOOK_GLOBAL4];
55931
+ if (existing) return existing;
55932
+ const config2 = readCpaLiveVoiceHookConfig(target2);
55933
+ if (!config2) return { status: "disabled", dispose() {
55934
+ } };
55935
+ const hashed = hashedNativeChatVoiceSupported(config2);
55936
+ if (!hashed && (config2.auditedDesktopVersion !== AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION || config2.auditedAppInitialAsset !== AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET || config2.desktopVersion !== void 0 && config2.desktopVersion !== config2.auditedDesktopVersion && !supportsVoiceVersion(CLIENT_OWNED_VOICE_ASSETS, config2.desktopVersion)))
55937
+ return { status: "unsupported", dispose() {
55938
+ } };
55939
+ const importModule = options.importModule ?? ((url2) => import(url2));
55940
+ let disposed = false;
55941
+ let timer;
55942
+ let restore;
55943
+ let module;
55944
+ const started = Date.now();
55945
+ const handle = {
55946
+ status: "pending",
55947
+ dispose() {
55948
+ disposed = true;
55949
+ if (timer !== void 0) target2.clearTimeout(timer);
55950
+ restore?.();
55951
+ if (target2[HOOK_GLOBAL4] === handle) Reflect.deleteProperty(target2, HOOK_GLOBAL4);
55952
+ }
55953
+ };
55954
+ target2[HOOK_GLOBAL4] = handle;
55955
+ const attempt = async () => {
55956
+ if (disposed) return;
55957
+ try {
55958
+ const names = loadedAssetNames(target2.document, target2.performance);
55959
+ const wrapRuntime = (services) => {
55960
+ const original = services.realtimeVoiceRuntime;
55961
+ if (typeof original !== "function" && !isRecord17(original)) return false;
55962
+ const start = Reflect.get(original, "requestRealtimeStart");
55963
+ if (typeof start !== "function") return false;
55964
+ const invoke2 = (...startArgs) => Reflect.apply(start, original, startArgs);
55965
+ const gatewayStarter = wrapGatewayVoiceStarter(
55966
+ invoke2,
55967
+ hashedGatewayStarterOptions(
55968
+ target2,
55969
+ () => cpaLiveVoicePreferenceAllowsInstall(target2),
55970
+ () => chatLiveVoicePreferenceAllowsOverride(target2),
55971
+ () => isExternalHarnessComposer(target2)
55972
+ )
55973
+ );
55974
+ const launch = (...args) => {
55975
+ let request = args[0];
55976
+ const chatStart = startNativeChatVoiceForRequest(request, target2);
55977
+ if (chatStart) return chatStart;
55978
+ const ownedChatUnavailable = ownedChatgptChatStartUnavailable(request, target2);
55979
+ if (ownedChatUnavailable) {
55980
+ rememberVoiceProductExperience(request, target2);
55981
+ throw new Error(ownedChatUnavailable);
55982
+ }
55983
+ try {
55984
+ request = routeExternalVoiceLaunch(request, target2.__codexhostHostRoutingV1, target2);
55985
+ } catch {
55986
+ }
55987
+ if (hashed && isRecord17(request) && request.productExperience === "codex" && request.source === "composer_button_new_thread") {
55988
+ request = { ...request, productExperience: "work" };
55989
+ }
55990
+ const experience = isRecord17(request) && typeof request.productExperience === "string" ? request.productExperience : "unset";
55991
+ if (hashed && gatewayVoiceStartRequest(
55992
+ request,
55993
+ cpaLiveVoicePreferenceAllowsInstall(target2),
55994
+ chatLiveVoicePreferenceAllowsOverride(target2),
55995
+ isExternalHarnessComposer(target2)
55996
+ )) {
55997
+ return gatewayStarter.start(request, ...args.slice(1)).then(
55998
+ (value) => {
55999
+ chatVoiceDebug("realtime-start", {
56000
+ productExperience: experience,
56001
+ outcome: "ok"
56002
+ });
56003
+ return value;
56004
+ },
56005
+ (error51) => {
56006
+ chatVoiceDebug("realtime-start", {
56007
+ productExperience: experience,
56008
+ outcome: "rejected"
56009
+ });
56010
+ throw error51;
56011
+ }
56012
+ );
56013
+ }
56014
+ try {
56015
+ const result = invoke2(request, ...args.slice(1));
56016
+ if (result && typeof result.then === "function") {
56017
+ return result.then(
56018
+ (value) => {
56019
+ chatVoiceDebug("realtime-start", {
56020
+ productExperience: experience,
56021
+ outcome: "ok"
56022
+ });
56023
+ return value;
56024
+ },
56025
+ (error51) => {
56026
+ chatVoiceDebug("realtime-start", {
56027
+ productExperience: experience,
56028
+ outcome: "rejected"
56029
+ });
56030
+ throw error51;
56031
+ }
56032
+ );
56033
+ }
56034
+ chatVoiceDebug("realtime-start", { productExperience: experience, outcome: "sync" });
56035
+ return result;
56036
+ } catch (error51) {
56037
+ chatVoiceDebug("realtime-start", { productExperience: experience, outcome: "throw" });
56038
+ throw error51;
56039
+ }
56040
+ };
56041
+ const wrapped = new Proxy(original, {
56042
+ get(service, key, receiver) {
56043
+ if (key === "requestRealtimeStart") return launch;
56044
+ if (key === "cancelRealtimeSessionStart") {
56045
+ const cancel = Reflect.get(service, key, receiver);
56046
+ if (typeof cancel === "function")
56047
+ return (...args) => {
56048
+ gatewayStarter.cancel();
56049
+ return Reflect.apply(cancel, original, args);
56050
+ };
56051
+ }
56052
+ return Reflect.get(service, key, receiver);
56053
+ }
56054
+ });
56055
+ if (!Reflect.set(services, "realtimeVoiceRuntime", wrapped)) return false;
56056
+ restore = () => {
56057
+ gatewayStarter.cancel();
56058
+ if (services.realtimeVoiceRuntime === wrapped) services.realtimeVoiceRuntime = original;
56059
+ };
56060
+ handle.status = "active";
56061
+ return true;
56062
+ };
56063
+ if (hashed) {
56064
+ if (names.some((name) => name.includes(HASHED_WEBPACK_VOICE_RUNTIME_ASSET))) {
56065
+ const req = await resolveHashedWebpackRequire(importModule);
56066
+ if (disposed) return;
56067
+ let ga;
56068
+ try {
56069
+ ga = req?.("GaA7");
56070
+ } catch {
56071
+ ga = void 0;
56072
+ }
56073
+ const services = hashedAppServices(ga);
56074
+ if (services && wrapRuntime(services)) return;
56075
+ }
56076
+ } else {
56077
+ const assets = selectVoiceAssets(
56078
+ LAUNCH_ASSETS,
56079
+ names,
56080
+ config2.desktopVersion,
56081
+ config2.desktopPlatform
56082
+ );
56083
+ if (assets) {
56084
+ module ??= await importModule(`app://-/assets/${assets.shared}`);
56085
+ if (disposed) return;
56086
+ const services = module?.[assets.services];
56087
+ if (isRecord17(services) && wrapRuntime(services)) return;
56088
+ }
56089
+ }
56090
+ } catch {
56091
+ handle.status = "unsupported";
56092
+ return;
56093
+ }
56094
+ if (Date.now() - started >= 6e4) {
56095
+ handle.status = "unsupported";
56096
+ return;
56097
+ }
56098
+ timer = target2.setTimeout(() => void attempt(), 250);
56099
+ };
56100
+ void attempt();
56101
+ return handle;
56102
+ }
56103
+
55817
56104
  // src/renderer-voice-settings-availability.ts
55818
- var record19 = (value) => value !== null && typeof value === "object";
56105
+ var record22 = (value) => value !== null && typeof value === "object";
55819
56106
  function voiceSettingsSurface(doc, page, appScope) {
55820
56107
  const pages = /* @__PURE__ */ new Set();
55821
56108
  const fibers = /* @__PURE__ */ new Set();
@@ -55838,8 +56125,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55838
56125
  const scopes = /* @__PURE__ */ new Map();
55839
56126
  for (const fiber of fibers)
55840
56127
  for (const hook of hooks2(fiber)) {
55841
- const scope2 = record19(hook.memoizedState) ? hook.memoizedState.current : void 0;
55842
- if (record19(scope2) && scope2.scope === appScope && record19(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(appScope.id) === scope2.node && typeof scope2.get === "function")
56128
+ const scope2 = record22(hook.memoizedState) ? hook.memoizedState.current : void 0;
56129
+ if (record22(scope2) && scope2.scope === appScope && record22(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(appScope.id) === scope2.node && typeof scope2.get === "function")
55843
56130
  scopes.set(scope2.node, scope2);
55844
56131
  }
55845
56132
  const scope = [...scopes.values()][0];
@@ -55883,7 +56170,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55883
56170
  for (const fiber of currentFibers())
55884
56171
  for (const hook2 of hooks2(fiber)) {
55885
56172
  const [subscriber2, deps] = Array.isArray(hook2.memoizedState) ? hook2.memoizedState : [];
55886
- if (!record19(subscriber2) || typeof subscriber2.getSnapshot !== "function" || !Array.isArray(deps) || deps.length !== 2 || deps[0] !== store || !record19(deps[1]) || typeof deps[1].read !== "function")
56173
+ if (!record22(subscriber2) || typeof subscriber2.getSnapshot !== "function" || !Array.isArray(deps) || deps.length !== 2 || deps[0] !== store || !record22(deps[1]) || typeof deps[1].read !== "function")
55887
56174
  continue;
55888
56175
  const atom2 = deps[1];
55889
56176
  if (availability(store, atom2, voice, gate) === true)
@@ -55896,7 +56183,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55896
56183
  const instance = hook.next?.queue;
55897
56184
  const effect = hook.next?.next?.memoizedState;
55898
56185
  const native = store.get(atom);
55899
- if (!instance || typeof instance.getSnapshot !== "function" || !record19(effect) || !Array.isArray(effect.deps) || effect.deps.length !== 1 || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || subscriber.getSnapshot() !== native || instance.getSnapshot() !== native || subscriber.createRender?.() != null)
56186
+ if (!instance || typeof instance.getSnapshot !== "function" || !record22(effect) || !Array.isArray(effect.deps) || effect.deps.length !== 1 || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || subscriber.getSnapshot() !== native || instance.getSnapshot() !== native || subscriber.createRender?.() != null)
55900
56187
  throw new Error("Unsupported Settings availability subscription");
55901
56188
  for (const [object6, key] of [
55902
56189
  [store, "sub"],
@@ -55955,7 +56242,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55955
56242
  }
55956
56243
 
55957
56244
  // src/renderer-dictation-settings.ts
55958
- var record20 = (value) => value !== null && typeof value === "object";
56245
+ var record23 = (value) => value !== null && typeof value === "object";
55959
56246
  var mode = (value) => value === null || value === "os-global" || value === "app";
55960
56247
  function replayDictationSettingsMode(store, atom, capabilities, gate) {
55961
56248
  try {
@@ -55998,7 +56285,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55998
56285
  function bindDictationSettingsMode(currentFibers, store, atom, capabilities, gate, allowed) {
55999
56286
  const readers = () => [...currentFibers()].flatMap(hooks2).filter((hook) => {
56000
56287
  const [subscriber, deps] = Array.isArray(hook.memoizedState) ? hook.memoizedState : [];
56001
- return record20(subscriber) && typeof subscriber.getSnapshot === "function" && Array.isArray(deps) && deps.length === 2 && deps[0] === store && deps[1] === atom;
56288
+ return record23(subscriber) && typeof subscriber.getSnapshot === "function" && Array.isArray(deps) && deps.length === 2 && deps[0] === store && deps[1] === atom;
56002
56289
  });
56003
56290
  const subscriptions = readers();
56004
56291
  if (!subscriptions.length || replayDictationSettingsMode(store, atom, capabilities, gate) === void 0)
@@ -56011,7 +56298,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56011
56298
  const instance = hook.next?.queue;
56012
56299
  const effect = hook.next?.next?.memoizedState;
56013
56300
  const native = store.get(atom);
56014
- if (!instance || typeof instance.getSnapshot !== "function" || !record20(effect) || !Array.isArray(effect.deps) || effect.deps.length !== 1 || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || subscriber.getSnapshot() !== native || instance.getSnapshot() !== native || subscriber.createRender?.() != null)
56301
+ if (!instance || typeof instance.getSnapshot !== "function" || !record23(effect) || !Array.isArray(effect.deps) || effect.deps.length !== 1 || effect.deps[0] !== subscriber.subscribe || typeof effect.create !== "function" || subscriber.getSnapshot() !== native || instance.getSnapshot() !== native || subscriber.createRender?.() != null)
56015
56302
  throw new Error("Unsupported Settings dictation mode subscription");
56016
56303
  for (const [object6, key] of [
56017
56304
  [store, "sub"],
@@ -56083,8 +56370,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56083
56370
  var MESSAGE_ID = "settings.general.realtimeVoice.unavailable.description";
56084
56371
  var LABEL = "Voice settings unavailable with this provider";
56085
56372
  var DESCRIPTION = "Your account allows voice chat. These Desktop settings require the default inference provider. Start ChatGPT Chat voice from the Chat composer.";
56086
- var record21 = (value) => value !== null && typeof value === "object";
56087
- var settled = (value, isCapable) => record21(value) && value.isLoading === false && value.isError === false && value.isCapable === isCapable;
56373
+ var record24 = (value) => value !== null && typeof value === "object";
56374
+ var settled = (value, isCapable) => record24(value) && value.isLoading === false && value.isError === false && value.isCapable === isCapable;
56088
56375
  function realtimeAtoms(scope, modules) {
56089
56376
  const atom = modules.capability.resolve(scope.node, scope.chain, { name: "voice.realtime" }).resolve(scope.node, scope.chain);
56090
56377
  return {
@@ -56095,7 +56382,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56095
56382
  function providerBlocksVoiceSettings(scope, modules) {
56096
56383
  try {
56097
56384
  const access = scope.get(modules.access);
56098
- if (!record21(access) || access.status !== "allowed" || !settled(scope.get(modules.capability, { name: "voice" }), true) || !settled(scope.get(modules.capability, { name: "voice.realtime" }), false))
56385
+ if (!record24(access) || access.status !== "allowed" || !settled(scope.get(modules.capability, { name: "voice" }), true) || !settled(scope.get(modules.capability, { name: "voice.realtime" }), false))
56099
56386
  return false;
56100
56387
  const { atom, gate } = realtimeAtoms(scope, modules);
56101
56388
  return replayVoiceCapability(scope.node.store, atom, gate)?.isCapable === true;
@@ -56113,10 +56400,10 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56113
56400
  );
56114
56401
  if (!ancestors2.some((fiber) => fiber.type === modules.page)) continue;
56115
56402
  const owner = ancestors2.find(
56116
- ({ memoizedProps: props2 }) => record21(props2) && record21(props2.description) && record21(props2.description.props) && props2.description.props.id === MESSAGE_ID && props2.control === null
56403
+ ({ memoizedProps: props2 }) => record24(props2) && record24(props2.description) && record24(props2.description.props) && props2.description.props.id === MESSAGE_ID && props2.control === null
56117
56404
  );
56118
56405
  const props = owner?.memoizedProps;
56119
- if (!record21(props) || !record21(props.description) || !record21(props.description.props) || !record21(props.label) || !record21(props.label.props) || element.textContent !== props.description.props.defaultMessage)
56406
+ if (!record24(props) || !record24(props.description) || !record24(props.description.props) || !record24(props.label) || !record24(props.label.props) || element.textContent !== props.description.props.defaultMessage)
56120
56407
  continue;
56121
56408
  const labelText = props.label.props.defaultMessage;
56122
56409
  if (typeof labelText !== "string") continue;
@@ -56133,10 +56420,10 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56133
56420
  for (const fiber of ancestors2) {
56134
56421
  let hook = fiber.memoizedState;
56135
56422
  const seen = /* @__PURE__ */ new Set();
56136
- while (record21(hook) && seen.size < 4096 && !seen.has(hook)) {
56423
+ while (record24(hook) && seen.size < 4096 && !seen.has(hook)) {
56137
56424
  seen.add(hook);
56138
- const scope2 = record21(hook.memoizedState) ? hook.memoizedState.current : void 0;
56139
- if (record21(scope2) && scope2.scope === modules.appScope && record21(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(modules.appScope.id) === scope2.node && typeof scope2.get === "function")
56425
+ const scope2 = record24(hook.memoizedState) ? hook.memoizedState.current : void 0;
56426
+ if (record24(scope2) && scope2.scope === modules.appScope && record24(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(modules.appScope.id) === scope2.node && typeof scope2.get === "function")
56140
56427
  scopes.set(scope2.node, scope2);
56141
56428
  hook = hook.next;
56142
56429
  }
@@ -56325,7 +56612,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56325
56612
 
56326
56613
  // src/renderer-rpc-steering-queue.ts
56327
56614
  var INTERRUPTED = "Interrupted before the steer was accepted.";
56328
- var record22 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
56615
+ var record25 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
56329
56616
  async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
56330
56617
  const snapshot = Promise.withResolvers();
56331
56618
  let lease;
@@ -56359,7 +56646,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56359
56646
  for (const value of /* @__PURE__ */ new Set([pending2, lease])) dispose(value);
56360
56647
  }
56361
56648
  if (messages.some(
56362
- (message2) => record22(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
56649
+ (message2) => record25(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
56363
56650
  ))
56364
56651
  throw new Error(
56365
56652
  "Resume or remove the other previously paused messages before changing direction"
@@ -56367,23 +56654,23 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56367
56654
  return async (turnId) => {
56368
56655
  await coordinator("removeQueuedMessage", threadId, messageId);
56369
56656
  const state = await manager("getThreadExecutionState", threadId);
56370
- const stillRunning = record22(state) && state.inProgress === true && state.activeTurnId === turnId;
56657
+ const stillRunning = record25(state) && state.inProgress === true && state.activeTurnId === turnId;
56371
56658
  const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
56372
- if (stillRunning || record22(turn) && turn.status === "completed")
56659
+ if (stillRunning || record25(turn) && turn.status === "completed")
56373
56660
  await coordinator("resumeInterruptedQueuedMessages", threadId);
56374
56661
  };
56375
56662
  }
56376
56663
 
56377
56664
  // src/renderer-rpc-steering.ts
56378
- var record23 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
56665
+ var record26 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
56379
56666
  var invoke = (target2, name, ...args) => Reflect.apply(Reflect.get(target2, name), target2, args);
56380
- var running = (state) => record23(state) && (state.inProgress === true || !!state.activeTurnId);
56667
+ var running = (state) => record26(state) && (state.inProgress === true || !!state.activeTurnId);
56381
56668
  var context = (previous, marker) => ({
56382
- ...record23(previous) ? previous : {},
56669
+ ...record26(previous) ? previous : {},
56383
56670
  [THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
56384
56671
  });
56385
56672
  function installRendererRpcSteering(value) {
56386
- if (!record23(value) || typeof value.forHost !== "function") return null;
56673
+ if (!record26(value) || typeof value.forHost !== "function") return null;
56387
56674
  const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
56388
56675
  if (!descriptor?.writable) return null;
56389
56676
  const controller = value;
@@ -56398,7 +56685,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56398
56685
  throw new Error("Steering connection was retired");
56399
56686
  };
56400
56687
  const inspect = async (threadId, input) => {
56401
- const text = Array.isArray(input) ? input.filter(record23).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
56688
+ const text = Array.isArray(input) ? input.filter(record26).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
56402
56689
  current();
56403
56690
  const delivery = await inspectRendererSteeringDelivery(
56404
56691
  (method, params) => {
@@ -56414,19 +56701,19 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56414
56701
  const target2 = async (threadId, messageId, delivery) => {
56415
56702
  const state = await invoke(rpc, "getThreadExecutionState", threadId);
56416
56703
  current();
56417
- if (!record23(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
56704
+ if (!record26(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
56418
56705
  throw new Error("Native steering target or message identity is unavailable");
56419
56706
  return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
56420
56707
  };
56421
56708
  const withoutQueueRow = async (request) => {
56422
- if (!record23(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
56709
+ if (!record26(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
56423
56710
  return request;
56424
56711
  try {
56425
56712
  const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
56426
56713
  current();
56427
56714
  if (!running(state)) return request;
56428
56715
  const message2 = request.message;
56429
- const text = record23(message2) && typeof message2.text === "string" ? message2.text : "";
56716
+ const text = record26(message2) && typeof message2.text === "string" ? message2.text : "";
56430
56717
  const delivery = await inspect(request.conversationId, [{ text }]);
56431
56718
  return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
56432
56719
  } catch {
@@ -56453,7 +56740,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56453
56740
  let messageId;
56454
56741
  let finish;
56455
56742
  const apply = (prepared) => {
56456
- if (!marker || !record23(prepared.steer)) return prepared;
56743
+ if (!marker || !record26(prepared.steer)) return prepared;
56457
56744
  const result2 = {
56458
56745
  ...prepared,
56459
56746
  steer: {
@@ -56462,7 +56749,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56462
56749
  }
56463
56750
  };
56464
56751
  if (marker.delivery !== "newTurn") return result2;
56465
- if (!record23(prepared.start) || !record23(prepared.start.request))
56752
+ if (!record26(prepared.start) || !record26(prepared.start.request))
56466
56753
  throw new Error("Native start preparation is unavailable for steering");
56467
56754
  return {
56468
56755
  ...result2,
@@ -56480,9 +56767,9 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56480
56767
  current();
56481
56768
  const prepared = await callback(...input);
56482
56769
  current();
56483
- if (!record23(prepared)) throw new Error("Native submission preparation is malformed");
56770
+ if (!record26(prepared)) throw new Error("Native submission preparation is malformed");
56484
56771
  if (marker) return apply(prepared);
56485
- if (input[1] !== "steer" || !record23(prepared.steer) || typeof prepared.conversationId !== "string")
56772
+ if (input[1] !== "steer" || !record26(prepared.steer) || typeof prepared.conversationId !== "string")
56486
56773
  return prepared;
56487
56774
  threadId = prepared.conversationId;
56488
56775
  const execution = await invoke(rpc, "getThreadExecutionState", threadId);
@@ -56491,7 +56778,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56491
56778
  const delivery = await inspect(threadId, prepared.steer.input);
56492
56779
  if (delivery === "official") return prepared;
56493
56780
  const restore = prepared.steer.restoreMessage;
56494
- messageId = record23(restore) && typeof restore.id === "string" ? restore.id : void 0;
56781
+ messageId = record26(restore) && typeof restore.id === "string" ? restore.id : void 0;
56495
56782
  const clientId = prepared.steer.clientUserMessageId ?? messageId;
56496
56783
  marker = await target2(threadId, clientId, delivery);
56497
56784
  if (delivery === "activeTurn") return apply(prepared);
@@ -56505,14 +56792,14 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56505
56792
  );
56506
56793
  const start = await callback(input[0], "start");
56507
56794
  current();
56508
- if (!record23(start)) throw new Error("Native start preparation is malformed");
56795
+ if (!record26(start)) throw new Error("Native start preparation is malformed");
56509
56796
  return apply(start);
56510
56797
  };
56511
56798
  const forwarded = [...args];
56512
56799
  forwarded[index] = prepare;
56513
56800
  if (key === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
56514
56801
  const result = await invoke(handle, key, ...forwarded);
56515
- if (finish && record23(result) && result.status === "sent" && typeof result.turnId === "string") {
56802
+ if (finish && record26(result) && result.status === "sent" && typeof result.turnId === "string") {
56516
56803
  await finish(result.turnId).catch(
56517
56804
  () => console.error("codexhost could not reconcile native steering queue")
56518
56805
  );