@karlorz/codexhost-cli-win32-x64 0.16.1-3 → 0.17.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19221,6 +19221,16 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
19221
19221
  continue;
19222
19222
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
19223
19223
  continue;
19224
+ if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
19225
+ const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
19226
+ if (data.isMeta === true || contextOnly)
19227
+ continue;
19228
+ if (current) {
19229
+ if (body)
19230
+ current.input.push({ type: "text", text: body });
19231
+ continue;
19232
+ }
19233
+ }
19224
19234
  if (includeCompactionHistory && isNativeCompactionSummary(row)) {
19225
19235
  if (supportsNativeCommands && current) {
19226
19236
  const outcome = data.isCompacted === true ? { status: "succeeded" } : {
@@ -16147,6 +16147,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16147
16147
  return `${HARNESS_COMMAND_MENTION_PATH_PREFIX}${encodeURIComponent(name).replace(/[()]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
16148
16148
  }
16149
16149
 
16150
+ // ../shared-contracts/dist/desktop-attachments.js
16151
+ var ATTACHED_FILES_HEADING = /^\s*# Files mentioned by the user:[ \t]*(?:\r?\n|$)/u;
16152
+ var REQUEST_HEADING = /(?:^|\n)## My request:[ \t]*(?:\r?\n|$)/u;
16153
+ var IMAGE_ATTACHMENT_PATTERN = /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu;
16154
+ var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
16155
+ function desktopImageAttachmentPaths(text) {
16156
+ const end = text.search(REQUEST_HEADING);
16157
+ const context = end < 0 ? text : text.slice(0, end);
16158
+ if (!ATTACHED_FILES_HEADING.test(context))
16159
+ return [];
16160
+ return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
16161
+ }
16162
+
16150
16163
  // ../shared-contracts/dist/remote-runtime.js
16151
16164
  var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
16152
16165
  var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
@@ -16560,17 +16573,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16560
16573
  }
16561
16574
 
16562
16575
  // src/renderer-native-chat-voice-assets.ts
16563
- var NATIVE_CHAT_VOICE_VERSION = "26.1027.30824";
16564
- var NATIVE_CHAT_INITIAL_ASSET = "app-initial-60f141238751.js";
16565
- var START_ASSET = "start-voice-4c77215aa289.js";
16576
+ var NATIVE_CHAT_VOICE_VERSION = "26.1027.61615";
16577
+ var NATIVE_CHAT_INITIAL_ASSET = "app-initial-18b189e867e7.js";
16578
+ var START_ASSET = "start-voice-221a396d38a5.js";
16566
16579
  var NATIVE_CHAT_VOICE_ASSETS = [
16567
16580
  {
16568
16581
  platform: "darwin",
16569
16582
  version: NATIVE_CHAT_VOICE_VERSION,
16570
16583
  initial: NATIVE_CHAT_INITIAL_ASSET,
16584
+ shared: "app-shared-601019a330d7.js",
16585
+ primary: "app-primary-75d53eef2374.js",
16586
+ start: START_ASSET,
16587
+ prewarm: "voice-prewarm-a7cd5160219e.js",
16588
+ settings: "voice-settings-320cf1212f2c.js"
16589
+ },
16590
+ {
16591
+ platform: "darwin",
16592
+ version: "26.1027.30824",
16593
+ initial: "app-initial-60f141238751.js",
16571
16594
  shared: "app-shared-7815d5a1a42a.js",
16572
16595
  primary: "app-primary-95a0e6d83f1e.js",
16573
- start: START_ASSET,
16596
+ start: "start-voice-4c77215aa289.js",
16574
16597
  prewarm: "voice-prewarm-e49220ad61bd.js"
16575
16598
  },
16576
16599
  {
@@ -16627,16 +16650,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16627
16650
  )
16628
16651
  );
16629
16652
  if (!sharedModule || !initialModule || !startModule || !prewarm) throw new Error();
16630
- const newest = assets.version === NATIVE_CHAT_VOICE_VERSION;
16653
+ const modern = assets.version === NATIVE_CHAT_VOICE_VERSION;
16654
+ const newest = modern || assets.version === "26.1027.30824";
16631
16655
  const latest = newest || assets.version === "26.1023.51421";
16632
16656
  const current = latest || assets.version === "26.1021.31345";
16633
- const initialize = newest ? primary?.Yp : latest ? primary?.gm : current ? primary?.um : initialModule.oT;
16657
+ const initialize = modern ? primary?.Qp : newest ? primary?.Yp : latest ? primary?.gm : current ? primary?.um : initialModule.oT;
16634
16658
  const start = current && !latest ? { t: startModule.r, n: startModule.i } : startModule;
16635
- if (typeof start.t !== "function" || typeof start.n !== "function" || typeof initialize !== "function" || typeof (newest ? initialModule.Xen : latest ? initialModule["s$t"] : current ? initialModule.qXt : initialModule.SPn) !== "function" || typeof (newest ? sharedModule.pWt : latest ? sharedModule.OHt : current ? sharedModule.XVt : sharedModule.FBt) !== "function" || typeof (newest ? sharedModule.GFt : latest ? sharedModule.wPt : current ? sharedModule.KNt : sharedModule.PNt) !== "function" || typeof prewarm.VoiceInstantConnectCacheController !== "function")
16659
+ if (typeof start.t !== "function" || typeof start.n !== "function" || typeof initialize !== "function" || typeof (modern ? initialModule.etn : newest ? initialModule.Xen : latest ? initialModule["s$t"] : current ? initialModule.qXt : initialModule.SPn) !== "function" || typeof (newest ? sharedModule.pWt : latest ? sharedModule.OHt : current ? sharedModule.XVt : sharedModule.FBt) !== "function" || typeof (newest ? sharedModule.GFt : latest ? sharedModule.wPt : current ? sharedModule.KNt : sharedModule.PNt) !== "function" || typeof prewarm.VoiceInstantConnectCacheController !== "function")
16636
16660
  throw new Error();
16637
16661
  initialize();
16638
16662
  start.t();
16639
- const initial = newest ? {
16663
+ const initial = modern ? {
16664
+ MOr: initialModule.p5n,
16665
+ CDr: initialModule.w6n,
16666
+ B1n: initialModule._On,
16667
+ SPn: initialModule.etn,
16668
+ oT: primary?.Qp,
16669
+ aT: primary?.Zp,
16670
+ Ycr: initialModule.ofr,
16671
+ Nir: initialModule.yEn,
16672
+ n0n: initialModule.FOn,
16673
+ Y1n: initialModule.JOn,
16674
+ HJt: initialModule.Z6
16675
+ } : newest ? {
16640
16676
  MOr: initialModule.l5n,
16641
16677
  CDr: initialModule.b6n,
16642
16678
  B1n: initialModule.pOn,
@@ -16863,12 +16899,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16863
16899
  if (!entry)
16864
16900
  return;
16865
16901
  entry.update((current) => {
16902
+ const { original } = entry;
16903
+ if (!original)
16904
+ return current;
16866
16905
  const settings = current.modelSettings;
16867
16906
  return settings?.model === entry.model && current.modelSettingsPersistAsDefault === false ? {
16868
16907
  ...current,
16869
- modelSettings: entry.original.modelSettings,
16870
- modelSettingsPersistAsDefault: entry.original.modelSettingsPersistAsDefault,
16871
- isManuallyChanged: entry.original.isManuallyChanged
16908
+ modelSettings: original.modelSettings,
16909
+ modelSettingsPersistAsDefault: original.modelSettingsPersistAsDefault,
16910
+ isManuallyChanged: original.isManuallyChanged
16872
16911
  } : current;
16873
16912
  });
16874
16913
  captured.delete(key);
@@ -16877,15 +16916,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16877
16916
  has(key) {
16878
16917
  return captured.has(key);
16879
16918
  },
16919
+ /** The carrier last written to this draft, or null while it keeps its native setting. */
16920
+ model(key) {
16921
+ return captured.get(key)?.model ?? null;
16922
+ },
16880
16923
  apply(key, binding, model2) {
16881
16924
  if (model2 === null) {
16882
16925
  restore(key);
16883
16926
  return;
16884
16927
  }
16885
16928
  const { update, usesAccountPreferences } = binding;
16929
+ const previous = captured.get(key);
16930
+ const entry = { update, model: model2 };
16886
16931
  update((current) => {
16887
- const previous = captured.get(key);
16888
- captured.set(key, { update, original: previous?.original ?? current, model: model2 });
16932
+ entry.original ??= previous?.original ?? current;
16889
16933
  const settings = current.modelSettings;
16890
16934
  if (settings?.model === model2 && settings.usesAccountPreferences === usesAccountPreferences && current.modelSettingsPersistAsDefault === false)
16891
16935
  return current;
@@ -16902,6 +16946,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16902
16946
  }
16903
16947
  };
16904
16948
  });
16949
+ captured.set(key, entry);
16905
16950
  },
16906
16951
  dispose() {
16907
16952
  for (const key of captured.keys())
@@ -18201,10 +18246,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18201
18246
  }
18202
18247
 
18203
18248
  // src/renderer-client-owned-voice.ts
18204
- var CLIENT_OWNED_VOICE_VERSION = "26.1027.30824";
18205
- var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-60f141238751.js";
18206
- var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-7815d5a1a42a.js";
18207
- var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-d9d400e751cd.js";
18249
+ var CLIENT_OWNED_VOICE_VERSION = "26.1027.61615";
18250
+ var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-18b189e867e7.js";
18251
+ var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-601019a330d7.js";
18252
+ var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-920d05377bbe.js";
18208
18253
  var CLIENT_OWNED_VOICE_ASSETS = [
18209
18254
  {
18210
18255
  platform: "darwin",
@@ -18212,6 +18257,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18212
18257
  initial: CLIENT_OWNED_VOICE_INITIAL_ASSET,
18213
18258
  shared: CLIENT_OWNED_VOICE_SHARED_ASSET,
18214
18259
  overlay: CLIENT_OWNED_VOICE_OVERLAY_ASSET,
18260
+ init: "Adr",
18261
+ fetch: "Odr",
18262
+ fetchFrom: "initial",
18263
+ bridge: "LRt",
18264
+ services: "Vct",
18265
+ responseError: "Pdr",
18266
+ responseErrorFrom: "initial",
18267
+ capabilityInit: "Ler",
18268
+ capabilityFamily: "Ier",
18269
+ inferenceGateFamily: "Vfr"
18270
+ },
18271
+ {
18272
+ platform: "darwin",
18273
+ version: "26.1027.30824",
18274
+ initial: "app-initial-60f141238751.js",
18275
+ shared: "app-shared-7815d5a1a42a.js",
18276
+ overlay: "avatar-overlay-native-page-d9d400e751cd.js",
18215
18277
  init: "Edr",
18216
18278
  fetch: "wdr",
18217
18279
  fetchFrom: "initial",
@@ -20905,6 +20967,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20905
20967
  loaded = true;
20906
20968
  show(value);
20907
20969
  }).catch(() => {
20970
+ loaded = true;
20908
20971
  status.textContent = messages.launchPathLoadError;
20909
20972
  }).finally(() => {
20910
20973
  busy = false;
@@ -22738,7 +22801,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
22738
22801
  launchPathAutomatic: "No saved override. Uses environment configuration, then automatic discovery.",
22739
22802
  launchPathSaving: "Saving\u2026",
22740
22803
  launchPathLoading: "Loading launch settings\u2026",
22741
- launchPathLoadError: "Could not load launch settings. Reopen this detail panel to retry.",
22804
+ launchPathLoadError: "Could not load launch settings. Save an installation directory or reset to automatic discovery to replace them.",
22742
22805
  launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
22743
22806
  grokComputerUseLabel: "Grok Computer Use",
22744
22807
  grokComputerUseTitle: "Computer Use",
@@ -23046,7 +23109,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
23046
23109
  launchPathAutomatic: "\u672A\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u8DEF\u5F84\uFF0C\u4F7F\u7528\u73AF\u5883\u53D8\u91CF\u914D\u7F6E\u6216\u81EA\u52A8\u53D1\u73B0\u3002",
23047
23110
  launchPathSaving: "\u6B63\u5728\u4FDD\u5B58\u2026",
23048
23111
  launchPathLoading: "\u6B63\u5728\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u2026",
23049
- launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u6B64\u8BE6\u60C5\u9762\u677F\u91CD\u8BD5\u3002",
23112
+ launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u3002\u4FDD\u5B58\u5B89\u88C5\u76EE\u5F55\u6216\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u5373\u53EF\u66FF\u6362\u3002",
23050
23113
  launchPathSaveError: "\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u586B\u5199\u6B64 Host \u4E0A\u5B9E\u9645\u5B58\u5728\u7684\u5B89\u88C5\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5E76\u786E\u8BA4\u914D\u7F6E\u76EE\u5F55\u53EF\u5199\u3002",
23051
23114
  grokComputerUseLabel: "Grok Computer Use",
23052
23115
  grokComputerUseTitle: "Computer Use",
@@ -28586,10 +28649,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
28586
28649
  const currentRole = manager.getStreamRole?.(threadId);
28587
28650
  if (isRecord9(currentRole) && currentRole.role === "follower")
28588
28651
  return originalSteer.apply(manager, args);
28589
- if (!Array.isArray(input) || input.length === 0 || input.some(
28590
- (item) => !isRecord9(item) || item.type !== "text" || typeof item.text !== "string"
28591
- ) || !input.some((item) => isRecord9(item) && typeof item.text === "string" && item.text.trim())) {
28592
- throw new Error("External steering requires non-empty text input");
28652
+ if (!Array.isArray(input) || input.length === 0 || input.some((item) => {
28653
+ if (!isRecord9(item)) return true;
28654
+ if (item.type === "text") return typeof item.text !== "string";
28655
+ if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
28656
+ if (item.type === "image") return typeof item.url !== "string" || !item.url;
28657
+ return true;
28658
+ }) || !input.some(
28659
+ (item) => isRecord9(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
28660
+ )) {
28661
+ throw new Error("External steering requires non-empty text or image input");
28593
28662
  }
28594
28663
  if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
28595
28664
  if (!isRecord9(restoreMessage) || !isRecord9(restoreMessage.context)) {
@@ -28728,16 +28797,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
28728
28797
  for (let index = 0; index < decoded.length; index += 1) bytes[index] = decoded.charCodeAt(index);
28729
28798
  return { contents: new Blob([bytes], { type: mimeType }), extension };
28730
28799
  }
28731
- function nativeImagePaths(text) {
28732
- const context = text.split("## My request:")[0] ?? "";
28733
- const start = context.indexOf("# Files mentioned by the user:");
28734
- if (start < 0) return [];
28735
- return [
28736
- ...context.slice(start).matchAll(
28737
- /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu
28738
- )
28739
- ].map((match) => match[1]).filter(filePath);
28740
- }
28741
28800
  function createRemoteAttachmentSender(target, hostId2, isCurrent) {
28742
28801
  const prepared = /* @__PURE__ */ new WeakMap();
28743
28802
  return (params, send) => {
@@ -28762,7 +28821,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28762
28821
  if (cached2) return cached2.then(dispatch);
28763
28822
  const input = params.input;
28764
28823
  const text = input.filter((item) => isRecord10(item) && item.type === "text").map((item) => isRecord10(item) && typeof item.text === "string" ? item.text : "").join("\n");
28765
- const existingPaths = nativeImagePaths(text);
28824
+ const existingPaths = desktopImageAttachmentPaths(text);
28766
28825
  const prepare = async () => {
28767
28826
  if (existingPaths.length === images.length) return params;
28768
28827
  if (images.length > 20) throw new Error("Too many remote image attachments (maximum 20)");
@@ -30271,8 +30330,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
30271
30330
  const draftKey = target[1];
30272
30331
  if (!binding || !route.policy.scopedCreation)
30273
30332
  return agent === "codex" && !draftModels.has(draftKey);
30274
- draftModels.apply(draftKey, binding, carrier ?? null);
30275
- if (route.policy.select(carrier ?? null, draftKey, binding.creationModes)) {
30333
+ const previous = draftModels.model(draftKey);
30334
+ const policyChanged = route.policy.select(carrier ?? null, draftKey, binding.creationModes);
30335
+ try {
30336
+ draftModels.apply(draftKey, binding, carrier ?? null);
30337
+ } catch (error51) {
30338
+ try {
30339
+ route.policy.select(previous, draftKey, binding.creationModes);
30340
+ } catch {
30341
+ }
30342
+ throw error51;
30343
+ }
30344
+ if (policyChanged) {
30276
30345
  modelUpdates += 1;
30277
30346
  liveStatus.modelUpdates = modelUpdates;
30278
30347
  }
@@ -33845,7 +33914,7 @@ ${detail}` : ""}`
33845
33914
  "codexhost was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 codexhost\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 codexhost \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
33846
33915
  "The active codexhost does not match the global npm installation. Uninstall only the remote service, or remove the package manually on the remote computer": "\u5F53\u524D codexhost \u4E0E npm \u5168\u5C40\u5B89\u88C5\u4F4D\u7F6E\u4E0D\u5339\u914D\u3002\u8BF7\u9009\u62E9\u4EC5\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1\uFF0C\u6216\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u5378\u8F7D\u8F6F\u4EF6\u5305",
33847
33916
  "The remote service was uninstalled, but removing the codexhost package failed. Check npm permissions on the remote computer and retry": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5378\u8F7D\uFF0C\u4F46 codexhost \u8F6F\u4EF6\u5305\u5378\u8F7D\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u4E0A\u7684 npm \u6743\u9650\u540E\u91CD\u8BD5",
33848
- "Remote Node.js is unsupported. Select Node.js 22.19 or later in the 22.x series, or Node.js 24.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7684 22.x \u7248\u672C\uFF0C\u6216 Node.js 24.x",
33917
+ "Remote Node.js is unsupported. Select Node.js 22.19 or later, except 23.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7248\u672C\uFF0C\u4F46\u4E0D\u5305\u62EC 23.x",
33849
33918
  "npm installation failed. Check network access and global installation permissions": "npm \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u548C\u5168\u5C40\u5B89\u88C5\u6743\u9650",
33850
33919
  "Remote service configuration failed. Check Codex CLI and the remote desktop login": "\u8FDC\u7A0B\u670D\u52A1\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 Codex CLI \u4EE5\u53CA\u8FDC\u7A0B\u7535\u8111\u7684\u684C\u9762\u767B\u5F55\u72B6\u6001",
33851
33920
  "Remote service could not stop. Check the remote service before retrying": "\u8FDC\u7A0B\u670D\u52A1\u65E0\u6CD5\u505C\u6B62\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u670D\u52A1\u540E\u91CD\u8BD5",
@@ -35179,6 +35248,30 @@ ${detail}` : ""}`
35179
35248
  };
35180
35249
  }
35181
35250
 
35251
+ // src/settings/session-import-sources.ts
35252
+ async function loadSessionImportSources(client, diagnostics, signal, refresh) {
35253
+ const { harnesses } = await client.listSessionImportSources();
35254
+ signal.throwIfAborted();
35255
+ if (!diagnostics || harnesses.length === 0) return harnesses;
35256
+ const hostId2 = client.hostId ?? "local";
35257
+ const readHost = () => diagnostics.snapshot().hosts.find((host2) => host2.hostId === hostId2);
35258
+ let host = readHost();
35259
+ const incomplete = () => !host || Boolean(host.directoryError) || harnesses.some(({ harnessId }) => {
35260
+ const status = host?.agents.find(({ agent }) => agent === harnessId)?.availability;
35261
+ return status === void 0 || status === "checking";
35262
+ });
35263
+ if (refresh || incomplete()) {
35264
+ await diagnostics.refresh(hostId2);
35265
+ signal.throwIfAborted();
35266
+ host = readHost();
35267
+ }
35268
+ if (incomplete()) throw new Error("Harness installation diagnostics are incomplete");
35269
+ const missing = new Set(
35270
+ host?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
35271
+ );
35272
+ return harnesses.filter(({ harnessId }) => !missing.has(harnessId));
35273
+ }
35274
+
35182
35275
  // src/settings/session-import-page.ts
35183
35276
  function shortSessionId(value) {
35184
35277
  return value.length <= 18 ? value : `${value.slice(0, 10)}\u2026${value.slice(-6)}`;
@@ -35248,7 +35341,7 @@ ${detail}` : ""}`
35248
35341
  ...getDiagnostics()?.snapshot().hosts.map(({ hostId: hostId2 }) => hostId2) ?? [],
35249
35342
  ...current ? [current] : []
35250
35343
  ])
35251
- ];
35344
+ ].filter((hostId2) => hostId2 !== "durable");
35252
35345
  displayedHostId = current;
35253
35346
  const scrollLeft = hostOptions.scrollLeft;
35254
35347
  hostOptions.replaceChildren();
@@ -35592,10 +35685,14 @@ ${detail}` : ""}`
35592
35685
  content.append(list);
35593
35686
  updateImportActions();
35594
35687
  };
35595
- const load = () => {
35688
+ const load = (refreshDiagnostics = false) => {
35596
35689
  if (importingId !== null || context.signal.aborted) return;
35597
35690
  loadedClient = null;
35598
- const client = getClient(selectedHostId);
35691
+ let client = getClient(selectedHostId);
35692
+ if (client?.hostId === "durable") {
35693
+ selectedHostId = "local";
35694
+ client = getClient(selectedHostId);
35695
+ }
35599
35696
  renderHosts(client);
35600
35697
  listControls.setBusy(client !== null);
35601
35698
  refresh.disabled = client !== null;
@@ -35608,11 +35705,11 @@ ${detail}` : ""}`
35608
35705
  void context.runLatest(
35609
35706
  async (signal) => {
35610
35707
  if (!client) throw new RendererSessionImportUnavailableError();
35611
- const missing = new Set(
35612
- getDiagnostics()?.snapshot().hosts.find(({ hostId: hostId2 }) => hostId2 === (client.hostId ?? "local"))?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
35613
- );
35614
- const harnesses = (await client.listSessionImportSources()).harnesses.filter(
35615
- ({ harnessId }) => !missing.has(harnessId)
35708
+ const harnesses = await loadSessionImportSources(
35709
+ client,
35710
+ getDiagnostics(),
35711
+ signal,
35712
+ refreshDiagnostics
35616
35713
  );
35617
35714
  const selected = harnesses.find(({ harnessId }) => harnessId === requestedHarness)?.harnessId ?? harnesses[0]?.harnessId ?? null;
35618
35715
  if (signal.aborted) throw new Error("Session import selection changed");
@@ -35663,7 +35760,7 @@ ${detail}` : ""}`
35663
35760
  load();
35664
35761
  hostButtons.find((button2) => button2.dataset.sessionImportHost === hostId2)?.focus();
35665
35762
  };
35666
- refresh.addEventListener("click", load);
35763
+ refresh.addEventListener("click", () => load(true));
35667
35764
  load();
35668
35765
  return void 0;
35669
35766
  }
@@ -45739,6 +45836,7 @@ ${usage_default}`;
45739
45836
  });
