@karlorz/codexhost-cli-win32-x64 0.16.1-2 → 0.17.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 (40) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.txt +6 -2
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +86 -20
  5. package/app/console-web.js +76 -17
  6. package/app/cpa-live-voice-hook.js +62 -8
  7. package/app/desktop-controller.mjs +107 -31
  8. package/app/host-runtime.mjs +2560 -1634
  9. package/app/plugins/antigravity/plugin.mjs +66 -2
  10. package/app/plugins/claude-code/plugin.mjs +43 -6
  11. package/app/plugins/codebuddy/plugin.mjs +41 -0
  12. package/app/plugins/codex-usage/plugin.mjs +31 -0
  13. package/app/plugins/copilot/plugin.mjs +31 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +40 -5
  15. package/app/plugins/deepseek-harness/plugin.mjs +490 -46
  16. package/app/plugins/devin/assets/icon.svg +1 -0
  17. package/app/plugins/devin/manifest.json +30 -0
  18. package/app/plugins/devin/plugin.mjs +23536 -0
  19. package/app/plugins/enabled.json +2 -0
  20. package/app/plugins/grok/plugin.mjs +1615 -495
  21. package/app/plugins/hermes/plugin.mjs +484 -196
  22. package/app/plugins/kimi-code/plugin.mjs +31 -0
  23. package/app/plugins/kiro-cli/plugin.mjs +31 -0
  24. package/app/plugins/omp/plugin.mjs +31 -0
  25. package/app/plugins/opencode/plugin.mjs +31 -0
  26. package/app/plugins/pi/plugin.mjs +1491 -411
  27. package/app/plugins/qoder/plugin.mjs +9555 -8654
  28. package/app/plugins/qoder-cn/plugin.mjs +9555 -8654
  29. package/app/plugins/qwen-code/assets/icon.svg +1 -0
  30. package/app/plugins/qwen-code/manifest.json +29 -0
  31. package/app/plugins/qwen-code/plugin.mjs +29471 -0
  32. package/app/plugins/workbuddy/plugin.mjs +41 -0
  33. package/app/plugins/zcode/plugin.mjs +31 -0
  34. package/app/renderer-extension.js +966 -233
  35. package/bin/codexhost.exe +0 -0
  36. package/libexec/codexhost-node-repl.exe +0 -0
  37. package/libexec/codexhost-shim.exe +0 -0
  38. package/libexec/codexhost-updater.exe +0 -0
  39. package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
  40. package/package.json +2 -2
