@codexhost/cli-win32-x64 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +62 -5
  4. package/app/console-web.js +236 -30
  5. package/app/desktop-controller.mjs +68 -9
  6. package/app/host-runtime.mjs +3653 -1136
  7. package/app/plugins/antigravity/plugin.mjs +64 -27
  8. package/app/plugins/claude-code/plugin.mjs +73 -13
  9. package/app/plugins/codebuddy/plugin.mjs +261 -93
  10. package/app/plugins/codex-usage/plugin.mjs +62 -5
  11. package/app/plugins/copilot/plugin.mjs +62 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +62 -5
  13. package/app/plugins/deepseek-harness/plugin.mjs +62 -5
  14. package/app/plugins/devin/plugin.mjs +62 -5
  15. package/app/plugins/grok/plugin.mjs +62 -5
  16. package/app/plugins/hermes/plugin.mjs +62 -5
  17. package/app/plugins/kimi-code/plugin.mjs +62 -5
  18. package/app/plugins/kiro-cli/plugin.mjs +62 -5
  19. package/app/plugins/omp/plugin.mjs +62 -5
  20. package/app/plugins/opencode/plugin.mjs +62 -5
  21. package/app/plugins/pi/plugin.mjs +62 -5
  22. package/app/plugins/qoder/plugin.mjs +62 -5
  23. package/app/plugins/qoder-cn/plugin.mjs +62 -5
  24. package/app/plugins/qwen-code/plugin.mjs +62 -5
  25. package/app/plugins/workbuddy/plugin.mjs +261 -93
  26. package/app/plugins/zcode/plugin.mjs +62 -5
  27. package/app/renderer-extension.js +950 -538
  28. package/app/web/assets/{abnfDiagram-XWFEHMT6-BdinLox4.js → abnfDiagram-XWFEHMT6-CnJyN70L.js} +1 -1
  29. package/app/web/assets/{architectureDiagram-CSQXQB3N-DgPBbtvP.js → architectureDiagram-CSQXQB3N-DH0ITYVE.js} +1 -1
  30. package/app/web/assets/{blockDiagram-BEDRHYPZ-B4ENdwtZ.js → blockDiagram-BEDRHYPZ-WL3ZKoKg.js} +1 -1
  31. package/app/web/assets/{c4Diagram-M2UUVUY5-DA6Owfyu.js → c4Diagram-M2UUVUY5-XwSPKj5H.js} +1 -1
  32. package/app/web/assets/{chunk-2Q5K7J3B-Dvh3qOmo.js → chunk-2Q5K7J3B-CKEzexjg.js} +1 -1
  33. package/app/web/assets/{chunk-3GCGMST5-VIkqueym.js → chunk-3GCGMST5-BdEgLpab.js} +1 -1
  34. package/app/web/assets/{chunk-5VM5RSS4-DTYof_OI.js → chunk-5VM5RSS4-DyxL5-Ts.js} +1 -1
  35. package/app/web/assets/{chunk-7U7NFRK5-Dp7s2dg0.js → chunk-7U7NFRK5-FXLb4tYa.js} +1 -1
  36. package/app/web/assets/{chunk-CNRTWJTD-TKBKxZLU.js → chunk-CNRTWJTD-DcdC1OYr.js} +1 -1
  37. package/app/web/assets/{chunk-D5HYT7QG-BRZDovSS.js → chunk-D5HYT7QG-BOz9vBX9.js} +1 -1
  38. package/app/web/assets/{chunk-EBZ3SEQC-C9USZ3tT.js → chunk-EBZ3SEQC-Dmc_Z53x.js} +2 -2
  39. package/app/web/assets/{chunk-JWPE2WC7-BrdvVNVo.js → chunk-JWPE2WC7-CrFwSwYi.js} +1 -1
  40. package/app/web/assets/{chunk-KTR4FSNJ-C7qwjGba.js → chunk-KTR4FSNJ-BY3AzFaI.js} +1 -1
  41. package/app/web/assets/{chunk-XXDRQBXY-DlSrRuwN.js → chunk-XXDRQBXY-CHgNy82n.js} +1 -1
  42. package/app/web/assets/{classDiagram-v2-KXABOMEV-BFvB4kwX.js → classDiagram-v2-KXABOMEV-ClM3-y5Z.js} +1 -1
  43. package/app/web/assets/{cose-bilkent-JH36ORCC-UyCAqNvj.js → cose-bilkent-JH36ORCC-I7nd8GgO.js} +1 -1
  44. package/app/web/assets/{cynefin-EF2NZ3EQ-CwawUbjJ.js → cynefin-EF2NZ3EQ-DzsXmyBH.js} +1 -1
  45. package/app/web/assets/{cynefinDiagram-NJNITYFG-BaWEIQJ0.js → cynefinDiagram-NJNITYFG-DLHq6igy.js} +1 -1
  46. package/app/web/assets/{dagre-KIHZ2IZ3-B7ENIjLG.js → dagre-KIHZ2IZ3-BK991Mno.js} +1 -1
  47. package/app/web/assets/{diagram-7YQZDPLS-CxRMU8xq.js → diagram-7YQZDPLS-C4qiWdQU.js} +1 -1
  48. package/app/web/assets/{diagram-QBROCOUO-qo7sxm4K.js → diagram-QBROCOUO-C_ZyBohC.js} +1 -1
  49. package/app/web/assets/{diagram-RJJCUUZO-CQiGMCMe.js → diagram-RJJCUUZO-C5Aezm94.js} +1 -1
  50. package/app/web/assets/{diagram-WERXNKYE-D0Jps1As.js → diagram-WERXNKYE-Ckc_umlF.js} +1 -1
  51. package/app/web/assets/{diagram-YHHI257C-p4AB8cqK.js → diagram-YHHI257C-BHjReoZZ.js} +1 -1
  52. package/app/web/assets/{diagram-YR4HJLHV-Bh6JKT04.js → diagram-YR4HJLHV-DVTGi_y9.js} +1 -1
  53. package/app/web/assets/{ebnfDiagram-N527522P-DRac0k4W.js → ebnfDiagram-N527522P-getuz1AR.js} +1 -1
  54. package/app/web/assets/{elk-O5DQBFGD-CWTz5SZP.js → elk-O5DQBFGD-C7mhTIuK.js} +1 -1
  55. package/app/web/assets/{erDiagram-K3K3BIDK-DE3w4BEY.js → erDiagram-K3K3BIDK-sV-HZvUV.js} +1 -1
  56. package/app/web/assets/{flowDiagram-Z6JWZHQI-NYs8bi5t.js → flowDiagram-Z6JWZHQI-D0L4wXUs.js} +1 -1
  57. package/app/web/assets/{ganttDiagram-3PRQTZWP-Bspp9btW.js → ganttDiagram-3PRQTZWP-BNt9Bjjo.js} +1 -1
  58. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-ByGW1uvv.js → gitGraphDiagram-VXDFKS5L-BABZzhHw.js} +1 -1
  59. package/app/web/assets/{grid-E2QIVN74-CegebiIw.js → grid-E2QIVN74-DLe2FQ_d.js} +1 -1
  60. package/app/web/assets/{index-DFPOGLS4.js → index-BLmkBEoq.js} +100 -100
  61. package/app/web/assets/index-Dwdnvinl.css +1 -0
  62. package/app/web/assets/{infoDiagram-EZ3ZOAHP-CexmsdZx.js → infoDiagram-EZ3ZOAHP-BKDuUqcr.js} +1 -1
  63. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BbWqKhg6.js → ishikawaDiagram-S3EKX5GW-C75EGghg.js} +1 -1
  64. package/app/web/assets/{journeyDiagram-POQNLL5X-27YlCe-1.js → journeyDiagram-POQNLL5X-q7Obruqa.js} +1 -1
  65. package/app/web/assets/{kanban-definition-BH5XI6FM-BAhOdeck.js → kanban-definition-BH5XI6FM-CzAqhFED.js} +1 -1
  66. package/app/web/assets/{mermaid.core-sGgCbv5y.js → mermaid.core-Bysx44LR.js} +4 -4
  67. package/app/web/assets/{mindmap-definition-WVAN44T4-CsMIX0Lj.js → mindmap-definition-WVAN44T4-Ds5rXTrF.js} +1 -1
  68. package/app/web/assets/{pegDiagram-D4NLKWP3-Cs3LXqn_.js → pegDiagram-D4NLKWP3-hmdERwtT.js} +1 -1
  69. package/app/web/assets/{pieDiagram-36ENHN4W-DdQsQX9I.js → pieDiagram-36ENHN4W-DfTnyG8D.js} +1 -1
  70. package/app/web/assets/{quadrantDiagram-ZQUDMS73-D1jOKqx_.js → quadrantDiagram-ZQUDMS73-CreQWjZQ.js} +1 -1
  71. package/app/web/assets/{railroadDiagram-JIZHGYPL-XulrgX5n.js → railroadDiagram-JIZHGYPL-Bhc_eO9G.js} +1 -1
  72. package/app/web/assets/{render-VIF2ZAQL-CSsGw-0I.js → render-VIF2ZAQL-BS1Zgk8K.js} +2 -2
  73. package/app/web/assets/{requirementDiagram-AXW2TVFA-CT66GXLN.js → requirementDiagram-AXW2TVFA-Dlp7d6QT.js} +1 -1
  74. package/app/web/assets/{sankeyDiagram-FBCJTAIF-CNRKebNY.js → sankeyDiagram-FBCJTAIF-DGBchL30.js} +1 -1
  75. package/app/web/assets/{sequenceDiagram-3LA2ROMG-DVl5y64e.js → sequenceDiagram-3LA2ROMG-DauFg5_R.js} +1 -1
  76. package/app/web/assets/{sizeCapture-2Q2CQKSF-Kg0XxSga.js → sizeCapture-2Q2CQKSF-DR-zy7an.js} +1 -1
  77. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DYQnfMsS.js → stateDiagram-v2-ATKHQDJO-BSRBSGUi.js} +1 -1
  78. package/app/web/assets/{swimlanes-YQL5WMAO-Chqt7pxD.js → swimlanes-YQL5WMAO-BwzOr5Dv.js} +1 -1
  79. package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +8 -0
  80. package/app/web/assets/{timeline-definition-7Z437IG3-aHFxjIT6.js → timeline-definition-7Z437IG3-BoZ-mNKc.js} +1 -1
  81. package/app/web/assets/{usecaseDiagram-RDK6N6HP-DsC5tFe4.js → usecaseDiagram-RDK6N6HP-DikhgH2m.js} +1 -1
  82. package/app/web/assets/{vennDiagram-SHRQU5PJ-C65oZxFn.js → vennDiagram-SHRQU5PJ-DY_oIxwl.js} +1 -1
  83. package/app/web/assets/{wardleyDiagram-F3OXNVQS-HTkq7DT0.js → wardleyDiagram-F3OXNVQS-DrRIiB_M.js} +1 -1
  84. package/app/web/assets/{xychartDiagram-GDYJKCDI-p1LpQ9MH.js → xychartDiagram-GDYJKCDI-CzSPgHV7.js} +1 -1
  85. package/app/web/codexhost-settings.js +126 -58
  86. package/app/web/index.html +2 -2
  87. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  88. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  89. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  90. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
  91. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  92. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  93. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  94. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +12 -12
  95. package/app/web/plugins/deepseek-ai__dsh-client-ui-commands/client.js +1 -1
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +18 -18
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +7 -7
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +2 -2
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +64 -66
  104. package/app/web/sw.js +230 -16
  105. package/app/web-modules/node_modules/@deepseek-ai/dsh-client-modules/index.js +7 -7
  106. package/app/web-modules/server.mjs +1482 -325
  107. package/bin/codexhost.exe +0 -0
  108. package/libexec/codexhost-node-repl.exe +0 -0
  109. package/libexec/codexhost-screenshot.exe +0 -0
  110. package/libexec/codexhost-shell.exe +0 -0
  111. package/libexec/codexhost-shim.exe +0 -0
  112. package/libexec/codexhost-updater.exe +0 -0
  113. package/package.json +1 -1
  114. package/app/web/assets/index-BbmB5VLj.css +0 -1
  115. package/app/web/assets/swimlanesDiagram-UCCPES4V-BfREktNP.js +0 -8
@@ -16659,8 +16659,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16659
16659
  bySchema.set(entry.schema, entry);
16660
16660
  }
16661
16661
  const rewrites = /* @__PURE__ */ new Map();
