@codexhost/cli-darwin-x64 0.25.0 → 0.26.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +174 -18
  4. package/app/console-web.js +543 -230
  5. package/app/desktop-controller.mjs +154 -5
  6. package/app/host-runtime.mjs +1064 -645
  7. package/app/plugins/antigravity/plugin.mjs +202 -19
  8. package/app/plugins/claude-code/plugin.mjs +195 -10
  9. package/app/plugins/codebuddy/plugin.mjs +154 -5
  10. package/app/plugins/codex-usage/plugin.mjs +154 -5
  11. package/app/plugins/copilot/plugin.mjs +154 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +154 -5
  13. package/app/plugins/deepseek-harness/plugin.mjs +182 -36
  14. package/app/plugins/devin/plugin.mjs +154 -5
  15. package/app/plugins/grok/plugin.mjs +154 -5
  16. package/app/plugins/hermes/plugin.mjs +198 -20
  17. package/app/plugins/kimi-code/plugin.mjs +154 -5
  18. package/app/plugins/kiro-cli/plugin.mjs +154 -5
  19. package/app/plugins/omp/plugin.mjs +154 -5
  20. package/app/plugins/opencode/plugin.mjs +155 -9
  21. package/app/plugins/pi/plugin.mjs +296 -33
  22. package/app/plugins/qoder/plugin.mjs +154 -5
  23. package/app/plugins/qoder-cn/plugin.mjs +154 -5
  24. package/app/plugins/qwen-code/plugin.mjs +154 -5
  25. package/app/plugins/workbuddy/plugin.mjs +154 -5
  26. package/app/plugins/zcode/plugin.mjs +154 -5
  27. package/app/renderer-extension.js +1132 -330
  28. package/app/web/assets/{index-DUOvhHbV.js → index-Bl_9AU27.js} +70 -70
  29. package/app/web/assets/{index-CTCFIQbU.css → index-arwoPpaG.css} +1 -1
  30. package/app/web/codexhost-settings.js +230 -140
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -10
  34. package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +13 -13
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +73 -73
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +75 -75
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  44. package/app/web-modules/server.mjs +14416 -13144
  45. package/bin/codexhost +0 -0
  46. package/libexec/CodexHost.app/Contents/Info.plist +2 -2
  47. package/libexec/CodexHost.app/Contents/MacOS/CodexHost +0 -0
  48. package/libexec/codexhost-shim +0 -0
  49. package/libexec/codexhost-updater +0 -0
  50. package/package.json +1 -1
@@ -16149,7 +16149,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16149
16149
  assignments: external_exports.record(external_exports.string(), external_exports.string()),
16150
16150
  projectless: external_exports.array(external_exports.string()),
16151
16151
  /** Canonical external pin membership; pins/list provides the native merged order. */
16152
- pinned: external_exports.array(external_exports.string())
16152
+ pinned: external_exports.array(external_exports.string()),
16153
+ /** Projects Desktop placed in each custom section, keyed by the official section ID, in
16154
+ * Desktop's section order. Omitted when no section holds a project. */
16155
+ sectionProjects: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())).optional()
16153
16156
  });
16154
16157
  var record2 = external_exports.record(external_exports.string(), external_exports.unknown());
16155
16158
  var clientChannelCursorSchema = external_exports.object({
@@ -16342,7 +16345,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16342
16345
  var threadCatalogReadParamsSchema = external_exports.object({
16343
16346
  includeArchived: external_exports.boolean().optional(),
16344
16347
  /** Absent means first page; null means this branch is exhausted. Native cursors only. */
16345
- officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
16348
+ officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional(),
16349
+ /**
16350
+ * Keep reading native pages until one holds a Thread in `cwd` but outside every
16351
+ * `excludeCwds` folder, the branch ends, or a page bound is reached. Every row read is
16352
+ * returned, so the native cursors stay contiguous.
16353
+ */
16354
+ scope: external_exports.object({
16355
+ cwd: external_exports.string().min(1).max(4096),
16356
+ excludeCwds: external_exports.array(external_exports.string().min(1).max(4096)).max(1024)
16357
+ }).strict().optional()
16346
16358
  }).strict();
16347
16359
  var threadCatalogReadResultSchema = external_exports.object({
16348
16360
  threads: external_exports.array(jsonObjectSchema),
@@ -16681,7 +16693,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16681
16693
  timeoutMinutes: external_exports.number().int().min(IDLE_RELEASE_TIMEOUT_MINUTES_MIN).max(IDLE_RELEASE_TIMEOUT_MINUTES_MAX)
16682
16694
  });
16683
16695
  var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
16684
- enabled: false,
16696
+ enabled: true,
16685
16697
  timeoutMinutes: 10
16686
16698
  });
16687
16699
 
@@ -17627,7 +17639,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17627
17639
  var UPDATE_ERROR_MAX_LENGTH = 500;
17628
17640
  var UPDATE_SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
17629
17641
  var updateSemanticVersionSchema = external_exports.string().regex(UPDATE_SEMVER_PATTERN);
17630
- var updateInstallationSchema = external_exports.enum(["npm", "windows-installer", "macos-dmg"]);
17642
+ var updateInstallationSchema = external_exports.enum([
17643
+ "npm",
17644
+ "windows-installer",
17645
+ "macos-dmg",
17646
+ "linux-archive"
17647
+ ]);
17631
17648
  var updatePhaseSchema = external_exports.enum([
17632
17649
  "prepared",
17633
17650
  "downloading",
@@ -17798,7 +17815,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17798
17815
  var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
17799
17816
  var REMOTE_IDENTITY_MAX_LENGTH = 1024;
17800
17817
  var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
17801
- var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17818
+ var target = {
17819
+ hostId: identity.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)
17820
+ };
17802
17821
  var thread = { ...target, threadId: identity };
17803
17822
  var text = external_exports.string().min(1).max(8e3);
17804
17823
  var input = { text, requestId: identity };
@@ -18017,6 +18036,136 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18017
18036
  var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
18018
18037
  var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
18019
18038
 
18039
+ // ../shared-contracts/dist/remote-peers.js
18040
+ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
18041
+ var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
18042
+ var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
18043
+ var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
18044
+ var remotePeerStateSchema = external_exports.enum([
18045
+ "connected",
18046
+ "connecting",
18047
+ "auth-error",
18048
+ "offline",
18049
+ "disabled"
18050
+ ]);
18051
+ var remotePeerSummarySchema = external_exports.object({
18052
+ peerId: remotePeerIdSchema,
18053
+ hostId: remotePeerHostIdSchema,
18054
+ name: external_exports.string().min(1).max(120),
18055
+ origin: external_exports.string().min(1).max(2048),
18056
+ transportKind: remotePeerTransportKindSchema,
18057
+ encrypted: external_exports.boolean(),
18058
+ enabled: external_exports.boolean(),
18059
+ state: remotePeerStateSchema,
18060
+ latencyMs: external_exports.number().int().nonnegative().optional(),
18061
+ version: external_exports.string().max(128).optional(),
18062
+ platform: external_exports.string().max(64).optional(),
18063
+ hostname: external_exports.string().max(255).optional(),
18064
+ homeDir: external_exports.string().max(4096).optional(),
18065
+ lastError: external_exports.string().max(1e3).optional(),
18066
+ projectCount: external_exports.number().int().nonnegative(),
18067
+ createdAt: external_exports.string(),
18068
+ updatedAt: external_exports.string()
18069
+ });
18070
+ var remotePeerListResultSchema = external_exports.object({
18071
+ peers: external_exports.array(remotePeerSummarySchema)
18072
+ });
18073
+ var remotePeerAddParamsSchema = external_exports.object({
18074
+ connectionUrl: external_exports.string().min(1).max(4096).optional(),
18075
+ origin: external_exports.string().min(1).max(2048).optional(),
18076
+ token: external_exports.string().min(1).max(2048).optional(),
18077
+ name: external_exports.string().trim().min(1).max(120).optional()
18078
+ }).refine((input2) => Boolean(input2.connectionUrl) || Boolean(input2.origin) && Boolean(input2.token), "Provide either connectionUrl or both origin and token");
18079
+ var remotePeerUpdateParamsSchema = external_exports.object({
18080
+ peerId: remotePeerIdSchema,
18081
+ name: external_exports.string().trim().min(1).max(120).optional(),
18082
+ connectionUrl: external_exports.string().min(1).max(4096).optional(),
18083
+ origin: external_exports.string().min(1).max(2048).optional(),
18084
+ token: external_exports.string().min(1).max(2048).optional(),
18085
+ enabled: external_exports.boolean().optional()
18086
+ });
18087
+ var remotePeerIdParamsSchema = external_exports.object({
18088
+ peerId: remotePeerIdSchema
18089
+ });
18090
+ var remotePeerRemoveResultSchema = external_exports.object({
18091
+ removed: external_exports.boolean()
18092
+ });
18093
+ var remotePeerTestParamsSchema = external_exports.object({
18094
+ peerId: remotePeerIdSchema.optional(),
18095
+ connectionUrl: external_exports.string().min(1).max(4096).optional(),
18096
+ origin: external_exports.string().min(1).max(2048).optional(),
18097
+ token: external_exports.string().min(1).max(2048).optional()
18098
+ }).refine((input2) => Boolean(input2.peerId) || Boolean(input2.connectionUrl) || Boolean(input2.origin) && Boolean(input2.token), "Provide peerId, connectionUrl, or both origin and token");
18099
+ var remotePeerTestResultSchema = external_exports.object({
18100
+ ok: external_exports.boolean(),
18101
+ latencyMs: external_exports.number().int().nonnegative().optional(),
18102
+ origin: external_exports.string().max(2048).optional(),
18103
+ transportKind: remotePeerTransportKindSchema.optional(),
18104
+ encrypted: external_exports.boolean().optional(),
18105
+ version: external_exports.string().max(128).optional(),
18106
+ platform: external_exports.string().max(64).optional(),
18107
+ hostname: external_exports.string().max(255).optional(),
18108
+ homeDir: external_exports.string().max(4096).optional(),
18109
+ projectCount: external_exports.number().int().nonnegative().optional(),
18110
+ error: external_exports.string().max(1e3).optional()
18111
+ });
18112
+ var remotePeerManifestProjectSchema = external_exports.object({
18113
+ id: external_exports.string().min(1).max(1024),
18114
+ name: external_exports.string().min(1).max(512),
18115
+ path: external_exports.string().min(1).max(8192),
18116
+ threadIds: external_exports.array(external_exports.string().min(1).max(1024))
18117
+ });
18118
+ var remotePeerManifestSchema = external_exports.object({
18119
+ version: external_exports.string().max(128),
18120
+ platform: external_exports.string().max(64),
18121
+ hostname: external_exports.string().max(255),
18122
+ homeDir: external_exports.string().max(4096).optional(),
18123
+ epoch: external_exports.string().min(1).max(256),
18124
+ projects: external_exports.array(remotePeerManifestProjectSchema)
18125
+ });
18126
+ var remotePeerDirectoryEntrySchema = external_exports.object({
18127
+ name: external_exports.string().min(1).max(512),
18128
+ path: external_exports.string().min(1).max(8192),
18129
+ kind: external_exports.literal("directory")
18130
+ });
18131
+ var remotePeerListDirsParamsSchema = external_exports.object({
18132
+ peerId: remotePeerIdSchema,
18133
+ path: external_exports.string().min(1).max(8192).optional()
18134
+ });
18135
+ var remotePeerListDirsResultSchema = external_exports.object({
18136
+ path: external_exports.string().min(1).max(8192),
18137
+ parentPath: external_exports.string().min(1).max(8192).nullable(),
18138
+ homeDir: external_exports.string().min(1).max(8192).optional(),
18139
+ entries: external_exports.array(remotePeerDirectoryEntrySchema)
18140
+ });
18141
+ var remotePeerCreateDirParamsSchema = external_exports.object({
18142
+ peerId: remotePeerIdSchema,
18143
+ parentPath: external_exports.string().min(1).max(8192),
18144
+ name: external_exports.string().min(1).max(255).refine((value) => value.trim().length > 0, "Directory name cannot be blank")
18145
+ });
18146
+ var remotePeerCreateDirResultSchema = external_exports.object({
18147
+ path: external_exports.string().min(1).max(8192),
18148
+ name: external_exports.string().min(1).max(255)
18149
+ });
18150
+ var remotePeerCreateWorkspaceParamsSchema = external_exports.object({
18151
+ peerId: remotePeerIdSchema,
18152
+ path: external_exports.string().min(1).max(8192),
18153
+ title: external_exports.string().trim().min(1).max(255).optional()
18154
+ });
18155
+ var remotePeerRenameWorkspaceParamsSchema = external_exports.object({
18156
+ peerId: remotePeerIdSchema,
18157
+ workspaceId: external_exports.string().min(1).max(1024),
18158
+ title: external_exports.string().trim().min(1).max(255)
18159
+ });
18160
+ var remotePeerDeleteWorkspaceParamsSchema = external_exports.object({
18161
+ peerId: remotePeerIdSchema,
18162
+ workspaceId: external_exports.string().min(1).max(1024)
18163
+ });
18164
+ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
18165
+ workspaceId: external_exports.string().min(1).max(1024).optional(),
18166
+ manifest: remotePeerManifestSchema
18167
+ });
18168
+
18020
18169
  // ../shared-contracts/dist/index.js
18021
18170
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
18022
18171
 
@@ -20279,6 +20428,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20279
20428
  var TRIGGER_CHIP_ROOT_CLASS = "codexhost-trigger-chip-root";
20280
20429
  var COMPACT_COMPOSER_ATTRIBUTE = "data-codexhost-compact-composer";
20281
20430
  var COMPACT_COMPOSER_WIDTH = 420;
20431
+ var COMPACT_PERMISSION_COMPOSER_ATTRIBUTE = "data-codexhost-compact-permission-composer";
20432
+ var COMPACT_PERMISSION_COMPOSER_WIDTH = 600;
20282
20433
  var TRIGGER_CHIP_SQUEEZE_MIN_WIDTH = "48px";
20283
20434
  function rendererModelTriggerMaxWidth() {
20284
20435
  return "min(280px, 36vw)";
@@ -20312,17 +20463,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20312
20463
  const update = () => {
20313
20464
  const width = composer.getBoundingClientRect().width;
20314
20465
  if (width > 0) {
20466
+ composer.toggleAttribute(
20467
+ COMPACT_PERMISSION_COMPOSER_ATTRIBUTE,
20468
+ width <= COMPACT_PERMISSION_COMPOSER_WIDTH
20469
+ );
20315
20470
  composer.toggleAttribute(COMPACT_COMPOSER_ATTRIBUTE, width <= COMPACT_COMPOSER_WIDTH);
20316
20471
  }
20317
20472
  };
20473
+ const clear = () => {
20474
+ composer.removeAttribute(COMPACT_PERMISSION_COMPOSER_ATTRIBUTE);
20475
+ composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
20476
+ };
20318
20477
  update();
20319
- if (typeof ResizeObserver === "undefined")
20320
- return () => composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
20478
+ if (typeof ResizeObserver === "undefined") return clear;
20321
20479
  const observer = new ResizeObserver(update);
20322
20480
  observer.observe(composer, { box: "border-box" });
20323
20481
  return () => {
20324
20482
  observer.disconnect();
20325
- composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
20483
+ clear();
20326
20484
  };
20327
20485
  }
20328
20486
  function ensureRendererTriggerChipStyle(ownerDocument) {
@@ -20366,19 +20524,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20366
20524
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-model-control] [data-codexhost-model-thinking] {
20367
20525
  display: none !important;
20368
20526
  }
20527
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control],
20369
20528
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control] {
20370
20529
  min-width: 30px !important;
20371
20530
  max-width: 30px !important;
20372
20531
  }
20532
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control] .${TRIGGER_CHIP_CLASS},
20373
20533
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control] .${TRIGGER_CHIP_CLASS} {
20374
20534
  padding-inline: 6px !important;
20375
20535
  }
20536
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-label],
20537
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-chevron],
20376
20538
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-label],
20377
20539
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-chevron],
20378
20540
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-credits-label],
20379
20541
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-usage-label] {
20380
20542
  display: none !important;
20381
20543
  }