@@ -16147,6 +16147,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16147
16147
  return `${HARNESS_COMMAND_MENTION_PATH_PREFIX}${encodeURIComponent(name).replace(/[()]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
16148
16148
  }
16149
16149
 
16150
+ // ../shared-contracts/dist/desktop-attachments.js
16151
+ var ATTACHED_FILES_HEADING = /^\s*# Files mentioned by the user:[ \t]*(?:\r?\n|$)/u;
16152
+ var REQUEST_HEADING = /(?:^|\n)## My request:[ \t]*(?:\r?\n|$)/u;
16153
+ var IMAGE_ATTACHMENT_PATTERN = /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu;
16154
+ var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
16155
+ function desktopImageAttachmentPaths(text) {
16156
+ const end = text.search(REQUEST_HEADING);
16157
+ const context = end < 0 ? text : text.slice(0, end);
16158
+ if (!ATTACHED_FILES_HEADING.test(context))
16159
+ return [];
16160
+ return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
16161
+ }
16162
+
16150
16163
  // ../shared-contracts/dist/remote-runtime.js
16151
16164
  var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
16152
16165
  var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
@@ -16277,6 +16290,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16277
16290
  })
16278
16291
  });
16279
16292
 
16293
+ // ../shared-contracts/dist/background-activity.js
16294
+ var THREAD_ACTIVITY_LIST_METHOD = "codexhost/thread/activity/list";
16295
+ var THREAD_ACTIVITY_READ_METHOD = "codexhost/thread/activity/read";
16296
+ var THREAD_ACTIVITY_STOP_METHOD = "codexhost/thread/activity/stop";
16297
+ var backgroundActivitySchema = external_exports.strictObject({
16298
+ id: external_exports.string().min(1),
16299
+ kind: external_exports.enum(["task", "monitor", "loop", "subagent"]),
16300
+ label: external_exports.string(),
16301
+ status: external_exports.enum(["running", "scheduled", "completed", "failed", "cancelled", "unknown"]),
16302
+ canStop: external_exports.boolean(),
16303
+ /** Existing detached command Item presented by Desktop's native process UI. */
16304
+ commandItemId: hostItemIdSchema.optional(),
16305
+ schedule: external_exports.string().optional(),
16306
+ nextRunAt: external_exports.string().datetime({ offset: true }).optional(),
16307
+ relatedActivityId: external_exports.string().optional(),
16308
+ threadId: hostThreadIdSchema.optional()
16309
+ });
16310
+ var backgroundActivityDetailSchema = external_exports.strictObject({
16311
+ activity: backgroundActivitySchema,
16312
+ output: external_exports.string(),
16313
+ truncated: external_exports.boolean()
16314
+ });
16315
+ var threadActivityParamsSchema = external_exports.strictObject({ threadId: hostThreadIdSchema });
16316
+ var threadActivityItemParamsSchema = threadActivityParamsSchema.extend({
16317
+ activityId: external_exports.string().min(1)
16318
+ });
16319
+ var threadActivityListResultSchema = external_exports.strictObject({
16320
+ supported: external_exports.boolean(),
16321
+ activities: external_exports.array(backgroundActivitySchema)
16322
+ });
16323
+ var threadActivityStopResultSchema = external_exports.strictObject({
16324
+ outcome: external_exports.enum(["stopped", "alreadyStopped", "notFound"])
16325
+ });
16326
+
16280
16327
  // ../shared-contracts/dist/index.js
16281
16328
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
16282
16329
 
@@ -16526,17 +16573,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16526
16573
  }
16527
16574
 
16528
16575
  // src/renderer-native-chat-voice-assets.ts
16529
- var NATIVE_CHAT_VOICE_VERSION = "26.1023.51421";
16530
- var NATIVE_CHAT_INITIAL_ASSET = "app-initial-bc8256c3cccb.js";
16531
- var START_ASSET = "start-voice-a0564cefdc95.js";
16576
+ var NATIVE_CHAT_VOICE_VERSION = "26.1027.61615";
16577
+ var NATIVE_CHAT_INITIAL_ASSET = "app-initial-18b189e867e7.js";
16578
+ var START_ASSET = "start-voice-221a396d38a5.js";
16532
16579
  var NATIVE_CHAT_VOICE_ASSETS = [
16533
16580
  {
16534
16581
  platform: "darwin",
16535
16582
  version: NATIVE_CHAT_VOICE_VERSION,
16536
16583
  initial: NATIVE_CHAT_INITIAL_ASSET,
16584
+ shared: "app-shared-601019a330d7.js",
16585
+ primary: "app-primary-75d53eef2374.js",
16586
+ start: START_ASSET,
16587
+ prewarm: "voice-prewarm-a7cd5160219e.js",
16588
+ settings: "voice-settings-320cf1212f2c.js"
16589
+ },
16590
+ {
16591
+ platform: "darwin",
16592
+ version: "26.1027.30824",
16593
+ initial: "app-initial-60f141238751.js",
16594
+ shared: "app-shared-7815d5a1a42a.js",
16595
+ primary: "app-primary-95a0e6d83f1e.js",
16596
+ start: "start-voice-4c77215aa289.js",
16597
+ prewarm: "voice-prewarm-e49220ad61bd.js"
16598
+ },
16599
+ {
16600
+ platform: "darwin",
16601
+ version: "26.1023.51421",
16602
+ initial: "app-initial-bc8256c3cccb.js",
16537
16603
  shared: "app-shared-e9f258fd3588.js",
16538
16604
  primary: "app-primary-b7f335b763ca.js",
16539
- start: START_ASSET,
16605
+ start: "start-voice-a0564cefdc95.js",
16540
16606
  prewarm: "voice-prewarm-53aefded152c.js",
16541
16607
  settings: "voice-settings-1a9f68eb7ae8.js"
16542
16608
  },
@@ -16584,15 +16650,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16584
16650
  )
16585
16651
  );
16586
16652
  if (!sharedModule || !initialModule || !startModule || !prewarm) throw new Error();
16587
- const latest = assets.version === NATIVE_CHAT_VOICE_VERSION;
16653
+ const modern = assets.version === NATIVE_CHAT_VOICE_VERSION;
16654
+ const newest = modern || assets.version === "26.1027.30824";
16655
+ const latest = newest || assets.version === "26.1023.51421";
16588
16656
  const current = latest || assets.version === "26.1021.31345";
16589
- const initialize = latest ? primary?.gm : current ? primary?.um : initialModule.oT;
16657
+ const initialize = modern ? primary?.Qp : newest ? primary?.Yp : latest ? primary?.gm : current ? primary?.um : initialModule.oT;
16590
16658
  const start = current && !latest ? { t: startModule.r, n: startModule.i } : startModule;
16591
- if (typeof start.t !== "function" || typeof start.n !== "function" || typeof initialize !== "function" || typeof (latest ? initialModule["s$t"] : current ? initialModule.qXt : initialModule.SPn) !== "function" || typeof (latest ? sharedModule.OHt : current ? sharedModule.XVt : sharedModule.FBt) !== "function" || typeof (latest ? sharedModule.wPt : current ? sharedModule.KNt : sharedModule.PNt) !== "function" || typeof prewarm.VoiceInstantConnectCacheController !== "function")
16659
+ if (typeof start.t !== "function" || typeof start.n !== "function" || typeof initialize !== "function" || typeof (modern ? initialModule.etn : newest ? initialModule.Xen : latest ? initialModule["s$t"] : current ? initialModule.qXt : initialModule.SPn) !== "function" || typeof (newest ? sharedModule.pWt : latest ? sharedModule.OHt : current ? sharedModule.XVt : sharedModule.FBt) !== "function" || typeof (newest ? sharedModule.GFt : latest ? sharedModule.wPt : current ? sharedModule.KNt : sharedModule.PNt) !== "function" || typeof prewarm.VoiceInstantConnectCacheController !== "function")
16592
16660
  throw new Error();
16593
16661
  initialize();
16594
16662
  start.t();
16595
- const initial = latest ? {
16663
+ const initial = modern ? {
16664
+ MOr: initialModule.p5n,
16665
+ CDr: initialModule.w6n,
16666
+ B1n: initialModule._On,
16667
+ SPn: initialModule.etn,
16668
+ oT: primary?.Qp,
16669
+ aT: primary?.Zp,
16670
+ Ycr: initialModule.ofr,
16671
+ Nir: initialModule.yEn,
16672
+ n0n: initialModule.FOn,
16673
+ Y1n: initialModule.JOn,
16674
+ HJt: initialModule.Z6
16675
+ } : newest ? {
16676
+ MOr: initialModule.l5n,
16677
+ CDr: initialModule.b6n,
16678
+ B1n: initialModule.pOn,
16679
+ SPn: initialModule.Xen,
16680
+ oT: primary?.Yp,
16681
+ aT: primary?.Jp,
16682
+ Ycr: initialModule.nfr,
16683
+ Nir: initialModule.hEn,
16684
+ n0n: initialModule.jOn,
16685
+ Y1n: initialModule.wOn,
16686
+ HJt: initialModule.J6
16687
+ } : latest ? {
16596
16688
  MOr: initialModule.x1n,
16597
16689
  CDr: initialModule.MQn,
16598
16690
  B1n: initialModule.Opn,
@@ -16617,7 +16709,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16617
16709
  Y1n: initialModule.fdn,
16618
16710
  HJt: initialModule.R2
16619
16711
  } : initialModule;
16620
- const shared = latest ? { Qst: sharedModule.uct, FBt: sharedModule.OHt, PNt: sharedModule.wPt, Vot: sharedModule.ast } : current ? {
16712
+ const shared = newest ? { Qst: sharedModule.klt, FBt: sharedModule.pWt, PNt: sharedModule.GFt, Vot: sharedModule._ct } : latest ? {
16713
+ Qst: sharedModule.uct,
16714
+ FBt: sharedModule.OHt,
16715
+ PNt: sharedModule.wPt,
16716
+ Vot: sharedModule.ast
16717
+ } : current ? {
16621
16718
  Qst: sharedModule.Bst,
16622
16719
  FBt: sharedModule.XVt,
16623
16720
  PNt: sharedModule.KNt,
@@ -16802,12 +16899,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16802
16899
  if (!entry)
16803
16900
  return;
16804
16901
  entry.update((current) => {
16902
+ const { original } = entry;
16903
+ if (!original)
16904
+ return current;
16805
16905
  const settings = current.modelSettings;
16806
16906
  return settings?.model === entry.model && current.modelSettingsPersistAsDefault === false ? {
16807
16907
  ...current,
16808
- modelSettings: entry.original.modelSettings,
16809
- modelSettingsPersistAsDefault: entry.original.modelSettingsPersistAsDefault,
16810
- isManuallyChanged: entry.original.isManuallyChanged
16908
+ modelSettings: original.modelSettings,
16909
+ modelSettingsPersistAsDefault: original.modelSettingsPersistAsDefault,
16910
+ isManuallyChanged: original.isManuallyChanged
16811
16911
  } : current;
16812
16912
  });
16813
16913
  captured.delete(key);
@@ -16816,15 +16916,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16816
16916
  has(key) {
16817
16917
  return captured.has(key);
16818
16918
  },
16919
+ /** The carrier last written to this draft, or null while it keeps its native setting. */
16920
+ model(key) {
16921
+ return captured.get(key)?.model ?? null;
16922
+ },
16819
16923
  apply(key, binding, model2) {
16820
16924
  if (model2 === null) {
16821
16925
  restore(key);
16822
16926
  return;
16823
16927
  }
16824
16928
  const { update, usesAccountPreferences } = binding;
16929
+ const previous = captured.get(key);
16930
+ const entry = { update, model: model2 };
16825
16931
  update((current) => {
16826
- const previous = captured.get(key);
16827
- captured.set(key, { update, original: previous?.original ?? current, model: model2 });
16932
+ entry.original ??= previous?.original ?? current;
16828
16933
  const settings = current.modelSettings;
16829
16934
  if (settings?.model === model2 && settings.usesAccountPreferences === usesAccountPreferences && current.modelSettingsPersistAsDefault === false)
16830
16935
  return current;
@@ -16841,6 +16946,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16841
16946
  }
16842
16947
  };
16843
16948
  });
16949
+ captured.set(key, entry);
16844
16950
  },
16845
16951
  dispose() {
16846
16952
  for (const key of captured.keys())
@@ -16915,14 +17021,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16915
17021
 
16916
17022
  // ../desktop-control/dist/renderer-host-discovery.js
16917
17023
  function requestManagerFromHookState(value, hostId2) {
16918
- const record15 = (candidate) => typeof candidate === "object" && candidate !== null;
17024
+ const record16 = (candidate) => typeof candidate === "object" && candidate !== null;
16919
17025
  const manager = (candidate) => {
16920
- if (!record15(candidate) || !record15(candidate.requestClient) || !record15(candidate.prewarmedThreadManager))
17026
+ if (!record16(candidate) || !record16(candidate.requestClient) || !record16(candidate.prewarmedThreadManager))
16921
17027
  return null;
16922
17028
  const bridge = candidate.requestClient;
16923
17029
  return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
16924
17030
  };
16925
- if (!record15(value))
17031
+ if (!record16(value))
16926
17032
  return null;
16927
17033
  const direct = manager(value) ?? manager(value.manager);
16928
17034
  if (direct)
@@ -16985,18 +17091,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16985
17091
 
16986
17092
  // ../desktop-control/dist/renderer-host-rpc-discovery.js
16987
17093
  function findRendererHostRpcFamily(store) {
16988
- const record15 = (value) => typeof value === "object" && value !== null;
17094
+ const record16 = (value) => typeof value === "object" && value !== null;
16989
17095
  const families = /* @__PURE__ */ new Set();
16990
17096
  for (const [definition, members] of store.familyBindings) {
16991
- if (!record15(definition) || definition.kind !== "signal-family")
17097
+ if (!record16(definition) || definition.kind !== "signal-family")
16992
17098
  continue;
16993
- if (!record15(members) || typeof members.get !== "function")
17099
+ if (!record16(members) || typeof members.get !== "function")
16994
17100
  continue;
16995
17101
  for (const [hostId2, member] of members) {
16996
- if (typeof hostId2 !== "string" || !record15(member))
17102
+ if (typeof hostId2 !== "string" || !record16(member))
16997
17103
  continue;
16998
17104
  const signal = member.value;
16999
- if (!record15(signal) || typeof signal.get !== "function")
17105
+ if (!record16(signal) || typeof signal.get !== "function")
17000
17106
  continue;
17001
17107
  let value;
17002
17108
  try {
@@ -17004,7 +17110,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17004
17110
  } catch {
17005
17111
  continue;
17006
17112
  }
17007
- if (record15(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record15(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
17113
+ if (record16(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record16(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
17008
17114
  families.add(members);
17009
17115
  break;
17010
17116
  }
@@ -17015,9 +17121,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17015
17121
  return { store, family: families.values().next().value };
17016
17122
  }
17017
17123
  function resolveRendererHostRpc(discovery, hostId2) {
17018
- const record15 = (value2) => typeof value2 === "object" && value2 !== null;
17124
+ const record16 = (value2) => typeof value2 === "object" && value2 !== null;
17019
17125
  const signal = discovery.family.get(hostId2)?.value;
17020
- if (!record15(signal) || typeof signal.get !== "function")
17126
+ if (!record16(signal) || typeof signal.get !== "function")
17021
17127
  return null;
17022
17128
  let value;
17023
17129
  try {
@@ -17025,10 +17131,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17025
17131
  } catch {
17026
17132
  return null;
17027
17133
  }
17028
- if (!record15(value) || value.status !== "ready" || !record15(value.client) || value.client.hostId !== hostId2)
17134
+ if (!record16(value) || value.status !== "ready" || !record16(value.client) || value.client.hostId !== hostId2)
17029
17135
  return null;
17030
17136
  const rpc = value.client.rpc;
17031
- return typeof rpc === "function" || record15(rpc) ? rpc : null;
17137
+ return typeof rpc === "function" || record16(rpc) ? rpc : null;
17032
17138
  }
17033
17139
 
17034
17140
  // ../desktop-control/dist/renderer-schedule-workspace-rpc.js
@@ -18140,10 +18246,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18140
18246
  }
18141
18247
 
18142
18248
  // src/renderer-client-owned-voice.ts
18143
- var CLIENT_OWNED_VOICE_VERSION = "26.1027.30824";
18144
- var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-60f141238751.js";
18145
- var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-7815d5a1a42a.js";
18146
- var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-d9d400e751cd.js";
18249
+ var CLIENT_OWNED_VOICE_VERSION = "26.1027.61615";
18250
+ var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-18b189e867e7.js";
18251
+ var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-601019a330d7.js";
18252
+ var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-920d05377bbe.js";
18147
18253
  var CLIENT_OWNED_VOICE_ASSETS = [
18148
18254
  {
18149
18255
  platform: "darwin",
@@ -18151,6 +18257,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18151
18257
  initial: CLIENT_OWNED_VOICE_INITIAL_ASSET,
18152
18258
  shared: CLIENT_OWNED_VOICE_SHARED_ASSET,
18153
18259
  overlay: CLIENT_OWNED_VOICE_OVERLAY_ASSET,
18260
+ init: "Adr",
18261
+ fetch: "Odr",
18262
+ fetchFrom: "initial",
18263
+ bridge: "LRt",
18264
+ services: "Vct",
18265
+ responseError: "Pdr",
18266
+ responseErrorFrom: "initial",
18267
+ capabilityInit: "Ler",
18268
+ capabilityFamily: "Ier",
18269
+ inferenceGateFamily: "Vfr"
18270
+ },
18271
+ {
18272
+ platform: "darwin",
18273
+ version: "26.1027.30824",
18274
+ initial: "app-initial-60f141238751.js",
18275
+ shared: "app-shared-7815d5a1a42a.js",
18276
+ overlay: "avatar-overlay-native-page-d9d400e751cd.js",
18154
18277
  init: "Edr",
18155
18278
  fetch: "wdr",
18156
18279
  fetchFrom: "initial",
@@ -18293,11 +18416,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18293
18416
  function visibleWorkComposer(owner) {
18294
18417
  const document2 = owner.document;
18295
18418
  if (!document2?.querySelectorAll) return false;
18296
- const visible = (element) => {
18419
+ const visible2 = (element) => {
18297
18420
  const box = element.getBoundingClientRect?.() ?? { width: 0 };
18298
18421
  return box.width > 0 && !element.closest?.("[hidden], [inert]");
18299
18422
  };
18300
- return [...document2.querySelectorAll("[data-codex-composer-root]")].some(visible) && ![...document2.querySelectorAll("[data-chatgpt-composer]")].some(visible);
18423
+ return [...document2.querySelectorAll("[data-codex-composer-root]")].some(visible2) && ![...document2.querySelectorAll("[data-chatgpt-composer]")].some(visible2);
18301
18424
  }
18302
18425
  function selectedWorkTab(owner) {
18303
18426
  const document2 = owner.document;
@@ -18519,6 +18642,546 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18519
18642
  return handle;
18520
18643
  }
18521
18644
 
18645
+ // src/renderer-request-sender.ts
18646
+ var RendererMethodUnavailableError = class extends Error {
18647
+ constructor(method, cause) {
18648
+ super(`${method} is unsupported on this Host connection`, { cause });
18649
+ this.method = method;
18650
+ this.name = "RendererMethodUnavailableError";
18651
+ }
18652
+ method;
18653
+ code = -32601;
18654
+ };
18655
+ function isUnsupportedMethod(error51, method) {
18656
+ if (typeof error51 !== "object" || error51 === null) return false;
18657
+ const code = "code" in error51 ? error51.code : void 0;
18658
+ const message2 = "message" in error51 ? error51.message : void 0;
18659
+ return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
18660
+ }
18661
+ function createRendererRequestSender(send) {
18662
+ const unsupported = /* @__PURE__ */ new Map();
18663
+ return async (method, params, options) => {
18664
+ const known = unsupported.get(method);
18665
+ if (known) throw known;
18666
+ try {
18667
+ return await (options === void 0 ? send(method, params) : send(method, params, options));
18668
+ } catch (error51) {
18669
+ if (!method.startsWith("codexhost/") || !isUnsupportedMethod(error51, method)) throw error51;
18670
+ const unavailable = new RendererMethodUnavailableError(method, error51);
18671
+ unsupported.set(method, unavailable);
18672
+ throw unavailable;
18673
+ }
18674
+ };
18675
+ }
18676
+
18677
+ // src/renderer-activity-navigation.ts
18678
+ var record6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
18679
+ function openRendererActivityChild(owner, child) {
18680
+ if (!owner.composer.isConnected || child.kind !== "subagent" || !child.threadId)
18681
+ throw Error("Native child conversation is unavailable");
18682
+ const callbacks = /* @__PURE__ */ new Set();
18683
+ const seen = /* @__PURE__ */ new Set();
18684
+ const anchors = [owner.composer, ...owner.composer.querySelectorAll("[contenteditable]")];
18685
+ for (const anchor of anchors) {
18686
+ const keys = Object.getOwnPropertyNames(anchor).filter(
18687
+ (key2) => key2.startsWith("__reactFiber$")
18688
+ );
18689
+ const key = keys[0];
18690
+ if (keys.length !== 1 || !key) continue;
18691
+ const first = Object.getOwnPropertyDescriptor(anchor, key)?.value;
18692
+ for (const fiber of committedReactAncestors(first)) {
18693
+ if (seen.has(fiber)) break;
18694
+ seen.add(fiber);
18695
+ const props = fiber.memoizedProps;
18696
+ if (!record6(props) || typeof props.onOpenBackgroundAgent !== "function") continue;
18697
+ if (typeof props.hostId !== "string" || typeof props.conversationId !== "string") continue;
18698
+ if (props.hostId !== owner.hostId || props.conversationId !== owner.threadId)
18699
+ throw Error("Native child navigation belongs to another chat or Host");
18700
+ callbacks.add(props.onOpenBackgroundAgent);
18701
+ }
18702
+ }
18703
+ const callback = callbacks.values().next().value;
18704
+ if (callbacks.size !== 1 || !callback)
18705
+ throw Error("Native child navigation is unavailable or ambiguous");
18706
+ callback({ conversationId: child.threadId, displayName: child.label, canInteract: false });
18707
+ }
18708
+
18709
+ // src/renderer-activity-detail.ts
18710
+ function appendActivityOutput(parent, detail, expanded, onExpanded) {
18711
+ const document2 = parent.ownerDocument;
18712
+ if (detail.activity.kind !== "loop") {
18713
+ const output = document2.createElement("pre");
18714
+ output.className = "activity-process-output";
18715
+ output.textContent = detail.output || "No native output available yet.";
18716
+ parent.append(output);
18717
+ return;
18718
+ }
18719
+ const prompt = detail.output || "No native prompt available yet.";
18720
+ const firstBreak = /\r\n|[\r\n]/.exec(prompt);
18721
+ const title = firstBreak ? prompt.slice(0, firstBreak.index) : prompt;
18722
+ const instructions = firstBreak ? prompt.slice(firstBreak.index + firstBreak[0].length) : "";
18723
+ const heading = document2.createElement("h4");
18724
+ heading.className = "activity-prompt-title text-sm font-medium";
18725
+ heading.textContent = title;
18726
+ parent.append(heading);
18727
+ if (!instructions) return;
18728
+ const disclosure = document2.createElement("details");
18729
+ disclosure.open = expanded;
18730
+ const summary = document2.createElement("summary");
18731
+ summary.className = "text-sm text-secondary";
18732
+ summary.textContent = "Schedule instructions";
18733
+ const body = document2.createElement("div");
18734
+ body.className = "activity-prompt-instructions text-sm";
18735
+ body.textContent = instructions;
18736
+ disclosure.append(summary, body);
18737
+ disclosure.addEventListener("toggle", () => {
18738
+ if (disclosure.isConnected) onExpanded(disclosure.open);
18739
+ });
18740
+ parent.append(disclosure);
18741
+ }
18742
+
18743
+ // src/renderer-activity-section.ts
18744
+ var PANEL = "[data-summary-panel-variant]";
18745
+ var OWNED = "[data-codexhost-background-activity]";
18746
+ function visible(window2, node) {
18747
+ if (!node.isConnected || node.getClientRects().length === 0) return false;
18748
+ for (let ancestor = node; ancestor; ancestor = ancestor.parentElement) {
18749
+ const style = window2.getComputedStyle(ancestor);
18750
+ if (ancestor.hidden || style.display === "none" || style.visibility === "hidden") return false;
18751
+ }
18752
+ return true;
18753
+ }
18754
+ function activitySectionTarget(window2, composer, previous) {
18755
+ const viewport = composer.closest("[data-app-shell-main-content-layout]");
18756
+ const workspace = viewport?.parentElement;
18757
+ if (!composer.isConnected) return { target: null, reason: "detached-composer" };
18758
+ if (!workspace) return { target: null, reason: "missing-workspace" };
18759
+ const roots = Array.from(workspace.querySelectorAll(PANEL)).filter(
18760
+ (node) => node.classList.contains("group/summary-panel") && visible(window2, node)
18761
+ );
18762
+ if (roots.length !== 1)
18763
+ return { target: null, reason: roots.length ? "ambiguous-panel" : "missing-panel" };
18764
+ const root = roots[0];
18765
+ if (!root) return { target: null, reason: "missing-panel" };
18766
+ const nativeSections = Array.from(root.querySelectorAll("section")).filter(
18767
+ (node) => {
18768
+ const parentSection = node.parentElement?.closest("section");
18769
+ return !node.closest(OWNED) && node.closest(PANEL) === root && node.classList.contains("flex") && node.classList.contains("flex-col") && (!parentSection || parentSection === root || !root.contains(parentSection));
18770
+ }
18771
+ );
18772
+ const containers = new Set(nativeSections.map((node) => node.parentElement));
18773
+ const target = nativeSections[0]?.parentElement;
18774
+ if (containers.size === 1 && target) return { target, reason: null };
18775
+ if (containers.size === 0 && previous?.isConnected && previous.closest(PANEL) === root)
18776
+ return { target: previous, reason: null };
18777
+ return { target: null, reason: containers.size ? "ambiguous-sections" : "missing-sections" };
18778
+ }
18779
+ var ACTIVITY_SECTION_CLASS = "relative z-0 flex flex-col pb-2 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:py-2";
18780
+ var ACTIVITY_SECTION_CONTENT_CLASS = "flex flex-col gap-0.5 px-5 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:gap-0 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:px-4 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:group-data-[summary-panel-density=comfortable]/summary-panel:px-5";
18781
+ var ACTIVITY_SECTION_HEADING_CLASS = "activity-heading sticky top-2 z-10 flex h-7 w-full min-w-0 items-center justify-start gap-2 pb-0.5 text-sm font-normal text-secondary bg-surface-elevated-secondary before:bg-surface-elevated-secondary before:pointer-events-none before:absolute before:inset-x-0 before:-top-2 before:h-2 before:content-[''] ps-5 pe-3.5 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:h-6 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:group-data-[summary-panel-density=comfortable]/summary-panel:h-7 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:pb-0 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:text-dynamic-isle-row group-data-[summary-panel-variant=dynamic-isle]/summary-panel:ps-4 group-data-[summary-panel-variant=dynamic-isle]/summary-panel:group-data-[summary-panel-density=comfortable]/summary-panel:ps-5";
18782
+ var ACTIVITY_SECTION_TOGGLE_CLASS = "group/section-toggle -ms-[3.5px] inline-flex min-w-0 flex-1 cursor-interaction items-center gap-1 rounded-xl py-0.5 ps-[3.5px] pe-1 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring";
18783
+ var ACTIVITY_SECTION_LABEL_CLASS = "activity-title min-w-0 flex-1 text-sm group-data-[summary-panel-variant=dynamic-isle]/summary-panel:text-dynamic-isle-row";
18784
+
18785
+ // src/renderer-background-activity.ts
18786
+ function activityCountdown(nextRunAt, now = Date.now()) {
18787
+ if (!nextRunAt) return "";
18788
+ const seconds = Math.ceil((Date.parse(nextRunAt) - now) / 1e3);
18789
+ if (!Number.isFinite(seconds)) return "";
18790
+ if (seconds <= 0) return "Waiting for Harness";
18791
+ return "Next in " + Math.floor(seconds / 60) + ":" + String(seconds % 60).padStart(2, "0");
18792
+ }
18793
+ function activitySummaryLabel(activity) {
18794
+ const firstLine = activity.label.trim().split(/[\r\n]/, 1)[0]?.replace(/\s+/g, " ") ?? "";
18795
+ if (!firstLine) return activity.kind === "loop" ? "Loop schedule" : "Background process";
18796
+ const characters = Array.from(firstLine);
18797
+ return characters.length > 72 ? characters.slice(0, 71).join("") + "\u2026" : firstLine;
18798
+ }
18799
+ function supplementalBackgroundActivities(activities) {
18800
+ const rows = activities.filter(
18801
+ (item) => item.kind === "loop" || item.kind !== "subagent" && !item.commandItemId
18802
+ );
18803
+ return rows.some((item) => !["completed", "failed", "cancelled"].includes(item.status)) ? rows : [];
18804
+ }
18805
+ function same(a, b) {
18806
+ return a?.hostId === b?.hostId && a?.threadId === b?.threadId && a?.composer === b?.composer && a?.route === b?.route;
18807
+ }
18808
+ var CSS2 = [
18809
+ "[data-codexhost-background-activity]{font:inherit;color:var(--color-text-primary,inherit);min-width:0}",
18810
+ "[data-codexhost-background-activity] button{font:inherit;color:inherit;cursor:pointer;background:transparent;border:0;text-align:left}",
18811
+ "[data-codexhost-background-activity] button:disabled{opacity:.6;cursor:wait}",
18812
+ "[data-codexhost-background-activity] button:focus-visible{outline:2px solid var(--color-ring,#779cff);outline-offset:2px}",
18813
+ "[data-codexhost-background-activity] [hidden]{display:none}",
18814
+ "[data-codexhost-background-activity] .activity-heading{margin:0}",
18815
+ "[data-codexhost-background-activity] .activity-disclosure{flex-shrink:0;transition:transform .15s}",
18816
+ "[data-codexhost-background-activity] button[aria-expanded=true]>.activity-disclosure{opacity:0}",
18817
+ "[data-codexhost-background-activity] button:hover>.activity-disclosure,[data-codexhost-background-activity] button:focus-visible>.activity-disclosure{opacity:1}",
18818
+ "[data-codexhost-background-activity] .activity-row{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0;padding:7px 0}",
18819
+ "[data-codexhost-background-activity] .activity-title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
18820
+ "[data-codexhost-background-activity] .activity-meta{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
18821
+ "[data-codexhost-background-activity] .activity-detail{padding:4px 0 10px;min-width:0}",
18822
+ "[data-codexhost-background-activity] .activity-prompt-title{margin:0 0 6px;overflow-wrap:anywhere}",
18823
+ "[data-codexhost-background-activity] summary{cursor:pointer;padding:4px 0}",
18824
+ "[data-codexhost-background-activity] .activity-prompt-instructions{white-space:pre-wrap;overflow-wrap:anywhere;max-height:40vh;overflow:auto;padding:6px 0}",
18825
+ "[data-codexhost-background-activity] pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;max-height:40vh;overflow:auto}",
18826
+ "[data-codexhost-background-activity] pre.activity-process-output{font:12px/1.5 ui-monospace,monospace}",
18827
+ "[data-codexhost-background-activity] .activity-action{padding:5px 0;text-decoration:underline;margin-right:12px}",
18828
+ "[data-codexhost-background-activity] .activity-error{font-size:12px;padding:0 20px;color:var(--color-text-danger,light-dark(#a32020,#ffaaa0))}"
18829
+ ].join("\n");
18830
+ function installRendererBackgroundActivity(window2, readContext) {
18831
+ let context = null;
18832
+ let revision = 0;
18833
+ let disposed = false;
18834
+ let inFlight = null;
18835
+ let root = null;
18836
+ let container = null;
18837
+ let body = null;
18838
+ let errorNode = null;
18839
+ let activities = [];
18840
+ let allActivities = [];
18841
+ let selected = null;
18842
+ let expanded = true;
18843
+ let instructionsExpanded = false;
18844
+ let detail = null;
18845
+ let renderKey = "";
18846
+ let renderedOutput;
18847
+ let navigation = null;
18848
+ const unsupported = /* @__PURE__ */ new WeakSet();
18849
+ const valid = (owner, token) => !disposed && token === revision && same(owner, context) && same(owner, readContext());
18850
+ const message2 = (error51) => error51 instanceof Error ? error51.message : "Native activity is unavailable";
18851
+ const setError = (text) => {
18852
+ if (errorNode && errorNode.textContent !== text) errorNode.textContent = text;
18853
+ };
18854
+ const unmount = () => {
18855
+ root?.remove();
18856
+ root = null;
18857
+ body = null;
18858
+ errorNode = null;
18859
+ renderKey = "";
18860
+ renderedOutput = void 0;
18861
+ };
18862
+ const clear = () => {
18863
+ navigation?.abort();
18864
+ navigation = null;
18865
+ unmount();
18866
+ container = null;
18867
+ selected = null;
18868
+ expanded = true;
18869
+ instructionsExpanded = false;
18870
+ detail = null;
18871
+ activities = [];
18872
+ allActivities = [];
18873
+ };
18874
+ const button2 = (text, action, className) => {
18875
+ const node = window2.document.createElement("button");
18876
+ node.type = "button";
18877
+ node.className = className;
18878
+ node.textContent = text;
18879
+ node.addEventListener("click", action);
18880
+ return node;
18881
+ };
18882
+ const clocks = () => {
18883
+ for (const clock of root?.querySelectorAll("[data-next-run]") ?? []) {
18884
+ const text = activityCountdown(clock.dataset.nextRun);
18885
+ if (clock.textContent !== text) clock.textContent = text;
18886
+ }
18887
+ };
18888
+ const metadata = (parent, activity) => {
18889
+ const meta3 = window2.document.createElement("span");
18890
+ meta3.className = "activity-meta text-xs text-secondary";
18891
+ meta3.textContent = [
18892
+ activity.kind === "loop" ? "Schedule" : "Process",
18893
+ activity.status,
18894
+ activity.schedule
18895
+ ].filter(Boolean).join(" \xB7 ");
18896
+ parent.append(meta3);
18897
+ if (activity.nextRunAt) {
18898
+ const clock = window2.document.createElement("span");
18899
+ clock.className = "activity-meta text-xs text-secondary";
18900
+ clock.dataset.nextRun = activity.nextRunAt;
18901
+ parent.append(clock);
18902
+ }
18903
+ };
18904
+ const openChild = async (owner, token, id) => {
18905
+ navigation?.abort();
18906
+ const request = new AbortController();
18907
+ navigation = request;
18908
+ let child = allActivities.find((item) => item.id === id);
18909
+ if (!child?.threadId) {
18910
+ let raw;
18911
+ try {
18912
+ raw = await owner.route.sendRequest(
18913
+ THREAD_ACTIVITY_READ_METHOD,
18914
+ { threadId: owner.threadId, activityId: id },
18915
+ { priority: "interactive", timeoutMs: 1e4 }
18916
+ );
18917
+ } catch (error51) {
18918
+ if (request.signal.aborted) return;
18919
+ throw error51;
18920
+ }
18921
+ if (!valid(owner, token) || request.signal.aborted) return;
18922
+ child = backgroundActivityDetailSchema.parse(raw).activity;
18923
+ }
18924
+ if (!valid(owner, token) || request.signal.aborted) return;
18925
+ if (child.kind !== "subagent" || !child.threadId)
18926
+ throw Error("Native child conversation is unavailable");
18927
+ openRendererActivityChild(owner, child);
18928
+ };
18929
+ const showDetail = async (id) => {
18930
+ const owner = context;
18931
+ if (!owner) return;
18932
+ const token = revision;
18933
+ selected = selected === id ? null : id;
18934
+ instructionsExpanded = false;
18935
+ detail = null;
18936
+ setError("");
18937
+ render();
18938
+ if (!selected) return;
18939
+ try {
18940
+ const raw = await owner.route.sendRequest(
18941
+ THREAD_ACTIVITY_READ_METHOD,
18942
+ { threadId: owner.threadId, activityId: id },
18943
+ { priority: "interactive", timeoutMs: 1e4 }
18944
+ );
18945
+ if (!valid(owner, token) || selected !== id) return;
18946
+ detail = backgroundActivityDetailSchema.parse(raw);
18947
+ render();
18948
+ } catch (error51) {
18949
+ if (valid(owner, token) && selected === id) setError(message2(error51));
18950
+ }
18951
+ };
18952
+ const render = () => {
18953
+ if (!body || !context) return;
18954
+ const key = JSON.stringify([
18955
+ activities,
18956
+ selected,
18957
+ detail && [detail.activity, detail.truncated]
18958
+ ]);
18959
+ if (key === renderKey && detail?.output === renderedOutput) return;
18960
+ renderKey = key;
18961
+ renderedOutput = detail?.output;
18962
+ body.replaceChildren();
18963
+ for (const activity of activities) {
18964
+ const row = window2.document.createElement("div");
18965
+ const trigger = button2("", () => void showDetail(activity.id), "activity-row");
18966
+ const title = window2.document.createElement("span");
18967
+ title.className = ACTIVITY_SECTION_LABEL_CLASS;
18968
+ title.textContent = activitySummaryLabel(activity);
18969
+ trigger.append(title);
18970
+ trigger.setAttribute("aria-expanded", String(selected === activity.id));
18971
+ metadata(trigger, activity);
18972
+ row.append(trigger);
18973
+ body.append(row);
18974
+ if (selected !== activity.id) continue;
18975
+ const content = window2.document.createElement("div");
18976
+ content.className = "activity-detail";
18977
+ row.append(content);
18978
+ if (!detail) {
18979
+ content.textContent = "Loading native details\u2026";
18980
+ continue;
18981
+ }
18982
+ appendActivityOutput(content, detail, instructionsExpanded, (value) => {
18983
+ instructionsExpanded = value;
18984
+ });
18985
+ if (detail.truncated) {
18986
+ const note = window2.document.createElement("span");
18987
+ note.className = "activity-meta text-xs text-secondary";
18988
+ note.textContent = "Native output is truncated.";
18989
+ content.append(note);
18990
+ }
18991
+ const owner = context;
18992
+ const token = revision;
18993
+ if (activity.relatedActivityId) {
18994
+ const id = activity.relatedActivityId;
18995
+ const open = button2(
18996
+ "Open latest run",
18997
+ () => {
18998
+ if (!valid(owner, token)) return;
18999
+ open.disabled = true;
19000
+ setError("");
19001
+ void openChild(owner, token, id).catch((error51) => {
19002
+ if (valid(owner, token)) setError(message2(error51));
19003
+ }).finally(() => {
19004
+ if (valid(owner, token)) open.disabled = false;
19005
+ });
19006
+ },
19007
+ "activity-action"
19008
+ );
19009
+ content.append(open);
19010
+ }
19011
+ if (detail.activity.canStop) {
19012
+ const stop = button2(
19013
+ activity.kind === "loop" ? "Delete schedule" : "Stop task",
19014
+ () => {
19015
+ if (!valid(owner, token)) return;
19016
+ stop.disabled = true;
19017
+ void (async () => {
19018
+ try {
19019
+ const raw = await owner.route.sendRequest(
19020
+ THREAD_ACTIVITY_STOP_METHOD,
19021
+ { threadId: owner.threadId, activityId: activity.id },
19022
+ { priority: "interactive", timeoutMs: 1e4 }
19023
+ );
19024
+ if (!valid(owner, token)) return;
19025
+ const result = threadActivityStopResultSchema.parse(raw);
19026
+ setError(result.outcome === "notFound" ? "Native activity was not found." : "");
19027
+ await refresh();
19028
+ } catch (error51) {
19029
+ if (valid(owner, token)) setError(message2(error51));
19030
+ } finally {
19031
+ if (valid(owner, token)) stop.disabled = false;
19032
+ }
19033
+ })();
19034
+ },
19035
+ "activity-action"
19036
+ );
19037
+ content.append(stop);
19038
+ }
19039
+ }
19040
+ clocks();
19041
+ };
19042
+ const mount = (owner, target) => {
19043
+ root = window2.document.createElement("section");
19044
+ root.dataset.codexhostBackgroundActivity = owner.threadId;
19045
+ root.className = ACTIVITY_SECTION_CLASS;
19046
+ const style = window2.document.createElement("style");
19047
+ style.textContent = CSS2;
19048
+ const heading = window2.document.createElement("header");
19049
+ heading.className = ACTIVITY_SECTION_HEADING_CLASS;
19050
+ const toggle = button2(
19051
+ "",
19052
+ () => {
19053
+ expanded = !expanded;
19054
+ syncExpanded();
19055
+ },
19056
+ ACTIVITY_SECTION_TOGGLE_CLASS
19057
+ );
19058
+ const label = window2.document.createElement("span");
19059
+ label.className = "truncate";
19060
+ label.textContent = "Background activity";
19061
+ const disclosure = window2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
19062
+ disclosure.setAttribute("class", "activity-disclosure");
19063
+ disclosure.setAttribute("width", "12");
19064
+ disclosure.setAttribute("height", "12");
19065
+ disclosure.setAttribute("viewBox", "0 0 24 24");
19066
+ disclosure.setAttribute("aria-hidden", "true");
19067
+ const path = window2.document.createElementNS("http://www.w3.org/2000/svg", "path");
19068
+ path.setAttribute("d", "m9 5 7 7-7 7");
19069
+ path.setAttribute("fill", "none");
19070
+ path.setAttribute("stroke", "currentColor");
19071
+ path.setAttribute("stroke-width", "2");
19072
+ disclosure.append(path);
19073
+ toggle.append(label, disclosure);
19074
+ heading.append(toggle);
19075
+ errorNode = window2.document.createElement("div");
19076
+ errorNode.className = "activity-error";
19077
+ errorNode.setAttribute("role", "status");
19078
+ body = window2.document.createElement("div");
19079
+ body.className = ACTIVITY_SECTION_CONTENT_CLASS;
19080
+ const syncExpanded = () => {
19081
+ toggle.setAttribute("aria-expanded", String(expanded));
19082
+ disclosure.style.transform = expanded ? "rotate(90deg)" : "";
19083
+ if (body) body.hidden = !expanded;
19084
+ if (errorNode) errorNode.hidden = !expanded;
19085
+ };
19086
+ syncExpanded();
19087
+ root.append(style, heading, errorNode, body);
19088
+ root.addEventListener("click", (event) => event.stopPropagation());
19089
+ target.append(root);
19090
+ renderKey = "";
19091
+ };
19092
+ const syncTarget = (owner) => {
19093
+ const { target } = activitySectionTarget(window2, owner.composer, container);
19094
+ if (!target) {
19095
+ unmount();
19096
+ if (!container?.isConnected) container = null;
19097
+ return;
19098
+ }
19099
+ container = target;
19100
+ if (!activities.length) {
19101
+ unmount();
19102
+ return;
19103
+ }
19104
+ if (!root?.isConnected) mount(owner, target);
19105
+ else if (root.parentElement !== target) target.append(root);
19106
+ render();
19107
+ };
19108
+ const refresh = async () => {
19109
+ if (disposed) return;
19110
+ const next = readContext();
19111
+ if (!same(context, next)) {
19112
+ revision++;
19113
+ inFlight = null;
19114
+ clear();
19115
+ context = next;
19116
+ }
19117
+ const owner = context;
19118
+ if (!owner) return;
19119
+ if (inFlight || unsupported.has(owner.route)) return;
19120
+ const token = revision;
19121
+ const request = {};
19122
+ inFlight = request;
19123
+ try {
19124
+ const raw = await owner.route.sendRequest(
19125
+ THREAD_ACTIVITY_LIST_METHOD,
19126
+ { threadId: owner.threadId },
19127
+ { priority: "background", timeoutMs: 5e3 }
19128
+ );
19129
+ if (!valid(owner, token)) return;
19130
+ const result = threadActivityListResultSchema.parse(raw);
19131
+ if (!result.supported) {
19132
+ clear();
19133
+ return;
19134
+ }
19135
+ allActivities = result.activities;
19136
+ activities = supplementalBackgroundActivities(allActivities);
19137
+ if (selected && !activities.some((item) => item.id === selected)) {
19138
+ selected = null;
19139
+ instructionsExpanded = false;
19140
+ detail = null;
19141
+ }
19142
+ syncTarget(owner);
19143
+ if (selected) {
19144
+ const id = selected;
19145
+ const rawDetail = await owner.route.sendRequest(
19146
+ THREAD_ACTIVITY_READ_METHOD,
19147
+ { threadId: owner.threadId, activityId: id },
19148
+ { priority: "background", timeoutMs: 5e3 }
19149
+ );
19150
+ if (!valid(owner, token) || selected !== id) return;
19151
+ detail = backgroundActivityDetailSchema.parse(rawDetail);
19152
+ render();
19153
+ }
19154
+ } catch (error51) {
19155
+ if (!valid(owner, token)) return;
19156
+ if (isUnsupportedMethod(error51, THREAD_ACTIVITY_LIST_METHOD)) {
19157
+ unsupported.add(owner.route);
19158
+ clear();
19159
+ } else {
19160
+ syncTarget(owner);
19161
+ setError(message2(error51));
19162
+ }
19163
+ } finally {
19164
+ if (inFlight === request) inFlight = null;
19165
+ }
19166
+ };
19167
+ const timer = window2.setInterval(() => {
19168
+ clocks();
19169
+ void refresh();
19170
+ }, 1e3);
19171
+ void refresh();
19172
+ return {
19173
+ refreshContext() {
19174
+ if (!same(context, readContext()) || root && !root.isConnected) void refresh();
19175
+ },
19176
+ dispose() {
19177
+ disposed = true;
19178
+ revision++;
19179
+ window2.clearInterval(timer);
19180
+ clear();
19181
+ }
19182
+ };
19183
+ }
19184
+
18522
19185
  // src/voice-settings-sync.ts
18523
19186
  function desktopVoiceCallActive(owner) {
18524
19187
  const hook = Reflect.get(owner, "__codexhostNativeChatVoiceV1");
@@ -18620,9 +19283,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18620
19283
  }
18621
19284
 
18622
19285
  // src/codex-ssh-services.ts
18623
- var record6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19286
+ var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
18624
19287
  function isSshServices(value) {
18625
- if (!record6(value) || !Object.hasOwn(value, "sshConnections") || !Object.hasOwn(value, "remoteConnections"))
19288
+ if (!record7(value) || !Object.hasOwn(value, "sshConnections") || !Object.hasOwn(value, "remoteConnections"))
18626
19289
  return false;
18627
19290
  const ssh = value.sshConnections;
18628
19291
  const remote = value.remoteConnections;
@@ -18633,7 +19296,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18633
19296
  }
18634
19297
 
18635
19298
  // src/codex-ssh-adapter.ts
18636
- var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19299
+ var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
18637
19300
  function createCodexSshClient(ownerWindow) {
18638
19301
  let nativeServices;
18639
19302
  function services() {
@@ -18669,7 +19332,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18669
19332
  const abort = () => finish(new DOMException("Aborted", "AbortError"));
18670
19333
  const receive = (event) => {
18671
19334
  const message2 = event.data;
18672
- if (!record7(message2) || message2.type !== "fetch-response" || message2.requestId !== requestId2)
19335
+ if (!record8(message2) || message2.type !== "fetch-response" || message2.requestId !== requestId2)
18673
19336
  return;
18674
19337
  if (message2.responseType !== "success" || typeof message2.status !== "number" || message2.status < 200 || message2.status >= 300 || typeof message2.bodyJsonString !== "string") {
18675
19338
  const detail = typeof message2.error === "string" ? `: ${message2.error}` : "";
@@ -18725,12 +19388,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18725
19388
  }
18726
19389
  async function list(signal) {
18727
19390
  const result = await request("refresh-remote-connections", {}, signal);
18728
- if (!record7(result) || !Array.isArray(result.remoteConnections))
19391
+ if (!record8(result) || !Array.isArray(result.remoteConnections))
18729
19392
  throw new Error("Invalid Codex SSH connection list");
18730
19393
  return result.remoteConnections.filter(
18731
- (item) => !(record7(item) && ["wsl", "remote-control"].includes(String(item.source)))
19394
+ (item) => !(record8(item) && ["wsl", "remote-control"].includes(String(item.source)))
18732
19395
  ).map((item) => {
18733
- if (!record7(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
19396
+ if (!record8(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
18734
19397
  throw new Error(
18735
19398
  "This Codex version uses an unsupported SSH configuration; open native settings"
18736
19399
  );
@@ -18802,11 +19465,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18802
19465
  },
18803
19466
  async state(hostId2, signal) {
18804
19467
  const result = await request("app-server-connection-state", { hostId: hostId2 }, signal);
18805
- if (!record7(result) || typeof result.state !== "string")
19468
+ if (!record8(result) || typeof result.state !== "string")
18806
19469
  throw new Error("Invalid Codex connection state");
18807
19470
  return {
18808
19471
  state: result.state,
18809
- error: typeof result.error === "string" ? result.error : record7(result.error) && typeof result.error.message === "string" ? result.error.message : null
19472
+ error: typeof result.error === "string" ? result.error : record8(result.error) && typeof result.error.message === "string" ? result.error.message : null
18810
19473
  };
18811
19474
  }
18812
19475
  };
@@ -19370,40 +20033,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19370
20033
  };
19371
20034
  }
19372
20035
 
19373
- // src/renderer-request-sender.ts
19374
- var RendererMethodUnavailableError = class extends Error {
19375
- constructor(method, cause) {
19376
- super(`${method} is unsupported on this Host connection`, { cause });
19377
- this.method = method;
19378
- this.name = "RendererMethodUnavailableError";
19379
- }
19380
- method;
19381
- code = -32601;
19382
- };
19383
- function isUnsupportedMethod(error51, method) {
19384
- if (typeof error51 !== "object" || error51 === null) return false;
19385
- const code = "code" in error51 ? error51.code : void 0;
19386
- const message2 = "message" in error51 ? error51.message : void 0;
19387
- return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
19388
- }
19389
- function createRendererRequestSender(send) {
19390
- const unsupported = /* @__PURE__ */ new Map();
19391
- return async (method, params, options) => {
19392
- const known = unsupported.get(method);
19393
- if (known) throw known;
19394
- try {
19395
- return await (options === void 0 ? send(method, params) : send(method, params, options));
19396
- } catch (error51) {
19397
- if (!method.startsWith("codexhost/") || !isUnsupportedMethod(error51, method)) throw error51;
19398
- const unavailable = new RendererMethodUnavailableError(method, error51);
19399
- unsupported.set(method, unavailable);
19400
- throw unavailable;
19401
- }
19402
- };
19403
- }
19404
-
19405
20036
  // src/renderer-questions.ts
19406
- function same(a, b) {
20037
+ function same2(a, b) {
19407
20038
  return a?.hostId === b?.hostId && a?.threadId === b?.threadId && a?.composer === b?.composer && a?.route === b?.route;
19408
20039
  }
19409
20040
  function installRendererQuestions(window2, readContext) {
@@ -19431,7 +20062,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19431
20062
  const refresh = async () => {
19432
20063
  if (disposed) return;
19433
20064
  const next = readContext();
19434
- if (!same(context, next)) {
20065
+ if (!same2(context, next)) {
19435
20066
  clear();
19436
20067
  context = next;
19437
20068
  revision++;
@@ -19446,7 +20077,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19446
20077
  { threadId: current.threadId },
19447
20078
  { priority: "background", timeoutMs: 5e3 }
19448
20079
  );
19449
- if (disposed || revision !== startedRevision || !same(current, readContext())) return;
20080
+ if (disposed || revision !== startedRevision || !same2(current, readContext())) return;
19450
20081
  const question = threadQuestionsResultSchema.parse(raw).questions[0];
19451
20082
  if (!question || !question.questions.some(
19452
20083
  (field2) => field2.type === "choice" && (field2.multiple || field2.allowOther)
@@ -19471,7 +20102,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19471
20102
  current.composer.ownerDocument,
19472
20103
  question,
19473
20104
  async (answers, cancelled) => {
19474
- if (disposed || !same(current, readContext()) || cardKey !== key)
20105
+ if (disposed || !same2(current, readContext()) || cardKey !== key)
19475
20106
  throw new Error("Question owner changed");
19476
20107
  const raw2 = await current.route.sendRequest(
19477
20108
  THREAD_QUESTION_RESPOND_METHOD,
@@ -19486,7 +20117,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19486
20117
  );
19487
20118
  threadQuestionRespondResultSchema.parse(raw2);
19488
20119
  drafts.delete(key);
19489
- if (same(current, context)) {
20120
+ if (same2(current, context)) {
19490
20121
  revision++;
19491
20122
  if (cardKey === key) clear(false);
19492
20123
  }
@@ -19498,7 +20129,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19498
20129
  stopActivity = installQuestionActivity(
19499
20130
  window2,
19500
20131
  card.root,
19501
- () => same(current, readContext()) && card === mounted && mounted.autoResolution?.resetOnActivity === true,
20132
+ () => same2(current, readContext()) && card === mounted && mounted.autoResolution?.resetOnActivity === true,
19502
20133
  async () => {
19503
20134
  const raw2 = await current.route.sendRequest(
19504
20135
  THREAD_QUESTION_ACTIVITY_METHOD,
@@ -19509,14 +20140,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19509
20140
  },
19510
20141
  { priority: "background", timeoutMs: 4e3 }
19511
20142
  );
19512
- if (disposed || card !== mounted || !same(current, readContext())) return;
20143
+ if (disposed || card !== mounted || !same2(current, readContext())) return;
19513
20144
  const ack = threadQuestionActivityResultSchema.parse(raw2).autoResolution;
19514
20145
  if (ack) mounted.updateAutoResolution(ack);
19515
20146
  }
19516
20147
  );
19517
20148
  } catch (error51) {
19518
20149
  if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
19519
- if (revision === startedRevision && same(current, context)) clear();
20150
+ if (revision === startedRevision && same2(current, context)) clear();
19520
20151
  } finally {
19521
20152
  inFlight = false;
19522
20153
  }
@@ -19528,7 +20159,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19528
20159
  return {
19529
20160
  refresh,
19530
20161
  refreshContext() {
19531
- if (!same(context, readContext()) || card && !card.root.isConnected) void refresh();
20162
+ if (!same2(context, readContext()) || card && !card.root.isConnected) void refresh();
19532
20163
  },
19533
20164
  dispose() {
19534
20165
  disposed = true;
@@ -20336,6 +20967,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20336
20967
  loaded = true;
20337
20968
  show(value);
20338
20969
  }).catch(() => {
20970
+ loaded = true;
20339
20971
  status.textContent = messages.launchPathLoadError;
20340
20972
  }).finally(() => {
20341
20973
  busy = false;
@@ -22169,7 +22801,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22169
22801
  launchPathAutomatic: "No saved override. Uses environment configuration, then automatic discovery.",
22170
22802
  launchPathSaving: "Saving\u2026",
22171
22803
  launchPathLoading: "Loading launch settings\u2026",
22172
- launchPathLoadError: "Could not load launch settings. Reopen this detail panel to retry.",
22804
+ launchPathLoadError: "Could not load launch settings. Save an installation directory or reset to automatic discovery to replace them.",
22173
22805
  launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
22174
22806
  grokComputerUseLabel: "Grok Computer Use",
22175
22807
  grokComputerUseTitle: "Computer Use",
@@ -22477,7 +23109,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22477
23109
  launchPathAutomatic: "\u672A\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u8DEF\u5F84\uFF0C\u4F7F\u7528\u73AF\u5883\u53D8\u91CF\u914D\u7F6E\u6216\u81EA\u52A8\u53D1\u73B0\u3002",
22478
23110
  launchPathSaving: "\u6B63\u5728\u4FDD\u5B58\u2026",
22479
23111
  launchPathLoading: "\u6B63\u5728\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u2026",
22480
- launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u6B64\u8BE6\u60C5\u9762\u677F\u91CD\u8BD5\u3002",
23112
+ launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u3002\u4FDD\u5B58\u5B89\u88C5\u76EE\u5F55\u6216\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u5373\u53EF\u66FF\u6362\u3002",
22481
23113
  launchPathSaveError: "\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u586B\u5199\u6B64 Host \u4E0A\u5B9E\u9645\u5B58\u5728\u7684\u5B89\u88C5\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5E76\u786E\u8BA4\u914D\u7F6E\u76EE\u5F55\u53EF\u5199\u3002",
22482
23114
  grokComputerUseLabel: "Grok Computer Use",
22483
23115
  grokComputerUseTitle: "Computer Use",
@@ -23181,12 +23813,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23181
23813
  const externalAgent = agent;
23182
23814
  const showInstall = view.downloadVisible[externalAgent] === true;
23183
23815
  const showError = view.errorVisible[externalAgent] === true;
23184
- const visible = showInstall || showError;
23816
+ const visible2 = showInstall || showError;
23185
23817
  option.action.hidden = false;
23186
- option.action.disabled = !visible;
23818
+ option.action.disabled = !visible2;
23187
23819
  option.action.style.display = "inline-flex";
23188
- option.action.style.visibility = visible ? "visible" : "hidden";
23189
- option.action.style.pointerEvents = visible ? "auto" : "none";
23820
+ option.action.style.visibility = visible2 ? "visible" : "hidden";
23821
+ option.action.style.pointerEvents = visible2 ? "auto" : "none";
23190
23822
  if (showError) {
23191
23823
  option.action.dataset.mode = "error";
23192
23824
  option.action.textContent = "!";
@@ -23212,7 +23844,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23212
23844
  option.action.setAttribute("aria-label", label);
23213
23845
  option.action.title = label;
23214
23846
  }
23215
- option.action.setAttribute("aria-hidden", String(!visible));
23847
+ option.action.setAttribute("aria-hidden", String(!visible2));
23216
23848
  }
23217
23849
  }
23218
23850
  return view;
@@ -23261,19 +23893,30 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23261
23893
  trigger.style.overflow = "hidden";
23262
23894
  }
23263
23895
  function observeRendererCompactComposer(composer) {
23896
+ let compact;
23897
+ let frame = null;
23264
23898
  const update = () => {
23265
23899
  const width = composer.getBoundingClientRect().width;
23266
- if (width > 0) {
23267
- composer.toggleAttribute(COMPACT_COMPOSER_ATTRIBUTE, width <= COMPACT_COMPOSER_WIDTH);
23268
- }
23900
+ if (width <= 0) return;
23901
+ const next = width <= COMPACT_COMPOSER_WIDTH;
23902
+ if (next === compact) return;
23903
+ compact = next;
23904
+ composer.toggleAttribute(COMPACT_COMPOSER_ATTRIBUTE, next);
23269
23905
  };
23270
23906
  update();
23271
23907
  if (typeof ResizeObserver === "undefined")
23272
23908
  return () => composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
23273
- const observer = new ResizeObserver(update);
23909
+ const observer = new ResizeObserver(() => {
23910
+ if (frame !== null) return;
23911
+ frame = requestAnimationFrame(() => {
23912
+ frame = null;
23913
+ update();
23914
+ });
23915
+ });
23274
23916
  observer.observe(composer, { box: "border-box" });
23275
23917
  return () => {
23276
23918
  observer.disconnect();
23919
+ if (frame !== null) cancelAnimationFrame(frame);
23277
23920
  composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
23278
23921
  };
23279
23922
  }
@@ -23819,9 +24462,9 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23819
24462
  const totalCostUsd = usage?.totalCostUsd;
23820
24463
  const hasContext = usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0;
23821
24464
  const hasTokenUsage = usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0;
23822
- const visible = rendererUsageHasDisplayData(usage);
23823
- control.root.style.display = visible ? "inline-flex" : "none";
23824
- if (!visible) {
24465
+ const visible2 = rendererUsageHasDisplayData(usage);
24466
+ control.root.style.display = visible2 ? "inline-flex" : "none";
24467
+ if (!visible2) {
23825
24468
  closePopover(control);
23826
24469
  return false;
23827
24470
  }
@@ -24966,7 +25609,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24966
25609
  const content = rendererModelSelectionNoticeContent(view, locale);
24967
25610
  control.selectionNotice.show(content.heading, content.message);
24968
25611
  }
24969
- function renderRendererModelPicker(control, view, visible, harnessId = "", locale = "en") {
25612
+ function renderRendererModelPicker(control, view, visible2, harnessId = "", locale = "en") {
24970
25613
  if (control.harnessId !== harnessId) {
24971
25614
  control.close();
24972
25615
  control.selectionNotice.hide();
@@ -24974,13 +25617,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
24974
25617
  control.favorites = readModelFavorites(harnessId);
24975
25618
  delete control.root.dataset.catalogSignature;
24976
25619
  }
24977
- control.root.style.display = visible ? "inline-flex" : "none";
25620
+ control.root.style.display = visible2 ? "inline-flex" : "none";
24978
25621
  control.root.style.alignItems = "center";
24979
25622
  control.root.style.alignSelf = "center";
24980
25623
  control.root.style.height = "28px";
24981
25624
  control.root.style.verticalAlign = "middle";
24982
25625
  applyRendererTriggerChipSqueezeRoot(control.root, rendererModelTriggerMaxWidth());
24983
- if (!visible) {
25626
+ if (!visible2) {
24984
25627
  control.close();
24985
25628
  control.fast.close();
24986
25629
  control.selectionNotice.hide();
@@ -25337,17 +25980,17 @@ Codex Fast mode prioritizes requests and may increase usage.`
25337
25980
  control.menu.append(button2);