45740
45837
  const mountedByComposer = /* @__PURE__ */ new Map();
45741
45838
  const catalogRequests = /* @__PURE__ */ new WeakMap();
45839
+ const draftUsageRequests = /* @__PURE__ */ new WeakMap();
45742
45840
  const pendingReplacements = /* @__PURE__ */ new Map();
45743
45841
  let disposed = false;
45744
45842
  const disposeReasoningSoftWrap = installReasoningTranscriptSoftWrap(document);
@@ -45872,7 +45970,7 @@ ${usage_default}`;
45872
45970
  for (const mounted of mountedByComposer.values()) {
45873
45971
  if (mounted.hostId !== hostId2) continue;
45874
45972
  renderMounted(mounted);
45875
- void refreshDraftCodexUsage(mounted);
45973
+ if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
45876
45974
  }
45877
45975
  });
45878
45976
  });
@@ -46055,36 +46153,59 @@ ${usage_default}`;
46055
46153
  renderMounted(mounted);
46056
46154
  }
46057
46155
  };
46058
- const refreshDraftCodexUsage = async (mounted) => {
46156
+ const refreshDraftUsage = async (mounted) => {
46059
46157
  const state = controller.get(mounted.composer);
46060
- if (state.agent !== "codex" || state.phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget))
46158
+ if (state.phase !== "draft" || controller.isSwitching(mounted.composer) || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget))
46061
46159
  return;