20544
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-lock]:not([hidden])) [data-codexhost-permission-shield],
20545
+ [${COMPACT_PERMISSION_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-error]:not([hidden])) [data-codexhost-permission-shield],
20382
20546
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-lock]:not([hidden])) [data-codexhost-permission-shield],
20383
20547
  [${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-error]:not([hidden])) [data-codexhost-permission-shield] {
20384
20548
  display: none !important;
@@ -24177,7 +24341,7 @@ ${error51.stderrTail}`] : []
24177
24341
  screenshotPreviewLabel: "\u9884\u89C8\u7B2C {index} \u5F20\u622A\u56FE\uFF08\u5171 {total} \u5F20\uFF09",
24178
24342
  previousScreenshot: "\u4E0A\u4E00\u5F20\u622A\u56FE",
24179
24343
  nextScreenshot: "\u4E0B\u4E00\u5F20\u622A\u56FE",
24180
- closePreview: "\u6536\u8D77\u5927\u56FE",
24344
+ closePreview: "\u5173\u95ED\u9884\u89C8",
24181
24345
  openExtensionSettings: "\u6253\u5F00\u8BBE\u7F6E",
24182
24346
  extensionSettingsTitle: "\u63D2\u4EF6\u8BBE\u7F6E",
24183
24347
  extensionSettingsDisabledHint: "\u7981\u7528\u65F6\u4E5F\u53EF\u7F16\u8F91",
@@ -24501,6 +24665,7 @@ ${error51.stderrTail}`] : []
24501
24665
  updateInstallationNpm: "npm",
24502
24666
  updateInstallationWindowsInstaller: "Windows installer",
24503
24667
  updateInstallationMacOsDmg: "macOS DMG",
24668
+ updateInstallationLinuxArchive: "Linux archive (.tar.gz)",
24504
24669
  updateInstallationUnknown: "Unknown",
24505
24670
  updateLatestVersion: "Latest version",
24506
24671
  updateUpToDate: "You are up to date.",
@@ -24803,6 +24968,7 @@ ${error51.stderrTail}`] : []
24803
24968
  updateInstallationNpm: "npm",
24804
24969
  updateInstallationWindowsInstaller: "Windows \u5B89\u88C5\u7A0B\u5E8F",
24805
24970
  updateInstallationMacOsDmg: "macOS DMG",
24971
+ updateInstallationLinuxArchive: "Linux \u538B\u7F29\u5305\uFF08.tar.gz\uFF09",
24806
24972
  updateInstallationUnknown: "\u672A\u77E5",
24807
24973
  updateLatestVersion: "\u6700\u65B0\u7248\u672C",
24808
24974
  updateUpToDate: "\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002",
@@ -25907,6 +26073,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
25907
26073
  function isRendererModelPickerDisabled(view) {
25908
26074
  return view.status === "waitingForAdapter" || view.status === "loading" || view.status === "selecting" || view.status === "empty" || view.catalog === void 0;
25909
26075
  }
26076
+ function canRetryRendererModelCatalog(view) {
26077
+ return view.status === "error" && view.catalog === void 0 && view.refreshing !== true;
26078
+ }
25910
26079
  function shouldCloseRendererModelPicker(view) {
25911
26080
  return isRendererModelPickerDisabled(view) && view.status !== "selecting";
25912
26081
  }
@@ -26229,6 +26398,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
26229
26398
  positionAdvancedMenus(control);
26230
26399
  };
26231
26400
  const onTriggerClick = () => {
26401
+ if (trigger.hasAttribute("data-codexhost-retry-models")) {
26402
+ onRefreshModels?.();
26403
+ return;
26404
+ }
26232
26405
  if (pickerOpen()) close();
26233
26406
  else open();
26234
26407
  };
@@ -26531,7 +26704,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
26531
26704
  syncRendererLabelText(control.thinkingLabel, secondaryLabel ?? "");
26532
26705
  control.thinkingLabel.hidden = secondaryLabel === void 0;
26533
26706
  const accessibleLabel = secondaryLabel ? `${presentation.modelLabel}, ${secondaryLabel}` : presentation.modelLabel;
26534
- control.trigger.title = view.error ?? accessibleLabel;
26707
+ const retryCatalog = control.refreshButton !== void 0 && canRetryRendererModelCatalog(view);
26708
+ control.trigger.title = retryCatalog ? `${view.error ?? accessibleLabel}
26709
+ ${messages.refreshModels}` : view.error ?? accessibleLabel;
26535
26710
  const selectionFailed = rendererModelSelectionFailed(view);
26536
26711
  control.errorMark.hidden = !selectionFailed;
26537
26712
  control.errorMark.style.display = selectionFailed ? "inline-flex" : "none";
@@ -26543,14 +26718,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
26543
26718
  "aria-busy",
26544
26719
  String(view.status === "loading" || view.status === "selecting")
26545
26720
  );
26546
- control.trigger.disabled = isRendererModelPickerDisabled(view);
26547
- control.fast.render(view.catalog, view.selected, control.trigger.disabled, locale === "zh-CN");
26721
+ const pickerDisabled = isRendererModelPickerDisabled(view);
26722
+ control.trigger.disabled = pickerDisabled && !retryCatalog;
26723
+ control.trigger.toggleAttribute("data-codexhost-retry-models", retryCatalog);
26724
+ control.fast.render(view.catalog, view.selected, pickerDisabled, locale === "zh-CN");
26548
26725
  control.trigger.style.paddingLeft = control.fast.button.hidden ? "8px" : "2px";
26549
26726
  if (control.fast.button.hidden) control.fast.button.remove();
26550
26727
  else if (control.fast.button.parentElement !== control.root)
26551
26728
  control.root.prepend(control.fast.button);
26552
26729
  if (shouldCloseRendererModelPicker(view) && !keepOpenMenu) control.close();
26553
- control.modelButton.disabled = control.trigger.disabled;
26730
+ control.modelButton.disabled = pickerDisabled;
26554
26731
  for (const [modelId2, option] of control.options) {
26555
26732
  const selected = sameHarnessModelRef(
26556
26733
  harnessModelRefFromKey(modelId2),
@@ -26558,14 +26735,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
26558
26735
  );
26559
26736
  option.button.setAttribute("aria-checked", String(selected));
26560
26737
  option.button.classList.toggle("bg-token-list-hover-background", selected);
26561
- option.button.disabled = control.trigger.disabled;
26738
+ option.button.disabled = pickerDisabled;
26562
26739
  option.check.style.visibility = selected ? "visible" : "hidden";
26563
26740
  }
26564
26741
  for (const [thinkingOptionId, option] of control.thinkingOptions) {
26565
26742
  const selected = thinkingOptionId === view.selectedThinkingOptionId;
26566
26743
  option.button.setAttribute("aria-checked", String(selected));
26567
26744
  option.button.classList.toggle("bg-token-list-hover-background", selected);
26568
- option.button.disabled = control.trigger.disabled || !presentation.thinkingSelectionEnabled;
26745
+ option.button.disabled = pickerDisabled || !presentation.thinkingSelectionEnabled;
26569
26746
  option.check.style.visibility = selected ? "visible" : "hidden";
26570
26747
  }
26571
26748
  syncModelSelectionNotice(control, view, locale);
@@ -27747,6 +27924,21 @@ Codex Fast mode prioritizes requests and may increase usage.`
27747
27924
  };
27748
27925
  }
27749
27926
 
27927
+ // src/renderer-native-model-loading.ts
27928
+ function isNativeModelCarrierLoadingButton(button2) {
27929
+ if (!button2.disabled || button2.getAttribute("data-composer-navigation-target") !== "reasoning" || button2.getAttribute("aria-busy") !== "true" || button2.hasAttribute("aria-haspopup"))
27930
+ return false;
27931
+ for (const label of button2.children) {
27932
+ const text2 = label.firstChild;
27933
+ if (label.localName !== "span" || text2?.nodeName !== "#text") continue;
27934
+ try {
27935
+ if (decodeHarnessPluginRoute(text2.nodeValue)) return true;
27936
+ } catch {
27937
+ }
27938
+ }
27939
+ return false;
27940
+ }
27941
+
27750
27942
  // src/renderer-native-model-retry.ts
27751
27943
  function record9(value) {
27752
27944
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
@@ -27952,7 +28144,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27952
28144
  'button[aria-haspopup="menu"], button[data-composer-navigation-target="reasoning"]'
27953
28145
  )
27954
28146
  ].filter(
27955
- (button2) => !isOwnedRendererControl(button2) && button2.closest(CODEX_COMPOSER_SELECTOR) === composer && (isNativeModelControlCandidate(button2) || isNativeModelRetryButton(button2, composer))
28147
+ (button2) => !isOwnedRendererControl(button2) && button2.closest(CODEX_COMPOSER_SELECTOR) === composer && (isNativeModelControlCandidate(button2) || isNativeModelRetryButton(button2, composer) || isNativeModelCarrierLoadingButton(button2))
27956
28148
  );
27957
28149
  return candidates.length === 1 ? candidates[0] ?? null : null;
27958
28150
  }
@@ -28855,6 +29047,260 @@ Codex Fast mode prioritizes requests and may increase usage.`
28855
29047
  };
28856
29048
  }
28857
29049
 
29050
+ // src/renderer-native-provider-usage-banner.ts
29051
+ var COMPOSER_SELECTOR = "[data-codex-composer-root]";
29052
+ function isRecord4(value) {
29053
+ return typeof value === "object" && value !== null && !Array.isArray(value);
29054
+ }
29055
+ function isCodexUsageBanner(element, composer) {
29056
+ if (element.closest(COMPOSER_SELECTOR) !== composer) return false;
29057
+ const key2 = Object.getOwnPropertyNames(element).find((name) => name.startsWith("__reactFiber$"));
29058
+ if (!key2) return false;
29059
+ for (const { memoizedProps: props } of committedReactAncestors(
29060
+ Object.getOwnPropertyDescriptor(element, key2)?.value
29061
+ )) {
29062
+ if (!isRecord4(props) || !isRecord4(props.banner)) continue;
29063
+ const type = props.banner.banner_type;
29064
+ return typeof type === "string" && /^(?:[a-z0-9]+_)*rate_limit_reached$/u.test(type);
29065
+ }
29066
+ return false;
29067
+ }
29068
+ function createRendererNativeProviderUsageBanner(composer) {
29069
+ const hidden = /* @__PURE__ */ new Map();
29070
+ let bypassed = false;
29071
+ let disposed = false;
29072
+ const Observer = composer.ownerDocument?.defaultView?.MutationObserver;
29073
+ const observer = Observer ? new Observer(() => {
29074
+ if (!disposed && bypassed) reconcile();
29075
+ }) : null;
29076
+ const restore = (element, state) => {
29077
+ if (element.hidden === true) element.hidden = state.hidden;
29078
+ if (element.getAttribute("aria-hidden") === "true") {
29079
+ if (state.ariaHidden === null) element.removeAttribute("aria-hidden");
29080
+ else element.setAttribute("aria-hidden", state.ariaHidden);
29081
+ }
29082
+ if (element.style.getPropertyValue("display") === "none" && element.style.getPropertyPriority("display") === "important") {
29083
+ if (state.display) element.style.setProperty("display", state.display, state.priority);
29084
+ else element.style.removeProperty("display");
29085
+ }
29086
+ hidden.delete(element);
29087
+ };
29088
+ const release = () => {
29089
+ for (const [element, state] of hidden) restore(element, state);
29090
+ };
29091
+ const reconcile = () => {
29092
+ if (!bypassed || !composer.isConnected) {
29093
+ release();
29094
+ return;
29095
+ }
29096
+ const banners = new Set(
29097
+ [...composer.querySelectorAll('aside[role="status"]')].filter(
29098
+ (element) => isCodexUsageBanner(element, composer)
29099
+ )
29100
+ );
29101
+ for (const [element, state] of hidden) {
29102
+ if (!banners.has(element)) restore(element, state);
29103
+ }
29104
+ for (const element of banners) {
29105
+ if (!hidden.has(element)) {
29106
+ hidden.set(element, {
29107
+ hidden: element.hidden,
29108
+ ariaHidden: element.getAttribute("aria-hidden"),
29109
+ display: element.style.getPropertyValue("display"),
29110
+ priority: element.style.getPropertyPriority("display")
29111
+ });
29112
+ }
29113
+ if (element.hidden !== true) element.hidden = true;
29114
+ if (element.getAttribute("aria-hidden") !== "true")
29115
+ element.setAttribute("aria-hidden", "true");
29116
+ if (element.style.getPropertyValue("display") !== "none" || element.style.getPropertyPriority("display") !== "important") {
29117
+ element.style.setProperty("display", "none", "important");
29118
+ }
29119
+ }
29120
+ };
29121
+ return {
29122
+ update(next) {
29123
+ if (disposed) return;
29124
+ if (next !== bypassed) {
29125
+ bypassed = next;
29126
+ observer?.disconnect();
29127
+ if (bypassed) {
29128
+ observer?.observe(composer, {
29129
+ subtree: true,
29130
+ childList: true,
29131
+ characterData: true,
29132
+ attributes: true,
29133
+ attributeFilter: ["hidden", "aria-hidden", "style"]
29134
+ });
29135
+ }
29136
+ }
29137
+ reconcile();
29138
+ },
29139
+ dispose() {
29140
+ disposed = true;
29141
+ bypassed = false;
29142
+ observer?.disconnect();
29143
+ release();
29144
+ }
29145
+ };
29146
+ }
29147
+
29148
+ // src/renderer-native-inference-route.ts
29149
+ var REFRESH_MS = 5e3;
29150
+ var CHECK_TIMEOUT_MS = 5e3;
29151
+ function nonEmpty(value) {
29152
+ return typeof value === "string" && value.trim().length > 0 ? value : null;
29153
+ }
29154
+ function createRendererNativeDraftWorkspaceStore() {
29155
+ const bindings = /* @__PURE__ */ new Map();
29156
+ const clearHost = (hostId2) => {
29157
+ for (const [composer, entry] of bindings) {
29158
+ if (entry.hostId === hostId2) bindings.delete(composer);
29159
+ }
29160
+ };
29161
+ return {
29162
+ publish(input2, activeDrafts) {
29163
+ const hostId2 = nonEmpty(input2.hostId);
29164
+ const cwd = nonEmpty(input2.cwd);
29165
+ if (!hostId2 || !cwd) return;
29166
+ const explicitDraftId = nonEmpty(input2.draftId);
29167
+ const hostDrafts = activeDrafts.filter(
29168
+ (candidate) => candidate.hostId === hostId2 && nonEmpty(candidate.draftId) !== null
29169
+ );
29170
+ if (explicitDraftId) {
29171
+ const matches = hostDrafts.filter((candidate) => candidate.draftId === explicitDraftId);
29172
+ if (matches.length !== 1 || !matches[0]) {
29173
+ for (const candidate of matches) bindings.delete(candidate.composer);
29174
+ return;
29175
+ }
29176
+ bindings.set(matches[0].composer, { hostId: hostId2, draftId: explicitDraftId, cwd });
29177
+ return;
29178
+ }
29179
+ if (hostDrafts.length !== 1 || !hostDrafts[0]) {
29180
+ if (hostDrafts.length > 1) clearHost(hostId2);
29181
+ return;
29182
+ }
29183
+ bindings.set(hostDrafts[0].composer, { hostId: hostId2, draftId: hostDrafts[0].draftId, cwd });
29184
+ },
29185
+ resolve(draft) {
29186
+ const hostId2 = nonEmpty(draft.hostId);
29187
+ const draftId = nonEmpty(draft.draftId);
29188
+ if (!hostId2 || !draftId) {
29189
+ bindings.delete(draft.composer);
29190
+ return null;
29191
+ }
29192
+ const entry = bindings.get(draft.composer);
29193
+ if (!entry) return null;
29194
+ if (entry.hostId !== hostId2 || entry.draftId !== draftId) {
29195
+ bindings.delete(draft.composer);
29196
+ return null;
29197
+ }
29198
+ return { draftId: entry.draftId, cwd: entry.cwd };
29199
+ },
29200
+ delete(composer) {
29201
+ bindings.delete(composer);
29202
+ },
29203
+ clear(hostId2) {
29204
+ if (hostId2 === void 0) bindings.clear();
29205
+ else clearHost(hostId2);
29206
+ }
29207
+ };
29208
+ }
29209
+ function createRendererNativeInferenceRoute(onChange) {
29210
+ let route = null;
29211
+ let timer = null;
29212
+ let disposed = false;
29213
+ let requestGeneration = 0;
29214
+ const clearTimer = () => {
29215
+ if (timer !== null) clearTimeout(timer);
29216
+ timer = null;
29217
+ };
29218
+ const invalidate = () => {
29219
+ requestGeneration++;
29220
+ clearTimer();
29221
+ route = null;
29222
+ };
29223
+ const check2 = (current) => {
29224
+ const generation = ++requestGeneration;
29225
+ clearTimer();
29226
+ current.pending = true;
29227
+ const finish = (independent) => {
29228
+ if (disposed || route !== current || !current.pending || requestGeneration !== generation)
29229
+ return;
29230
+ clearTimer();
29231
+ current.pending = false;
29232
+ current.independent = independent;
29233
+ current.checkedAt = Date.now();
29234
+ timer = setTimeout(() => {
29235
+ timer = null;
29236
+ if (!disposed && route === current) onChange();
29237
+ }, REFRESH_MS);
29238
+ onChange();
29239
+ };
29240
+ timer = setTimeout(() => {
29241
+ if (disposed || route !== current || !current.pending || requestGeneration !== generation)
29242
+ return;
29243
+ console.warn(
29244
+ "codexhost native inference route verification timed out; retaining Codex usage gate"
29245
+ );
29246
+ finish(false);
29247
+ }, CHECK_TIMEOUT_MS);
29248
+ void (async () => {
29249
+ try {
29250
+ const target2 = current.threadId ? { threadId: current.threadId } : current.draftCwd ? { cwd: current.draftCwd } : null;
29251
+ if (!target2) {
29252
+ finish(false);
29253
+ return;
29254
+ }
29255
+ const independent = await current.client.usesIndependentNativeInference?.(target2) === true;
29256
+ finish(independent);
29257
+ } catch (error51) {
29258
+ if (disposed || route !== current || !current.pending || requestGeneration !== generation)
29259
+ return;
29260
+ console.warn(
29261
+ "codexhost native inference route could not be verified; retaining Codex usage gate",
29262
+ error51 instanceof Error ? error51.name : "UnknownError"
29263
+ );
29264
+ finish(false);
29265
+ }
29266
+ })();
29267
+ };
29268
+ return {
29269
+ update(client, threadId, eligible, draft = null) {
29270
+ if (disposed || !eligible || !client) {
29271
+ invalidate();
29272
+ return false;
29273
+ }
29274
+ const draftId = threadId ? null : nonEmpty(draft?.draftId);
29275
+ const draftCwd = threadId ? null : nonEmpty(draft?.cwd);
29276
+ if (!threadId && (!draftId || !draftCwd)) {
29277
+ invalidate();
29278
+ return false;
29279
+ }
29280
+ if (route?.client !== client || route.threadId !== threadId || route.draftId !== draftId || route.draftCwd !== draftCwd) {
29281
+ invalidate();
29282
+ route = {
29283
+ client,
29284
+ threadId,
29285
+ draftId,
29286
+ draftCwd,
29287
+ independent: false,
29288
+ pending: false,
29289
+ checkedAt: 0
29290
+ };
29291
+ check2(route);
29292
+ } else if (!route.pending && Date.now() - route.checkedAt >= REFRESH_MS) {
29293
+ check2(route);
29294
+ }
29295
+ return route.independent;
29296
+ },
29297
+ dispose() {
29298
+ disposed = true;
29299
+ invalidate();
29300
+ }
29301
+ };
29302
+ }
29303
+
28858
29304
  // src/agent-group-sync.ts
28859
29305
  function startAgentGroupSync(store, getClient, options) {
28860
29306
  const owner = options.owner ?? (typeof window === "undefined" ? void 0 : window);
@@ -29010,15 +29456,42 @@ Codex Fast mode prioritizes requests and may increase usage.`
29010
29456
  }