25338
25981
  }
25339
25982
  }
25340
- function renderRendererPermissionModePicker(control, view, visible, locale = control.locale) {
25983
+ function renderRendererPermissionModePicker(control, view, visible2, locale = control.locale) {
25341
25984
  control.locale = locale;
25342
25985
  const messages = rendererHarnessMessages(locale);
25343
25986
  control.menu.setAttribute("aria-label", messages.permissionMode);
25344
- control.root.style.display = visible ? "inline-flex" : "none";
25987
+ control.root.style.display = visible2 ? "inline-flex" : "none";
25345
25988
  control.root.style.alignItems = "center";
25346
25989
  control.root.style.alignSelf = "center";
25347
25990
  control.root.style.height = "28px";
25348
25991
  control.root.style.verticalAlign = "middle";
25349
25992
  applyRendererTriggerChipSqueezeRoot(control.root, rendererPermissionModeTriggerMaxWidth());
25350
- if (!visible) {
25993
+ if (!visible2) {
25351
25994
  control.close();
25352
25995
  return;
25353
25996
  }
@@ -25841,9 +26484,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
25841
26484
  root.append(chip);
25842
26485
  }
25843
26486
  }
25844
- const visible = active.length > 0 && anchor !== null;
25845
- if (root.hidden === visible) root.hidden = !visible;
25846
- const display = visible ? "inline-flex" : "none";
26487
+ const visible2 = active.length > 0 && anchor !== null;
26488
+ if (root.hidden === visible2) root.hidden = !visible2;
26489
+ const display = visible2 ? "inline-flex" : "none";
25847
26490
  if (root.style.display !== display) root.style.display = display;
25848
26491
  const visibility = root.scrollWidth > root.clientWidth ? "hidden" : "visible";
25849
26492
  if (root.style.visibility !== visibility) root.style.visibility = visibility;
@@ -28006,10 +28649,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
28006
28649
  const currentRole = manager.getStreamRole?.(threadId);
28007
28650
  if (isRecord9(currentRole) && currentRole.role === "follower")
28008
28651
  return originalSteer.apply(manager, args);
28009
- if (!Array.isArray(input) || input.length === 0 || input.some(
28010
- (item) => !isRecord9(item) || item.type !== "text" || typeof item.text !== "string"
28011
- ) || !input.some((item) => isRecord9(item) && typeof item.text === "string" && item.text.trim())) {
28012
- throw new Error("External steering requires non-empty text input");
28652
+ if (!Array.isArray(input) || input.length === 0 || input.some((item) => {
28653
+ if (!isRecord9(item)) return true;
28654
+ if (item.type === "text") return typeof item.text !== "string";
28655
+ if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
28656
+ if (item.type === "image") return typeof item.url !== "string" || !item.url;
28657
+ return true;
28658
+ }) || !input.some(
28659
+ (item) => isRecord9(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
28660
+ )) {
28661
+ throw new Error("External steering requires non-empty text or image input");
28013
28662
  }
28014
28663
  if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
28015
28664
  if (!isRecord9(restoreMessage) || !isRecord9(restoreMessage.context)) {
@@ -28148,16 +28797,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
28148
28797
  for (let index = 0; index < decoded.length; index += 1) bytes[index] = decoded.charCodeAt(index);
28149
28798
  return { contents: new Blob([bytes], { type: mimeType }), extension };
28150
28799
  }
28151
- function nativeImagePaths(text) {
28152
- const context = text.split("## My request:")[0] ?? "";
28153
- const start = context.indexOf("# Files mentioned by the user:");
28154
- if (start < 0) return [];
28155
- return [
28156
- ...context.slice(start).matchAll(
28157
- /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu
28158
- )
28159
- ].map((match) => match[1]).filter(filePath);
28160
- }
28161
28800
  function createRemoteAttachmentSender(target, hostId2, isCurrent) {
28162
28801
  const prepared = /* @__PURE__ */ new WeakMap();
28163
28802
  return (params, send) => {
@@ -28182,7 +28821,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28182
28821
  if (cached2) return cached2.then(dispatch);
28183
28822
  const input = params.input;
28184
28823
  const text = input.filter((item) => isRecord10(item) && item.type === "text").map((item) => isRecord10(item) && typeof item.text === "string" ? item.text : "").join("\n");
28185
- const existingPaths = nativeImagePaths(text);
28824
+ const existingPaths = desktopImageAttachmentPaths(text);
28186
28825
  const prepare = async () => {
28187
28826
  if (existingPaths.length === images.length) return params;
28188
28827
  if (images.length > 20) throw new Error("Too many remote image attachments (maximum 20)");
@@ -28264,10 +28903,10 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
28264
28903
  }
28265
28904
 
28266
28905
  // src/renderer-thread-reference-persistence.ts
28267
- var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
28906
+ var record9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
28268
28907
  var SYNC_TIMEOUT_MS = 2e3;
28269
28908
  function restoreRpcThreadReferenceCapability(client, messages, isCurrent) {
28270
- if (!record8(messages) || !record8(messages.electronBridge)) return client;
28909
+ if (!record9(messages) || !record9(messages.electronBridge)) return client;
28271
28910
  const bridge = messages.electronBridge;
28272
28911
  const send = bridge.sendMessageFromView;
28273
28912
  if (typeof send !== "function") return client;
@@ -28282,7 +28921,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
28282
28921
  const listener = (event) => {
28283
28922
  if (event.source != null && event.source !== messages) return;
28284
28923
  const message2 = event.data;
28285
- if (!record8(message2) || message2.type !== "persisted-atom-sync" || !record8(message2.state))
28924
+ if (!record9(message2) || message2.type !== "persisted-atom-sync" || !record9(message2.state))
28286
28925
  return;
28287
28926
  finish(!Object.hasOwn(message2.state, key));
28288
28927
  };
@@ -28323,12 +28962,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
28323
28962
  }
28324
28963
 
28325
28964
  // src/renderer-thread-reference-capability.ts
28326
- var record9 = (value) => typeof value === "object" && value !== null;
28965
+ var record10 = (value) => typeof value === "object" && value !== null;
28327
28966
  function restoreThreadReferenceCapability(client, manager, isCurrent, messages = null) {
28328
- if (record9(manager) && manager.kind === "main-process-rpc") {
28967
+ if (record10(manager) && manager.kind === "main-process-rpc") {
28329
28968
  return restoreRpcThreadReferenceCapability(client, messages, isCurrent);
28330
28969
  }
28331
- if (!record9(manager) || !record9(manager.storage)) return client;
28970
+ if (!record10(manager) || !record10(manager.storage)) return client;
28332
28971
  const storage = manager.storage;
28333
28972
  const read = storage.readValue;
28334
28973
  const write = storage.writeValue;
@@ -28363,14 +29002,14 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
28363
29002
  }
28364
29003
 
28365
29004
  // src/renderer-thread-reference-context.ts
28366
- var record10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
29005
+ var record11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
28367
29006
  function createThreadReferenceContext(manager, hostId2, isCurrent) {
28368
29007
  const prepared = /* @__PURE__ */ new WeakMap();
28369
29008
  return (params) => {
28370
- if (hostId2 === "local" || !record10(manager) || typeof manager.getConversation !== "function" || !record10(params) || typeof params.threadId !== "string")
29009
+ if (hostId2 === "local" || !record11(manager) || typeof manager.getConversation !== "function" || !record11(params) || typeof params.threadId !== "string")
28371
29010
  return params;
28372
29011
  const conversation = manager.getConversation.call(manager, params.threadId);
28373
- if (!record10(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
29012
+ if (!record11(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
28374
29013
  return params;
28375
29014
  if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
28376
29015
  const cached2 = prepared.get(params);
@@ -29691,8 +30330,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29691
30330
  const draftKey = target[1];
29692
30331
  if (!binding || !route.policy.scopedCreation)
29693
30332
  return agent === "codex" && !draftModels.has(draftKey);
29694
- draftModels.apply(draftKey, binding, carrier ?? null);
29695
- if (route.policy.select(carrier ?? null, draftKey, binding.creationModes)) {
30333
+ const previous = draftModels.model(draftKey);
30334
+ const policyChanged = route.policy.select(carrier ?? null, draftKey, binding.creationModes);
30335
+ try {
30336
+ draftModels.apply(draftKey, binding, carrier ?? null);
30337
+ } catch (error51) {
30338
+ try {
30339
+ route.policy.select(previous, draftKey, binding.creationModes);
30340
+ } catch {
30341
+ }
30342
+ throw error51;
30343
+ }
30344
+ if (policyChanged) {
29696
30345
  modelUpdates += 1;
29697
30346
  liveStatus.modelUpdates = modelUpdates;
29698
30347
  }
@@ -33265,7 +33914,7 @@ ${detail}` : ""}`
33265
33914
  "codexhost was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 codexhost\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 codexhost \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
33266
33915
  "The active codexhost does not match the global npm installation. Uninstall only the remote service, or remove the package manually on the remote computer": "\u5F53\u524D codexhost \u4E0E npm \u5168\u5C40\u5B89\u88C5\u4F4D\u7F6E\u4E0D\u5339\u914D\u3002\u8BF7\u9009\u62E9\u4EC5\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1\uFF0C\u6216\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u5378\u8F7D\u8F6F\u4EF6\u5305",
33267
33916
  "The remote service was uninstalled, but removing the codexhost package failed. Check npm permissions on the remote computer and retry": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5378\u8F7D\uFF0C\u4F46 codexhost \u8F6F\u4EF6\u5305\u5378\u8F7D\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u4E0A\u7684 npm \u6743\u9650\u540E\u91CD\u8BD5",
33268
- "Remote Node.js is unsupported. Select Node.js 22.19 or later in the 22.x series, or Node.js 24.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7684 22.x \u7248\u672C\uFF0C\u6216 Node.js 24.x",
33917
+ "Remote Node.js is unsupported. Select Node.js 22.19 or later, except 23.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7248\u672C\uFF0C\u4F46\u4E0D\u5305\u62EC 23.x",
33269
33918
  "npm installation failed. Check network access and global installation permissions": "npm \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u548C\u5168\u5C40\u5B89\u88C5\u6743\u9650",
33270
33919
  "Remote service configuration failed. Check Codex CLI and the remote desktop login": "\u8FDC\u7A0B\u670D\u52A1\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 Codex CLI \u4EE5\u53CA\u8FDC\u7A0B\u7535\u8111\u7684\u684C\u9762\u767B\u5F55\u72B6\u6001",
33271
33920
  "Remote service could not stop. Check the remote service before retrying": "\u8FDC\u7A0B\u670D\u52A1\u65E0\u6CD5\u505C\u6B62\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u670D\u52A1\u540E\u91CD\u8BD5",
@@ -34599,6 +35248,30 @@ ${detail}` : ""}`
34599
35248
  };
34600
35249
  }
34601
35250
 
35251
+ // src/settings/session-import-sources.ts
35252
+ async function loadSessionImportSources(client, diagnostics, signal, refresh) {
35253
+ const { harnesses } = await client.listSessionImportSources();
35254
+ signal.throwIfAborted();
35255
+ if (!diagnostics || harnesses.length === 0) return harnesses;
35256
+ const hostId2 = client.hostId ?? "local";
35257
+ const readHost = () => diagnostics.snapshot().hosts.find((host2) => host2.hostId === hostId2);
35258
+ let host = readHost();
35259
+ const incomplete = () => !host || Boolean(host.directoryError) || harnesses.some(({ harnessId }) => {
35260
+ const status = host?.agents.find(({ agent }) => agent === harnessId)?.availability;
35261
+ return status === void 0 || status === "checking";
35262
+ });
35263
+ if (refresh || incomplete()) {
35264
+ await diagnostics.refresh(hostId2);
35265
+ signal.throwIfAborted();
35266
+ host = readHost();
35267
+ }
35268
+ if (incomplete()) throw new Error("Harness installation diagnostics are incomplete");
35269
+ const missing = new Set(
35270
+ host?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
35271
+ );
35272
+ return harnesses.filter(({ harnessId }) => !missing.has(harnessId));
35273
+ }
35274
+
34602
35275
  // src/settings/session-import-page.ts
34603
35276
  function shortSessionId(value) {
34604
35277
  return value.length <= 18 ? value : `${value.slice(0, 10)}\u2026${value.slice(-6)}`;
@@ -34668,7 +35341,7 @@ ${detail}` : ""}`
34668
35341
  ...getDiagnostics()?.snapshot().hosts.map(({ hostId: hostId2 }) => hostId2) ?? [],
34669
35342
  ...current ? [current] : []
34670
35343
  ])
34671
- ];
35344
+ ].filter((hostId2) => hostId2 !== "durable");
34672
35345
  displayedHostId = current;
34673
35346
  const scrollLeft = hostOptions.scrollLeft;
34674
35347
  hostOptions.replaceChildren();
@@ -35012,10 +35685,14 @@ ${detail}` : ""}`
35012
35685
  content.append(list);
35013
35686
  updateImportActions();
35014
35687
  };
35015
- const load = () => {
35688
+ const load = (refreshDiagnostics = false) => {
35016
35689
  if (importingId !== null || context.signal.aborted) return;
35017
35690
  loadedClient = null;
35018
- const client = getClient(selectedHostId);
35691
+ let client = getClient(selectedHostId);
35692
+ if (client?.hostId === "durable") {
35693
+ selectedHostId = "local";
35694
+ client = getClient(selectedHostId);
35695
+ }
35019
35696
  renderHosts(client);
35020
35697
  listControls.setBusy(client !== null);
35021
35698
  refresh.disabled = client !== null;
@@ -35028,11 +35705,11 @@ ${detail}` : ""}`
35028
35705
  void context.runLatest(
35029
35706
  async (signal) => {
35030
35707
  if (!client) throw new RendererSessionImportUnavailableError();
35031
- const missing = new Set(
35032
- getDiagnostics()?.snapshot().hosts.find(({ hostId: hostId2 }) => hostId2 === (client.hostId ?? "local"))?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
35033
- );
35034
- const harnesses = (await client.listSessionImportSources()).harnesses.filter(
35035
- ({ harnessId }) => !missing.has(harnessId)
35708
+ const harnesses = await loadSessionImportSources(
35709
+ client,
35710
+ getDiagnostics(),
35711
+ signal,
35712
+ refreshDiagnostics
35036
35713
  );
35037
35714
  const selected = harnesses.find(({ harnessId }) => harnessId === requestedHarness)?.harnessId ?? harnesses[0]?.harnessId ?? null;
35038
35715
  if (signal.aborted) throw new Error("Session import selection changed");
@@ -35083,7 +35760,7 @@ ${detail}` : ""}`
35083
35760
  load();
35084
35761
  hostButtons.find((button2) => button2.dataset.sessionImportHost === hostId2)?.focus();
35085
35762
  };
35086
- refresh.addEventListener("click", load);
35763
+ refresh.addEventListener("click", () => load(true));
35087
35764
  load();
35088
35765
  return void 0;
35089
35766
  }
@@ -35602,7 +36279,7 @@ ${detail}` : ""}`
35602
36279
  }
35603
36280
  function defaultImportName(source, existing) {
35604
36281
  const base = source.provider === "openai-codex" ? "codex" : "grok";
35605
- const used = new Set(existing.map((record15) => record15.name));
36282
+ const used = new Set(existing.map((record16) => record16.name));
35606
36283
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
35607
36284
  if (!used.has(base)) return base;
35608
36285
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -35625,7 +36302,7 @@ ${detail}` : ""}`
35625
36302
  const shown = (text) => accountDisplayText(text, hideEmails);
35626
36303
  const targetButtons = /* @__PURE__ */ new Map();
35627
36304
  const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
35628
- const sourceOf = (record15) => snapshot.sources.find((source) => source.id === record15.source.id);
36305
+ const sourceOf = (record16) => snapshot.sources.find((source) => source.id === record16.source.id);
35629
36306
  const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
35630
36307
  const compatibleSources = () => {
35631
36308
  const target = piTarget();
@@ -35663,7 +36340,7 @@ ${detail}` : ""}`
35663
36340
  sectionImport.addEventListener("click", () => {
35664
36341
  const sources = compatibleSources();
35665
36342
  const free = sources.find(
35666
- (source2) => !importedRecords().some((record15) => record15.source.id === source2.id)
36343
+ (source2) => !importedRecords().some((record16) => record16.source.id === source2.id)
35667
36344
  );
35668
36345
  const source = free ?? sources[0];
35669
36346
  if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
@@ -35713,30 +36390,30 @@ ${detail}` : ""}`
35713
36390
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
35714
36391
  return mark;
35715
36392
  };
35716
- const renderRow = (record15) => {
36393
+ const renderRow = (record16) => {
35717
36394
  const row = document2.createElement("div");
35718
36395
  row.className = "settings-pi-accounts__row";
35719
36396
  row.tabIndex = -1;
35720
- row.dataset.importName = record15.name;
35721
- row.setAttribute("aria-label", shown(record15.source.label));
35722
- const agent = record15.source.harnessId;
36397
+ row.dataset.importName = record16.name;
36398
+ row.setAttribute("aria-label", shown(record16.source.label));
36399
+ const agent = record16.source.harnessId;
35723
36400
  const mark = createMark(agent);
35724
36401
  const identity = document2.createElement("div");
35725
36402
  identity.className = "settings-pi-accounts__identity";
35726
36403
  const label = document2.createElement("strong");
35727
36404
  label.className = "settings-account-email";
35728
- label.textContent = shown(record15.source.label);
36405
+ label.textContent = shown(record16.source.label);
35729
36406
  label.title = label.textContent;
35730
36407
  label.translate = false;
35731
36408
  const meta3 = document2.createElement("div");
35732
36409
  meta3.className = "settings-account-metadata";
35733
- const source = sourceOf(record15);
36410
+ const source = sourceOf(record16);
35734
36411
  const parts = [
35735
36412
  metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
35736
- metaPart(`${record15.name}/\u2026`, void 0, true),
36413
+ metaPart(`${record16.name}/\u2026`, void 0, true),
35737
36414
  metaPart(messages.copied)
35738
36415
  ];
35739
- const time3 = formatImportedAt(record15.importedAt);
36416
+ const time3 = formatImportedAt(record16.importedAt);
35740
36417
  if (time3) parts.push(metaPart(time3));
35741
36418
  parts.forEach((part, index) => {
35742
36419
  if (index > 0) {
@@ -35753,23 +36430,23 @@ ${detail}` : ""}`
35753
36430
  reimport.type = "button";
35754
36431
  reimport.className = "settings-account-action";
35755
36432
  reimport.textContent = messages.rowReimport;
35756
- reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record15.source.label)}`);
36433
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record16.source.label)}`);
35757
36434
  reimport.disabled = busy || !source;
35758
36435
  reimport.title = messages.reimport;
35759
36436
  reimport.addEventListener("click", () => {
35760
- if (source) openDialog("reimport", { source, record: record15 }, `row:${record15.name}`);
36437
+ if (source) openDialog("reimport", { source, record: record16 }, `row:${record16.name}`);
35761
36438
  });
35762
36439
  const remove = document2.createElement("button");
35763
36440
  remove.type = "button";
35764
36441
  remove.className = "settings-account-action settings-pi-accounts__remove";
35765
36442
  remove.textContent = messages.rowRemove;
35766
- remove.setAttribute("aria-label", `${messages.remove}: ${shown(record15.source.label)}`);
36443
+ remove.setAttribute("aria-label", `${messages.remove}: ${shown(record16.source.label)}`);
35767
36444
  remove.disabled = busy;
35768
- remove.addEventListener("click", () => openDialog("remove", { record: record15 }, `row:${record15.name}`));
36445
+ remove.addEventListener("click", () => openDialog("remove", { record: record16 }, `row:${record16.name}`));
35769
36446
  if (source) actions.append(reimport);
35770
36447
  actions.append(remove);
35771
36448
  row.append(mark, identity, actions);
35772
- rows.set(record15.name, row);
36449
+ rows.set(record16.name, row);
35773
36450
  return row;
35774
36451
  };
35775
36452
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -35922,7 +36599,7 @@ ${detail}` : ""}`
35922
36599
  const label = document2.createElement("strong");
35923
36600
  label.textContent = shown(choice.label);
35924
36601
  label.translate = false;
35925
- const existing = importedRecords().find((record15) => record15.source.id === choice.id);
36602
+ const existing = importedRecords().find((record16) => record16.source.id === choice.id);
35926
36603
  const agent = choice.harnessId;
35927
36604
  const detail = document2.createElement("span");
35928
36605
  detail.textContent = [
@@ -35963,7 +36640,7 @@ ${detail}` : ""}`
35963
36640
  const name = request.action === "list" ? void 0 : request.name;
35964
36641
  state = {
35965
36642
  source: state.source,
35966
- record: importedRecords().find((record15) => record15.name === name) ?? state.record
36643
+ record: importedRecords().find((record16) => record16.name === name) ?? state.record
35967
36644
  };
35968
36645
  show(next);
35969
36646
  } else {
@@ -35977,12 +36654,12 @@ ${detail}` : ""}`
35977
36654
  sourceRadios = [];
35978
36655
  body.replaceChildren();
35979
36656
  controls.replaceChildren();
35980
- const { source, record: record15 } = state;
36657
+ const { source, record: record16 } = state;
35981
36658
  const close = () => modal.close();
35982
36659
  if (mode2 === "add" || mode2 === "reimport") {
35983
36660
  title.textContent = mode2 === "add" ? messages.add : messages.reimport;
35984
36661
  modal.setAttribute("aria-label", title.textContent);
35985
- const active = source ?? record15?.source;
36662
+ const active = source ?? record16?.source;
35986
36663
  const choices = mode2 === "add" && state.choose ? compatibleSources() : [];
35987
36664
  if (choices.length > 1) body.append(sourcePicker(choices));
35988
36665
  else if (active) body.append(line(messages.source, shown(active.label)));
@@ -35991,8 +36668,8 @@ ${detail}` : ""}`
35991
36668
  input.maxLength = 48;
35992
36669
  input.autocomplete = "off";
35993
36670
  input.spellcheck = false;
35994
- input.value = record15?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
35995
- input.readOnly = Boolean(record15);
36671
+ input.value = record16?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
36672
+ input.readOnly = Boolean(record16);
35996
36673
  input.addEventListener("input", () => {
35997
36674
  nameEdited = true;
35998
36675
  });
@@ -36026,7 +36703,7 @@ ${detail}` : ""}`
36026
36703
  {
36027
36704
  action: mode2 === "reimport" ? "reimport" : "import",
36028
36705
  sourceId: source2.id,
36029
- name: record15?.name ?? input.value,
36706
+ name: record16?.name ?? input.value,
36030
36707
  confirmed: true
36031
36708
  },
36032
36709
  "done"
@@ -36036,16 +36713,16 @@ ${detail}` : ""}`
36036
36713
  )
36037
36714
  );
36038
36715
  (mode2 === "add" ? input : controls.children[0]).focus();
36039
- } else if (mode2 === "remove" && record15) {
36716
+ } else if (mode2 === "remove" && record16) {
36040
36717
  title.textContent = messages.remove;
36041
36718
  modal.setAttribute("aria-label", title.textContent);
36042
- body.append(note(messages.removeWarning.replace("{name}", record15.name)));
36719
+ body.append(note(messages.removeWarning.replace("{name}", record16.name)));
36043
36720
  const cancel = command(messages.cancel, close);
36044
36721
  controls.append(
36045
36722
  cancel,
36046
36723
  command(
36047
36724
  messages.remove,
36048
- () => submit({ action: "remove", name: record15.name, confirmed: true }, null),
36725
+ () => submit({ action: "remove", name: record16.name, confirmed: true }, null),
36049
36726
  "danger"
36050
36727
  )
36051
36728
  );
@@ -36053,7 +36730,7 @@ ${detail}` : ""}`
36053
36730
  } else {
36054
36731
  title.textContent = messages.doneTitle;
36055
36732
  modal.setAttribute("aria-label", title.textContent);
36056
- const name = record15?.name;
36733
+ const name = record16?.name;
36057
36734
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
36058
36735
  body.append(note(messages.done));
36059
36736
  const done = command(messages.close, close, "primary");
@@ -36100,21 +36777,21 @@ ${detail}` : ""}`
36100
36777
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
36101
36778
  );
36102
36779
  if (!source || !target) return null;
36103
- const record15 = target.imports.find((candidate) => candidate.source.id === source.id);
36780
+ const record16 = target.imports.find((candidate) => candidate.source.id === source.id);
36104
36781
  const key = `${harnessId}:${accountLabel}:import`;
36105
36782
  const button2 = document2.createElement("button");
36106
36783
  button2.type = "button";
36107
36784
  button2.className = "settings-account-pi-import";
36108
36785
  button2.dataset.accountFocus = key;
36109
36786
  button2.disabled = busy;
36110
- const hint = record15 ? messages.importedHint.replace("{name}", record15.name) : messages.add;
36787
+ const hint = record16 ? messages.importedHint.replace("{name}", record16.name) : messages.add;
36111
36788
  button2.title = hint;
36112
36789
  button2.setAttribute("aria-label", hint);
36113
36790
  button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
36114
- if (record15) {
36791
+ if (record16) {
36115
36792
  button2.dataset.state = "imported";
36116
36793
  const name = document2.createElement("code");
36117
- name.textContent = `${record15.name}/\u2026`;
36794
+ name.textContent = `${record16.name}/\u2026`;
36118
36795
  name.translate = false;
36119
36796
  button2.append(name, createRendererSettingsIcon("check", 12));
36120
36797
  } else {
@@ -36122,7 +36799,7 @@ ${detail}` : ""}`
36122
36799
  button2.append(messages.add);
36123
36800
  }
36124
36801
  button2.addEventListener("click", () => {
36125
- if (!record15) {
36802
+ if (!record16) {
36126
36803
  openDialog("add", { source }, key);
36127
36804
  return;
36128
36805
  }
@@ -36131,7 +36808,7 @@ ${detail}` : ""}`
36131
36808
  renderSection();
36132
36809
  sectionToggle.setAttribute("aria-expanded", "true");
36133
36810
  }
36134
- const row = rows.get(record15.name);
36811
+ const row = rows.get(record16.name);
36135
36812
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
36136
36813
  row?.focus();
36137
36814
  });
@@ -42843,7 +43520,7 @@ th[aria-sort] .console-usage-sort__mark {
42843
43520
  place();
42844
43521
  const observer = ownerWindow ? new ownerWindow.MutationObserver((records) => {
42845
43522
  const titlebar = source?.closest("[data-app-shell-titlebar]");
42846
- if (!source?.isConnected || records.some((record15) => titlebar?.contains(record15.target))) {
43523
+ if (!source?.isConnected || records.some((record16) => titlebar?.contains(record16.target))) {
42847
43524
  place();
42848
43525
  }
42849
43526
  }) : null;
@@ -45159,6 +45836,7 @@ ${usage_default}`;
45159
45836
  });
45160
45837
  const mountedByComposer = /* @__PURE__ */ new Map();
45161
45838
  const catalogRequests = /* @__PURE__ */ new WeakMap();
45839
+ const draftUsageRequests = /* @__PURE__ */ new WeakMap();
45162
45840
  const pendingReplacements = /* @__PURE__ */ new Map();
45163
45841
  let disposed = false;
45164
45842
  const disposeReasoningSoftWrap = installReasoningTranscriptSoftWrap(document);
@@ -45292,7 +45970,7 @@ ${usage_default}`;
45292
45970
  for (const mounted of mountedByComposer.values()) {
45293
45971
  if (mounted.hostId !== hostId2) continue;
45294
45972
  renderMounted(mounted);
45295
- void refreshDraftCodexUsage(mounted);
45973
+ if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
45296
45974
  }
45297
45975
  });
45298
45976
  });
@@ -45475,36 +46153,59 @@ ${usage_default}`;
45475
46153
  renderMounted(mounted);
45476
46154
  }
45477
46155
  };
45478
- const refreshDraftCodexUsage = async (mounted) => {
46156
+ const refreshDraftUsage = async (mounted) => {
45479
46157
  const state = controller.get(mounted.composer);
45480
- if (state.agent !== "codex" || state.phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget))
46158
+ if (state.phase !== "draft" || controller.isSwitching(mounted.composer) || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget))
45481
46159
  return;
45482
- const accounts = composerCodexAccounts(mounted.composer);
45483
- const client = accounts?.client;
46160
+ const agent = state.agent;
46161
+ const accounts = agent === "codex" ? composerCodexAccounts(mounted.composer) : null;
45484
46162
  const accountId = accounts?.readyAccountId;
46163
+ const client = composerClient(mounted);
45485
46164
  const hostId2 = mounted.hostId;
46165
+ const previous = draftUsageRequests.get(mounted);
46166
+ if (agent !== "codex" && previous?.pending && previous.client === client && previous.generation === mounted.usageRequestGeneration)
46167
+ return;
45486
46168
  const generation = ++mounted.usageRequestGeneration;
46169
+ const request = { client, generation, pending: true };
46170
+ draftUsageRequests.set(mounted, request);
46171
+ mounted.draftUsageClient = null;
45487
46172
  mounted.usage = null;
45488
46173
  mounted.accountCredits = null;
46174
+ mounted.accountCreditsSupported = false;
45489
46175
  renderMounted(mounted);
45490
- if (!accountId || !client?.inspectCodexAccountUsage) return;
46176
+ const isCurrent = () => !disposed && mounted.hostId === hostId2 && composerClient(mounted) === client && mounted.composer.isConnected && mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation && controller.get(mounted.composer).agent === agent && controller.get(mounted.composer).phase === "draft" && !controller.isSwitching(mounted.composer) && !controller.isSubmissionPending(mounted.composer) && !threadIdFromComposerModelTarget(mounted.modelTarget);
45491
46177
  try {
45492
- const result = await client.inspectCodexAccountUsage({ accountId });
45493
- if (disposed || mounted.hostId !== hostId2 || composerCodexAccounts(mounted.composer) !== accounts || !mounted.composer.isConnected || mountedByComposer.get(mounted.composer) !== mounted || mounted.usageRequestGeneration !== generation || controller.get(mounted.composer).agent !== "codex" || controller.get(mounted.composer).phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget) || accounts.readyAccountId !== accountId || result.accountId !== accountId)
45494
- return;
45495
- mounted.usage = result.usage;
45496
- mounted.accountCredits = result.accountCredits ?? null;
46178
+ if (!client) return;
46179
+ if (agent === "codex") {
46180
+ if (!accountId || !client.inspectCodexAccountUsage) return;
46181
+ const result = await client.inspectCodexAccountUsage({ accountId });
46182
+ if (!isCurrent() || composerCodexAccounts(mounted.composer) !== accounts || accounts?.readyAccountId !== accountId || result.accountId !== accountId)
46183
+ return;
46184
+ mounted.usage = result.usage;
46185
+ mounted.accountCredits = result.accountCredits ?? null;
46186
+ } else {
46187
+ if (!client.inspectHarnessAccount) return;
46188
+ const result = await client.inspectHarnessAccount({
46189
+ harnessId: harnessIdSchema.parse(agent),
46190
+ refresh: true
46191
+ });
46192
+ if (!isCurrent() || result.harnessId !== agent) return;
46193
+ mounted.accountCredits = result.account?.credits ?? null;
46194
+ }
46195
+ mounted.draftUsageClient = client;
45497
46196
  renderMounted(mounted);
45498
46197
  } catch {
46198
+ } finally {
46199
+ request.pending = false;
45499
46200
  }
45500
46201
  };
45501
46202
  const refreshThreadUsage = async (mounted, refresh) => {
45502
46203
  const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
45503
- if (!threadId && controller.get(mounted.composer).agent === "codex") {
45504
- await refreshDraftCodexUsage(mounted);
46204
+ if (!threadId) {
46205
+ await refreshDraftUsage(mounted);
45505
46206
  return;
45506
46207
  }
45507
- if (!threadId || !modelControl) {
46208
+ if (!modelControl) {
45508
46209
  mounted.usage = null;
45509
46210
  mounted.accountCredits = null;
45510
46211
  usageRefreshAttempts.delete(mounted.composer);
@@ -46299,8 +47000,23 @@ ${usage_default}`;
46299
47000
  if (agent !== "codex" && composerAvailability(mounted)[agent] !== "ready") {
46300
47001
  return false;
46301
47002
  }
47003
+ const state = controller.get(mounted.composer);
47004
+ if (state.phase !== "draft" || controller.isSwitching(mounted.composer)) return false;
46302
47005
  controller.clearPendingSubmission(mounted.composer);
46303
- const composerId = controller.get(mounted.composer).composerId;
47006
+ const composerId = state.composerId;
47007
+ for (const candidate of mountedByComposer.values()) {
47008
+ if (controller.get(candidate.composer).composerId !== composerId) continue;
47009
+ candidate.usageRequestGeneration += 1;
47010
+ candidate.usage = null;
47011
+ candidate.accountCredits = null;
47012
+ candidate.accountCreditsSupported = false;
47013
+ usageRefreshAttempts.delete(candidate.composer);
47014
+ const timer = usageRefreshTimers.get(candidate.composer);
47015
+ if (timer !== void 0) {
47016
+ window.clearTimeout(timer);
47017
+ usageRefreshTimers.delete(candidate.composer);
47018
+ }
47019
+ }
46304
47020
  controller.invalidateModelRequests(mounted.composer);
46305
47021
  const switching = controller.switchAgent(mounted.composer, agent, {
46306
47022
  applyAgent: (nextAgent) => applyDraftAgentCarrier(mounted.composer, nextAgent),
@@ -46328,7 +47044,9 @@ ${usage_default}`;
46328
47044
  return false;
46329
47045
  } finally {
46330
47046
  for (const candidate of mountedByComposer.values()) {
46331
- if (controller.get(candidate.composer).composerId === composerId) renderMounted(candidate);
47047
+ if (controller.get(candidate.composer).composerId !== composerId) continue;
47048
+ renderMounted(candidate);
47049
+ void refreshDraftUsage(candidate);
46332
47050
  }
46333
47051
  }
46334
47052
  };
@@ -46343,7 +47061,7 @@ ${usage_default}`;
46343
47061
  for (const mounted of mountedByComposer.values()) {
46344
47062
  if (mounted.hostId !== hostId2) continue;
46345
47063
  renderMounted(mounted);
46346
- void refreshDraftCodexUsage(mounted);
47064
+ if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
46347
47065
  }
46348
47066
  })
46349
47067
  );
@@ -46557,6 +47275,7 @@ ${usage_default}`;
46557
47275
  void clearDraftPrewarm(mounted.composer).catch(() => void 0);
46558
47276
  }
46559
47277
  void loadExternalCatalog(mounted);
47278
+ void refreshDraftUsage(mounted);
46560
47279
  continue;
46561
47280
  }
46562
47281
  const target = controllerTarget(mounted.modelTarget, hostId2);
@@ -46585,11 +47304,18 @@ ${usage_default}`;
46585
47304
  }
46586
47305
  if (changed) sidebarAgentIcons.refresh();
46587
47306
  };
46588
- function reconcileHarnessAvailabilityHost() {
47307
+ function reconcileHarnessAvailabilityHost(retryDraftUsage = false) {
46589
47308
  for (const hostId3 of modelControl?.knownHostIds?.() ?? []) {
46590
47309
  hostHarnessAvailabilityState(hostId3);
46591
47310
  }
46592
47311
  reloadMountedOwnershipForHost();
47312
+ for (const mounted of mountedByComposer.values()) {
47313
+ const client = composerClient(mounted);
47314
+ const request = draftUsageRequests.get(mounted);
47315
+ if (controller.get(mounted.composer).agent !== "codex" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
47316
+ void refreshDraftUsage(mounted);
47317
+ }
47318
+ }
46593
47319
  let connectionsChanged = false;
46594
47320
  for (const target of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
46595
47321
  if (!target) continue;
@@ -46808,6 +47534,7 @@ ${usage_default}`;
46808
47534
  accountCreditsSupported: inherited?.accountCreditsSupported ?? false,
46809
47535
  hostId: inherited?.hostId ?? hostId2,
46810
47536
  usageRequestGeneration: 0,
47537
+ draftUsageClient: null,
46811
47538
  commandRequestGeneration: 0
46812
47539
  };
46813
47540
  mountedByComposer.set(composer, mounted);
@@ -46827,7 +47554,7 @@ ${usage_default}`;
46827
47554
  } else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
46828
47555
  void loadExternalCatalog(mounted);
46829
47556
  }
46830
- if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftCodexUsage(mounted);
47557
+ if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftUsage(mounted);
46831
47558
  void refreshCommands(mounted);
46832
47559
  };
46833
47560
  const scan = () => {
@@ -46908,6 +47635,7 @@ ${usage_default}`;
46908
47635
  }
46909
47636
  pendingReplacements.clear();
46910
47637
  questions.refreshContext();
47638
+ backgroundActivity.refreshContext();
46911
47639
  };
46912
47640
  const scheduleScan = (refreshTargets = false) => {
46913
47641
  refreshTargetsOnNextScan ||= refreshTargets;
@@ -47107,7 +47835,7 @@ ${usage_default}`;
47107
47835
  document.addEventListener("keydown", onKeyDown, true);
47108
47836
  document.addEventListener("click", onClick, true);
47109
47837
  const onWindowFocus = () => {
47110
- reconcileHarnessAvailabilityHost();
47838
+ reconcileHarnessAvailabilityHost(true);
47111
47839
  void loadCodexAccounts();
47112
47840
  for (const mounted of mountedByComposer.values()) {
47113
47841
  if (mounted.hostId === activeModelHostId(mounted.composer) && mounted.ownershipStatus === "error") {
@@ -47208,16 +47936,18 @@ ${usage_default}`;
47208
47936
  const connectedComposers = () => [...mountedByComposer.values()].filter(
47209
47937
  (mounted) => isMountedComposer(mounted.composer) && mounted.control.root.isConnected
47210
47938
  );
47211
- const questions = installRendererQuestions(window, () => {
47212
- const visible = connectedComposers().filter(
47939
+ const readActivityContext = () => {
47940
+ const visible2 = connectedComposers().filter(
47213
47941
  (mounted2) => mounted2.composer.getClientRects().length > 0 && window.getComputedStyle(mounted2.composer).visibility === "visible" && !mounted2.composer.closest('[hidden], [inert], [aria-hidden="true"]') && controller.get(mounted2.composer).agent !== "codex"
47214
47942
  );
47215
- const mounted = visible.length === 1 ? visible[0] : void 0;
47943
+ const mounted = visible2.length === 1 ? visible2[0] : void 0;
47216
47944
  const threadId = mounted ? threadIdFromComposerModelTarget(findComposerModelTarget(mounted.composer)) : null;
47217
47945
  const hostId2 = mounted?.hostId;
47218
47946
  const route = hostId2 ? window.__codexhostHostRoutingV1?.forHost(hostId2) : null;
47219
47947
  return mounted && threadId && hostId2 && route ? { hostId: hostId2, threadId, composer: mounted.composer, route: route.manager } : null;
47220
- });
47948
+ };
47949
+ const questions = installRendererQuestions(window, readActivityContext);
47950
+ const backgroundActivity = installRendererBackgroundActivity(window, readActivityContext);
47221
47951
  const api = {
47222
47952
  remoteConnections: (request) => handleRemoteConnectionsRequest(remoteConnections, request),
47223
47953
  currentThreadId() {
@@ -47305,12 +48035,14 @@ ${usage_default}`;
47305
48035
  for (const mounted of mountedByComposer.values()) {
47306
48036
  renderMounted(mounted);
47307
48037
  void refreshCommands(mounted);
48038
+ if (controller.get(mounted.composer).agent !== "codex") void refreshDraftUsage(mounted);
47308
48039
  }
47309
48040
  },
47310
48041
  dispose() {
47311
48042
  if (disposed) return;
47312
48043
  disposed = true;
47313
48044
  questions.dispose();
48045
+ backgroundActivity.dispose();
47314
48046
  usageNotificationDispose();
47315
48047
  adapterDispose?.();
47316
48048
  adapterDispose = null;
@@ -47518,8 +48250,8 @@ ${usage_default}`;
47518
48250
  // src/renderer-voice-capability.ts
47519
48251
  var GLOBAL = "__codexhostVoiceCapabilityV1";
47520
48252
  var INFERENCE_GATE = "3683713372";
47521
- var record11 = (value) => value !== null && typeof value === "object";
47522
- var capable = (value) => record11(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
48253
+ var record12 = (value) => value !== null && typeof value === "object";
48254
+ var capable = (value) => record12(value) && typeof value.isLoading === "boolean" && typeof value.isError === "boolean" && typeof value.isCapable === "boolean";
47523
48255
  var equal = (a, b) => a.isLoading === b.isLoading && a.isError === b.isError && a.isCapable === b.isCapable;
47524
48256
  function replayVoiceCapability(store, atom, gate) {
47525
48257
  const evaluate = (override) => {
@@ -47557,7 +48289,7 @@ ${usage_default}`;
47557
48289
  }
47558
48290
  }
47559
48291
  function isFamily(value) {
47560
- return record11(value) && record11(value.scope) && typeof value.resolve === "function";
48292
+ return record12(value) && record12(value.scope) && typeof value.resolve === "function";
47561
48293
  }
47562
48294
  function initializeVoiceCapabilityFamilies(module, assets) {
47563
48295
  const initialize = module[assets.capabilityInit];
@@ -47573,7 +48305,7 @@ ${usage_default}`;
47573
48305
  const result = [];
47574
48306
  const seen = /* @__PURE__ */ new Set();
47575
48307
  let hook = fiber.memoizedState;
47576
- while (record11(hook) && result.length < 4096 && !seen.has(hook)) {
48308
+ while (record12(hook) && result.length < 4096 && !seen.has(hook)) {
47577
48309
  seen.add(hook);
47578
48310
  result.push(hook);
47579
48311
  hook = hook.next;
@@ -47589,7 +48321,7 @@ ${usage_default}`;
47589
48321
  let root = ancestors2[0];
47590
48322
  if (chat) {
47591
48323
  const owners = ancestors2.filter(
47592
- ({ memoizedProps: props }) => record11(props) && props.isWorkConversation === false && props.isTemporaryChat === false && props.shouldBlockExternalEgress === false && props.readOnly !== true && typeof props.conversationId === "string" && record11(props.composerSelectionContext) && props.composerSelectionContext.conversationId === props.conversationId
48324
+ ({ memoizedProps: props }) => record12(props) && props.isWorkConversation === false && props.isTemporaryChat === false && props.shouldBlockExternalEgress === false && props.readOnly !== true && typeof props.conversationId === "string" && record12(props.composerSelectionContext) && props.composerSelectionContext.conversationId === props.conversationId
47593
48325
  );
47594
48326
  if (owners.length !== 1) return fibers;
47595
48327
  root = owners[0];
@@ -47601,7 +48333,7 @@ ${usage_default}`;
47601
48333
  const ancestors3 = committedReactAncestors(Object.getOwnPropertyDescriptor(element, key)?.value);
47602
48334
  const boundary = ancestors3.indexOf(root);
47603
48335
  if (boundary < 0) continue;
47604
- for (const fiber of ancestors3.slice(0, boundary + 1)) if (record11(fiber)) fibers.add(fiber);
48336
+ for (const fiber of ancestors3.slice(0, boundary + 1)) if (record12(fiber)) fibers.add(fiber);
47605
48337
  }
47606
48338
  return fibers;
47607
48339
  }
@@ -47622,7 +48354,7 @@ ${usage_default}`;
47622
48354
  const list = hooks(fiber);
47623
48355
  for (const memo of list) {
47624
48356
  const [signal, deps] = Array.isArray(memo.memoizedState) ? memo.memoizedState : [];
47625
- if (!record11(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
48357
+ if (!record12(signal) || !Array.isArray(deps) || deps.length !== 5 || deps[3] !== family || !(deps[1] instanceof Map) || deps[2] !== void 0)
47626
48358
  continue;
47627
48359
  const chain = deps[1];
47628
48360
  const node = chain.get(family.scope.id);
@@ -47631,7 +48363,7 @@ ${usage_default}`;
47631
48363
  const matches = [...members].filter(([, member]) => member.cacheKey === deps[0]);
47632
48364
  if (matches.length !== 1 || typeof matches[0]?.[0] !== "string") continue;
47633
48365
  const parameter = JSON.parse(matches[0][0]);
47634
- if (!record11(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")
48366
+ if (!record12(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")
47635
48367
  continue;
47636
48368
  const subscriptions = list.filter((hook2) => {
47637
48369
  const state = hook2.memoizedState;
@@ -47644,7 +48376,7 @@ ${usage_default}`;
47644
48376
  const effect = hook.next?.next?.memoizedState;
47645
48377
  const store = signal.store;
47646
48378
  const gate = gates.resolve(node, chain, INFERENCE_GATE)?.atom;
47647
- if (!gate || !instance || !record11(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(
48379
+ if (!gate || !instance || !record12(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(
47648
48380
  store.get(signal.atom),
47649
48381
  subscriber.getSnapshot()
47650
48382
  ) || !equal(subscriber.getSnapshot(), instance.getSnapshot()) || subscriber.createRender?.() != null)
@@ -47756,7 +48488,7 @@ ${usage_default}`;
47756
48488
  target[GLOBAL] = handle;
47757
48489
  const hookActive = (key) => {
47758
48490
  const hook = target[key];
47759
- return record11(hook) && hook.status === "active";
48491
+ return record12(hook) && hook.status === "active";
47760
48492
  };
47761
48493
  const currentRoute = () => {
47762
48494
  try {
@@ -47832,7 +48564,7 @@ ${usage_default}`;
47832
48564
  }
47833
48565
 
47834
48566
  // src/renderer-voice-settings-availability.ts
47835
- var record12 = (value) => value !== null && typeof value === "object";
48567
+ var record13 = (value) => value !== null && typeof value === "object";
47836
48568
  function voiceSettingsSurface(doc, page, appScope) {
47837
48569
  const pages = /* @__PURE__ */ new Set();
47838
48570
  const fibers = /* @__PURE__ */ new Set();
@@ -47855,8 +48587,8 @@ ${usage_default}`;
47855
48587
  const scopes = /* @__PURE__ */ new Map();
47856
48588
  for (const fiber of fibers)
47857
48589
  for (const hook of hooks(fiber)) {
47858
- const scope2 = record12(hook.memoizedState) ? hook.memoizedState.current : void 0;
47859
- if (record12(scope2) && scope2.scope === appScope && record12(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(appScope.id) === scope2.node && typeof scope2.get === "function")
48590
+ const scope2 = record13(hook.memoizedState) ? hook.memoizedState.current : void 0;
48591
+ if (record13(scope2) && scope2.scope === appScope && record13(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(appScope.id) === scope2.node && typeof scope2.get === "function")
47860
48592
  scopes.set(scope2.node, scope2);
47861
48593
  }
47862
48594
  const scope = [...scopes.values()][0];
@@ -47900,7 +48632,7 @@ ${usage_default}`;
47900
48632
  for (const fiber of currentFibers())
47901
48633
  for (const hook2 of hooks(fiber)) {
47902
48634
  const [subscriber2, deps] = Array.isArray(hook2.memoizedState) ? hook2.memoizedState : [];
47903
- if (!record12(subscriber2) || typeof subscriber2.getSnapshot !== "function" || !Array.isArray(deps) || deps.length !== 2 || deps[0] !== store || !record12(deps[1]) || typeof deps[1].read !== "function")
48635
+ if (!record13(subscriber2) || typeof subscriber2.getSnapshot !== "function" || !Array.isArray(deps) || deps.length !== 2 || deps[0] !== store || !record13(deps[1]) || typeof deps[1].read !== "function")
47904
48636
  continue;
47905
48637
  const atom2 = deps[1];
47906
48638
  if (availability(store, atom2, voice, gate) === true)
@@ -47913,7 +48645,7 @@ ${usage_default}`;
47913
48645
  const instance = hook.next?.queue;
47914
48646
  const effect = hook.next?.next?.memoizedState;
47915
48647
  const native = store.get(atom);
47916
- if (!instance || typeof instance.getSnapshot !== "function" || !record12(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)
48648
+ if (!instance || typeof instance.getSnapshot !== "function" || !record13(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)
47917
48649
  throw new Error("Unsupported Settings availability subscription");
47918
48650
  for (const [object3, key] of [
47919
48651
  [store, "sub"],
@@ -47972,7 +48704,7 @@ ${usage_default}`;
47972
48704
  }
47973
48705
 
47974
48706
  // src/renderer-dictation-settings.ts
47975
- var record13 = (value) => value !== null && typeof value === "object";
48707
+ var record14 = (value) => value !== null && typeof value === "object";
47976
48708
  var mode = (value) => value === null || value === "os-global" || value === "app";
47977
48709
  function replayDictationSettingsMode(store, atom, capabilities, gate) {
47978
48710
  try {
@@ -48015,7 +48747,7 @@ ${usage_default}`;
48015
48747
  function bindDictationSettingsMode(currentFibers, store, atom, capabilities, gate, allowed) {
48016
48748
  const readers = () => [...currentFibers()].flatMap(hooks).filter((hook) => {
48017
48749
  const [subscriber, deps] = Array.isArray(hook.memoizedState) ? hook.memoizedState : [];
48018
- return record13(subscriber) && typeof subscriber.getSnapshot === "function" && Array.isArray(deps) && deps.length === 2 && deps[0] === store && deps[1] === atom;
48750
+ return record14(subscriber) && typeof subscriber.getSnapshot === "function" && Array.isArray(deps) && deps.length === 2 && deps[0] === store && deps[1] === atom;
48019
48751
  });
48020
48752
  const subscriptions = readers();
48021
48753
  if (!subscriptions.length || replayDictationSettingsMode(store, atom, capabilities, gate) === void 0)
@@ -48028,7 +48760,7 @@ ${usage_default}`;
48028
48760
  const instance = hook.next?.queue;
48029
48761
  const effect = hook.next?.next?.memoizedState;
48030
48762
  const native = store.get(atom);
48031
- if (!instance || typeof instance.getSnapshot !== "function" || !record13(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)
48763
+ if (!instance || typeof instance.getSnapshot !== "function" || !record14(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)
48032
48764
  throw new Error("Unsupported Settings dictation mode subscription");
48033
48765
  for (const [object3, key] of [
48034
48766
  [store, "sub"],
@@ -48100,8 +48832,8 @@ ${usage_default}`;
48100
48832
  var MESSAGE_ID = "settings.general.realtimeVoice.unavailable.description";
48101
48833
  var LABEL = "Voice settings unavailable with this provider";
48102
48834
  var DESCRIPTION = "Your account allows voice chat. These Desktop settings require the default inference provider. Start ChatGPT Chat voice from the Chat composer.";
48103
- var record14 = (value) => value !== null && typeof value === "object";
48104
- var settled = (value, isCapable) => record14(value) && value.isLoading === false && value.isError === false && value.isCapable === isCapable;
48835
+ var record15 = (value) => value !== null && typeof value === "object";
48836
+ var settled = (value, isCapable) => record15(value) && value.isLoading === false && value.isError === false && value.isCapable === isCapable;
48105
48837
  function realtimeAtoms(scope, modules) {
48106
48838
  const atom = modules.capability.resolve(scope.node, scope.chain, { name: "voice.realtime" }).resolve(scope.node, scope.chain);
48107
48839
  return {
@@ -48112,7 +48844,7 @@ ${usage_default}`;
48112
48844
  function providerBlocksVoiceSettings(scope, modules) {
48113
48845
  try {
48114
48846
  const access = scope.get(modules.access);
48115
- if (!record14(access) || access.status !== "allowed" || !settled(scope.get(modules.capability, { name: "voice" }), true) || !settled(scope.get(modules.capability, { name: "voice.realtime" }), false))
48847
+ if (!record15(access) || access.status !== "allowed" || !settled(scope.get(modules.capability, { name: "voice" }), true) || !settled(scope.get(modules.capability, { name: "voice.realtime" }), false))
48116
48848
  return false;
48117
48849
  const { atom, gate } = realtimeAtoms(scope, modules);
48118
48850
  return replayVoiceCapability(scope.node.store, atom, gate)?.isCapable === true;
@@ -48130,10 +48862,10 @@ ${usage_default}`;
48130
48862
  );
48131
48863
  if (!ancestors2.some((fiber) => fiber.type === modules.page)) continue;
48132
48864
  const owner = ancestors2.find(
48133
- ({ memoizedProps: props2 }) => record14(props2) && record14(props2.description) && record14(props2.description.props) && props2.description.props.id === MESSAGE_ID && props2.control === null
48865
+ ({ memoizedProps: props2 }) => record15(props2) && record15(props2.description) && record15(props2.description.props) && props2.description.props.id === MESSAGE_ID && props2.control === null
48134
48866
  );
48135
48867
  const props = owner?.memoizedProps;
48136
- if (!record14(props) || !record14(props.description) || !record14(props.description.props) || !record14(props.label) || !record14(props.label.props) || element.textContent !== props.description.props.defaultMessage)
48868
+ if (!record15(props) || !record15(props.description) || !record15(props.description.props) || !record15(props.label) || !record15(props.label.props) || element.textContent !== props.description.props.defaultMessage)
48137
48869
  continue;
48138
48870
  const labelText = props.label.props.defaultMessage;
48139
48871
  if (typeof labelText !== "string") continue;
@@ -48150,10 +48882,10 @@ ${usage_default}`;
48150
48882
  for (const fiber of ancestors2) {
48151
48883
  let hook = fiber.memoizedState;
48152
48884
  const seen = /* @__PURE__ */ new Set();
48153
- while (record14(hook) && seen.size < 4096 && !seen.has(hook)) {
48885
+ while (record15(hook) && seen.size < 4096 && !seen.has(hook)) {
48154
48886
  seen.add(hook);
48155
- const scope2 = record14(hook.memoizedState) ? hook.memoizedState.current : void 0;
48156
- if (record14(scope2) && scope2.scope === modules.appScope && record14(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(modules.appScope.id) === scope2.node && typeof scope2.get === "function")
48887
+ const scope2 = record15(hook.memoizedState) ? hook.memoizedState.current : void 0;
48888
+ if (record15(scope2) && scope2.scope === modules.appScope && record15(scope2.node) && scope2.chain instanceof Map && scope2.chain.get(modules.appScope.id) === scope2.node && typeof scope2.get === "function")
48157
48889
  scopes.set(scope2.node, scope2);
48158
48890
  hook = hook.next;
48159
48891
  }
@@ -48310,18 +49042,19 @@ ${usage_default}`;
48310
49042
  )
48311
49043
  );
48312
49044
  if (disposed) return;
48313
- const latest = assets.version === NATIVE_CHAT_VOICE_VERSION;
48314
- const initialize = latest ? initial.N4n : initial.l0n;
49045
+ const modern = assets.version === "26.1027.61615";
49046
+ const latest = assets.version === "26.1023.51421";
49047
+ const initialize = modern ? initial.Ler : latest ? initial.N4n : initial.l0n;
48315
49048
  if (typeof initialize !== "function" || typeof settings.VoiceSettings !== "function")
48316
49049
  return;
48317
49050
  initialize();
48318
- const dictationMode = latest ? initial.KG : initial.mW;
49051
+ const dictationMode = modern ? initial.UO : latest ? initial.KG : initial.mW;
48319
49052
  modules = {
48320
- appScope: latest ? shared.uct : shared.Bst,
49053
+ appScope: modern ? shared.klt : latest ? shared.uct : shared.Bst,
48321
49054
  page: settings.VoiceSettings,
48322
- access: latest ? initial.yer : initial.k5n,
48323
- capability: latest ? initial.M4n : initial.c0n,
48324
- gates: latest ? initial.Par : initial.Cnr,
49055
+ access: modern ? initial.Dsr : latest ? initial.yer : initial.k5n,
49056
+ capability: modern ? initial.Ier : latest ? initial.M4n : initial.c0n,
49057
+ gates: modern ? initial.Vfr : latest ? initial.Par : initial.Cnr,
48325
49058
  ...dictationMode ? { dictationMode } : {}
48326
49059
  };
48327
49060
  }