46062
- const accounts = composerCodexAccounts(mounted.composer);
46063
- const client = accounts?.client;
46160
+ const agent = state.agent;
46161
+ const accounts = agent === "codex" ? composerCodexAccounts(mounted.composer) : null;
46064
46162
  const accountId = accounts?.readyAccountId;
46163
+ const client = composerClient(mounted);
46065
46164
  const hostId2 = mounted.hostId;
46165
+ const previous = draftUsageRequests.get(mounted);
46166
+ if (agent !== "codex" && previous?.pending && previous.client === client && previous.generation === mounted.usageRequestGeneration)
46167
+ return;
46066
46168
  const generation = ++mounted.usageRequestGeneration;
46169
+ const request = { client, generation, pending: true };
46170
+ draftUsageRequests.set(mounted, request);
46171
+ mounted.draftUsageClient = null;
46067
46172
  mounted.usage = null;
46068
46173
  mounted.accountCredits = null;
46174
+ mounted.accountCreditsSupported = false;
46069
46175
  renderMounted(mounted);
46070
- if (!accountId || !client?.inspectCodexAccountUsage) return;
46176
+ const isCurrent = () => !disposed && mounted.hostId === hostId2 && composerClient(mounted) === client && mounted.composer.isConnected && mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation && controller.get(mounted.composer).agent === agent && controller.get(mounted.composer).phase === "draft" && !controller.isSwitching(mounted.composer) && !controller.isSubmissionPending(mounted.composer) && !threadIdFromComposerModelTarget(mounted.modelTarget);
46071
46177
  try {
46072
- const result = await client.inspectCodexAccountUsage({ accountId });
46073
- if (disposed || mounted.hostId !== hostId2 || composerCodexAccounts(mounted.composer) !== accounts || !mounted.composer.isConnected || mountedByComposer.get(mounted.composer) !== mounted || mounted.usageRequestGeneration !== generation || controller.get(mounted.composer).agent !== "codex" || controller.get(mounted.composer).phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget) || accounts.readyAccountId !== accountId || result.accountId !== accountId)
46074
- return;
46075
- mounted.usage = result.usage;
46076
- mounted.accountCredits = result.accountCredits ?? null;
46178
+ if (!client) return;
46179
+ if (agent === "codex") {
46180
+ if (!accountId || !client.inspectCodexAccountUsage) return;
46181
+ const result = await client.inspectCodexAccountUsage({ accountId });
46182
+ if (!isCurrent() || composerCodexAccounts(mounted.composer) !== accounts || accounts?.readyAccountId !== accountId || result.accountId !== accountId)
46183
+ return;
46184
+ mounted.usage = result.usage;
46185
+ mounted.accountCredits = result.accountCredits ?? null;
46186
+ } else {
46187
+ if (!client.inspectHarnessAccount) return;
46188
+ const result = await client.inspectHarnessAccount({
46189
+ harnessId: harnessIdSchema.parse(agent),
46190
+ refresh: true
46191
+ });
46192
+ if (!isCurrent() || result.harnessId !== agent) return;
46193
+ mounted.accountCredits = result.account?.credits ?? null;
46194
+ }
46195
+ mounted.draftUsageClient = client;
46077
46196
  renderMounted(mounted);