29011
29457
 
29012
29458
  // src/renderer-native-thread.ts
29013
- function isRecord4(value) {
29459
+ function isRecord5(value) {
29014
29460
  return typeof value === "object" && value !== null && !Array.isArray(value);
29015
29461
  }
29016
- async function verifyNativeCodexThread(sendRequest, threadId) {
29462
+ function usesIndependentNativeInference(value, modelProvider) {
29463
+ const config2 = isRecord5(value) ? value.config : null;
29464
+ if (!isRecord5(config2)) return false;
29465
+ const providerId = modelProvider ?? config2.model_provider;
29466
+ if (typeof providerId !== "string") return false;
29467
+ if (["openai", "cc-switch-official", "codexhost"].includes(providerId)) return false;
29468
+ const providers = config2.model_providers;
29469
+ const provider = isRecord5(providers) ? providers[providerId] : null;
29470
+ if (!isRecord5(provider) || typeof provider.base_url !== "string") return false;
29471
+ if (!URL.canParse(provider.base_url)) return false;
29472
+ const endpoint = new URL(provider.base_url);
29473
+ if (!["http:", "https:"].includes(endpoint.protocol)) return false;
29474
+ const hostname3 = endpoint.hostname.replace(/\.$/u, "");
29475
+ if (["openai.com", "chatgpt.com"].some(
29476
+ (domain2) => hostname3 === domain2 || hostname3.endsWith(`.${domain2}`)
29477
+ )) {
29478
+ return false;
29479
+ }
29480
+ return provider.requires_openai_auth === false || typeof provider.experimental_bearer_token === "string" && provider.experimental_bearer_token.trim().length > 0 || typeof provider.env_key === "string" && provider.env_key.trim().length > 0;
29481
+ }
29482
+ async function readNativeCodexThread(sendRequest, threadId) {
29017
29483
  const native = await sendRequest("thread/read", { threadId, includeTurns: false });
29018
- const thread2 = isRecord4(native) ? native.thread : null;
29019
- if (!isRecord4(thread2) || thread2.id !== threadId || typeof thread2.modelProvider !== "string" || !thread2.modelProvider || thread2.modelProvider === "codexhost" || typeof thread2.cliVersion !== "string" || !thread2.cliVersion || thread2.cliVersion === "codexhost") {
29484
+ const thread2 = isRecord5(native) ? native.thread : null;
29485
+ if (!isRecord5(thread2) || thread2.id !== threadId || typeof thread2.modelProvider !== "string" || !thread2.modelProvider || thread2.modelProvider === "codexhost" || typeof thread2.cliVersion !== "string" || !thread2.cliVersion || thread2.cliVersion === "codexhost") {
29020
29486
  throw new Error("Native Thread response cannot establish Codex ownership");
29021
29487
  }
29488
+ return {
29489
+ modelProvider: thread2.modelProvider,
29490
+ cwd: typeof thread2.cwd === "string" && thread2.cwd.trim().length > 0 ? thread2.cwd : null
29491
+ };
29492
+ }
29493
+ async function verifyNativeCodexThread(sendRequest, threadId) {
29494
+ await readNativeCodexThread(sendRequest, threadId);
29022
29495
  }
29023
29496
 
29024
29497
  // src/renderer-session-import-client.ts
@@ -29095,15 +29568,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
29095
29568
  var CODEX_ACCOUNT_LIST_METHOD = "codexhost/account/list";
29096
29569
  var CODEX_ACCOUNT_REFRESH_METHOD = "codexhost/account/refresh";
29097
29570
  var CODEX_ACCOUNT_CHANGED_METHOD = "codexhost/account/changed";
29098
- function isRecord5(value) {
29571
+ function isRecord6(value) {
29099
29572
  return typeof value === "object" && value !== null && !Array.isArray(value);
29100
29573
  }
29101
29574
  function notifiedThreadId(notification) {
29102
- if (!isRecord5(notification) || !THREAD_USAGE_REFRESH_METHODS.includes(notification.method)) {
29575
+ if (!isRecord6(notification) || !THREAD_USAGE_REFRESH_METHODS.includes(notification.method)) {
29103
29576
  return null;
29104
29577
  }
29105
29578
  const params = notification.params;
29106
- if (!isRecord5(params)) return null;
29579
+ if (!isRecord6(params)) return null;
29107
29580
  const parsed = hostThreadIdSchema.safeParse(params.threadId);
29108
29581
  return parsed.success ? parsed.data : null;
29109
29582
  }
@@ -29183,7 +29656,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29183
29656
  THREAD_TREE_SNAPSHOT_METHOD,
29184
29657
  (message2) => {
29185
29658
  const result = threadTreeWatchResultSchema.safeParse(
29186
- isRecord5(message2) ? message2.params : void 0
29659
+ isRecord6(message2) ? message2.params : void 0
29187
29660
  );
29188
29661
  if (!closed && result.success && subscriptionId2 === result.data.subscriptionId && result.data.snapshot.revision > revision) {
29189
29662
  revision = result.data.snapshot.revision;
@@ -29259,6 +29732,31 @@ Codex Fast mode prioritizes requests and may increase usage.`
29259
29732
  return harnessConfigurationStateSchema.parse(result);
29260
29733
  };
29261
29734
  return Object.freeze({
29735
+ async usesIndependentNativeInference(input2) {
29736
+ if (!input2) return false;
29737
+ if ("threadId" in input2) {
29738
+ const thread2 = await readNativeCodexThread(
29739
+ manager.sendRequest,
29740
+ threadInspectionParamsSchema.parse(input2).threadId
29741
+ );
29742
+ if (!thread2.cwd) return false;
29743
+ return usesIndependentNativeInference(
29744
+ await manager.sendRequest("config/read", {
29745
+ includeLayers: false,
29746
+ cwd: thread2.cwd
29747
+ }),
29748
+ thread2.modelProvider
29749
+ );
29750
+ }
29751
+ const cwd = typeof input2.cwd === "string" && input2.cwd.trim().length > 0 ? input2.cwd : null;
29752
+ if (!cwd) return false;
29753
+ return usesIndependentNativeInference(
29754
+ await manager.sendRequest("config/read", {
29755
+ includeLayers: false,
29756
+ cwd
29757
+ })
29758
+ );
29759
+ },
29262
29760
  async getHarnessPreferences(scope = "external") {
29263
29761
  return harnessPreferenceSnapshotSchema.parse(
29264
29762
  await manager.sendRequest(
@@ -29278,7 +29776,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29278
29776
  watchThreadTree,
29279
29777
  async hasDesktopThread(threadId) {
29280
29778
  const result = await manager.sendRequest("thread/read", { threadId, includeTurns: false });
29281
- return isRecord5(result) && isRecord5(result.thread) && result.thread.id === threadId;
29779
+ return isRecord6(result) && isRecord6(result.thread) && result.thread.id === threadId;
29282
29780
  },
29283
29781
  subscribeHarnessPreferences(listener) {
29284
29782
  return notificationTarget(source)?.addNotificationCallback?.(
@@ -29354,7 +29852,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29354
29852
  },
29355
29853
  subscribeSkillsChanged(listener) {
29356
29854
  return notificationTarget(source)?.addNotificationCallback?.(SKILLS_CHANGED_METHOD, (value) => {
29357
- if (!isRecord5(value) || value.method !== SKILLS_CHANGED_METHOD) return;
29855
+ if (!isRecord6(value) || value.method !== SKILLS_CHANGED_METHOD) return;
29358
29856
  const parsed = skillsChangedParamsSchema.safeParse(value.params);
29359
29857
  if (parsed.success) listener(parsed.data);
29360
29858
  }) ?? (() => {
@@ -29634,7 +30132,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29634
30132
  throw new Error("Renderer Account notification callback is unavailable");
29635
30133
  }
29636
30134
  return notifications.addNotificationCallback(CODEX_ACCOUNT_CHANGED_METHOD, (notification) => {
29637
- if (!isRecord5(notification) || notification.method !== CODEX_ACCOUNT_CHANGED_METHOD) return;
30135
+ if (!isRecord6(notification) || notification.method !== CODEX_ACCOUNT_CHANGED_METHOD) return;
29638
30136
  const state = codexAccountChangedSchema.safeParse(notification.params);
29639
30137
  if (state.success) listener(state.data);
29640
30138
  });
@@ -29646,14 +30144,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
29646
30144
  }
29647
30145
 
29648
30146
  // src/renderer-external-queue.ts
29649
- function isRecord6(value) {
30147
+ function isRecord7(value) {
29650
30148
  return value !== null && typeof value === "object" && !Array.isArray(value);
29651
30149
  }
29652
30150
  function installRendererExternalQueue(target2) {
29653
- if (!isRecord6(target2) || typeof target2.getTurnCoordinator !== "function") return null;
30151
+ if (!isRecord7(target2) || typeof target2.getTurnCoordinator !== "function") return null;
29654
30152
  const coordinator = target2.getTurnCoordinator();
29655
- const queue = isRecord6(coordinator) ? coordinator.serverQueue : null;
29656
- if (!isRecord6(queue) || typeof queue.isEnabled !== "function") return null;
30153
+ const queue = isRecord7(coordinator) ? coordinator.serverQueue : null;
30154
+ if (!isRecord7(queue) || typeof queue.isEnabled !== "function") return null;
29657
30155
  return () => void 0;
29658
30156
  }
29659
30157
 
@@ -29682,19 +30180,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
29682
30180
  }
29683
30181
 
29684
30182
  // src/renderer-external-steering.ts
29685
- function isRecord7(value) {
30183
+ function isRecord8(value) {
29686
30184
  return value !== null && typeof value === "object" && !Array.isArray(value);
29687
30185
  }
29688
30186
  function isManager(value) {
29689
- return isRecord7(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
30187
+ return isRecord8(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
29690
30188
  (key2) => typeof value[key2] === "function"
29691
30189
  );
29692
30190
  }
29693
30191
  function submissionHost(manager) {
29694
30192
  const coordinator = manager.getTurnCoordinator();
29695
- const options = isRecord7(coordinator) ? coordinator.options : null;
29696
- const host = isRecord7(options) ? options.submissionHost : null;
29697
- if (!isRecord7(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
30193
+ const options = isRecord8(coordinator) ? coordinator.options : null;
30194
+ const host = isRecord8(options) ? options.submissionHost : null;
30195
+ if (!isRecord8(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
29698
30196
  throw new Error("Desktop turn submission binding is unavailable");
29699
30197
  }
29700
30198
  return {
@@ -29736,20 +30234,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
29736
30234
  var INTERRUPTED_QUEUE_REASON = "Interrupted before the steer was accepted.";
29737
30235
  async function preserveQueuedFollowUps(manager, threadId) {
29738
30236
  const coordinator = manager.getTurnCoordinator();
29739
- if (!isRecord7(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
30237
+ if (!isRecord8(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
29740
30238
  throw new Error("Desktop follow-up queue binding is unavailable");
29741
30239
  }
29742
30240
  await coordinator.loadMessages.call(coordinator, threadId);
29743
30241
  const messages = coordinator.readMessages.call(coordinator, threadId);
29744
30242
  if (!Array.isArray(messages)) throw new Error("Desktop follow-up queue is unavailable");
29745
30243
  const alreadyPaused = new Set(
29746
- messages.filter((message2) => isRecord7(message2) && message2.pausedReason != null).map((message2) => message2.id)
30244
+ messages.filter((message2) => isRecord8(message2) && message2.pausedReason != null).map((message2) => message2.id)
29747
30245
  );
29748
30246
  return () => {
29749
30247
  coordinator.mutate.call(coordinator, threadId, (current) => {
29750
30248
  if (!Array.isArray(current)) return current;
29751
30249
  return current.map((message2) => {
29752
- if (!isRecord7(message2) || alreadyPaused.has(message2.id) || message2.pausedReason !== INTERRUPTED_QUEUE_REASON)
30250
+ if (!isRecord8(message2) || alreadyPaused.has(message2.id) || message2.pausedReason !== INTERRUPTED_QUEUE_REASON)
29753
30251
  return message2;
29754
30252
  const resumed = { ...message2 };
29755
30253
  delete resumed.pausedReason;
@@ -29771,16 +30269,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
29771
30269
  if ((method === "turn/start" || method === "turn/steer") && prepareTurnInput) {
29772
30270
  params = prepareTurnInput(params);
29773
30271
  }
29774
- const messageId = isRecord7(params) ? params.clientUserMessageId : null;
29775
- const route = typeof messageId === "string" && isRecord7(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
29776
- if (method !== "turn/start" || !isRecord7(params) || !route || route.threadId !== params.threadId) {
30272
+ const messageId = isRecord8(params) ? params.clientUserMessageId : null;
30273
+ const route = typeof messageId === "string" && isRecord8(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
30274
+ if (method !== "turn/start" || !isRecord8(params) || !route || route.threadId !== params.threadId) {
29777
30275
  if (method === "turn/start" && sendTurnStart) {
29778
30276
  return sendTurnStart(params, (input2) => {
29779
30277
  if (disposed) throw new Error("External submission binding was disposed");
29780
30278
  return originalSend.call(manager, method, input2, options);
29781
30279
  });
29782
30280
  }
29783
- if (method === "turn/steer" && isRecord7(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
30281
+ if (method === "turn/steer" && isRecord8(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
29784
30282
  params = { ...params, [THREAD_STEER_DELIVERY_PARAM]: "activeTurn" };
29785
30283
  }
29786
30284
  return originalSend.call(manager, method, params, options);
@@ -29803,7 +30301,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29803
30301
  options
29804
30302
  )
29805
30303
  ).then((response) => {
29806
- if (!isRecord7(response) || typeof response.turnId !== "string" || !response.turnId) {
30304
+ if (!isRecord8(response) || typeof response.turnId !== "string" || !response.turnId) {
29807
30305
  throw new Error("External steering returned no replacement Turn identity");
29808
30306
  }
29809
30307
  return {
@@ -29841,7 +30339,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29841
30339
  ] = args;
29842
30340
  if (typeof threadId !== "string") return originalSteer.apply(manager, args);
29843
30341
  const role = manager.getStreamRole?.(threadId);
29844
- if (isRecord7(role) && role.role === "follower") return originalSteer.apply(manager, args);
30342
+ if (isRecord8(role) && role.role === "follower") return originalSteer.apply(manager, args);
29845
30343
  let host = null;
29846
30344
  let expectedTurnId;
29847
30345
  try {
@@ -29849,7 +30347,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29849
30347
  expectedTurnId = host.getActiveTurnId(threadId);
29850
30348
  } catch {
29851
30349
  }
29852
- const text2 = Array.isArray(input2) ? input2.filter((item) => isRecord7(item) && typeof item.text === "string").map((item) => item.text).join("\n") : void 0;
30350
+ const text2 = Array.isArray(input2) ? input2.filter((item) => isRecord8(item) && typeof item.text === "string").map((item) => item.text).join("\n") : void 0;
29853
30351
  const delivery = await inspectDelivery(threadId, text2);
29854
30352
  if (disposed) throw new Error("External steering binding was disposed");
29855
30353
  if (delivery === "official") return originalSteer.apply(manager, args);
@@ -29865,21 +30363,21 @@ Codex Fast mode prioritizes requests and may increase usage.`
29865
30363
  }
29866
30364
  if (!host) throw new Error("Desktop turn submission binding is unavailable");
29867
30365
  const currentRole = manager.getStreamRole?.(threadId);
29868
- if (isRecord7(currentRole) && currentRole.role === "follower")
30366
+ if (isRecord8(currentRole) && currentRole.role === "follower")
29869
30367
  return originalSteer.apply(manager, args);
29870
30368
  if (!Array.isArray(input2) || input2.length === 0 || input2.some((item) => {
29871
- if (!isRecord7(item)) return true;
30369
+ if (!isRecord8(item)) return true;
29872
30370
  if (item.type === "text") return typeof item.text !== "string";
29873
30371
  if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
29874
30372
  if (item.type === "image") return typeof item.url !== "string" || !item.url;
29875
30373
  return true;
29876
30374
  }) || !input2.some(
29877
- (item) => isRecord7(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
30375
+ (item) => isRecord8(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
29878
30376
  )) {
29879
30377
  throw new Error("External steering requires non-empty text or image input");
29880
30378
  }
29881
30379
  if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
29882
- if (!isRecord7(restoreMessage) || !isRecord7(restoreMessage.context)) {
30380
+ if (!isRecord8(restoreMessage) || !isRecord8(restoreMessage.context)) {
29883
30381
  throw new Error("Desktop steering message context is unavailable");
29884
30382
  }
29885
30383
  const messageId = typeof clientUserMessageId === "string" && clientUserMessageId ? clientUserMessageId : typeof restoreMessage.id === "string" && restoreMessage.id ? restoreMessage.id : crypto.randomUUID();
@@ -29929,7 +30427,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29929
30427
  },
29930
30428
  onMessageAdded
29931
30429
  );
29932
- if (!isRecord7(response) || !isRecord7(response.turn) || typeof response.turn.id !== "string") {
30430
+ if (!isRecord8(response) || !isRecord8(response.turn) || typeof response.turn.id !== "string") {
29933
30431
  throw new Error("Desktop returned no replacement Turn identity");
29934
30432
  }
29935
30433
  try {
@@ -29960,7 +30458,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29960
30458
  }
29961
30459
 
29962
30460
  // src/renderer-remote-attachments.ts
29963
- function isRecord8(value) {
30461
+ function isRecord9(value) {
29964
30462
  return value !== null && typeof value === "object" && !Array.isArray(value);
29965
30463
  }
29966
30464
  var MAX_IMAGE_BYTES = 20 * 1024 * 1024;
@@ -30002,14 +30500,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
30002
30500
  function createRemoteAttachmentSender(target2, hostId2, isCurrent) {
30003
30501
  const prepared = /* @__PURE__ */ new WeakMap();
30004
30502
  return (params, send) => {
30005
- if (hostId2 === "local" || !isRecord8(target2) || !isRecord8(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target2.getConversation !== "function")
30503
+ if (hostId2 === "local" || !isRecord9(target2) || !isRecord9(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target2.getConversation !== "function")
30006
30504
  return send(params);
30007
30505
  const images = params.input.filter(
30008
- (item) => isRecord8(item) && (item.type === "image" || item.type === "localImage")
30506
+ (item) => isRecord9(item) && (item.type === "image" || item.type === "localImage")
30009
30507
  );
30010
30508
  if (images.length === 0) return send(params);
30011
30509
  const conversation = target2.getConversation.call(target2, params.threadId);
30012
- if (!isRecord8(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
30510
+ if (!isRecord9(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
30013
30511
  return send(params);
30014
30512
  const assertCurrent = () => {
30015
30513
  if (!isCurrent()) throw new Error("Remote attachment connection is no longer available");
@@ -30022,7 +30520,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
30022
30520
  const cached2 = prepared.get(params);
30023
30521
  if (cached2) return cached2.then(dispatch);
30024
30522
  const input2 = params.input;
30025
- const text2 = input2.filter((item) => isRecord8(item) && item.type === "text").map((item) => isRecord8(item) && typeof item.text === "string" ? item.text : "").join("\n");
30523
+ const text2 = input2.filter((item) => isRecord9(item) && item.type === "text").map((item) => isRecord9(item) && typeof item.text === "string" ? item.text : "").join("\n");
30026
30524
  const existingPaths = desktopImageAttachmentPaths(text2);
30027
30525
  const prepare = async () => {
30028
30526
  if (existingPaths.length === images.length) return params;
@@ -30054,7 +30552,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
30054
30552
  contents: file2.contents,
30055
30553
  label: `image-${index + 1}.${file2.extension}`
30056
30554
  });
30057
- if (!isRecord8(saved) || !filePath2(saved.path) || saved.fsPath !== saved.path) {
30555
+ if (!isRecord9(saved) || !filePath2(saved.path) || saved.fsPath !== saved.path) {
30058
30556
  throw new Error("Desktop returned an invalid remote attachment path");
30059
30557
  }
30060
30558
  created.push(saved.path);
@@ -30223,11 +30721,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30223
30721
  }
30224
30722
 
30225
30723
  // src/renderer-manual-compaction.ts
30226
- function isRecord9(value) {
30724
+ function isRecord10(value) {
30227
30725
  return value !== null && typeof value === "object" && !Array.isArray(value);
30228
30726
  }
30229
30727
  function installRendererManualCompaction(target2, hostId2, messages) {
30230
- if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord9(target2) || typeof target2.registerPendingManualContextCompaction !== "function" || typeof target2.getConversation !== "function") {
30728
+ if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord10(target2) || typeof target2.registerPendingManualContextCompaction !== "function" || typeof target2.getConversation !== "function") {
30231
30729
  return null;
30232
30730
  }
30233
30731
  const register2 = target2.registerPendingManualContextCompaction;
@@ -30236,18 +30734,18 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30236
30734
  const listener = (event) => {
30237
30735
  if (event.source != null && event.source !== messages) return;
30238
30736
  const message2 = event.data;
30239
- if (!isRecord9(message2) || message2.type !== "mcp-notification" || message2.hostId !== hostId2 || message2.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
30737
+ if (!isRecord10(message2) || message2.type !== "mcp-notification" || message2.hostId !== hostId2 || message2.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
30240
30738
  return;
30241
30739
  }
30242
30740
  const params = threadManualCompactionStartedSchema.safeParse(message2.params);
30243
30741
  if (!params.success) return;
30244
30742
  const { threadId } = params.data;
30245
30743
  const conversation = getConversation.call(target2, threadId);
30246
- if (!isRecord9(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
30744
+ if (!isRecord10(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
30247
30745
  return;
30248
30746
  }
30249
30747
  const role = getStreamRole?.call(target2, threadId);
30250
- if (isRecord9(role) && role.role === "follower") return;
30748
+ if (isRecord10(role) && role.role === "follower") return;
30251
30749
  register2.call(target2, threadId);
30252
30750
  };
30253
30751
  messages.addEventListener("message", listener);
@@ -30424,7 +30922,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30424
30922
  var SIDEBAR_AGENT_ICON_ATTRIBUTE = "data-codexhost-sidebar-agent-icon";
30425
30923
  var SIDEBAR_AGENT_ICON_ROW_SELECTOR = `${SIDEBAR_THREAD_ROW_SELECTOR}, ${NATIVE_SCHEDULE_SIDEBAR_ROW_SELECTOR}`;
30426
30924
  var OWNERSHIP_RETRY_DELAYS_MS = [100, 300, 800, 1500, 3e3];
30427
- function isRecord10(value) {
30925
+ function isRecord11(value) {
30428
30926
  return typeof value === "object" && value !== null && !Array.isArray(value);
30429
30927
  }
30430
30928
  function sidebarThreadAttributes(element) {
@@ -30451,19 +30949,19 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30451
30949
  const fiberName = fiberNames[0];
30452
30950
  if (fiberNames.length !== 1 || !fiberName) return null;
30453
30951
  const firstFiber2 = Object.getOwnPropertyDescriptor(element, fiberName)?.value;
30454
- if (!isRecord10(firstFiber2)) return null;
30952
+ if (!isRecord11(firstFiber2)) return null;
30455
30953
  const candidates = /* @__PURE__ */ new Set();
30456
30954
  let fiber = firstFiber2;
30457
30955
  for (let depth = 0; fiber && depth < 12; depth += 1) {
30458
30956
  const props = fiber.memoizedProps;
30459
- if (isRecord10(props) && isRecord10(props.dataAttributes)) {
30957
+ if (isRecord11(props) && isRecord11(props.dataAttributes)) {
30460
30958
  const dataAttributes = props.dataAttributes;
30461
30959
  const threadId = hostThreadIdSchema.safeParse(props.conversationId);
30462
30960
  if (threadId.success && dataAttributes[SIDEBAR_THREAD_ROW_ATTRIBUTE] === rowMarker && dataAttributes[SIDEBAR_THREAD_ID_ATTRIBUTE] === taskKey && dataAttributes[SIDEBAR_THREAD_HOST_ID_ATTRIBUTE] === hostId2) {
30463
30961
  candidates.add(threadId.data);
30464
30962
  }
30465
30963
  }
30466
- fiber = isRecord10(fiber.return) ? fiber.return : null;
30964
+ fiber = isRecord11(fiber.return) ? fiber.return : null;
30467
30965
  }
30468
30966
  return candidates.size === 1 ? candidates.values().next().value ?? null : null;
30469
30967
  }
@@ -30960,7 +31458,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30960
31458
  if (row) finish(row);
30961
31459
  });
30962
31460
  }
30963
- function isRecord11(value) {
31461
+ function isRecord12(value) {
30964
31462
  return typeof value === "object" && value !== null && !Array.isArray(value);
30965
31463
  }
30966
31464
  function firstFiber(element) {
@@ -30970,7 +31468,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30970
31468
  const name = names[0];
30971
31469
  if (names.length !== 1 || !name) return null;
30972
31470
  const value = Object.getOwnPropertyDescriptor(element, name)?.value;
30973
- return isRecord11(value) ? value : null;
31471
+ return isRecord12(value) ? value : null;
30974
31472
  }
30975
31473
  function directForkAncestors(first) {
30976
31474
  const ancestors2 = [];
@@ -30980,7 +31478,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30980
31478
  if (seen.has(fiber)) return [];
30981
31479
  seen.add(fiber);
30982
31480
  ancestors2.push(fiber);
30983
- fiber = isRecord11(fiber.return) ? fiber.return : null;
31481
+ fiber = isRecord12(fiber.return) ? fiber.return : null;
30984
31482
  }
30985
31483
  return ancestors2;
30986
31484
  }
@@ -30998,7 +31496,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
30998
31496
  let hasForkCallback = false;
30999
31497
  for (const fiber of ancestors2) {
31000
31498
  const props = fiber.memoizedProps;
31001
- if (!isRecord11(props)) continue;
31499
+ if (!isRecord12(props)) continue;
31002
31500
  if (!hasForkCallback && typeof props.onFork !== "function" && ownsOtherCallback(fiber, props)) {
31003
31501
  return null;
31004
31502
  }
@@ -31030,7 +31528,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31030
31528
  if (!threadId.success || !turnId.success) return null;
31031
31529
  const fiber = firstFiber(button2);
31032
31530
  const buttonProps = fiber?.memoizedProps;
31033
- if (!fiber || !isRecord11(buttonProps) || !Object.hasOwn(buttonProps, "aria-busy")) return null;
31531
+ if (!fiber || !isRecord12(buttonProps) || !Object.hasOwn(buttonProps, "aria-busy")) return null;
31034
31532
  return forkTargetFromAncestors(button2, threadId.data, turnId.data, directForkAncestors(fiber)) ?? forkTargetFromAncestors(button2, threadId.data, turnId.data, committedReactAncestors(fiber));
31035
31533
  }
31036
31534
  var BrowserRendererForkDom = class {
@@ -31120,7 +31618,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31120
31618
  }
31121
31619
  var DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS = 1e4;
31122
31620
  var DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS = 25;
31123
- function isRecord12(value) {
31621
+ function isRecord13(value) {
31124
31622
  return typeof value === "object" && value !== null && !Array.isArray(value);
31125
31623
  }
31126
31624
  function decodeOpenCodeTransportModelId(value) {
@@ -31285,7 +31783,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31285
31783
  let fiber = findComposerFiber(composer);
31286
31784
  for (let depth = 0; fiber && depth < 120; depth += 1) {
31287
31785
  const props = fiber.memoizedProps;
31288
- if (isRecord12(props) && "conversationId" in props && props.conversationId != null) {
31786
+ if (isRecord13(props) && "conversationId" in props && props.conversationId != null) {
31289
31787
  const candidate = hostThreadIdSchema.safeParse(props.conversationId);
31290
31788
  if (!candidate.success || threadId !== void 0 && threadId !== candidate.data) {
31291
31789
  return null;
@@ -31298,12 +31796,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31298
31796
  return threadId;
31299
31797
  }
31300
31798
  function isLegacySevenSlotDraftWrapper(value) {
31301
- if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord12(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
31799
+ if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord13(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
31302
31800
  return false;
31303
31801
  }
31304
31802
  try {
31305
31803
  const draft = value[3].get();
31306
- return isRecord12(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
31804
+ return isRecord13(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
31307
31805
  } catch {
31308
31806
  return false;
31309
31807
  }
@@ -31337,8 +31835,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31337
31835
  let fiber = findComposerFiber(composer);
31338
31836
  for (let depth = 0; fiber && depth < 120; depth += 1) {
31339
31837
  const updateQueue = fiber.updateQueue;
31340
- const memoCache = isRecord12(updateQueue) ? updateQueue.memoCache : null;
31341
- const data = isRecord12(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
31838
+ const memoCache = isRecord13(updateQueue) ? updateQueue.memoCache : null;
31839
+ const data = isRecord13(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
31342
31840
  for (const value of data) {
31343
31841
  const draftId = draftIdFromMemoValue(value);
31344
31842
  if (draftId) draftIds.add(draftId);
@@ -31366,7 +31864,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31366
31864
  return ["default", draftIds.values().next().value];
31367
31865
  }
31368
31866
  function isDraftPrewarmPolicyReady(value) {
31369
- return isRecord12(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
31867
+ return isRecord13(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
31370
31868
  }
31371
31869
  async function waitForRendererDraftPrewarmPolicy(target2, composer) {
31372
31870
  const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
@@ -31472,6 +31970,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31472
31970
  forkThread: (input2) => currentModelClient().forkThread(input2),
31473
31971
  inspectHarness: (...args) => currentModelClient().inspectHarness(...args),
31474
31972
  inspectThread: (input2) => currentModelClient().inspectThread(input2),
31973
+ usesIndependentNativeInference: async (input2) => {
31974
+ const client = currentModelClient();
31975
+ return client.usesIndependentNativeInference ? client.usesIndependentNativeInference(input2) : false;
31976
+ },
31475
31977
  inspectHarnessCommands: (input2) => currentModelClient().inspectHarnessCommands(input2),
31476
31978
  inspectThreadCommands: (input2) => currentModelClient().inspectThreadCommands(input2),
31477
31979
  executeThreadCommand: (input2) => currentModelClient().executeThreadCommand(input2),
@@ -31660,11 +32162,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31660
32162
  return null;
31661
32163
  }
31662
32164
  }
31663
- function isRecord13(value) {
32165
+ function isRecord14(value) {
31664
32166
  return typeof value === "object" && value !== null && !Array.isArray(value);
31665
32167
  }
31666
32168
  function parseExternalConfiguration(value) {
31667
- if (!isRecord13(value)) return void 0;
32169
+ if (!isRecord14(value)) return void 0;
31668
32170
  const model2 = harnessModelRefSchema.safeParse(value.model);
31669
32171
  if (!model2.success) return void 0;
31670
32172
  const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
@@ -31681,10 +32183,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31681
32183
  const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
31682
32184
  if (!raw) return void 0;
31683
32185
  const parsed = JSON.parse(raw);
31684
- if (!isRecord13(parsed) || parsed.version !== 1) return void 0;
32186
+ if (!isRecord14(parsed) || parsed.version !== 1) return void 0;
31685
32187
  if (parsed.lastAgent !== "codex" && !harnessPluginIdSchema.safeParse(parsed.lastAgent).success)
31686
32188
  return void 0;
31687
- const externalByAgent = isRecord13(parsed.externalByAgent) ? parsed.externalByAgent : {};
32189
+ const externalByAgent = isRecord14(parsed.externalByAgent) ? parsed.externalByAgent : {};
31688
32190
  const parsedExternal = Object.fromEntries(
31689
32191
  Object.keys(externalByAgent).filter((agent) => harnessPluginIdSchema.safeParse(agent).success).flatMap((agent) => {
31690
32192
  const configuration = parseExternalConfiguration(externalByAgent[agent]);
@@ -31829,16 +32331,16 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31829
32331
  // src/codex-locale-adapter.ts
31830
32332
  var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
31831
32333
  function isNativeLocaleServices(value) {
31832
- if (!isRecord14(value) || !Object.hasOwn(value, "appInfo")) return false;
32334
+ if (!isRecord15(value) || !Object.hasOwn(value, "appInfo")) return false;
31833
32335
  const appInfo = value.appInfo;
31834
32336
  return appInfo != null && typeof appInfo.getLocaleInfo === "function";
31835
32337
  }
31836
32338
  function isNativeSettingsServices(value) {
31837
- if (!isRecord14(value) || !Object.hasOwn(value, "settings")) return false;
32339
+ if (!isRecord15(value) || !Object.hasOwn(value, "settings")) return false;
31838
32340
  const settings = value.settings;
31839
32341
  return typeof settings?.read === "function" && typeof settings?.write === "function";
31840
32342
  }
31841
- function isRecord14(value) {
32343
+ function isRecord15(value) {
31842
32344
  return typeof value === "object" && value !== null && !Array.isArray(value);
31843
32345
  }
31844
32346
  function canonicalLocale(value) {
@@ -31860,7 +32362,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31860
32362
  return new DOMException("The operation was aborted", "AbortError");
31861
32363
  }
31862
32364
  function parseLocaleOverride(response) {
31863
- if (!isRecord14(response) || !Object.hasOwn(response, "effective")) {
32365
+ if (!isRecord15(response) || !Object.hasOwn(response, "effective")) {
31864
32366
  throw new Error("Codex native locale override response is malformed");
31865
32367
  }
31866
32368
  if (response.effective === null) return null;
@@ -31875,7 +32377,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
31875
32377
  return locale;
31876
32378
  }
31877
32379
  function parseLocaleInfo(value) {
31878
- if (!isRecord14(value)) throw new Error("Codex locale info response is malformed");
32380
+ if (!isRecord15(value)) throw new Error("Codex locale info response is malformed");
31879
32381
  return {
31880
32382
  ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
31881
32383
  systemLocale: optionalLocale(value.systemLocale, "system locale")
@@ -33472,6 +33974,9 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
33472
33974
  const roundedM = Math.round(normalized / 1e6 * 10) / 10;
33473
33975
  return `${Number.isInteger(roundedM) ? roundedM.toFixed(0) : roundedM.toFixed(1)}m`;
33474
33976
  }
33977
+ function formatPositiveExtensionCount(count3) {
33978
+ return isValidExtensionCount(count3) && count3 > 0 ? formatExtensionCount(count3) : null;
33979
+ }
33475
33980
  function arrayBufferToBase64(buffer) {
33476
33981
  const bytes = new Uint8Array(buffer);
33477
33982
  const chunkSize = 32768;
@@ -38953,8 +39458,6 @@ ${detail}` : ""}`
38953
39458
  iconUrl: iconUrl2,
38954
39459
  author,
38955
39460
  version: version2,
38956
- repository,
38957
- stars,
38958
39461
  downloads,
38959
39462
  trustTier,
38960
39463
  statusState,
@@ -39068,21 +39571,25 @@ ${detail}` : ""}`
39068
39571
  card.append(body);
39069
39572
  }
39070
39573
  if (update) {
39574
+ card.dataset.updateAvailable = "true";
39071
39575
  const row = createEl(document2, "div", "settings-extensions-card__update");
39072
39576
  row.dataset.updateAvailable = "true";
39073
39577
  update.action.addEventListener("click", stopTrigger);
39074
39578
  update.action.addEventListener("keydown", stopTrigger);
39075
- row.append(createEl(document2, "span", "", update.label), update.action);
39579
+ const label = createEl(
39580
+ document2,
39581
+ "span",
39582
+ "settings-extensions-card__update-label",
39583
+ update.label
39584
+ );
39585
+ row.append(label, update.action);
39076
39586
  card.append(row);
39077
39587
  }
39078
39588
  const authorVersion = formatAuthorVersion(author, version2);
39079
- const repositoryHref = parseSafeRepositoryUrl(repository);
39080
- const formattedStars = isValidExtensionCount(stars) ? formatExtensionCount(stars) : null;
39081
- const formattedDownloads = isValidExtensionCount(downloads) ? formatExtensionCount(downloads) : null;
39589
+ const formattedDownloads = formatPositiveExtensionCount(downloads);
39082
39590
  const categoryLabels = (categories ?? []).slice(0, MAX_CARD_CATEGORIES).map((category) => contentCopy.categories[category] ?? category);
39083
39591
  const categoriesText = categoryLabels.join(" \xB7 ");
39084
- let starControl = null;
39085
- if (authorVersion || repositoryHref || formattedStars || formattedDownloads || categoriesText) {
39592
+ if (authorVersion || formattedDownloads || categoriesText) {
39086
39593
  const metaRow = createEl(document2, "div", "settings-extensions-card__meta");
39087
39594
  const metaLeft = createEl(document2, "div", "settings-extensions-card__meta-left");
39088
39595
  if (authorVersion) {
@@ -39095,35 +39602,6 @@ ${detail}` : ""}`
39095
39602
  authorVersionWrap.title = authorVersion;
39096
39603
  metaLeft.append(authorVersionWrap);
39097
39604
  }
39098
- if (repositoryHref) {
39099
- const starLink = createEl(
39100
- document2,
39101
- "a",
39102
- "settings-extensions-card__star settings-extensions-card__star--link"
39103
- );
39104
- starLink.href = repositoryHref;
39105
- starLink.target = "_blank";
39106
- starLink.rel = "noopener noreferrer";
39107
- starLink.dataset.action = "open-repository";
39108
- const label = formattedStars ? `${copy.githubRepository} \xB7 ${formattedStars}` : copy.githubRepository;
39109
- starLink.title = label;
39110
- starLink.setAttribute("aria-label", label);
39111
- starLink.append(createRendererSettingsIcon("star", 11));
39112
- if (formattedStars) {
39113
- starLink.append(createEl(document2, "span", "", formattedStars));
39114
- }
39115
- starLink.addEventListener("click", stopTrigger);
39116
- starLink.addEventListener("keydown", stopTrigger);
39117
- starControl = starLink;
39118
- metaLeft.append(starLink);
39119
- } else if (formattedStars) {
39120
- const starBadge = createEl(document2, "span", "settings-extensions-card__star");
39121
- starBadge.append(
39122
- createRendererSettingsIcon("star", 11),
39123
- createEl(document2, "span", "", formattedStars)
39124
- );
39125
- metaLeft.append(starBadge);
39126
- }
39127
39605
  if (formattedDownloads) {
39128
39606
  const downloadsBadge = createEl(document2, "span", "settings-extensions-card__downloads");
39129
39607
  downloadsBadge.dataset.metric = "downloads";
@@ -39151,12 +39629,10 @@ ${detail}` : ""}`
39151
39629
  }
39152
39630
  card.addEventListener("click", (event) => {
39153
39631
  if (isWithinElement(event.target, actionWrap)) return;
39154
- if (starControl && isWithinElement(event.target, starControl)) return;
39155
39632
  onOpenDetails();
39156
39633
  });
39157
39634
  card.addEventListener("keydown", (event) => {
39158
39635
  if (isWithinElement(event.target, actionWrap)) return;
39159
- if (starControl && isWithinElement(event.target, starControl)) return;
39160
39636
  if (event.key === "Enter" || event.key === " ") {
39161
39637
  event.preventDefault();
39162
39638
  onOpenDetails();
@@ -39675,20 +40151,17 @@ ${detail}` : ""}`
39675
40151
  let settingsSection = null;
39676
40152
  let descriptionSection = null;
39677
40153
  let screenshotsSection = null;
39678
- let previewStage = null;
39679
- let previewImage = null;
39680
- let previewCounter = null;
39681
- let previewPrevButton = null;
39682
- let previewNextButton = null;
39683
40154
  let galleryGrid = null;
40155
+ let lightboxDialog = null;
40156
+ let lightboxImage = null;
40157
+ let lightboxCounter = null;
40158
+ let lightboxPrevButton = null;
40159
+ let lightboxNextButton = null;
40160
+ let lightboxReturnFocus = null;
39684
40161
  let currentScreenshots = [];
39685
40162
  let currentDisplayName = "";
39686
- const syncPreviewStage = () => {
39687
- if (!previewStage || !previewImage || !previewCounter || !galleryGrid) return;
39688
- const total = currentScreenshots.length;
39689
- if (activeScreenshotIndex !== null && (activeScreenshotIndex < 0 || activeScreenshotIndex >= total)) {
39690
- activeScreenshotIndex = null;
39691
- }
40163
+ const syncThumbPressed = () => {
40164
+ if (!galleryGrid) return;
39692
40165
  const thumbButtons = galleryGrid.children;
39693
40166
  for (let i = 0; i < thumbButtons.length; i += 1) {
39694
40167
  const button2 = thumbButtons[i];
@@ -39696,28 +40169,138 @@ ${detail}` : ""}`
39696
40169
  button2.setAttribute("aria-pressed", String(activeScreenshotIndex === i));
39697
40170
  }
39698
40171
  }
39699
- if (activeScreenshotIndex === null || total === 0) {
39700
- previewStage.hidden = true;
39701
- previewImage.src = "";
39702
- previewImage.alt = "";
40172
+ };
40173
+ const cleanupLightbox = () => {
40174
+ const previous = lightboxDialog;
40175
+ const restore = lightboxReturnFocus;
40176
+ lightboxDialog = null;
40177
+ lightboxImage = null;
40178
+ lightboxCounter = null;
40179
+ lightboxPrevButton = null;
40180
+ lightboxNextButton = null;
40181
+ lightboxReturnFocus = null;
40182
+ activeScreenshotIndex = null;
40183
+ previous?.remove();
40184
+ syncThumbPressed();
40185
+ if (restore && restore.isConnected && typeof restore.focus === "function") {
40186
+ restore.focus();
40187
+ }
40188
+ };
40189
+ const closeLightbox = () => {
40190
+ if (!lightboxDialog) {
40191
+ activeScreenshotIndex = null;
40192
+ syncThumbPressed();
40193
+ return;
40194
+ }
40195
+ if (lightboxDialog.open) {
40196
+ lightboxDialog.close();
40197
+ } else {
40198
+ cleanupLightbox();
40199
+ }
40200
+ };
40201
+ const syncLightbox = () => {
40202
+ const total = currentScreenshots.length;
40203
+ if (activeScreenshotIndex === null || total === 0 || activeScreenshotIndex < 0 || activeScreenshotIndex >= total) {
40204
+ closeLightbox();
39703
40205
  return;
39704
40206
  }
39705
40207
  const activeUrl = currentScreenshots[activeScreenshotIndex];
39706
40208
  if (!activeUrl) {
39707
- previewStage.hidden = true;
39708
- previewImage.src = "";
39709
- previewImage.alt = "";
40209
+ closeLightbox();
39710
40210
  return;
39711
40211
  }
39712
- previewStage.hidden = false;
39713
- previewImage.src = activeUrl;
39714
- previewImage.alt = formatMessage(copy.screenshotAlt, {
39715
- name: currentDisplayName,
39716
- index: String(activeScreenshotIndex + 1)
39717
- });
39718
- previewCounter.textContent = `${activeScreenshotIndex + 1} / ${total}`;
39719
- if (previewPrevButton) previewPrevButton.hidden = total <= 1;
39720
- if (previewNextButton) previewNextButton.hidden = total <= 1;
40212
+ if (!lightboxDialog) {
40213
+ const modal = createEl(document2, "dialog", "settings-extensions-lightbox");
40214
+ modal.setAttribute("aria-label", copy.screenshotsTitle);
40215
+ modal.tabIndex = -1;
40216
+ lightboxImage = createEl(document2, "img", "settings-extensions-lightbox__img");
40217
+ const closeBtn = createEl(
40218
+ document2,
40219
+ "button",
40220
+ "settings-extensions-lightbox__btn settings-extensions-lightbox__close"
40221
+ );
40222
+ closeBtn.type = "button";
40223
+ closeBtn.title = copy.closePreview;
40224
+ closeBtn.setAttribute("aria-label", copy.closePreview);
40225
+ closeBtn.append(createRendererSettingsIcon("close", 16));
40226
+ closeBtn.addEventListener("click", () => modal.close());
40227
+ lightboxPrevButton = createEl(
40228
+ document2,
40229
+ "button",
40230
+ "settings-extensions-lightbox__btn settings-extensions-lightbox__nav settings-extensions-lightbox__nav--prev"
40231
+ );
40232
+ lightboxPrevButton.type = "button";
40233
+ lightboxPrevButton.title = copy.previousScreenshot;
40234
+ lightboxPrevButton.setAttribute("aria-label", copy.previousScreenshot);
40235
+ lightboxPrevButton.append(createRendererSettingsIcon("chevron-left", 18));
40236
+ lightboxPrevButton.addEventListener("click", () => {
40237
+ if (activeScreenshotIndex === null || currentScreenshots.length <= 1) return;
40238
+ activeScreenshotIndex = (activeScreenshotIndex - 1 + currentScreenshots.length) % currentScreenshots.length;
40239
+ syncLightbox();
40240
+ });
40241
+ lightboxNextButton = createEl(
40242
+ document2,
40243
+ "button",
40244
+ "settings-extensions-lightbox__btn settings-extensions-lightbox__nav settings-extensions-lightbox__nav--next"
40245
+ );
40246
+ lightboxNextButton.type = "button";
40247
+ lightboxNextButton.title = copy.nextScreenshot;
40248
+ lightboxNextButton.setAttribute("aria-label", copy.nextScreenshot);
40249
+ lightboxNextButton.append(createRendererSettingsIcon("chevron-right", 18));
40250
+ lightboxNextButton.addEventListener("click", () => {
40251
+ if (activeScreenshotIndex === null || currentScreenshots.length <= 1) return;
40252
+ activeScreenshotIndex = (activeScreenshotIndex + 1) % currentScreenshots.length;
40253
+ syncLightbox();
40254
+ });
40255
+ lightboxCounter = createEl(document2, "span", "settings-extensions-lightbox__count");
40256
+ modal.append(
40257
+ lightboxImage,
40258
+ closeBtn,
40259
+ lightboxPrevButton,
40260
+ lightboxNextButton,
40261
+ lightboxCounter
40262
+ );
40263
+ modal.addEventListener("click", (event) => {
40264
+ if (event.target === modal) modal.close();
40265
+ });
40266
+ modal.addEventListener("keydown", (event) => {
40267
+ if (event.key === "Escape") {
40268
+ event.preventDefault();
40269
+ event.stopPropagation?.();
40270
+ modal.close();
40271
+ } else if (event.key === "ArrowLeft" && currentScreenshots.length > 1) {
40272
+ event.preventDefault();
40273
+ event.stopPropagation?.();
40274
+ activeScreenshotIndex = ((activeScreenshotIndex ?? 0) - 1 + currentScreenshots.length) % currentScreenshots.length;
40275
+ syncLightbox();
40276
+ } else if (event.key === "ArrowRight" && currentScreenshots.length > 1) {
40277
+ event.preventDefault();
40278
+ event.stopPropagation?.();
40279
+ activeScreenshotIndex = ((activeScreenshotIndex ?? 0) + 1) % currentScreenshots.length;
40280
+ syncLightbox();
40281
+ }
40282
+ });
40283
+ modal.addEventListener("close", cleanupLightbox);
40284
+ lightboxDialog = modal;
40285
+ host.append(modal);
40286
+ modal.showModal();
40287
+ modal.focus();
40288
+ }
40289
+ if (lightboxImage) {
40290
+ lightboxImage.src = activeUrl;
40291
+ lightboxImage.alt = formatMessage(copy.screenshotAlt, {
40292
+ name: currentDisplayName,
40293
+ index: String(activeScreenshotIndex + 1)
40294
+ });
40295
+ }
40296
+ const multi = total > 1;
40297
+ if (lightboxPrevButton) lightboxPrevButton.hidden = !multi;
40298
+ if (lightboxNextButton) lightboxNextButton.hidden = !multi;
40299
+ if (lightboxCounter) {
40300
+ lightboxCounter.hidden = !multi;
40301
+ lightboxCounter.textContent = multi ? `${activeScreenshotIndex + 1} / ${total}` : "";
40302
+ }
40303
+ syncThumbPressed();
39721
40304
  };
39722
40305
  const renderScreenshots = (extensionId, installed, catalogEntry, displayName) => {
39723
40306
  if (!screenshotsSection || !galleryGrid) return;
@@ -39726,21 +40309,20 @@ ${detail}` : ""}`
39726
40309
  currentDisplayName = displayName;
39727
40310
  if (urls.length === 0) {
39728
40311
  renderedScreenshotsKey = "";
39729
- activeScreenshotIndex = null;
39730
40312
  screenshotsSection.hidden = true;
39731
40313
  galleryGrid.replaceChildren();
39732
- syncPreviewStage();
40314
+ closeLightbox();
39733
40315
  return;
39734
40316
  }
39735
40317
  screenshotsSection.hidden = false;
39736
40318
  const signature = `${extensionId}\0${urls.join("\0")}`;
39737
40319
  if (signature === renderedScreenshotsKey) {
39738
- syncPreviewStage();
40320
+ if (activeScreenshotIndex !== null) syncLightbox();
39739
40321
  return;
39740
40322
  }
39741
40323
  renderedScreenshotsKey = signature;
39742
40324
  if (activeScreenshotIndex !== null && activeScreenshotIndex >= urls.length) {
39743
- activeScreenshotIndex = null;
40325
+ closeLightbox();
39744
40326
  }
39745
40327
  const thumbs = [];
39746
40328
  for (let i = 0; i < urls.length; i += 1) {
@@ -39766,13 +40348,14 @@ ${detail}` : ""}`
39766
40348
  image.loading = "lazy";
39767
40349
  thumbButton.append(image);
39768
40350
  thumbButton.addEventListener("click", () => {
39769
- activeScreenshotIndex = activeScreenshotIndex === i ? null : i;
39770
- syncPreviewStage();
40351
+ lightboxReturnFocus = thumbButton;
40352
+ activeScreenshotIndex = i;
40353
+ syncLightbox();
39771
40354
  });
39772
40355
  thumbs.push(thumbButton);
39773
40356
  }
39774
40357
  galleryGrid.replaceChildren(...thumbs);
39775
- syncPreviewStage();
40358
+ if (activeScreenshotIndex !== null) syncLightbox();
39776
40359
  };
39777
40360
  const renderInlineSettings = (installed, contentLocale) => {
39778
40361
  if (!settingsSection) return;
@@ -40385,8 +40968,8 @@ ${detail}` : ""}`
40385
40968
  const repositoryHref = parseSafeRepositoryUrl(
40386
40969
  (installed?.state === "valid" ? installed.manifest.repository : void 0) ?? catalogEntry?.repository
40387
40970
  );
40388
- const formattedStars = isValidExtensionCount(catalogEntry?.stars) ? formatExtensionCount(catalogEntry.stars) : null;
40389
- const formattedDownloads = isValidExtensionCount(catalogEntry?.downloads) ? formatExtensionCount(catalogEntry.downloads) : null;
40971
+ const formattedStars = formatPositiveExtensionCount(catalogEntry?.stars);
40972
+ const formattedDownloads = formatPositiveExtensionCount(catalogEntry?.downloads);
40390
40973
  if (repositoryHref) {
40391
40974
  const repoLink = createEl(document2, "a", "settings-extensions-detail-modal__repo");
40392
40975
  repoLink.href = repositoryHref;
@@ -40472,6 +41055,7 @@ ${detail}` : ""}`
40472
41055
  };
40473
41056
  const cleanup = () => {
40474
41057
  signal.removeEventListener("abort", cleanup);
41058
+ closeLightbox();
40475
41059
  settingsLoadToken += 1;
40476
41060
  const previous = dialog;
40477
41061
  dialog = null;
@@ -40499,11 +41083,6 @@ ${detail}` : ""}`
40499
41083
  settingsSection = null;
40500
41084
  descriptionSection = null;
40501
41085
  screenshotsSection = null;
40502
- previewStage = null;
40503
- previewImage = null;
40504
- previewCounter = null;
40505
- previewPrevButton = null;
40506
- previewNextButton = null;
40507
41086
  galleryGrid = null;
40508
41087
  previous?.remove();
40509
41088
  onClose?.();
@@ -40585,60 +41164,8 @@ ${detail}` : ""}`
40585
41164
  "settings-extensions-detail-modal__section-title",
40586
41165
  copy.screenshotsTitle
40587
41166
  );
40588
- previewStage = createEl(document2, "div", "settings-extensions-detail-modal__preview");
40589
- previewStage.hidden = true;
40590
- previewImage = createEl(document2, "img", "settings-extensions-detail-modal__preview-img");
40591
- const previewBar = createEl(document2, "div", "settings-extensions-detail-modal__preview-bar");
40592
- previewCounter = createEl(document2, "span", "settings-extensions-detail-modal__preview-count");
40593
- const previewControls = createEl(
40594
- document2,
40595
- "div",
40596
- "settings-extensions-detail-modal__preview-controls"
40597
- );
40598
- previewPrevButton = createEl(
40599
- document2,
40600
- "button",
40601
- "settings-icon-button settings-extensions-detail-modal__preview-nav"
40602
- );
40603
- previewPrevButton.type = "button";
40604
- previewPrevButton.title = copy.previousScreenshot;
40605
- previewPrevButton.setAttribute("aria-label", copy.previousScreenshot);
40606
- previewPrevButton.append(createRendererSettingsIcon("chevron-left", 14));
40607
- previewPrevButton.addEventListener("click", () => {
40608
- if (activeScreenshotIndex === null || currentScreenshots.length <= 1) return;
40609
- activeScreenshotIndex = (activeScreenshotIndex - 1 + currentScreenshots.length) % currentScreenshots.length;
40610
- syncPreviewStage();
40611
- });
40612
- previewNextButton = createEl(
40613
- document2,
40614
- "button",
40615
- "settings-icon-button settings-extensions-detail-modal__preview-nav"
40616
- );
40617
- previewNextButton.type = "button";
40618
- previewNextButton.title = copy.nextScreenshot;
40619
- previewNextButton.setAttribute("aria-label", copy.nextScreenshot);
40620
- previewNextButton.append(createRendererSettingsIcon("chevron-right", 14));
40621
- previewNextButton.addEventListener("click", () => {
40622
- if (activeScreenshotIndex === null || currentScreenshots.length <= 1) return;
40623
- activeScreenshotIndex = (activeScreenshotIndex + 1) % currentScreenshots.length;
40624
- syncPreviewStage();
40625
- });
40626
- const closePreviewButton = createEl(
40627
- document2,
40628
- "button",
40629
- "settings-extensions-detail-modal__preview-close",
40630
- copy.closePreview
40631
- );
40632
- closePreviewButton.type = "button";
40633
- closePreviewButton.addEventListener("click", () => {
40634
- activeScreenshotIndex = null;
40635
- syncPreviewStage();
40636
- });
40637
- previewControls.append(previewPrevButton, previewNextButton, closePreviewButton);
40638
- previewBar.append(previewCounter, previewControls);
40639
- previewStage.append(previewImage, previewBar);
40640
41167
  galleryGrid = createEl(document2, "div", "settings-extensions-detail-modal__gallery");
40641
- screenshotsSection.append(screenshotsHeading, previewStage, galleryGrid);
41168
+ screenshotsSection.append(screenshotsHeading, galleryGrid);
40642
41169
  modalBody.append(
40643
41170
  feedbackBar,
40644
41171
  attentionBar,
@@ -40656,8 +41183,7 @@ ${detail}` : ""}`
40656
41183
  event.preventDefault();
40657
41184
  event.stopPropagation?.();
40658
41185
  if (activeScreenshotIndex !== null) {
40659
- activeScreenshotIndex = null;
40660
- syncPreviewStage();
41186
+ closeLightbox();
40661
41187
  return;
40662
41188
  }
40663
41189
  modal.close();
@@ -40665,8 +41191,7 @@ ${detail}` : ""}`
40665
41191
  modal.addEventListener("cancel", (event) => {
40666
41192
  if (activeScreenshotIndex !== null) {
40667
41193
  event.preventDefault();
40668
- activeScreenshotIndex = null;
40669
- syncPreviewStage();
41194
+ closeLightbox();
40670
41195
  }
40671
41196
  });
40672
41197
  modal.addEventListener("close", cleanup);
@@ -40691,7 +41216,7 @@ ${detail}` : ""}`
40691
41216
  const { installed, catalogEntry } = resolveEntries(extensionId, state);
40692
41217
  if (!installed && !catalogEntry) return;
40693
41218
  if (openExtensionId !== extensionId) {
40694
- activeScreenshotIndex = null;
41219
+ closeLightbox();
40695
41220
  renderedIconKey = "";
40696
41221
  renderedScreenshotsKey = "";
40697
41222
  renderedDetailsKey = "";
@@ -41272,8 +41797,6 @@ ${detail}` : ""}`
41272
41797
  iconUrl: entry.icon,
41273
41798
  author: entry.author,
41274
41799
  version: entry.version,
41275
- repository: entry.repository,
41276
- stars: entry.stars,
41277
41800
  downloads: entry.downloads,
41278
41801
  trustTier: entry.trustTier,
41279
41802
  description: catalogDescription(entry, contentLocale),
@@ -41954,7 +42477,7 @@ ${detail}` : ""}`
41954
42477
  const button2 = createEl(
41955
42478
  document2,
41956
42479
  "button",
41957
- "settings-command-button settings-command-button--secondary settings-extensions-card__button",
42480
+ "settings-command-button settings-extensions-card__button settings-extensions-card__update-button",
41958
42481
  updating ? copy.updating : copy.update
41959
42482
  );
41960
42483
  button2.type = "button";
@@ -41982,8 +42505,6 @@ ${detail}` : ""}`
41982
42505
  iconUrl: resolveInstalledExtensionIconUrl(item, catalogEntry),
41983
42506
  author: (item.state === "valid" ? item.manifest.author : void 0) ?? catalogEntry?.author,
41984
42507
  version: item.state === "valid" ? item.manifest.version : void 0,
41985
- repository: (item.state === "valid" ? item.manifest.repository : void 0) ?? catalogEntry?.repository,
41986
- stars: catalogEntry?.stars,
41987
42508
  downloads: catalogEntry?.downloads,
41988
42509
  trustTier: catalogEntry?.trustTier,
41989
42510
  statusState,
@@ -46460,6 +46981,7 @@ ${detail}` : ""}`
46460
46981
  return messages.updateInstallationWindowsInstaller;
46461
46982
  }
46462
46983
  if (installation === "macos-dmg") return messages.updateInstallationMacOsDmg;
46984
+ if (installation === "linux-archive") return messages.updateInstallationLinuxArchive;
46463
46985
  return messages.updateInstallationUnknown;
46464
46986
  }
46465
46987
  function isPendingStatus(status) {
@@ -50504,7 +51026,6 @@ ${detail}` : ""}`
50504
51026
  white-space: nowrap;
50505
51027
  }
50506
51028
 
50507
- .settings-extensions-card__star,
50508
51029
  .settings-extensions-card__downloads {
50509
51030
  display: inline-flex;
50510
51031
  align-items: center;
@@ -50519,19 +51040,13 @@ ${detail}` : ""}`
50519
51040
  transition: color 140ms ease;
50520
51041
  }
50521
51042
 
50522
- .settings-extensions-card__star--link {
50523
- margin: 0 -2px;
50524
- padding: 0 2px;
50525
- cursor: pointer;
51043
+ .settings-extensions-card[data-update-available="true"] {
51044
+ border-color: color-mix(in srgb, var(--settings-focus) 34%, var(--settings-border));
50526
51045
  }
50527
51046
 
50528
- .settings-extensions-card__star--link:hover {
50529
- color: var(--settings-text);
50530
- }
50531
-
50532
- .settings-extensions-card__star--link:focus-visible {
50533
- outline: 2px solid var(--settings-focus);
50534
- outline-offset: 2px;
51047
+ .settings-extensions-card[data-update-available="true"]:hover {
51048
+ border-color: color-mix(in srgb, var(--settings-focus) 54%, var(--settings-border));
51049
+ box-shadow: 0 4px 14px color-mix(in srgb, var(--settings-focus) 12%, transparent);
50535
51050
  }
50536
51051
 
50537
51052
  .settings-extensions-card__update {
@@ -50539,7 +51054,12 @@ ${detail}` : ""}`
50539
51054
  flex-wrap: wrap;
50540
51055
  align-items: center;
50541
51056
  justify-content: space-between;
50542
- gap: 4px 8px;
51057
+ gap: 6px 10px;
51058
+ margin-top: 2px;
51059
+ padding: 6px 8px 6px 10px;
51060
+ border: 1px solid color-mix(in srgb, var(--settings-focus) 24%, transparent);
51061
+ border-radius: 9px;
51062
+ background: color-mix(in srgb, var(--settings-focus) 9%, transparent);
50543
51063
  color: var(--settings-focus);
50544
51064
  font-size: 12px;
50545
51065
  font-weight: 600;
@@ -50547,6 +51067,29 @@ ${detail}` : ""}`
50547
51067
  overflow-wrap: anywhere;
50548
51068
  }
50549
51069
 
51070
+ .settings-extensions-card__update-label {
51071
+ display: inline-flex;
51072
+ align-items: center;
51073
+ gap: 7px;
51074
+ font-variant-numeric: tabular-nums;
51075
+ }
51076
+
51077
+ .settings-extensions-card__update-label::before {
51078
+ content: "";
51079
+ flex: none;
51080
+ width: 6px;
51081
+ height: 6px;
51082
+ border-radius: 50%;
51083
+ background: var(--settings-focus);
51084
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--settings-focus) 20%, transparent);
51085
+ }
51086
+
51087
+ .settings-extensions-card__update .settings-extensions-card__update-button {
51088
+ min-height: 26px;
51089
+ padding: 3px 11px;
51090
+ font-weight: 600;
51091
+ }
51092
+
50550
51093
  .settings-extensions-card__categories-text {
50551
51094
  flex: 0 1 auto;
50552
51095
  max-width: 52%;
@@ -51294,8 +51837,8 @@ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
51294
51837
  .settings-extensions-detail-modal__alert[hidden],
51295
51838
  .settings-extensions-detail-modal__description[hidden],
51296
51839
  .settings-extensions-detail-modal__screenshots[hidden],
51297
- .settings-extensions-detail-modal__preview[hidden],
51298
- .settings-extensions-detail-modal__preview-nav[hidden] {
51840
+ .settings-extensions-lightbox__nav[hidden],
51841
+ .settings-extensions-lightbox__count[hidden] {
51299
51842
  display: none;
51300
51843
  }
51301
51844
 
@@ -51461,68 +52004,9 @@ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
51461
52004
  line-height: 16px;
51462
52005
  }
51463
52006
 
51464
- .settings-extensions-detail-modal__preview {
51465
- display: grid;
51466
- gap: 8px;
51467
- padding: 10px;
51468
- background: var(--settings-inset);
51469
- border: 1px solid var(--settings-border);
51470
- border-radius: 10px;
51471
- }
51472
-
51473
- .settings-extensions-detail-modal__preview-img {
51474
- display: block;
51475
- width: 100%;
51476
- max-height: 340px;
51477
- object-fit: contain;
51478
- background: var(--settings-surface);
51479
- border-radius: 7px;
51480
- }
51481
-
51482
- .settings-extensions-detail-modal__preview-bar {
51483
- display: flex;
51484
- align-items: center;
51485
- justify-content: space-between;
51486
- gap: 8px;
51487
- }
51488
-
51489
- .settings-extensions-detail-modal__preview-count {
51490
- color: var(--settings-subtle);
51491
- font-size: 11.5px;
51492
- font-variant-numeric: tabular-nums;
51493
- }
51494
-
51495
- .settings-extensions-detail-modal__preview-controls {
51496
- display: flex;
51497
- align-items: center;
51498
- gap: 4px;
51499
- }
51500
-
51501
- .settings-extensions-detail-modal__preview-close {
51502
- height: 24px;
51503
- padding: 0 8px;
51504
- color: var(--settings-muted);
51505
- font: inherit;
51506
- font-size: 11.5px;
51507
- background: var(--settings-panel);
51508
- border: 1px solid var(--settings-border);
51509
- border-radius: 6px;
51510
- cursor: pointer;
51511
- }
51512
-
51513
- .settings-extensions-detail-modal__preview-close:hover {
51514
- color: var(--settings-text);
51515
- background: var(--settings-hover);
51516
- }
51517
-
51518
- .settings-extensions-detail-modal__preview-close:focus-visible {
51519
- outline: 2px solid var(--settings-focus);
51520
- outline-offset: 1px;
51521
- }
51522
-
51523
52007
  .settings-extensions-detail-modal__gallery {
51524
52008
  display: grid;
51525
- grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
52009
+ grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
51526
52010
  gap: 8px;
51527
52011
  }
51528
52012
 
@@ -51534,15 +52018,16 @@ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
51534
52018
  background: var(--settings-inset);
51535
52019
  border: 1.5px solid var(--settings-border);
51536
52020
  border-radius: 8px;
51537
- cursor: pointer;
52021
+ cursor: zoom-in;
51538
52022
  transition:
51539
- border-color 120ms ease,
51540
- transform 120ms ease,
51541
- box-shadow 120ms ease;
52023
+ border-color 140ms ease,
52024
+ transform 140ms ease,
52025
+ box-shadow 140ms ease;
51542
52026
  }
51543
52027
 
51544
52028
  .settings-extensions-detail-modal__thumb:hover {
51545
52029
  border-color: var(--settings-focus);
52030
+ box-shadow: 0 4px 12px light-dark(rgb(15 23 42 / 10%), rgb(0 0 0 / 32%));
51546
52031
  }
51547
52032
 
51548
52033
  .settings-extensions-detail-modal__thumb[aria-pressed="true"] {
@@ -51562,6 +52047,131 @@ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
51562
52047
  object-fit: cover;
51563
52048
  }
51564
52049
 
52050
+ dialog.settings-extensions-lightbox {
52051
+ position: fixed;
52052
+ inset: 0;
52053
+ width: 100vw;
52054
+ height: 100vh;
52055
+ max-width: none;
52056
+ max-height: none;
52057
+ margin: 0;
52058
+ padding: 28px 72px 68px;
52059
+ box-sizing: border-box;
52060
+ overflow: hidden;
52061
+ background: transparent;
52062
+ border: 0;
52063
+ }
52064
+
52065
+ dialog.settings-extensions-lightbox[open] {
52066
+ display: grid;
52067
+ place-items: center;
52068
+ }
52069
+
52070
+ dialog.settings-extensions-lightbox:focus {
52071
+ outline: none;
52072
+ }
52073
+
52074
+ dialog.settings-extensions-lightbox::backdrop {
52075
+ background: rgb(10 13 20 / 78%);
52076
+ -webkit-backdrop-filter: blur(12px) saturate(130%);
52077
+ backdrop-filter: blur(12px) saturate(130%);
52078
+ animation: settings-extensions-backdrop-in 160ms ease-out;
52079
+ }
52080
+
52081
+ .settings-extensions-lightbox__img {
52082
+ display: block;
52083
+ max-width: min(calc(100vw - 144px), 1560px);
52084
+ max-height: calc(100vh - 96px);
52085
+ object-fit: contain;
52086
+ background: rgb(18 22 30 / 60%);
52087
+ border: 1px solid rgb(255 255 255 / 14%);
52088
+ border-radius: 12px;
52089
+ box-shadow: 0 24px 64px rgb(0 0 0 / 48%);
52090
+ animation: settings-extensions-dialog-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
52091
+ }
52092
+
52093
+ .settings-extensions-lightbox__btn {
52094
+ position: fixed;
52095
+ display: inline-flex;
52096
+ align-items: center;
52097
+ justify-content: center;
52098
+ padding: 0;
52099
+ color: rgb(255 255 255 / 92%);
52100
+ background: rgb(24 28 36 / 74%);
52101
+ border: 1px solid rgb(255 255 255 / 16%);
52102
+ border-radius: 999px;
52103
+ -webkit-backdrop-filter: blur(16px) saturate(150%);
52104
+ backdrop-filter: blur(16px) saturate(150%);
52105
+ box-shadow: 0 8px 24px rgb(0 0 0 / 32%);
52106
+ cursor: pointer;
52107
+ transition:
52108
+ background-color 140ms ease,
52109
+ border-color 140ms ease,
52110
+ transform 100ms ease;
52111
+ }
52112
+
52113
+ .settings-extensions-lightbox__btn:hover {
52114
+ color: #fff;
52115
+ background: rgb(42 48 60 / 88%);
52116
+ border-color: rgb(255 255 255 / 28%);
52117
+ }
52118
+
52119
+ .settings-extensions-lightbox__btn:focus-visible {
52120
+ outline: 2px solid #fff;
52121
+ outline-offset: 2px;
52122
+ }
52123
+
52124
+ .settings-extensions-lightbox__close {
52125
+ top: 18px;
52126
+ right: 18px;
52127
+ width: 36px;
52128
+ height: 36px;
52129
+ }
52130
+
52131
+ .settings-extensions-lightbox__nav {
52132
+ top: 50%;
52133
+ width: 38px;
52134
+ height: 38px;
52135
+ transform: translateY(-50%);
52136
+ }
52137
+
52138
+ .settings-extensions-lightbox__nav--prev {
52139
+ left: 18px;
52140
+ }
52141
+
52142
+ .settings-extensions-lightbox__nav--next {
52143
+ right: 18px;
52144
+ }
52145
+
52146
+ .settings-extensions-lightbox__count {
52147
+ position: fixed;
52148
+ bottom: 18px;
52149
+ left: 50%;
52150
+ padding: 5px 12px;
52151
+ color: rgb(255 255 255 / 90%);
52152
+ font-size: 12px;
52153
+ font-weight: 500;
52154
+ line-height: 16px;
52155
+ font-variant-numeric: tabular-nums;
52156
+ background: rgb(24 28 36 / 74%);
52157
+ border: 1px solid rgb(255 255 255 / 16%);
52158
+ border-radius: 999px;
52159
+ -webkit-backdrop-filter: blur(16px) saturate(150%);
52160
+ backdrop-filter: blur(16px) saturate(150%);
52161
+ transform: translateX(-50%);
52162
+ }
52163
+
52164
+ @media (max-width: 640px) {
52165
+ dialog.settings-extensions-lightbox {
52166
+ padding: 56px 14px 64px;
52167
+ }
52168
+
52169
+ .settings-extensions-lightbox__img {
52170
+ max-width: calc(100vw - 28px);
52171
+ max-height: calc(100vh - 120px);
52172
+ }
52173
+ }
52174
+
51565
52175
  .settings-extensions .settings-command-button--danger {
51566
52176
  flex: none;
51567
52177
  color: var(--settings-danger);
@@ -52046,7 +52656,9 @@ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
52046
52656
  dialog.settings-account-dialog.settings-extensions-create-dialog[open],
52047
52657
  dialog.settings-account-dialog.settings-extensions-detail-dialog::backdrop,
52048
52658
  dialog.settings-account-dialog.settings-extensions-import-dialog::backdrop,
52049
- dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop {
52659
+ dialog.settings-account-dialog.settings-extensions-create-dialog::backdrop,
52660
+ dialog.settings-extensions-lightbox::backdrop,
52661
+ .settings-extensions-lightbox__img {
52050
52662
  animation: none;
52051
52663
  }
52052
52664
  }
@@ -55592,6 +56204,68 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
55592
56204
  };
55593
56205
  }
55594
56206
 
56207
+ // src/renderer-reference-trigger.ts
56208
+ var HASH_BOUNDARY = String.raw`[\s\p{sc=Han}\p{sc=Hira}\p{sc=Kana}\u30FC\u3000-\u303F\uFF01\uFF02\uFF04-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65]`;
56209
+ var FENCE_PATTERN3 = /^ {0,3}(`{3,}|~{3,})(.*)$/u;
56210
+ function isFenceOpening(marker, rest) {
56211
+ return marker === "~" || !rest.includes("`");
56212
+ }
56213
+ function insideMarkdownCode(textBeforeCaret) {
56214
+ const lines = textBeforeCaret.split(/\r\n|\n|\r/u);
56215
+ const lastIndex = lines.length - 1;
56216
+ let fence = null;
56217
+ let inlineBackticks = 0;
56218
+ for (let lineIndex = 0; lineIndex <= lastIndex; lineIndex += 1) {
56219
+ const line = lines[lineIndex] ?? "";
56220
+ if (fence !== null) {
56221
+ if (lineIndex < lastIndex) {
56222
+ const match2 = FENCE_PATTERN3.exec(line);
56223
+ if (match2) {
56224
+ const run = match2[1] ?? "";
56225
+ if (run.charAt(0) === fence.marker && run.length >= fence.length && (match2[2] ?? "").trim() === "") {
56226
+ fence = null;
56227
+ }
56228
+ }
56229
+ }
56230
+ continue;
56231
+ }
56232
+ if (lineIndex < lastIndex && line.trim() === "") {
56233
+ inlineBackticks = 0;
56234
+ continue;
56235
+ }
56236
+ const match = FENCE_PATTERN3.exec(line);
56237
+ if (match) {
56238
+ const run = match[1] ?? "";
56239
+ const marker = run.charAt(0);
56240
+ const rest = match[2] ?? "";
56241
+ if (isFenceOpening(marker, rest)) {
56242
+ inlineBackticks = 0;
56243
+ if (lineIndex === lastIndex) return true;
56244
+ fence = { marker, length: run.length };
56245
+ continue;
56246
+ }
56247
+ }
56248
+ let i = 0;
56249
+ while (i < line.length) {
56250
+ if (inlineBackticks === 0 && line.charAt(i) === "\\") {
56251
+ i += 2;
56252
+ continue;
56253
+ }
56254
+ if (line.charAt(i) === "`") {
56255
+ let end = i + 1;
56256
+ while (end < line.length && line.charAt(end) === "`") end += 1;
56257
+ const runLength = end - i;
56258
+ if (inlineBackticks === 0) inlineBackticks = runLength;
56259
+ else if (runLength === inlineBackticks) inlineBackticks = 0;
56260
+ i = end;
56261
+ continue;
56262
+ }
56263
+ i += 1;
56264
+ }
56265
+ }
56266
+ return fence !== null || inlineBackticks > 0;
56267
+ }
56268
+
55595
56269
  // src/renderer-delegation-mention.ts
55596
56270
  var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
55597
56271
  var STYLE_ATTRIBUTE4 = "data-codexhost-delegation-mention-style";
@@ -55607,13 +56281,18 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
55607
56281
  var VIEWPORT_MARGIN = 8;
55608
56282
  var MENU_GAP2 = 4;
55609
56283
  var MAX_QUERY_LENGTH = 32;
55610
- var TRIGGER_PATTERN = /(?:^|\s)#([^\s#]*)$/u;
56284
+ var TRIGGER_PATTERN = new RegExp(
56285
+ String.raw`(?:^|${HASH_BOUNDARY})[#\uFF03]([^\s#\uFF03]*)$`,
56286
+ "u"
56287
+ );
55611
56288
  function findDelegationTrigger(textBeforeCaret) {
55612
56289
  const match = TRIGGER_PATTERN.exec(textBeforeCaret);
55613
56290
  if (!match) return null;
55614
56291
  const query = match[1] ?? "";
55615
56292
  if (query.length > MAX_QUERY_LENGTH || /^\d/u.test(query)) return null;
55616
- return { query, start: textBeforeCaret.length - query.length - 1 };
56293
+ const start = textBeforeCaret.length - query.length - 1;
56294
+ if (insideMarkdownCode(textBeforeCaret.slice(0, start))) return null;
56295
+ return { query, start };
55617
56296
  }
55618
56297
  function filterDelegationTargets(targets, query) {
55619
56298
  const needle = query.trim().toLowerCase();
@@ -55916,6 +56595,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55916
56595
  if (!node || node.nodeType !== node.TEXT_NODE) return null;
55917
56596
  const editor = node.parentElement?.closest('[contenteditable="true"]');
55918
56597
  if (!editor || !options.isComposerEditor(editor)) return null;
56598
+ if (node.parentElement?.closest("code, pre")) return null;
55919
56599
  const text2 = node;
55920
56600
  const found = findDelegationTrigger(text2.data.slice(0, selection2.anchorOffset));
55921
56601
  if (!found) return null;
@@ -55924,7 +56604,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
55924
56604
  node: text2,
55925
56605
  start: found.start,
55926
56606
  end: selection2.anchorOffset,
55927
- query: found.query
56607
+ query: found.query,
56608
+ char: text2.data.charAt(found.start)
55928
56609
  };
55929
56610
  };
55930
56611
  const refresh = () => {
@@ -56015,7 +56696,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
56015
56696
  if (entry.kind === "librarySkill" && trigger && !options.readSkills?.(trigger.editor)) return;
56016
56697
  close();
56017
56698
  if (!trigger || !trigger.node.isConnected) return;
56018
- const expected = `#${trigger.query}`;
56699
+ const expected = `${trigger.char}${trigger.query}`;
56019
56700
  if (trigger.node.data.slice(trigger.start, trigger.end) !== expected) return;
56020
56701
  const range = { node: trigger.node, start: trigger.start, end: trigger.end, expected };
56021
56702
  inserting = true;
@@ -57470,6 +58151,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
57470
58151
  const mountedByComposer = /* @__PURE__ */ new Map();
57471
58152
  const pendingDefaultPreferences = /* @__PURE__ */ new Map();
57472
58153
  const catalogRequests = /* @__PURE__ */ new WeakMap();
58154
+ const harnessAvailabilityRechecks = /* @__PURE__ */ new Map();
57473
58155
  const draftUsageRequests = /* @__PURE__ */ new WeakMap();
57474
58156
  const pendingReplacements = /* @__PURE__ */ new Map();
57475
58157
  let disposed = false;
@@ -57689,6 +58371,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
57689
58371
  );
57690
58372
  };
57691
58373
  const showCodexUsageGateStatus = (mounted, status) => {
58374
+ mounted.codexUsageBanner.update(status === "bypassed");
57692
58375
  const title = status === "unsupported" ? rendererHarnessMessages(settingsLifecycle.locale).codexUsageGateUnavailable : "";
57693
58376
  if (mounted.control.root.title !== title) mounted.control.root.title = title;
57694
58377
  };
@@ -57715,6 +58398,22 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
57715
58398
  const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
57716
58399
  return composerClient(mounted) && (!needsRpcSteering || window.__codexhostRpcSteeringV1) ? "ready" : "installing";
57717
58400
  };
58401
+ const draftWorkspaces = /* @__PURE__ */ new Map();
58402
+ const nativeDraftWorkspaces = createRendererNativeDraftWorkspaceStore();
58403
+ const draftIdFromComposerModelTarget = (target2) => target2?.[0] === "default" && typeof target2[1] === "string" && target2[1].length > 0 ? target2[1] : null;
58404
+ const activeNativeDraftComposers = () => [...mountedByComposer.values()].map((mounted) => ({
58405
+ composer: mounted.composer,
58406
+ hostId: threadIdFromComposerModelTarget(mounted.modelTarget) ? null : activeModelHostId(mounted.composer),
58407
+ draftId: draftIdFromComposerModelTarget(mounted.modelTarget)
58408
+ }));
58409
+ {
58410
+ const published = Reflect.get(window, "__codexhostDraftWorkspacesV1");
58411
+ if (typeof published === "object" && published !== null) {
58412
+ for (const [hostId2, cwd] of Object.entries(published)) {
58413
+ if (typeof cwd === "string" && cwd.length > 0) draftWorkspaces.set(hostId2, cwd);
58414
+ }
58415
+ }
58416
+ }
57718
58417
  const renderMounted = (mounted) => {
57719
58418
  if (!isMountedComposer(mounted.composer)) return;
57720
58419
  restorePendingDraftPreference(mounted);
@@ -57745,7 +58444,25 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
57745
58444
  mounted.ownershipStatus === "error",
57746
58445
  mounted.accountBalance
57747
58446
  );
57748
- showCodexUsageGateStatus(mounted, mounted.codexUsageGate.update(externalSubmissionReady));
58447
+ const nativeTargetResolved = mounted.modelTarget?.[0] === "default" || mounted.modelTarget?.[0] === "conversation";
58448
+ const nativeEligible = nativeTargetResolved && controller.get(mounted.composer).agent === "codex" && mounted.ownershipStatus !== "loading" && mounted.ownershipStatus !== "error" && !controller.isSwitching(mounted.composer);
58449
+ const nativeThreadId = threadIdFromComposerModelTarget(mounted.modelTarget);
58450
+ if (nativeThreadId) nativeDraftWorkspaces.delete(mounted.composer);
58451
+ const nativeDraftScope = nativeThreadId ? null : nativeDraftWorkspaces.resolve({
58452
+ composer: mounted.composer,
58453
+ hostId: activeModelHostId(mounted.composer),
58454
+ draftId: draftIdFromComposerModelTarget(mounted.modelTarget)
58455
+ });
58456
+ const nativeSubmissionReady = mounted.nativeInferenceRoute.update(
58457
+ composerClient(mounted),
58458
+ nativeThreadId,
58459
+ nativeEligible,
58460
+ nativeDraftScope
58461
+ );
58462
+ showCodexUsageGateStatus(
58463
+ mounted,
58464
+ mounted.codexUsageGate.update(externalSubmissionReady || nativeSubmissionReady)
58465
+ );
57749
58466
  if (mounted.control.usage) {
57750
58467
  mounted.control.usage.onOpen = () => {
57751
58468
  void refreshThreadUsage(
@@ -57756,15 +58473,6 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
57756
58473
  }
57757
58474
  };
57758
58475
  let delegationMention = null;
57759
- const draftWorkspaces = /* @__PURE__ */ new Map();
57760
- {
57761
- const published = Reflect.get(window, "__codexhostDraftWorkspacesV1");
57762
- if (typeof published === "object" && published !== null) {
57763
- for (const [hostId2, cwd] of Object.entries(published)) {
57764
- if (typeof cwd === "string" && cwd.length > 0) draftWorkspaces.set(hostId2, cwd);
57765
- }
57766
- }
57767
- }
57768
58476
  const skillContext = (editor) => {
57769
58477
  const composer = composerForElement(editor);
57770
58478
  const mounted = composer ? mountedByComposer.get(composer) : void 0;
@@ -58113,7 +58821,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
58113
58821
  sidebarAgentIcons.refresh();
58114
58822
  return true;
58115
58823
  };
58116
- const loadExternalCatalog = async (mounted, credentialAccess) => {
58824
+ const loadExternalCatalog = async (mounted, credentialAccess, refresh = false) => {
58117
58825
  if (!isMountedComposer(mounted.composer)) return;
58118
58826
  modelRecovery.delete(mounted);
58119
58827
  void refreshCommands(mounted);
@@ -58170,6 +58878,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
58170
58878
  catalogRequests.set(mounted, catalogRequest);
58171
58879
  const inspection = await client.inspectHarness({
58172
58880
  harnessId: harnessIdSchema.parse(agent),
58881
+ ...refresh ? { refresh: true } : {},
58173
58882
  ...credentialAccess ? { credentialAccess } : {}
58174
58883
  });
58175
58884
  if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent || mounted.hostId !== requestHostId || modelControl !== requestModelControl || modelClientForHostFrom(requestModelControl, requestHostId) !== client || activeModelHostId(mounted.composer) !== requestHostId) {
@@ -58353,6 +59062,61 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
58353
59062
  finishModelRequest(mounted, generation);
58354
59063
  }
58355
59064
  };
59065
+ const recheckFailedHarnessCatalog = async (mounted, hostId2, agent) => {
59066
+ const client = composerClient(mounted);
59067
+ if (!client) return;
59068
+ const loadingView = {
59069
+ status: "loading",
59070
+ thinkingSelectionSupported: false
59071
+ };
59072
+ mounted.modelView = loadingView;
59073
+ renderMounted(mounted);
59074
+ const key2 = `${hostId2}\0${agent}`;
59075
+ const recheck = (harnessAvailabilityRechecks.get(key2) ?? 0) + 1;
59076
+ harnessAvailabilityRechecks.set(key2, recheck);
59077
+ const state = hostHarnessAvailabilityState(hostId2);
59078
+ let status = "error";
59079
+ let nextError;
59080
+ let webUiAvailable = false;
59081
+ try {
59082
+ const inspection = await client.inspectHarness({
59083
+ harnessId: harnessIdSchema.parse(agent),
59084
+ refresh: true,
59085
+ purpose: "availability",
59086
+ credentialAccess: "retry"
59087
+ });
59088
+ status = inspection.status === "ready" ? "ready" : inspection.status;
59089
+ webUiAvailable = hostId2 === "local" && inspection.status === "ready" && inspection.webUi?.open === true;
59090
+ if (inspection.status !== "ready") {
59091
+ const error51 = inspection.error;
59092
+ nextError = {
59093
+ code: error51.code,
59094
+ message: error51.message,
59095
+ retryable: error51.retryable,
59096
+ ...error51.diagnostic ? { diagnostic: error51.diagnostic } : {},
59097
+ ...error51.stage ? { stage: error51.stage } : {},
59098
+ ...error51.durationMs !== void 0 ? { durationMs: error51.durationMs } : {},
59099
+ ...error51.stderrTail ? { stderrTail: error51.stderrTail } : {}
59100
+ };
59101
+ }
59102
+ } catch (error51) {
59103
+ nextError = {
59104
+ code: error51 instanceof RendererMethodUnavailableError ? "unavailable" : "internalError",
59105
+ message: error51 instanceof Error ? error51.message : String(error51),
59106
+ retryable: !(error51 instanceof RendererMethodUnavailableError),
59107
+ stage: "request"
59108
+ };
59109
+ }
59110
+ const current = !disposed && harnessAvailabilityRechecks.get(key2) === recheck && modelClientForHost(hostId2) === client;
59111
+ if (current) {
59112
+ state.errors[agent] = nextError;
59113
+ state.availability = { ...state.availability, [agent]: status };
59114
+ state.webUi = { ...state.webUi, [agent]: webUiAvailable };
59115
+ publishConnectionStatus();
59116
+ }
59117
+ if (mounted.modelView !== loadingView || !isMountedComposer(mounted.composer)) return;
59118
+ void loadExternalCatalog(mounted, void 0, current && status === "ready");
59119
+ };
58356
59120
  const refreshExternalModels = async (mounted) => {
58357
59121
  const { agent } = controller.get(mounted.composer);
58358
59122
  const hostId2 = mounted.hostId;
@@ -58360,6 +59124,15 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
58360
59124
  const requestControl = modelControl;
58361
59125
  if (agent === "codex" || !hostId2 || !client) return;
58362
59126
  const matchesTarget = (candidate) => isMountedComposer(candidate.composer) && mountedByComposer.get(candidate.composer) === candidate && candidate.hostId === hostId2 && activeModelHostId(candidate.composer) === hostId2 && modelControl === requestControl && composerClient(candidate) === client && controller.get(candidate.composer).agent === agent && !controller.isSwitching(candidate.composer);
59127
+ if (matchesTarget(mounted) && mounted.modelView.status === "error" && mounted.modelView.catalog === void 0) {
59128
+ const availability = hostHarnessAvailabilityState(hostId2).availability[agent];
59129
+ if (availability === "ready" || availability === "checking") {
59130
+ void loadExternalCatalog(mounted, void 0, true);
59131
+ } else {
59132
+ void recheckFailedHarnessCatalog(mounted, hostId2, agent);
59133
+ }
59134
+ return;
59135
+ }
58363
59136
  const canRefresh = (candidate) => matchesTarget(candidate) && candidate.modelView.catalog !== void 0 && (candidate.modelView.status === "ready" || candidate.modelView.status === "error");
58364
59137
  const active2 = catalogRequests.get(mounted);
58365
59138
  if (!canRefresh(mounted) || active2?.refreshing && isCurrentModelRequest(mounted, active2.generation))
@@ -58990,7 +59763,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
58990
59763
  scheduleHarnessAvailabilityRetry(hostId2);
58991
59764
  return Promise.resolve();
58992
59765
  }
58993
- if (state.request?.client === client && (!force || state.request.force)) {
59766
+ if (state.request?.client === client && (!force || state.request.force) && (!credentialAccess || state.request.credentialAccess === credentialAccess)) {
58994
59767
  return state.request.promise;
58995
59768
  }
58996
59769
  if (state.directoryClient !== client) {
@@ -59061,6 +59834,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59061
59834
  await Promise.all(
59062
59835
  agentsToInspect.map(async (agent) => {
59063
59836
  const before = state.availability[agent];
59837
+ const recheckKey = `${hostId2}\0${agent}`;
59838
+ const recheck = harnessAvailabilityRechecks.get(recheckKey);
59064
59839
  let status = "error";
59065
59840
  let nextError;
59066
59841
  let webUiAvailable = false;
@@ -59099,6 +59874,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59099
59874
  }
59100
59875
  if (generation !== state.requestGeneration || disposed || modelClientForHost(hostId2) !== client)
59101
59876
  return;
59877
+ if (harnessAvailabilityRechecks.get(recheckKey) !== recheck) return;
59102
59878
  const previousStatus = state.availability[agent];
59103
59879
  if (before !== "ready" && previousStatus === "ready" && nextError?.code === "credentialAccessRequired")
59104
59880
  return;
@@ -59116,7 +59892,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59116
59892
  isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView),
59117
59893
  refresh && force
59118
59894
  )) {
59119
- void loadExternalCatalog(mounted);
59895
+ void loadExternalCatalog(mounted, void 0, refresh && force);
59120
59896
  }
59121
59897
  renderMounted(mounted);
59122
59898
  }
@@ -59130,7 +59906,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59130
59906
  scheduleHarnessAvailabilityRetry(hostId2);
59131
59907
  }
59132
59908
  })();
59133
- const request = { client, promise: promise2, force };
59909
+ const request = { client, promise: promise2, force, ...credentialAccess ? { credentialAccess } : {} };
59134
59910
  state.request = request;
59135
59911
  void promise2.then(
59136
59912
  () => {
@@ -59429,6 +60205,12 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59429
60205
  composerId: state.composerId,
59430
60206
  control,
59431
60207
  codexUsageGate: createRendererCodexUsageGate(composer),
60208
+ codexUsageBanner: createRendererNativeProviderUsageBanner(composer),
60209
+ nativeInferenceRoute: createRendererNativeInferenceRoute(() => {
60210
+ if (!disposed && mountedByComposer.get(composer) === mounted && composer.isConnected) {
60211
+ renderMounted(mounted);
60212
+ }
60213
+ }),
59432
60214
  modelTarget,
59433
60215
  modelView: inherited?.modelView ?? { status: "idle" },
59434
60216
  permissionModeView: inherited?.permissionModeView ?? { status: "idle" },
@@ -59505,6 +60287,9 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59505
60287
  usageRefreshTimers.delete(composer);
59506
60288
  }
59507
60289
  mounted.codexUsageGate.dispose();
60290
+ mounted.codexUsageBanner.dispose();
60291
+ mounted.nativeInferenceRoute.dispose();
60292
+ nativeDraftWorkspaces.delete(composer);
59508
60293
  disposeComposerAgentControl(mounted.control);
59509
60294
  ownershipRecovery.delete(mounted);
59510
60295
  modelRecovery.delete(mounted);
@@ -59711,10 +60496,13 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59711
60496
  reconcileHarnessAvailabilityHost();
59712
60497
  void loadCodexAccounts();
59713
60498
  void refreshHarnessAvailability();
60499
+ nativeDraftWorkspaces.clear();
59714
60500
  for (const mounted of mountedByComposer.values()) {
59715
60501
  const state = controller.get(mounted.composer);
59716
60502
  if (state.agent !== "codex" && !threadIdFromComposerModelTarget(mounted.modelTarget) && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
59717
60503
  void loadExternalCatalog(mounted);
60504
+ } else if (state.agent === "codex" && !threadIdFromComposerModelTarget(mounted.modelTarget)) {
60505
+ renderMounted(mounted);
59718
60506
  }
59719
60507
  }
59720
60508
  };
@@ -59772,13 +60560,23 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59772
60560
  const onDraftWorkspace = (event) => {
59773
60561
  const detail = event.detail;
59774
60562
  if (typeof detail !== "object" || detail === null) return;
59775
- const { hostId: hostId2, cwd } = detail;
59776
- if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
60563
+ const { hostId: hostId2, cwd, draftId } = detail;
60564
+ if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.trim().length === 0) return;
59777
60565
  draftWorkspaces.set(hostId2, cwd);
60566
+ nativeDraftWorkspaces.publish(
60567
+ {
60568
+ hostId: hostId2,
60569
+ cwd,
60570
+ ...typeof draftId === "string" && draftId.length > 0 ? { draftId } : {}
60571
+ },
60572
+ activeNativeDraftComposers()
60573
+ );
59778
60574
  delegationMention?.refresh();
59779
60575
  for (const mounted of mountedByComposer.values()) {
59780
60576
  if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2 && controller.get(mounted.composer).agent !== "codex") {
59781
60577
  void refreshCommands(mounted, { keepCurrent: true });
60578
+ } else if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2) {
60579
+ renderMounted(mounted);
59782
60580
  }
59783
60581
  }
59784
60582
  };
@@ -59981,6 +60779,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
59981
60779
  if (state.retryTimer !== null) window.clearTimeout(state.retryTimer);
59982
60780
  }
59983
60781
  harnessAvailabilityByHost.clear();
60782
+ nativeDraftWorkspaces.clear();
59984
60783
  activeAvailabilityHostId = "local";
59985
60784
  sidebarAgentIcons.refresh();
59986
60785
  void refreshHarnessAvailabilityForHost("local");
@@ -60052,8 +60851,11 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
60052
60851
  mounted.usageRequestGeneration += 1;
60053
60852
  usageRefreshAttempts.delete(mounted.composer);
60054
60853
  mounted.codexUsageGate.dispose();
60854
+ mounted.codexUsageBanner.dispose();
60855
+ mounted.nativeInferenceRoute.dispose();
60055
60856
  disposeComposerAgentControl(mounted.control);
60056
60857
  }
60858
+ nativeDraftWorkspaces.clear();
60057
60859
  mountedByComposer.clear();
60058
60860
  pendingReplacements.clear();
60059
60861
  connectionListeners.clear();