@karlorz/codexhost-cli-win32-x64 0.17.1-0 → 0.17.4-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.
@@ -15103,49 +15103,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15103
15103
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15104
15104
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15105
15105
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15106
- }).strict().superRefine((usage, context) => {
15106
+ }).strict().superRefine((usage, context2) => {
15107
15107
  if (Object.keys(usage).length === 0) {
15108
- context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
15108
+ context2.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
15109
15109
  }
15110
15110
  const hasContextUsed = usage.contextUsedTokens !== void 0;
15111
15111
  const hasContextWindow = usage.contextWindowTokens !== void 0;
15112
15112
  if (hasContextUsed !== hasContextWindow) {
15113
- context.addIssue({
15113
+ context2.addIssue({
15114
15114
  code: "custom",
15115
15115
  message: "Thread Usage context fields must be provided together",
15116
15116
  path: [hasContextUsed ? "contextWindowTokens" : "contextUsedTokens"]
15117
15117
  });
15118
15118
  }
15119
15119
  if (usage.contextWindowTokens === 0) {
15120
- context.addIssue({
15120
+ context2.addIssue({
15121
15121
  code: "custom",
15122
15122
  message: "Thread Usage contextWindowTokens must be greater than zero",
15123
15123
  path: ["contextWindowTokens"]
15124
15124
  });
15125
15125
  }
15126
15126
  if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
15127
- context.addIssue({
15127
+ context2.addIssue({
15128
15128
  code: "custom",
15129
15129
  message: "Thread Usage costSource must be provided with totalCostUsd",
15130
15130
  path: ["costSource"]
15131
15131
  });
15132
15132
  }
15133
15133
  if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
15134
- context.addIssue({
15134
+ context2.addIssue({
15135
15135
  code: "custom",
15136
15136
  message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
15137
15137
  path: ["unpricedModels"]
15138
15138
  });
15139
15139
  }
15140
15140
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
15141
- context.addIssue({
15141
+ context2.addIssue({
15142
15142
  code: "custom",
15143
15143
  message: "Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent",
15144
15144
  path: ["planFiveHourResetsAtUnix"]
15145
15145
  });
15146
15146
  }
15147
15147
  if (usage.planSevenDayResetsAtUnix !== void 0 && usage.planSevenDayUsedPercent === void 0) {
15148
- context.addIssue({
15148
+ context2.addIssue({
15149
15149
  code: "custom",
15150
15150
  message: "Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent",
15151
15151
  path: ["planSevenDayResetsAtUnix"]
@@ -15253,10 +15253,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15253
15253
 
15254
15254
  // ../shared-contracts/dist/json-value.js
15255
15255
  function rejectExplicitUndefined(keys) {
15256
- return (value, context) => {
15256
+ return (value, context2) => {
15257
15257
  for (const key of keys) {
15258
15258
  if (Object.hasOwn(value, key) && value[key] === void 0) {
15259
- context.addIssue({
15259
+ context2.addIssue({
15260
15260
  code: "custom",
15261
15261
  path: [key],
15262
15262
  message: "Explicit undefined is not valid JSON"
@@ -15340,11 +15340,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15340
15340
  var harnessPermissionModeCatalogSchema = external_exports.object({
15341
15341
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
15342
15342
  defaultModeId: harnessPermissionModeIdSchema
15343
- }).strict().superRefine((catalog, context) => {
15343
+ }).strict().superRefine((catalog, context2) => {
15344
15344
  const ids = /* @__PURE__ */ new Set();
15345
15345
  for (const [index, mode2] of catalog.modes.entries()) {
15346
15346
  if (ids.has(mode2.id)) {
15347
- context.addIssue({
15347
+ context2.addIssue({
15348
15348
  code: "custom",
15349
15349
  message: "Permission Mode IDs must be unique",
15350
15350
  path: ["modes", index, "id"]
@@ -15353,7 +15353,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15353
15353
  ids.add(mode2.id);
15354
15354
  }
15355
15355
  if (!ids.has(catalog.defaultModeId)) {
15356
- context.addIssue({
15356
+ context2.addIssue({
15357
15357
  code: "custom",
15358
15358
  message: "Default Permission Mode must exist in the catalog",
15359
15359
  path: ["defaultModeId"]
@@ -15396,11 +15396,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15396
15396
  return void 0;
15397
15397
  return catalog?.models.find((model2) => model2.ref.id === ref.id || model2.fastModel?.id === ref.id);
15398
15398
  }
15399
- var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
15399
+ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context2) => {
15400
15400
  const ids = /* @__PURE__ */ new Set();
15401
15401
  for (const [index, option] of options.entries()) {
15402
15402
  if (ids.has(option.id)) {
15403
- context.addIssue({
15403
+ context2.addIssue({
15404
15404
  code: "custom",
15405
15405
  message: "Thinking option IDs must be unique",
15406
15406
  path: [index, "id"]
@@ -15414,12 +15414,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15414
15414
  defaultModel: harnessModelRefSchema.optional(),
15415
15415
  thinkingOptions: harnessThinkingOptionsSchema,
15416
15416
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
15417
- }).strict().superRefine((catalog, context) => {
15417
+ }).strict().superRefine((catalog, context2) => {
15418
15418
  const refs = /* @__PURE__ */ new Set();
15419
15419
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
15420
15420
  for (const [index, model2] of catalog.models.entries()) {
15421
15421
  if (refs.has(model2.ref.id)) {
15422
- context.addIssue({
15422
+ context2.addIssue({
15423
15423
  code: "custom",
15424
15424
  message: "Model Catalog refs must be unique",
15425
15425
  path: ["models", index, "ref", "id"]
@@ -15428,7 +15428,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15428
15428
  refs.add(model2.ref.id);
15429
15429
  if (model2.fastModel) {
15430
15430
  if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15431
- context.addIssue({
15431
+ context2.addIssue({
15432
15432
  code: "custom",
15433
15433
  message: "Fast Model refs must be distinct and unique",
15434
15434
  path: ["models", index, "fastModel"]
@@ -15439,7 +15439,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15439
15439
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15440
15440
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
15441
15441
  if (supportedThinkingIds.has(optionId)) {
15442
- context.addIssue({
15442
+ context2.addIssue({
15443
15443
  code: "custom",
15444
15444
  message: "Supported Thinking option IDs must be unique per Model",
15445
15445
  path: ["models", index, "supportedThinkingOptionIds", optionIndex]
@@ -15447,7 +15447,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15447
15447
  }
15448
15448
  supportedThinkingIds.add(optionId);
15449
15449
  if (!thinkingIds.has(optionId)) {
15450
- context.addIssue({
15450
+ context2.addIssue({
15451
15451
  code: "custom",
15452
15452
  message: "Supported Thinking option must exist in the catalog",
15453
15453
  path: ["models", index, "supportedThinkingOptionIds", optionIndex]
@@ -15456,14 +15456,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15456
15456
  }
15457
15457
  }
15458
15458
  if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
15459
- context.addIssue({
15459
+ context2.addIssue({
15460
15460
  code: "custom",
15461
15461
  message: "Default Model must exist in the Model Catalog",
15462
15462
  path: ["defaultModel", "id"]
15463
15463
  });
15464
15464
  }
15465
15465
  if (catalog.defaultThinkingOptionId && !thinkingIds.has(catalog.defaultThinkingOptionId)) {
15466
- context.addIssue({
15466
+ context2.addIssue({
15467
15467
  code: "custom",
15468
15468
  message: "Default Thinking option must exist in the catalog",
15469
15469
  path: ["defaultThinkingOptionId"]
@@ -15508,9 +15508,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15508
15508
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15509
15509
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15510
15510
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
15511
- }).strict().superRefine((state, context) => {
15511
+ }).strict().superRefine((state, context2) => {
15512
15512
  if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
15513
- context.addIssue({
15513
+ context2.addIssue({
15514
15514
  code: "custom",
15515
15515
  message: "Effective Thinking option must be currently available",
15516
15516
  path: ["effectiveThinkingOptionId"]
@@ -15527,10 +15527,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15527
15527
  permissionModes: harnessPermissionModeCatalogSchema.optional(),
15528
15528
  capabilities: harnessSessionCapabilitiesSchema,
15529
15529
  webUi: harnessWebUiCapabilitySchema.optional()
15530
- }).strict().superRefine((inspection, context) => {
15530
+ }).strict().superRefine((inspection, context2) => {
15531
15531
  const selectable = inspection.capabilities.configuration.selectPermissionMode;
15532
15532
  if (selectable !== Boolean(inspection.permissionModes)) {
15533
- context.addIssue({
15533
+ context2.addIssue({
15534
15534
  code: "custom",
15535
15535
  message: "Permission Mode catalog and capability must agree",
15536
15536
  path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
@@ -15592,11 +15592,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15592
15592
  ]);
15593
15593
  var threadOwnershipListParamsSchema = external_exports.object({
15594
15594
  threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15595
- }).strict().superRefine(({ threadIds }, context) => {
15595
+ }).strict().superRefine(({ threadIds }, context2) => {
15596
15596
  const seen = /* @__PURE__ */ new Set();
15597
15597
  for (const [index, threadId] of threadIds.entries()) {
15598
15598
  if (seen.has(threadId)) {
15599
- context.addIssue({
15599
+ context2.addIssue({
15600
15600
  code: "custom",
15601
15601
  message: "Thread ownership-list IDs must be unique",
15602
15602
  path: ["threadIds", index]
@@ -15620,11 +15620,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15620
15620
  ]);
15621
15621
  var threadOwnershipListResultSchema = external_exports.object({
15622
15622
  threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15623
- }).strict().superRefine(({ threads }, context) => {
15623
+ }).strict().superRefine(({ threads }, context2) => {
15624
15624
  const seen = /* @__PURE__ */ new Set();
15625
15625
  for (const [index, thread] of threads.entries()) {
15626
15626
  if (seen.has(thread.threadId)) {
15627
- context.addIssue({
15627
+ context2.addIssue({
15628
15628
  code: "custom",
15629
15629
  message: "Thread ownership-list results must be unique",
15630
15630
  path: ["threads", index, "threadId"]
@@ -15639,6 +15639,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15639
15639
  text: external_exports.string().optional()
15640
15640
  }).strict();
15641
15641
  var THREAD_STEER_DELIVERY_PARAM = "codexhostSteerDelivery";
15642
+ var THREAD_STEERING_CONTEXT_PARAM = "codexhost_external_steering";
15643
+ var threadSteeringContextSchema = external_exports.object({
15644
+ kind: external_exports.literal("application"),
15645
+ value: external_exports.string().transform((text, context2) => {
15646
+ try {
15647
+ return JSON.parse(text);
15648
+ } catch {
15649
+ context2.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15650
+ return external_exports.NEVER;
15651
+ }
15652
+ }).pipe(external_exports.object({
15653
+ expectedTurnId: hostTurnIdSchema,
15654
+ clientUserMessageId: external_exports.string().min(1),
15655
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15656
+ }).strict())
15657
+ }).strict().transform((context2) => context2.value);
15642
15658
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15643
15659
  var threadSteeringInspectResultSchema = external_exports.object({
15644
15660
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -15967,11 +15983,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15967
15983
  * Omitted by Adapters; set by the Host on inspection results.
15968
15984
  */
15969
15985
  source: external_exports.enum(["live", "static"]).optional()
15970
- }).strict().superRefine((catalog, context) => {
15986
+ }).strict().superRefine((catalog, context2) => {
15971
15987
  const ids = /* @__PURE__ */ new Set();
15972
15988
  for (const [index, command] of catalog.commands.entries()) {
15973
15989
  if (ids.has(command.id)) {
15974
- context.addIssue({
15990
+ context2.addIssue({
15975
15991
  code: "custom",
15976
15992
  message: "Harness command IDs must be unique",
15977
15993
  path: ["commands", index, "id"]
@@ -16094,9 +16110,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16094
16110
  downloadedBytes: external_exports.number().int().nonnegative().optional(),
16095
16111
  totalBytes: external_exports.number().int().positive().optional(),
16096
16112
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
16097
- }).superRefine((status, context) => {
16113
+ }).superRefine((status, context2) => {
16098
16114
  if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
16099
- context.addIssue({
16115
+ context2.addIssue({
16100
16116
  code: "custom",
16101
16117
  path: ["downloadedBytes"],
16102
16118
  message: "downloadedBytes must not exceed totalBytes"
@@ -16154,10 +16170,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16154
16170
  var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
16155
16171
  function desktopImageAttachmentPaths(text) {
16156
16172
  const end = text.search(REQUEST_HEADING);
16157
- const context = end < 0 ? text : text.slice(0, end);
16158
- if (!ATTACHED_FILES_HEADING.test(context))
16173
+ const context2 = end < 0 ? text : text.slice(0, end);
16174
+ if (!ATTACHED_FILES_HEADING.test(context2))
16159
16175
  return [];
16160
- return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
16176
+ return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
16161
16177
  }
16162
16178
 
16163
16179
  // ../shared-contracts/dist/remote-runtime.js
@@ -16810,15 +16826,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16810
16826
  // ../desktop-control/dist/renderer-host-rpc-discovery.js
16811
16827
  function findRendererAppScopeStore(root) {
16812
16828
  const MAX_VISITED_FIBERS = 5e4;
16813
- const record19 = (value) => typeof value === "object" && value !== null;
16829
+ const record21 = (value) => typeof value === "object" && value !== null;
16814
16830
  const container = root.getElementById?.("root");
16815
- if (!record19(container))
16831
+ if (!record21(container))
16816
16832
  return null;
16817
16833
  const key = Object.getOwnPropertyNames(container).find((name) => name.startsWith("__reactContainer$"));
16818
16834
  const first = key ? container[key] : null;
16819
- if (!record19(first))
16835
+ if (!record21(first))
16820
16836
  return null;
16821
- const isScopeHandle = (value) => record19(value) && record19(value.node) && "chain" in value && "scope" in value && typeof value.get === "function" && typeof value.set === "function" && typeof value.watch === "function";
16837
+ const isScopeHandle = (value) => record21(value) && record21(value.node) && "chain" in value && "scope" in value && typeof value.get === "function" && typeof value.set === "function" && typeof value.watch === "function";
16822
16838
  const stack = [first];
16823
16839
  const seen = /* @__PURE__ */ new Set();
16824
16840
  while (stack.length && seen.size < MAX_VISITED_FIBERS) {
@@ -16827,41 +16843,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16827
16843
  continue;
16828
16844
  seen.add(fiber);
16829
16845
  let hook = fiber.memoizedState;
16830
- for (let index = 0; record19(hook) && "next" in hook && index < 150; index += 1) {
16846
+ for (let index = 0; record21(hook) && "next" in hook && index < 150; index += 1) {
16831
16847
  const state = hook.memoizedState;
16832
- const handle = record19(state) ? state.current : null;
16848
+ const handle = record21(state) ? state.current : null;
16833
16849
  if (isScopeHandle(handle)) {
16834
16850
  let node = handle.node;
16835
16851
  const nodes = /* @__PURE__ */ new Set();
16836
- while (record19(node.parent) && !nodes.has(node.parent)) {
16852
+ while (record21(node.parent) && !nodes.has(node.parent)) {
16837
16853
  nodes.add(node);
16838
16854
  node = node.parent;
16839
16855
  }
16840
16856
  const bindings = node.familyBindings;
16841
- return record19(bindings) && typeof bindings.get === "function" && typeof bindings.entries === "function" ? node : null;
16857
+ return record21(bindings) && typeof bindings.get === "function" && typeof bindings.entries === "function" ? node : null;
16842
16858
  }
16843
16859
  hook = hook.next;
16844
16860
  }
16845
- if (record19(fiber.sibling))
16861
+ if (record21(fiber.sibling))
16846
16862
  stack.push(fiber.sibling);
16847
- if (record19(fiber.child))
16863
+ if (record21(fiber.child))
16848
16864
  stack.push(fiber.child);
16849
16865
  }
16850
16866
  return null;
16851
16867
  }
16852
16868
  function findRendererHostRpcFamily(store) {
16853
- const record19 = (value) => typeof value === "object" && value !== null;
16869
+ const record21 = (value) => typeof value === "object" && value !== null;
16854
16870
  const families = /* @__PURE__ */ new Set();
16855
16871
  for (const [definition, members] of store.familyBindings) {
16856
- if (!record19(definition) || definition.kind !== "signal-family")
16872
+ if (!record21(definition) || definition.kind !== "signal-family")
16857
16873
  continue;
16858
- if (!record19(members) || typeof members.get !== "function")
16874
+ if (!record21(members) || typeof members.get !== "function")
16859
16875
  continue;
16860
16876
  for (const [hostId2, member] of members) {
16861
- if (typeof hostId2 !== "string" || !record19(member))
16877
+ if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:]|ssh:)/u.test(hostId2))
16878
+ continue;
16879
+ if (!record21(member))
16862
16880
  continue;
16863
16881
  const signal = member.value;
16864
- if (!record19(signal) || typeof signal.get !== "function")
16882
+ if (!record21(signal) || typeof signal.get !== "function")
16865
16883
  continue;
16866
16884
  let value;
16867
16885
  try {
@@ -16869,7 +16887,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16869
16887
  } catch {
16870
16888
  continue;
16871
16889
  }
16872
- if (record19(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record19(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
16890
+ if (record21(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record21(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
16873
16891
  families.add(members);
16874
16892
  break;
16875
16893
  }
@@ -16880,9 +16898,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16880
16898
  return { store, family: families.values().next().value };
16881
16899
  }
16882
16900
  function resolveRendererHostRpc(discovery, hostId2) {
16883
- const record19 = (value2) => typeof value2 === "object" && value2 !== null;
16901
+ const record21 = (value2) => typeof value2 === "object" && value2 !== null;
16884
16902
  const signal = discovery.family.get(hostId2)?.value;
16885
- if (!record19(signal) || typeof signal.get !== "function")
16903
+ if (!record21(signal) || typeof signal.get !== "function")
16886
16904
  return null;
16887
16905
  let value;
16888
16906
  try {
@@ -16890,10 +16908,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16890
16908
  } catch {
16891
16909
  return null;
16892
16910
  }
16893
- if (!record19(value) || value.status !== "ready" || !record19(value.client) || value.client.hostId !== hostId2)
16911
+ if (!record21(value) || value.status !== "ready" || !record21(value.client) || value.client.hostId !== hostId2)
16894
16912
  return null;
16895
16913
  const rpc = value.client.rpc;
16896
- return typeof rpc === "function" || record19(rpc) ? rpc : null;
16914
+ return typeof rpc === "function" || record21(rpc) ? rpc : null;
16897
16915
  }
16898
16916
  function rendererHostRpcUsesExternalQueue(store, conversationId) {
16899
16917
  const providers = /* @__PURE__ */ new Map();
@@ -17181,11 +17199,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17181
17199
  for (const row of rows) {
17182
17200
  if (row.length !== 24 || row[7] !== null || row[10] !== true || !updates.has(row[13]))
17183
17201
  continue;
17184
- const context = row[12];
17202
+ const context2 = row[12];
17185
17203
  const result = row[23];
17186
- if (context && context === row[21] && typeof context.usesAccountPreferences === "boolean" && result?.usesAccountPreferences === context.usesAccountPreferences && typeof row[14] === "function" && row[14] === row[20] && result.setModelAndReasoningEffort === row[14]) {
17204
+ if (context2 && context2 === row[21] && typeof context2.usesAccountPreferences === "boolean" && result?.usesAccountPreferences === context2.usesAccountPreferences && typeof row[14] === "function" && row[14] === row[20] && result.setModelAndReasoningEffort === row[14]) {
17187
17205
  update ??= row[13];
17188
- modes.add(context.usesAccountPreferences);
17206
+ modes.add(context2.usesAccountPreferences);
17189
17207
  const settings = result.modelSettings;
17190
17208
  const candidate = previousRows.get(row);
17191
17209
  const mode2 = candidate?.[44];
@@ -17330,14 +17348,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17330
17348
 
17331
17349
  // ../desktop-control/dist/renderer-host-discovery.js
17332
17350
  function requestManagerFromHookState(value, hostId2) {
17333
- const record19 = (candidate) => typeof candidate === "object" && candidate !== null;
17351
+ const record21 = (candidate) => typeof candidate === "object" && candidate !== null;
17334
17352
  const manager = (candidate) => {
17335
- if (!record19(candidate) || !record19(candidate.requestClient) || !record19(candidate.prewarmedThreadManager))
17353
+ if (!record21(candidate) || !record21(candidate.requestClient) || !record21(candidate.prewarmedThreadManager))
17336
17354
  return null;
17337
17355
  const bridge = candidate.requestClient;
17338
17356
  return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
17339
17357
  };
17340
- if (!record19(value))
17358
+ if (!record21(value))
17341
17359
  return null;
17342
17360
  const direct = manager(value) ?? manager(value.manager);
17343
17361
  if (direct)
@@ -17856,10 +17874,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17856
17874
  const seenDependencies = /* @__PURE__ */ new Set();
17857
17875
  while (record6(dependency) && seenDependencies.size < 4096 && !seenDependencies.has(dependency)) {
17858
17876
  seenDependencies.add(dependency);
17859
- const context = dependency.context;
17877
+ const context2 = dependency.context;
17860
17878
  const chain = dependency.memoizedValue;
17861
- if (record6(context) && context.displayName === native.scopeDefinition.__scopeBrand && chain instanceof Map && chain.get(native.scopeDefinition.id) === appNode)
17862
- contexts.add(context);
17879
+ if (record6(context2) && context2.displayName === native.scopeDefinition.__scopeBrand && chain instanceof Map && chain.get(native.scopeDefinition.id) === appNode)
17880
+ contexts.add(context2);
17863
17881
  dependency = dependency.next;
17864
17882
  }
17865
17883
  }
@@ -18736,10 +18754,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18736
18754
  function lastVoiceLaunchProductExperience() {
18737
18755
  return lastVoiceProductExperience;
18738
18756
  }
18739
- function isExternalHarnessComposer(owner = globalThis) {
18740
- if (lastVoiceProductExperience === "chat") return false;
18741
- if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
18742
- if (lastVoiceProductExperience !== "work") return false;
18757
+ function lastAgentIsExternalHarness(owner) {
18743
18758
  const storage = owner.localStorage;
18744
18759
  if (!storage) return false;
18745
18760
  try {
@@ -18749,6 +18764,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18749
18764
  return false;
18750
18765
  }
18751
18766
  }
18767
+ function isExternalHarnessComposer(owner = globalThis) {
18768
+ if (lastVoiceProductExperience === "chat") return false;
18769
+ if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
18770
+ if (lastVoiceProductExperience === "codex") return false;
18771
+ if (lastVoiceProductExperience !== "work" && !isWorkComposerSurface(owner)) return false;
18772
+ return lastAgentIsExternalHarness(owner);
18773
+ }
18752
18774
  function wrapClientOwnedVoiceFetch(client, bridge, workOverride, responseError, chatOverride = () => false, workSurface = () => isWorkComposerSurface(), externalHarness = () => isExternalHarnessComposer()) {
18753
18775
  const original = client.fetch;
18754
18776
  const wrapped = async function(url2, options) {
@@ -19101,7 +19123,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19101
19123
  "[data-codexhost-background-activity] .activity-error{font-size:12px;padding:0 20px;color:var(--color-text-danger,light-dark(#a32020,#ffaaa0))}"
19102
19124
  ].join("\n");
19103
19125
  function installRendererBackgroundActivity(window2, readContext) {
19104
- let context = null;
19126
+ let context2 = null;
19105
19127
  let revision = 0;
19106
19128
  let disposed = false;
19107
19129
  let inFlight = null;
@@ -19119,7 +19141,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19119
19141
  let renderedOutput;
19120
19142
  let navigation = null;
19121
19143
  const unsupported = /* @__PURE__ */ new WeakSet();
19122
- const valid = (owner, token) => !disposed && token === revision && same(owner, context) && same(owner, readContext());
19144
+ const valid = (owner, token) => !disposed && token === revision && same(owner, context2) && same(owner, readContext());
19123
19145
  const message2 = (error51) => error51 instanceof Error ? error51.message : "Native activity is unavailable";
19124
19146
  const setError = (text) => {
19125
19147
  if (errorNode && errorNode.textContent !== text) errorNode.textContent = text;
@@ -19200,7 +19222,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19200
19222
  openRendererActivityChild(owner, child);
19201
19223
  };
19202
19224
  const showDetail = async (id) => {
19203
- const owner = context;
19225
+ const owner = context2;
19204
19226
  if (!owner) return;
19205
19227
  const token = revision;
19206
19228
  selected = selected === id ? null : id;
@@ -19223,7 +19245,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19223
19245
  }
19224
19246
  };
19225
19247
  const render = () => {
19226
- if (!body || !context) return;
19248
+ if (!body || !context2) return;
19227
19249
  const key = JSON.stringify([
19228
19250
  activities,
19229
19251
  selected,
@@ -19261,7 +19283,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19261
19283
  note.textContent = "Native output is truncated.";
19262
19284
  content.append(note);
19263
19285
  }
19264
- const owner = context;
19286
+ const owner = context2;
19265
19287
  const token = revision;
19266
19288
  if (activity.relatedActivityId) {
19267
19289
  const id = activity.relatedActivityId;
@@ -19381,13 +19403,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19381
19403
  const refresh = async () => {
19382
19404
  if (disposed) return;
19383
19405
  const next = readContext();
19384
- if (!same(context, next)) {
19406
+ if (!same(context2, next)) {
19385
19407
  revision++;
19386
19408
  inFlight = null;
19387
19409
  clear();
19388
- context = next;
19410
+ context2 = next;
19389
19411
  }
19390
- const owner = context;
19412
+ const owner = context2;
19391
19413
  if (!owner) return;
19392
19414
  if (inFlight || unsupported.has(owner.route)) return;
19393
19415
  const token = revision;
@@ -19444,7 +19466,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19444
19466
  void refresh();
19445
19467
  return {
19446
19468
  refreshContext() {
19447
- if (!same(context, readContext()) || root && !root.isConnected) void refresh();
19469
+ if (!same(context2, readContext()) || root && !root.isConnected) void refresh();
19448
19470
  },
19449
19471
  dispose() {
19450
19472
  disposed = true;
@@ -19511,6 +19533,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19511
19533
  }
19512
19534
 
19513
19535
  // src/codex-native-services.ts
19536
+ var MAX_RUNTIME_MODULES = 32768;
19537
+ var MAX_RUNTIME_EXPORTS = 131072;
19538
+ var RUNTIME_SCAN_SLICE = 2048;
19539
+ var COMPILED_EXPORT_GETTER = /^(?:\(\)=>|function\(\)\{return )[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[(?:[A-Za-z_$][\w$]*|"[^"\\]*"|'[^'\\]*')\])*\}?$/;
19540
+ var objectLike = (value) => (typeof value === "object" || typeof value === "function") && value !== null;
19541
+ function instantiatedModules(namespace) {
19542
+ const runtime = namespace.__webpack_require__;
19543
+ if (typeof runtime !== "function") return null;
19544
+ const cache = Object.getOwnPropertyDescriptor(runtime, "c")?.value;
19545
+ return objectLike(cache) ? cache : null;
19546
+ }
19547
+ function compiledExportValues(module) {
19548
+ if (!objectLike(module) || Object.hasOwn(module, "error")) return [];
19549
+ const exports = Object.getOwnPropertyDescriptor(module, "exports")?.value;
19550
+ if (typeof exports !== "object" || exports === null) return [];
19551
+ const prototype = Object.getPrototypeOf(exports);
19552
+ if (prototype !== Object.prototype && prototype !== null) return [];
19553
+ const values = [];
19554
+ for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(exports))) {
19555
+ if (!descriptor.enumerable || descriptor.configurable) continue;
19556
+ if ("value" in descriptor) {
19557
+ values.push(descriptor.value);
19558
+ continue;
19559
+ }
19560
+ if (!descriptor.get) continue;
19561
+ try {
19562
+ if (COMPILED_EXPORT_GETTER.test(Function.prototype.toString.call(descriptor.get)))
19563
+ values.push(descriptor.get.call(exports));
19564
+ } catch {
19565
+ }
19566
+ }
19567
+ return values;
19568
+ }
19514
19569
  async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
19515
19570
  if (!ownerWindow.document || !ownerWindow.location) return null;
19516
19571
  const page = new URL(ownerWindow.location.href);
@@ -19540,6 +19595,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19540
19595
  (a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
19541
19596
  );
19542
19597
  const matches = /* @__PURE__ */ new Set();
19598
+ const addMatch = (value) => {
19599
+ if (matchesServices(value)) matches.add(value);
19600
+ if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
19601
+ };
19602
+ const runtimes = /* @__PURE__ */ new Set();
19543
19603
  for (const url2 of candidates) {
19544
19604
  let module;
19545
19605
  try {
@@ -19547,8 +19607,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19547
19607
  } catch {
19548
19608
  continue;
19549
19609
  }
19550
- for (const value of Object.values(module).filter(matchesServices)) matches.add(value);
19551
- if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
19610
+ Object.values(module).forEach(addMatch);
19611
+ const runtime = instantiatedModules(module);
19612
+ if (runtime) runtimes.add(runtime);
19613
+ }
19614
+ let scannedExports = 0;
19615
+ for (const runtime of runtimes) {
19616
+ const modules = Object.values(runtime);
19617
+ if (modules.length > MAX_RUNTIME_MODULES)
19618
+ throw new Error("Codex native services are unavailable in this window");
19619
+ for (const [index, module] of modules.entries()) {
19620
+ if (index > 0 && index % RUNTIME_SCAN_SLICE === 0)
19621
+ await new Promise((resolve) => setTimeout(resolve));
19622
+ const values = compiledExportValues(module);
19623
+ scannedExports += values.length;
19624
+ if (scannedExports > MAX_RUNTIME_EXPORTS)
19625
+ throw new Error("Codex native services are unavailable in this window");
19626
+ values.forEach(addMatch);
19627
+ }
19552
19628
  }
19553
19629
  if (catalog !== void 0 && Reflect.get(ownerWindow, "__codexhostLoadedModulesV1") !== catalog)
19554
19630
  throw new Error("Codex loaded module catalog changed during discovery. Try again once ready.");
@@ -20314,7 +20390,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20314
20390
  let disposed = false;
20315
20391
  let inFlight = false;
20316
20392
  let revision = 0;
20317
- let context = null;
20393
+ let context2 = null;
20318
20394
  let card = null;
20319
20395
  let cardKey = null;
20320
20396
  let stopActivity;
@@ -20335,12 +20411,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20335
20411
  const refresh = async () => {
20336
20412
  if (disposed) return;
20337
20413
  const next = readContext();
20338
- if (!same2(context, next)) {
20414
+ if (!same2(context2, next)) {
20339
20415
  clear();
20340
- context = next;
20416
+ context2 = next;
20341
20417
  revision++;
20342
20418
  }
20343
- const current = context;
20419
+ const current = context2;
20344
20420
  if (!current || inFlight || unsupported.has(current.route)) return;
20345
20421
  const startedRevision = revision;
20346
20422
  inFlight = true;
@@ -20390,7 +20466,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20390
20466
  );
20391
20467
  threadQuestionRespondResultSchema.parse(raw2);
20392
20468
  drafts.delete(key);
20393
- if (same2(current, context)) {
20469
+ if (same2(current, context2)) {
20394
20470
  revision++;
20395
20471
  if (cardKey === key) clear(false);
20396
20472
  }
@@ -20420,7 +20496,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20420
20496
  );
20421
20497
  } catch (error51) {
20422
20498
  if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
20423
- if (revision === startedRevision && same2(current, context)) clear();
20499
+ if (revision === startedRevision && same2(current, context2)) clear();
20424
20500
  } finally {
20425
20501
  inFlight = false;
20426
20502
  }
@@ -20432,7 +20508,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20432
20508
  return {
20433
20509
  refresh,
20434
20510
  refreshContext() {
20435
- if (!same2(context, readContext()) || card && !card.root.isConnected) void refresh();
20511
+ if (!same2(context2, readContext()) || card && !card.root.isConnected) void refresh();
20436
20512
  },
20437
20513
  dispose() {
20438
20514
  disposed = true;
@@ -20597,9 +20673,9 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
20597
20673
  }
20598
20674
  return Object.create(Object.getPrototypeOf(value), descriptors);
20599
20675
  }
20600
- async function prepareRendererRpcAttachments(value, context) {
20676
+ async function prepareRendererRpcAttachments(value, context2) {
20601
20677
  if (!record10(value) || !record10(value.steer) || !Array.isArray(value.steer.input)) return value;
20602
- const { manager, threadId, isCurrent } = context;
20678
+ const { manager, threadId, isCurrent } = context2;
20603
20679
  const created = /* @__PURE__ */ new Set();
20604
20680
  const uploads = /* @__PURE__ */ new Map();
20605
20681
  const storage = {
@@ -20622,7 +20698,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
20622
20698
  return manager.removePastedTextAttachment(path);
20623
20699
  }
20624
20700
  };
20625
- const send = createRemoteAttachmentSender(storage, context.hostId, isCurrent);
20701
+ const send = createRemoteAttachmentSender(storage, context2.hostId, isCurrent);
20626
20702
  const input = async (request) => {
20627
20703
  const prepared = await send({ ...request, threadId }, (params) => params);
20628
20704
  if (!record10(prepared)) throw new Error("Image attachment preparation returned invalid input");
@@ -22625,8 +22701,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22625
22701
  id: "connections",
22626
22702
  label: messages.pageLabels.connections,
22627
22703
  icon: "connections",
22628
- mount(context) {
22629
- const document2 = context.content.ownerDocument;
22704
+ mount(context2) {
22705
+ const document2 = context2.content.ownerDocument;
22630
22706
  const header = document2.createElement("div");
22631
22707
  header.className = "settings-connection-page-header";
22632
22708
  const headingCopy = document2.createElement("div");
@@ -22648,7 +22724,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22648
22724
  const syncMessage = document2.createElement("p");
22649
22725
  syncMessage.className = "settings-page-description";
22650
22726
  syncMessage.setAttribute("role", "status");
22651
- context.content.append(header, syncMessage, content);
22727
+ context2.content.append(header, syncMessage, content);
22652
22728
  let pending = false;
22653
22729
  let selectedHostId = null;
22654
22730
  let selectedItemKey = null;
@@ -22660,12 +22736,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22660
22736
  let renderQueued = false;
22661
22737
  let renderFrame = null;
22662
22738
  const scheduleRender = () => {
22663
- if (disposed || context.signal.aborted || renderQueued) return;
22739
+ if (disposed || context2.signal.aborted || renderQueued) return;
22664
22740
  renderQueued = true;
22665
22741
  const flush = () => {
22666
22742
  renderFrame = null;
22667
22743
  renderQueued = false;
22668
- if (!disposed && !context.signal.aborted) {
22744
+ if (!disposed && !context2.signal.aborted) {
22669
22745
  render(diagnostics?.snapshot() ?? latestSnapshot);
22670
22746
  }
22671
22747
  };
@@ -22684,12 +22760,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22684
22760
  const versions = createConnectionVersions(
22685
22761
  document2,
22686
22762
  messages,
22687
- context.signal,
22763
+ context2.signal,
22688
22764
  diagnostics,
22689
22765
  scheduleRender
22690
22766
  );
22691
22767
  const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
22692
- const updates = createConnectionUpdates(document2, messages, context.signal, scheduleRender);
22768
+ const updates = createConnectionUpdates(document2, messages, context2.signal, scheduleRender);
22693
22769
  const runRefresh = () => {
22694
22770
  if (pending || !diagnostics) return;
22695
22771
  pending = true;
@@ -22698,7 +22774,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22698
22774
  createRendererSettingsIcon("diagnose", 16),
22699
22775
  messages.connectionRefreshing
22700
22776
  );
22701
- void context.runLatest(() => diagnostics.refresh(), {
22777
+ void context2.runLatest(() => diagnostics.refresh(), {
22702
22778
  success() {
22703
22779
  installs?.clearErrors();
22704
22780
  pending = false;
@@ -23054,9 +23130,9 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23054
23130
  }
23055
23131
  };
23056
23132
  render(diagnostics?.snapshot() ?? null);
23057
- void getRemoteConnections()?.ssh.list(context.signal).then(
23133
+ void getRemoteConnections()?.ssh.list(context2.signal).then(
23058
23134
  (connections) => {
23059
- if (context.signal.aborted) return;
23135
+ if (context2.signal.aborted) return;
23060
23136
  for (const connection of connections) {
23061
23137
  hostNames.set(connection.hostId, connection.displayName.trim());
23062
23138
  }
@@ -27327,7 +27403,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27327
27403
  let fiber = fiberName ? Object.getOwnPropertyDescriptor(element, fiberName)?.value : null;
27328
27404
  for (let depth = 0; fiber && depth < 60; depth += 1) {
27329
27405
  const props = fiber.memoizedProps;
27330
- if (isRecord4(props) && typeof props.onSelectModel === "function" && typeof props.onSelectReasoningEffort === "function" && "reasoningEffort" in props && isRecord4(props.fallbackPowerSelection)) {
27406
+ if (isRecord4(props) && typeof props.onSelectModel === "function" && "reasoningEffort" in props && (typeof props.onSelectReasoningEffort === "function" && isRecord4(props.fallbackPowerSelection) || element.getAttribute("data-composer-navigation-target") === "reasoning" && typeof props.onCommitPower === "function" && Array.isArray(props.powerSelections))) {
27331
27407
  return true;
27332
27408
  }
27333
27409
  const parent = fiber.return;
@@ -27390,6 +27466,23 @@ Codex Fast mode prioritizes requests and may increase usage.`
27390
27466
  ].filter(isNativeContextUsageControlCandidate);
27391
27467
  return candidates.length === 1 ? candidates[0] ?? null : null;
27392
27468
  }
27469
+ var NATIVE_GOAL_MODE_CLEAR_LABELS = /* @__PURE__ */ new Set(["clear goal", "\u6E05\u9664\u76EE\u6807", "\u6E05\u9664\u76EE\u6A19"]);
27470
+ function composerHidesNativeGoalControl(agent, switching = false) {
27471
+ return switching || agent !== "codex" && agent !== "grok";
27472
+ }
27473
+ function isNativeGoalControlCandidate(element) {
27474
+ if (typeof element.hasAttribute !== "function" || typeof element.matches !== "function" || typeof element.getAttribute !== "function" || isOwnedRendererControl(element) || !element.matches("button")) {
27475
+ return false;
27476
+ }
27477
+ const label = (element.getAttribute("aria-label") ?? "").replace(/\s+/g, " ").trim().toLowerCase();
27478
+ return NATIVE_GOAL_MODE_CLEAR_LABELS.has(label);
27479
+ }
27480
+ function nativeGoalControlForComposer(composer) {
27481
+ const candidates = [...composer.querySelectorAll("button")].filter(
27482
+ isNativeGoalControlCandidate
27483
+ );
27484
+ return candidates.length === 1 ? candidates[0] ?? null : null;
27485
+ }
27393
27486
  function isNativeUsageBannerCandidate(element) {
27394
27487
  if (element.localName !== "aside") return false;
27395
27488
  if (typeof element.querySelector !== "function") return false;
@@ -27428,6 +27521,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
27428
27521
  restoreNativeControl(control.nativeUsageBanner);
27429
27522
  control.nativeUsageBanner = captureNativeControl(candidate);
27430
27523
  }
27524
+ function refreshNativeGoalControl(control) {
27525
+ const candidate = nativeGoalControlForComposer(control.composer);
27526
+ if (candidate === control.nativeGoalControl?.element) return;
27527
+ restoreNativeControl(control.nativeGoalControl);
27528
+ control.nativeGoalControl = captureNativeControl(candidate);
27529
+ }
27431
27530
  function refreshNativeModelControl(control) {
27432
27531
  const candidate = nativeModelControlForComposer(control.composer);
27433
27532
  if (!candidate) return;
@@ -27438,8 +27537,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
27438
27537
  }
27439
27538
  }
27440
27539
  function usagePlacementAnchor(control) {
27441
- const context = control.nativeContextUsageControl?.element;
27442
- const contextWrapper = context?.parentElement;
27540
+ const context2 = control.nativeContextUsageControl?.element;
27541
+ const contextWrapper = context2?.parentElement;
27443
27542
  if (contextWrapper?.parentElement) return contextWrapper;
27444
27543
  const modelRoot = control.modelPicker?.root;
27445
27544
  return modelRoot?.parentElement ? modelRoot : null;
@@ -27529,7 +27628,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27529
27628
  parent.insertBefore(control.permissionModePicker.root, candidate);
27530
27629
  }
27531
27630
  }
27532
- function setNativeControlHidden(state, hidden) {
27631
+ function setNativeControlHidden(state, hidden, dismiss = false) {
27533
27632
  if (!state) return;
27534
27633
  if (!hidden) {
27535
27634
  restoreNativeControl(state);
@@ -27540,15 +27639,17 @@ Codex Fast mode prioritizes requests and may increase usage.`
27540
27639
  if (active && typeof active.blur === "function" && state.element.contains(active)) {
27541
27640
  active.blur();
27542
27641
  }
27642
+ if (dismiss && typeof state.element.click === "function") state.element.click();
27543
27643
  if (state.element.getAttribute("aria-expanded") === "true") state.element.click();
27544
27644
  state.element.hidden = true;
27545
27645
  state.element.setAttribute("aria-hidden", "true");
27546
27646
  }
27547
- function reconcileComposerNativeControls(control, hideModel, hidePermissionMode) {
27647
+ function reconcileComposerNativeControls(control, hideModel, hidePermissionMode, hideGoal = false) {
27548
27648
  refreshNativeContextUsageControl(control);
27549
27649
  refreshNativeModelControl(control);
27550
27650
  refreshNativePermissionModeControl(control);
27551
27651
  refreshNativeUsageBanner(control);
27652
+ refreshNativeGoalControl(control);
27552
27653
  refreshTrailingClusterPlacement(control);
27553
27654
  refreshUsagePlacement(control);
27554
27655
  refreshCreditsPlacement(control);
@@ -27558,6 +27659,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27558
27659
  setNativeControlHidden(control.nativeModelControl, hideModel);
27559
27660
  setNativeControlHidden(control.nativeContextUsageControl, false);
27560
27661
  setNativeControlHidden(control.nativePermissionModeControl, hidePermissionMode);
27662
+ setNativeControlHidden(control.nativeGoalControl, hideGoal, hideGoal);
27561
27663
  setNativeControlHidden(
27562
27664
  control.nativeUsageBanner,
27563
27665
  readCodexUsageBannerPreference(preferenceOwner(control))
@@ -27573,6 +27675,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27573
27675
  nativeContextUsageControlForComposer(composer)
27574
27676
  );
27575
27677
  const nativeUsageBanner = captureNativeControl(nativeUsageBannerForComposer(composer));
27678
+ const nativeGoalControl = captureNativeControl(nativeGoalControlForComposer(composer));
27576
27679
  const semanticNativePermissionModeControl = semanticNativePermissionModeControlForComposer(composer);
27577
27680
  const nativePermissionModeControl = captureNativeControl(semanticNativePermissionModeControl);
27578
27681
  const nativePermissionModeControlVerified = semanticNativePermissionModeControl !== null && nativePermissionModeControlForComposer(composer) === semanticNativePermissionModeControl;
@@ -27635,6 +27738,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27635
27738
  nativePermissionModeControl,
27636
27739
  nativeContextUsageControl,
27637
27740
  nativeUsageBanner,
27741
+ nativeGoalControl,
27638
27742
  nativePermissionModeControlVerified,
27639
27743
  credits,
27640
27744
  composerIndicators,
@@ -27665,7 +27769,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27665
27769
  const modelReady = selectedModel !== void 0 && selectedCatalogModel !== void 0;
27666
27770
  const modelBlocked = state.agent !== "codex" && (modelView.status === "selecting" || !modelReady || !thinkingReady);
27667
27771
  const permissionModeBlocked = state.agent !== "codex" && !isPermissionModeControlReady(permissionModeView);
27668
- const submissionBlocked = switching || ownershipError || modelBlocked || permissionModeBlocked;
27772
+ const submissionBlocked = switching || ownershipError || state.agent !== "codex" && adapterState !== "ready" || modelBlocked || permissionModeBlocked;
27669
27773
  if (submissionBlocked && control.sendDisabledBeforeSwitch === null) {
27670
27774
  control.sendDisabledBeforeSwitch = control.sendButton.disabled;
27671
27775
  control.sendButton.disabled = true;
@@ -27688,7 +27792,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
27688
27792
  reconcileComposerNativeControls(
27689
27793
  control,
27690
27794
  pickerView.nativeModelHidden,
27691
- switching || state.agent !== "codex"
27795
+ switching || state.agent !== "codex",
27796
+ composerHidesNativeGoalControl(state.agent, switching)
27692
27797
  );
27693
27798
  renderRendererModelPicker(
27694
27799
  control.modelPicker,
@@ -27728,6 +27833,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27728
27833
  restoreNativeControl(control.nativeModelControl);
27729
27834
  restoreNativeControl(control.nativeContextUsageControl);
27730
27835
  restoreNativeControl(control.nativeUsageBanner);
27836
+ restoreNativeControl(control.nativeGoalControl);
27731
27837
  restoreNativeControl(control.nativePermissionModeControl);
27732
27838
  control.composerIndicators?.dispose();
27733
27839
  control.credits.dispose();
@@ -28906,9 +29012,31 @@ Codex Fast mode prioritizes requests and may increase usage.`
28906
29012
  return installLocalQueueGate(target);
28907
29013
  }
28908
29014
 
29015
+ // src/renderer-steering-delivery.ts
29016
+ async function inspectRendererSteeringDelivery(send, threadId, text) {
29017
+ const inspect = "codexhost/thread/steering/inspect";
29018
+ try {
29019
+ const response2 = await send(inspect, { threadId, ...text !== void 0 ? { text } : {} });
29020
+ return threadSteeringInspectResultSchema.parse(response2).delivery;
29021
+ } catch (error51) {
29022
+ if (!isUnsupportedMethod(error51, inspect)) throw error51;
29023
+ }
29024
+ const ownership = "codexhost/thread/ownership/list";
29025
+ let response;
29026
+ try {
29027
+ response = await send(ownership, { threadIds: [threadId] });
29028
+ } catch (error51) {
29029
+ if (!isUnsupportedMethod(error51, ownership)) throw error51;
29030
+ await verifyNativeCodexThread(send, threadId);
29031
+ return "official";
29032
+ }
29033
+ const result = threadOwnershipListResultSchema.parse(response);
29034
+ const owner = result.threads.find((thread) => thread.threadId === threadId)?.owner;
29035
+ if (!owner) throw new Error("Thread ownership could not be resolved for steering");
29036
+ return owner === "codex" ? "official" : "newTurn";
29037
+ }
29038
+
28909
29039
  // src/renderer-external-steering.ts
28910
- var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
28911
- var THREAD_OWNERSHIP_LIST_METHOD2 = "codexhost/thread/ownership/list";
28912
29040
  function isRecord10(value) {
28913
29041
  return value !== null && typeof value === "object" && !Array.isArray(value);
28914
29042
  }
@@ -28937,9 +29065,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
28937
29065
  function queuedFollowUpText(message2) {
28938
29066
  if (!isRecord10(message2)) return "";
28939
29067
  if (typeof message2.text === "string" && message2.text.trim()) return message2.text;
28940
- const context = message2.context;
28941
- if (isRecord10(context) && typeof context.prompt === "string" && context.prompt.trim()) {
28942
- return context.prompt;
29068
+ const context2 = message2.context;
29069
+ if (isRecord10(context2) && typeof context2.prompt === "string" && context2.prompt.trim()) {
29070
+ return context2.prompt;
28943
29071
  }
28944
29072
  return "";
28945
29073
  }
@@ -29115,34 +29243,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
29115
29243
  };
29116
29244
  });
29117
29245
  };
29118
- const inspectDelivery = async (threadId, text) => {
29119
- try {
29120
- const response = await originalSend.call(manager, THREAD_STEERING_INSPECT_METHOD, {
29121
- threadId,
29122
- ...text !== void 0 ? { text } : {}
29123
- });
29124
- return threadSteeringInspectResultSchema.parse(response).delivery;
29125
- } catch (error51) {
29126
- if (!isUnsupportedMethod(error51, THREAD_STEERING_INSPECT_METHOD)) throw error51;
29127
- }
29128
- let ownershipResponse;
29129
- try {
29130
- ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD2, {
29131
- threadIds: [threadId]
29132
- });
29133
- } catch (error51) {
29134
- if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD2)) throw error51;
29135
- await verifyNativeCodexThread(
29136
- (method, params) => originalSend.call(manager, method, params),
29137
- threadId
29138
- );
29139
- return "official";
29140
- }
29141
- const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
29142
- const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
29143
- if (!owner) throw new Error("Thread ownership could not be resolved for steering");
29144
- return owner === "codex" ? "official" : "newTurn";
29145
- };
29246
+ const inspectDelivery = (threadId, text) => inspectRendererSteeringDelivery(
29247
+ (method, params) => originalSend.call(manager, method, params),
29248
+ threadId,
29249
+ text
29250
+ );
29146
29251
  const steer = async function(...args) {
29147
29252
  const [
29148
29253
  threadId,
@@ -29153,7 +29258,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
29153
29258
  clientUserMessageId,
29154
29259
  additionalContext,
29155
29260
  toolOutput,
29156
- onMessageAdded
29261
+ onMessageAdded,
29262
+ beforeSendRequest,
29263
+ assertRequestCurrent
29157
29264
  ] = args;
29158
29265
  if (typeof threadId !== "string") return originalSteer.apply(manager, args);
29159
29266
  const role = manager.getStreamRole?.(threadId);
@@ -29212,7 +29319,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29212
29319
  if (expectedTurnId == null && host.hasPendingTurnStart(threadId)) {
29213
29320
  throw new Error("Previous Turn submission has not been confirmed yet");
29214
29321
  }
29215
- const context = restoreMessage.context;
29322
+ const context2 = restoreMessage.context;
29216
29323
  const routeKey = `${threadId}\0${messageId}`;
29217
29324
  if (typeof expectedTurnId === "string") routes.set(routeKey, { threadId, expectedTurnId });
29218
29325
  const promise2 = Promise.resolve().then(async () => {
@@ -29232,13 +29339,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
29232
29339
  serviceTier,
29233
29340
  model: null,
29234
29341
  effort: null,
29235
- collaborationMode: context.collaborationMode ?? null
29342
+ collaborationMode: context2.collaborationMode ?? null
29236
29343
  },
29237
29344
  context: {
29238
29345
  attachments: attachments ?? [],
29239
- commentAttachments: context.commentAttachments ?? [],
29240
- mcpAppModelContextAttachments: context.mcpAppModelContextAttachments,
29241
- useAppServerPermissionDefault: true
29346
+ commentAttachments: context2.commentAttachments ?? [],
29347
+ mcpAppModelContextAttachments: context2.mcpAppModelContextAttachments,
29348
+ useAppServerPermissionDefault: true,
29349
+ beforeSendRequest,
29350
+ assertRequestCurrent
29242
29351
  }
29243
29352
  },
29244
29353
  onMessageAdded
@@ -30587,9 +30696,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
30587
30696
  const connected = !disposed && (client !== null || localClient !== null || (window.__codexhostHostRoutingV1?.knownHostIds?.() ?? []).some(
30588
30697
  (hostId2) => window.__codexhostHostRoutingV1?.forHost(hostId2) != null
30589
30698
  ));
30699
+ const manager = route?.manager;
30700
+ const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
30701
+ const steeringReady = !needsRpcSteering || window.__codexhostRpcSteeringV1 !== void 0;
30590
30702
  updateStatus(
30591
30703
  connected ? "ready" : "installing",
30592
- connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
30704
+ connected && !steeringReady ? "native-steering-policy-unavailable" : connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
30593
30705
  connected ? "request-bridge" : null
30594
30706
  );
30595
30707
  return route;
@@ -30906,7 +31018,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
30906
31018
  systemLocale: optionalLocale(value.systemLocale, "system locale")
30907
31019
  };
30908
31020
  }
30909
- function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke) {
31021
+ function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
30910
31022
  if (signal?.aborted) return Promise.reject(abortError2());
30911
31023
  return new Promise((resolve, reject) => {
30912
31024
  let settled2 = false;
@@ -30933,7 +31045,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
30933
31045
  const native = await loadCodexNativeServices(ownerWindow, matchesServices);
30934
31046
  if (settled2) return;
30935
31047
  if (!native) throw new Error("Codex native locale services are unavailable");
30936
- nativeRequest = invoke(native);
31048
+ nativeRequest = invoke2(native);
30937
31049
  const response = await nativeRequest;
30938
31050
  settle(() => resolve(response));
30939
31051
  })().catch((error51) => settle(() => reject(error51)));
@@ -31158,8 +31270,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
31158
31270
  id: options.id ?? "voice",
31159
31271
  label: m.title,
31160
31272
  icon: "settings",
31161
- mount(context) {
31162
- const doc = context.content.ownerDocument;
31273
+ mount(context2) {
31274
+ const doc = context2.content.ownerDocument;
31163
31275
  let state = null;
31164
31276
  let base = null;
31165
31277
  let draft = null;
@@ -31249,9 +31361,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
31249
31361
  };
31250
31362
  const render = () => {
31251
31363
  if (disposed) return;
31252
- const tree = context.content.getRootNode();
31364
+ const tree = context2.content.getRootNode();
31253
31365
  const focused = tree.activeElement;
31254
- const focusedId = focused && context.content.contains(focused) ? focused.id : "";
31366
+ const focusedId = focused && context2.content.contains(focused) ? focused.id : "";
31255
31367
  const root = h(doc, "div", { className: "settings-voice" });
31256
31368
  root.append(
31257
31369
  h(doc, "div", { className: "settings-section-label" }, m.title),
@@ -31260,7 +31372,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
31260
31372
  if (!draft || !state) {
31261
31373
  root.append(h(doc, "p", { role: "status" }, offline ? m.unavailable : m.loading));
31262
31374
  if (offline) root.append(button(doc, m.retry, () => void load(true)));
31263
- context.content.replaceChildren(root);
31375
+ context2.content.replaceChildren(root);
31264
31376
  return;
31265
31377
  }
31266
31378
  const unavailable = busy || offline || state.restart.phase === "restarting";
@@ -31456,7 +31568,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
31456
31568
  root.append(h(doc, "p", { className: "settings-voice__hint" }, m.integrationOff));
31457
31569
  if (offline || base?.revision !== state.revision)
31458
31570
  root.append(button(doc, m.retry, () => void load(true)));
31459
- context.content.replaceChildren(root);
31571
+ context2.content.replaceChildren(root);
31460
31572
  if (focusedId)
31461
31573
  root.querySelector(`#${focusedId}`)?.focus({ preventScroll: true });
31462
31574
  };
@@ -32862,8 +32974,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
32862
32974
  id: "usage-statistics",
32863
32975
  label: messages.label,
32864
32976
  icon: "dashboard",
32865
- mount(context) {
32866
- const document2 = context.content.ownerDocument;
32977
+ mount(context2) {
32978
+ const document2 = context2.content.ownerDocument;
32867
32979
  const locale = pageLocale ?? (document2.documentElement.lang || "en");
32868
32980
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
32869
32981
  const count4 = (value) => count3(value, locale);
@@ -32921,7 +33033,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
32921
33033
  document2,
32922
33034
  consoleMessages2,
32923
33035
  (method, params2) => request(method, params2, view.hostId),
32924
- context.signal,
33036
+ context2.signal,
32925
33037
  load
32926
33038
  );
32927
33039
  let offeredHosts = usageHosts ? [] : void 0;
@@ -32929,7 +33041,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
32929
33041
  label: messages.host,
32930
33042
  searchLabel: messages.search,
32931
33043
  emptyLabel: messages.noMatches,
32932
- signal: context.signal,
33044
+ signal: context2.signal,
32933
33045
  searchable: false,
32934
33046
  display: (option) => `${messages.host} \xB7 ${option.label}`,
32935
33047
  onChange: (key) => {
@@ -32959,7 +33071,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
32959
33071
  const offerHosts = () => {
32960
33072
  if (!usageHosts) return;
32961
33073
  void usageHosts().then((hosts) => {
32962
- if (context.signal.aborted) return;
33074
+ if (context2.signal.aborted) return;
32963
33075
  offeredHosts = hosts;
32964
33076
  hostOptions();
32965
33077
  }).catch(() => void 0);
@@ -32985,7 +33097,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
32985
33097
  label: messages.autoRefresh,
32986
33098
  searchLabel: messages.search,
32987
33099
  emptyLabel: messages.noMatches,
32988
- signal: context.signal,
33100
+ signal: context2.signal,
32989
33101
  searchable: false,
32990
33102
  display: (option) => `${messages.autoRefresh} \xB7 ${option.label}`,
32991
33103
  onChange: (key) => {
@@ -33030,7 +33142,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
33030
33142
  label: messages.filterModel,
33031
33143
  searchLabel: messages.search,
33032
33144
  emptyLabel: messages.noMatches,
33033
- signal: context.signal,
33145
+ signal: context2.signal,
33034
33146
  onChange: (key) => {
33035
33147
  view.model = key;
33036
33148
  changed();
@@ -33040,7 +33152,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
33040
33152
  label: messages.filterProject,
33041
33153
  searchLabel: messages.search,
33042
33154
  emptyLabel: messages.noMatches,
33043
- signal: context.signal,
33155
+ signal: context2.signal,
33044
33156
  onChange: (key) => {
33045
33157
  view.project = key;
33046
33158
  changed();
@@ -33828,7 +33940,7 @@ ${detail}` : ""}`
33828
33940
  }
33829
33941
  function schedule() {
33830
33942
  window.clearTimeout(poll);
33831
- if (context.signal.aborted) return;
33943
+ if (context2.signal.aborted) return;
33832
33944
  if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
33833
33945
  else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
33834
33946
  }
@@ -33846,12 +33958,12 @@ ${detail}` : ""}`
33846
33958
  } catch {
33847
33959
  if (!isCurrent()) return;
33848
33960
  }
33849
- if (!context.signal.aborted) render();
33961
+ if (!context2.signal.aborted) render();
33850
33962
  }
33851
33963
  function load() {
33852
33964
  window.clearTimeout(poll);
33853
33965
  const requested = params();
33854
- void context.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
33966
+ void context2.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
33855
33967
  success(value) {
33856
33968
  const parsed = usageStatisticsResultSchema.safeParse(value);
33857
33969
  if (parsed.success) {
@@ -33874,7 +33986,7 @@ ${detail}` : ""}`
33874
33986
  }
33875
33987
  });
33876
33988
  }
33877
- context.content.replaceChildren(header, prices.element, filters, notices, body);
33989
+ context2.content.replaceChildren(header, prices.element, filters, notices, body);
33878
33990
  render();
33879
33991
  offerHosts();
33880
33992
  void refreshHarnessNames();
@@ -35691,8 +35803,8 @@ ${detail}` : ""}`
35691
35803
  id: "session-import",
35692
35804
  label: messages.pageLabels["session-import"],
35693
35805
  icon: "session-import",
35694
- mount(context) {
35695
- const document2 = context.content.ownerDocument;
35806
+ mount(context2) {
35807
+ const document2 = context2.content.ownerDocument;
35696
35808
  const header = document2.createElement("div");
35697
35809
  header.className = "settings-session-import-header";
35698
35810
  const heading = document2.createElement("h2");
@@ -35812,7 +35924,7 @@ ${detail}` : ""}`
35812
35924
  const content = document2.createElement("section");
35813
35925
  content.className = "settings-session-import-content";
35814
35926
  const listControls = createSessionImportListControls(document2, messages, () => load());
35815
- context.content.append(
35927
+ context2.content.append(
35816
35928
  header,
35817
35929
  hostLabel,
35818
35930
  harness2,
@@ -35945,7 +36057,7 @@ ${detail}` : ""}`
35945
36057
  retry.addEventListener("click", () => {
35946
36058
  if (retry.disabled) return;
35947
36059
  setRetrying(true);
35948
- void context.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
36060
+ void context2.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
35949
36061
  success() {
35950
36062
  setRetrying(false);
35951
36063
  },
@@ -36006,16 +36118,16 @@ ${detail}` : ""}`
36006
36118
  const actionArea = document2.createElement("div");
36007
36119
  actionArea.className = "settings-session-import-row__action";
36008
36120
  if (candidate.running === true) {
36009
- const running = document2.createElement("span");
36010
- running.className = "settings-session-import-running";
36011
- running.textContent = messages.sessionImportRunning;
36012
- running.title = messages.sessionImportRunningHint;
36013
- running.setAttribute("aria-hidden", "true");
36121
+ const running2 = document2.createElement("span");
36122
+ running2.className = "settings-session-import-running";
36123
+ running2.textContent = messages.sessionImportRunning;
36124
+ running2.title = messages.sessionImportRunningHint;
36125
+ running2.setAttribute("aria-hidden", "true");
36014
36126
  actionArea.append(
36015
- running,
36127
+ running2,
36016
36128
  createAccessibleText(
36017
36129
  document2,
36018
- `${running.textContent}: ${messages.sessionImportRunningHint}`
36130
+ `${running2.textContent}: ${messages.sessionImportRunningHint}`
36019
36131
  )
36020
36132
  );
36021
36133
  }
@@ -36036,7 +36148,7 @@ ${detail}` : ""}`
36036
36148
  refresh.disabled = true;
36037
36149
  updateImportActions();
36038
36150
  let committedThreadId = null;
36039
- void context.runLatest(
36151
+ void context2.runLatest(
36040
36152
  async (signal) => {
36041
36153
  importStatus.replaceChildren();
36042
36154
  const result = await client.importHarnessSession({
@@ -36080,7 +36192,7 @@ ${detail}` : ""}`
36080
36192
  updateImportActions();
36081
36193
  };
36082
36194
  const load = (refreshDiagnostics = false) => {
36083
- if (importingId !== null || context.signal.aborted) return;
36195
+ if (importingId !== null || context2.signal.aborted) return;
36084
36196
  loadedClient = null;
36085
36197
  let client = getClient(selectedHostId);
36086
36198
  if (client?.hostId === "durable") {
@@ -36096,7 +36208,7 @@ ${detail}` : ""}`
36096
36208
  else renderUnavailable();
36097
36209
  const requestedHarness = selectedHarness;
36098
36210
  const pageParams = listControls.params();
36099
- void context.runLatest(
36211
+ void context2.runLatest(
36100
36212
  async (signal) => {
36101
36213
  if (!client) throw new RendererSessionImportUnavailableError();
36102
36214
  const harnesses = await loadSessionImportSources(
@@ -36162,8 +36274,8 @@ ${detail}` : ""}`
36162
36274
  }
36163
36275
 
36164
36276
  // src/settings/loaded-sessions-table.ts
36165
- function mountLoadedSessionsTable(context, messages, getClient) {
36166
- const document2 = context.content.ownerDocument;
36277
+ function mountLoadedSessionsTable(context2, messages, getClient) {
36278
+ const document2 = context2.content.ownerDocument;
36167
36279
  const owner = document2.defaultView;
36168
36280
  if (!owner) return () => void 0;
36169
36281
  const text = messages.loadedSessions;
@@ -36199,7 +36311,7 @@ ${detail}` : ""}`
36199
36311
  scroll.hidden = true;
36200
36312
  header.append(title, description);
36201
36313
  container.append(header, status, scroll);
36202
- context.content.append(container);
36314
+ context2.content.append(container);
36203
36315
  let disposed = false;
36204
36316
  let timer;
36205
36317
  let requestTimer;
@@ -36221,7 +36333,7 @@ ${detail}` : ""}`
36221
36333
  );
36222
36334
  })
36223
36335
  ]);
36224
- if (disposed || context.signal.aborted) return;
36336
+ if (disposed || context2.signal.aborted) return;
36225
36337
  body.replaceChildren();
36226
36338
  for (const row of rows.toSorted(
36227
36339
  (a, b) => b.inactiveMs - a.inactiveMs || a.harnessId.localeCompare(b.harnessId) || a.threadId.localeCompare(b.threadId)
@@ -36245,13 +36357,13 @@ ${detail}` : ""}`
36245
36357
  status.hidden = rows.length > 0;
36246
36358
  scroll.hidden = rows.length === 0;
36247
36359
  } catch (error51) {
36248
- if (disposed || context.signal.aborted) return;
36360
+ if (disposed || context2.signal.aborted) return;
36249
36361
  status.textContent = error51 instanceof RendererMethodUnavailableError ? text.unavailable : text.failed;
36250
36362
  status.hidden = false;
36251
36363
  scroll.hidden = true;
36252
36364
  } finally {
36253
36365
  owner.clearTimeout(requestTimer);
36254
- if (!disposed && !context.signal.aborted)
36366
+ if (!disposed && !context2.signal.aborted)
36255
36367
  timer = owner.setTimeout(() => void refresh(), 1e4);
36256
36368
  }
36257
36369
  };
@@ -36264,8 +36376,8 @@ ${detail}` : ""}`
36264
36376
  }
36265
36377
 
36266
36378
  // src/settings/idle-release-controls.ts
36267
- function mountIdleReleaseControls(context, messages, getLoadedSessionsClient) {
36268
- const { content } = context;
36379
+ function mountIdleReleaseControls(context2, messages, getLoadedSessionsClient) {
36380
+ const { content } = context2;
36269
36381
  const document2 = content.ownerDocument;
36270
36382
  const owner = document2.defaultView;
36271
36383
  if (!owner) return () => void 0;
@@ -36307,7 +36419,7 @@ ${detail}` : ""}`
36307
36419
  card.append(toggle.item, timeout.item);
36308
36420
  content.append(group);
36309
36421
  const disposeTable = mountLoadedSessionsTable(
36310
- { ...context, content: card },
36422
+ { ...context2, content: card },
36311
36423
  messages,
36312
36424
  getLoadedSessionsClient
36313
36425
  );
@@ -36380,8 +36492,8 @@ ${detail}` : ""}`
36380
36492
  id: "appearance",
36381
36493
  label: messages.pageLabels.appearance,
36382
36494
  icon: "settings",
36383
- mount(context) {
36384
- const document2 = context.content.ownerDocument;
36495
+ mount(context2) {
36496
+ const document2 = context2.content.ownerDocument;
36385
36497
  const ownerWindow = document2.defaultView;
36386
36498
  if (!ownerWindow) return;
36387
36499
  const heading = document2.createElement("div");
@@ -36433,9 +36545,9 @@ ${detail}` : ""}`
36433
36545
  ownerWindow.addEventListener(REASONING_SOFT_WRAP_CHANGE_EVENT, sync);
36434
36546
  row.item.append(toggle);
36435
36547
  card.append(row.item);
36436
- context.content.append(heading, description, group);
36548
+ context2.content.append(heading, description, group);
36437
36549
  const disposeIdleRelease = mountIdleReleaseControls(
36438
- context,
36550
+ context2,
36439
36551
  messages,
36440
36552
  getLoadedSessionsClient
36441
36553
  );
@@ -36673,7 +36785,7 @@ ${detail}` : ""}`
36673
36785
  }
36674
36786
  function defaultImportName(source, existing) {
36675
36787
  const base = source.provider === "openai-codex" ? "codex" : "grok";
36676
- const used = new Set(existing.map((record19) => record19.name));
36788
+ const used = new Set(existing.map((record21) => record21.name));
36677
36789
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
36678
36790
  if (!used.has(base)) return base;
36679
36791
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -36696,7 +36808,7 @@ ${detail}` : ""}`
36696
36808
  const shown = (text) => accountDisplayText(text, hideEmails);
36697
36809
  const targetButtons = /* @__PURE__ */ new Map();
36698
36810
  const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
36699
- const sourceOf = (record19) => snapshot.sources.find((source) => source.id === record19.source.id);
36811
+ const sourceOf = (record21) => snapshot.sources.find((source) => source.id === record21.source.id);
36700
36812
  const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
36701
36813
  const compatibleSources = () => {
36702
36814
  const target = piTarget();
@@ -36734,7 +36846,7 @@ ${detail}` : ""}`
36734
36846
  sectionImport.addEventListener("click", () => {
36735
36847
  const sources = compatibleSources();
36736
36848
  const free = sources.find(
36737
- (source2) => !importedRecords().some((record19) => record19.source.id === source2.id)
36849
+ (source2) => !importedRecords().some((record21) => record21.source.id === source2.id)
36738
36850
  );
36739
36851
  const source = free ?? sources[0];
36740
36852
  if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
@@ -36784,30 +36896,30 @@ ${detail}` : ""}`
36784
36896
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
36785
36897
  return mark;
36786
36898
  };
36787
- const renderRow = (record19) => {
36899
+ const renderRow = (record21) => {
36788
36900
  const row = document2.createElement("div");
36789
36901
  row.className = "settings-pi-accounts__row";
36790
36902
  row.tabIndex = -1;
36791
- row.dataset.importName = record19.name;
36792
- row.setAttribute("aria-label", shown(record19.source.label));
36793
- const agent = record19.source.harnessId;
36903
+ row.dataset.importName = record21.name;
36904
+ row.setAttribute("aria-label", shown(record21.source.label));
36905
+ const agent = record21.source.harnessId;
36794
36906
  const mark = createMark(agent);
36795
36907
  const identity = document2.createElement("div");
36796
36908
  identity.className = "settings-pi-accounts__identity";
36797
36909
  const label = document2.createElement("strong");
36798
36910
  label.className = "settings-account-email";
36799
- label.textContent = shown(record19.source.label);
36911
+ label.textContent = shown(record21.source.label);
36800
36912
  label.title = label.textContent;
36801
36913
  label.translate = false;
36802
36914
  const meta3 = document2.createElement("div");
36803
36915
  meta3.className = "settings-account-metadata";
36804
- const source = sourceOf(record19);
36916
+ const source = sourceOf(record21);
36805
36917
  const parts = [
36806
36918
  metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
36807
- metaPart(`${record19.name}/\u2026`, void 0, true),
36919
+ metaPart(`${record21.name}/\u2026`, void 0, true),
36808
36920
  metaPart(messages.copied)
36809
36921
  ];
36810
- const time3 = formatImportedAt(record19.importedAt);
36922
+ const time3 = formatImportedAt(record21.importedAt);
36811
36923
  if (time3) parts.push(metaPart(time3));
36812
36924
  parts.forEach((part, index) => {
36813
36925
  if (index > 0) {
@@ -36824,23 +36936,23 @@ ${detail}` : ""}`
36824
36936
  reimport.type = "button";
36825
36937
  reimport.className = "settings-account-action";
36826
36938
  reimport.textContent = messages.rowReimport;
36827
- reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record19.source.label)}`);
36939
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record21.source.label)}`);
36828
36940
  reimport.disabled = busy || !source;
36829
36941
  reimport.title = messages.reimport;
36830
36942
  reimport.addEventListener("click", () => {
36831
- if (source) openDialog("reimport", { source, record: record19 }, `row:${record19.name}`);
36943
+ if (source) openDialog("reimport", { source, record: record21 }, `row:${record21.name}`);
36832
36944
  });
36833
36945
  const remove = document2.createElement("button");
36834
36946
  remove.type = "button";
36835
36947
  remove.className = "settings-account-action settings-pi-accounts__remove";
36836
36948
  remove.textContent = messages.rowRemove;
36837
- remove.setAttribute("aria-label", `${messages.remove}: ${shown(record19.source.label)}`);
36949
+ remove.setAttribute("aria-label", `${messages.remove}: ${shown(record21.source.label)}`);
36838
36950
  remove.disabled = busy;
36839
- remove.addEventListener("click", () => openDialog("remove", { record: record19 }, `row:${record19.name}`));
36951
+ remove.addEventListener("click", () => openDialog("remove", { record: record21 }, `row:${record21.name}`));
36840
36952
  if (source) actions.append(reimport);
36841
36953
  actions.append(remove);
36842
36954
  row.append(mark, identity, actions);
36843
- rows.set(record19.name, row);
36955
+ rows.set(record21.name, row);
36844
36956
  return row;
36845
36957
  };
36846
36958
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -36993,7 +37105,7 @@ ${detail}` : ""}`
36993
37105
  const label = document2.createElement("strong");
36994
37106
  label.textContent = shown(choice.label);
36995
37107
  label.translate = false;
36996
- const existing = importedRecords().find((record19) => record19.source.id === choice.id);
37108
+ const existing = importedRecords().find((record21) => record21.source.id === choice.id);
36997
37109
  const agent = choice.harnessId;
36998
37110
  const detail = document2.createElement("span");
36999
37111
  detail.textContent = [
@@ -37034,7 +37146,7 @@ ${detail}` : ""}`
37034
37146
  const name = request.action === "list" ? void 0 : request.name;
37035
37147
  state = {
37036
37148
  source: state.source,
37037
- record: importedRecords().find((record19) => record19.name === name) ?? state.record
37149
+ record: importedRecords().find((record21) => record21.name === name) ?? state.record
37038
37150
  };
37039
37151
  show(next);
37040
37152
  } else {
@@ -37048,12 +37160,12 @@ ${detail}` : ""}`
37048
37160
  sourceRadios = [];
37049
37161
  body.replaceChildren();
37050
37162
  controls.replaceChildren();
37051
- const { source, record: record19 } = state;
37163
+ const { source, record: record21 } = state;
37052
37164
  const close = () => modal.close();
37053
37165
  if (mode2 === "add" || mode2 === "reimport") {
37054
37166
  title.textContent = mode2 === "add" ? messages.add : messages.reimport;
37055
37167
  modal.setAttribute("aria-label", title.textContent);
37056
- const active = source ?? record19?.source;
37168
+ const active = source ?? record21?.source;
37057
37169
  const choices = mode2 === "add" && state.choose ? compatibleSources() : [];
37058
37170
  if (choices.length > 1) body.append(sourcePicker(choices));
37059
37171
  else if (active) body.append(line(messages.source, shown(active.label)));
@@ -37062,8 +37174,8 @@ ${detail}` : ""}`
37062
37174
  input.maxLength = 48;
37063
37175
  input.autocomplete = "off";
37064
37176
  input.spellcheck = false;
37065
- input.value = record19?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
37066
- input.readOnly = Boolean(record19);
37177
+ input.value = record21?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
37178
+ input.readOnly = Boolean(record21);
37067
37179
  input.addEventListener("input", () => {
37068
37180
  nameEdited = true;
37069
37181
  });
@@ -37097,7 +37209,7 @@ ${detail}` : ""}`
37097
37209
  {
37098
37210
  action: mode2 === "reimport" ? "reimport" : "import",
37099
37211
  sourceId: source2.id,
37100
- name: record19?.name ?? input.value,
37212
+ name: record21?.name ?? input.value,
37101
37213
  confirmed: true
37102
37214
  },
37103
37215
  "done"
@@ -37107,16 +37219,16 @@ ${detail}` : ""}`
37107
37219
  )
37108
37220
  );
37109
37221
  (mode2 === "add" ? input : controls.children[0]).focus();
37110
- } else if (mode2 === "remove" && record19) {
37222
+ } else if (mode2 === "remove" && record21) {
37111
37223
  title.textContent = messages.remove;
37112
37224
  modal.setAttribute("aria-label", title.textContent);
37113
- body.append(note(messages.removeWarning.replace("{name}", record19.name)));
37225
+ body.append(note(messages.removeWarning.replace("{name}", record21.name)));
37114
37226
  const cancel = command(messages.cancel, close);
37115
37227
  controls.append(
37116
37228
  cancel,
37117
37229
  command(
37118
37230
  messages.remove,
37119
- () => submit({ action: "remove", name: record19.name, confirmed: true }, null),
37231
+ () => submit({ action: "remove", name: record21.name, confirmed: true }, null),
37120
37232
  "danger"
37121
37233
  )
37122
37234
  );
@@ -37124,7 +37236,7 @@ ${detail}` : ""}`
37124
37236
  } else {
37125
37237
  title.textContent = messages.doneTitle;
37126
37238
  modal.setAttribute("aria-label", title.textContent);
37127
- const name = record19?.name;
37239
+ const name = record21?.name;
37128
37240
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
37129
37241
  body.append(note(messages.done));
37130
37242
  const done = command(messages.close, close, "primary");
@@ -37171,21 +37283,21 @@ ${detail}` : ""}`
37171
37283
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
37172
37284
  );
37173
37285
  if (!source || !target) return null;
37174
- const record19 = target.imports.find((candidate) => candidate.source.id === source.id);
37286
+ const record21 = target.imports.find((candidate) => candidate.source.id === source.id);
37175
37287
  const key = `${harnessId}:${accountLabel}:import`;
37176
37288
  const button2 = document2.createElement("button");
37177
37289
  button2.type = "button";
37178
37290
  button2.className = "settings-account-pi-import";
37179
37291
  button2.dataset.accountFocus = key;
37180
37292
  button2.disabled = busy;
37181
- const hint = record19 ? messages.importedHint.replace("{name}", record19.name) : messages.add;
37293
+ const hint = record21 ? messages.importedHint.replace("{name}", record21.name) : messages.add;
37182
37294
  button2.title = hint;
37183
37295
  button2.setAttribute("aria-label", hint);
37184
37296
  button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
37185
- if (record19) {
37297
+ if (record21) {
37186
37298
  button2.dataset.state = "imported";
37187
37299
  const name = document2.createElement("code");
37188
- name.textContent = `${record19.name}/\u2026`;
37300
+ name.textContent = `${record21.name}/\u2026`;
37189
37301
  name.translate = false;
37190
37302
  button2.append(name, createRendererSettingsIcon("check", 12));
37191
37303
  } else {
@@ -37193,7 +37305,7 @@ ${detail}` : ""}`
37193
37305
  button2.append(messages.add);
37194
37306
  }
37195
37307
  button2.addEventListener("click", () => {
37196
- if (!record19) {
37308
+ if (!record21) {
37197
37309
  openDialog("add", { source }, key);
37198
37310
  return;
37199
37311
  }
@@ -37202,7 +37314,7 @@ ${detail}` : ""}`
37202
37314
  renderSection();
37203
37315
  sectionToggle.setAttribute("aria-expanded", "true");
37204
37316
  }
37205
- const row = rows.get(record19.name);
37317
+ const row = rows.get(record21.name);
37206
37318
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
37207
37319
  row?.focus();
37208
37320
  });
@@ -37905,8 +38017,8 @@ ${detail}` : ""}`
37905
38017
  id: "accounts",
37906
38018
  label: messages.pageLabels.accounts,
37907
38019
  icon: "accounts",
37908
- mount(context) {
37909
- const document2 = context.content.ownerDocument;
38020
+ mount(context2) {
38021
+ const document2 = context2.content.ownerDocument;
37910
38022
  const header = document2.createElement("div");
37911
38023
  header.className = "settings-account-header";
37912
38024
  const copy = document2.createElement("div");
@@ -37991,15 +38103,15 @@ ${detail}` : ""}`
37991
38103
  let plugins = [];
37992
38104
  const pluginFor = (id) => plugins.find((plugin) => plugin.id === id);
37993
38105
  const credentialImports = mountCredentialImports(
37994
- context.content,
37995
- context.signal,
38106
+ context2.content,
38107
+ context2.signal,
37996
38108
  getClient,
37997
38109
  messages.credentialImports,
37998
38110
  () => render(),
37999
38111
  pluginFor
38000
38112
  );
38001
- context.content.append(header, status, toolbar, list, credentialImports.section);
38002
- const stopCountdowns = mountAccountResetCountdowns(list, messages, context.signal);
38113
+ context2.content.append(header, status, toolbar, list, credentialImports.section);
38114
+ const stopCountdowns = mountAccountResetCountdowns(list, messages, context2.signal);
38003
38115
  let accounts = [];
38004
38116
  let currentAccountId = null;
38005
38117
  let accountPhase = "unavailable";
@@ -38105,7 +38217,7 @@ ${detail}` : ""}`
38105
38217
  requests.map(async ({ account, loading }) => {
38106
38218
  try {
38107
38219
  const result = await inspect({ accountId: account.accountId });
38108
- if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
38220
+ if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
38109
38221
  return;
38110
38222
  usageByAccountId.set(
38111
38223
  account.accountId,
@@ -38117,7 +38229,7 @@ ${detail}` : ""}`
38117
38229
  } : { status: "empty" }
38118
38230
  );
38119
38231
  } catch {
38120
- if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
38232
+ if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
38121
38233
  return;
38122
38234
  usageByAccountId.set(account.accountId, { status: "error" });
38123
38235
  }
@@ -38146,7 +38258,7 @@ ${detail}` : ""}`
38146
38258
  };
38147
38259
  const refreshInBackground = () => {
38148
38260
  if (!client().refreshCodexAccounts) return;
38149
- void context.runLatest(
38261
+ void context2.runLatest(
38150
38262
  () => client().refreshCodexAccounts?.() ?? client().listCodexAccounts(),
38151
38263
  {
38152
38264
  success(result) {
@@ -38158,7 +38270,7 @@ ${detail}` : ""}`
38158
38270
  );
38159
38271
  };
38160
38272
  const load = () => {
38161
- void context.runLatest(() => client().listCodexAccounts(), {
38273
+ void context2.runLatest(() => client().listCodexAccounts(), {
38162
38274
  success(result) {
38163
38275
  loadMessage = null;
38164
38276
  setAccounts(result);
@@ -38178,10 +38290,10 @@ ${detail}` : ""}`
38178
38290
  });
38179
38291
  } catch {
38180
38292
  }
38181
- const harnessAccounts = createHarnessAccounts(context.signal, getClient, render);
38293
+ const harnessAccounts = createHarnessAccounts(context2.signal, getClient, render);
38182
38294
  const directoryClient = getClient();
38183
38295
  void directoryClient?.listHarnessPlugins?.().then(({ plugins: next }) => {
38184
- if (context.signal.aborted || getClient() !== directoryClient) return;
38296
+ if (context2.signal.aborted || getClient() !== directoryClient) return;
38185
38297
  plugins = next;
38186
38298
  render();
38187
38299
  void credentialImports.refresh();
@@ -38204,14 +38316,14 @@ ${detail}` : ""}`
38204
38316
  id: "harness-schedules",
38205
38317
  label: t("\u5B9A\u65F6\u4EFB\u52A1", "Schedules"),
38206
38318
  icon: "schedules",
38207
- mount(context) {
38319
+ mount(context2) {
38208
38320
  const navigate = () => {
38209
- context.content.replaceChildren();
38210
- void context.runLatest((signal) => options.openSchedules(signal), {
38321
+ context2.content.replaceChildren();
38322
+ void context2.runLatest((signal) => options.openSchedules(signal), {
38211
38323
  success() {
38212
38324
  },
38213
38325
  failure() {
38214
- const document2 = context.content.ownerDocument;
38326
+ const document2 = context2.content.ownerDocument;
38215
38327
  const status = document2.createElement("p");
38216
38328
  status.setAttribute("role", "status");
38217
38329
  status.className = "text-sm text-settings-muted";
@@ -38224,7 +38336,7 @@ ${detail}` : ""}`
38224
38336
  retry.className = "rounded-lg px-3 py-2 text-sm text-settings-text hover:bg-settings-hover focus-visible:outline-2 focus-visible:outline-settings-focus";
38225
38337
  retry.textContent = t("\u91CD\u8BD5", "Retry");
38226
38338
  retry.addEventListener("click", navigate);
38227
- context.content.replaceChildren(status, retry);
38339
+ context2.content.replaceChildren(status, retry);
38228
38340
  }
38229
38341
  });
38230
38342
  };
@@ -38387,8 +38499,8 @@ ${detail}` : ""}`
38387
38499
  id: "about",
38388
38500
  label: messages.pageLabels.about,
38389
38501
  icon: "about",
38390
- mount(context) {
38391
- const document2 = context.content.ownerDocument;
38502
+ mount(context2) {
38503
+ const document2 = context2.content.ownerDocument;
38392
38504
  const heading = document2.createElement("div");
38393
38505
  heading.className = "settings-section-label";
38394
38506
  heading.textContent = messages.pageLabels.about;
@@ -38430,7 +38542,7 @@ ${detail}` : ""}`
38430
38542
  panel.append(product, tagline, introduction, starCallout, repositorySection);
38431
38543
  const consoleEntry = consoleSection(document2, messages, getClient());
38432
38544
  if (consoleEntry) panel.append(consoleEntry);
38433
- context.content.append(heading, panel);
38545
+ context2.content.append(heading, panel);
38434
38546
  return void 0;
38435
38547
  }
38436
38548
  });
@@ -38457,8 +38569,8 @@ ${detail}` : ""}`
38457
38569
  id: "updates",
38458
38570
  label: messages.pageLabels.updates,
38459
38571
  icon: "updates",
38460
- mount(context) {
38461
- const document2 = context.content.ownerDocument;
38572
+ mount(context2) {
38573
+ const document2 = context2.content.ownerDocument;
38462
38574
  const windows = isWindowsRenderer(document2.defaultView);
38463
38575
  const heading = document2.createElement("div");
38464
38576
  heading.className = "settings-section-label";
@@ -38559,7 +38671,7 @@ ${detail}` : ""}`
38559
38671
  const notes = document2.createElement("div");
38560
38672
  notes.className = "settings-update-notes-section";
38561
38673
  const starBanner = updateStarBanner(document2, messages);
38562
- context.content.append(heading, metadata, panel, controls, starBanner, notes);
38674
+ context2.content.append(heading, metadata, panel, controls, starBanner, notes);
38563
38675
  const setManualFallback = (fallback) => {
38564
38676
  controls.className = fallback ? "settings-update-controls" : "settings-update-controls is-quiet";
38565
38677
  manualNpmDescription.textContent = fallback ? messages.updateManualFallbackDescription : messages.updateManualNpmDescription;
@@ -38612,7 +38724,7 @@ ${detail}` : ""}`
38612
38724
  }
38613
38725
  pollAttempts += 1;
38614
38726
  pollTimer = document2.defaultView?.setTimeout(() => {
38615
- void context.runLatest(
38727
+ void context2.runLatest(
38616
38728
  (signal) => runBoundedRendererUpdateRequest(() => client.readUpdateStatus(), signal),
38617
38729
  {
38618
38730
  success(result) {
@@ -38659,7 +38771,7 @@ ${detail}` : ""}`
38659
38771
  if (pending) return;
38660
38772
  pending = true;
38661
38773
  renderPendingStatus(null, messages.updatePreparing);
38662
- void context.runLatest(
38774
+ void context2.runLatest(
38663
38775
  (signal) => runBoundedRendererUpdateRequest(() => client.startUpdate(), signal),
38664
38776
  {
38665
38777
  success(result) {
@@ -38765,7 +38877,7 @@ ${detail}` : ""}`
38765
38877
  }
38766
38878
  pending = true;
38767
38879
  renderPendingStatus(null, messages.updateChecking);
38768
- return context.runLatest(
38880
+ return context2.runLatest(
38769
38881
  (signal) => runBoundedRendererUpdateRequest(() => client.checkUpdate(), signal),
38770
38882
  {
38771
38883
  success(result) {
@@ -43914,7 +44026,7 @@ th[aria-sort] .console-usage-sort__mark {
43914
44026
  place();
43915
44027
  const observer = ownerWindow ? new ownerWindow.MutationObserver((records) => {
43916
44028
  const titlebar = source?.closest("[data-app-shell-titlebar]");
43917
- if (!source?.isConnected || records.some((record19) => titlebar?.contains(record19.target))) {
44029
+ if (!source?.isConnected || records.some((record21) => titlebar?.contains(record21.target))) {
43918
44030
  place();
43919
44031
  }
43920
44032
  }) : null;
@@ -46337,6 +46449,7 @@ ${usage_default}`;
46337
46449
  retryAttempt: 0
46338
46450
  });
46339
46451
  const harnessAvailabilityByHost = /* @__PURE__ */ new Map();
46452
+ const codexAccountLoads = /* @__PURE__ */ new WeakMap();
46340
46453
  const hostHarnessAvailabilityState = (hostId2) => {
46341
46454
  let state = harnessAvailabilityByHost.get(hostId2);
46342
46455
  if (!state) {
@@ -46433,7 +46546,11 @@ ${usage_default}`;
46433
46546
  const agent = controller.get(mounted.composer).agent;
46434
46547
  return state.plugins && agent !== "codex" && !state.plugins.some(({ id }) => id === agent) ? { ...state.availability, [agent]: "unavailable" } : state.availability;
46435
46548
  };
46436
- const composerAdapterState = (mounted) => composerClient(mounted) ? "ready" : "installing";
46549
+ const composerAdapterState = (mounted) => {
46550
+ const manager = mounted.hostId ? window.__codexhostHostRoutingV1?.forHost(mounted.hostId)?.manager : null;
46551
+ const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
46552
+ return composerClient(mounted) && (!needsRpcSteering || window.__codexhostRpcSteeringV1) ? "ready" : "installing";
46553
+ };
46437
46554
  const renderMounted = (mounted) => {
46438
46555
  if (!isMountedComposer(mounted.composer)) return;
46439
46556
  const hostId2 = mounted.hostId;
@@ -46654,7 +46771,7 @@ ${usage_default}`;
46654
46771
  const isExternalConfigurationReady = (mounted) => {
46655
46772
  const current = controller.get(mounted.composer);
46656
46773
  if (current.agent === "codex") return true;
46657
- return isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
46774
+ return composerAdapterState(mounted) === "ready" && isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
46658
46775
  };
46659
46776
  const clearDraftPrewarm = async (composer) => {
46660
46777
  const policy = await waitForRendererDraftPrewarmPolicy(window, composer);
@@ -47444,21 +47561,27 @@ ${usage_default}`;
47444
47561
  }
47445
47562
  }
47446
47563
  };
47564
+ const loadCodexAccountsForHost = (hostId2) => {
47565
+ const accounts = codexAccountsForHost(hostId2);
47566
+ if (!accounts) return Promise.resolve();
47567
+ const pending = codexAccountLoads.get(accounts);
47568
+ if (pending) return pending;
47569
+ const request = accounts.refresh().then(() => {
47570
+ if (disposed || codexAccountsForHost(hostId2) !== accounts) return;
47571
+ for (const mounted of mountedByComposer.values()) {
47572
+ if (mounted.hostId !== hostId2) continue;
47573
+ renderMounted(mounted);
47574
+ if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
47575
+ }
47576
+ }).finally(() => {
47577
+ if (codexAccountLoads.get(accounts) === request) codexAccountLoads.delete(accounts);
47578
+ });
47579
+ codexAccountLoads.set(accounts, request);
47580
+ return request;
47581
+ };
47447
47582
  const loadCodexAccounts = async () => {
47448
47583
  const hostIds = new Set([...mountedByComposer.values()].map((mounted) => mounted.hostId));
47449
- await Promise.all(
47450
- [...hostIds].map(async (hostId2) => {
47451
- const accounts = codexAccountsForHost(hostId2);
47452
- if (!accounts) return;
47453
- await accounts.refresh();
47454
- if (disposed || codexAccountsForHost(hostId2) !== accounts) return;
47455
- for (const mounted of mountedByComposer.values()) {
47456
- if (mounted.hostId !== hostId2) continue;
47457
- renderMounted(mounted);
47458
- if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
47459
- }
47460
- })
47461
- );
47584
+ await Promise.all([...hostIds].map(loadCodexAccountsForHost));
47462
47585
  };
47463
47586
  const openInstallPage = (hostId2, agent) => {
47464
47587
  const plugin = hostId2 ? hostHarnessAvailabilityState(hostId2).plugins?.find(({ id }) => id === agent) : void 0;
@@ -47669,7 +47792,8 @@ ${usage_default}`;
47669
47792
  void clearDraftPrewarm(mounted.composer).catch(() => void 0);
47670
47793
  }
47671
47794
  void loadExternalCatalog(mounted);
47672
- void refreshDraftUsage(mounted);
47795
+ if (state.agent === "codex") void loadCodexAccountsForHost(hostId2);
47796
+ else void refreshDraftUsage(mounted);
47673
47797
  continue;
47674
47798
  }
47675
47799
  const target = controllerTarget(mounted.modelTarget, hostId2);
@@ -47706,8 +47830,10 @@ ${usage_default}`;
47706
47830
  for (const mounted of mountedByComposer.values()) {
47707
47831
  const client = composerClient(mounted);
47708
47832
  const request = draftUsageRequests.get(mounted);
47709
- if (controller.get(mounted.composer).agent !== "codex" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
47710
- void refreshDraftUsage(mounted);
47833
+ const state = controller.get(mounted.composer);
47834
+ if (state.phase === "draft" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
47835
+ if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
47836
+ else void refreshDraftUsage(mounted);
47711
47837
  }
47712
47838
  }
47713
47839
  let connectionsChanged = false;
@@ -47948,7 +48074,10 @@ ${usage_default}`;
47948
48074
  } else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
47949
48075
  void loadExternalCatalog(mounted);
47950
48076
  }
47951
- if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftUsage(mounted);
48077
+ if (!threadIdFromComposerModelTarget(modelTarget)) {
48078
+ if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
48079
+ else void refreshDraftUsage(mounted);
48080
+ }
47952
48081
  void refreshCommands(mounted);
47953
48082
  };
47954
48083
  const scan = () => {
@@ -48010,7 +48139,12 @@ ${usage_default}`;
48010
48139
  }
48011
48140
  const state = controller.get(composer);
48012
48141
  const hideCodexControls = controller.isSwitching(composer) || state.agent !== "codex";
48013
- reconcileComposerNativeControls(mounted.control, hideCodexControls, hideCodexControls);
48142
+ reconcileComposerNativeControls(
48143
+ mounted.control,
48144
+ hideCodexControls,
48145
+ hideCodexControls,
48146
+ composerHidesNativeGoalControl(state.agent, controller.isSwitching(composer))
48147
+ );
48014
48148
  showCodexUsageGateStatus(mounted, mounted.codexUsageGate.refresh());
48015
48149
  }
48016
48150
  for (const editor of document.querySelectorAll(EDITOR_SELECTOR)) {
@@ -48261,8 +48395,15 @@ ${usage_default}`;
48261
48395
  };
48262
48396
  const onUsageBannerPreference = () => {
48263
48397
  for (const mounted of mountedByComposer.values()) {
48264
- const hideCodexControls = controller.isSwitching(mounted.composer) || controller.get(mounted.composer).agent !== "codex";
48265
- reconcileComposerNativeControls(mounted.control, hideCodexControls, hideCodexControls);
48398
+ const switching = controller.isSwitching(mounted.composer);
48399
+ const agent = controller.get(mounted.composer).agent;
48400
+ const hideCodexControls = switching || agent !== "codex";
48401
+ reconcileComposerNativeControls(
48402
+ mounted.control,
48403
+ hideCodexControls,
48404
+ hideCodexControls,
48405
+ composerHidesNativeGoalControl(agent, switching)
48406
+ );
48266
48407
  mounted.codexUsageGate.refresh();
48267
48408
  }
48268
48409
  };
@@ -48533,7 +48674,20 @@ ${usage_default}`;
48533
48674
  function isRecord16(value) {
48534
48675
  return typeof value === "object" && value !== null && !Array.isArray(value);
48535
48676
  }
48536
- function routeExternalVoiceLaunch(request, routing) {
48677
+ function lastAgentPluginRoute(owner) {
48678
+ try {
48679
+ const storage = owner.localStorage;
48680
+ const parsed = JSON.parse(storage?.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY) ?? "");
48681
+ if (typeof parsed.lastAgent !== "string" || parsed.lastAgent === "" || parsed.lastAgent === "codex")
48682
+ return void 0;
48683
+ const harnessId = harnessPluginIdSchema.safeParse(parsed.lastAgent);
48684
+ if (!harnessId.success) return void 0;
48685
+ return encodeHarnessPluginRoute({ harnessId: harnessId.data });
48686
+ } catch {
48687
+ return void 0;
48688
+ }
48689
+ }
48690
+ function routeExternalVoiceLaunch(request, routing, owner = globalThis) {
48537
48691
  rememberVoiceProductExperience(request);
48538
48692
  if (!routing || !isRecord16(request) || request.source !== "composer_button_new_thread")
48539
48693
  return request;
@@ -48542,8 +48696,9 @@ ${usage_default}`;
48542
48696
  if (typeof hostId2 !== "string" || !hostId2) return request;
48543
48697
  const route = routing.forComposer();
48544
48698
  if (!route || route.hostId !== hostId2 || routing.forHost(hostId2) !== route) return request;
48545
- const model2 = route.policy.selectedModel();
48546
- if (!model2?.startsWith("codexhost/")) return request;
48699
+ const selected = route.policy.selectedModel();
48700
+ const model2 = typeof selected === "string" && selected.startsWith("codexhost/") ? selected : lastAgentPluginRoute(owner);
48701
+ if (!model2) return request;
48547
48702
  const mode2 = request.activeCollaborationMode;
48548
48703
  if (mode2 !== void 0 && mode2 !== null && !isRecord16(mode2)) return request;
48549
48704
  const settings = isRecord16(mode2) ? mode2.settings : void 0;
@@ -48614,7 +48769,11 @@ ${usage_default}`;
48614
48769
  const chatStart = startNativeChatVoiceForRequest(request, target);
48615
48770
  if (chatStart) return chatStart;
48616
48771
  try {
48617
- request = routeExternalVoiceLaunch(request, target.__codexhostHostRoutingV1);
48772
+ request = routeExternalVoiceLaunch(
48773
+ request,
48774
+ target.__codexhostHostRoutingV1,
48775
+ target
48776
+ );
48618
48777
  } catch {
48619
48778
  }
48620
48779
  return Reflect.apply(start, original, [request, ...args.slice(1)]);
@@ -48905,7 +49064,7 @@ ${usage_default}`;
48905
49064
  };
48906
49065
  const external = () => {
48907
49066
  try {
48908
- return currentRoute()?.policy.selectedModel()?.startsWith("codexhost/") === true;
49067
+ return isExternalHarnessComposer(target);
48909
49068
  } catch {
48910
49069
  return false;
48911
49070
  }
@@ -49476,7 +49635,268 @@ ${usage_default}`;
49476
49635
  return handle;
49477
49636
  }
49478
49637
 
49638
+ // src/renderer-rpc-steering-queue.ts
49639
+ var INTERRUPTED = "Interrupted before the steer was accepted.";
49640
+ var record19 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
49641
+ async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
49642
+ const snapshot = Promise.withResolvers();
49643
+ let lease;
49644
+ let released = false;
49645
+ const dispose = (value) => {
49646
+ if (value != null) value[Symbol.dispose]?.();
49647
+ };
49648
+ const pending = manager("subscribe", {
49649
+ type: "thread",
49650
+ key: { hostId: hostId2, threadId },
49651
+ field: "queuedMessages",
49652
+ listener(value) {
49653
+ if (Array.isArray(value)) snapshot.resolve(value);
49654
+ }
49655
+ });
49656
+ let timeout;
49657
+ let messages;
49658
+ try {
49659
+ timeout = setTimeout(
49660
+ () => snapshot.reject(new Error("Native follow-up queue did not become ready")),
49661
+ 5e3
49662
+ );
49663
+ const ready = Promise.resolve(pending).then((value) => {
49664
+ if (released) dispose(value);
49665
+ else lease = value;
49666
+ });
49667
+ [messages] = await Promise.all([snapshot.promise, ready]);
49668
+ } finally {
49669
+ released = true;
49670
+ clearTimeout(timeout);
49671
+ for (const value of /* @__PURE__ */ new Set([pending, lease])) dispose(value);
49672
+ }
49673
+ if (messages.some(
49674
+ (message2) => record19(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
49675
+ ))
49676
+ throw new Error(
49677
+ "Resume or remove the other previously paused messages before changing direction"
49678
+ );
49679
+ return async (turnId) => {
49680
+ await coordinator("removeQueuedMessage", threadId, messageId);
49681
+ const state = await manager("getThreadExecutionState", threadId);
49682
+ const stillRunning = record19(state) && state.inProgress === true && state.activeTurnId === turnId;
49683
+ const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
49684
+ if (stillRunning || record19(turn) && turn.status === "completed")
49685
+ await coordinator("resumeInterruptedQueuedMessages", threadId);
49686
+ };
49687
+ }
49688
+
49689
+ // src/renderer-rpc-steering.ts
49690
+ var record20 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
49691
+ var invoke = (target, name, ...args) => Reflect.apply(Reflect.get(target, name), target, args);
49692
+ var running = (state) => record20(state) && (state.inProgress === true || !!state.activeTurnId);
49693
+ var context = (previous, marker) => ({
49694
+ ...record20(previous) ? previous : {},
49695
+ [THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
49696
+ });
49697
+ function installRendererRpcSteering(value) {
49698
+ if (!record20(value) || typeof value.forHost !== "function") return null;
49699
+ const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
49700
+ if (!descriptor?.writable) return null;
49701
+ const controller = value;
49702
+ const original = controller.forHost;
49703
+ const cached2 = /* @__PURE__ */ new WeakMap();
49704
+ let disposed = false;
49705
+ const wrap = (rpc, hostId2, owner = rpc) => {
49706
+ const existing = cached2.get(rpc);
49707
+ if (existing) return existing;
49708
+ const current = () => {
49709
+ if (disposed || original.call(controller, hostId2) !== owner)
49710
+ throw new Error("Steering connection was retired");
49711
+ };
49712
+ const inspect = async (threadId, input) => {
49713
+ const text = Array.isArray(input) ? input.filter(record20).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
49714
+ current();
49715
+ const delivery = await inspectRendererSteeringDelivery(
49716
+ (method, params) => {
49717
+ current();
49718
+ return invoke(rpc, "sendRequest", method, params);
49719
+ },
49720
+ threadId,
49721
+ text
49722
+ );
49723
+ current();
49724
+ return delivery;
49725
+ };
49726
+ const target = async (threadId, messageId, delivery) => {
49727
+ const state = await invoke(rpc, "getThreadExecutionState", threadId);
49728
+ current();
49729
+ if (!record20(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
49730
+ throw new Error("Native steering target or message identity is unavailable");
49731
+ return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
49732
+ };
49733
+ const withoutQueueRow = async (request) => {
49734
+ if (!record20(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
49735
+ return request;
49736
+ try {
49737
+ const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
49738
+ current();
49739
+ if (!running(state)) return request;
49740
+ const message2 = request.message;
49741
+ const text = record20(message2) && typeof message2.text === "string" ? message2.text : "";
49742
+ const delivery = await inspect(request.conversationId, [{ text }]);
49743
+ return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
49744
+ } catch {
49745
+ return request;
49746
+ }
49747
+ };
49748
+ const coordinator = (remote) => new Proxy(remote, {
49749
+ get(handle, key) {
49750
+ if (key === "then") {
49751
+ const then = Reflect.get(handle, key);
49752
+ return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [(value2) => resolve(coordinator(value2)), reject]) : then;
49753
+ }
49754
+ if (key === "dup") return () => coordinator(invoke(handle, "dup"));
49755
+ if (key !== "sendMessage" && key !== "sendQueuedMessageNow")
49756
+ return Reflect.get(handle, key);
49757
+ return async (...args) => {
49758
+ current();
49759
+ const index = key === "sendMessage" ? 1 : 3;
49760
+ const callback = args[index];
49761
+ if (typeof callback !== "function")
49762
+ throw new Error("Native submission preparation is unavailable");
49763
+ let marker = null;
49764
+ let threadId;
49765
+ let messageId;
49766
+ let finish;
49767
+ const apply = (prepared) => {
49768
+ if (!marker || !record20(prepared.steer)) return prepared;
49769
+ const result2 = {
49770
+ ...prepared,
49771
+ steer: {
49772
+ ...prepared.steer,
49773
+ additionalContext: context(prepared.steer.additionalContext, marker)
49774
+ }
49775
+ };
49776
+ if (marker.delivery !== "newTurn") return result2;
49777
+ if (!record20(prepared.start) || !record20(prepared.start.request))
49778
+ throw new Error("Native start preparation is unavailable for steering");
49779
+ return {
49780
+ ...result2,
49781
+ afterInactiveTurnId: marker.expectedTurnId,
49782
+ start: {
49783
+ ...prepared.start,
49784
+ request: {
49785
+ ...prepared.start.request,
49786
+ additionalContext: context(prepared.start.request.additionalContext, marker)
49787
+ }
49788
+ }
49789
+ };
49790
+ };
49791
+ const prepare = async (...input) => {
49792
+ current();
49793
+ const prepared = await callback(...input);
49794
+ current();
49795
+ if (!record20(prepared)) throw new Error("Native submission preparation is malformed");
49796
+ if (marker) return apply(prepared);
49797
+ if (input[1] !== "steer" || !record20(prepared.steer) || typeof prepared.conversationId !== "string")
49798
+ return prepared;
49799
+ threadId = prepared.conversationId;
49800
+ const execution = await invoke(rpc, "getThreadExecutionState", threadId);
49801
+ current();
49802
+ if (!running(execution)) return prepared;
49803
+ const delivery = await inspect(threadId, prepared.steer.input);
49804
+ if (delivery === "official") return prepared;
49805
+ const restore = prepared.steer.restoreMessage;
49806
+ messageId = record20(restore) && typeof restore.id === "string" ? restore.id : void 0;
49807
+ const clientId = prepared.steer.clientUserMessageId ?? messageId;
49808
+ marker = await target(threadId, clientId, delivery);
49809
+ if (delivery === "activeTurn") return apply(prepared);
49810
+ if (!messageId) throw new Error("Native queued message identity is unavailable");
49811
+ finish = await prepareRpcSteeringQueue(
49812
+ hostId2,
49813
+ threadId,
49814
+ (name, ...values) => invoke(rpc, name, ...values),
49815
+ (name, ...values) => invoke(remote, name, ...values),
49816
+ messageId
49817
+ );
49818
+ const start = await callback(input[0], "start");
49819
+ current();
49820
+ if (!record20(start)) throw new Error("Native start preparation is malformed");
49821
+ return apply(start);
49822
+ };
49823
+ const forwarded = [...args];
49824
+ forwarded[index] = prepare;
49825
+ if (key === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
49826
+ const result = await invoke(handle, key, ...forwarded);
49827
+ if (finish && record20(result) && result.status === "sent" && typeof result.turnId === "string") {
49828
+ await finish(result.turnId).catch(
49829
+ () => console.error("codexhost could not reconcile native steering queue")
49830
+ );
49831
+ }
49832
+ return result;
49833
+ };
49834
+ }
49835
+ });
49836
+ const wrapped = new Proxy(rpc, {
49837
+ get(handle, key) {
49838
+ if (key === "then") {
49839
+ const then = Reflect.get(handle, key);
49840
+ return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [
49841
+ (value2) => resolve(wrap(value2, hostId2, owner)),
49842
+ reject
49843
+ ]) : then;
49844
+ }
49845
+ if (key === "dup") return () => wrap(invoke(handle, "dup"), hostId2, owner);
49846
+ if (key === "getTurnCoordinator")
49847
+ return () => {
49848
+ current();
49849
+ return coordinator(invoke(handle, "getTurnCoordinator"));
49850
+ };
49851
+ return Reflect.get(handle, key);
49852
+ }
49853
+ });
49854
+ cached2.set(rpc, wrapped);
49855
+ return wrapped;
49856
+ };
49857
+ const forHost = (hostId2) => wrap(original.call(controller, hostId2), hostId2);
49858
+ controller.forHost = forHost;
49859
+ return () => {
49860
+ disposed = true;
49861
+ if (controller.forHost === forHost) Object.defineProperty(controller, "forHost", descriptor);
49862
+ };
49863
+ }
49864
+
49479
49865
  // src/production-entry.ts
49866
+ Object.defineProperty(window, "__codexhostInstallRpcSteeringV1", {
49867
+ configurable: true,
49868
+ value(controller) {
49869
+ const state = window;
49870
+ if (state.__codexhostRpcSteeringV1)
49871
+ return window.__codexhostRpcSteeringV1?.controller === controller;
49872
+ const routing = window.__codexhostHostRoutingV1;
49873
+ if (!routing) return false;
49874
+ const cleanup = installRendererRpcSteering(controller);
49875
+ if (!cleanup) return false;
49876
+ const originalDispose = routing.dispose;
49877
+ const dispose = () => {
49878
+ cleanup();
49879
+ delete state.__codexhostRpcSteeringV1;
49880
+ window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
49881
+ if (routing.dispose === dispose) routing.dispose = originalDispose;
49882
+ originalDispose.call(routing);
49883
+ };
49884
+ routing.dispose = dispose;
49885
+ state.__codexhostRpcSteeringV1 = {
49886
+ controller,
49887
+ // A later native Remote Control install replaces this method; the Controller
49888
+ // compares it on every tick and releases a displaced wrapper to reinstall.
49889
+ forHost: controller.forHost,
49890
+ release() {
49891
+ cleanup();
49892
+ delete state.__codexhostRpcSteeringV1;
49893
+ window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
49894
+ }
49895
+ };
49896
+ window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
49897
+ return true;
49898
+ }
49899
+ });
49480
49900
  installCpaLiveVoiceHook();
49481
49901
  installClientOwnedVoiceHook();
49482
49902
  installExternalVoiceLaunchHook();