46078
46197
  } catch {
46198
+ } finally {
46199
+ request.pending = false;
46079
46200
  }
46080
46201
  };
46081
46202
  const refreshThreadUsage = async (mounted, refresh) => {
46082
46203
  const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
46083
- if (!threadId && controller.get(mounted.composer).agent === "codex") {
46084
- await refreshDraftCodexUsage(mounted);
46204
+ if (!threadId) {
46205
+ await refreshDraftUsage(mounted);
46085
46206
  return;
46086
46207
  }
46087
- if (!threadId || !modelControl) {
46208
+ if (!modelControl) {
46088
46209
  mounted.usage = null;
46089
46210
  mounted.accountCredits = null;
46090
46211
  usageRefreshAttempts.delete(mounted.composer);
@@ -46879,8 +47000,23 @@ ${usage_default}`;
46879
47000
  if (agent !== "codex" && composerAvailability(mounted)[agent] !== "ready") {
46880
47001
  return false;
46881
47002
  }
47003
+ const state = controller.get(mounted.composer);
47004
+ if (state.phase !== "draft" || controller.isSwitching(mounted.composer)) return false;
46882
47005
  controller.clearPendingSubmission(mounted.composer);
46883
- const composerId = controller.get(mounted.composer).composerId;
47006
+ const composerId = state.composerId;
47007
+ for (const candidate of mountedByComposer.values()) {
47008
+ if (controller.get(candidate.composer).composerId !== composerId) continue;
47009
+ candidate.usageRequestGeneration += 1;
47010
+ candidate.usage = null;
47011
+ candidate.accountCredits = null;
47012
+ candidate.accountCreditsSupported = false;
47013
+ usageRefreshAttempts.delete(candidate.composer);
47014
+ const timer = usageRefreshTimers.get(candidate.composer);
47015
+ if (timer !== void 0) {
47016
+ window.clearTimeout(timer);
47017
+ usageRefreshTimers.delete(candidate.composer);
47018
+ }
47019
+ }
46884
47020
  controller.invalidateModelRequests(mounted.composer);
46885
47021
  const switching = controller.switchAgent(mounted.composer, agent, {
46886
47022
  applyAgent: (nextAgent) => applyDraftAgentCarrier(mounted.composer, nextAgent),
@@ -46908,7 +47044,9 @@ ${usage_default}`;
46908
47044
  return false;
46909
47045
  } finally {
46910
47046
  for (const candidate of mountedByComposer.values()) {
46911
- if (controller.get(candidate.composer).composerId === composerId) renderMounted(candidate);
47047
+ if (controller.get(candidate.composer).composerId !== composerId) continue;
47048
+ renderMounted(candidate);
47049
+ void refreshDraftUsage(candidate);
46912
47050
  }
46913
47051
  }
46914
47052
  };
@@ -46923,7 +47061,7 @@ ${usage_default}`;
46923
47061
  for (const mounted of mountedByComposer.values()) {
46924
47062
  if (mounted.hostId !== hostId2) continue;
46925
47063
  renderMounted(mounted);
46926
- void refreshDraftCodexUsage(mounted);
47064
+ if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
46927
47065
  }
46928
47066
  })
46929
47067
  );
@@ -47137,6 +47275,7 @@ ${usage_default}`;
47137
47275
  void clearDraftPrewarm(mounted.composer).catch(() => void 0);
47138
47276
  }
47139
47277
  void loadExternalCatalog(mounted);
47278
+ void refreshDraftUsage(mounted);
47140
47279
  continue;
47141
47280
  }