16662
- for (const record17 of pendingRecords.get(ctx) ?? []) {
16663
- const seen = ctx.seen.get(record17);
16662
+ for (const record19 of pendingRecords.get(ctx) ?? []) {
16663
+ const seen = ctx.seen.get(record19);
16664
16664
  const names = (seen?.def ?? seen?.schema)?.propertyNames;
16665
16665
  if (!names || names === true || rewrites.has(names))
16666
16666
  continue;
@@ -19965,10 +19965,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19965
19965
 
19966
19966
  // ../shared-contracts/dist/json-value.js
19967
19967
  function rejectExplicitUndefined(keys) {
19968
- return (value, context2) => {
19968
+ return (value, context) => {
19969
19969
  for (const key2 of keys) {
19970
19970
  if (Object.hasOwn(value, key2) && value[key2] === void 0) {
19971
- context2.addIssue({
19971
+ context.addIssue({
19972
19972
  code: "custom",
19973
19973
  path: [key2],
19974
19974
  message: "Explicit undefined is not valid JSON"
@@ -20092,11 +20092,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20092
20092
  var harnessPermissionModeCatalogSchema = external_exports.object({
20093
20093
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
20094
20094
  defaultModeId: harnessPermissionModeIdSchema
20095
- }).strict().superRefine((catalog, context2) => {
20095
+ }).strict().superRefine((catalog, context) => {
20096
20096
  const ids = /* @__PURE__ */ new Set();
20097
20097
  for (const [index, mode] of catalog.modes.entries()) {
20098
20098
  if (ids.has(mode.id)) {
20099
- context2.addIssue({
20099
+ context.addIssue({
20100
20100
  code: "custom",
20101
20101
  message: "Permission Mode IDs must be unique",
20102
20102
  path: ["modes", index, "id"]
@@ -20105,7 +20105,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20105
20105
  ids.add(mode.id);
20106
20106
  }
20107
20107
  if (!ids.has(catalog.defaultModeId)) {
20108
- context2.addIssue({
20108
+ context.addIssue({
20109
20109
  code: "custom",
20110
20110
  message: "Default Permission Mode must exist in the catalog",
20111
20111
  path: ["defaultModeId"]
@@ -20213,49 +20213,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20213
20213
  latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
20214
20214
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
20215
20215
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
20216
- }).strict().superRefine((usage, context2) => {
20216
+ }).strict().superRefine((usage, context) => {
20217
20217
  if (Object.keys(usage).length === 0) {
20218
- context2.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
20218
+ context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
20219
20219
  }
20220
20220
  const hasContextUsed = usage.contextUsedTokens !== void 0;
20221
20221
  const hasContextWindow = usage.contextWindowTokens !== void 0;
20222
20222
  if (hasContextUsed !== hasContextWindow) {
20223
- context2.addIssue({
20223
+ context.addIssue({
20224
20224
  code: "custom",
20225
20225
  message: "Thread Usage context fields must be provided together",
20226
20226
  path: [hasContextUsed ? "contextWindowTokens" : "contextUsedTokens"]
20227
20227
  });
20228
20228
  }
20229
20229
  if (usage.contextWindowTokens === 0) {
20230
- context2.addIssue({
20230
+ context.addIssue({
20231
20231
  code: "custom",
20232
20232
  message: "Thread Usage contextWindowTokens must be greater than zero",
20233
20233
  path: ["contextWindowTokens"]
20234
20234
  });
20235
20235
  }
20236
20236
  if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
20237
- context2.addIssue({
20237
+ context.addIssue({
20238
20238
  code: "custom",
20239
20239
  message: "Thread Usage costSource must be provided with totalCostUsd",
20240
20240
  path: ["costSource"]
20241
20241
  });
20242
20242
  }
20243
20243
  if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
20244
- context2.addIssue({
20244
+ context.addIssue({
20245
20245
  code: "custom",
20246
20246
  message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
20247
20247
  path: ["unpricedModels"]
20248
20248
  });
20249
20249
  }
20250
20250
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
20251
- context2.addIssue({
20251
+ context.addIssue({
20252
20252
  code: "custom",
20253
20253
  message: "Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent",
20254
20254
  path: ["planFiveHourResetsAtUnix"]
20255
20255
  });
20256
20256
  }
20257
20257
  if (usage.planSevenDayResetsAtUnix !== void 0 && usage.planSevenDayUsedPercent === void 0) {
20258
- context2.addIssue({
20258
+ context.addIssue({
20259
20259
  code: "custom",
20260
20260
  message: "Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent",
20261
20261
  path: ["planSevenDayResetsAtUnix"]
@@ -20376,11 +20376,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20376
20376
  return void 0;
20377
20377
  return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
20378
20378
  }
20379
- var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context2) => {
20379
+ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
20380
20380
  const ids = /* @__PURE__ */ new Set();
20381
20381
  for (const [index, option] of options.entries()) {
20382
20382
  if (ids.has(option.id)) {
20383
- context2.addIssue({
20383
+ context.addIssue({
20384
20384
  code: "custom",
20385
20385
  message: "Thinking option IDs must be unique",
20386
20386
  path: [index, "id"]
@@ -20404,12 +20404,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20404
20404
  * validated by the Adapter after selecting the Model.
20405
20405
  */
20406
20406
  thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
20407
- }).strict().superRefine((catalog, context2) => {
20407
+ }).strict().superRefine((catalog, context) => {
20408
20408
  const refs = [];
20409
20409
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
20410
20410
  for (const [index, model2] of catalog.models.entries()) {
20411
20411
  if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
20412
- context2.addIssue({
20412
+ context.addIssue({
20413
20413
  code: "custom",
20414
20414
  message: "Model Catalog refs must be unique",
20415
20415
  path: ["models", index, "ref", "id"]
@@ -20418,7 +20418,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20418
20418
  refs.push(model2.ref);
20419
20419
  if (model2.fastModel) {
20420
20420
  if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
20421
- context2.addIssue({
20421
+ context.addIssue({
20422
20422
  code: "custom",
20423
20423
  message: "Fast Model refs must be distinct and unique",
20424
20424
  path: ["models", index, "fastModel"]
@@ -20429,7 +20429,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20429
20429
  const supportedThinkingIds = /* @__PURE__ */ new Set();
20430
20430
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
20431
20431
  if (supportedThinkingIds.has(optionId)) {
20432
- context2.addIssue({
20432
+ context.addIssue({
20433
20433
  code: "custom",
20434
20434
  message: "Supported Thinking option IDs must be unique per Model",
20435
20435
  path: ["models", index, "supportedThinkingOptionIds", optionIndex]
@@ -20437,7 +20437,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20437
20437
  }
20438
20438
  supportedThinkingIds.add(optionId);
20439
20439
  if (!thinkingIds.has(optionId)) {
20440
- context2.addIssue({
20440
+ context.addIssue({
20441
20441
  code: "custom",
20442
20442
  message: "Supported Thinking option must exist in the catalog",
20443
20443
  path: ["models", index, "supportedThinkingOptionIds", optionIndex]
@@ -20446,14 +20446,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20446
20446
  }
20447
20447
  }
20448
20448
  if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
20449
- context2.addIssue({
20449
+ context.addIssue({
20450
20450
  code: "custom",
20451
20451
  message: "Default Model must exist in the Model Catalog",
20452
20452
  path: ["defaultModel", "id"]
20453
20453
  });
20454
20454
  }
20455
20455
  if (catalog.defaultThinkingOptionId && !thinkingIds.has(catalog.defaultThinkingOptionId)) {
20456
- context2.addIssue({
20456
+ context.addIssue({
20457
20457
  code: "custom",
20458
20458
  message: "Default Thinking option must exist in the catalog",
20459
20459
  path: ["defaultThinkingOptionId"]
@@ -20501,9 +20501,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20501
20501
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
20502
20502
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
20503
20503
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
20504
- }).strict().superRefine((state, context2) => {
20504
+ }).strict().superRefine((state, context) => {
20505
20505
  if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
20506
- context2.addIssue({
20506
+ context.addIssue({
20507
20507
  code: "custom",
20508
20508
  message: "Effective Thinking option must be currently available",
20509
20509
  path: ["effectiveThinkingOptionId"]
@@ -20520,10 +20520,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20520
20520
  permissionModes: harnessPermissionModeCatalogSchema.optional(),
20521
20521
  capabilities: harnessSessionCapabilitiesSchema,
20522
20522
  webUi: harnessWebUiCapabilitySchema.optional()
20523
- }).strict().superRefine((inspection, context2) => {
20523
+ }).strict().superRefine((inspection, context) => {
20524
20524
  const selectable = inspection.capabilities.configuration.selectPermissionMode;
20525
20525
  if (selectable !== Boolean(inspection.permissionModes)) {
20526
- context2.addIssue({
20526
+ context.addIssue({
20527
20527
  code: "custom",
20528
20528
  message: "Permission Mode catalog and capability must agree",
20529
20529
  path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
@@ -20595,11 +20595,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20595
20595
  ]);
20596
20596
  var threadOwnershipListParamsSchema = external_exports.object({
20597
20597
  threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
20598
- }).strict().superRefine(({ threadIds }, context2) => {
20598
+ }).strict().superRefine(({ threadIds }, context) => {
20599
20599
  const seen = /* @__PURE__ */ new Set();
20600
20600
  for (const [index, threadId] of threadIds.entries()) {
20601
20601
  if (seen.has(threadId)) {
20602
- context2.addIssue({
20602
+ context.addIssue({
20603
20603
  code: "custom",
20604
20604
  message: "Thread ownership-list IDs must be unique",
20605
20605
  path: ["threadIds", index]
@@ -20623,11 +20623,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20623
20623
  ]);
20624
20624
  var threadOwnershipListResultSchema = external_exports.object({
20625
20625
  threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
20626
- }).strict().superRefine(({ threads }, context2) => {
20626
+ }).strict().superRefine(({ threads }, context) => {
20627
20627
  const seen = /* @__PURE__ */ new Set();
20628
20628
  for (const [index, thread3] of threads.entries()) {
20629
20629
  if (seen.has(thread3.threadId)) {
20630
- context2.addIssue({
20630
+ context.addIssue({
20631
20631
  code: "custom",
20632
20632
  message: "Thread ownership-list results must be unique",
20633
20633
  path: ["threads", index, "threadId"]
@@ -20645,11 +20645,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20645
20645
  var THREAD_STEERING_CONTEXT_PARAM = "codexhost_external_steering";
20646
20646
  var threadSteeringContextSchema = external_exports.object({
20647
20647
  kind: external_exports.literal("application"),
20648
- value: external_exports.string().transform((text2, context2) => {
20648
+ value: external_exports.string().transform((text2, context) => {
20649
20649
  try {
20650
20650
  return JSON.parse(text2);
20651
20651
  } catch {
20652
- context2.addIssue({ code: "custom", message: "Invalid steering context JSON" });
20652
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
20653
20653
  return external_exports.NEVER;
20654
20654
  }
20655
20655
  }).pipe(external_exports.object({
@@ -20657,7 +20657,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20657
20657
  clientUserMessageId: external_exports.string().min(1),
20658
20658
  delivery: external_exports.enum(["newTurn", "activeTurn"])
20659
20659
  }).strict())
20660
- }).strict().transform((context2) => context2.value);
20660
+ }).strict().transform((context) => context.value);
20661
20661
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
20662
20662
  var threadSteeringInspectResultSchema = external_exports.object({
20663
20663
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -21475,6 +21475,45 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21475
21475
  // ../shared-contracts/dist/client-channel.js
21476
21476
  var CLIENT_CHANNEL_VERSION = 1;
21477
21477
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
21478
+ var THREAD_SECTION_CAPABILITY = "threadSectionsV1";
21479
+ var threadSectionName = external_exports.string().trim().min(1);
21480
+ var threadSectionId = external_exports.string().min(1);
21481
+ var threadSectionAppearance = external_exports.object({
21482
+ icon: external_exports.string().nullable(),
21483
+ color: external_exports.string().nullable()
21484
+ });
21485
+ var clientThreadSectionAppearanceSchema = threadSectionAppearance.nullable();
21486
+ var CLIENT_THREAD_SECTION_MUTATIONS = {
21487
+ create: {
21488
+ method: "codexhost/thread/sections/create",
21489
+ params: external_exports.object({ name: threadSectionName }).strict()
21490
+ },
21491
+ update: {
21492
+ method: "codexhost/thread/sections/update",
21493
+ params: external_exports.object({
21494
+ sectionId: threadSectionId,
21495
+ name: threadSectionName,
21496
+ appearance: threadSectionAppearance.strict().nullable().optional()
21497
+ }).strict()
21498
+ },
21499
+ delete: {
21500
+ method: "codexhost/thread/sections/delete",
21501
+ params: external_exports.object({ sectionId: threadSectionId }).strict()
21502
+ }
21503
+ };
21504
+ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnion("status", [
21505
+ external_exports.object({ status: external_exports.literal("unknown") }),
21506
+ external_exports.object({
21507
+ status: external_exports.literal("confirmed"),
21508
+ sectionId: threadSectionId,
21509
+ section: external_exports.object({
21510
+ id: threadSectionId,
21511
+ name: external_exports.string().min(1),
21512
+ appearance: clientThreadSectionAppearanceSchema
21513
+ }).nullable(),
21514
+ syncPending: external_exports.boolean()
21515
+ })
21516
+ ]);
21478
21517
  var CLIENT_CHANNEL_METHODS = [
21479
21518
  "codexhost/skills/list",
21480
21519
  "codexhost/voice/status",
@@ -21485,6 +21524,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21485
21524
  "codexhost/harness/preferences/get",
21486
21525
  "codexhost/harness/preferences/patch",
21487
21526
  "experimentalFeature/list",
21527
+ "collaborationMode/list",
21528
+ "codexhost/thread/collaboration-mode/select",
21488
21529
  "thread/list",
21489
21530
  "thread/metadata/update",
21490
21531
  "codexhost/thread/catalog/read",
@@ -21521,6 +21562,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21521
21562
  "codexhost/thread/pins/list",
21522
21563
  "codexhost/thread/sections/list",
21523
21564
  "codexhost/thread/sections/move",
21565
+ CLIENT_THREAD_SECTION_MUTATIONS.create.method,
21566
+ CLIENT_THREAD_SECTION_MUTATIONS.update.method,
21567
+ CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
21524
21568
  "codexhost/thread/pins/set",
21525
21569
  "codexhost/harness/plugins/list",
21526
21570
  "codexhost/harness/inspect",
@@ -21571,16 +21615,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21571
21615
  "codexhost/sessions/loaded/list"
21572
21616
  ];
21573
21617
  var clientThreadSectionsSchema = external_exports.object({
21618
+ [THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
21619
+ complete: external_exports.literal(false).optional(),
21574
21620
  sections: external_exports.array(external_exports.object({
21575
21621
  id: external_exports.string().min(1),
21576
21622
  name: external_exports.string().min(1),
21623
+ appearance: clientThreadSectionAppearanceSchema.optional(),
21577
21624
  threads: external_exports.array(jsonObjectSchema)
21578
- }).strict())
21579
- }).strict();
21625
+ }))
21626
+ });
21580
21627
  var clientThreadSectionMoveSchema = external_exports.object({
21581
21628
  threadId: external_exports.string().min(1).max(1024),
21582
- sectionId: external_exports.string().min(1).max(1024).nullable()
21583
- }).strict();
21629
+ sectionId: external_exports.string().min(1).max(1024).nullable(),
21630
+ beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
21631
+ expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
21632
+ }).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
21584
21633
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
21585
21634
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
21586
21635
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -21627,6 +21676,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21627
21676
  harnessId: external_exports.string().min(1)
21628
21677
  }),
21629
21678
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
21679
+ external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
21630
21680
  external_exports.object({
21631
21681
  type: external_exports.literal("preferences-changed"),
21632
21682
  cursor: clientChannelCursorSchema,
@@ -21768,6 +21818,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21768
21818
  nextCursor: external_exports.string().nullable()
21769
21819
  }),
21770
21820
  configuration: external_exports.object({
21821
+ codexCollaborationMode: external_exports.enum(["plan", "default"]).optional(),
21771
21822
  /** Native Codex model names are not external Harness transport refs. */
21772
21823
  native: external_exports.object({
21773
21824
  model: external_exports.string().min(1).max(1024).optional(),
@@ -21793,7 +21844,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21793
21844
  startedAt: external_exports.number(),
21794
21845
  epoch: external_exports.string().uuid(),
21795
21846
  capabilities: external_exports.object({
21796
- peerDelegation: external_exports.literal(1).optional()
21847
+ peerDelegation: external_exports.literal(1).optional(),
21848
+ threadReferenceContext: external_exports.literal(1).optional()
21797
21849
  }).optional()
21798
21850
  });
21799
21851
  var clientChannelResponseSchema = external_exports.object({
@@ -22055,7 +22107,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22055
22107
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
22056
22108
  var REMOTE_THREAD_READ_TIMEOUT_MS = 35e3;
22057
22109
  var DELEGATION_READ_METHOD = "codexhost/thread/delegation-read";
22110
+ var THREAD_REFERENCE_CONTEXT_CAPABILITY_METHOD = "codexhost/thread/reference-context/capability";
22058
22111
  var THREAD_REFERENCE_SOURCE_HOST_PARAM = "codexhostSourceHostId";
22112
+ function isDesktopSshHostId(hostId2) {
22113
+ return typeof hostId2 === "string" && hostId2.length <= 1024 && /^remote-ssh(?:-[^:\x00-\x20\x7f]+)?:[^\x00-\x20\x7f]+$/u.test(hostId2);
22114
+ }
22059
22115
  var delegationReadParamsSchema = external_exports.strictObject({
22060
22116
  threadId: external_exports.string().min(1).max(1024),
22061
22117
  view: external_exports.enum(["result", "messages"]),
@@ -22537,6 +22593,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22537
22593
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
22538
22594
  permissionModeId: harnessPermissionModeIdSchema.optional()
22539
22595
  }).refine((value) => Boolean(value.model || value.thinkingOptionId || value.permissionModeId), "A default configuration must contain a preference");
22596
+ var projectHarnessSelectionSchema = external_exports.discriminatedUnion("mode", [
22597
+ external_exports.strictObject({ mode: external_exports.literal("global") }),
22598
+ external_exports.strictObject({ mode: external_exports.literal("last") }),
22599
+ external_exports.strictObject({ mode: external_exports.literal("manual"), harnessId: harnessIdSchema })
22600
+ ]);
22540
22601
  var newThreadDefaultsSchema = external_exports.strictObject({
22541
22602
  lastHarness: harnessIdSchema.optional(),
22542
22603
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
@@ -23363,11 +23424,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23363
23424
  * `live` once their Session's live catalog has loaded.
23364
23425
  */
23365
23426
  source: external_exports.enum(["live", "static"]).optional()
23366
- }).strict().superRefine((catalog, context2) => {
23427
+ }).strict().superRefine((catalog, context) => {
23367
23428
  const ids = /* @__PURE__ */ new Set();
23368
23429
  for (const [index, command] of catalog.commands.entries()) {
23369
23430
  if (ids.has(command.id)) {
23370
- context2.addIssue({
23431
+ context.addIssue({
23371
23432
  code: "custom",
23372
23433
  message: "Harness command IDs must be unique",
23373
23434
  path: ["commands", index, "id"]
@@ -23504,9 +23565,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23504
23565
  npmDownload: npmDownloadProgressSchema.optional(),
23505
23566
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
23506
23567
  serviceStopOutput: external_exports.string().optional()
23507
- }).superRefine((status, context2) => {
23568
+ }).superRefine((status, context) => {
23508
23569
  if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
23509
- context2.addIssue({
23570
+ context.addIssue({
23510
23571
  code: "custom",
23511
23572
  path: ["downloadedBytes"],
23512
23573
  message: "downloadedBytes must not exceed totalBytes"
@@ -23638,10 +23699,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23638
23699
  var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
23639
23700
  function desktopImageAttachmentPaths(text2) {
23640
23701
  const end = text2.search(REQUEST_HEADING);
23641
- const context2 = end < 0 ? text2 : text2.slice(0, end);
23642
- if (!ATTACHED_FILES_HEADING.test(context2))
23702
+ const context = end < 0 ? text2 : text2.slice(0, end);
23703
+ if (!ATTACHED_FILES_HEADING.test(context))
23643
23704
  return [];
23644
- return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
23705
+ return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
23645
23706
  }
23646
23707
 
23647
23708
  // ../shared-contracts/dist/thread-watch-notice.js
@@ -24975,7 +25036,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24975
25036
  let disposed = false;
24976
25037
  let inFlight = false;
24977
25038
  let revision = 0;
24978
- let context2 = null;
25039
+ let context = null;
24979
25040
  let card = null;
24980
25041
  let cardKey = null;
24981
25042
  const unsupported = /* @__PURE__ */ new WeakSet();
@@ -24993,12 +25054,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24993
25054
  const refresh = async () => {
24994
25055
  if (disposed) return;
24995
25056
  const next = readContext();
24996
- if (!same(context2, next)) {
25057
+ if (!same(context, next)) {
24997
25058
  clear();
24998
- context2 = next;
25059
+ context = next;
24999
25060
  revision++;
25000
25061
  }
25001
- const current = context2;
25062
+ const current = context;
25002
25063
  if (!current || inFlight || unsupported.has(current.route)) return;
25003
25064
  const startedRevision = revision;
25004
25065
  inFlight = true;
@@ -25043,7 +25104,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25043
25104
  );
25044
25105
  threadQuestionRespondResultSchema.parse(raw2);
25045
25106
  drafts.delete(key2);
25046
- if (same(current, context2)) {
25107
+ if (same(current, context)) {
25047
25108
  revision++;
25048
25109
  if (cardKey === key2) clear(false);
25049
25110
  }
@@ -25053,7 +25114,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25053
25114
  current.composer.before(card.root);
25054
25115
  } catch (error62) {
25055
25116
  if (isUnsupportedMethod(error62, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
25056
- if (revision === startedRevision && same(current, context2)) clear();
25117
+ if (revision === startedRevision && same(current, context)) clear();
25057
25118
  } finally {
25058
25119
  inFlight = false;
25059
25120
  }
@@ -25065,7 +25126,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25065
25126
  return {
25066
25127
  refresh,
25067
25128
  refreshContext() {
25068
- if (!same(context2, readContext()) || card && !card.root.isConnected) void refresh();
25129
+ if (!same(context, readContext()) || card && !card.root.isConnected) void refresh();
25069
25130
  },
25070
25131
  dispose() {
25071
25132
  disposed = true;
@@ -25157,6 +25218,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25157
25218
  return stack.length > 0 ? exhausted() : [];
25158
25219
  }
25159
25220
 
25221
+ // ../desktop-control/dist/renderer-app-scope.js
25222
+ var record5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25223
+ function readRendererAppScope(root) {
25224
+ const scopes = /* @__PURE__ */ new Map();
25225
+ const seen = /* @__PURE__ */ new Set();
25226
+ for (const main of root.querySelectorAll("main")) {
25227
+ const keys = Object.getOwnPropertyNames(main).filter((key3) => key3.startsWith("__reactFiber$"));
25228
+ const key2 = keys[0];
25229
+ if (keys.length !== 1 || !key2)
25230
+ continue;
25231
+ for (const fiber of committedReactAncestors(Reflect.get(main, key2))) {
25232
+ if (seen.has(fiber))
25233
+ break;
25234
+ seen.add(fiber);
25235
+ let hook = fiber.memoizedState;
25236
+ for (let n = 0; record5(hook) && "next" in hook && n < 150; n++, hook = hook.next) {
25237
+ const handle = record5(hook.memoizedState) ? hook.memoizedState.current : null;
25238
+ if (!record5(handle) || !record5(handle.node) || handle.node.parent != null || !("chain" in handle) || !("scope" in handle) || typeof handle.get !== "function" || typeof handle.set !== "function" || typeof handle.watch !== "function" || !(handle.node.familyBindings instanceof Map))
25239
+ continue;
25240
+ scopes.set(handle.node, handle);
25241
+ }
25242
+ }
25243
+ }
25244
+ return scopes.size === 1 ? scopes.values().next().value ?? null : null;
25245
+ }
25246
+
25160
25247
  // ../desktop-control/dist/renderer-native-schedule-sidebar.js
25161
25248
  var NATIVE_SCHEDULE_SIDEBAR_ROW_SELECTOR = 'aside [data-sidebar-cycle-item][role="button"][aria-labelledby]';
25162
25249
  function readNativeScheduleSidebarThread(element) {
@@ -25191,7 +25278,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25191
25278
  }
25192
25279
 
25193
25280
  // ../desktop-control/dist/renderer-scoped-draft-model.js
25194
- function record5(value) {
25281
+ function record6(value) {
25195
25282
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
25196
25283
  }
25197
25284
  function isDraftId(value) {
@@ -25206,31 +25293,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25206
25293
  if (!draftId || ids.length < 2 || ids.some((id2) => id2 !== draftId))
25207
25294
  return [];
25208
25295
  return [...new Set(row)].flatMap((value) => {
25209
- const result = record5(value);
25210
- const draft = record5(result?.draftSettings);
25296
+ const result = record6(value);
25297
+ const draft = record6(result?.draftSettings);
25211
25298
  const update = result?.updateDraftSettings;
25212
25299
  return result?.isNewThreadDraft === true && draft && row.includes(draft) && typeof update === "function" && repeated(row, update) ? [{ draftId, draft, update }] : [];
25213
25300
  });
25214
25301
  }
25215
25302
  function modelContexts(row) {
25216
25303
  return [...new Set(row)].flatMap((value) => {
25217
- const result = record5(value);
25304
+ const result = record6(value);
25218
25305
  const callback = result?.setModelAndReasoningEffort;
25219
25306
  const usesAccountPreferences = result?.usesAccountPreferences;
25220
- if (typeof callback !== "function" || !repeated(row, callback) || typeof usesAccountPreferences !== "boolean" || !row.some((context2) => context2 !== value && record5(context2)?.usesAccountPreferences === usesAccountPreferences))
25307
+ if (typeof callback !== "function" || !repeated(row, callback) || typeof usesAccountPreferences !== "boolean" || !row.some((context) => context !== value && record6(context)?.usesAccountPreferences === usesAccountPreferences))
25221
25308
  return [];
25222
- return [{ row, usesAccountPreferences, settings: record5(result?.modelSettings) }];
25309
+ return [{ row, usesAccountPreferences, settings: record6(result?.modelSettings) }];
25223
25310
  });
25224
25311
  }
25225
25312
  function collaborationMode(value) {
25226
- const mode = record5(value);
25227
- const settings = record5(mode?.settings);
25313
+ const mode = record6(value);
25314
+ const settings = record6(mode?.settings);
25228
25315
  return typeof mode?.mode === "string" && settings && typeof settings.model === "string" ? mode : null;
25229
25316
  }
25230
25317
  function activeModes(row) {
25231
25318
  const modes = /* @__PURE__ */ new Set();
25232
25319
  for (const value of row) {
25233
- const mode = collaborationMode(record5(value)?.activeMode);
25320
+ const mode = collaborationMode(record6(value)?.activeMode);
25234
25321
  if (mode && row.includes(mode) && row.includes(mode.settings))
25235
25322
  modes.add(mode);
25236
25323
  }
@@ -25240,7 +25327,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25240
25327
  const modes = /* @__PURE__ */ new Set();
25241
25328
  for (const row of rows) {
25242
25329
  if (!row.includes(draftId) || row.some((value) => isDraftId(value) && value !== draftId) || !row.some((value) => {
25243
- const result = record5(value);
25330
+ const result = record6(value);
25244
25331
  return typeof result?.handleSubmitLocal === "function" && typeof result.handleNewWorktreeConversation === "function";
25245
25332
  }))
25246
25333
  continue;
@@ -25267,7 +25354,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25267
25354
  const submitModes = /* @__PURE__ */ new Set();
25268
25355
  const owners = [];
25269
25356
  for (const ancestor of committedReactAncestors(fiber)) {
25270
- const data = record5(record5(ancestor.updateQueue)?.memoCache)?.data;
25357
+ const data = record6(record6(ancestor.updateQueue)?.memoCache)?.data;
25271
25358
  if (!Array.isArray(data))
25272
25359
  continue;
25273
25360
  const rows = data.filter(Array.isArray);
@@ -25379,16 +25466,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25379
25466
  }
25380
25467
 
25381
25468
  // ../desktop-control/dist/renderer-native-schedule-form.js
25382
- var record6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25469
+ var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25383
25470
  function ancestors(element) {
25384
- if (!record6(element))
25471
+ if (!record7(element))
25385
25472
  return [];
25386
25473
  const key2 = Object.getOwnPropertyNames(element).find((name) => name.startsWith("__reactFiber$"));
25387
25474
  return committedReactAncestors(key2 ? Object.getOwnPropertyDescriptor(element, key2)?.value : null);
25388
25475
  }
25389
25476
  function readNativeScheduleForm(form) {
25390
25477
  const candidates = ancestors(form).flatMap(({ memoizedProps: props2 }) => {
25391
- if (!record6(props2) || !record6(props2.setup) || props2.setup.triggerMode !== "create" || !record6(props2.draft) || !record6(props2.draft.scheduleConfig) || typeof props2.draft.scheduleDirty !== "boolean" || typeof props2.draft.prompt !== "string" || props2.draft.id != null || !["heartbeat", "cron"].includes(String(props2.draft.kind)) || !["local", "cloud"].includes(String(props2.executionLocation)) || typeof props2.onChange !== "function" || typeof props2.onSubmit !== "function" || typeof props2.isSaving !== "boolean" || props2.draft.model !== null && typeof props2.draft.model !== "string" || props2.draft.reasoningEffort !== null && typeof props2.draft.reasoningEffort !== "string")
25478
+ if (!record7(props2) || !record7(props2.setup) || props2.setup.triggerMode !== "create" || !record7(props2.draft) || !record7(props2.draft.scheduleConfig) || typeof props2.draft.scheduleDirty !== "boolean" || typeof props2.draft.prompt !== "string" || props2.draft.id != null || !["heartbeat", "cron"].includes(String(props2.draft.kind)) || !["local", "cloud"].includes(String(props2.executionLocation)) || typeof props2.onChange !== "function" || typeof props2.onSubmit !== "function" || typeof props2.isSaving !== "boolean" || props2.draft.model !== null && typeof props2.draft.model !== "string" || props2.draft.reasoningEffort !== null && typeof props2.draft.reasoningEffort !== "string")
25392
25479
  return [];
25393
25480
  return [props2];
25394
25481
  });
@@ -25397,7 +25484,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25397
25484
  return null;
25398
25485
  const draft = props.draft;
25399
25486
  const change = props.onChange;
25400
- const supportsExternal = props.executionLocation === "local" && draft.kind === "heartbeat" && draft.cloudTeam == null && (!record6(props.creation) || props.creation.type === "task") && (!record6(draft.eventTrigger) || draft.eventTrigger.selected !== true) && (!Array.isArray(draft.webhookTriggers) || draft.webhookTriggers.length === 0);
25487
+ const supportsExternal = props.executionLocation === "local" && draft.kind === "heartbeat" && draft.cloudTeam == null && (!record7(props.creation) || props.creation.type === "task") && (!record7(draft.eventTrigger) || draft.eventTrigger.selected !== true) && (!Array.isArray(draft.webhookTriggers) || draft.webhookTriggers.length === 0);
25401
25488
  return {
25402
25489
  selection: {
25403
25490
  model: draft.model,
@@ -25428,11 +25515,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25428
25515
  const node2 = fiber.stateNode;
25429
25516
  if (node2 === form)
25430
25517
  break;
25431
- if (record6(node2) && node2.nodeType === 1 && typeof node2.hidden === "boolean" && record6(node2.style) && ["getPropertyValue", "getPropertyPriority", "setProperty"].every((method) => typeof node2.style[method] === "function") && form.contains(node2))
25518
+ if (record7(node2) && node2.nodeType === 1 && typeof node2.hidden === "boolean" && record7(node2.style) && ["getPropertyValue", "getPropertyPriority", "setProperty"].every((method) => typeof node2.style[method] === "function") && form.contains(node2))
25432
25519
  host = node2;
25433
25520
  const props = fiber.memoizedProps;
25434
- const label = record6(props) && record6(props.label) ? props.label.props : null;
25435
- if (record6(label) && ["inbox.automations.model.label", "automations.configuration.effort"].includes(String(label.id))) {
25521
+ const label = record7(props) && record7(props.label) ? props.label.props : null;
25522
+ if (record7(label) && ["inbox.automations.model.label", "automations.configuration.effort"].includes(String(label.id))) {
25436
25523
  if (host)
25437
25524
  rows.add(host);
25438
25525
  break;
@@ -25444,14 +25531,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25444
25531
 
25445
25532
  // ../desktop-control/dist/renderer-host-discovery.js
25446
25533
  function requestManagerFromHookState(value, hostId2) {
25447
- const record17 = (candidate) => typeof candidate === "object" && candidate !== null;
25534
+ const record19 = (candidate) => typeof candidate === "object" && candidate !== null;
25448
25535
  const manager = (candidate) => {
25449
- if (!record17(candidate) || !record17(candidate.requestClient) || !record17(candidate.prewarmedThreadManager))
25536
+ if (!record19(candidate) || !record19(candidate.requestClient) || !record19(candidate.prewarmedThreadManager))
25450
25537
  return null;
25451
25538
  const bridge = candidate.requestClient;
25452
25539
  return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
25453
25540
  };
25454
- if (!record17(value))
25541
+ if (!record19(value))
25455
25542
  return null;
25456
25543
  const direct = manager(value) ?? manager(value.manager);
25457
25544
  if (direct)
@@ -25514,20 +25601,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25514
25601
 
25515
25602
  // ../desktop-control/dist/renderer-host-rpc-discovery.js
25516
25603
  function findRendererHostRpcFamily(store) {
25517
- const record17 = (value) => typeof value === "object" && value !== null;
25604
+ const record19 = (value) => typeof value === "object" && value !== null;
25518
25605
  const families = /* @__PURE__ */ new Set();
25519
25606
  for (const [definition, members2] of store.familyBindings) {
25520
- if (!record17(definition) || definition.kind !== "signal-family")
25607
+ if (!record19(definition) || definition.kind !== "signal-family")
25521
25608
  continue;
25522
- if (!record17(members2) || typeof members2.get !== "function")
25609
+ if (!record19(members2) || typeof members2.get !== "function")
25523
25610
  continue;
25524
25611
  for (const [hostId2, member] of members2) {
25525
25612
  if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:])/u.test(hostId2))
25526
25613
  continue;
25527
- if (!record17(member))
25614
+ if (!record19(member))
25528
25615
  continue;
25529
25616
  const signal = member.value;
25530
- if (!record17(signal) || typeof signal.get !== "function")
25617
+ if (!record19(signal) || typeof signal.get !== "function")
25531
25618
  continue;
25532
25619
  let value;
25533
25620
  try {
@@ -25535,7 +25622,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25535
25622
  } catch {
25536
25623
  continue;
25537
25624
  }
25538
- if (record17(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record17(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
25625
+ if (record19(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record19(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
25539
25626
  families.add(members2);
25540
25627
  break;
25541
25628
  }
@@ -25548,9 +25635,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25548
25635
  function resolveRendererHostRpc(discovery, hostId2) {
25549
25636
  if (hostId2 === "durable")
25550
25637
  return null;
25551
- const record17 = (value2) => typeof value2 === "object" && value2 !== null;
25638
+ const record19 = (value2) => typeof value2 === "object" && value2 !== null;
25552
25639
  const signal = discovery.family.get(hostId2)?.value;
25553
- if (!record17(signal) || typeof signal.get !== "function")
25640
+ if (!record19(signal) || typeof signal.get !== "function")
25554
25641
  return null;
25555
25642
  let value;
25556
25643
  try {
@@ -25558,43 +25645,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25558
25645
  } catch {
25559
25646
  return null;
25560
25647
  }
25561
- if (!record17(value) || value.status !== "ready" || !record17(value.client) || value.client.hostId !== hostId2)
25648
+ if (!record19(value) || value.status !== "ready" || !record19(value.client) || value.client.hostId !== hostId2)
25562
25649
  return null;
25563
25650
  const rpc = value.client.rpc;
25564
- return typeof rpc === "function" || record17(rpc) ? rpc : null;
25651
+ return typeof rpc === "function" || record19(rpc) ? rpc : null;
25565
25652
  }
25566
25653
 
25567
25654
  // ../desktop-control/dist/renderer-schedule-workspace-rpc.js
25568
- var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25655
+ var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25569
25656
  function localAppScope(root) {
25570
- const scopes = /* @__PURE__ */ new Map();
25571
- const seen = /* @__PURE__ */ new Set();
25572
- for (const main of root.querySelectorAll("main")) {
25573
- const keys = Object.getOwnPropertyNames(main).filter((key3) => key3.startsWith("__reactFiber$"));
25574
- const key2 = keys[0];
25575
- if (keys.length !== 1 || !key2)
25576
- continue;
25577
- for (const fiber of committedReactAncestors(Reflect.get(main, key2))) {
25578
- if (seen.has(fiber))
25579
- break;
25580
- seen.add(fiber);
25581
- let hook = fiber.memoizedState;
25582
- for (let n = 0; record7(hook) && "next" in hook && n < 150; n++, hook = hook.next) {
25583
- const handle = record7(hook.memoizedState) ? hook.memoizedState.current : null;
25584
- if (!record7(handle) || !record7(handle.node) || handle.node.parent != null || !("chain" in handle) || !("scope" in handle) || typeof handle.get !== "function" || typeof handle.set !== "function" || typeof handle.watch !== "function" || !(handle.node.familyBindings instanceof Map))
25585
- continue;
25586
- scopes.set(handle.node, { handle, store: handle.node });
25587
- }
25588
- }
25589
- }
25590
- const scope = scopes.values().next().value;
25591
- if (scopes.size !== 1 || !scope)
25657
+ const handle = readRendererAppScope(root);
25658
+ if (!handle)
25592
25659
  throw new Error("Native local app scope is missing or ambiguous");
25593
- const discovery = findRendererHostRpcFamily(scope.store);
25660
+ const discovery = findRendererHostRpcFamily(handle.node);
25594
25661
  const rpc = discovery && resolveRendererHostRpc(discovery, "local");
25595
25662
  if (!discovery || !rpc)
25596
25663
  throw new Error("Native local app RPC is unavailable");
25597
- return { ...scope, discovery, rpc };
25664
+ return { handle, store: handle.node, discovery, rpc };
25598
25665
  }
25599
25666
  async function createRpcScheduleWorkspaceThread(root, routing, route, createThread, input3, signal) {
25600
25667
  if (!route.policy.scopedCreation)
@@ -25614,11 +25681,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25614
25681
  };
25615
25682
  const readEmpty = async (threadId) => {
25616
25683
  const read = await request("thread/read", { threadId, includeTurns: false });
25617
- if (!record7(read) || !record7(read.thread) || read.thread.id !== threadId || !record7(read.thread.status))
25684
+ if (!record8(read) || !record8(read.thread) || read.thread.id !== threadId || !record8(read.thread.status))
25618
25685
  throw new Error("The created chat could not be read");
25619
25686
  const turns = await request("thread/turns/list", { threadId, cursor: null, limit: 1 });
25620
25687
  const queue = await request("thread/queue/list", { threadId, cursor: null, limit: 1 });
25621
- if (!record7(turns) || !Array.isArray(turns.data) || !("nextCursor" in turns) || !record7(queue) || !Array.isArray(queue.data) || !("nextCursor" in queue))
25688
+ if (!record8(turns) || !Array.isArray(turns.data) || !("nextCursor" in turns) || !record8(queue) || !Array.isArray(queue.data) || !("nextCursor" in queue))
25622
25689
  throw new Error("The created chat's history or queue could not be confirmed");
25623
25690
  return {
25624
25691
  thread: read.thread,
@@ -25648,7 +25715,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25648
25715
  };
25649
25716
  signal.addEventListener("abort", discardAfterDismissal, { once: true });
25650
25717
  const remember = (result) => {
25651
- if (!record7(result) || result.status !== "created")
25718
+ if (!record8(result) || result.status !== "created")
25652
25719
  return;
25653
25720
  const id2 = hostThreadIdSchema.safeParse(result.conversationId);
25654
25721
  if (!id2.success)
@@ -25670,10 +25737,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25670
25737
  assertRequestCurrent: assertCurrent,
25671
25738
  onSettled: remember
25672
25739
  });
25673
- const result = record7(output2) && output2.kind === "creation" ? output2.result : null;
25740
+ const result = record8(output2) && output2.kind === "creation" ? output2.result : null;
25674
25741
  remember(result);
25675
25742
  assertCurrent();
25676
- if (!record7(result) || result.status !== "created" || !createdId || !record7(result.firstTurn) || result.firstTurn.status !== "not-requested")
25743
+ if (!record8(result) || result.status !== "created" || !createdId || !record8(result.firstTurn) || result.firstTurn.status !== "not-requested")
25677
25744
  throw new Error("Chat creation was not confirmed. Check the chat list before creating another task.");
25678
25745
  const { thread: thread3, empty } = await readEmpty(createdId);
25679
25746
  const inspection = threadInspectionSchema.parse(await request("codexhost/thread/inspect", { threadId: createdId }));
@@ -25700,13 +25767,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25700
25767
  }
25701
25768
 
25702
25769
  // ../desktop-control/dist/renderer-schedule-workspace.js
25703
- var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25770
+ var record9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25704
25771
  function readNativeScheduleWorkspaces(root) {
25705
25772
  const projects = /* @__PURE__ */ new Map();
25706
25773
  const ambiguous = /* @__PURE__ */ new Set();
25707
25774
  const seen = /* @__PURE__ */ new Set();
25708
25775
  const add = (value) => {
25709
- if (!record8(value) || value.source !== "codex" || !record8(value.group))
25776
+ if (!record9(value) || value.source !== "codex" || !record9(value.group))
25710
25777
  return;
25711
25778
  const group = value.group;
25712
25779
  if (group.projectKind !== "local" || group.hostId != null && group.hostId !== "local" || typeof group.projectId !== "string" || !group.projectId || typeof group.label !== "string" || typeof group.path !== "string" || !Array.isArray(group.rootPaths) || !group.rootPaths.includes(group.path) || !/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(group.path) || group.path.includes("\0"))
@@ -25728,7 +25795,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25728
25795
  break;
25729
25796
  seen.add(fiber);
25730
25797
  const props = fiber.memoizedProps;
25731
- if (!record8(props))
25798
+ if (!record9(props))
25732
25799
  continue;
25733
25800
  add(props.project);
25734
25801
  if (props.projectByKey instanceof Map)
@@ -25771,7 +25838,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25771
25838
  }
25772
25839
  }));
25773
25840
  const scope = scopes.values().next().value;
25774
- if (scopes.size !== 1 || !record8(scope) || typeof scope.get !== "function")
25841
+ if (scopes.size !== 1 || !record9(scope) || typeof scope.get !== "function")
25775
25842
  throw new Error("Native local chat scope is missing or ambiguous");
25776
25843
  if (!readNativeScheduleWorkspaces(root).some(({ id: id2, cwd }) => id2 === input3.workspace.id && cwd === input3.workspace.cwd))
25777
25844
  throw new Error("The selected workspace is no longer available");
@@ -25784,7 +25851,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25784
25851
  const id2 = createdId;
25785
25852
  released = true;
25786
25853
  const conversation2 = manager.getConversation(id2);
25787
- if (!record8(conversation2) || !Array.isArray(conversation2.turns) || conversation2.turns.length || Array.isArray(conversation2.requests) && conversation2.requests.length > 0 || conversation2.pendingRequest != null)
25854
+ if (!record9(conversation2) || !Array.isArray(conversation2.turns) || conversation2.turns.length || Array.isArray(conversation2.requests) && conversation2.requests.length > 0 || conversation2.pendingRequest != null)
25788
25855
  return;
25789
25856
  void Promise.resolve().then(() => manager.archiveConversation(id2, {
25790
25857
  useAppServerPins: false,
@@ -25793,7 +25860,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25793
25860
  };
25794
25861
  signal.addEventListener("abort", discard, { once: true });
25795
25862
  const remember = (result2) => {
25796
- if (!record8(result2) || result2.status !== "created")
25863
+ if (!record9(result2) || result2.status !== "created")
25797
25864
  return;
25798
25865
  const id2 = hostThreadIdSchema.safeParse(result2.conversationId);
25799
25866
  if (id2.success)
@@ -25810,16 +25877,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25810
25877
  startWithoutFirstTurn: true,
25811
25878
  onSettled: remember
25812
25879
  });
25813
- const result = record8(output2) && output2.kind === "creation" ? output2.result : null;
25880
+ const result = record9(output2) && output2.kind === "creation" ? output2.result : null;
25814
25881
  remember(result);
25815
25882
  signal.throwIfAborted();
25816
- if (!record8(result) || result.status !== "created" || !createdId || !record8(result.firstTurn) || result.firstTurn.status !== "not-requested")
25883
+ if (!record9(result) || result.status !== "created" || !createdId || !record9(result.firstTurn) || result.firstTurn.status !== "not-requested")
25817
25884
  throw new Error("Chat creation was not confirmed. Check the chat list before creating another task.");
25818
25885
  if (routing.forHost("local")?.manager !== route.manager)
25819
25886
  throw new Error("The local connection changed. Reopen the task dialog.");
25820
25887
  const conversation = manager.getConversation(createdId);
25821
- const mode = record8(conversation) ? conversation.latestCollaborationMode : null;
25822
- if (!record8(conversation) || conversation.cwd !== input3.workspace.cwd || !record8(mode) || !record8(mode.settings) || mode.settings.model !== input3.model)
25888
+ const mode = record9(conversation) ? conversation.latestCollaborationMode : null;
25889
+ if (!record9(conversation) || conversation.cwd !== input3.workspace.cwd || !record9(mode) || !record9(mode.settings) || mode.settings.model !== input3.model)
25823
25890
  throw new Error("The created chat's workspace or Model could not be confirmed");
25824
25891
  return {
25825
25892
  threadId: createdId,
@@ -29842,8 +29909,8 @@ ${error62.stderrTail}`] : []
29842
29909
  id: "connections",
29843
29910
  label: messages.pageLabels.connections,
29844
29911
  icon: "connections",
29845
- mount(context2) {
29846
- const document2 = context2.content.ownerDocument;
29912
+ mount(context) {
29913
+ const document2 = context.content.ownerDocument;
29847
29914
  const header = document2.createElement("div");
29848
29915
  header.className = "settings-connection-page-header";
29849
29916
  const headingCopy = document2.createElement("div");
@@ -29865,7 +29932,7 @@ ${error62.stderrTail}`] : []
29865
29932
  const syncMessage = document2.createElement("p");
29866
29933
  syncMessage.className = "settings-page-description";
29867
29934
  syncMessage.setAttribute("role", "status");
29868
- context2.content.append(header, syncMessage, content);
29935
+ context.content.append(header, syncMessage, content);
29869
29936
  let pending2 = false;
29870
29937
  let selectedHostId = null;
29871
29938
  let renderedHostId = null;
@@ -29879,12 +29946,12 @@ ${error62.stderrTail}`] : []
29879
29946
  let renderQueued = false;
29880
29947
  let renderFrame = null;
29881
29948
  const scheduleRender = () => {
29882
- if (disposed || context2.signal.aborted || renderQueued) return;
29949
+ if (disposed || context.signal.aborted || renderQueued) return;
29883
29950
  renderQueued = true;
29884
29951
  const flush = () => {
29885
29952
  renderFrame = null;
29886
29953
  renderQueued = false;
29887
- if (!disposed && !context2.signal.aborted) {
29954
+ if (!disposed && !context.signal.aborted) {
29888
29955
  render(diagnostics?.snapshot() ?? latestSnapshot);
29889
29956
  }
29890
29957
  };
@@ -29901,9 +29968,9 @@ ${error62.stderrTail}`] : []
29901
29968
  };
29902
29969
  const diagnostics = getDiagnostics();
29903
29970
  const versions = createConnectionVersions(
29904
- context2.content,
29971
+ context.content,
29905
29972
  messages,
29906
- context2.signal,
29973
+ context.signal,
29907
29974
  diagnostics,
29908
29975
  scheduleRender
29909
29976
  );
@@ -29911,7 +29978,7 @@ ${error62.stderrTail}`] : []
29911
29978
  const updates = createConnectionUpdates(
29912
29979
  document2,
29913
29980
  messages,
29914
- context2.signal,
29981
+ context.signal,
29915
29982
  scheduleRender,
29916
29983
  diagnostics
29917
29984
  );
@@ -30012,7 +30079,7 @@ ${error62.stderrTail}`] : []
30012
30079
  createRendererSettingsIcon("diagnose", 16),
30013
30080
  messages.connectionRefreshing
30014
30081
  );
30015
- void context2.runLatest(() => diagnostics.refresh(void 0, "retry"), {
30082
+ void context.runLatest(() => diagnostics.refresh(void 0, "retry"), {
30016
30083
  success() {
30017
30084
  installs?.clearErrors();
30018
30085
  pending2 = false;
@@ -30376,9 +30443,9 @@ ${error62.stderrTail}`] : []
30376
30443
  }
30377
30444
  };
30378
30445
  render(diagnostics?.snapshot() ?? null);
30379
- void getRemoteConnections()?.ssh.list(context2.signal).then(
30446
+ void getRemoteConnections()?.ssh.list(context.signal).then(
30380
30447
  (connections) => {
30381
- if (context2.signal.aborted) return;
30448
+ if (context.signal.aborted) return;
30382
30449
  for (const connection of connections) {
30383
30450
  hostNames.set(connection.hostId, connection.displayName.trim());
30384
30451
  }
@@ -30697,6 +30764,7 @@ ${error62.stderrTail}`] : []
30697
30764
  updating: "Updating\u2026",
30698
30765
  updateToVersion: "Update to v{version}",
30699
30766
  installedBadge: "Installed",
30767
+ installedDisabledBadge: "Installed \xB7 Off",
30700
30768
  uninstall: "Uninstall",
30701
30769
  uninstalling: "Uninstalling\u2026",
30702
30770
  uninstallConfirmPrompt: "Remove this plugin?",
@@ -30709,7 +30777,9 @@ ${error62.stderrTail}`] : []
30709
30777
  marketplaceEmptyDescription: "Refresh to check for newly published plugins, or import one from GitHub, a local .zip package, or a local directory.",
30710
30778
  marketplaceFallbackNotice: "The remote catalog is unreachable. You can still install plugins from GitHub, a ZIP, or a local directory.",
30711
30779
  marketplaceLoadFailed: "Could not load plugin marketplace: {message}",
30712
- installedSuccess: "Installed \u201C{name}\u201D (v{version}). Enable it when ready.",
30780
+ installedSuccess: "Installed and enabled \u201C{name}\u201D (v{version}).",
30781
+ installedSlotConflict: "Installed \u201C{name}\u201D (v{version}), but left it disabled because a Desktop slot conflicts with {other}. Disable {other} first to enable it.",
30782
+ installedDisabled: "Installed \u201C{name}\u201D (v{version}), currently disabled. Review or enable it in Installed.",
30713
30783
  updatedSuccess: "Updated \u201C{name}\u201D to v{version}.",
30714
30784
  uninstalledSuccess: "Uninstalled \u201C{name}\u201D.",
30715
30785
  installFailed: "Could not install plugin: {message}",
@@ -30926,6 +30996,7 @@ ${error62.stderrTail}`] : []
30926
30996
  updating: "\u66F4\u65B0\u4E2D\u2026",
30927
30997
  updateToVersion: "\u66F4\u65B0\u5230 v{version}",
30928
30998
  installedBadge: "\u5DF2\u5B89\u88C5",
30999
+ installedDisabledBadge: "\u5DF2\u5B89\u88C5 \xB7 \u672A\u542F\u7528",
30929
31000
  uninstall: "\u5378\u8F7D",
30930
31001
  uninstalling: "\u5378\u8F7D\u4E2D\u2026",
30931
31002
  uninstallConfirmPrompt: "\u786E\u8BA4\u5378\u8F7D\u6B64\u63D2\u4EF6\uFF1F",
@@ -30938,7 +31009,9 @@ ${error62.stderrTail}`] : []
30938
31009
  marketplaceEmptyDescription: "\u53EF\u70B9\u51FB\u5237\u65B0\u83B7\u53D6\u6700\u65B0\u76EE\u5F55\uFF0C\u6216\u901A\u8FC7 GitHub\u3001\u672C\u5730 .zip \u5305\u6216\u672C\u5730\u76EE\u5F55\u5BFC\u5165\u3002",
30939
31010
  marketplaceFallbackNotice: "\u8FDC\u7AEF\u5E02\u573A\u76EE\u5F55\u6682\u4E0D\u53EF\u8FBE\u3002\u4F60\u4ECD\u53EF\u901A\u8FC7 GitHub\u3001ZIP \u6216\u672C\u5730\u76EE\u5F55\u5B89\u88C5\u63D2\u4EF6\u3002",
30940
31011
  marketplaceLoadFailed: "\u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6\u5E02\u573A\uFF1A{message}",
30941
- installedSuccess: "\u5DF2\u5B89\u88C5\u201C{name}\u201D\uFF08v{version}\uFF09\uFF0C\u53EF\u6309\u9700\u5F00\u542F\u3002",
31012
+ installedSuccess: "\u5DF2\u5B89\u88C5\u5E76\u542F\u7528\u201C{name}\u201D\uFF08v{version}\uFF09\u3002",
31013
+ installedSlotConflict: "\u5DF2\u5B89\u88C5\u201C{name}\u201D\uFF08v{version}\uFF09\uFF0C\u4F46\u56E0\u4E0E {other} \u5B58\u5728 Desktop \u69FD\u4F4D\u51B2\u7A81\u6682\u672A\u542F\u7528\uFF0C\u8BF7\u5148\u7981\u7528 {other} \u540E\u518D\u542F\u7528\u3002",
31014
+ installedDisabled: "\u5DF2\u5B89\u88C5\u201C{name}\u201D\uFF08v{version}\uFF09\uFF0C\u5F53\u524D\u672A\u542F\u7528\uFF0C\u53EF\u524D\u5F80\u300C\u5DF2\u5B89\u88C5\u300D\u67E5\u770B\u6216\u624B\u52A8\u542F\u7528\u3002",
30942
31015
  updatedSuccess: "\u5DF2\u5C06\u201C{name}\u201D\u66F4\u65B0\u81F3 v{version}\u3002",
30943
31016
  uninstalledSuccess: "\u5DF2\u5378\u8F7D\u201C{name}\u201D\u3002",
30944
31017
  installFailed: "\u5B89\u88C5\u63D2\u4EF6\u5931\u8D25\uFF1A{message}",
@@ -34711,9 +34784,11 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34711
34784
  }
34712
34785
 
34713
34786
  // src/renderer-native-model-loading.ts
34714
- function isNativeModelCarrierLoadingButton(button2) {
34715
- if (!button2.disabled || button2.getAttribute("data-composer-navigation-target") !== "reasoning" || button2.getAttribute("aria-busy") !== "true" || button2.hasAttribute("aria-haspopup"))
34716
- return false;
34787
+ var NATIVE_MODEL_LOADING_FIBER_WALK_DEPTH = 120;
34788
+ function isRecord(value) {
34789
+ return typeof value === "object" && value !== null && !Array.isArray(value);
34790
+ }
34791
+ function hasCarrierLabel(button2) {
34717
34792
  for (const label of button2.children) {
34718
34793
  const text2 = label.firstChild;
34719
34794
  if (label.localName !== "span" || text2?.nodeName !== "#text") continue;
@@ -34724,9 +34799,43 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34724
34799
  }
34725
34800
  return false;
34726
34801
  }
34802
+ function hasSkeletonPlaceholder(button2) {
34803
+ if (!button2.getAttribute("aria-label")?.trim() || button2.children.length !== 1) return false;
34804
+ const placeholder = button2.children[0];
34805
+ return placeholder?.localName === "span" && placeholder.getAttribute("aria-hidden") === "true" && Boolean(placeholder.getAttribute("data-size")?.trim()) && (placeholder.children?.length ?? 0) === 0 && (placeholder.textContent ?? "").trim() === "";
34806
+ }
34807
+ function hasNativeModelPickerLoadingOwner(button2, composer) {
34808
+ const fiberKey = Object.getOwnPropertyNames(button2).find(
34809
+ (key2) => key2.startsWith("__reactFiber$")
34810
+ );
34811
+ if (!fiberKey) return false;
34812
+ const ancestors2 = committedReactAncestors(
34813
+ Object.getOwnPropertyDescriptor(button2, fiberKey)?.value
34814
+ );
34815
+ const host = ancestors2[0];
34816
+ const hostProps = isRecord(host?.memoizedProps) ? host.memoizedProps : void 0;
34817
+ if (host?.stateNode !== button2 || hostProps?.["data-composer-navigation-target"] !== "reasoning" || hostProps?.["aria-busy"] !== true || hostProps?.disabled !== true) {
34818
+ return false;
34819
+ }
34820
+ for (const owner of ancestors2.slice(1, NATIVE_MODEL_LOADING_FIBER_WALK_DEPTH)) {
34821
+ if (owner.stateNode === composer) break;
34822
+ const props = isRecord(owner.memoizedProps) ? owner.memoizedProps : void 0;
34823
+ if (!props) continue;
34824
+ if ("conversationId" in props && "permissionsHostId" in props && "permissionsCwdOverride" in props && ("hasThreadResumeFailed" in props || "serviceTierDefaults" in props || isRecord(props.home))) {
34825
+ return true;
34826
+ }
34827
+ }
34828
+ return false;
34829
+ }
34830
+ function isNativeModelLoadingButton(button2, composer) {
34831
+ if (!button2.disabled || button2.getAttribute("data-composer-navigation-target") !== "reasoning" || button2.getAttribute("aria-busy") !== "true" || button2.hasAttribute("aria-haspopup"))
34832
+ return false;
34833
+ if (hasCarrierLabel(button2)) return true;
34834
+ return hasSkeletonPlaceholder(button2) && hasNativeModelPickerLoadingOwner(button2, composer);
34835
+ }
34727
34836
 
34728
34837
  // src/renderer-native-model-retry.ts
34729
- function record9(value) {
34838
+ function record10(value) {
34730
34839
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
34731
34840
  }
34732
34841
  function containsMessage(children, id2) {
@@ -34737,7 +34846,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34737
34846
  for (const item of child) pending2.push(item);
34738
34847
  continue;
34739
34848
  }
34740
- const props = record9(record9(child)?.props);
34849
+ const props = record10(record10(child)?.props);
34741
34850
  if (props?.id === id2) return true;
34742
34851
  if (props?.children !== void 0) pending2.push(props.children);
34743
34852
  }
@@ -34754,14 +34863,14 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34754
34863
  Object.getOwnPropertyDescriptor(button2, fiberKey)?.value
34755
34864
  );
34756
34865
  const host = ancestors2[0];
34757
- const props = record9(host?.memoizedProps);
34758
- const current = record9(Object.getOwnPropertyDescriptor(button2, propsKey)?.value);
34866
+ const props = record10(host?.memoizedProps);
34867
+ const current = record10(Object.getOwnPropertyDescriptor(button2, propsKey)?.value);
34759
34868
  if (host?.stateNode !== button2 || props?.["data-composer-navigation-target"] !== "reasoning" || typeof props.onClick !== "function" || props.onClick !== current?.onClick || !containsMessage(props.children, "composer.modelPicker.retryModels"))
34760
34869
  return false;
34761
34870
  for (const owner of ancestors2.slice(1, 60)) {
34762
34871
  if (owner.stateNode === composer) break;
34763
- const tooltip = record9(owner.memoizedProps)?.content;
34764
- if (record9(record9(tooltip)?.props)?.id === "composer.modelPicker.modelsUnavailable")
34872
+ const tooltip = record10(owner.memoizedProps)?.content;
34873
+ if (record10(record10(tooltip)?.props)?.id === "composer.modelPicker.modelsUnavailable")
34765
34874
  return true;
34766
34875
  }
34767
34876
  return false;
@@ -34863,7 +34972,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34863
34972
  const composer = element.closest(CODEX_COMPOSER_SELECTOR);
34864
34973
  return composer && !hasNativeComposerRequest(composer) && !isOrbitComposer(composer) ? composer : null;
34865
34974
  }
34866
- function isRecord(value) {
34975
+ function isRecord2(value) {
34867
34976
  return typeof value === "object" && value !== null && !Array.isArray(value);
34868
34977
  }
34869
34978
  var NATIVE_CONTROL_FIBER_WALK_DEPTH = 120;
@@ -34880,7 +34989,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34880
34989
  let fiber = fiberName ? Object.getOwnPropertyDescriptor(element, fiberName)?.value : null;
34881
34990
  for (let depth = 0; fiber && depth < NATIVE_CONTROL_FIBER_WALK_DEPTH; depth += 1) {
34882
34991
  const props = fiber.memoizedProps;
34883
- if (isRecord(props) && typeof props.onSelectModel === "function" && "reasoningEffort" in props && (typeof props.onSelectReasoningEffort === "function" && isRecord(props.fallbackPowerSelection) || element.getAttribute("data-composer-navigation-target") === "reasoning" && typeof props.onCommitPower === "function" && Array.isArray(props.powerSelections))) {
34992
+ if (isRecord2(props) && typeof props.onSelectModel === "function" && "reasoningEffort" in props && (typeof props.onSelectReasoningEffort === "function" && isRecord2(props.fallbackPowerSelection) || element.getAttribute("data-composer-navigation-target") === "reasoning" && typeof props.onCommitPower === "function" && Array.isArray(props.powerSelections))) {
34884
34993
  return true;
34885
34994
  }
34886
34995
  const parent = fiber.return;
@@ -34900,7 +35009,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34900
35009
  let ownsComposerPermissionState = false;
34901
35010
  for (let depth = 0; fiber && depth < NATIVE_CONTROL_FIBER_WALK_DEPTH; depth += 1) {
34902
35011
  const props = fiber.memoizedProps;
34903
- if (isRecord(props)) {
35012
+ if (isRecord2(props)) {
34904
35013
  if (props["data-composer-navigation-target"] === "permissions" && props["aria-haspopup"] === "menu") {
34905
35014
  ownsTrigger = true;
34906
35015
  }
@@ -34931,7 +35040,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34931
35040
  'button[aria-haspopup="menu"], button[data-composer-navigation-target="reasoning"]'
34932
35041
  )
34933
35042
  ].filter(
34934
- (button2) => !isOwnedRendererControl(button2) && button2.closest(CODEX_COMPOSER_SELECTOR) === composer && (isNativeModelControlCandidate(button2) || isNativeModelRetryButton(button2, composer) || isNativeModelCarrierLoadingButton(button2))
35043
+ (button2) => !isOwnedRendererControl(button2) && button2.closest(CODEX_COMPOSER_SELECTOR) === composer && (isNativeModelControlCandidate(button2) || isNativeModelRetryButton(button2, composer) || isNativeModelLoadingButton(button2, composer))
34935
35044
  );
34936
35045
  return candidates.length === 1 ? candidates[0] ?? null : null;
34937
35046
  }
@@ -34976,8 +35085,8 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34976
35085
  if (candidate) syncRendererModelTriggerClass(control.modelPicker);
34977
35086
  }
34978
35087
  function usagePlacementAnchor(control) {
34979
- const context2 = control.nativeContextUsageControl?.element;
34980
- const contextWrapper = context2?.parentElement;
35088
+ const context = control.nativeContextUsageControl?.element;
35089
+ const contextWrapper = context?.parentElement;
34981
35090
  if (contextWrapper?.parentElement) return contextWrapper;
34982
35091
  const modelRoot = control.modelPicker?.root;
34983
35092
  return modelRoot?.parentElement ? modelRoot : null;
@@ -35390,19 +35499,19 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35390
35499
 
35391
35500
  // src/renderer-codex-usage-banner.ts
35392
35501
  var MAX_FIBERS = 2e4;
35393
- function isRecord2(value) {
35502
+ function isRecord3(value) {
35394
35503
  return typeof value === "object" && value !== null && !Array.isArray(value);
35395
35504
  }
35396
35505
  function isUsageBanner(props) {
35397
- return isRecord2(props) && "banner" in props && "rateLimitStatus" in props && typeof props.sendBlocked === "boolean";
35506
+ return isRecord3(props) && "banner" in props && "rateLimitStatus" in props && typeof props.sendBlocked === "boolean";
35398
35507
  }
35399
35508
  function isElement(value) {
35400
- return isRecord2(value) && typeof value.setAttribute === "function" && isRecord2(value.style);
35509
+ return isRecord3(value) && typeof value.setAttribute === "function" && isRecord3(value.style);
35401
35510
  }
35402
35511
  function hostElements(fiber, budget) {
35403
35512
  const result = [];
35404
35513
  const visit2 = (node2) => {
35405
- for (let current = node2; isRecord2(current); current = current.sibling) {
35514
+ for (let current = node2; isRecord3(current); current = current.sibling) {
35406
35515
  if (budget.remaining-- <= 0) return;
35407
35516
  const { stateNode } = current;
35408
35517
  if (isElement(stateNode)) result.push(stateNode);
@@ -35413,13 +35522,13 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35413
35522
  return result;
35414
35523
  }
35415
35524
  function findCodexUsageBannerElements(owner) {
35416
- if (!isRecord2(owner)) return [];
35525
+ if (!isRecord3(owner)) return [];
35417
35526
  const budget = { remaining: MAX_FIBERS };
35418
35527
  const found = [];
35419
35528
  const stack = [owner.child];
35420
35529
  while (stack.length > 0 && budget.remaining > 0) {
35421
35530
  const node2 = stack.pop();
35422
- if (!isRecord2(node2)) continue;
35531
+ if (!isRecord3(node2)) continue;
35423
35532
  budget.remaining -= 1;
35424
35533
  const fiber = node2;
35425
35534
  stack.push(fiber.sibling);
@@ -35465,13 +35574,13 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35465
35574
  var MAX_HOOKS = 4096;
35466
35575
  var MAX_DOM_DEPTH = 12;
35467
35576
  var RETRY_DELAY_MS = 1e3;
35468
- function isRecord3(value) {
35577
+ function isRecord4(value) {
35469
35578
  return typeof value === "object" && value !== null && !Array.isArray(value);
35470
35579
  }
35471
35580
  function hooksOf(fiber) {
35472
35581
  const result = [];
35473
- let hook = isRecord3(fiber) ? fiber.memoizedState : null;
35474
- while (isRecord3(hook) && result.length < MAX_HOOKS) {
35582
+ let hook = isRecord4(fiber) ? fiber.memoizedState : null;
35583
+ while (isRecord4(hook) && result.length < MAX_HOOKS) {
35475
35584
  result.push(hook);
35476
35585
  hook = hook.next;
35477
35586
  }
@@ -35488,7 +35597,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35488
35597
  Object.getOwnPropertyDescriptor(element, key2)?.value
35489
35598
  );
35490
35599
  const consumers = ancestors2.filter(
35491
- ({ memoizedProps: props }) => isRecord3(props) && typeof props.submitDisabledReasons === "string" && typeof props.onSubmitLocal === "function"
35600
+ ({ memoizedProps: props }) => isRecord4(props) && typeof props.submitDisabledReasons === "string" && typeof props.onSubmitLocal === "function"
35492
35601
  );
35493
35602
  if (consumers.length > 0) {
35494
35603
  const consumer = consumers.length === 1 ? consumers[0] : void 0;
@@ -35497,7 +35606,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35497
35606
  }
35498
35607
  const scopes = [];
35499
35608
  ancestors2.forEach(({ memoizedProps: props }, index) => {
35500
- if (isRecord3(props) && "onLocalSubmitStart" in props && typeof props.submitDisabled === "boolean") {
35609
+ if (isRecord4(props) && "onLocalSubmitStart" in props && typeof props.submitDisabled === "boolean") {
35501
35610
  scopes.push({ owner: ancestors2[index], fibers: ancestors2.slice(0, index + 1) });
35502
35611
  }
35503
35612
  });
@@ -35522,11 +35631,11 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35522
35631
  if (!Array.isArray(memo2) || !Array.isArray(memo2[1])) return null;
35523
35632
  const [subscriber, dependencies] = memo2;
35524
35633
  const signal = dependencies[0];
35525
- const adapted = isRecord3(signal) && typeof signal.get === "function" && typeof signal.subscribe === "function";
35634
+ const adapted = isRecord4(signal) && typeof signal.get === "function" && typeof signal.subscribe === "function";
35526
35635
  const [store, atom] = adapted ? [signal.store, signal.atom] : dependencies;
35527
35636
  const instance = hook.next?.queue;
35528
35637
  const effect = hook.next?.next?.memoizedState;
35529
- if (!isRecord3(subscriber) || typeof subscriber.getSnapshot !== "function" || typeof subscriber.subscribe !== "function" || !isRecord3(store) || typeof store.get !== "function" || typeof store.sub !== "function" || !isRecord3(atom) || typeof atom.read !== "function" || "write" in atom || !isRecord3(instance) || typeof instance.value !== "boolean" && typeof instance.value !== "string" || typeof instance.getSnapshot !== "function" || !isRecord3(effect) || typeof effect.create !== "function" || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe) {
35638
+ if (!isRecord4(subscriber) || typeof subscriber.getSnapshot !== "function" || typeof subscriber.subscribe !== "function" || !isRecord4(store) || typeof store.get !== "function" || typeof store.sub !== "function" || !isRecord4(atom) || typeof atom.read !== "function" || "write" in atom || !isRecord4(instance) || typeof instance.value !== "boolean" && typeof instance.value !== "string" || typeof instance.getSnapshot !== "function" || !isRecord4(effect) || typeof effect.create !== "function" || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe) {
35530
35639
  return null;
35531
35640
  }
35532
35641
  return {
@@ -35571,10 +35680,10 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35571
35680
  visiting.delete(dependency);
35572
35681
  }
35573
35682
  }
35574
- if (!isRecord3(value)) return value;
35683
+ if (!isRecord4(value)) return value;
35575
35684
  if (typeof value.hardBlocked === "boolean") return trace(value, "reserve");
35576
35685
  if ("authMethod" in value) return trace(value, "auth");
35577
- if (isRecord3(value.data) && isRecord3(value.data.rate_limit)) {
35686
+ if (isRecord4(value.data) && isRecord4(value.data.rate_limit)) {
35578
35687
  return {
35579
35688
  ...value,
35580
35689
  data: { ...value.data, rate_limit: trace(value.data.rate_limit, "limit") }
@@ -35639,9 +35748,9 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35639
35748
  const type = consumer.elementType ?? consumer.type;
35640
35749
  if (type == null) return null;
35641
35750
  const producers = ancestors2.slice(ancestors2.indexOf(consumer) + 1).filter(({ updateQueue }) => {
35642
- const cache = isRecord3(updateQueue) ? updateQueue.memoCache : null;
35643
- return isRecord3(cache) && Array.isArray(cache.data) && cache.data.some(
35644
- (row) => Array.isArray(row) && row.some((node2) => isRecord3(node2) && node2.props === props && node2.type === type)
35751
+ const cache = isRecord4(updateQueue) ? updateQueue.memoCache : null;
35752
+ return isRecord4(cache) && Array.isArray(cache.data) && cache.data.some(
35753
+ (row) => Array.isArray(row) && row.some((node2) => isRecord4(node2) && node2.props === props && node2.type === type)
35645
35754
  );
35646
35755
  });
35647
35756
  const producer = producers[0];
@@ -35756,7 +35865,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35756
35865
  }
35757
35866
  function isBound(projections) {
35758
35867
  return [...projections].every(({ fiber, subscriber, instance }) => {
35759
- const alternate = isRecord3(fiber.alternate) ? fiber.alternate : null;
35868
+ const alternate = isRecord4(fiber.alternate) ? fiber.alternate : null;
35760
35869
  return [fiber, alternate].some(
35761
35870
  (candidate) => hooksOf(candidate).some(
35762
35871
  (hook) => Array.isArray(hook.memoizedState) && hook.memoizedState[0] === subscriber && hook.next?.queue === instance
@@ -35841,7 +35950,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35841
35950
 
35842
35951
  // src/renderer-native-provider-usage-banner.ts
35843
35952
  var COMPOSER_SELECTOR = "[data-codex-composer-root]";
35844
- function isRecord4(value) {
35953
+ function isRecord5(value) {
35845
35954
  return typeof value === "object" && value !== null && !Array.isArray(value);
35846
35955
  }
35847
35956
  function isCodexUsageBanner(element, composer) {
@@ -35851,7 +35960,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
35851
35960
  for (const { memoizedProps: props } of committedReactAncestors(
35852
35961
  Object.getOwnPropertyDescriptor(element, key2)?.value
35853
35962
  )) {
35854
- if (!isRecord4(props) || !isRecord4(props.banner)) continue;
35963
+ if (!isRecord5(props) || !isRecord5(props.banner)) continue;
35855
35964
  const type = props.banner.banner_type;
35856
35965
  return typeof type === "string" && /^(?:[a-z0-9]+_)*rate_limit_reached$/u.test(type);
35857
35966
  }
@@ -36248,18 +36357,18 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36248
36357
  }
36249
36358
 
36250
36359
  // src/renderer-native-thread.ts
36251
- function isRecord5(value) {
36360
+ function isRecord6(value) {
36252
36361
  return typeof value === "object" && value !== null && !Array.isArray(value);
36253
36362
  }
36254
36363
  function usesIndependentNativeInference(value, modelProvider) {
36255
- const config2 = isRecord5(value) ? value.config : null;
36256
- if (!isRecord5(config2)) return false;
36364
+ const config2 = isRecord6(value) ? value.config : null;
36365
+ if (!isRecord6(config2)) return false;
36257
36366
  const providerId = modelProvider ?? config2.model_provider;
36258
36367
  if (typeof providerId !== "string") return false;
36259
36368
  if (["openai", "cc-switch-official", "codexhost"].includes(providerId)) return false;
36260
36369
  const providers = config2.model_providers;
36261
- const provider = isRecord5(providers) ? providers[providerId] : null;
36262
- if (!isRecord5(provider) || typeof provider.base_url !== "string") return false;
36370
+ const provider = isRecord6(providers) ? providers[providerId] : null;
36371
+ if (!isRecord6(provider) || typeof provider.base_url !== "string") return false;
36263
36372
  if (!URL.canParse(provider.base_url)) return false;
36264
36373
  const endpoint = new URL(provider.base_url);
36265
36374
  if (!["http:", "https:"].includes(endpoint.protocol)) return false;
@@ -36273,8 +36382,8 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36273
36382
  }
36274
36383
  async function readNativeCodexThread(sendRequest, threadId) {
36275
36384
  const native = await sendRequest("thread/read", { threadId, includeTurns: false });
36276
- const thread3 = isRecord5(native) ? native.thread : null;
36277
- if (!isRecord5(thread3) || thread3.id !== threadId || typeof thread3.modelProvider !== "string" || !thread3.modelProvider || thread3.modelProvider === "codexhost" || typeof thread3.cliVersion !== "string" || !thread3.cliVersion || thread3.cliVersion === "codexhost") {
36385
+ const thread3 = isRecord6(native) ? native.thread : null;
36386
+ if (!isRecord6(thread3) || thread3.id !== threadId || typeof thread3.modelProvider !== "string" || !thread3.modelProvider || thread3.modelProvider === "codexhost" || typeof thread3.cliVersion !== "string" || !thread3.cliVersion || thread3.cliVersion === "codexhost") {
36278
36387
  throw new Error("Native Thread response cannot establish Codex ownership");
36279
36388
  }
36280
36389
  return {
@@ -36363,15 +36472,15 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36363
36472
  var CODEX_ACCOUNT_LIST_METHOD = "codexhost/account/list";
36364
36473
  var CODEX_ACCOUNT_REFRESH_METHOD = "codexhost/account/refresh";
36365
36474
  var CODEX_ACCOUNT_CHANGED_METHOD = "codexhost/account/changed";
36366
- function isRecord6(value) {
36475
+ function isRecord7(value) {
36367
36476
  return typeof value === "object" && value !== null && !Array.isArray(value);
36368
36477
  }
36369
36478
  function notifiedThreadId(notification) {
36370
- if (!isRecord6(notification) || !THREAD_USAGE_REFRESH_METHODS.includes(notification.method)) {
36479
+ if (!isRecord7(notification) || !THREAD_USAGE_REFRESH_METHODS.includes(notification.method)) {
36371
36480
  return null;
36372
36481
  }
36373
36482
  const params = notification.params;
36374
- if (!isRecord6(params)) return null;
36483
+ if (!isRecord7(params)) return null;
36375
36484
  const parsed = hostThreadIdSchema.safeParse(params.threadId);
36376
36485
  return parsed.success ? parsed.data : null;
36377
36486
  }
@@ -36451,7 +36560,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36451
36560
  THREAD_TREE_SNAPSHOT_METHOD,
36452
36561
  (message2) => {
36453
36562
  const result = threadTreeWatchResultSchema.safeParse(
36454
- isRecord6(message2) ? message2.params : void 0
36563
+ isRecord7(message2) ? message2.params : void 0
36455
36564
  );
36456
36565
  if (!closed && result.success && subscriptionId2 === result.data.subscriptionId && result.data.snapshot.revision > revision) {
36457
36566
  revision = result.data.snapshot.revision;
@@ -36571,7 +36680,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36571
36680
  watchThreadTree,
36572
36681
  async hasDesktopThread(threadId) {
36573
36682
  const result = await manager.sendRequest("thread/read", { threadId, includeTurns: false });
36574
- return isRecord6(result) && isRecord6(result.thread) && result.thread.id === threadId;
36683
+ return isRecord7(result) && isRecord7(result.thread) && result.thread.id === threadId;
36575
36684
  },
36576
36685
  subscribeHarnessPreferences(listener) {
36577
36686
  return notificationTarget(source)?.addNotificationCallback?.(
@@ -36652,7 +36761,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36652
36761
  },
36653
36762
  subscribeSkillsChanged(listener) {
36654
36763
  return notificationTarget(source)?.addNotificationCallback?.(SKILLS_CHANGED_METHOD, (value) => {
36655
- if (!isRecord6(value) || value.method !== SKILLS_CHANGED_METHOD) return;
36764
+ if (!isRecord7(value) || value.method !== SKILLS_CHANGED_METHOD) return;
36656
36765
  const parsed = skillsChangedParamsSchema.safeParse(value.params);
36657
36766
  if (parsed.success) listener(parsed.data);
36658
36767
  }) ?? (() => {
@@ -36959,7 +37068,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36959
37068
  throw new Error("Renderer Account notification callback is unavailable");
36960
37069
  }
36961
37070
  return notifications.addNotificationCallback(CODEX_ACCOUNT_CHANGED_METHOD, (notification) => {
36962
- if (!isRecord6(notification) || notification.method !== CODEX_ACCOUNT_CHANGED_METHOD) return;
37071
+ if (!isRecord7(notification) || notification.method !== CODEX_ACCOUNT_CHANGED_METHOD) return;
36963
37072
  const state = codexAccountChangedSchema.safeParse(notification.params);
36964
37073
  if (state.success) listener(state.data);
36965
37074
  });
@@ -36971,14 +37080,14 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36971
37080
  }
36972
37081
 
36973
37082
  // src/renderer-external-queue.ts
36974
- function isRecord7(value) {
37083
+ function isRecord8(value) {
36975
37084
  return value !== null && typeof value === "object" && !Array.isArray(value);
36976
37085
  }
36977
37086
  function installRendererExternalQueue(target2) {
36978
- if (!isRecord7(target2) || typeof target2.getTurnCoordinator !== "function") return null;
37087
+ if (!isRecord8(target2) || typeof target2.getTurnCoordinator !== "function") return null;
36979
37088
  const coordinator = target2.getTurnCoordinator();
36980
- const queue = isRecord7(coordinator) ? coordinator.serverQueue : null;
36981
- if (!isRecord7(queue) || typeof queue.isEnabled !== "function") return null;
37089
+ const queue = isRecord8(coordinator) ? coordinator.serverQueue : null;
37090
+ if (!isRecord8(queue) || typeof queue.isEnabled !== "function") return null;
36982
37091
  return () => void 0;
36983
37092
  }
36984
37093
 
@@ -37007,19 +37116,19 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37007
37116
  }
37008
37117
 
37009
37118
  // src/renderer-external-steering.ts
37010
- function isRecord8(value) {
37119
+ function isRecord9(value) {
37011
37120
  return value !== null && typeof value === "object" && !Array.isArray(value);
37012
37121
  }
37013
37122
  function isManager(value) {
37014
- return isRecord8(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
37123
+ return isRecord9(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
37015
37124
  (key2) => typeof value[key2] === "function"
37016
37125
  );
37017
37126
  }
37018
37127
  function submissionHost(manager) {
37019
37128
  const coordinator = manager.getTurnCoordinator();
37020
- const options = isRecord8(coordinator) ? coordinator.options : null;
37021
- const host = isRecord8(options) ? options.submissionHost : null;
37022
- if (!isRecord8(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
37129
+ const options = isRecord9(coordinator) ? coordinator.options : null;
37130
+ const host = isRecord9(options) ? options.submissionHost : null;
37131
+ if (!isRecord9(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
37023
37132
  throw new Error("Desktop turn submission binding is unavailable");
37024
37133
  }
37025
37134
  return {
@@ -37061,20 +37170,20 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37061
37170
  var INTERRUPTED_QUEUE_REASON = "Interrupted before the steer was accepted.";
37062
37171
  async function preserveQueuedFollowUps(manager, threadId) {
37063
37172
  const coordinator = manager.getTurnCoordinator();
37064
- if (!isRecord8(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
37173
+ if (!isRecord9(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
37065
37174
  throw new Error("Desktop follow-up queue binding is unavailable");
37066
37175
  }
37067
37176
  await coordinator.loadMessages.call(coordinator, threadId);
37068
37177
  const messages = coordinator.readMessages.call(coordinator, threadId);
37069
37178
  if (!Array.isArray(messages)) throw new Error("Desktop follow-up queue is unavailable");
37070
37179
  const alreadyPaused = new Set(
37071
- messages.filter((message2) => isRecord8(message2) && message2.pausedReason != null).map((message2) => message2.id)
37180
+ messages.filter((message2) => isRecord9(message2) && message2.pausedReason != null).map((message2) => message2.id)
37072
37181
  );
37073
37182
  return () => {
37074
37183
  coordinator.mutate.call(coordinator, threadId, (current) => {
37075
37184
  if (!Array.isArray(current)) return current;
37076
37185
  return current.map((message2) => {
37077
- if (!isRecord8(message2) || alreadyPaused.has(message2.id) || message2.pausedReason !== INTERRUPTED_QUEUE_REASON)
37186
+ if (!isRecord9(message2) || alreadyPaused.has(message2.id) || message2.pausedReason !== INTERRUPTED_QUEUE_REASON)
37078
37187
  return message2;
37079
37188
  const resumed = { ...message2 };
37080
37189
  delete resumed.pausedReason;
@@ -37092,20 +37201,17 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37092
37201
  const activeTurnSteers = /* @__PURE__ */ new Map();
37093
37202
  const pending2 = /* @__PURE__ */ new Map();
37094
37203
  let disposed = false;
37095
- const send = function(method, params, options) {
37096
- if ((method === "turn/start" || method === "turn/steer") && prepareTurnInput) {
37097
- params = prepareTurnInput(params);
37098
- }
37099
- const messageId = isRecord8(params) ? params.clientUserMessageId : null;
37100
- const route = typeof messageId === "string" && isRecord8(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
37101
- if (method !== "turn/start" || !isRecord8(params) || !route || route.threadId !== params.threadId) {
37204
+ const sendPrepared = function(method, params, options) {
37205
+ const messageId = isRecord9(params) ? params.clientUserMessageId : null;
37206
+ const route = typeof messageId === "string" && isRecord9(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
37207
+ if (method !== "turn/start" || !isRecord9(params) || !route || route.threadId !== params.threadId) {
37102
37208
  if (method === "turn/start" && sendTurnStart) {
37103
37209
  return sendTurnStart(params, (input3) => {
37104
37210
  if (disposed) throw new Error("External submission binding was disposed");
37105
37211
  return originalSend.call(manager, method, input3, options);
37106
37212
  });
37107
37213
  }
37108
- if (method === "turn/steer" && isRecord8(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
37214
+ if (method === "turn/steer" && isRecord9(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
37109
37215
  params = { ...params, [THREAD_STEER_DELIVERY_PARAM]: "activeTurn" };
37110
37216
  }
37111
37217
  return originalSend.call(manager, method, params, options);
@@ -37128,7 +37234,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37128
37234
  options
37129
37235
  )
37130
37236
  ).then((response) => {
37131
- if (!isRecord8(response) || typeof response.turnId !== "string" || !response.turnId) {
37237
+ if (!isRecord9(response) || typeof response.turnId !== "string" || !response.turnId) {
37132
37238
  throw new Error("External steering returned no replacement Turn identity");
37133
37239
  }
37134
37240
  return {
@@ -37145,6 +37251,9 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37145
37251
  };
37146
37252
  });
37147
37253
  };
37254
+ const send = function(method, params, options) {
37255
+ return prepareTurnInput && (method === "turn/start" || method === "turn/steer") ? prepareTurnInput(params, (prepared) => sendPrepared(method, prepared, options)) : sendPrepared(method, params, options);
37256
+ };
37148
37257
  const inspectDelivery = (threadId, text2) => inspectRendererSteeringDelivery(
37149
37258
  (method, params) => originalSend.call(manager, method, params),
37150
37259
  threadId,
@@ -37166,7 +37275,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37166
37275
  ] = args;
37167
37276
  if (typeof threadId !== "string") return originalSteer.apply(manager, args);
37168
37277
  const role = manager.getStreamRole?.(threadId);
37169
- if (isRecord8(role) && role.role === "follower") return originalSteer.apply(manager, args);
37278
+ if (isRecord9(role) && role.role === "follower") return originalSteer.apply(manager, args);
37170
37279
  let host = null;
37171
37280
  let expectedTurnId;
37172
37281
  try {
@@ -37174,7 +37283,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37174
37283
  expectedTurnId = host.getActiveTurnId(threadId);
37175
37284
  } catch {
37176
37285
  }
37177
- const text2 = Array.isArray(input3) ? input3.filter((item) => isRecord8(item) && typeof item.text === "string").map((item) => item.text).join("\n") : void 0;
37286
+ const text2 = Array.isArray(input3) ? input3.filter((item) => isRecord9(item) && typeof item.text === "string").map((item) => item.text).join("\n") : void 0;
37178
37287
  const delivery = await inspectDelivery(threadId, text2);
37179
37288
  if (disposed) throw new Error("External steering binding was disposed");
37180
37289
  if (delivery === "official") return originalSteer.apply(manager, args);
@@ -37190,21 +37299,21 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37190
37299
  }
37191
37300
  if (!host) throw new Error("Desktop turn submission binding is unavailable");
37192
37301
  const currentRole = manager.getStreamRole?.(threadId);
37193
- if (isRecord8(currentRole) && currentRole.role === "follower")
37302
+ if (isRecord9(currentRole) && currentRole.role === "follower")
37194
37303
  return originalSteer.apply(manager, args);
37195
37304
  if (!Array.isArray(input3) || input3.length === 0 || input3.some((item) => {
37196
- if (!isRecord8(item)) return true;
37305
+ if (!isRecord9(item)) return true;
37197
37306
  if (item.type === "text") return typeof item.text !== "string";
37198
37307
  if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
37199
37308
  if (item.type === "image") return typeof item.url !== "string" || !item.url;
37200
37309
  return true;
37201
37310
  }) || !input3.some(
37202
- (item) => isRecord8(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
37311
+ (item) => isRecord9(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
37203
37312
  )) {
37204
37313
  throw new Error("External steering requires non-empty text or image input");
37205
37314
  }
37206
37315
  if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
37207
- if (!isRecord8(restoreMessage) || !isRecord8(restoreMessage.context)) {
37316
+ if (!isRecord9(restoreMessage) || !isRecord9(restoreMessage.context)) {
37208
37317
  throw new Error("Desktop steering message context is unavailable");
37209
37318
  }
37210
37319
  const messageId = typeof clientUserMessageId === "string" && clientUserMessageId ? clientUserMessageId : typeof restoreMessage.id === "string" && restoreMessage.id ? restoreMessage.id : crypto.randomUUID();
@@ -37221,7 +37330,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37221
37330
  if (expectedTurnId == null && host.hasPendingTurnStart(threadId)) {
37222
37331
  throw new Error("Previous Turn submission has not been confirmed yet");
37223
37332
  }
37224
- const context2 = restoreMessage.context;
37333
+ const context = restoreMessage.context;
37225
37334
  const routeKey = `${threadId}\0${messageId}`;
37226
37335
  if (typeof expectedTurnId === "string") routes.set(routeKey, { threadId, expectedTurnId });
37227
37336
  const promise2 = Promise.resolve().then(async () => {
@@ -37241,12 +37350,12 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37241
37350
  serviceTier,
37242
37351
  model: null,
37243
37352
  effort: null,
37244
- collaborationMode: context2.collaborationMode ?? null
37353
+ collaborationMode: context.collaborationMode ?? null
37245
37354
  },
37246
37355
  context: {
37247
37356
  attachments: attachments ?? [],
37248
- commentAttachments: context2.commentAttachments ?? [],
37249
- mcpAppModelContextAttachments: context2.mcpAppModelContextAttachments,
37357
+ commentAttachments: context.commentAttachments ?? [],
37358
+ mcpAppModelContextAttachments: context.mcpAppModelContextAttachments,
37250
37359
  useAppServerPermissionDefault: true,
37251
37360
  beforeSendRequest,
37252
37361
  assertRequestCurrent
@@ -37254,7 +37363,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37254
37363
  },
37255
37364
  onMessageAdded
37256
37365
  );
37257
- if (!isRecord8(response) || !isRecord8(response.turn) || typeof response.turn.id !== "string") {
37366
+ if (!isRecord9(response) || !isRecord9(response.turn) || typeof response.turn.id !== "string") {
37258
37367
  throw new Error("Desktop returned no replacement Turn identity");
37259
37368
  }
37260
37369
  try {
@@ -37285,7 +37394,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37285
37394
  }
37286
37395
 
37287
37396
  // src/renderer-remote-attachments.ts
37288
- function isRecord9(value) {
37397
+ function isRecord10(value) {
37289
37398
  return value !== null && typeof value === "object" && !Array.isArray(value);
37290
37399
  }
37291
37400
  var MAX_IMAGE_BYTES = 20 * 1024 * 1024;
@@ -37327,14 +37436,14 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37327
37436
  function createRemoteAttachmentSender(target2, hostId2, isCurrent) {
37328
37437
  const prepared = /* @__PURE__ */ new WeakMap();
37329
37438
  return (params, send) => {
37330
- if (hostId2 === "local" || !isRecord9(target2) || !isRecord9(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target2.getConversation !== "function")
37439
+ if (hostId2 === "local" || !isRecord10(target2) || !isRecord10(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target2.getConversation !== "function")
37331
37440
  return send(params);
37332
37441
  const images = params.input.filter(
37333
- (item) => isRecord9(item) && (item.type === "image" || item.type === "localImage")
37442
+ (item) => isRecord10(item) && (item.type === "image" || item.type === "localImage")
37334
37443
  );
37335
37444
  if (images.length === 0) return send(params);
37336
37445
  const conversation = target2.getConversation.call(target2, params.threadId);
37337
- if (!isRecord9(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
37446
+ if (!isRecord10(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
37338
37447
  return send(params);
37339
37448
  const assertCurrent = () => {
37340
37449
  if (!isCurrent()) throw new Error("Remote attachment connection is no longer available");
@@ -37347,7 +37456,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37347
37456
  const cached2 = prepared.get(params);
37348
37457
  if (cached2) return cached2.then(dispatch);
37349
37458
  const input3 = params.input;
37350
- const text2 = input3.filter((item) => isRecord9(item) && item.type === "text").map((item) => isRecord9(item) && typeof item.text === "string" ? item.text : "").join("\n");
37459
+ const text2 = input3.filter((item) => isRecord10(item) && item.type === "text").map((item) => isRecord10(item) && typeof item.text === "string" ? item.text : "").join("\n");
37351
37460
  const existingPaths = desktopImageAttachmentPaths(text2);
37352
37461
  const prepare = async () => {
37353
37462
  if (existingPaths.length === images.length) return params;
@@ -37379,7 +37488,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37379
37488
  contents: file2.contents,
37380
37489
  label: `image-${index + 1}.${file2.extension}`
37381
37490
  });
37382
- if (!isRecord9(saved) || !filePath2(saved.path) || saved.fsPath !== saved.path) {
37491
+ if (!isRecord10(saved) || !filePath2(saved.path) || saved.fsPath !== saved.path) {
37383
37492
  throw new Error("Desktop returned an invalid remote attachment path");
37384
37493
  }
37385
37494
  created.push(saved.path);
@@ -37430,10 +37539,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37430
37539
  }
37431
37540
 
37432
37541
  // src/renderer-thread-reference-persistence.ts
37433
- var record10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37542
+ var record11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37434
37543
  var SYNC_TIMEOUT_MS = 2e3;
37435
37544
  function restoreRpcThreadReferenceCapability(client, messages, isCurrent) {
37436
- if (!record10(messages) || !record10(messages.electronBridge)) return client;
37545
+ if (!record11(messages) || !record11(messages.electronBridge)) return client;
37437
37546
  const bridge = messages.electronBridge;
37438
37547
  const send = bridge.sendMessageFromView;
37439
37548
  if (typeof send !== "function") return client;
@@ -37448,7 +37557,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37448
37557
  const listener = (event) => {
37449
37558
  if (event.source != null && event.source !== messages) return;
37450
37559
  const message2 = event.data;
37451
- if (!record10(message2) || message2.type !== "persisted-atom-sync" || !record10(message2.state))
37560
+ if (!record11(message2) || message2.type !== "persisted-atom-sync" || !record11(message2.state))
37452
37561
  return;
37453
37562
  finish(!Object.hasOwn(message2.state, key2));
37454
37563
  };
@@ -37489,12 +37598,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37489
37598
  }
37490
37599
 
37491
37600
  // src/renderer-thread-reference-capability.ts
37492
- var record11 = (value) => typeof value === "object" && value !== null;
37601
+ var record12 = (value) => typeof value === "object" && value !== null;
37493
37602
  function restoreThreadReferenceCapability(client, manager, isCurrent, messages = null) {
37494
- if (record11(manager) && manager.kind === "main-process-rpc") {
37603
+ if (record12(manager) && manager.kind === "main-process-rpc") {
37495
37604
  return restoreRpcThreadReferenceCapability(client, messages, isCurrent);
37496
37605
  }
37497
- if (!record11(manager) || !record11(manager.storage)) return client;
37606
+ if (!record12(manager) || !record12(manager.storage)) return client;
37498
37607
  const storage = manager.storage;
37499
37608
  const read = storage.readValue;
37500
37609
  const write = storage.writeValue;
@@ -37529,30 +37638,65 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37529
37638
  }
37530
37639
 
37531
37640
  // src/renderer-thread-reference-context.ts
37532
- var record12 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37533
- function createThreadReferenceContext(manager, hostId2, isCurrent) {
37641
+ var record13 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37642
+ function captureThreadReferenceGeneration(routing, hostId2) {
37643
+ const expected = routing?.connectionGeneration?.(hostId2);
37644
+ return () => {
37645
+ const current = routing?.connectionGeneration?.(hostId2);
37646
+ return expected !== null && current !== null && current?.owner === expected?.owner && current?.revision === expected?.revision;
37647
+ };
37648
+ }
37649
+ async function supportsThreadReferenceContext(send) {
37650
+ let timer;
37651
+ try {
37652
+ const result = await Promise.race([
37653
+ send(THREAD_REFERENCE_CONTEXT_CAPABILITY_METHOD, {}),
37654
+ new Promise((resolve) => {
37655
+ timer = setTimeout(() => resolve(null), 1500);
37656
+ })
37657
+ ]);
37658
+ return record13(result) && result.threadReferenceContext === true;
37659
+ } catch {
37660
+ return false;
37661
+ } finally {
37662
+ clearTimeout(timer);
37663
+ }
37664
+ }
37665
+ function createThreadReferenceContext(manager, hostId2, isCurrent, readRouting) {
37534
37666
  const prepared = /* @__PURE__ */ new WeakMap();
37535
- return (params) => {
37536
- if (hostId2 === "local" || !record12(manager) || typeof manager.getConversation !== "function" || !record12(params) || typeof params.threadId !== "string")
37537
- return params;
37667
+ return (params, send) => {
37668
+ if (hostId2 === "local" || !record13(manager) || typeof manager.getConversation !== "function" || !record13(params) || typeof params.threadId !== "string")
37669
+ return send(params);
37538
37670
  const conversation = manager.getConversation.call(manager, params.threadId);
37539
- if (!record12(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
37540
- return params;
37671
+ if (!record13(conversation) || conversation.id !== params.threadId) return send(params);
37672
+ const external = conversation.modelProvider === "codexhost";
37673
+ if (!external && !isDesktopSshHostId(hostId2)) return send(params);
37674
+ const forward = (supported) => {
37675
+ if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
37676
+ if (!supported) return send(params);
37677
+ let result = prepared.get(params);
37678
+ if (!result) {
37679
+ result = { ...params, [THREAD_REFERENCE_SOURCE_HOST_PARAM]: hostId2 };
37680
+ prepared.set(params, result);
37681
+ }
37682
+ return send(result);
37683
+ };
37684
+ const request = manager.sendRequest;
37685
+ if (external) return forward(true);
37541
37686
  if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
37542
- const cached2 = prepared.get(params);
37543
- if (cached2) return cached2;
37544
- const result = { ...params, [THREAD_REFERENCE_SOURCE_HOST_PARAM]: hostId2 };
37545
- prepared.set(params, result);
37546
- return result;
37687
+ const isSameGeneration = captureThreadReferenceGeneration(readRouting?.(), hostId2);
37688
+ return typeof request === "function" ? supportsThreadReferenceContext(
37689
+ (method, input3) => request.call(manager, method, input3)
37690
+ ).then((supported) => forward(supported && isSameGeneration())) : forward(false);
37547
37691
  };
37548
37692
  }
37549
37693
 
37550
37694
  // src/renderer-manual-compaction.ts
37551
- function isRecord10(value) {
37695
+ function isRecord11(value) {
37552
37696
  return value !== null && typeof value === "object" && !Array.isArray(value);
37553
37697
  }
37554
37698
  function installRendererManualCompaction(target2, hostId2, messages) {
37555
- if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord10(target2) || typeof target2.registerPendingManualContextCompaction !== "function" || typeof target2.getConversation !== "function") {
37699
+ if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord11(target2) || typeof target2.registerPendingManualContextCompaction !== "function" || typeof target2.getConversation !== "function") {
37556
37700
  return null;
37557
37701
  }
37558
37702
  const register2 = target2.registerPendingManualContextCompaction;
@@ -37561,18 +37705,18 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37561
37705
  const listener = (event) => {
37562
37706
  if (event.source != null && event.source !== messages) return;
37563
37707
  const message2 = event.data;
37564
- if (!isRecord10(message2) || message2.type !== "mcp-notification" || message2.hostId !== hostId2 || message2.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
37708
+ if (!isRecord11(message2) || message2.type !== "mcp-notification" || message2.hostId !== hostId2 || message2.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
37565
37709
  return;
37566
37710
  }
37567
37711
  const params = threadManualCompactionStartedSchema.safeParse(message2.params);
37568
37712
  if (!params.success) return;
37569
37713
  const { threadId } = params.data;
37570
37714
  const conversation = getConversation.call(target2, threadId);
37571
- if (!isRecord10(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
37715
+ if (!isRecord11(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
37572
37716
  return;
37573
37717
  }
37574
37718
  const role = getStreamRole?.call(target2, threadId);
37575
- if (isRecord10(role) && role.role === "follower") return;
37719
+ if (isRecord11(role) && role.role === "follower") return;
37576
37720
  register2.call(target2, threadId);
37577
37721
  };
37578
37722
  messages.addEventListener("message", listener);
@@ -37671,7 +37815,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37671
37815
  createThreadReferenceContext(
37672
37816
  target2,
37673
37817
  route.hostId,
37674
- () => !disposed && readRouting()?.forHost(route.hostId) === route
37818
+ () => !disposed && readRouting()?.forHost(route.hostId) === route,
37819
+ readRouting
37675
37820
  )
37676
37821
  ),
37677
37822
  () => installRendererManualCompaction(target2, route.hostId, messages)
@@ -37749,7 +37894,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37749
37894
  var SIDEBAR_AGENT_ICON_ATTRIBUTE = "data-codexhost-sidebar-agent-icon";
37750
37895
  var SIDEBAR_AGENT_ICON_ROW_SELECTOR = `${SIDEBAR_THREAD_ROW_SELECTOR}, ${NATIVE_SCHEDULE_SIDEBAR_ROW_SELECTOR}`;
37751
37896
  var OWNERSHIP_RETRY_DELAYS_MS = [100, 300, 800, 1500, 3e3];
37752
- function isRecord11(value) {
37897
+ function isRecord12(value) {
37753
37898
  return typeof value === "object" && value !== null && !Array.isArray(value);
37754
37899
  }
37755
37900
  function sidebarThreadAttributes(element) {
@@ -37776,19 +37921,19 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37776
37921
  const fiberName = fiberNames[0];
37777
37922
  if (fiberNames.length !== 1 || !fiberName) return null;
37778
37923
  const firstFiber2 = Object.getOwnPropertyDescriptor(element, fiberName)?.value;
37779
- if (!isRecord11(firstFiber2)) return null;
37924
+ if (!isRecord12(firstFiber2)) return null;
37780
37925
  const candidates = /* @__PURE__ */ new Set();
37781
37926
  let fiber = firstFiber2;
37782
37927
  for (let depth = 0; fiber && depth < 12; depth += 1) {
37783
37928
  const props = fiber.memoizedProps;
37784
- if (isRecord11(props) && isRecord11(props.dataAttributes)) {
37929
+ if (isRecord12(props) && isRecord12(props.dataAttributes)) {
37785
37930
  const dataAttributes = props.dataAttributes;
37786
37931
  const threadId = hostThreadIdSchema.safeParse(props.conversationId);
37787
37932
  if (threadId.success && dataAttributes[SIDEBAR_THREAD_ROW_ATTRIBUTE] === rowMarker && dataAttributes[SIDEBAR_THREAD_ID_ATTRIBUTE] === taskKey && dataAttributes[SIDEBAR_THREAD_HOST_ID_ATTRIBUTE] === hostId2) {
37788
37933
  candidates.add(threadId.data);
37789
37934
  }
37790
37935
  }
37791
- fiber = isRecord11(fiber.return) ? fiber.return : null;
37936
+ fiber = isRecord12(fiber.return) ? fiber.return : null;
37792
37937
  }
37793
37938
  return candidates.size === 1 ? candidates.values().next().value ?? null : null;
37794
37939
  }
@@ -38285,7 +38430,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38285
38430
  if (row) finish(row);
38286
38431
  });
38287
38432
  }
38288
- function isRecord12(value) {
38433
+ function isRecord13(value) {
38289
38434
  return typeof value === "object" && value !== null && !Array.isArray(value);
38290
38435
  }
38291
38436
  function firstFiber(element) {
@@ -38295,7 +38440,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38295
38440
  const name = names[0];
38296
38441
  if (names.length !== 1 || !name) return null;
38297
38442
  const value = Object.getOwnPropertyDescriptor(element, name)?.value;
38298
- return isRecord12(value) ? value : null;
38443
+ return isRecord13(value) ? value : null;
38299
38444
  }
38300
38445
  function directForkAncestors(first) {
38301
38446
  const ancestors2 = [];
@@ -38305,7 +38450,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38305
38450
  if (seen.has(fiber)) return [];
38306
38451
  seen.add(fiber);
38307
38452
  ancestors2.push(fiber);
38308
- fiber = isRecord12(fiber.return) ? fiber.return : null;
38453
+ fiber = isRecord13(fiber.return) ? fiber.return : null;
38309
38454
  }
38310
38455
  return ancestors2;
38311
38456
  }
@@ -38323,7 +38468,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38323
38468
  let hasForkCallback = false;
38324
38469
  for (const fiber of ancestors2) {
38325
38470
  const props = fiber.memoizedProps;
38326
- if (!isRecord12(props)) continue;
38471
+ if (!isRecord13(props)) continue;
38327
38472
  if (!hasForkCallback && typeof props.onFork !== "function" && ownsOtherCallback(fiber, props)) {
38328
38473
  return null;
38329
38474
  }
@@ -38355,7 +38500,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38355
38500
  if (!threadId.success || !turnId.success) return null;
38356
38501
  const fiber = firstFiber(button2);
38357
38502
  const buttonProps = fiber?.memoizedProps;
38358
- if (!fiber || !isRecord12(buttonProps) || !Object.hasOwn(buttonProps, "aria-busy")) return null;
38503
+ if (!fiber || !isRecord13(buttonProps) || !Object.hasOwn(buttonProps, "aria-busy")) return null;
38359
38504
  return forkTargetFromAncestors(button2, threadId.data, turnId.data, directForkAncestors(fiber)) ?? forkTargetFromAncestors(button2, threadId.data, turnId.data, committedReactAncestors(fiber));
38360
38505
  }
38361
38506
  var BrowserRendererForkDom = class {
@@ -38421,16 +38566,16 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38421
38566
  // src/codex-locale-adapter.ts
38422
38567
  var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
38423
38568
  function isNativeLocaleServices(value) {
38424
- if (!isRecord13(value) || !Object.hasOwn(value, "appInfo")) return false;
38569
+ if (!isRecord14(value) || !Object.hasOwn(value, "appInfo")) return false;
38425
38570
  const appInfo = value.appInfo;
38426
38571
  return appInfo != null && typeof appInfo.getLocaleInfo === "function";
38427
38572
  }
38428
38573
  function isNativeSettingsServices(value) {
38429
- if (!isRecord13(value) || !Object.hasOwn(value, "settings")) return false;
38574
+ if (!isRecord14(value) || !Object.hasOwn(value, "settings")) return false;
38430
38575
  const settings = value.settings;
38431
38576
  return typeof settings?.read === "function" && typeof settings?.write === "function";
38432
38577
  }
38433
- function isRecord13(value) {
38578
+ function isRecord14(value) {
38434
38579
  return typeof value === "object" && value !== null && !Array.isArray(value);
38435
38580
  }
38436
38581
  function canonicalLocale(value) {
@@ -38452,7 +38597,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38452
38597
  return new DOMException("The operation was aborted", "AbortError");
38453
38598
  }
38454
38599
  function parseLocaleOverride(response) {
38455
- if (!isRecord13(response) || !Object.hasOwn(response, "effective")) {
38600
+ if (!isRecord14(response) || !Object.hasOwn(response, "effective")) {
38456
38601
  throw new Error("Codex native locale override response is malformed");
38457
38602
  }
38458
38603
  if (response.effective === null) return null;
@@ -38467,7 +38612,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
38467
38612
  return locale;
38468
38613
  }
38469
38614
  function parseLocaleInfo(value) {
38470
- if (!isRecord13(value)) throw new Error("Codex locale info response is malformed");
38615
+ if (!isRecord14(value)) throw new Error("Codex locale info response is malformed");
38471
38616
  return {
38472
38617
  ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
38473
38618
  systemLocale: optionalLocale(value.systemLocale, "system locale")
@@ -39285,7 +39430,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39285
39430
  }
39286
39431
  var DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS = 1e4;
39287
39432
  var DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS = 25;
39288
- function isRecord14(value) {
39433
+ function isRecord15(value) {
39289
39434
  return typeof value === "object" && value !== null && !Array.isArray(value);
39290
39435
  }
39291
39436
  function decodeOpenCodeTransportModelId(value) {
@@ -39450,7 +39595,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39450
39595
  let fiber = findComposerFiber(composer);
39451
39596
  for (let depth = 0; fiber && depth < 120; depth += 1) {
39452
39597
  const props = fiber.memoizedProps;
39453
- if (isRecord14(props) && "conversationId" in props && props.conversationId != null) {
39598
+ if (isRecord15(props) && "conversationId" in props && props.conversationId != null) {
39454
39599
  const candidate = hostThreadIdSchema.safeParse(props.conversationId);
39455
39600
  if (!candidate.success || threadId !== void 0 && threadId !== candidate.data) {
39456
39601
  return null;
@@ -39463,12 +39608,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39463
39608
  return threadId;
39464
39609
  }
39465
39610
  function isLegacySevenSlotDraftWrapper(value) {
39466
- if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord14(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
39611
+ if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord15(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
39467
39612
  return false;
39468
39613
  }
39469
39614
  try {
39470
39615
  const draft = value[3].get();
39471
- return isRecord14(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
39616
+ return isRecord15(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
39472
39617
  } catch {
39473
39618
  return false;
39474
39619
  }
@@ -39502,8 +39647,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39502
39647
  let fiber = findComposerFiber(composer);
39503
39648
  for (let depth = 0; fiber && depth < 120; depth += 1) {
39504
39649
  const updateQueue = fiber.updateQueue;
39505
- const memoCache = isRecord14(updateQueue) ? updateQueue.memoCache : null;
39506
- const data = isRecord14(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
39650
+ const memoCache = isRecord15(updateQueue) ? updateQueue.memoCache : null;
39651
+ const data = isRecord15(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
39507
39652
  for (const value of data) {
39508
39653
  const draftId = draftIdFromMemoValue(value);
39509
39654
  if (draftId) draftIds.add(draftId);
@@ -39531,7 +39676,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39531
39676
  return ["default", draftIds.values().next().value];
39532
39677
  }
39533
39678
  function isDraftPrewarmPolicyReady(value) {
39534
- return isRecord14(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
39679
+ return isRecord15(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
39535
39680
  }
39536
39681
  async function waitForRendererDraftPrewarmPolicy(target2, composer) {
39537
39682
  const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
@@ -39849,11 +39994,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39849
39994
  return null;
39850
39995
  }
39851
39996
  }
39852
- function isRecord15(value) {
39997
+ function isRecord16(value) {
39853
39998
  return typeof value === "object" && value !== null && !Array.isArray(value);
39854
39999
  }
39855
40000
  function parseExternalConfiguration(value) {
39856
- if (!isRecord15(value)) return void 0;
40001
+ if (!isRecord16(value)) return void 0;
39857
40002
  const model2 = harnessModelRefSchema.safeParse(value.model);
39858
40003
  if (!model2.success) return void 0;
39859
40004
  const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
@@ -39870,10 +40015,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
39870
40015
  const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
39871
40016
  if (!raw) return void 0;
39872
40017
  const parsed = JSON.parse(raw);
39873
- if (!isRecord15(parsed) || parsed.version !== 1) return void 0;
40018
+ if (!isRecord16(parsed) || parsed.version !== 1) return void 0;
39874
40019
  if (parsed.lastAgent !== "codex" && !harnessPluginIdSchema.safeParse(parsed.lastAgent).success)
39875
40020
  return void 0;
39876
- const externalByAgent = isRecord15(parsed.externalByAgent) ? parsed.externalByAgent : {};
40021
+ const externalByAgent = isRecord16(parsed.externalByAgent) ? parsed.externalByAgent : {};
39877
40022
  const parsedExternal = Object.fromEntries(
39878
40023
  Object.keys(externalByAgent).filter((agent) => harnessPluginIdSchema.safeParse(agent).success).flatMap((agent) => {
39879
40024
  const configuration = parseExternalConfiguration(externalByAgent[agent]);
@@ -40104,7 +40249,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40104
40249
  }
40105
40250
  };
40106
40251
  const track = (teardown) => {
40107
- guard();
40252
+ try {
40253
+ guard();
40254
+ } catch (error62) {
40255
+ teardown();
40256
+ throw error62;
40257
+ }
40108
40258
  teardowns.add(teardown);
40109
40259
  return () => {
40110
40260
  if (teardowns.delete(teardown)) teardown();
@@ -40153,7 +40303,20 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40153
40303
  watchTree(callback) {
40154
40304
  guard();
40155
40305
  return track(bridge.watchTree((snapshot) => delivery(callback, snapshot)));
40156
- }
40306
+ },
40307
+ ...bridge.watchUnread ? {
40308
+ watchUnread(threadIds, callback) {
40309
+ guard();
40310
+ if (!Array.isArray(threadIds) || threadIds.length > THREAD_TREE_MAX_NODES || threadIds.some((id3) => !hostThreadIdSchema.safeParse(id3).success))
40311
+ throw new Error("Invalid Desktop unread Thread ids");
40312
+ return track(
40313
+ bridge.watchUnread(
40314
+ [...new Set(threadIds)],
40315
+ (snapshot) => delivery(callback, Object.freeze({ ...snapshot }))
40316
+ )
40317
+ );
40318
+ }
40319
+ } : {}
40157
40320
  },
40158
40321
  navigate: {
40159
40322
  async openThread(threadId) {
@@ -40493,11 +40656,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40493
40656
  }
40494
40657
  };
40495
40658
  const registerSettingsPage = (extensionId, page) => {
40496
- const record17 = { page, revision: ++settingsPageRevision };
40497
- customSettingsPages.set(extensionId, record17);
40659
+ const record19 = { page, revision: ++settingsPageRevision };
40660
+ customSettingsPages.set(extensionId, record19);
40498
40661
  notifySettingsPages();
40499
40662
  return () => {
40500
- if (customSettingsPages.get(extensionId) !== record17) return;
40663
+ if (customSettingsPages.get(extensionId) !== record19) return;
40501
40664
  customSettingsPages.delete(extensionId);
40502
40665
  notifySettingsPages();
40503
40666
  };
@@ -40643,15 +40806,15 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40643
40806
  const getRegisteredSettingsPages = () => {
40644
40807
  const pages = [];
40645
40808
  const seen = /* @__PURE__ */ new Set();
40646
- for (const [extensionId, record17] of customSettingsPages) {
40809
+ for (const [extensionId, record19] of customSettingsPages) {
40647
40810
  const instance = instances.get(extensionId);
40648
- const title = record17.page.title ?? instance?.name;
40811
+ const title = record19.page.title ?? instance?.name;
40649
40812
  pages.push({
40650
40813
  extensionId,
40651
40814
  kind: "custom",
40652
- revision: record17.revision,
40815
+ revision: record19.revision,
40653
40816
  ...title !== void 0 ? { title } : {},
40654
- page: record17.page
40817
+ page: record19.page
40655
40818
  });
40656
40819
  seen.add(extensionId);
40657
40820
  }
@@ -41408,6 +41571,17 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
41408
41571
  const shared = targetSlots.filter((slot2) => otherSlots.includes(slot2));
41409
41572
  return shared.length > 0 ? shared : targetSlots;
41410
41573
  }
41574
+ function findDesktopSlotConflictForExtension(item, list) {
41575
+ if (item.state !== "valid") return void 0;
41576
+ if (item.desktopConflictWith) return item.desktopConflictWith;
41577
+ if (!item.manifest.desktop || !item.manifest.slots?.length) return void 0;
41578
+ return resolveDesktopExtensionSlots(
41579
+ [...list.configuration.enabled.filter((id2) => id2 !== item.id), item.id],
41580
+ list.extensions.filter(
41581
+ (entry) => entry.state === "valid" && Boolean(entry.manifest.desktop)
41582
+ ).map(({ id: id2, manifest }) => ({ id: id2, slots: manifest.slots ?? [] }))
41583
+ ).conflicts.get(item.id);
41584
+ }
41411
41585
  function isToggleBlocked(item) {
41412
41586
  if (item.enabled) return false;
41413
41587
  return item.state !== "valid";
@@ -41815,15 +41989,15 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
41815
41989
  id: pageId,
41816
41990
  label: label.slice(0, 64),
41817
41991
  icon: icon2 && isRendererSettingsIconName(icon2) ? icon2 : "extensions",
41818
- mount(context2) {
41992
+ mount(context) {
41819
41993
  const container = createEl(
41820
- context2.content.ownerDocument,
41994
+ context.content.ownerDocument,
41821
41995
  "div",
41822
41996
  "settings-extension-plugin-page"
41823
41997
  );
41824
41998
  container.dataset.extensionId = extensionId;
41825
41999
  container.dataset.settingsMode = "custom";
41826
- context2.content.append(container);
42000
+ context.content.append(container);
41827
42001
  const cleanup = contribution.mount(container, {
41828
42002
  locale: messages.locale,
41829
42003
  storage: services.storage,
@@ -43388,8 +43562,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43388
43562
  id: "usage-statistics",
43389
43563
  label: messages.label,
43390
43564
  icon: "dashboard",
43391
- mount(context2) {
43392
- const document2 = context2.content.ownerDocument;
43565
+ mount(context) {
43566
+ const document2 = context.content.ownerDocument;
43393
43567
  const locale = pageLocale ?? (document2.documentElement.lang || "en");
43394
43568
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
43395
43569
  const count3 = (value) => count2(value, locale);
@@ -43447,7 +43621,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43447
43621
  document2,
43448
43622
  consoleMessages2,
43449
43623
  (method, params2) => request(method, params2, view.hostId),
43450
- context2.signal,
43624
+ context.signal,
43451
43625
  load
43452
43626
  );
43453
43627
  let offeredHosts = usageHosts ? [] : void 0;
@@ -43455,7 +43629,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43455
43629
  label: messages.host,
43456
43630
  searchLabel: messages.search,
43457
43631
  emptyLabel: messages.noMatches,
43458
- signal: context2.signal,
43632
+ signal: context.signal,
43459
43633
  searchable: false,
43460
43634
  display: (option) => `${messages.host} \xB7 ${option.label}`,
43461
43635
  onChange: (key2) => {
@@ -43485,7 +43659,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43485
43659
  const offerHosts = () => {
43486
43660
  if (!usageHosts) return;
43487
43661
  void usageHosts().then((hosts) => {
43488
- if (context2.signal.aborted) return;
43662
+ if (context.signal.aborted) return;
43489
43663
  offeredHosts = hosts;
43490
43664
  hostOptions();
43491
43665
  }).catch(() => void 0);
@@ -43511,7 +43685,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43511
43685
  label: messages.autoRefresh,
43512
43686
  searchLabel: messages.search,
43513
43687
  emptyLabel: messages.noMatches,
43514
- signal: context2.signal,
43688
+ signal: context.signal,
43515
43689
  searchable: false,
43516
43690
  display: (option) => `${messages.autoRefresh} \xB7 ${option.label}`,
43517
43691
  onChange: (key2) => {
@@ -43556,7 +43730,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43556
43730
  label: messages.filterModel,
43557
43731
  searchLabel: messages.search,
43558
43732
  emptyLabel: messages.noMatches,
43559
- signal: context2.signal,
43733
+ signal: context.signal,
43560
43734
  onChange: (key2) => {
43561
43735
  view.model = key2;
43562
43736
  changed();
@@ -43566,7 +43740,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43566
43740
  label: messages.filterProject,
43567
43741
  searchLabel: messages.search,
43568
43742
  emptyLabel: messages.noMatches,
43569
- signal: context2.signal,
43743
+ signal: context.signal,
43570
43744
  onChange: (key2) => {
43571
43745
  view.project = key2;
43572
43746
  changed();
@@ -44354,7 +44528,7 @@ ${detail}` : ""}`
44354
44528
  }
44355
44529
  function schedule() {
44356
44530
  window.clearTimeout(poll);
44357
- if (context2.signal.aborted) return;
44531
+ if (context.signal.aborted) return;
44358
44532
  if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
44359
44533
  else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
44360
44534
  }
@@ -44372,12 +44546,12 @@ ${detail}` : ""}`
44372
44546
  } catch {
44373
44547
  if (!isCurrent()) return;
44374
44548
  }
44375
- if (!context2.signal.aborted) render();
44549
+ if (!context.signal.aborted) render();
44376
44550
  }
44377
44551
  function load() {
44378
44552
  window.clearTimeout(poll);
44379
44553
  const requested = params();
44380
- void context2.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
44554
+ void context.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
44381
44555
  success(value) {
44382
44556
  const parsed = usageStatisticsResultSchema.safeParse(value);
44383
44557
  if (parsed.success) {
@@ -44400,7 +44574,7 @@ ${detail}` : ""}`
44400
44574
  }
44401
44575
  });
44402
44576
  }
44403
- context2.content.replaceChildren(header, prices.element, filters, notices, body);
44577
+ context.content.replaceChildren(header, prices.element, filters, notices, body);
44404
44578
  render();
44405
44579
  offerHosts();
44406
44580
  void refreshHarnessNames();
@@ -46299,8 +46473,8 @@ ${detail}` : ""}`
46299
46473
  id: "session-import",
46300
46474
  label: messages.pageLabels["session-import"],
46301
46475
  icon: "session-import",
46302
- mount(context2) {
46303
- const document2 = context2.content.ownerDocument;
46476
+ mount(context) {
46477
+ const document2 = context.content.ownerDocument;
46304
46478
  const header = document2.createElement("div");
46305
46479
  header.className = "settings-session-import-header";
46306
46480
  const heading = document2.createElement("h2");
@@ -46420,7 +46594,7 @@ ${detail}` : ""}`
46420
46594
  const content = document2.createElement("section");
46421
46595
  content.className = "settings-session-import-content";
46422
46596
  const listControls = createSessionImportListControls(document2, messages, () => load());
46423
- context2.content.append(
46597
+ context.content.append(
46424
46598
  header,
46425
46599
  hostLabel,
46426
46600
  harness2,
@@ -46553,7 +46727,7 @@ ${detail}` : ""}`
46553
46727
  retry.addEventListener("click", () => {
46554
46728
  if (retry.disabled) return;
46555
46729
  setRetrying(true);
46556
- void context2.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
46730
+ void context.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
46557
46731
  success() {
46558
46732
  setRetrying(false);
46559
46733
  },
@@ -46644,7 +46818,7 @@ ${detail}` : ""}`
46644
46818
  refresh.disabled = true;
46645
46819
  updateImportActions();
46646
46820
  let committedThreadId = null;
46647
- void context2.runLatest(
46821
+ void context.runLatest(
46648
46822
  async (signal) => {
46649
46823
  importStatus.replaceChildren();
46650
46824
  const result = await client.importHarnessSession({
@@ -46688,7 +46862,7 @@ ${detail}` : ""}`
46688
46862
  updateImportActions();
46689
46863
  };
46690
46864
  const load = (refreshDiagnostics = false) => {
46691
- if (importingId !== null || context2.signal.aborted) return;
46865
+ if (importingId !== null || context.signal.aborted) return;
46692
46866
  loadedClient = null;
46693
46867
  let client = getClient(selectedHostId);
46694
46868
  if (client?.hostId === "durable") {
@@ -46704,7 +46878,7 @@ ${detail}` : ""}`
46704
46878
  else renderUnavailable();
46705
46879
  const requestedHarness = selectedHarness;
46706
46880
  const pageParams = listControls.params();
46707
- void context2.runLatest(
46881
+ void context.runLatest(
46708
46882
  async (signal) => {
46709
46883
  if (!client) throw new RendererSessionImportUnavailableError();
46710
46884
  const harnesses = await loadSessionImportSources(
@@ -46770,8 +46944,8 @@ ${detail}` : ""}`
46770
46944
  }
46771
46945
 
46772
46946
  // src/settings/loaded-sessions-table.ts
46773
- function mountLoadedSessionsTable(context2, messages, getClient) {
46774
- const document2 = context2.content.ownerDocument;
46947
+ function mountLoadedSessionsTable(context, messages, getClient) {
46948
+ const document2 = context.content.ownerDocument;
46775
46949
  const owner = document2.defaultView;
46776
46950
  if (!owner) return () => void 0;
46777
46951
  const text2 = messages.loadedSessions;
@@ -46807,7 +46981,7 @@ ${detail}` : ""}`
46807
46981
  scroll.hidden = true;
46808
46982
  header.append(title, description);
46809
46983
  container.append(header, status, scroll);
46810
- context2.content.append(container);
46984
+ context.content.append(container);
46811
46985
  let disposed = false;
46812
46986
  let timer;
46813
46987
  let requestTimer;
@@ -46829,7 +47003,7 @@ ${detail}` : ""}`
46829
47003
  );
46830
47004
  })
46831
47005
  ]);
46832
- if (disposed || context2.signal.aborted) return;
47006
+ if (disposed || context.signal.aborted) return;
46833
47007
  body.replaceChildren();
46834
47008
  for (const row of rows.toSorted(
46835
47009
  (a, b) => b.inactiveMs - a.inactiveMs || a.harnessId.localeCompare(b.harnessId) || a.threadId.localeCompare(b.threadId)
@@ -46853,13 +47027,13 @@ ${detail}` : ""}`
46853
47027
  status.hidden = rows.length > 0;
46854
47028
  scroll.hidden = rows.length === 0;
46855
47029
  } catch (error62) {
46856
- if (disposed || context2.signal.aborted) return;
47030
+ if (disposed || context.signal.aborted) return;
46857
47031
  status.textContent = error62 instanceof RendererMethodUnavailableError ? text2.unavailable : text2.failed;
46858
47032
  status.hidden = false;
46859
47033
  scroll.hidden = true;
46860
47034
  } finally {
46861
47035
  owner.clearTimeout(requestTimer);
46862
- if (!disposed && !context2.signal.aborted)
47036
+ if (!disposed && !context.signal.aborted)
46863
47037
  timer = owner.setTimeout(() => void refresh(), 1e4);
46864
47038
  }
46865
47039
  };
@@ -46872,8 +47046,8 @@ ${detail}` : ""}`
46872
47046
  }
46873
47047
 
46874
47048
  // src/settings/idle-release-controls.ts
46875
- function mountIdleReleaseControls(context2, messages, getLoadedSessionsClient) {
46876
- const { content } = context2;
47049
+ function mountIdleReleaseControls(context, messages, getLoadedSessionsClient) {
47050
+ const { content } = context;
46877
47051
  const document2 = content.ownerDocument;
46878
47052
  const owner = document2.defaultView;
46879
47053
  if (!owner) return () => void 0;
@@ -46915,7 +47089,7 @@ ${detail}` : ""}`
46915
47089
  card.append(toggle.item, timeout.item);
46916
47090
  content.append(group);
46917
47091
  const disposeTable = mountLoadedSessionsTable(
46918
- { ...context2, content: card },
47092
+ { ...context, content: card },
46919
47093
  messages,
46920
47094
  getLoadedSessionsClient
46921
47095
  );
@@ -46982,8 +47156,8 @@ ${detail}` : ""}`
46982
47156
  id: "appearance",
46983
47157
  label: messages.pageLabels.appearance,
46984
47158
  icon: "settings",
46985
- mount(context2) {
46986
- const document2 = context2.content.ownerDocument;
47159
+ mount(context) {
47160
+ const document2 = context.content.ownerDocument;
46987
47161
  const ownerWindow = document2.defaultView;
46988
47162
  if (!ownerWindow) return;
46989
47163
  const heading = document2.createElement("div");
@@ -47010,9 +47184,9 @@ ${detail}` : ""}`
47010
47184
  ownerWindow.addEventListener(REASONING_SOFT_WRAP_CHANGE_EVENT, sync);
47011
47185
  row.item.append(toggle);
47012
47186
  card.append(row.item);
47013
- context2.content.append(heading, description, group);
47187
+ context.content.append(heading, description, group);
47014
47188
  const disposeIdleRelease = mountIdleReleaseControls(
47015
- context2,
47189
+ context,
47016
47190
  messages,
47017
47191
  getLoadedSessionsClient
47018
47192
  );
@@ -47054,6 +47228,8 @@ ${detail}` : ""}`
47054
47228
  downloads,
47055
47229
  trustTier,
47056
47230
  statusState,
47231
+ statusDotOverride,
47232
+ stateBadge,
47057
47233
  update,
47058
47234
  description,
47059
47235
  attention,
@@ -47115,6 +47291,18 @@ ${detail}` : ""}`
47115
47291
  dot.setAttribute("aria-label", copy.states[statusState]);
47116
47292
  dot.title = copy.states[statusState];
47117
47293
  titleGroup.append(dot);
47294
+ } else if (statusDotOverride) {
47295
+ const dot = createEl(document2, "span", "settings-extensions-card__status-dot");
47296
+ dot.dataset.tone = statusDotOverride.tone;
47297
+ dot.setAttribute("role", "img");
47298
+ dot.setAttribute("aria-label", statusDotOverride.label);
47299
+ dot.title = statusDotOverride.label;
47300
+ titleGroup.append(dot);
47301
+ }
47302
+ if (stateBadge) {
47303
+ const badge = createEl(document2, "span", "settings-extensions-state-badge", stateBadge.label);
47304
+ badge.dataset.tone = stateBadge.tone;
47305
+ titleGroup.append(badge);
47118
47306
  }
47119
47307
  const compatLabel = incompatiblePlatformLabel ?? (platformBadge?.kind === "web" ? platformBadge.label : void 0);
47120
47308
  if (compatLabel) {
@@ -49718,7 +49906,7 @@ ${detail}` : ""}`
49718
49906
  const displayName = catalogDisplayName(entry, contentLocale);
49719
49907
  const installed = installedById.get(entry.id);
49720
49908
  const updateAvailable = hasCatalogUpdate(installed, entry);
49721
- const installState = installed ? updateAvailable ? "update" : "installed" : "available";
49909
+ const installState = installed ? updateAvailable ? "update" : installed.enabled ? "installed" : "installed-disabled" : "available";
49722
49910
  const entryAction = pendingMutations.get(entry.id) ?? null;
49723
49911
  const isBusyCard = entryAction !== null;
49724
49912
  const controlsDisabled = isBusyCard || globalBusy;
@@ -49747,6 +49935,15 @@ ${detail}` : ""}`
49747
49935
  );
49748
49936
  actionButton.setAttribute("aria-busy", String(updatingThis));
49749
49937
  actionButton.disabled = controlsDisabled || !canInstall;
49938
+ } else if (installState === "installed-disabled") {
49939
+ actionButton.className = "settings-extensions-btn-installed-disabled";
49940
+ actionButton.dataset.action = "installed-disabled";
49941
+ actionButton.title = copy.installedDisabledBadge;
49942
+ actionButton.setAttribute("aria-label", copy.installedDisabledBadge);
49943
+ const offDot = createEl(document2, "span", "settings-extensions-btn-installed-disabled__dot");
49944
+ offDot.setAttribute("aria-hidden", "true");
49945
+ actionButton.append(offDot, createEl(document2, "span", "", copy.installedDisabledBadge));
49946
+ actionButton.disabled = controlsDisabled;
49750
49947
  } else {
49751
49948
  const isFeaturedLayout = layout === "featured";
49752
49949
  actionButton.className = isFeaturedLayout ? "settings-extensions-btn-installed settings-extensions-btn-installed--featured" : "settings-extensions-btn-installed";
@@ -49792,6 +49989,7 @@ ${detail}` : ""}`
49792
49989
  version: updateAvailable && installed?.state === "valid" ? installed.manifest.version : entry.version,
49793
49990
  downloads: entry.downloads,
49794
49991
  trustTier: entry.trustTier,
49992
+ statusDotOverride: installState === "update" && installed && !installed.enabled ? { tone: "neutral", label: copy.installedDisabledBadge } : void 0,
49795
49993
  update: updateAvailable && installed?.state === "valid" ? {
49796
49994
  version: entry.version,
49797
49995
  label: formatMessage(copy.updateVersionCue, {
@@ -49883,8 +50081,8 @@ ${detail}` : ""}`
49883
50081
  id: "desktop-extensions",
49884
50082
  label: messages.pageLabels["desktop-extensions"],
49885
50083
  icon: "extensions",
49886
- mount(context2) {
49887
- const document2 = context2.content.ownerDocument;
50084
+ mount(context) {
50085
+ const document2 = context.content.ownerDocument;
49888
50086
  const ownerWindow = document2.defaultView;
49889
50087
  const root = createEl(document2, "div", "settings-extensions");
49890
50088
  const listViewWrap = createEl(document2, "div", "settings-extensions__list-view");
@@ -50143,7 +50341,7 @@ ${detail}` : ""}`
50143
50341
  const body = createEl(document2, "div", "settings-extensions__body");
50144
50342
  listViewWrap.append(header, stickyBar, banner, diagnosticsPanel, body);
50145
50343
  root.append(listViewWrap, pageViewHost);
50146
- context2.content.append(root);
50344
+ context.content.append(root);
50147
50345
  const initialHasCatalog = typeof resolveAvailableClient(getClient)?.listHostExtensionCatalog === "function";
50148
50346
  let disposed = false;
50149
50347
  let moreMenuOpen = false;
@@ -50210,7 +50408,7 @@ ${detail}` : ""}`
50210
50408
  const pageHost = createDesktopExtensionPageHost({
50211
50409
  document: document2,
50212
50410
  host: pageViewHost,
50213
- signal: context2.signal,
50411
+ signal: context.signal,
50214
50412
  messages,
50215
50413
  getClient: () => resolveAvailableClient(getClient),
50216
50414
  getContentLocale: resolveContentLocale,
@@ -50221,13 +50419,13 @@ ${detail}` : ""}`
50221
50419
  }
50222
50420
  });
50223
50421
  const openExtensionPage = (item) => {
50224
- if (disposed || context2.signal.aborted || !item.enabled || !item.manifest.page) return;
50422
+ if (disposed || context.signal.aborted || !item.enabled || !item.manifest.page) return;
50225
50423
  closeHeaderMenus();
50226
50424
  detailModal.close();
50227
50425
  importModal.close();
50228
50426
  createModal.close();
50229
50427
  const pageId = pluginPages?.getPageIdForExtension(item.id);
50230
- if (pageId && context2.navigateToPage?.(pageId)) return;
50428
+ if (pageId && context.navigateToPage?.(pageId)) return;
50231
50429
  const catalogEntry = catalogById.get(item.id);
50232
50430
  listViewWrap.hidden = true;
50233
50431
  pageViewHost.hidden = false;
@@ -50251,7 +50449,7 @@ ${detail}` : ""}`
50251
50449
  const detailModal = createDesktopExtensionDetailModal({
50252
50450
  document: document2,
50253
50451
  host: root,
50254
- signal: context2.signal,
50452
+ signal: context.signal,
50255
50453
  messages,
50256
50454
  catalogIconLoader,
50257
50455
  assetClient: {
@@ -50289,9 +50487,9 @@ ${detail}` : ""}`
50289
50487
  onOpenPage: (item) => {
50290
50488
  openExtensionPage(item);
50291
50489
  },
50292
- onOpenSettings: pluginPages && context2.navigateToPage ? (extensionId) => {
50490
+ onOpenSettings: pluginPages && context.navigateToPage ? (extensionId) => {
50293
50491
  const pageId = pluginPages.getPageIdForExtension(extensionId);
50294
- if (pageId) context2.navigateToPage?.(pageId);
50492
+ if (pageId) context.navigateToPage?.(pageId);
50295
50493
  } : void 0,
50296
50494
  onClose: () => {
50297
50495
  modalFeedback = null;
@@ -50300,14 +50498,14 @@ ${detail}` : ""}`
50300
50498
  const createModal = createDesktopExtensionCreateModal({
50301
50499
  document: document2,
50302
50500
  host: root,
50303
- signal: context2.signal,
50501
+ signal: context.signal,
50304
50502
  messages,
50305
50503
  getCopy: () => contentLocaleMessages(resolveContentLocale())
50306
50504
  });
50307
50505
  const importModal = createDesktopExtensionImportModal({
50308
50506
  document: document2,
50309
50507
  host: root,
50310
- signal: context2.signal,
50508
+ signal: context.signal,
50311
50509
  messages,
50312
50510
  onImport: async (source) => {
50313
50511
  await importExtension(source);
@@ -50495,7 +50693,7 @@ ${detail}` : ""}`
50495
50693
  if (filterMenuOpen) setFilterMenuOpen(false);
50496
50694
  };
50497
50695
  const openDetailModal = (extensionId) => {
50498
- if (disposed || context2.signal.aborted || activeRecoveryDialog || importModal.isOpen) {
50696
+ if (disposed || context.signal.aborted || activeRecoveryDialog || importModal.isOpen) {
50499
50697
  return;
50500
50698
  }
50501
50699
  closeHeaderMenus();
@@ -50606,6 +50804,7 @@ ${detail}` : ""}`
50606
50804
  downloads: catalogEntry?.downloads,
50607
50805
  trustTier: catalogEntry?.trustTier,
50608
50806
  statusState,
50807
+ stateBadge: item.state === "valid" && !item.enabled && statusState === "disabled" ? { tone: "neutral", label: copy.states.disabled } : void 0,
50609
50808
  update,
50610
50809
  description: extensionDescription(item, contentLocale),
50611
50810
  attention,
@@ -50849,9 +51048,9 @@ ${detail}` : ""}`
50849
51048
  };
50850
51049
  const schedulePoll = () => {
50851
51050
  clearPollTimer();
50852
- if (disposed || context2.signal.aborted || document2.visibilityState === "hidden") return;
51051
+ if (disposed || context.signal.aborted || document2.visibilityState === "hidden") return;
50853
51052
  pollTimer = setTimeout(() => {
50854
- if (disposed || context2.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
51053
+ if (disposed || context.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
50855
51054
  schedulePoll();
50856
51055
  return;
50857
51056
  }
@@ -50876,7 +51075,7 @@ ${detail}` : ""}`
50876
51075
  const token = ++listApplyToken;
50877
51076
  try {
50878
51077
  const refreshed = await client.listHostExtensions();
50879
- if (disposed || context2.signal.aborted) return;
51078
+ if (disposed || context.signal.aborted) return;
50880
51079
  applyLoadedList(refreshed, token);
50881
51080
  } catch {
50882
51081
  }
@@ -50901,7 +51100,7 @@ ${detail}` : ""}`
50901
51100
  }
50902
51101
  const listHostExtensions = client.listHostExtensions.bind(client);
50903
51102
  const token = ++listApplyToken;
50904
- await context2.runLatest(async () => listHostExtensions(), {
51103
+ await context.runLatest(async () => listHostExtensions(), {
50905
51104
  success(result) {
50906
51105
  loading = false;
50907
51106
  unavailable = false;
@@ -50958,7 +51157,7 @@ ${detail}` : ""}`
50958
51157
  try {
50959
51158
  const params = forceRefresh ? { forceRefresh: true } : {};
50960
51159
  const result = await client.listHostExtensionCatalog(params);
50961
- if (disposed || context2.signal.aborted || token !== catalogRequestToken) return;
51160
+ if (disposed || context.signal.aborted || token !== catalogRequestToken) return;
50962
51161
  catalogLoading = false;
50963
51162
  catalogUnavailable = false;
50964
51163
  catalogError = null;
@@ -50966,7 +51165,7 @@ ${detail}` : ""}`
50966
51165
  catalogById = new Map(result.extensions.map((entry) => [entry.id, entry]));
50967
51166
  render();
50968
51167
  } catch (error62) {
50969
- if (disposed || context2.signal.aborted || token !== catalogRequestToken) return;
51168
+ if (disposed || context.signal.aborted || token !== catalogRequestToken) return;
50970
51169
  catalogLoading = false;
50971
51170
  if (error62 instanceof RendererMethodUnavailableError) {
50972
51171
  catalogUnavailable = true;
@@ -50986,8 +51185,44 @@ ${detail}` : ""}`
50986
51185
  render();
50987
51186
  }
50988
51187
  };
51188
+ const buildInstallFeedback = (result, isUpdate, fallbackName) => {
51189
+ const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || fallbackName;
51190
+ const version2 = result.manifest.version.replace(/^v/u, "");
51191
+ if (isUpdate) {
51192
+ return {
51193
+ tone: "success",
51194
+ text: formatMessage(copy.updatedSuccess, { name: displayName, version: version2 })
51195
+ };
51196
+ }
51197
+ const refreshedItem = listing?.extensions.find((item) => item.id === result.id);
51198
+ if (refreshedItem && !refreshedItem.enabled) {
51199
+ const conflictId = listing ? findDesktopSlotConflictForExtension(refreshedItem, listing) : void 0;
51200
+ if (conflictId && listing) {
51201
+ const other = describeOtherExtension(conflictId, listing.extensions, messages.locale);
51202
+ return {
51203
+ tone: "warning",
51204
+ text: formatMessage(copy.installedSlotConflict, {
51205
+ name: displayName,
51206
+ version: version2,
51207
+ other
51208
+ })
51209
+ };
51210
+ }
51211
+ return {
51212
+ tone: "warning",
51213
+ text: formatMessage(copy.installedDisabled, { name: displayName, version: version2 })
51214
+ };
51215
+ }
51216
+ return {
51217
+ tone: "success",
51218
+ text: formatMessage(result.replaced ? copy.updatedSuccess : copy.installedSuccess, {
51219
+ name: displayName,
51220
+ version: version2
51221
+ })
51222
+ };
51223
+ };
50989
51224
  const installFromCatalog = async (entry, isUpdate) => {
50990
- if (recovering || pendingMutations.has(entry.id) || disposed || context2.signal.aborted)
51225
+ if (recovering || pendingMutations.has(entry.id) || disposed || context.signal.aborted)
50991
51226
  return;
50992
51227
  const client = resolveAvailableClient(getClient);
50993
51228
  const installedItem = listing?.extensions.find((item) => item.id === entry.id);
@@ -51015,22 +51250,13 @@ ${detail}` : ""}`
51015
51250
  } else {
51016
51251
  return;
51017
51252
  }
51018
- if (disposed || context2.signal.aborted) return;
51019
- const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || fallbackName;
51020
- const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
51021
- setFeedback(
51022
- {
51023
- tone: "success",
51024
- text: formatMessage(
51025
- result.replaced || isUpdate ? copy.updatedSuccess : copy.installedSuccess,
51026
- { name: displayName, version: result.manifest.version }
51027
- )
51028
- },
51029
- modalTargetId
51030
- );
51253
+ if (disposed || context.signal.aborted) return;
51031
51254
  await refreshInstalledAfterMutation();
51255
+ if (disposed || context.signal.aborted) return;
51256
+ const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
51257
+ setFeedback(buildInstallFeedback(result, isUpdate, fallbackName), modalTargetId);
51032
51258
  } catch (error62) {
51033
- if (disposed || context2.signal.aborted) return;
51259
+ if (disposed || context.signal.aborted) return;
51034
51260
  const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
51035
51261
  setFeedback(
51036
51262
  {
@@ -51041,7 +51267,7 @@ ${detail}` : ""}`
51041
51267
  );
51042
51268
  } finally {
51043
51269
  pendingMutations.delete(entry.id);
51044
- if (!disposed && !context2.signal.aborted) {
51270
+ if (!disposed && !context.signal.aborted) {
51045
51271
  render();
51046
51272
  if (!hasPendingMutations()) schedulePoll();
51047
51273
  }
@@ -51059,31 +51285,25 @@ ${detail}` : ""}`
51059
51285
  syncToolbarState();
51060
51286
  try {
51061
51287
  const result = await install2({ source });
51062
- if (disposed || context2.signal.aborted) return;
51288
+ if (disposed || context.signal.aborted) return;
51063
51289
  activeView = "installed";
51064
51290
  selectedCapability = "all";
51065
51291
  searchQuery = "";
51066
51292
  searchInput.value = "";
51067
51293
  clearSearchButton.hidden = true;
51068
- const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || result.id;
51069
- setFeedback({
51070
- tone: "success",
51071
- text: formatMessage(result.replaced ? copy.updatedSuccess : copy.installedSuccess, {
51072
- name: displayName,
51073
- version: result.manifest.version
51074
- })
51075
- });
51076
51294
  await refreshInstalledAfterMutation();
51295
+ if (disposed || context.signal.aborted) return;
51296
+ setFeedback(buildInstallFeedback(result, false, result.id));
51077
51297
  } finally {
51078
51298
  importing = false;
51079
- if (!disposed && !context2.signal.aborted) {
51299
+ if (!disposed && !context.signal.aborted) {
51080
51300
  render();
51081
51301
  if (!hasPendingMutations()) schedulePoll();
51082
51302
  }
51083
51303
  }
51084
51304
  };
51085
51305
  const uninstallExtension = async (item) => {
51086
- if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
51306
+ if (recovering || pendingMutations.has(item.id) || disposed || context.signal.aborted)
51087
51307
  return;
51088
51308
  const client = resolveAvailableClient(getClient);
51089
51309
  const uninstall = client?.uninstallHostExtension?.bind(client);
@@ -51097,7 +51317,7 @@ ${detail}` : ""}`
51097
51317
  id: item.id,
51098
51318
  ...item.state === "valid" ? { expectedDigest: item.digest } : {}
51099
51319
  });
51100
- if (disposed || context2.signal.aborted) return;
51320
+ if (disposed || context.signal.aborted) return;
51101
51321
  if (pageHost.extensionId === item.id) {
51102
51322
  pageHost.close();
51103
51323
  }
@@ -51110,7 +51330,7 @@ ${detail}` : ""}`
51110
51330
  });
51111
51331
  await refreshInstalledAfterMutation();
51112
51332
  } catch (error62) {
51113
- if (disposed || context2.signal.aborted) return;
51333
+ if (disposed || context.signal.aborted) return;
51114
51334
  const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
51115
51335
  setFeedback(
51116
51336
  {
@@ -51121,14 +51341,14 @@ ${detail}` : ""}`
51121
51341
  );
51122
51342
  } finally {
51123
51343
  pendingMutations.delete(item.id);
51124
- if (!disposed && !context2.signal.aborted) {
51344
+ if (!disposed && !context.signal.aborted) {
51125
51345
  render();
51126
51346
  if (!hasPendingMutations()) schedulePoll();
51127
51347
  }
51128
51348
  }
51129
51349
  };
51130
51350
  const toggleExtension = async (item, enable) => {
51131
- if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
51351
+ if (recovering || pendingMutations.has(item.id) || disposed || context.signal.aborted)
51132
51352
  return;
51133
51353
  const client = resolveAvailableClient(getClient);
51134
51354
  const mutate = enable ? client?.enableHostExtension?.bind(client) : client?.disableHostExtension?.bind(client);
@@ -51143,10 +51363,10 @@ ${detail}` : ""}`
51143
51363
  render();
51144
51364
  let shouldReload = false;
51145
51365
  const runQueued = toggleQueue.then(async () => {
51146
- if (disposed || context2.signal.aborted) return;
51366
+ if (disposed || context.signal.aborted) return;
51147
51367
  const expectedRevision2 = listing?.configuration.revision ?? 0;
51148
51368
  const result = await mutate({ id: item.id, expectedRevision: expectedRevision2 });
51149
- if (disposed || context2.signal.aborted) return;
51369
+ if (disposed || context.signal.aborted) return;
51150
51370
  const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
51151
51371
  if (result.state === "saved") {
51152
51372
  if (!enable && pageHost.extensionId === item.id) {
@@ -51198,7 +51418,7 @@ ${detail}` : ""}`
51198
51418
  try {
51199
51419
  await runQueued;
51200
51420
  } catch (error62) {
51201
- if (disposed || context2.signal.aborted) return;
51421
+ if (disposed || context.signal.aborted) return;
51202
51422
  if (error62 instanceof RendererMethodUnavailableError) {
51203
51423
  unavailable = true;
51204
51424
  listing = null;
@@ -51215,7 +51435,7 @@ ${detail}` : ""}`
51215
51435
  );
51216
51436
  } finally {
51217
51437
  pendingMutations.delete(item.id);
51218
- if (!disposed && !context2.signal.aborted) {
51438
+ if (!disposed && !context.signal.aborted) {
51219
51439
  render();
51220
51440
  if (shouldReload) {
51221
51441
  await loadInstalled({ silent: true, keepFeedback: true });
@@ -51226,7 +51446,7 @@ ${detail}` : ""}`
51226
51446
  }
51227
51447
  };
51228
51448
  const openRecoveryDialog = () => {
51229
- if (disposed || context2.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
51449
+ if (disposed || context.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
51230
51450
  return;
51231
51451
  const client = resolveAvailableClient(getClient);
51232
51452
  if (!client?.recoverHostExtensions) return;
@@ -51272,7 +51492,7 @@ ${detail}` : ""}`
51272
51492
  modal.setAttribute("aria-busy", String(next));
51273
51493
  };
51274
51494
  const cleanupDialog = () => {
51275
- context2.signal.removeEventListener("abort", cleanupDialog);
51495
+ context.signal.removeEventListener("abort", cleanupDialog);
51276
51496
  if (activeRecoveryDialog === modal) activeRecoveryDialog = null;
51277
51497
  modal.remove();
51278
51498
  };
@@ -51283,7 +51503,7 @@ ${detail}` : ""}`
51283
51503
  if (dialogBusy) event.preventDefault();
51284
51504
  });
51285
51505
  modal.addEventListener("close", cleanupDialog);
51286
- context2.signal.addEventListener("abort", cleanupDialog, { once: true });
51506
+ context.signal.addEventListener("abort", cleanupDialog, { once: true });
51287
51507
  form.addEventListener("submit", (event) => {
51288
51508
  event.preventDefault();
51289
51509
  if (dialogBusy || hasPendingMutations()) return;
@@ -51301,7 +51521,7 @@ ${detail}` : ""}`
51301
51521
  render();
51302
51522
  const params = listing !== null ? { expectedRevision: listing.configuration.revision } : {};
51303
51523
  void recover(params).then(async (result) => {
51304
- if (disposed || context2.signal.aborted) return;
51524
+ if (disposed || context.signal.aborted) return;
51305
51525
  if (result.state === "saved") {
51306
51526
  pageHost.close();
51307
51527
  if (listing) {
@@ -51347,7 +51567,7 @@ ${detail}` : ""}`
51347
51567
  render();
51348
51568
  schedulePoll();
51349
51569
  }).catch((error62) => {
51350
- if (disposed || context2.signal.aborted) return;
51570
+ if (disposed || context.signal.aborted) return;
51351
51571
  recovering = false;
51352
51572
  setDialogBusy(false);
51353
51573
  render();
@@ -51382,7 +51602,7 @@ ${detail}` : ""}`
51382
51602
  };
51383
51603
  const onVisibilityChange = () => {
51384
51604
  if (document2.visibilityState === "hidden") clearPollTimer();
51385
- else if (!disposed && !context2.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
51605
+ else if (!disposed && !context.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
51386
51606
  void loadInstalled({ silent: true });
51387
51607
  }
51388
51608
  };
@@ -51456,12 +51676,12 @@ ${detail}` : ""}`
51456
51676
  }
51457
51677
  void clipboard.writeText(EXTENSIONS_ROOT_DISPLAY).then(
51458
51678
  () => {
51459
- if (!disposed && !context2.signal.aborted) {
51679
+ if (!disposed && !context.signal.aborted) {
51460
51680
  setFeedback({ tone: "success", text: copy.copiedDirectoryPath });
51461
51681
  }
51462
51682
  },
51463
51683
  () => {
51464
- if (!disposed && !context2.signal.aborted) {
51684
+ if (!disposed && !context.signal.aborted) {
51465
51685
  setFeedback({ tone: "danger", text: copy.copyPathFailed });
51466
51686
  }
51467
51687
  }
@@ -51507,7 +51727,7 @@ ${detail}` : ""}`
51507
51727
  }
51508
51728
  });
51509
51729
  const unsubscribePluginPages = pluginPages?.subscribe(() => {
51510
- if (!disposed && !context2.signal.aborted) {
51730
+ if (!disposed && !context.signal.aborted) {
51511
51731
  detailModal.sync(buildDetailModalState());
51512
51732
  }
51513
51733
  }) ?? null;
@@ -52152,7 +52372,7 @@ ${detail}` : ""}`
52152
52372
  }
52153
52373
  function defaultImportName(source, existing) {
52154
52374
  const base = source.provider === "openai-codex" ? "codex" : "grok";
52155
- const used = new Set(existing.map((record17) => record17.name));
52375
+ const used = new Set(existing.map((record19) => record19.name));
52156
52376
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
52157
52377
  if (!used.has(base)) return base;
52158
52378
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -52175,7 +52395,7 @@ ${detail}` : ""}`
52175
52395
  const shown = (text2) => accountDisplayText(text2, hideEmails);
52176
52396
  const targetButtons = /* @__PURE__ */ new Map();
52177
52397
  const importedRecords = () => snapshot.targets.find((target2) => target2.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
52178
- const sourceOf = (record17) => snapshot.sources.find((source) => source.id === record17.source.id);
52398
+ const sourceOf = (record19) => snapshot.sources.find((source) => source.id === record19.source.id);
52179
52399
  const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
52180
52400
  const compatibleSources = () => {
52181
52401
  const target2 = piTarget();
@@ -52213,7 +52433,7 @@ ${detail}` : ""}`
52213
52433
  sectionImport.addEventListener("click", () => {
52214
52434
  const sources = compatibleSources();
52215
52435
  const free = sources.find(
52216
- (source2) => !importedRecords().some((record17) => record17.source.id === source2.id)
52436
+ (source2) => !importedRecords().some((record19) => record19.source.id === source2.id)
52217
52437
  );
52218
52438
  const source = free ?? sources[0];
52219
52439
  if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
@@ -52263,30 +52483,30 @@ ${detail}` : ""}`
52263
52483
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
52264
52484
  return mark;
52265
52485
  };
52266
- const renderRow = (record17) => {
52486
+ const renderRow = (record19) => {
52267
52487
  const row = document2.createElement("div");
52268
52488
  row.className = "settings-pi-accounts__row";
52269
52489
  row.tabIndex = -1;
52270
- row.dataset.importName = record17.name;
52271
- row.setAttribute("aria-label", shown(record17.source.label));
52272
- const agent = record17.source.harnessId;
52490
+ row.dataset.importName = record19.name;
52491
+ row.setAttribute("aria-label", shown(record19.source.label));
52492
+ const agent = record19.source.harnessId;
52273
52493
  const mark = createMark(agent);
52274
52494
  const identity3 = document2.createElement("div");
52275
52495
  identity3.className = "settings-pi-accounts__identity";
52276
52496
  const label = document2.createElement("strong");
52277
52497
  label.className = "settings-account-email";
52278
- label.textContent = shown(record17.source.label);
52498
+ label.textContent = shown(record19.source.label);
52279
52499
  label.title = label.textContent;
52280
52500
  label.translate = false;
52281
52501
  const meta3 = document2.createElement("div");
52282
52502
  meta3.className = "settings-account-metadata";
52283
- const source = sourceOf(record17);
52503
+ const source = sourceOf(record19);
52284
52504
  const parts = [
52285
52505
  metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
52286
- metaPart(`${record17.name}/\u2026`, void 0, true),
52506
+ metaPart(`${record19.name}/\u2026`, void 0, true),
52287
52507
  metaPart(messages.copied)
52288
52508
  ];
52289
- const time3 = formatImportedAt(record17.importedAt);
52509
+ const time3 = formatImportedAt(record19.importedAt);
52290
52510
  if (time3) parts.push(metaPart(time3));
52291
52511
  parts.forEach((part, index) => {
52292
52512
  if (index > 0) {
@@ -52303,23 +52523,23 @@ ${detail}` : ""}`
52303
52523
  reimport.type = "button";
52304
52524
  reimport.className = "settings-account-action";
52305
52525
  reimport.textContent = messages.rowReimport;
52306
- reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record17.source.label)}`);
52526
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record19.source.label)}`);
52307
52527
  reimport.disabled = busy || !source;
52308
52528
  reimport.title = messages.reimport;
52309
52529
  reimport.addEventListener("click", () => {
52310
- if (source) openDialog("reimport", { source, record: record17 }, `row:${record17.name}`);
52530
+ if (source) openDialog("reimport", { source, record: record19 }, `row:${record19.name}`);
52311
52531
  });
52312
52532
  const remove = document2.createElement("button");
52313
52533
  remove.type = "button";
52314
52534
  remove.className = "settings-account-action settings-pi-accounts__remove";
52315
52535
  remove.textContent = messages.rowRemove;
52316
- remove.setAttribute("aria-label", `${messages.remove}: ${shown(record17.source.label)}`);
52536
+ remove.setAttribute("aria-label", `${messages.remove}: ${shown(record19.source.label)}`);
52317
52537
  remove.disabled = busy;
52318
- remove.addEventListener("click", () => openDialog("remove", { record: record17 }, `row:${record17.name}`));
52538
+ remove.addEventListener("click", () => openDialog("remove", { record: record19 }, `row:${record19.name}`));
52319
52539
  if (source) actions.append(reimport);
52320
52540
  actions.append(remove);
52321
52541
  row.append(mark, identity3, actions);
52322
- rows.set(record17.name, row);
52542
+ rows.set(record19.name, row);
52323
52543
  return row;
52324
52544
  };
52325
52545
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -52472,7 +52692,7 @@ ${detail}` : ""}`
52472
52692
  const label = document2.createElement("strong");
52473
52693
  label.textContent = shown(choice.label);
52474
52694
  label.translate = false;
52475
- const existing = importedRecords().find((record17) => record17.source.id === choice.id);
52695
+ const existing = importedRecords().find((record19) => record19.source.id === choice.id);
52476
52696
  const agent = choice.harnessId;
52477
52697
  const detail = document2.createElement("span");
52478
52698
  detail.textContent = [
@@ -52513,7 +52733,7 @@ ${detail}` : ""}`
52513
52733
  const name = request.action === "list" ? void 0 : request.name;
52514
52734
  state = {
52515
52735
  source: state.source,
52516
- record: importedRecords().find((record17) => record17.name === name) ?? state.record
52736
+ record: importedRecords().find((record19) => record19.name === name) ?? state.record
52517
52737
  };
52518
52738
  show(next);
52519
52739
  } else {
@@ -52527,12 +52747,12 @@ ${detail}` : ""}`
52527
52747
  sourceRadios = [];
52528
52748
  body.replaceChildren();
52529
52749
  controls.replaceChildren();
52530
- const { source, record: record17 } = state;
52750
+ const { source, record: record19 } = state;
52531
52751
  const close = () => modal.close();
52532
52752
  if (mode === "add" || mode === "reimport") {
52533
52753
  title.textContent = mode === "add" ? messages.add : messages.reimport;
52534
52754
  modal.setAttribute("aria-label", title.textContent);
52535
- const active2 = source ?? record17?.source;
52755
+ const active2 = source ?? record19?.source;
52536
52756
  const choices = mode === "add" && state.choose ? compatibleSources() : [];
52537
52757
  if (choices.length > 1) body.append(sourcePicker(choices));
52538
52758
  else if (active2) body.append(line(messages.source, shown(active2.label)));
@@ -52541,8 +52761,8 @@ ${detail}` : ""}`
52541
52761
  input3.maxLength = 48;
52542
52762
  input3.autocomplete = "off";
52543
52763
  input3.spellcheck = false;
52544
- input3.value = record17?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
52545
- input3.readOnly = Boolean(record17);
52764
+ input3.value = record19?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
52765
+ input3.readOnly = Boolean(record19);
52546
52766
  input3.addEventListener("input", () => {
52547
52767
  nameEdited = true;
52548
52768
  });
@@ -52576,7 +52796,7 @@ ${detail}` : ""}`
52576
52796
  {
52577
52797
  action: mode === "reimport" ? "reimport" : "import",
52578
52798
  sourceId: source2.id,
52579
- name: record17?.name ?? input3.value,
52799
+ name: record19?.name ?? input3.value,
52580
52800
  confirmed: true
52581
52801
  },
52582
52802
  "done"
@@ -52586,16 +52806,16 @@ ${detail}` : ""}`
52586
52806
  )
52587
52807
  );
52588
52808
  (mode === "add" ? input3 : controls.children[0]).focus();
52589
- } else if (mode === "remove" && record17) {
52809
+ } else if (mode === "remove" && record19) {
52590
52810
  title.textContent = messages.remove;
52591
52811
  modal.setAttribute("aria-label", title.textContent);
52592
- body.append(note(messages.removeWarning.replace("{name}", record17.name)));
52812
+ body.append(note(messages.removeWarning.replace("{name}", record19.name)));
52593
52813
  const cancel = command(messages.cancel, close);
52594
52814
  controls.append(
52595
52815
  cancel,
52596
52816
  command(
52597
52817
  messages.remove,
52598
- () => submit({ action: "remove", name: record17.name, confirmed: true }, null),
52818
+ () => submit({ action: "remove", name: record19.name, confirmed: true }, null),
52599
52819
  "danger"
52600
52820
  )
52601
52821
  );
@@ -52603,7 +52823,7 @@ ${detail}` : ""}`
52603
52823
  } else {
52604
52824
  title.textContent = messages.doneTitle;
52605
52825
  modal.setAttribute("aria-label", title.textContent);
52606
- const name = record17?.name;
52826
+ const name = record19?.name;
52607
52827
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
52608
52828
  body.append(note(messages.done));
52609
52829
  const done = command(messages.close, close, "primary");
@@ -52650,21 +52870,21 @@ ${detail}` : ""}`
52650
52870
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
52651
52871
  );
52652
52872
  if (!source || !target2) return null;
52653
- const record17 = target2.imports.find((candidate) => candidate.source.id === source.id);
52873
+ const record19 = target2.imports.find((candidate) => candidate.source.id === source.id);
52654
52874
  const key2 = `${harnessId}:${accountLabel}:import`;
52655
52875
  const button2 = document2.createElement("button");
52656
52876
  button2.type = "button";
52657
52877
  button2.className = "settings-account-pi-import";
52658
52878
  button2.dataset.accountFocus = key2;
52659
52879
  button2.disabled = busy;
52660
- const hint = record17 ? messages.importedHint.replace("{name}", record17.name) : messages.add;
52880
+ const hint = record19 ? messages.importedHint.replace("{name}", record19.name) : messages.add;
52661
52881
  button2.title = hint;
52662
52882
  button2.setAttribute("aria-label", hint);
52663
52883
  button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
52664
- if (record17) {
52884
+ if (record19) {
52665
52885
  button2.dataset.state = "imported";
52666
52886
  const name = document2.createElement("code");
52667
- name.textContent = `${record17.name}/\u2026`;
52887
+ name.textContent = `${record19.name}/\u2026`;
52668
52888
  name.translate = false;
52669
52889
  button2.append(name, createRendererSettingsIcon("check", 12));
52670
52890
  } else {
@@ -52672,7 +52892,7 @@ ${detail}` : ""}`
52672
52892
  button2.append(messages.add);
52673
52893
  }
52674
52894
  button2.addEventListener("click", () => {
52675
- if (!record17) {
52895
+ if (!record19) {
52676
52896
  openDialog("add", { source }, key2);
52677
52897
  return;
52678
52898
  }
@@ -52681,7 +52901,7 @@ ${detail}` : ""}`
52681
52901
  renderSection();
52682
52902
  sectionToggle.setAttribute("aria-expanded", "true");
52683
52903
  }
52684
- const row = rows.get(record17.name);
52904
+ const row = rows.get(record19.name);
52685
52905
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
52686
52906
  row?.focus();
52687
52907
  });
@@ -53384,8 +53604,8 @@ ${detail}` : ""}`
53384
53604
  id: "accounts",
53385
53605
  label: messages.pageLabels.accounts,
53386
53606
  icon: "accounts",
53387
- mount(context2) {
53388
- const document2 = context2.content.ownerDocument;
53607
+ mount(context) {
53608
+ const document2 = context.content.ownerDocument;
53389
53609
  const header = document2.createElement("div");
53390
53610
  header.className = "settings-account-header";
53391
53611
  const copy = document2.createElement("div");
@@ -53470,15 +53690,15 @@ ${detail}` : ""}`
53470
53690
  let plugins = [];
53471
53691
  const pluginFor = (id2) => plugins.find((plugin) => plugin.id === id2);
53472
53692
  const credentialImports = mountCredentialImports(
53473
- context2.content,
53474
- context2.signal,
53693
+ context.content,
53694
+ context.signal,
53475
53695
  getClient,
53476
53696
  messages.credentialImports,
53477
53697
  () => render(),
53478
53698
  pluginFor
53479
53699
  );
53480
- context2.content.append(header, status, toolbar, list, credentialImports.section);
53481
- const stopCountdowns = mountAccountResetCountdowns(list, messages, context2.signal);
53700
+ context.content.append(header, status, toolbar, list, credentialImports.section);
53701
+ const stopCountdowns = mountAccountResetCountdowns(list, messages, context.signal);
53482
53702
  let accounts = [];
53483
53703
  let currentAccountId = null;
53484
53704
  let accountPhase = "unavailable";
@@ -53584,7 +53804,7 @@ ${detail}` : ""}`
53584
53804
  requests.map(async ({ account, loading }) => {
53585
53805
  try {
53586
53806
  const result = await inspect({ accountId: account.accountId });
53587
- if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53807
+ if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53588
53808
  return;
53589
53809
  usageByAccountId.set(
53590
53810
  account.accountId,
@@ -53596,7 +53816,7 @@ ${detail}` : ""}`
53596
53816
  } : { status: "empty" }
53597
53817
  );
53598
53818
  } catch {
53599
- if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53819
+ if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53600
53820
  return;
53601
53821
  usageByAccountId.set(account.accountId, { status: "error" });
53602
53822
  }
@@ -53625,7 +53845,7 @@ ${detail}` : ""}`
53625
53845
  };
53626
53846
  const refreshInBackground = () => {
53627
53847
  if (!client().refreshCodexAccounts) return;
53628
- void context2.runLatest(
53848
+ void context.runLatest(
53629
53849
  () => client().refreshCodexAccounts?.() ?? client().listCodexAccounts(),
53630
53850
  {
53631
53851
  success(result) {
@@ -53637,7 +53857,7 @@ ${detail}` : ""}`
53637
53857
  );
53638
53858
  };
53639
53859
  const load = () => {
53640
- void context2.runLatest(() => client().listCodexAccounts(), {
53860
+ void context.runLatest(() => client().listCodexAccounts(), {
53641
53861
  success(result) {
53642
53862
  loadMessage = null;
53643
53863
  setAccounts(result);
@@ -53657,10 +53877,10 @@ ${detail}` : ""}`
53657
53877
  });
53658
53878
  } catch {
53659
53879
  }
53660
- const harnessAccounts = createHarnessAccounts(context2.signal, getClient, render);
53880
+ const harnessAccounts = createHarnessAccounts(context.signal, getClient, render);
53661
53881
  const directoryClient = getClient();
53662
53882
  void directoryClient?.listHarnessPlugins?.().then(({ plugins: next }) => {
53663
- if (context2.signal.aborted || getClient() !== directoryClient) return;
53883
+ if (context.signal.aborted || getClient() !== directoryClient) return;
53664
53884
  plugins = next;
53665
53885
  render();
53666
53886
  void credentialImports.refresh();
@@ -54483,8 +54703,8 @@ ${detail}` : ""}`
54483
54703
  id: "delegation",
54484
54704
  label: messages.pageLabels.delegation,
54485
54705
  icon: "delegation",
54486
- mount(context2) {
54487
- const doc = context2.content.ownerDocument;
54706
+ mount(context) {
54707
+ const doc = context.content.ownerDocument;
54488
54708
  const ownerWindow = doc.defaultView;
54489
54709
  const root = doc.createElement("div");
54490
54710
  root.className = "settings-delegation";
@@ -54508,7 +54728,7 @@ ${detail}` : ""}`
54508
54728
  const rowViews = /* @__PURE__ */ new Map();
54509
54729
  let disposed = false;
54510
54730
  let preferencesLoadGeneration = 0;
54511
- const isActive = () => !disposed && !context2.signal.aborted;
54731
+ const isActive = () => !disposed && !context.signal.aborted;
54512
54732
  const diagramAgents = () => readyAgents.map((agent) => {
54513
54733
  const summary = formatEffectiveSummary(
54514
54734
  agent.id,
@@ -54630,7 +54850,7 @@ ${detail}` : ""}`
54630
54850
  footnote.textContent = copy.footnote;
54631
54851
  modelsSection.append(sectionHead, unavailableNotice, group, footnote);
54632
54852
  root.append(header, diagram.element, howto, modelsSection);
54633
- context2.content.append(root);
54853
+ context.content.append(root);
54634
54854
  const canPersist = () => {
54635
54855
  const client = getClient();
54636
54856
  return Boolean(client?.getHarnessPreferences && client?.patchHarnessPreferences);
@@ -55044,14 +55264,14 @@ ${detail}` : ""}`
55044
55264
  id: "harness-schedules",
55045
55265
  label: t("\u5B9A\u65F6\u4EFB\u52A1", "Schedules"),
55046
55266
  icon: "schedules",
55047
- mount(context2) {
55267
+ mount(context) {
55048
55268
  const navigate = () => {
55049
- context2.content.replaceChildren();
55050
- void context2.runLatest((signal) => options.openSchedules(signal), {
55269
+ context.content.replaceChildren();
55270
+ void context.runLatest((signal) => options.openSchedules(signal), {
55051
55271
  success() {
55052
55272
  },
55053
55273
  failure() {
55054
- const document2 = context2.content.ownerDocument;
55274
+ const document2 = context.content.ownerDocument;
55055
55275
  const status = document2.createElement("p");
55056
55276
  status.setAttribute("role", "status");
55057
55277
  status.className = "text-sm text-settings-muted";
@@ -55064,7 +55284,7 @@ ${detail}` : ""}`
55064
55284
  retry.className = "rounded-lg px-3 py-2 text-sm text-settings-text hover:bg-settings-hover focus-visible:outline-2 focus-visible:outline-settings-focus";
55065
55285
  retry.textContent = t("\u91CD\u8BD5", "Retry");
55066
55286
  retry.addEventListener("click", navigate);
55067
- context2.content.replaceChildren(status, retry);
55287
+ context.content.replaceChildren(status, retry);
55068
55288
  }
55069
55289
  });
55070
55290
  };
@@ -55120,12 +55340,12 @@ ${detail}` : ""}`
55120
55340
  // src/settings/update-status-poll.ts
55121
55341
  var RENDERER_UPDATE_STATUS_WAIT_MS = 10 * 6e4;
55122
55342
  var STATUS_POLL_INTERVAL_MS = 750;
55123
- function createRendererUpdateStatusPoll(context2, handlers) {
55124
- const window2 = context2.content.ownerDocument.defaultView;
55343
+ function createRendererUpdateStatusPoll(context, handlers) {
55344
+ const window2 = context.content.ownerDocument.defaultView;
55125
55345
  let timer;
55126
55346
  let deadline = 0;
55127
55347
  let disposed = false;
55128
- const active2 = () => !disposed && !context2.signal.aborted;
55348
+ const active2 = () => !disposed && !context.signal.aborted;
55129
55349
  const clearTimer = () => {
55130
55350
  if (timer !== void 0) window2?.clearTimeout(timer);
55131
55351
  timer = void 0;
@@ -55147,7 +55367,7 @@ ${detail}` : ""}`
55147
55367
  handlers.unavailable();
55148
55368
  return;
55149
55369
  }
55150
- void context2.runLatest(
55370
+ void context.runLatest(
55151
55371
  (signal) => runBoundedRendererUpdateRequest(
55152
55372
  readStatus,
55153
55373
  signal,
@@ -55391,8 +55611,8 @@ ${detail}` : ""}`
55391
55611
  id: "about",
55392
55612
  label: messages.pageLabels.about,
55393
55613
  icon: "about",
55394
- mount(context2) {
55395
- const document2 = context2.content.ownerDocument;
55614
+ mount(context) {
55615
+ const document2 = context.content.ownerDocument;
55396
55616
  const heading = document2.createElement("div");
55397
55617
  heading.className = "settings-section-label";
55398
55618
  heading.textContent = messages.pageLabels.about;
@@ -55434,7 +55654,7 @@ ${detail}` : ""}`
55434
55654
  panel.append(product, tagline, introduction, starCallout, repositorySection);
55435
55655
  const consoleEntry = consoleSection(document2, messages, getClient());
55436
55656
  if (consoleEntry) panel.append(consoleEntry);
55437
- context2.content.append(heading, panel);
55657
+ context.content.append(heading, panel);
55438
55658
  return void 0;
55439
55659
  }
55440
55660
  });
@@ -55461,8 +55681,8 @@ ${detail}` : ""}`
55461
55681
  id: "updates",
55462
55682
  label: messages.pageLabels.updates,
55463
55683
  icon: "updates",
55464
- mount(context2) {
55465
- const document2 = context2.content.ownerDocument;
55684
+ mount(context) {
55685
+ const document2 = context.content.ownerDocument;
55466
55686
  const windows = isWindowsRenderer(document2.defaultView);
55467
55687
  const header = document2.createElement("div");
55468
55688
  header.className = "settings-update-header";
@@ -55481,8 +55701,8 @@ ${detail}` : ""}`
55481
55701
  let currentAnnouncement = null;
55482
55702
  let announcementDialog = null;
55483
55703
  announcementButton.addEventListener("click", () => {
55484
- if (!currentAnnouncement || context2.signal.aborted) return;
55485
- const rootNode = context2.content.getRootNode();
55704
+ if (!currentAnnouncement || context.signal.aborted) return;
55705
+ const rootNode = context.content.getRootNode();
55486
55706
  const hostScheme = rootNode instanceof ShadowRoot && rootNode.host instanceof HTMLElement ? rootNode.host.style.colorScheme : "";
55487
55707
  const colorScheme2 = hostScheme === "light" || hostScheme === "dark" ? hostScheme : "inherit";
55488
55708
  announcementDialog?.dispose();
@@ -55591,9 +55811,9 @@ ${detail}` : ""}`
55591
55811
  controls.append(manualTitle, manualNpm, manualWindowsInstaller, actions);
55592
55812
  const notes = document2.createElement("div");
55593
55813
  notes.className = "settings-update-notes-section";
55594
- const macosSigning = createMacOsSigningSection(document2, messages, context2.signal);
55814
+ const macosSigning = createMacOsSigningSection(document2, messages, context.signal);
55595
55815
  const starBanner = updateStarBanner(document2, messages);
55596
- context2.content.append(
55816
+ context.content.append(
55597
55817
  header,
55598
55818
  metadata,
55599
55819
  panel,
@@ -55609,7 +55829,7 @@ ${detail}` : ""}`
55609
55829
  };
55610
55830
  let pending2 = false;
55611
55831
  let checkedStatus = null;
55612
- const statusPoll = createRendererUpdateStatusPoll(context2, {
55832
+ const statusPoll = createRendererUpdateStatusPoll(context, {
55613
55833
  status(status) {
55614
55834
  const message2 = statusMessage(status, messages);
55615
55835
  if (message2) renderPendingStatus(status, message2);
@@ -55715,23 +55935,23 @@ ${detail}` : ""}`
55715
55935
  try {
55716
55936
  const fresh = await runBoundedRendererUpdateRequest(
55717
55937
  () => client.checkUpdate(),
55718
- context2.signal
55938
+ context.signal
55719
55939
  );
55720
- if (context2.signal.aborted) return;
55940
+ if (context.signal.aborted) return;
55721
55941
  if (fresh) latestRunningTaskCount = fresh.runningTaskCount ?? 0;
55722
55942
  } catch {
55723
- if (context2.signal.aborted) return;
55943
+ if (context.signal.aborted) return;
55724
55944
  }
55725
55945
  if (latestRunningTaskCount > 0) {
55726
55946
  const confirmed = await confirmUpdateWithRunningTasks(
55727
- context2.content,
55947
+ context.content,
55728
55948
  messages,
55729
- context2.signal,
55949
+ context.signal,
55730
55950
  latestRunningTaskCount
55731
55951
  );
55732
- if (!confirmed || context2.signal.aborted) return;
55952
+ if (!confirmed || context.signal.aborted) return;
55733
55953
  }
55734
- if (!context2.signal.aborted) start(client);
55954
+ if (!context.signal.aborted) start(client);
55735
55955
  } finally {
55736
55956
  confirming = false;
55737
55957
  }
@@ -55742,7 +55962,7 @@ ${detail}` : ""}`
55742
55962
  pending2 = true;
55743
55963
  const previousStatus = checkedStatus;
55744
55964
  renderPendingStatus(null, messages.updatePreparing);
55745
- void context2.runLatest(
55965
+ void context.runLatest(
55746
55966
  (signal) => runBoundedRendererUpdateRequest(() => client.startUpdate(), signal),
55747
55967
  {
55748
55968
  success(result) {
@@ -55922,7 +56142,7 @@ ${detail}` : ""}`
55922
56142
  }
55923
56143
  pending2 = true;
55924
56144
  renderPendingStatus(null, messages.updateChecking);
55925
- return context2.runLatest(
56145
+ return context.runLatest(
55926
56146
  (signal) => runBoundedRendererUpdateRequest(() => client.checkUpdate(), signal),
55927
56147
  {
55928
56148
  success(result) {
@@ -55940,7 +56160,7 @@ ${detail}` : ""}`
55940
56160
  const client = getClient();
55941
56161
  if (!client?.getReleaseAnnouncement) return;
55942
56162
  void client.getReleaseAnnouncement({ manual: true }).then((result) => {
55943
- if (context2.signal.aborted || !result?.announcement) return;
56163
+ if (context.signal.aborted || !result?.announcement) return;
55944
56164
  currentAnnouncement = result.announcement;
55945
56165
  announcementButton.hidden = false;
55946
56166
  }).catch(() => {
@@ -59842,6 +60062,22 @@ ${detail}` : ""}`
59842
60062
  white-space: nowrap;
59843
60063
  }
59844
60064
 
60065
+ .settings-extensions-state-badge {
60066
+ display: inline-flex;
60067
+ align-items: center;
60068
+ flex: none;
60069
+ height: 18px;
60070
+ padding: 0 6px;
60071
+ border-radius: 5px;
60072
+ background: color-mix(in srgb, var(--settings-muted) 11%, transparent);
60073
+ box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--settings-muted) 22%, transparent);
60074
+ color: var(--settings-muted);
60075
+ font-size: 10.5px;
60076
+ font-weight: 500;
60077
+ line-height: 1;
60078
+ white-space: nowrap;
60079
+ }
60080
+
59845
60081
  .settings-extensions-card__meta-line {
59846
60082
  display: flex;
59847
60083
  align-items: center;
@@ -59986,11 +60222,58 @@ ${detail}` : ""}`
59986
60222
  }
59987
60223
 
59988
60224
  .settings-extensions-btn-installed--featured:focus-visible,
60225
+ .settings-extensions-btn-installed:focus-visible,
60226
+ .settings-extensions-btn-installed-disabled:focus-visible,
59989
60227
  .settings-extensions-btn-update:focus-visible {
59990
60228
  outline: 2px solid var(--settings-focus);
59991
60229
  outline-offset: 1px;
59992
60230
  }
59993
60231
 
60232
+ .settings-extensions-btn-installed-disabled {
60233
+ display: inline-flex;
60234
+ align-items: center;
60235
+ justify-content: center;
60236
+ gap: 5px;
60237
+ height: 28px;
60238
+ padding: 0 9px;
60239
+ color: var(--settings-muted);
60240
+ font: inherit;
60241
+ font-size: 11.5px;
60242
+ font-weight: 500;
60243
+ line-height: 16px;
60244
+ white-space: nowrap;
60245
+ background: color-mix(in srgb, var(--settings-muted) 9%, transparent);
60246
+ border: 0;
60247
+ border-radius: 6px;
60248
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--settings-muted) 24%, transparent);
60249
+ cursor: pointer;
60250
+ transition:
60251
+ background-color 140ms ease,
60252
+ box-shadow 140ms ease,
60253
+ color 140ms ease;
60254
+ }
60255
+
60256
+ .settings-extensions-btn-installed-disabled:hover:not(:disabled) {
60257
+ color: var(--settings-text);
60258
+ background: color-mix(in srgb, var(--settings-muted) 14%, transparent);
60259
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--settings-muted) 38%, transparent);
60260
+ }
60261
+
60262
+ .settings-extensions-btn-installed-disabled:disabled {
60263
+ opacity: 0.5;
60264
+ cursor: not-allowed;
60265
+ }
60266
+
60267
+ .settings-extensions-btn-installed-disabled__dot {
60268
+ flex: none;
60269
+ width: 6px;
60270
+ height: 6px;
60271
+ box-sizing: border-box;
60272
+ border: 1.5px solid currentColor;
60273
+ border-radius: 50%;
60274
+ opacity: 0.85;
60275
+ }
60276
+
59994
60277
  .settings-extensions-btn-update {
59995
60278
  display: inline-flex;
59996
60279
  align-items: center;
@@ -60234,6 +60517,11 @@ ${detail}` : ""}`
60234
60517
  background: var(--settings-danger);
60235
60518
  }
60236
60519
 
60520
+ .settings-extensions-card__status-dot[data-tone="neutral"] {
60521
+ background: transparent;
60522
+ box-shadow: inset 0 0 0 1.5px var(--settings-subtle);
60523
+ }
60524
+
60237
60525
  .settings-extensions-card__body {
60238
60526
  display: grid;
60239
60527
  gap: 8px;
@@ -66373,13 +66661,13 @@ ${renderer_brand_mark_default}`;
66373
66661
  var ROW = "data-app-action-sidebar-thread-row";
66374
66662
  var ID = "data-app-action-sidebar-thread-id";
66375
66663
  var HOST = "data-app-action-sidebar-thread-host-id";
66376
- function record13(value) {
66664
+ function record14(value) {
66377
66665
  return typeof value === "object" && value !== null && !Array.isArray(value);
66378
66666
  }
66379
66667
  function hooks(owner) {
66380
66668
  const result = [];
66381
66669
  let hook = owner.memoizedState;
66382
- while (record13(hook) && result.length < 4096) {
66670
+ while (record14(hook) && result.length < 4096) {
66383
66671
  result.push(hook);
66384
66672
  hook = hook.next;
66385
66673
  }
@@ -66387,7 +66675,7 @@ ${renderer_brand_mark_default}`;
66387
66675
  }
66388
66676
  function identity2(owner) {
66389
66677
  const props = owner.memoizedProps;
66390
- if (!record13(props) || !record13(props.dataAttributes)) return null;
66678
+ if (!record14(props) || !record14(props.dataAttributes)) return null;
66391
66679
  const { conversationId: threadId, hostId: hostId2, dataAttributes: attributes } = props;
66392
66680
  if (typeof threadId !== "string" || !threadId || typeof hostId2 !== "string" || !hostId2 || !(ROW in attributes) || attributes[HOST] !== hostId2 || attributes[ID] !== threadId && attributes[ID] !== `${hostId2}:${threadId}`)
66393
66681
  return null;
@@ -66399,10 +66687,10 @@ ${renderer_brand_mark_default}`;
66399
66687
  const [subscriber, deps] = memo2;
66400
66688
  const signal = deps[0];
66401
66689
  const next = hook.next;
66402
- const instance = record13(next) ? next.queue : null;
66403
- const effectHook = record13(next) ? next.next : null;
66404
- const effect = record13(effectHook) ? effectHook.memoizedState : null;
66405
- if (deps.length !== 2 || deps[1] !== void 0 || !record13(signal) || typeof signal.get !== "function" || typeof signal.subscribe !== "function" || !record13(signal.atom) || typeof signal.atom.read !== "function" || "write" in signal.atom || !record13(signal.store) || typeof signal.store.get !== "function" || typeof signal.store.sub !== "function" || !record13(subscriber) || typeof subscriber.getSnapshot !== "function" || typeof subscriber.subscribe !== "function" || !record13(instance) || typeof instance.getSnapshot !== "function" || !record13(effect) || typeof effect.create !== "function" || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe)
66690
+ const instance = record14(next) ? next.queue : null;
66691
+ const effectHook = record14(next) ? next.next : null;
66692
+ const effect = record14(effectHook) ? effectHook.memoizedState : null;
66693
+ if (deps.length !== 2 || deps[1] !== void 0 || !record14(signal) || typeof signal.get !== "function" || typeof signal.subscribe !== "function" || !record14(signal.atom) || typeof signal.atom.read !== "function" || "write" in signal.atom || !record14(signal.store) || typeof signal.store.get !== "function" || typeof signal.store.sub !== "function" || !record14(subscriber) || typeof subscriber.getSnapshot !== "function" || typeof subscriber.subscribe !== "function" || !record14(instance) || typeof instance.getSnapshot !== "function" || !record14(effect) || typeof effect.create !== "function" || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe)
66406
66694
  return null;
66407
66695
  return {
66408
66696
  atom: signal.atom,
@@ -66413,7 +66701,7 @@ ${renderer_brand_mark_default}`;
66413
66701
  };
66414
66702
  }
66415
66703
  function repairSidebarThreadState(owner) {
66416
- if (!record13(owner)) return null;
66704
+ if (!record14(owner)) return null;
66417
66705
  const key2 = identity2(owner);
66418
66706
  if (!key2) return null;
66419
66707
  const candidates = [];
@@ -66425,7 +66713,7 @@ ${renderer_brand_mark_default}`;
66425
66713
  if (instance2.value !== null || store2.get(atom2) !== null || subscriber2.getSnapshot() !== null || instance2.getSnapshot() !== null)
66426
66714
  continue;
66427
66715
  const value = atom2.read((dependency) => store2.get(dependency));
66428
- if (record13(value) && record13(value.summary) && value.summary.modelProvider === "codexhost" && value.summary.conversationId === key2.threadId && value.summary.hostId === key2.hostId && Array.isArray(value.requests) && typeof value.resumeState === "string")
66716
+ if (record14(value) && record14(value.summary) && value.summary.modelProvider === "codexhost" && value.summary.conversationId === key2.threadId && value.summary.hostId === key2.hostId && Array.isArray(value.requests) && typeof value.resumeState === "string")
66429
66717
  candidates.push(candidate2);
66430
66718
  }
66431
66719
  } catch {
@@ -66507,8 +66795,8 @@ ${renderer_brand_mark_default}`;
66507
66795
  if (seen.has(fiber)) return /* @__PURE__ */ new Set();
66508
66796
  seen.add(fiber);
66509
66797
  if (identity2(fiber)) owners.add(fiber);
66510
- if (fiber !== first && record13(fiber.sibling)) stack.push(fiber.sibling);
66511
- if (record13(fiber.child)) stack.push(fiber.child);
66798
+ if (fiber !== first && record14(fiber.sibling)) stack.push(fiber.sibling);
66799
+ if (record14(fiber.child)) stack.push(fiber.child);
66512
66800
  }
66513
66801
  if (stack.length) return /* @__PURE__ */ new Set();
66514
66802
  }
@@ -66520,7 +66808,7 @@ ${renderer_brand_mark_default}`;
66520
66808
  refresh() {
66521
66809
  const owners = sidebarOwners(root);
66522
66810
  for (const [owner, repair] of repairs) {
66523
- const current = owners.has(owner) ? owner : record13(owner.alternate) && owners.has(owner.alternate) ? owner.alternate : null;
66811
+ const current = owners.has(owner) ? owner : record14(owner.alternate) && owners.has(owner.alternate) ? owner.alternate : null;
66524
66812
  if (current && repair.isBound(current)) owners.delete(current);
66525
66813
  else {
66526
66814
  repair.dispose();
@@ -66597,10 +66885,10 @@ ${renderer_brand_mark_default}`;
66597
66885
  // src/renderer-skill-library.ts
66598
66886
  function createRendererSkillLibrary(options) {
66599
66887
  let active2 = null;
66600
- const key2 = (context2) => JSON.stringify(context2.params);
66888
+ const key2 = (context) => JSON.stringify(context.params);
66601
66889
  const current = (state) => {
66602
- const context2 = options.context(state.editor);
66603
- return active2 === state && context2?.client === state.context.client && key2(context2) === state.key;
66890
+ const context = options.context(state.editor);
66891
+ return active2 === state && context?.client === state.context.client && key2(context) === state.key;
66604
66892
  };
66605
66893
  const close = () => {
66606
66894
  active2?.unsubscribe?.();
@@ -66631,28 +66919,28 @@ ${renderer_brand_mark_default}`;
66631
66919
  } while (state.dirty && current(state));
66632
66920
  };
66633
66921
  const open2 = (editor) => {
66634
- const context2 = options.context(editor);
66635
- if (!context2) {
66922
+ const context = options.context(editor);
66923
+ if (!context) {
66636
66924
  close();
66637
66925
  return;
66638
66926
  }
66639
- if (active2?.context.client === context2.client && active2.key === key2(context2)) {
66927
+ if (active2?.context.client === context.client && active2.key === key2(context)) {
66640
66928
  active2.editor = editor;
66641
66929
  return;
66642
66930
  }
66643
66931
  close();
66644
66932
  const state = {
66645
66933
  editor,
66646
- context: context2,
66647
- key: key2(context2),
66934
+ context,
66935
+ key: key2(context),
66648
66936
  pending: false,
66649
66937
  dirty: false
66650
66938
  };
66651
66939
  active2 = state;
66652
- if (context2.client.subscribeSkillsChanged) {
66653
- state.unsubscribe = context2.client.subscribeSkillsChanged((change) => {
66940
+ if (context.client.subscribeSkillsChanged) {
66941
+ state.unsubscribe = context.client.subscribeSkillsChanged((change) => {
66654
66942
  if (!current(state)) return;
66655
- if (change.cwd && !context2.params.threadId && change.cwd !== context2.params.cwd) return;
66943
+ if (change.cwd && !context.params.threadId && change.cwd !== context.params.cwd) return;
66656
66944
  void query(state);
66657
66945
  });
66658
66946
  }
@@ -66662,9 +66950,9 @@ ${renderer_brand_mark_default}`;
66662
66950
  open: open2,
66663
66951
  close,
66664
66952
  read(editor) {
66665
- const context2 = options.context(editor);
66666
- if (!context2) return null;
66667
- if (!active2 || active2.context.client !== context2.client || active2.key !== key2(context2))
66953
+ const context = options.context(editor);
66954
+ if (!context) return null;
66955
+ if (!active2 || active2.context.client !== context.client || active2.key !== key2(context))
66668
66956
  open2(editor);
66669
66957
  const state = active2;
66670
66958
  if (!state) return null;
@@ -67583,8 +67871,109 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67583
67871
  return event.defaultPrevented;
67584
67872
  }
67585
67873
 
67874
+ // src/codex-thread-unread.ts
67875
+ var record15 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
67876
+ function isNativeThreadReadState(value) {
67877
+ return record15(value) && Object.hasOwn(value, "identityKey") && Object.hasOwn(value, "isReady") && ["read", "identityKey", "isReady", "isUnread", "subscribe"].every(
67878
+ (key2) => typeof value[key2] === "function"
67879
+ );
67880
+ }
67881
+ function isNativeSidebarUnread(value) {
67882
+ if (typeof value !== "function" || value.length !== 2) return false;
67883
+ const source = Function.prototype.toString.call(value);
67884
+ return /^function\b/u.test(source) && source.includes(".byKey.get(") && source.includes(".summary.conversationId") && source.includes(".summary.hostId") && source.includes(".summary.hasUnreadTurn") && /\?\.[\w$]+\([^)]*\.summary.hostId\)\?\.has\([^)]*\.summary.conversationId\)/u.test(source) && /\?\?\s*[\w$]+\.summary\.hasUnreadTurn\s*:\s*[\w$]+\([\w$]+,\s*[\w$]+\);?\s*\}$/u.test(source);
67885
+ }
67886
+ function createDesktopThreadUnreadWatcher(ownerWindow, importModule) {
67887
+ let loading;
67888
+ const load = () => loading ??= Promise.all([
67889
+ loadCodexNativeServices(ownerWindow, isNativeThreadReadState, importModule),
67890
+ loadCodexNativeServices(ownerWindow, isNativeSidebarUnread, importModule)
67891
+ ]).then(
67892
+ (services) => {
67893
+ if (services.some((service) => !service)) loading = void 0;
67894
+ return services;
67895
+ },
67896
+ () => {
67897
+ loading = void 0;
67898
+ return [null, null];
67899
+ }
67900
+ );
67901
+ return (threadIds, receive) => {
67902
+ const ids = [...new Set(threadIds)];
67903
+ let disposed = false;
67904
+ let revision = 0;
67905
+ let stopScope = () => {
67906
+ };
67907
+ let stopState = () => {
67908
+ };
67909
+ let previous;
67910
+ const unknown2 = () => Object.fromEntries(ids.map((id2) => [id2, null]));
67911
+ const publish = (snapshot) => {
67912
+ if (disposed || previous && ids.every((id2) => snapshot[id2] === previous?.[id2])) return;
67913
+ previous = snapshot;
67914
+ receive(Object.freeze(snapshot));
67915
+ };
67916
+ publish(unknown2());
67917
+ if (ids.length) {
67918
+ void load().then(([state, unread]) => {
67919
+ if (disposed || !state || !unread) return;
67920
+ const refresh = () => {
67921
+ const current = ++revision;
67922
+ stopScope();
67923
+ stopScope = () => {
67924
+ };
67925
+ if (disposed) return;
67926
+ const scope = readRendererAppScope(ownerWindow.document);
67927
+ if (!scope) return publish(unknown2());
67928
+ try {
67929
+ const ready = () => {
67930
+ const saved = state.read();
67931
+ return state.isReady() && record15(saved) && Array.isArray(saved.local);
67932
+ };
67933
+ if (!ready()) return publish(unknown2());
67934
+ const identity3 = state.identityKey();
67935
+ const closeScope = scope.watch(({ get }) => {
67936
+ if (disposed || current !== revision) return;
67937
+ try {
67938
+ if (!ready() || identity3 !== state.identityKey()) return publish(unknown2());
67939
+ const snapshot = Object.fromEntries(
67940
+ ids.map((id2) => {
67941
+ const value = unread(get, `local:${id2}`);
67942
+ return [id2, typeof value === "boolean" ? value : null];
67943
+ })
67944
+ );
67945
+ publish(snapshot);
67946
+ } catch {
67947
+ publish(unknown2());
67948
+ }
67949
+ });
67950
+ if (disposed || current !== revision) closeScope();
67951
+ else stopScope = closeScope;
67952
+ } catch {
67953
+ publish(unknown2());
67954
+ }
67955
+ };
67956
+ try {
67957
+ stopState = state.subscribe({ type: "snapshot", listener: refresh });
67958
+ refresh();
67959
+ } catch {
67960
+ stopScope();
67961
+ stopState();
67962
+ publish(unknown2());
67963
+ }
67964
+ });
67965
+ }
67966
+ return () => {
67967
+ disposed = true;
67968
+ revision++;
67969
+ stopScope();
67970
+ stopState();
67971
+ };
67972
+ };
67973
+ }
67974
+
67586
67975
  // src/remote-sidebar-history.ts
67587
- function record14(value) {
67976
+ function record16(value) {
67588
67977
  return typeof value === "object" && value !== null;
67589
67978
  }
67590
67979
  function sidebarCatalogForWindow(load) {
@@ -67600,22 +67989,22 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67600
67989
  async function loadSidebarCatalog(view) {
67601
67990
  const services = await loadCodexNativeServices(
67602
67991
  view,
67603
- (value) => record14(value) && Object.hasOwn(value, "appServerManagers") && Object.hasOwn(value, "localThreadCatalog") && typeof value.localThreadCatalog?.notifyThread === "function" && typeof value.localThreadCatalog?.readEntries === "function"
67992
+ (value) => record16(value) && Object.hasOwn(value, "appServerManagers") && Object.hasOwn(value, "localThreadCatalog") && typeof value.localThreadCatalog?.notifyThread === "function" && typeof value.localThreadCatalog?.readEntries === "function"
67604
67993
  );
67605
67994
  return services?.localThreadCatalog ?? null;
67606
67995
  }
67607
67996
  function observeRemoteSidebarClosures(view, closed) {
67608
67997
  const listen = ({ data, source }) => {
67609
- if (source !== null && source !== view || !record14(data) || data.type !== "mcp-notification" || typeof data.hostId !== "string" || !data.hostId.startsWith("remote-ssh") || !record14(data.params) || typeof data.params.threadId !== "string")
67998
+ if (source !== null && source !== view || !record16(data) || data.type !== "mcp-notification" || typeof data.hostId !== "string" || !data.hostId.startsWith("remote-ssh") || !record16(data.params) || typeof data.params.threadId !== "string")
67610
67999
  return;
67611
- if (data.method === "thread/closed" || data.method === "thread/status/changed" && record14(data.params.status) && data.params.status.type === "notLoaded")
68000
+ if (data.method === "thread/closed" || data.method === "thread/status/changed" && record16(data.params.status) && data.params.status.type === "notLoaded")
67612
68001
  closed(data.hostId, data.params.threadId);
67613
68002
  };
67614
68003
  view.addEventListener("message", listen);
67615
68004
  return () => view.removeEventListener("message", listen);
67616
68005
  }
67617
68006
  function emptyCachedThread(value, key2, cwd) {
67618
- return record14(value) && value.id === key2.threadId && value.hostId === key2.hostId && value.cwd === cwd && (!value.title || value.title === cwd) && value.modelProvider !== "codexhost" && value.resumeState === "needs_resume" && record14(value.threadRuntimeStatus) && value.threadRuntimeStatus.type === "notLoaded" && Array.isArray(value.requests) && value.requests.length === 0 && Array.isArray(value.turns) && value.turns.length === 0;
68007
+ return record16(value) && value.id === key2.threadId && value.hostId === key2.hostId && value.cwd === cwd && (!value.title || value.title === cwd) && value.modelProvider !== "codexhost" && value.resumeState === "needs_resume" && record16(value.threadRuntimeStatus) && value.threadRuntimeStatus.type === "notLoaded" && Array.isArray(value.requests) && value.requests.length === 0 && Array.isArray(value.turns) && value.turns.length === 0;
67619
68008
  }
67620
68009
  async function reconcileRemoteSidebarThread(manager, key2, cwd, catalogForWindow, isCurrent) {
67621
68010
  if (!manager.getConversation || !manager.discardConversationFromCache || !isCurrent()) return;
@@ -67623,7 +68012,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67623
68012
  await manager.sendRequest("thread/read", { threadId: key2.threadId, includeTurns: false });
67624
68013
  return;
67625
68014
  } catch (error62) {
67626
- if (!record14(error62) || (error62.jsonRpcCode ?? error62.code) !== -32600) throw error62;
68015
+ if (!record16(error62) || (error62.jsonRpcCode ?? error62.code) !== -32600) throw error62;
67627
68016
  if (error62.message !== `thread not loaded: ${key2.threadId}`) return;
67628
68017
  }
67629
68018
  if (!isCurrent()) return;
@@ -67632,7 +68021,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67632
68021
  const entries = await catalog.readEntries([key2]);
67633
68022
  if (!Array.isArray(entries) || entries.length > 1) return;
67634
68023
  const entry = entries[0];
67635
- if (entry != null && (!record14(entry) || entry.hostId !== key2.hostId || entry.threadId !== key2.threadId || entry.modelProvider === "codexhost" || entry.cwd !== cwd || entry.displayTitle !== cwd))
68024
+ if (entry != null && (!record16(entry) || entry.hostId !== key2.hostId || entry.threadId !== key2.threadId || entry.modelProvider === "codexhost" || entry.cwd !== cwd || entry.displayTitle !== cwd))
67636
68025
  return;
67637
68026
  const cached2 = await manager.getConversation(key2.threadId);
67638
68027
  if (!isCurrent() || cached2 != null && !emptyCachedThread(cached2, key2, cwd)) return;
@@ -67763,10 +68152,10 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67763
68152
  getClient,
67764
68153
  getLocale
67765
68154
  });
67766
- const record17 = { module, surface };
67767
- instances.set(id2, record17);
68155
+ const record19 = { module, surface };
68156
+ instances.set(id2, record19);
67768
68157
  void surface.mount(() => document2.body.append(container)).catch(() => {
67769
- if (instances.get(id2) === record17) delete record17.surface;
68158
+ if (instances.get(id2) === record19) delete record19.surface;
67770
68159
  surface.dispose();
67771
68160
  });
67772
68161
  } catch (cause) {
@@ -71488,6 +71877,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71488
71877
  ready: () => !disposed && window.__codexhostRendererBindingProbeV1?.status().adapter.state === "ready",
71489
71878
  sidebar: sidebarDom,
71490
71879
  watchTree: treeRelay.subscribe,
71880
+ watchUnread: createDesktopThreadUnreadWatcher(window),
71491
71881
  describe: (id2) => {
71492
71882
  const plugin = pluginForHost("local", id2);
71493
71883
  return plugin ? { name: plugin.name, ...plugin.icon ? { icon: plugin.icon } : {} } : id2 === "codex" ? { name: "Codex" } : void 0;
@@ -71729,7 +72119,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71729
72119
 
71730
72120
  // src/renderer-rpc-steering-queue.ts
71731
72121
  var INTERRUPTED = "Interrupted before the steer was accepted.";
71732
- var record15 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
72122
+ var record17 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71733
72123
  async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
71734
72124
  const snapshot = Promise.withResolvers();
71735
72125
  let lease;
@@ -71763,7 +72153,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71763
72153
  for (const value of /* @__PURE__ */ new Set([pending2, lease])) dispose(value);
71764
72154
  }
71765
72155
  if (messages.some(
71766
- (message2) => record15(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
72156
+ (message2) => record17(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
71767
72157
  ))
71768
72158
  throw new Error(
71769
72159
  "Resume or remove the other previously paused messages before changing direction"
@@ -71771,23 +72161,34 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71771
72161
  return async (turnId) => {
71772
72162
  await coordinator("removeQueuedMessage", threadId, messageId);
71773
72163
  const state = await manager("getThreadExecutionState", threadId);
71774
- const stillRunning = record15(state) && state.inProgress === true && state.activeTurnId === turnId;
72164
+ const stillRunning = record17(state) && state.inProgress === true && state.activeTurnId === turnId;
71775
72165
  const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
71776
- if (stillRunning || record15(turn) && turn.status === "completed")
72166
+ if (stillRunning || record17(turn) && turn.status === "completed")
71777
72167
  await coordinator("resumeInterruptedQueuedMessages", threadId);
71778
72168
  };
71779
72169
  }
71780
72170
 
71781
72171
  // src/renderer-rpc-steering.ts
71782
- var record16 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
72172
+ var record18 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71783
72173
  var invoke = (target2, name, ...args) => Reflect.apply(Reflect.get(target2, name), target2, args);
71784
- var running = (state) => record16(state) && (state.inProgress === true || !!state.activeTurnId);
71785
- var context = (previous, marker) => ({
71786
- ...record16(previous) ? previous : {},
71787
- [THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
72174
+ var running = (state) => record18(state) && (state.inProgress === true || !!state.activeTurnId);
72175
+ var withApplicationContext = (params, key2, value) => ({
72176
+ ...params,
72177
+ additionalContext: {
72178
+ ...record18(params.additionalContext) ? params.additionalContext : {},
72179
+ [key2]: { kind: "application", value }
72180
+ }
71788
72181
  });
71789
- function installRendererRpcSteering(value) {
71790
- if (!record16(value) || typeof value.forHost !== "function") return null;
72182
+ function withReferenceHost(prepared, hostId2) {
72183
+ const stamp = (params) => withApplicationContext(params, THREAD_REFERENCE_SOURCE_HOST_PARAM, hostId2);
72184
+ return {
72185
+ ...prepared,
72186
+ ...record18(prepared.steer) ? { steer: stamp(prepared.steer) } : {},
72187
+ ...record18(prepared.start) && record18(prepared.start.request) ? { start: { ...prepared.start, request: stamp(prepared.start.request) } } : {}
72188
+ };
72189
+ }
72190
+ function installRendererRpcSteering(value, routing) {
72191
+ if (!record18(value) || typeof value.forHost !== "function") return null;
71791
72192
  const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
71792
72193
  if (!descriptor?.writable) return null;
71793
72194
  const controller = value;
@@ -71802,7 +72203,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71802
72203
  throw new Error("Steering connection was retired");
71803
72204
  };
71804
72205
  const inspect = async (threadId, input3) => {
71805
- const text2 = Array.isArray(input3) ? input3.filter(record16).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
72206
+ const text2 = Array.isArray(input3) ? input3.filter(record18).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
71806
72207
  current();
71807
72208
  const delivery = await inspectRendererSteeringDelivery(
71808
72209
  (method, params) => {
@@ -71818,19 +72219,19 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71818
72219
  const target2 = async (threadId, messageId, delivery) => {
71819
72220
  const state = await invoke(rpc, "getThreadExecutionState", threadId);
71820
72221
  current();
71821
- if (!record16(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
72222
+ if (!record18(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
71822
72223
  throw new Error("Native steering target or message identity is unavailable");
71823
72224
  return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
71824
72225
  };
71825
72226
  const withoutQueueRow = async (request) => {
71826
- if (!record16(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
72227
+ if (!record18(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
71827
72228
  return request;
71828
72229
  try {
71829
72230
  const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
71830
72231
  current();
71831
72232
  if (!running(state)) return request;
71832
72233
  const message2 = request.message;
71833
- const text2 = record16(message2) && typeof message2.text === "string" ? message2.text : "";
72234
+ const text2 = record18(message2) && typeof message2.text === "string" ? message2.text : "";
71834
72235
  const delivery = await inspect(request.conversationId, [{ text: text2 }]);
71835
72236
  return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
71836
72237
  } catch {
@@ -71852,53 +72253,64 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71852
72253
  const callback = args[index];
71853
72254
  if (typeof callback !== "function")
71854
72255
  throw new Error("Native submission preparation is unavailable");
72256
+ const route = isDesktopSshHostId(hostId2) ? routing?.forHost(hostId2) : null;
72257
+ const isSameGeneration = route && captureThreadReferenceGeneration(routing, hostId2);
72258
+ let capability;
72259
+ const stamp = async (prepared) => {
72260
+ if (!isSameGeneration?.() || routing?.forHost(hostId2) !== route) return prepared;
72261
+ capability ??= supportsThreadReferenceContext(
72262
+ (method, params) => invoke(rpc, "sendRequest", method, params)
72263
+ );
72264
+ const supported = await capability;
72265
+ current();
72266
+ return supported && isSameGeneration() && routing?.forHost(hostId2) === route ? withReferenceHost(prepared, hostId2) : prepared;
72267
+ };
71855
72268
  let marker = null;
71856
72269
  let threadId;
71857
72270
  let messageId;
71858
72271
  let finish;
71859
72272
  const apply = (prepared) => {
71860
- if (!marker || !record16(prepared.steer)) return prepared;
72273
+ if (!marker || !record18(prepared.steer)) return prepared;
72274
+ const value2 = JSON.stringify(marker);
71861
72275
  const result2 = {
71862
72276
  ...prepared,
71863
- steer: {
71864
- ...prepared.steer,
71865
- additionalContext: context(prepared.steer.additionalContext, marker)
71866
- }
72277
+ steer: withApplicationContext(prepared.steer, THREAD_STEERING_CONTEXT_PARAM, value2)
71867
72278
  };
71868
72279
  if (marker.delivery !== "newTurn") return result2;
71869
- if (!record16(prepared.start) || !record16(prepared.start.request))
72280
+ if (!record18(prepared.start) || !record18(prepared.start.request))
71870
72281
  throw new Error("Native start preparation is unavailable for steering");
71871
72282
  return {
71872
72283
  ...result2,
71873
72284
  afterInactiveTurnId: marker.expectedTurnId,
71874
72285
  start: {
71875
72286
  ...prepared.start,
71876
- request: {
71877
- ...prepared.start.request,
71878
- additionalContext: context(prepared.start.request.additionalContext, marker)
71879
- }
72287
+ request: withApplicationContext(
72288
+ prepared.start.request,
72289
+ THREAD_STEERING_CONTEXT_PARAM,
72290
+ value2
72291
+ )
71880
72292
  }
71881
72293
  };
71882
72294
  };
71883
72295
  const prepare = async (...input3) => {
71884
72296
  current();
71885
- const prepared = await callback(...input3);
72297
+ const raw = await callback(...input3);
71886
72298
  current();
71887
- if (!record16(prepared)) throw new Error("Native submission preparation is malformed");
71888
- if (marker) return apply(prepared);
71889
- if (input3[1] !== "steer" || !record16(prepared.steer) || typeof prepared.conversationId !== "string")
71890
- return prepared;
71891
- threadId = prepared.conversationId;
72299
+ if (!record18(raw)) throw new Error("Native submission preparation is malformed");
72300
+ if (marker) return apply(await stamp(raw));
72301
+ if (input3[1] !== "steer" || !record18(raw.steer) || typeof raw.conversationId !== "string")
72302
+ return stamp(raw);
72303
+ threadId = raw.conversationId;
71892
72304
  const execution = await invoke(rpc, "getThreadExecutionState", threadId);
71893
72305
  current();
71894
- if (!running(execution)) return prepared;
71895
- const delivery = await inspect(threadId, prepared.steer.input);
71896
- if (delivery === "official") return prepared;
71897
- const restore = prepared.steer.restoreMessage;
71898
- messageId = record16(restore) && typeof restore.id === "string" ? restore.id : void 0;
71899
- const clientId = prepared.steer.clientUserMessageId ?? messageId;
72306
+ if (!running(execution)) return stamp(raw);
72307
+ const delivery = await inspect(threadId, raw.steer.input);
72308
+ if (delivery === "official") return stamp(raw);
72309
+ const restore = raw.steer.restoreMessage;
72310
+ messageId = record18(restore) && typeof restore.id === "string" ? restore.id : void 0;
72311
+ const clientId = raw.steer.clientUserMessageId ?? messageId;
71900
72312
  marker = await target2(threadId, clientId, delivery);
71901
- if (delivery === "activeTurn") return apply(prepared);
72313
+ if (delivery === "activeTurn") return apply(await stamp(raw));
71902
72314
  if (!messageId) throw new Error("Native queued message identity is unavailable");
71903
72315
  finish = await prepareRpcSteeringQueue(
71904
72316
  hostId2,
@@ -71909,14 +72321,14 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71909
72321
  );
71910
72322
  const start = await callback(input3[0], "start");
71911
72323
  current();
71912
- if (!record16(start)) throw new Error("Native start preparation is malformed");
71913
- return apply(start);
72324
+ if (!record18(start)) throw new Error("Native start preparation is malformed");
72325
+ return apply(await stamp(start));
71914
72326
  };
71915
72327
  const forwarded = [...args];
71916
72328
  forwarded[index] = prepare;
71917
72329
  if (key2 === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
71918
72330
  const result = await invoke(handle, key2, ...forwarded);
71919
- if (finish && record16(result) && result.status === "sent" && typeof result.turnId === "string") {
72331
+ if (finish && record18(result) && result.status === "sent" && typeof result.turnId === "string") {
71920
72332
  await finish(result.turnId).catch(
71921
72333
  () => console.error("codexhost could not reconcile native steering queue")
71922
72334
  );
@@ -71964,7 +72376,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71964
72376
  return window.__codexhostRpcSteeringV1?.controller === controller;
71965
72377
  const routing = window.__codexhostHostRoutingV1;
71966
72378
  if (!routing) return false;
71967
- const cleanup = installRendererRpcSteering(controller);
72379
+ const cleanup = installRendererRpcSteering(controller, routing);
71968
72380
  if (!cleanup) return false;
71969
72381
  const originalDispose = routing.dispose;
71970
72382
  const dispose = () => {