47142
47281
  const target = controllerTarget(mounted.modelTarget, hostId2);
@@ -47165,11 +47304,18 @@ ${usage_default}`;
47165
47304
  }
47166
47305
  if (changed) sidebarAgentIcons.refresh();
47167
47306
  };
47168
- function reconcileHarnessAvailabilityHost() {
47307
+ function reconcileHarnessAvailabilityHost(retryDraftUsage = false) {
47169
47308
  for (const hostId3 of modelControl?.knownHostIds?.() ?? []) {
47170
47309
  hostHarnessAvailabilityState(hostId3);
47171
47310
  }
47172
47311
  reloadMountedOwnershipForHost();
47312
+ for (const mounted of mountedByComposer.values()) {
47313
+ const client = composerClient(mounted);
47314
+ const request = draftUsageRequests.get(mounted);
47315
+ if (controller.get(mounted.composer).agent !== "codex" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
47316
+ void refreshDraftUsage(mounted);
47317
+ }
47318
+ }
47173
47319
  let connectionsChanged = false;
47174
47320
  for (const target of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
47175
47321
  if (!target) continue;
@@ -47388,6 +47534,7 @@ ${usage_default}`;
47388
47534
  accountCreditsSupported: inherited?.accountCreditsSupported ?? false,
47389
47535
  hostId: inherited?.hostId ?? hostId2,
47390
47536
  usageRequestGeneration: 0,
47537
+ draftUsageClient: null,
47391
47538
  commandRequestGeneration: 0
47392
47539
  };
47393
47540
  mountedByComposer.set(composer, mounted);
@@ -47407,7 +47554,7 @@ ${usage_default}`;
47407
47554
  } else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
47408
47555
  void loadExternalCatalog(mounted);
47409
47556
  }
47410
- if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftCodexUsage(mounted);
47557
+ if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftUsage(mounted);
47411
47558
  void refreshCommands(mounted);
47412
47559
  };
47413
47560
  const scan = () => {
@@ -47688,7 +47835,7 @@ ${usage_default}`;
47688
47835
  document.addEventListener("keydown", onKeyDown, true);
47689
47836
  document.addEventListener("click", onClick, true);
47690
47837
  const onWindowFocus = () => {
47691
- reconcileHarnessAvailabilityHost();
47838
+ reconcileHarnessAvailabilityHost(true);
47692
47839
  void loadCodexAccounts();
47693
47840
  for (const mounted of mountedByComposer.values()) {
47694
47841
  if (mounted.hostId === activeModelHostId(mounted.composer) && mounted.ownershipStatus === "error") {
@@ -47888,6 +48035,7 @@ ${usage_default}`;
47888
48035
  for (const mounted of mountedByComposer.values()) {
47889
48036
  renderMounted(mounted);
47890
48037
  void refreshCommands(mounted);
48038
+ if (controller.get(mounted.composer).agent !== "codex") void refreshDraftUsage(mounted);
47891
48039
  }
47892
48040
  },
47893
48041
  dispose() {
@@ -48894,18 +49042,19 @@ ${usage_default}`;
48894
49042
  )
48895
49043
  );
48896
49044
  if (disposed) return;
49045
+ const modern = assets.version === "26.1027.61615";
48897
49046
  const latest = assets.version === "26.1023.51421";
48898
- const initialize = latest ? initial.N4n : initial.l0n;
49047
+ const initialize = modern ? initial.Ler : latest ? initial.N4n : initial.l0n;
48899
49048
  if (typeof initialize !== "function" || typeof settings.VoiceSettings !== "function")
48900
49049
  return;
48901
49050
  initialize();
48902
- const dictationMode = latest ? initial.KG : initial.mW;
49051
+ const dictationMode = modern ? initial.UO : latest ? initial.KG : initial.mW;
48903
49052
  modules = {
48904
- appScope: latest ? shared.uct : shared.Bst,
49053
+ appScope: modern ? shared.klt : latest ? shared.uct : shared.Bst,
48905
49054
  page: settings.VoiceSettings,
48906
- access: latest ? initial.yer : initial.k5n,
48907
- capability: latest ? initial.M4n : initial.c0n,
48908
- gates: latest ? initial.Par : initial.Cnr,
49055
+ access: modern ? initial.Dsr : latest ? initial.yer : initial.k5n,
49056
+ capability: modern ? initial.Ier : latest ? initial.M4n : initial.c0n,
49057
+ gates: modern ? initial.Vfr : latest ? initial.Par : initial.Cnr,
48909
49058
  ...dictationMode ? { dictationMode } : {}
48910
49059
  };
48911
49060
  }
package/bin/codexhost.exe CHANGED
Binary file
Binary file
Binary file
Binary file