@codexhost/cli-win32-x64 0.29.2 → 0.31.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 (122) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +94 -20
  4. package/app/console-web.js +123 -31
  5. package/app/desktop-controller.mjs +113 -37
  6. package/app/host-runtime.mjs +3963 -2280
  7. package/app/plugins/antigravity/plugin.mjs +94 -20
  8. package/app/plugins/claude-code/plugin.mjs +105 -28
  9. package/app/plugins/codebuddy/plugin.mjs +767 -202
  10. package/app/plugins/codex-usage/plugin.mjs +112 -38
  11. package/app/plugins/copilot/plugin.mjs +94 -20
  12. package/app/plugins/cursor-cli/plugin.mjs +94 -20
  13. package/app/plugins/deepseek-harness/plugin.mjs +94 -20
  14. package/app/plugins/devin/plugin.mjs +94 -20
  15. package/app/plugins/grok/plugin.mjs +94 -20
  16. package/app/plugins/hermes/plugin.mjs +94 -20
  17. package/app/plugins/kimi-code/plugin.mjs +94 -20
  18. package/app/plugins/kiro-cli/plugin.mjs +94 -20
  19. package/app/plugins/omp/plugin.mjs +94 -20
  20. package/app/plugins/opencode/plugin.mjs +94 -20
  21. package/app/plugins/pi/plugin.mjs +94 -20
  22. package/app/plugins/qoder/plugin.mjs +94 -20
  23. package/app/plugins/qoder-cn/plugin.mjs +94 -20
  24. package/app/plugins/qwen-code/plugin.mjs +94 -20
  25. package/app/plugins/workbuddy/plugin.mjs +798 -202
  26. package/app/plugins/zcode/plugin.mjs +94 -20
  27. package/app/renderer-extension.js +702 -440
  28. package/app/web/assets/abnfDiagram-XWFEHMT6-Bqy7uOSy.js +1 -0
  29. package/app/web/assets/architectureDiagram-CSQXQB3N-6aaP1YoM.js +36 -0
  30. package/app/web/assets/blockDiagram-BEDRHYPZ-B4QSFXe0.js +140 -0
  31. package/app/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
  32. package/app/web/assets/c4Diagram-M2UUVUY5-BYE-C8Gq.js +38 -0
  33. package/app/web/assets/chunk-2Q5K7J3B-CiEM-GTd.js +1 -0
  34. package/app/web/assets/chunk-3GCGMST5-hzY9BiB1.js +1 -0
  35. package/app/web/assets/chunk-5VM5RSS4-DYXznY0H.js +15 -0
  36. package/app/web/assets/chunk-7U7NFRK5-Bzw5MDPr.js +88 -0
  37. package/app/web/assets/chunk-CNRTWJTD-DMbxMfi3.js +1 -0
  38. package/app/web/assets/chunk-D5HYT7QG-By0ZVBtD.js +1 -0
  39. package/app/web/assets/chunk-EBZ3SEQC-Yyu_sMV7.js +2 -0
  40. package/app/web/assets/chunk-JWPE2WC7-DDzqxIPT.js +1 -0
  41. package/app/web/assets/chunk-KTR4FSNJ-GlKqhtpl.js +1 -0
  42. package/app/web/assets/chunk-XXDRQBXY-DNc-CvYu.js +1 -0
  43. package/app/web/assets/classDiagram-v2-KXABOMEV-4_PFS2N_.js +217 -0
  44. package/app/web/assets/cose-bilkent-JH36ORCC-BE3foHUY.js +1 -0
  45. package/app/web/assets/cynefin-EF2NZ3EQ-D2PqrYZ3.js +141 -0
  46. package/app/web/assets/cynefinDiagram-NJNITYFG-DOObpTbq.js +62 -0
  47. package/app/web/assets/cytoscape.esm-Cm0uQArZ.js +332 -0
  48. package/app/web/assets/d3-scale-4DPf7zan.js +1 -0
  49. package/app/web/assets/dagre-KIHZ2IZ3-Znm2jin9.js +4 -0
  50. package/app/web/assets/diagram-7YQZDPLS-ByZMD-uA.js +41 -0
  51. package/app/web/assets/diagram-QBROCOUO-BiRShpnN.js +200 -0
  52. package/app/web/assets/diagram-RJJCUUZO-D9wLVoK2.js +30 -0
  53. package/app/web/assets/diagram-WERXNKYE-BSbIh-yC.js +24 -0
  54. package/app/web/assets/diagram-YHHI257C-DMWrHMc8.js +3 -0
  55. package/app/web/assets/diagram-YR4HJLHV-C4sBAFb1.js +24 -0
  56. package/app/web/assets/ebnfDiagram-N527522P-BZLloaoQ.js +1 -0
  57. package/app/web/assets/elk-O5DQBFGD-Da3e5tn5.js +27 -0
  58. package/app/web/assets/erDiagram-K3K3BIDK-B2lKAIZF.js +99 -0
  59. package/app/web/assets/flowDiagram-Z6JWZHQI-q2EY_kmB.js +213 -0
  60. package/app/web/assets/ganttDiagram-3PRQTZWP-BGrNZ20b.js +292 -0
  61. package/app/web/assets/gitGraphDiagram-VXDFKS5L-DIZNXREy.js +106 -0
  62. package/app/web/assets/graph-D8UmR1vK.js +1 -0
  63. package/app/web/assets/grid-E2QIVN74-0cUkPG69.js +1 -0
  64. package/app/web/assets/{index-aSHN2MIG.css → index-BbmB5VLj.css} +1 -1
  65. package/app/web/assets/{index-0TnaYwHS.js → index-PN7K-15_.js} +78 -78
  66. package/app/web/assets/infoDiagram-EZ3ZOAHP-BHhUTQCn.js +2 -0
  67. package/app/web/assets/ishikawaDiagram-S3EKX5GW-DPOxtl4c.js +70 -0
  68. package/app/web/assets/journeyDiagram-POQNLL5X-D8RyXckG.js +139 -0
  69. package/app/web/assets/kanban-definition-BH5XI6FM-COJv3Hyh.js +89 -0
  70. package/app/web/assets/langs/{graphql-ChAeyPkT.js → graphql-D6Z3qcRW.js} +1 -1
  71. package/app/web/assets/langs/{http-BvreBIbD.js → http-XiU9G9In.js} +1 -1
  72. package/app/web/assets/langs/{php-D8omCIuJ.js → php-DL3xwS-7.js} +1 -1
  73. package/app/web/assets/langs/{rst-Do7RLLCS.js → rst-DudRVJ9g.js} +1 -1
  74. package/app/web/assets/langs/{ruby-rH_O_vse.js → ruby-_FqsfqJi.js} +1 -1
  75. package/app/web/assets/langs/{svelte-xZy73wAj.js → svelte-ClsVJoBT.js} +1 -1
  76. package/app/web/assets/langs/{vue-C4DW8agZ.js → vue-BiKMXCyK.js} +1 -1
  77. package/app/web/assets/mermaid.core-DYdcDKIt.js +314 -0
  78. package/app/web/assets/mindmap-definition-WVAN44T4-DnYIM4ja.js +98 -0
  79. package/app/web/assets/pegDiagram-D4NLKWP3-Ds3GAEJ6.js +1 -0
  80. package/app/web/assets/pieDiagram-36ENHN4W-BhLUJGEB.js +39 -0
  81. package/app/web/assets/quadrantDiagram-ZQUDMS73-DwtX-IxK.js +7 -0
  82. package/app/web/assets/railroadDiagram-JIZHGYPL-D2vmTTnJ.js +1 -0
  83. package/app/web/assets/render-VIF2ZAQL-DGU1ql-Z.js +2 -0
  84. package/app/web/assets/requirementDiagram-AXW2TVFA-u3j1sKkI.js +84 -0
  85. package/app/web/assets/sankeyDiagram-FBCJTAIF-k-An9VHW.js +40 -0
  86. package/app/web/assets/sequenceDiagram-3LA2ROMG-DUjbYb4R.js +169 -0
  87. package/app/web/assets/sizeCapture-2Q2CQKSF-DATTL7FZ.js +1 -0
  88. package/app/web/assets/stateDiagram-v2-ATKHQDJO-cCJX5M2u.js +291 -0
  89. package/app/web/assets/swimlanes-YQL5WMAO-B7grWEWt.js +1 -0
  90. package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +8 -0
  91. package/app/web/assets/timeline-definition-7Z437IG3-BhsLa6l1.js +120 -0
  92. package/app/web/assets/usecaseDiagram-RDK6N6HP-CkPQYmQw.js +370 -0
  93. package/app/web/assets/vendor-BKfNgqAm.js +666 -0
  94. package/app/web/assets/vennDiagram-SHRQU5PJ-CufZSwvw.js +34 -0
  95. package/app/web/assets/wardleyDiagram-F3OXNVQS-CSkfpFOA.js +78 -0
  96. package/app/web/assets/xychartDiagram-GDYJKCDI-BhZf9scK.js +7 -0
  97. package/app/web/codexhost-settings.js +57 -57
  98. package/app/web/index.html +3 -3
  99. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  100. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  101. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
  102. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  104. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +12 -12
  105. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
  106. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
  107. package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
  108. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  109. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  110. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  111. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  112. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -72
  113. package/app/web-modules/licenses/DSH-THIRD_PARTY_NOTICES.md +1 -1
  114. package/app/web-modules/server.mjs +724 -259
  115. package/bin/codexhost.exe +0 -0
  116. package/libexec/codexhost-node-repl.exe +0 -0
  117. package/libexec/codexhost-screenshot.exe +0 -0
  118. package/libexec/codexhost-shell.exe +0 -0
  119. package/libexec/codexhost-shim.exe +0 -0
  120. package/libexec/codexhost-updater.exe +0 -0
  121. package/package.json +1 -1
  122. package/app/web/assets/vendor-C9g2bw8s.js +0 -410
@@ -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,17 +20623,17 @@ 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
- for (const [index, thread2] of threads.entries()) {
20629
- if (seen.has(thread2.threadId)) {
20630
- context2.addIssue({
20628
+ for (const [index, thread3] of threads.entries()) {
20629
+ if (seen.has(thread3.threadId)) {
20630
+ context.addIssue({
20631
20631
  code: "custom",
20632
20632
  message: "Thread ownership-list results must be unique",
20633
20633
  path: ["threads", index, "threadId"]
20634
20634
  });
20635
20635
  }
20636
- seen.add(thread2.threadId);
20636
+ seen.add(thread3.threadId);
20637
20637
  }
20638
20638
  });
20639
20639
  var threadSteeringInspectParamsSchema = external_exports.object({
@@ -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"])
@@ -21449,9 +21449,71 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21449
21449
  message: "Telemetry heartbeat must contain at least one countable field"
21450
21450
  });
21451
21451
 
21452
+ // ../shared-contracts/dist/native-codex-goal.js
21453
+ var NATIVE_CODEX_GOAL_METHOD = "codexhost/thread/goal";
21454
+ var NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS = 4e3;
21455
+ var thread = { threadId: hostThreadIdSchema };
21456
+ var nativeCodexGoalRequestSchema = external_exports.discriminatedUnion("action", [
21457
+ external_exports.strictObject({ ...thread, action: external_exports.enum(["get", "pause", "resume", "clear"]) }),
21458
+ external_exports.strictObject({
21459
+ ...thread,
21460
+ action: external_exports.enum(["create", "edit"]),
21461
+ objective: external_exports.string().trim().min(1).refine((objective) => Array.from(objective).length <= NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS, `A goal objective can have up to ${NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS} characters.`)
21462
+ })
21463
+ ]);
21464
+ var nativeCodexGoalResultSchema = external_exports.object({
21465
+ goal: external_exports.object({
21466
+ threadId: hostThreadIdSchema,
21467
+ objective: external_exports.string(),
21468
+ status: external_exports.enum(["active", "paused", "blocked", "usageLimited", "budgetLimited", "complete"]),
21469
+ tokenBudget: external_exports.int().positive().nullable().default(null),
21470
+ tokensUsed: external_exports.int().nonnegative(),
21471
+ timeUsedSeconds: external_exports.int().nonnegative()
21472
+ }).nullable()
21473
+ });
21474
+
21452
21475
  // ../shared-contracts/dist/client-channel.js
21453
21476
  var CLIENT_CHANNEL_VERSION = 1;
21454
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
+ ]);
21455
21517
  var CLIENT_CHANNEL_METHODS = [
21456
21518
  "codexhost/skills/list",
21457
21519
  "codexhost/voice/status",
@@ -21461,10 +21523,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21461
21523
  "codexhost/harness/display-settings/capabilities",
21462
21524
  "codexhost/harness/preferences/get",
21463
21525
  "codexhost/harness/preferences/patch",
21526
+ "experimentalFeature/list",
21464
21527
  "thread/list",
21465
21528
  "thread/metadata/update",
21466
21529
  "codexhost/thread/catalog/read",
21467
21530
  "thread/read",
21531
+ NATIVE_CODEX_GOAL_METHOD,
21468
21532
  "thread/resume",
21469
21533
  "thread/fork",
21470
21534
  "thread/turns/list",
@@ -21496,6 +21560,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21496
21560
  "codexhost/thread/pins/list",
21497
21561
  "codexhost/thread/sections/list",
21498
21562
  "codexhost/thread/sections/move",
21563
+ CLIENT_THREAD_SECTION_MUTATIONS.create.method,
21564
+ CLIENT_THREAD_SECTION_MUTATIONS.update.method,
21565
+ CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
21499
21566
  "codexhost/thread/pins/set",
21500
21567
  "codexhost/harness/plugins/list",
21501
21568
  "codexhost/harness/inspect",
@@ -21546,16 +21613,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21546
21613
  "codexhost/sessions/loaded/list"
21547
21614
  ];
21548
21615
  var clientThreadSectionsSchema = external_exports.object({
21616
+ [THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
21617
+ complete: external_exports.literal(false).optional(),
21549
21618
  sections: external_exports.array(external_exports.object({
21550
21619
  id: external_exports.string().min(1),
21551
21620
  name: external_exports.string().min(1),
21621
+ appearance: clientThreadSectionAppearanceSchema.optional(),
21552
21622
  threads: external_exports.array(jsonObjectSchema)
21553
- }).strict())
21554
- }).strict();
21623
+ }))
21624
+ });
21555
21625
  var clientThreadSectionMoveSchema = external_exports.object({
21556
21626
  threadId: external_exports.string().min(1).max(1024),
21557
- sectionId: external_exports.string().min(1).max(1024).nullable()
21558
- }).strict();
21627
+ sectionId: external_exports.string().min(1).max(1024).nullable(),
21628
+ beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
21629
+ expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
21630
+ }).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
21559
21631
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
21560
21632
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
21561
21633
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -21602,6 +21674,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21602
21674
  harnessId: external_exports.string().min(1)
21603
21675
  }),
21604
21676
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
21677
+ external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
21605
21678
  external_exports.object({
21606
21679
  type: external_exports.literal("preferences-changed"),
21607
21680
  cursor: clientChannelCursorSchema,
@@ -21768,7 +21841,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21768
21841
  startedAt: external_exports.number(),
21769
21842
  epoch: external_exports.string().uuid(),
21770
21843
  capabilities: external_exports.object({
21771
- peerDelegation: external_exports.literal(1).optional()
21844
+ peerDelegation: external_exports.literal(1).optional(),
21845
+ threadReferenceContext: external_exports.literal(1).optional()
21772
21846
  }).optional()
21773
21847
  });
21774
21848
  var clientChannelResponseSchema = external_exports.object({
@@ -22030,7 +22104,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22030
22104
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
22031
22105
  var REMOTE_THREAD_READ_TIMEOUT_MS = 35e3;
22032
22106
  var DELEGATION_READ_METHOD = "codexhost/thread/delegation-read";
22107
+ var THREAD_REFERENCE_CONTEXT_CAPABILITY_METHOD = "codexhost/thread/reference-context/capability";
22033
22108
  var THREAD_REFERENCE_SOURCE_HOST_PARAM = "codexhostSourceHostId";
22109
+ function isDesktopSshHostId(hostId2) {
22110
+ return typeof hostId2 === "string" && hostId2.length <= 1024 && /^remote-ssh(?:-[^:\x00-\x20\x7f]+)?:[^\x00-\x20\x7f]+$/u.test(hostId2);
22111
+ }
22034
22112
  var delegationReadParamsSchema = external_exports.strictObject({
22035
22113
  threadId: external_exports.string().min(1).max(1024),
22036
22114
  view: external_exports.enum(["result", "messages"]),
@@ -23338,11 +23416,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23338
23416
  * `live` once their Session's live catalog has loaded.
23339
23417
  */
23340
23418
  source: external_exports.enum(["live", "static"]).optional()
23341
- }).strict().superRefine((catalog, context2) => {
23419
+ }).strict().superRefine((catalog, context) => {
23342
23420
  const ids = /* @__PURE__ */ new Set();
23343
23421
  for (const [index, command] of catalog.commands.entries()) {
23344
23422
  if (ids.has(command.id)) {
23345
- context2.addIssue({
23423
+ context.addIssue({
23346
23424
  code: "custom",
23347
23425
  message: "Harness command IDs must be unique",
23348
23426
  path: ["commands", index, "id"]
@@ -23479,9 +23557,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23479
23557
  npmDownload: npmDownloadProgressSchema.optional(),
23480
23558
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
23481
23559
  serviceStopOutput: external_exports.string().optional()
23482
- }).superRefine((status, context2) => {
23560
+ }).superRefine((status, context) => {
23483
23561
  if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
23484
- context2.addIssue({
23562
+ context.addIssue({
23485
23563
  code: "custom",
23486
23564
  path: ["downloadedBytes"],
23487
23565
  message: "downloadedBytes must not exceed totalBytes"
@@ -23613,10 +23691,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23613
23691
  var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
23614
23692
  function desktopImageAttachmentPaths(text2) {
23615
23693
  const end = text2.search(REQUEST_HEADING);
23616
- const context2 = end < 0 ? text2 : text2.slice(0, end);
23617
- if (!ATTACHED_FILES_HEADING.test(context2))
23694
+ const context = end < 0 ? text2 : text2.slice(0, end);
23695
+ if (!ATTACHED_FILES_HEADING.test(context))
23618
23696
  return [];
23619
- return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
23697
+ return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
23620
23698
  }
23621
23699
 
23622
23700
  // ../shared-contracts/dist/thread-watch-notice.js
@@ -23674,7 +23752,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23674
23752
  var target = {
23675
23753
  hostId: identity.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)
23676
23754
  };
23677
- var thread = { ...target, threadId: identity };
23755
+ var thread2 = { ...target, threadId: identity };
23678
23756
  var text = external_exports.string().min(1).max(8e3);
23679
23757
  var input2 = { text, requestId: identity };
23680
23758
  var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
@@ -23725,7 +23803,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23725
23803
  serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
23726
23804
  reasoningEffort: identity.optional()
23727
23805
  }),
23728
- external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
23806
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread2 }),
23729
23807
  external_exports.strictObject({
23730
23808
  kind: external_exports.literal("list"),
23731
23809
  ...target,
@@ -23735,7 +23813,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23735
23813
  }),
23736
23814
  external_exports.strictObject({
23737
23815
  kind: external_exports.literal("read"),
23738
- ...thread,
23816
+ ...thread2,
23739
23817
  page: external_exports.strictObject({
23740
23818
  cursor: external_exports.string().min(1).max(8192).nullable(),
23741
23819
  epoch: identity.optional(),
@@ -23745,10 +23823,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23745
23823
  message: "A history continuation requires its connection epoch"
23746
23824
  }).optional()
23747
23825
  }),
23748
- external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
23826
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread2, epoch: identity }),
23749
23827
  external_exports.strictObject({
23750
23828
  kind: external_exports.literal("configure"),
23751
- ...thread,
23829
+ ...thread2,
23752
23830
  epoch: identity,
23753
23831
  modelId: identity.optional(),
23754
23832
  serviceTier: harnessModelServiceTierSchema.optional(),
@@ -23759,15 +23837,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23759
23837
  }),
23760
23838
  external_exports.strictObject({
23761
23839
  kind: external_exports.literal("prompt"),
23762
- ...thread,
23840
+ ...thread2,
23763
23841
  epoch: identity,
23764
23842
  text,
23765
23843
  requestId: identity.optional()
23766
23844
  }),
23767
- external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
23845
+ external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread2, epoch: identity }),
23768
23846
  external_exports.strictObject({
23769
23847
  kind: external_exports.literal("delivery"),
23770
- ...thread,
23848
+ ...thread2,
23771
23849
  epoch: identity,
23772
23850
  action: external_exports.discriminatedUnion("kind", [
23773
23851
  external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
@@ -23781,17 +23859,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
23781
23859
  external_exports.strictObject({ kind: external_exports.literal("sendNow"), itemId: identity })
23782
23860
  ])
23783
23861
  }),
23784
- external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
23862
+ external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread2, epoch: identity, turnId: identity }),
23785
23863
  external_exports.strictObject({
23786
23864
  kind: external_exports.literal("rename"),
23787
- ...thread,
23865
+ ...thread2,
23788
23866
  epoch: identity,
23789
23867
  name: external_exports.string().min(1).max(512)
23790
23868
  }),
23791
- external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread, epoch: identity, archived: external_exports.boolean() }),
23869
+ external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread2, epoch: identity, archived: external_exports.boolean() }),
23792
23870
  external_exports.strictObject({
23793
23871
  kind: external_exports.literal("respond"),
23794
- ...thread,
23872
+ ...thread2,
23795
23873
  epoch: identity,
23796
23874
  requestId: external_exports.union([identity, external_exports.number().int()]),
23797
23875
  result: external_exports.record(external_exports.string(), external_exports.unknown())
@@ -24950,7 +25028,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24950
25028
  let disposed = false;
24951
25029
  let inFlight = false;
24952
25030
  let revision = 0;
24953
- let context2 = null;
25031
+ let context = null;
24954
25032
  let card = null;
24955
25033
  let cardKey = null;
24956
25034
  const unsupported = /* @__PURE__ */ new WeakSet();
@@ -24968,12 +25046,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24968
25046
  const refresh = async () => {
24969
25047
  if (disposed) return;
24970
25048
  const next = readContext();
24971
- if (!same(context2, next)) {
25049
+ if (!same(context, next)) {
24972
25050
  clear();
24973
- context2 = next;
25051
+ context = next;
24974
25052
  revision++;
24975
25053
  }
24976
- const current = context2;
25054
+ const current = context;
24977
25055
  if (!current || inFlight || unsupported.has(current.route)) return;
24978
25056
  const startedRevision = revision;
24979
25057
  inFlight = true;
@@ -25018,7 +25096,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25018
25096
  );
25019
25097
  threadQuestionRespondResultSchema.parse(raw2);
25020
25098
  drafts.delete(key2);
25021
- if (same(current, context2)) {
25099
+ if (same(current, context)) {
25022
25100
  revision++;
25023
25101
  if (cardKey === key2) clear(false);
25024
25102
  }
@@ -25028,7 +25106,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25028
25106
  current.composer.before(card.root);
25029
25107
  } catch (error62) {
25030
25108
  if (isUnsupportedMethod(error62, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
25031
- if (revision === startedRevision && same(current, context2)) clear();
25109
+ if (revision === startedRevision && same(current, context)) clear();
25032
25110
  } finally {
25033
25111
  inFlight = false;
25034
25112
  }
@@ -25040,7 +25118,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25040
25118
  return {
25041
25119
  refresh,
25042
25120
  refreshContext() {
25043
- if (!same(context2, readContext()) || card && !card.root.isConnected) void refresh();
25121
+ if (!same(context, readContext()) || card && !card.root.isConnected) void refresh();
25044
25122
  },
25045
25123
  dispose() {
25046
25124
  disposed = true;
@@ -25132,6 +25210,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25132
25210
  return stack.length > 0 ? exhausted() : [];
25133
25211
  }
25134
25212
 
25213
+ // ../desktop-control/dist/renderer-app-scope.js
25214
+ var record5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25215
+ function readRendererAppScope(root) {
25216
+ const scopes = /* @__PURE__ */ new Map();
25217
+ const seen = /* @__PURE__ */ new Set();
25218
+ for (const main of root.querySelectorAll("main")) {
25219
+ const keys = Object.getOwnPropertyNames(main).filter((key3) => key3.startsWith("__reactFiber$"));
25220
+ const key2 = keys[0];
25221
+ if (keys.length !== 1 || !key2)
25222
+ continue;
25223
+ for (const fiber of committedReactAncestors(Reflect.get(main, key2))) {
25224
+ if (seen.has(fiber))
25225
+ break;
25226
+ seen.add(fiber);
25227
+ let hook = fiber.memoizedState;
25228
+ for (let n = 0; record5(hook) && "next" in hook && n < 150; n++, hook = hook.next) {
25229
+ const handle = record5(hook.memoizedState) ? hook.memoizedState.current : null;
25230
+ 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))
25231
+ continue;
25232
+ scopes.set(handle.node, handle);
25233
+ }
25234
+ }
25235
+ }
25236
+ return scopes.size === 1 ? scopes.values().next().value ?? null : null;
25237
+ }
25238
+
25135
25239
  // ../desktop-control/dist/renderer-native-schedule-sidebar.js
25136
25240
  var NATIVE_SCHEDULE_SIDEBAR_ROW_SELECTOR = 'aside [data-sidebar-cycle-item][role="button"][aria-labelledby]';
25137
25241
  function readNativeScheduleSidebarThread(element) {
@@ -25166,7 +25270,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25166
25270
  }
25167
25271
 
25168
25272
  // ../desktop-control/dist/renderer-scoped-draft-model.js
25169
- function record5(value) {
25273
+ function record6(value) {
25170
25274
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
25171
25275
  }
25172
25276
  function isDraftId(value) {
@@ -25181,31 +25285,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25181
25285
  if (!draftId || ids.length < 2 || ids.some((id2) => id2 !== draftId))
25182
25286
  return [];
25183
25287
  return [...new Set(row)].flatMap((value) => {
25184
- const result = record5(value);
25185
- const draft = record5(result?.draftSettings);
25288
+ const result = record6(value);
25289
+ const draft = record6(result?.draftSettings);
25186
25290
  const update = result?.updateDraftSettings;
25187
25291
  return result?.isNewThreadDraft === true && draft && row.includes(draft) && typeof update === "function" && repeated(row, update) ? [{ draftId, draft, update }] : [];
25188
25292
  });
25189
25293
  }
25190
25294
  function modelContexts(row) {
25191
25295
  return [...new Set(row)].flatMap((value) => {
25192
- const result = record5(value);
25296
+ const result = record6(value);
25193
25297
  const callback = result?.setModelAndReasoningEffort;
25194
25298
  const usesAccountPreferences = result?.usesAccountPreferences;
25195
- if (typeof callback !== "function" || !repeated(row, callback) || typeof usesAccountPreferences !== "boolean" || !row.some((context2) => context2 !== value && record5(context2)?.usesAccountPreferences === usesAccountPreferences))
25299
+ if (typeof callback !== "function" || !repeated(row, callback) || typeof usesAccountPreferences !== "boolean" || !row.some((context) => context !== value && record6(context)?.usesAccountPreferences === usesAccountPreferences))
25196
25300
  return [];
25197
- return [{ row, usesAccountPreferences, settings: record5(result?.modelSettings) }];
25301
+ return [{ row, usesAccountPreferences, settings: record6(result?.modelSettings) }];
25198
25302
  });
25199
25303
  }
25200
25304
  function collaborationMode(value) {
25201
- const mode = record5(value);
25202
- const settings = record5(mode?.settings);
25305
+ const mode = record6(value);
25306
+ const settings = record6(mode?.settings);
25203
25307
  return typeof mode?.mode === "string" && settings && typeof settings.model === "string" ? mode : null;
25204
25308
  }
25205
25309
  function activeModes(row) {
25206
25310
  const modes = /* @__PURE__ */ new Set();
25207
25311
  for (const value of row) {
25208
- const mode = collaborationMode(record5(value)?.activeMode);
25312
+ const mode = collaborationMode(record6(value)?.activeMode);
25209
25313
  if (mode && row.includes(mode) && row.includes(mode.settings))
25210
25314
  modes.add(mode);
25211
25315
  }
@@ -25215,7 +25319,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25215
25319
  const modes = /* @__PURE__ */ new Set();
25216
25320
  for (const row of rows) {
25217
25321
  if (!row.includes(draftId) || row.some((value) => isDraftId(value) && value !== draftId) || !row.some((value) => {
25218
- const result = record5(value);
25322
+ const result = record6(value);
25219
25323
  return typeof result?.handleSubmitLocal === "function" && typeof result.handleNewWorktreeConversation === "function";
25220
25324
  }))
25221
25325
  continue;
@@ -25242,7 +25346,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25242
25346
  const submitModes = /* @__PURE__ */ new Set();
25243
25347
  const owners = [];
25244
25348
  for (const ancestor of committedReactAncestors(fiber)) {
25245
- const data = record5(record5(ancestor.updateQueue)?.memoCache)?.data;
25349
+ const data = record6(record6(ancestor.updateQueue)?.memoCache)?.data;
25246
25350
  if (!Array.isArray(data))
25247
25351
  continue;
25248
25352
  const rows = data.filter(Array.isArray);
@@ -25354,16 +25458,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25354
25458
  }
25355
25459
 
25356
25460
  // ../desktop-control/dist/renderer-native-schedule-form.js
25357
- var record6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25461
+ var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25358
25462
  function ancestors(element) {
25359
- if (!record6(element))
25463
+ if (!record7(element))
25360
25464
  return [];
25361
25465
  const key2 = Object.getOwnPropertyNames(element).find((name) => name.startsWith("__reactFiber$"));
25362
25466
  return committedReactAncestors(key2 ? Object.getOwnPropertyDescriptor(element, key2)?.value : null);
25363
25467
  }
25364
25468
  function readNativeScheduleForm(form) {
25365
25469
  const candidates = ancestors(form).flatMap(({ memoizedProps: props2 }) => {
25366
- 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")
25470
+ 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")
25367
25471
  return [];
25368
25472
  return [props2];
25369
25473
  });
@@ -25372,7 +25476,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25372
25476
  return null;
25373
25477
  const draft = props.draft;
25374
25478
  const change = props.onChange;
25375
- 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);
25479
+ 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);
25376
25480
  return {
25377
25481
  selection: {
25378
25482
  model: draft.model,
@@ -25403,11 +25507,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25403
25507
  const node2 = fiber.stateNode;
25404
25508
  if (node2 === form)
25405
25509
  break;
25406
- 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))
25510
+ 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))
25407
25511
  host = node2;
25408
25512
  const props = fiber.memoizedProps;
25409
- const label = record6(props) && record6(props.label) ? props.label.props : null;
25410
- if (record6(label) && ["inbox.automations.model.label", "automations.configuration.effort"].includes(String(label.id))) {
25513
+ const label = record7(props) && record7(props.label) ? props.label.props : null;
25514
+ if (record7(label) && ["inbox.automations.model.label", "automations.configuration.effort"].includes(String(label.id))) {
25411
25515
  if (host)
25412
25516
  rows.add(host);
25413
25517
  break;
@@ -25419,14 +25523,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25419
25523
 
25420
25524
  // ../desktop-control/dist/renderer-host-discovery.js
25421
25525
  function requestManagerFromHookState(value, hostId2) {
25422
- const record17 = (candidate) => typeof candidate === "object" && candidate !== null;
25526
+ const record19 = (candidate) => typeof candidate === "object" && candidate !== null;
25423
25527
  const manager = (candidate) => {
25424
- if (!record17(candidate) || !record17(candidate.requestClient) || !record17(candidate.prewarmedThreadManager))
25528
+ if (!record19(candidate) || !record19(candidate.requestClient) || !record19(candidate.prewarmedThreadManager))
25425
25529
  return null;
25426
25530
  const bridge = candidate.requestClient;
25427
25531
  return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
25428
25532
  };
25429
- if (!record17(value))
25533
+ if (!record19(value))
25430
25534
  return null;
25431
25535
  const direct = manager(value) ?? manager(value.manager);
25432
25536
  if (direct)
@@ -25489,20 +25593,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25489
25593
 
25490
25594
  // ../desktop-control/dist/renderer-host-rpc-discovery.js
25491
25595
  function findRendererHostRpcFamily(store) {
25492
- const record17 = (value) => typeof value === "object" && value !== null;
25596
+ const record19 = (value) => typeof value === "object" && value !== null;
25493
25597
  const families = /* @__PURE__ */ new Set();
25494
25598
  for (const [definition, members2] of store.familyBindings) {
25495
- if (!record17(definition) || definition.kind !== "signal-family")
25599
+ if (!record19(definition) || definition.kind !== "signal-family")
25496
25600
  continue;
25497
- if (!record17(members2) || typeof members2.get !== "function")
25601
+ if (!record19(members2) || typeof members2.get !== "function")
25498
25602
  continue;
25499
25603
  for (const [hostId2, member] of members2) {
25500
25604
  if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:])/u.test(hostId2))
25501
25605
  continue;
25502
- if (!record17(member))
25606
+ if (!record19(member))
25503
25607
  continue;
25504
25608
  const signal = member.value;
25505
- if (!record17(signal) || typeof signal.get !== "function")
25609
+ if (!record19(signal) || typeof signal.get !== "function")
25506
25610
  continue;
25507
25611
  let value;
25508
25612
  try {
@@ -25510,7 +25614,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25510
25614
  } catch {
25511
25615
  continue;
25512
25616
  }
25513
- if (record17(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record17(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
25617
+ if (record19(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record19(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
25514
25618
  families.add(members2);
25515
25619
  break;
25516
25620
  }
@@ -25523,9 +25627,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25523
25627
  function resolveRendererHostRpc(discovery, hostId2) {
25524
25628
  if (hostId2 === "durable")
25525
25629
  return null;
25526
- const record17 = (value2) => typeof value2 === "object" && value2 !== null;
25630
+ const record19 = (value2) => typeof value2 === "object" && value2 !== null;
25527
25631
  const signal = discovery.family.get(hostId2)?.value;
25528
- if (!record17(signal) || typeof signal.get !== "function")
25632
+ if (!record19(signal) || typeof signal.get !== "function")
25529
25633
  return null;
25530
25634
  let value;
25531
25635
  try {
@@ -25533,43 +25637,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25533
25637
  } catch {
25534
25638
  return null;
25535
25639
  }
25536
- if (!record17(value) || value.status !== "ready" || !record17(value.client) || value.client.hostId !== hostId2)
25640
+ if (!record19(value) || value.status !== "ready" || !record19(value.client) || value.client.hostId !== hostId2)
25537
25641
  return null;
25538
25642
  const rpc = value.client.rpc;
25539
- return typeof rpc === "function" || record17(rpc) ? rpc : null;
25643
+ return typeof rpc === "function" || record19(rpc) ? rpc : null;
25540
25644
  }
25541
25645
 
25542
25646
  // ../desktop-control/dist/renderer-schedule-workspace-rpc.js
25543
- var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25647
+ var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25544
25648
  function localAppScope(root) {
25545
- const scopes = /* @__PURE__ */ new Map();
25546
- const seen = /* @__PURE__ */ new Set();
25547
- for (const main of root.querySelectorAll("main")) {
25548
- const keys = Object.getOwnPropertyNames(main).filter((key3) => key3.startsWith("__reactFiber$"));
25549
- const key2 = keys[0];
25550
- if (keys.length !== 1 || !key2)
25551
- continue;
25552
- for (const fiber of committedReactAncestors(Reflect.get(main, key2))) {
25553
- if (seen.has(fiber))
25554
- break;
25555
- seen.add(fiber);
25556
- let hook = fiber.memoizedState;
25557
- for (let n = 0; record7(hook) && "next" in hook && n < 150; n++, hook = hook.next) {
25558
- const handle = record7(hook.memoizedState) ? hook.memoizedState.current : null;
25559
- 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))
25560
- continue;
25561
- scopes.set(handle.node, { handle, store: handle.node });
25562
- }
25563
- }
25564
- }
25565
- const scope = scopes.values().next().value;
25566
- if (scopes.size !== 1 || !scope)
25649
+ const handle = readRendererAppScope(root);
25650
+ if (!handle)
25567
25651
  throw new Error("Native local app scope is missing or ambiguous");
25568
- const discovery = findRendererHostRpcFamily(scope.store);
25652
+ const discovery = findRendererHostRpcFamily(handle.node);
25569
25653
  const rpc = discovery && resolveRendererHostRpc(discovery, "local");
25570
25654
  if (!discovery || !rpc)
25571
25655
  throw new Error("Native local app RPC is unavailable");
25572
- return { ...scope, discovery, rpc };
25656
+ return { handle, store: handle.node, discovery, rpc };
25573
25657
  }
25574
25658
  async function createRpcScheduleWorkspaceThread(root, routing, route, createThread, input3, signal) {
25575
25659
  if (!route.policy.scopedCreation)
@@ -25589,11 +25673,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25589
25673
  };
25590
25674
  const readEmpty = async (threadId) => {
25591
25675
  const read = await request("thread/read", { threadId, includeTurns: false });
25592
- if (!record7(read) || !record7(read.thread) || read.thread.id !== threadId || !record7(read.thread.status))
25676
+ if (!record8(read) || !record8(read.thread) || read.thread.id !== threadId || !record8(read.thread.status))
25593
25677
  throw new Error("The created chat could not be read");
25594
25678
  const turns = await request("thread/turns/list", { threadId, cursor: null, limit: 1 });
25595
25679
  const queue = await request("thread/queue/list", { threadId, cursor: null, limit: 1 });
25596
- if (!record7(turns) || !Array.isArray(turns.data) || !("nextCursor" in turns) || !record7(queue) || !Array.isArray(queue.data) || !("nextCursor" in queue))
25680
+ if (!record8(turns) || !Array.isArray(turns.data) || !("nextCursor" in turns) || !record8(queue) || !Array.isArray(queue.data) || !("nextCursor" in queue))
25597
25681
  throw new Error("The created chat's history or queue could not be confirmed");
25598
25682
  return {
25599
25683
  thread: read.thread,
@@ -25623,7 +25707,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25623
25707
  };
25624
25708
  signal.addEventListener("abort", discardAfterDismissal, { once: true });
25625
25709
  const remember = (result) => {
25626
- if (!record7(result) || result.status !== "created")
25710
+ if (!record8(result) || result.status !== "created")
25627
25711
  return;
25628
25712
  const id2 = hostThreadIdSchema.safeParse(result.conversationId);
25629
25713
  if (!id2.success)
@@ -25645,15 +25729,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25645
25729
  assertRequestCurrent: assertCurrent,
25646
25730
  onSettled: remember
25647
25731
  });
25648
- const result = record7(output2) && output2.kind === "creation" ? output2.result : null;
25732
+ const result = record8(output2) && output2.kind === "creation" ? output2.result : null;
25649
25733
  remember(result);
25650
25734
  assertCurrent();
25651
- if (!record7(result) || result.status !== "created" || !createdId || !record7(result.firstTurn) || result.firstTurn.status !== "not-requested")
25735
+ if (!record8(result) || result.status !== "created" || !createdId || !record8(result.firstTurn) || result.firstTurn.status !== "not-requested")
25652
25736
  throw new Error("Chat creation was not confirmed. Check the chat list before creating another task.");
25653
- const { thread: thread2, empty } = await readEmpty(createdId);
25737
+ const { thread: thread3, empty } = await readEmpty(createdId);
25654
25738
  const inspection = threadInspectionSchema.parse(await request("codexhost/thread/inspect", { threadId: createdId }));
25655
25739
  assertCurrent();
25656
- if (!empty || thread2.cwd !== input3.workspace.cwd || inspection.owner !== "external" || inspection.transportModelId !== input3.model)
25740
+ if (!empty || thread3.cwd !== input3.workspace.cwd || inspection.owner !== "external" || inspection.transportModelId !== input3.model)
25657
25741
  throw new Error("The created chat's workspace, Model or empty state could not be confirmed");
25658
25742
  return {
25659
25743
  threadId: createdId,
@@ -25675,13 +25759,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25675
25759
  }
25676
25760
 
25677
25761
  // ../desktop-control/dist/renderer-schedule-workspace.js
25678
- var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25762
+ var record9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
25679
25763
  function readNativeScheduleWorkspaces(root) {
25680
25764
  const projects = /* @__PURE__ */ new Map();
25681
25765
  const ambiguous = /* @__PURE__ */ new Set();
25682
25766
  const seen = /* @__PURE__ */ new Set();
25683
25767
  const add = (value) => {
25684
- if (!record8(value) || value.source !== "codex" || !record8(value.group))
25768
+ if (!record9(value) || value.source !== "codex" || !record9(value.group))
25685
25769
  return;
25686
25770
  const group = value.group;
25687
25771
  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"))
@@ -25703,7 +25787,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25703
25787
  break;
25704
25788
  seen.add(fiber);
25705
25789
  const props = fiber.memoizedProps;
25706
- if (!record8(props))
25790
+ if (!record9(props))
25707
25791
  continue;
25708
25792
  add(props.project);
25709
25793
  if (props.projectByKey instanceof Map)
@@ -25746,7 +25830,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25746
25830
  }
25747
25831
  }));
25748
25832
  const scope = scopes.values().next().value;
25749
- if (scopes.size !== 1 || !record8(scope) || typeof scope.get !== "function")
25833
+ if (scopes.size !== 1 || !record9(scope) || typeof scope.get !== "function")
25750
25834
  throw new Error("Native local chat scope is missing or ambiguous");
25751
25835
  if (!readNativeScheduleWorkspaces(root).some(({ id: id2, cwd }) => id2 === input3.workspace.id && cwd === input3.workspace.cwd))
25752
25836
  throw new Error("The selected workspace is no longer available");
@@ -25759,7 +25843,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25759
25843
  const id2 = createdId;
25760
25844
  released = true;
25761
25845
  const conversation2 = manager.getConversation(id2);
25762
- if (!record8(conversation2) || !Array.isArray(conversation2.turns) || conversation2.turns.length || Array.isArray(conversation2.requests) && conversation2.requests.length > 0 || conversation2.pendingRequest != null)
25846
+ if (!record9(conversation2) || !Array.isArray(conversation2.turns) || conversation2.turns.length || Array.isArray(conversation2.requests) && conversation2.requests.length > 0 || conversation2.pendingRequest != null)
25763
25847
  return;
25764
25848
  void Promise.resolve().then(() => manager.archiveConversation(id2, {
25765
25849
  useAppServerPins: false,
@@ -25768,7 +25852,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25768
25852
  };
25769
25853
  signal.addEventListener("abort", discard, { once: true });
25770
25854
  const remember = (result2) => {
25771
- if (!record8(result2) || result2.status !== "created")
25855
+ if (!record9(result2) || result2.status !== "created")
25772
25856
  return;
25773
25857
  const id2 = hostThreadIdSchema.safeParse(result2.conversationId);
25774
25858
  if (id2.success)
@@ -25785,16 +25869,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
25785
25869
  startWithoutFirstTurn: true,
25786
25870
  onSettled: remember
25787
25871
  });
25788
- const result = record8(output2) && output2.kind === "creation" ? output2.result : null;
25872
+ const result = record9(output2) && output2.kind === "creation" ? output2.result : null;
25789
25873
  remember(result);
25790
25874
  signal.throwIfAborted();
25791
- if (!record8(result) || result.status !== "created" || !createdId || !record8(result.firstTurn) || result.firstTurn.status !== "not-requested")
25875
+ if (!record9(result) || result.status !== "created" || !createdId || !record9(result.firstTurn) || result.firstTurn.status !== "not-requested")
25792
25876
  throw new Error("Chat creation was not confirmed. Check the chat list before creating another task.");
25793
25877
  if (routing.forHost("local")?.manager !== route.manager)
25794
25878
  throw new Error("The local connection changed. Reopen the task dialog.");
25795
25879
  const conversation = manager.getConversation(createdId);
25796
- const mode = record8(conversation) ? conversation.latestCollaborationMode : null;
25797
- if (!record8(conversation) || conversation.cwd !== input3.workspace.cwd || !record8(mode) || !record8(mode.settings) || mode.settings.model !== input3.model)
25880
+ const mode = record9(conversation) ? conversation.latestCollaborationMode : null;
25881
+ if (!record9(conversation) || conversation.cwd !== input3.workspace.cwd || !record9(mode) || !record9(mode.settings) || mode.settings.model !== input3.model)
25798
25882
  throw new Error("The created chat's workspace or Model could not be confirmed");
25799
25883
  return {
25800
25884
  threadId: createdId,
@@ -29817,8 +29901,8 @@ ${error62.stderrTail}`] : []
29817
29901
  id: "connections",
29818
29902
  label: messages.pageLabels.connections,
29819
29903
  icon: "connections",
29820
- mount(context2) {
29821
- const document2 = context2.content.ownerDocument;
29904
+ mount(context) {
29905
+ const document2 = context.content.ownerDocument;
29822
29906
  const header = document2.createElement("div");
29823
29907
  header.className = "settings-connection-page-header";
29824
29908
  const headingCopy = document2.createElement("div");
@@ -29840,7 +29924,7 @@ ${error62.stderrTail}`] : []
29840
29924
  const syncMessage = document2.createElement("p");
29841
29925
  syncMessage.className = "settings-page-description";
29842
29926
  syncMessage.setAttribute("role", "status");
29843
- context2.content.append(header, syncMessage, content);
29927
+ context.content.append(header, syncMessage, content);
29844
29928
  let pending2 = false;
29845
29929
  let selectedHostId = null;
29846
29930
  let renderedHostId = null;
@@ -29854,12 +29938,12 @@ ${error62.stderrTail}`] : []
29854
29938
  let renderQueued = false;
29855
29939
  let renderFrame = null;
29856
29940
  const scheduleRender = () => {
29857
- if (disposed || context2.signal.aborted || renderQueued) return;
29941
+ if (disposed || context.signal.aborted || renderQueued) return;
29858
29942
  renderQueued = true;
29859
29943
  const flush = () => {
29860
29944
  renderFrame = null;
29861
29945
  renderQueued = false;
29862
- if (!disposed && !context2.signal.aborted) {
29946
+ if (!disposed && !context.signal.aborted) {
29863
29947
  render(diagnostics?.snapshot() ?? latestSnapshot);
29864
29948
  }
29865
29949
  };
@@ -29876,9 +29960,9 @@ ${error62.stderrTail}`] : []
29876
29960
  };
29877
29961
  const diagnostics = getDiagnostics();
29878
29962
  const versions = createConnectionVersions(
29879
- context2.content,
29963
+ context.content,
29880
29964
  messages,
29881
- context2.signal,
29965
+ context.signal,
29882
29966
  diagnostics,
29883
29967
  scheduleRender
29884
29968
  );
@@ -29886,7 +29970,7 @@ ${error62.stderrTail}`] : []
29886
29970
  const updates = createConnectionUpdates(
29887
29971
  document2,
29888
29972
  messages,
29889
- context2.signal,
29973
+ context.signal,
29890
29974
  scheduleRender,
29891
29975
  diagnostics
29892
29976
  );
@@ -29987,7 +30071,7 @@ ${error62.stderrTail}`] : []
29987
30071
  createRendererSettingsIcon("diagnose", 16),
29988
30072
  messages.connectionRefreshing
29989
30073
  );
29990
- void context2.runLatest(() => diagnostics.refresh(void 0, "retry"), {
30074
+ void context.runLatest(() => diagnostics.refresh(void 0, "retry"), {
29991
30075
  success() {
29992
30076
  installs?.clearErrors();
29993
30077
  pending2 = false;
@@ -30351,9 +30435,9 @@ ${error62.stderrTail}`] : []
30351
30435
  }
30352
30436
  };
30353
30437
  render(diagnostics?.snapshot() ?? null);
30354
- void getRemoteConnections()?.ssh.list(context2.signal).then(
30438
+ void getRemoteConnections()?.ssh.list(context.signal).then(
30355
30439
  (connections) => {
30356
- if (context2.signal.aborted) return;
30440
+ if (context.signal.aborted) return;
30357
30441
  for (const connection of connections) {
30358
30442
  hostNames.set(connection.hostId, connection.displayName.trim());
30359
30443
  }
@@ -34701,7 +34785,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34701
34785
  }
34702
34786
 
34703
34787
  // src/renderer-native-model-retry.ts
34704
- function record9(value) {
34788
+ function record10(value) {
34705
34789
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
34706
34790
  }
34707
34791
  function containsMessage(children, id2) {
@@ -34712,7 +34796,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34712
34796
  for (const item of child) pending2.push(item);
34713
34797
  continue;
34714
34798
  }
34715
- const props = record9(record9(child)?.props);
34799
+ const props = record10(record10(child)?.props);
34716
34800
  if (props?.id === id2) return true;
34717
34801
  if (props?.children !== void 0) pending2.push(props.children);
34718
34802
  }
@@ -34729,14 +34813,14 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34729
34813
  Object.getOwnPropertyDescriptor(button2, fiberKey)?.value
34730
34814
  );
34731
34815
  const host = ancestors2[0];
34732
- const props = record9(host?.memoizedProps);
34733
- const current = record9(Object.getOwnPropertyDescriptor(button2, propsKey)?.value);
34816
+ const props = record10(host?.memoizedProps);
34817
+ const current = record10(Object.getOwnPropertyDescriptor(button2, propsKey)?.value);
34734
34818
  if (host?.stateNode !== button2 || props?.["data-composer-navigation-target"] !== "reasoning" || typeof props.onClick !== "function" || props.onClick !== current?.onClick || !containsMessage(props.children, "composer.modelPicker.retryModels"))
34735
34819
  return false;
34736
34820
  for (const owner of ancestors2.slice(1, 60)) {
34737
34821
  if (owner.stateNode === composer) break;
34738
- const tooltip = record9(owner.memoizedProps)?.content;
34739
- if (record9(record9(tooltip)?.props)?.id === "composer.modelPicker.modelsUnavailable")
34822
+ const tooltip = record10(owner.memoizedProps)?.content;
34823
+ if (record10(record10(tooltip)?.props)?.id === "composer.modelPicker.modelsUnavailable")
34740
34824
  return true;
34741
34825
  }
34742
34826
  return false;
@@ -34951,8 +35035,8 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
34951
35035
  if (candidate) syncRendererModelTriggerClass(control.modelPicker);
34952
35036
  }
34953
35037
  function usagePlacementAnchor(control) {
34954
- const context2 = control.nativeContextUsageControl?.element;
34955
- const contextWrapper = context2?.parentElement;
35038
+ const context = control.nativeContextUsageControl?.element;
35039
+ const contextWrapper = context?.parentElement;
34956
35040
  if (contextWrapper?.parentElement) return contextWrapper;
34957
35041
  const modelRoot = control.modelPicker?.root;
34958
35042
  return modelRoot?.parentElement ? modelRoot : null;
@@ -36248,13 +36332,13 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36248
36332
  }
36249
36333
  async function readNativeCodexThread(sendRequest, threadId) {
36250
36334
  const native = await sendRequest("thread/read", { threadId, includeTurns: false });
36251
- const thread2 = isRecord5(native) ? native.thread : null;
36252
- if (!isRecord5(thread2) || thread2.id !== threadId || typeof thread2.modelProvider !== "string" || !thread2.modelProvider || thread2.modelProvider === "codexhost" || typeof thread2.cliVersion !== "string" || !thread2.cliVersion || thread2.cliVersion === "codexhost") {
36335
+ const thread3 = isRecord5(native) ? native.thread : null;
36336
+ if (!isRecord5(thread3) || thread3.id !== threadId || typeof thread3.modelProvider !== "string" || !thread3.modelProvider || thread3.modelProvider === "codexhost" || typeof thread3.cliVersion !== "string" || !thread3.cliVersion || thread3.cliVersion === "codexhost") {
36253
36337
  throw new Error("Native Thread response cannot establish Codex ownership");
36254
36338
  }
36255
36339
  return {
36256
- modelProvider: thread2.modelProvider,
36257
- cwd: typeof thread2.cwd === "string" && thread2.cwd.trim().length > 0 ? thread2.cwd : null
36340
+ modelProvider: thread3.modelProvider,
36341
+ cwd: typeof thread3.cwd === "string" && thread3.cwd.trim().length > 0 ? thread3.cwd : null
36258
36342
  };
36259
36343
  }
36260
36344
  async function verifyNativeCodexThread(sendRequest, threadId) {
@@ -36505,17 +36589,17 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36505
36589
  async usesIndependentNativeInference(input3) {
36506
36590
  if (!input3) return false;
36507
36591
  if ("threadId" in input3) {
36508
- const thread2 = await readNativeCodexThread(
36592
+ const thread3 = await readNativeCodexThread(
36509
36593
  manager.sendRequest,
36510
36594
  threadInspectionParamsSchema.parse(input3).threadId
36511
36595
  );
36512
- if (!thread2.cwd) return false;
36596
+ if (!thread3.cwd) return false;
36513
36597
  return usesIndependentNativeInference(
36514
36598
  await manager.sendRequest("config/read", {
36515
36599
  includeLayers: false,
36516
- cwd: thread2.cwd
36600
+ cwd: thread3.cwd
36517
36601
  }),
36518
- thread2.modelProvider
36602
+ thread3.modelProvider
36519
36603
  );
36520
36604
  }
36521
36605
  const cwd = typeof input3.cwd === "string" && input3.cwd.trim().length > 0 ? input3.cwd : null;
@@ -36662,7 +36746,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36662
36746
  const params = threadOwnershipListParamsSchema.parse(input3);
36663
36747
  const value = await manager.sendRequest(THREAD_OWNERSHIP_LIST_METHOD, params);
36664
36748
  const result = threadOwnershipListResultSchema.parse(value);
36665
- if (result.threads.length !== params.threadIds.length || result.threads.some((thread2, index) => thread2.threadId !== params.threadIds[index])) {
36749
+ if (result.threads.length !== params.threadIds.length || result.threads.some((thread3, index) => thread3.threadId !== params.threadIds[index])) {
36666
36750
  throw new Error("Thread ownership-list result does not match the requested IDs");
36667
36751
  }
36668
36752
  return result;
@@ -36976,7 +37060,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
36976
37060
  return "official";
36977
37061
  }
36978
37062
  const result = threadOwnershipListResultSchema.parse(response);
36979
- const owner = result.threads.find((thread2) => thread2.threadId === threadId)?.owner;
37063
+ const owner = result.threads.find((thread3) => thread3.threadId === threadId)?.owner;
36980
37064
  if (!owner) throw new Error("Thread ownership could not be resolved for steering");
36981
37065
  return owner === "codex" ? "official" : "newTurn";
36982
37066
  }
@@ -37067,10 +37151,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37067
37151
  const activeTurnSteers = /* @__PURE__ */ new Map();
37068
37152
  const pending2 = /* @__PURE__ */ new Map();
37069
37153
  let disposed = false;
37070
- const send = function(method, params, options) {
37071
- if ((method === "turn/start" || method === "turn/steer") && prepareTurnInput) {
37072
- params = prepareTurnInput(params);
37073
- }
37154
+ const sendPrepared = function(method, params, options) {
37074
37155
  const messageId = isRecord8(params) ? params.clientUserMessageId : null;
37075
37156
  const route = typeof messageId === "string" && isRecord8(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
37076
37157
  if (method !== "turn/start" || !isRecord8(params) || !route || route.threadId !== params.threadId) {
@@ -37120,6 +37201,9 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37120
37201
  };
37121
37202
  });
37122
37203
  };
37204
+ const send = function(method, params, options) {
37205
+ return prepareTurnInput && (method === "turn/start" || method === "turn/steer") ? prepareTurnInput(params, (prepared) => sendPrepared(method, prepared, options)) : sendPrepared(method, params, options);
37206
+ };
37123
37207
  const inspectDelivery = (threadId, text2) => inspectRendererSteeringDelivery(
37124
37208
  (method, params) => originalSend.call(manager, method, params),
37125
37209
  threadId,
@@ -37196,7 +37280,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37196
37280
  if (expectedTurnId == null && host.hasPendingTurnStart(threadId)) {
37197
37281
  throw new Error("Previous Turn submission has not been confirmed yet");
37198
37282
  }
37199
- const context2 = restoreMessage.context;
37283
+ const context = restoreMessage.context;
37200
37284
  const routeKey = `${threadId}\0${messageId}`;
37201
37285
  if (typeof expectedTurnId === "string") routes.set(routeKey, { threadId, expectedTurnId });
37202
37286
  const promise2 = Promise.resolve().then(async () => {
@@ -37216,12 +37300,12 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
37216
37300
  serviceTier,
37217
37301
  model: null,
37218
37302
  effort: null,
37219
- collaborationMode: context2.collaborationMode ?? null
37303
+ collaborationMode: context.collaborationMode ?? null
37220
37304
  },
37221
37305
  context: {
37222
37306
  attachments: attachments ?? [],
37223
- commentAttachments: context2.commentAttachments ?? [],
37224
- mcpAppModelContextAttachments: context2.mcpAppModelContextAttachments,
37307
+ commentAttachments: context.commentAttachments ?? [],
37308
+ mcpAppModelContextAttachments: context.mcpAppModelContextAttachments,
37225
37309
  useAppServerPermissionDefault: true,
37226
37310
  beforeSendRequest,
37227
37311
  assertRequestCurrent
@@ -37405,10 +37489,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37405
37489
  }
37406
37490
 
37407
37491
  // src/renderer-thread-reference-persistence.ts
37408
- var record10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37492
+ var record11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37409
37493
  var SYNC_TIMEOUT_MS = 2e3;
37410
37494
  function restoreRpcThreadReferenceCapability(client, messages, isCurrent) {
37411
- if (!record10(messages) || !record10(messages.electronBridge)) return client;
37495
+ if (!record11(messages) || !record11(messages.electronBridge)) return client;
37412
37496
  const bridge = messages.electronBridge;
37413
37497
  const send = bridge.sendMessageFromView;
37414
37498
  if (typeof send !== "function") return client;
@@ -37423,7 +37507,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37423
37507
  const listener = (event) => {
37424
37508
  if (event.source != null && event.source !== messages) return;
37425
37509
  const message2 = event.data;
37426
- if (!record10(message2) || message2.type !== "persisted-atom-sync" || !record10(message2.state))
37510
+ if (!record11(message2) || message2.type !== "persisted-atom-sync" || !record11(message2.state))
37427
37511
  return;
37428
37512
  finish(!Object.hasOwn(message2.state, key2));
37429
37513
  };
@@ -37464,12 +37548,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37464
37548
  }
37465
37549
 
37466
37550
  // src/renderer-thread-reference-capability.ts
37467
- var record11 = (value) => typeof value === "object" && value !== null;
37551
+ var record12 = (value) => typeof value === "object" && value !== null;
37468
37552
  function restoreThreadReferenceCapability(client, manager, isCurrent, messages = null) {
37469
- if (record11(manager) && manager.kind === "main-process-rpc") {
37553
+ if (record12(manager) && manager.kind === "main-process-rpc") {
37470
37554
  return restoreRpcThreadReferenceCapability(client, messages, isCurrent);
37471
37555
  }
37472
- if (!record11(manager) || !record11(manager.storage)) return client;
37556
+ if (!record12(manager) || !record12(manager.storage)) return client;
37473
37557
  const storage = manager.storage;
37474
37558
  const read = storage.readValue;
37475
37559
  const write = storage.writeValue;
@@ -37504,21 +37588,56 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37504
37588
  }
37505
37589
 
37506
37590
  // src/renderer-thread-reference-context.ts
37507
- var record12 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37508
- function createThreadReferenceContext(manager, hostId2, isCurrent) {
37591
+ var record13 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
37592
+ function captureThreadReferenceGeneration(routing, hostId2) {
37593
+ const expected = routing?.connectionGeneration?.(hostId2);
37594
+ return () => {
37595
+ const current = routing?.connectionGeneration?.(hostId2);
37596
+ return expected !== null && current !== null && current?.owner === expected?.owner && current?.revision === expected?.revision;
37597
+ };
37598
+ }
37599
+ async function supportsThreadReferenceContext(send) {
37600
+ let timer;
37601
+ try {
37602
+ const result = await Promise.race([
37603
+ send(THREAD_REFERENCE_CONTEXT_CAPABILITY_METHOD, {}),
37604
+ new Promise((resolve) => {
37605
+ timer = setTimeout(() => resolve(null), 1500);
37606
+ })
37607
+ ]);
37608
+ return record13(result) && result.threadReferenceContext === true;
37609
+ } catch {
37610
+ return false;
37611
+ } finally {
37612
+ clearTimeout(timer);
37613
+ }
37614
+ }
37615
+ function createThreadReferenceContext(manager, hostId2, isCurrent, readRouting) {
37509
37616
  const prepared = /* @__PURE__ */ new WeakMap();
37510
- return (params) => {
37511
- if (hostId2 === "local" || !record12(manager) || typeof manager.getConversation !== "function" || !record12(params) || typeof params.threadId !== "string")
37512
- return params;
37617
+ return (params, send) => {
37618
+ if (hostId2 === "local" || !record13(manager) || typeof manager.getConversation !== "function" || !record13(params) || typeof params.threadId !== "string")
37619
+ return send(params);
37513
37620
  const conversation = manager.getConversation.call(manager, params.threadId);
37514
- if (!record12(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
37515
- return params;
37621
+ if (!record13(conversation) || conversation.id !== params.threadId) return send(params);
37622
+ const external = conversation.modelProvider === "codexhost";
37623
+ if (!external && !isDesktopSshHostId(hostId2)) return send(params);
37624
+ const forward = (supported) => {
37625
+ if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
37626
+ if (!supported) return send(params);
37627
+ let result = prepared.get(params);
37628
+ if (!result) {
37629
+ result = { ...params, [THREAD_REFERENCE_SOURCE_HOST_PARAM]: hostId2 };
37630
+ prepared.set(params, result);
37631
+ }
37632
+ return send(result);
37633
+ };
37634
+ const request = manager.sendRequest;
37635
+ if (external) return forward(true);
37516
37636
  if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
37517
- const cached2 = prepared.get(params);
37518
- if (cached2) return cached2;
37519
- const result = { ...params, [THREAD_REFERENCE_SOURCE_HOST_PARAM]: hostId2 };
37520
- prepared.set(params, result);
37521
- return result;
37637
+ const isSameGeneration = captureThreadReferenceGeneration(readRouting?.(), hostId2);
37638
+ return typeof request === "function" ? supportsThreadReferenceContext(
37639
+ (method, input3) => request.call(manager, method, input3)
37640
+ ).then((supported) => forward(supported && isSameGeneration())) : forward(false);
37522
37641
  };
37523
37642
  }
37524
37643
 
@@ -37646,7 +37765,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
37646
37765
  createThreadReferenceContext(
37647
37766
  target2,
37648
37767
  route.hostId,
37649
- () => !disposed && readRouting()?.forHost(route.hostId) === route
37768
+ () => !disposed && readRouting()?.forHost(route.hostId) === route,
37769
+ readRouting
37650
37770
  )
37651
37771
  ),
37652
37772
  () => installRendererManualCompaction(target2, route.hostId, messages)
@@ -40079,7 +40199,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40079
40199
  }
40080
40200
  };
40081
40201
  const track = (teardown) => {
40082
- guard();
40202
+ try {
40203
+ guard();
40204
+ } catch (error62) {
40205
+ teardown();
40206
+ throw error62;
40207
+ }
40083
40208
  teardowns.add(teardown);
40084
40209
  return () => {
40085
40210
  if (teardowns.delete(teardown)) teardown();
@@ -40128,7 +40253,20 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40128
40253
  watchTree(callback) {
40129
40254
  guard();
40130
40255
  return track(bridge.watchTree((snapshot) => delivery(callback, snapshot)));
40131
- }
40256
+ },
40257
+ ...bridge.watchUnread ? {
40258
+ watchUnread(threadIds, callback) {
40259
+ guard();
40260
+ if (!Array.isArray(threadIds) || threadIds.length > THREAD_TREE_MAX_NODES || threadIds.some((id3) => !hostThreadIdSchema.safeParse(id3).success))
40261
+ throw new Error("Invalid Desktop unread Thread ids");
40262
+ return track(
40263
+ bridge.watchUnread(
40264
+ [...new Set(threadIds)],
40265
+ (snapshot) => delivery(callback, Object.freeze({ ...snapshot }))
40266
+ )
40267
+ );
40268
+ }
40269
+ } : {}
40132
40270
  },
40133
40271
  navigate: {
40134
40272
  async openThread(threadId) {
@@ -40468,11 +40606,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40468
40606
  }
40469
40607
  };
40470
40608
  const registerSettingsPage = (extensionId, page) => {
40471
- const record17 = { page, revision: ++settingsPageRevision };
40472
- customSettingsPages.set(extensionId, record17);
40609
+ const record19 = { page, revision: ++settingsPageRevision };
40610
+ customSettingsPages.set(extensionId, record19);
40473
40611
  notifySettingsPages();
40474
40612
  return () => {
40475
- if (customSettingsPages.get(extensionId) !== record17) return;
40613
+ if (customSettingsPages.get(extensionId) !== record19) return;
40476
40614
  customSettingsPages.delete(extensionId);
40477
40615
  notifySettingsPages();
40478
40616
  };
@@ -40618,15 +40756,15 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
40618
40756
  const getRegisteredSettingsPages = () => {
40619
40757
  const pages = [];
40620
40758
  const seen = /* @__PURE__ */ new Set();
40621
- for (const [extensionId, record17] of customSettingsPages) {
40759
+ for (const [extensionId, record19] of customSettingsPages) {
40622
40760
  const instance = instances.get(extensionId);
40623
- const title = record17.page.title ?? instance?.name;
40761
+ const title = record19.page.title ?? instance?.name;
40624
40762
  pages.push({
40625
40763
  extensionId,
40626
40764
  kind: "custom",
40627
- revision: record17.revision,
40765
+ revision: record19.revision,
40628
40766
  ...title !== void 0 ? { title } : {},
40629
- page: record17.page
40767
+ page: record19.page
40630
40768
  });
40631
40769
  seen.add(extensionId);
40632
40770
  }
@@ -41790,15 +41928,15 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
41790
41928
  id: pageId,
41791
41929
  label: label.slice(0, 64),
41792
41930
  icon: icon2 && isRendererSettingsIconName(icon2) ? icon2 : "extensions",
41793
- mount(context2) {
41931
+ mount(context) {
41794
41932
  const container = createEl(
41795
- context2.content.ownerDocument,
41933
+ context.content.ownerDocument,
41796
41934
  "div",
41797
41935
  "settings-extension-plugin-page"
41798
41936
  );
41799
41937
  container.dataset.extensionId = extensionId;
41800
41938
  container.dataset.settingsMode = "custom";
41801
- context2.content.append(container);
41939
+ context.content.append(container);
41802
41940
  const cleanup = contribution.mount(container, {
41803
41941
  locale: messages.locale,
41804
41942
  storage: services.storage,
@@ -43363,8 +43501,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43363
43501
  id: "usage-statistics",
43364
43502
  label: messages.label,
43365
43503
  icon: "dashboard",
43366
- mount(context2) {
43367
- const document2 = context2.content.ownerDocument;
43504
+ mount(context) {
43505
+ const document2 = context.content.ownerDocument;
43368
43506
  const locale = pageLocale ?? (document2.documentElement.lang || "en");
43369
43507
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
43370
43508
  const count3 = (value) => count2(value, locale);
@@ -43422,7 +43560,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43422
43560
  document2,
43423
43561
  consoleMessages2,
43424
43562
  (method, params2) => request(method, params2, view.hostId),
43425
- context2.signal,
43563
+ context.signal,
43426
43564
  load
43427
43565
  );
43428
43566
  let offeredHosts = usageHosts ? [] : void 0;
@@ -43430,7 +43568,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43430
43568
  label: messages.host,
43431
43569
  searchLabel: messages.search,
43432
43570
  emptyLabel: messages.noMatches,
43433
- signal: context2.signal,
43571
+ signal: context.signal,
43434
43572
  searchable: false,
43435
43573
  display: (option) => `${messages.host} \xB7 ${option.label}`,
43436
43574
  onChange: (key2) => {
@@ -43460,7 +43598,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43460
43598
  const offerHosts = () => {
43461
43599
  if (!usageHosts) return;
43462
43600
  void usageHosts().then((hosts) => {
43463
- if (context2.signal.aborted) return;
43601
+ if (context.signal.aborted) return;
43464
43602
  offeredHosts = hosts;
43465
43603
  hostOptions();
43466
43604
  }).catch(() => void 0);
@@ -43486,7 +43624,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43486
43624
  label: messages.autoRefresh,
43487
43625
  searchLabel: messages.search,
43488
43626
  emptyLabel: messages.noMatches,
43489
- signal: context2.signal,
43627
+ signal: context.signal,
43490
43628
  searchable: false,
43491
43629
  display: (option) => `${messages.autoRefresh} \xB7 ${option.label}`,
43492
43630
  onChange: (key2) => {
@@ -43531,7 +43669,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43531
43669
  label: messages.filterModel,
43532
43670
  searchLabel: messages.search,
43533
43671
  emptyLabel: messages.noMatches,
43534
- signal: context2.signal,
43672
+ signal: context.signal,
43535
43673
  onChange: (key2) => {
43536
43674
  view.model = key2;
43537
43675
  changed();
@@ -43541,7 +43679,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
43541
43679
  label: messages.filterProject,
43542
43680
  searchLabel: messages.search,
43543
43681
  emptyLabel: messages.noMatches,
43544
- signal: context2.signal,
43682
+ signal: context.signal,
43545
43683
  onChange: (key2) => {
43546
43684
  view.project = key2;
43547
43685
  changed();
@@ -44329,7 +44467,7 @@ ${detail}` : ""}`
44329
44467
  }
44330
44468
  function schedule() {
44331
44469
  window.clearTimeout(poll);
44332
- if (context2.signal.aborted) return;
44470
+ if (context.signal.aborted) return;
44333
44471
  if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
44334
44472
  else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
44335
44473
  }
@@ -44347,12 +44485,12 @@ ${detail}` : ""}`
44347
44485
  } catch {
44348
44486
  if (!isCurrent()) return;
44349
44487
  }
44350
- if (!context2.signal.aborted) render();
44488
+ if (!context.signal.aborted) render();
44351
44489
  }
44352
44490
  function load() {
44353
44491
  window.clearTimeout(poll);
44354
44492
  const requested = params();
44355
- void context2.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
44493
+ void context.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
44356
44494
  success(value) {
44357
44495
  const parsed = usageStatisticsResultSchema.safeParse(value);
44358
44496
  if (parsed.success) {
@@ -44375,7 +44513,7 @@ ${detail}` : ""}`
44375
44513
  }
44376
44514
  });
44377
44515
  }
44378
- context2.content.replaceChildren(header, prices.element, filters, notices, body);
44516
+ context.content.replaceChildren(header, prices.element, filters, notices, body);
44379
44517
  render();
44380
44518
  offerHosts();
44381
44519
  void refreshHarnessNames();
@@ -46274,8 +46412,8 @@ ${detail}` : ""}`
46274
46412
  id: "session-import",
46275
46413
  label: messages.pageLabels["session-import"],
46276
46414
  icon: "session-import",
46277
- mount(context2) {
46278
- const document2 = context2.content.ownerDocument;
46415
+ mount(context) {
46416
+ const document2 = context.content.ownerDocument;
46279
46417
  const header = document2.createElement("div");
46280
46418
  header.className = "settings-session-import-header";
46281
46419
  const heading = document2.createElement("h2");
@@ -46395,7 +46533,7 @@ ${detail}` : ""}`
46395
46533
  const content = document2.createElement("section");
46396
46534
  content.className = "settings-session-import-content";
46397
46535
  const listControls = createSessionImportListControls(document2, messages, () => load());
46398
- context2.content.append(
46536
+ context.content.append(
46399
46537
  header,
46400
46538
  hostLabel,
46401
46539
  harness2,
@@ -46528,7 +46666,7 @@ ${detail}` : ""}`
46528
46666
  retry.addEventListener("click", () => {
46529
46667
  if (retry.disabled) return;
46530
46668
  setRetrying(true);
46531
- void context2.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
46669
+ void context.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
46532
46670
  success() {
46533
46671
  setRetrying(false);
46534
46672
  },
@@ -46619,7 +46757,7 @@ ${detail}` : ""}`
46619
46757
  refresh.disabled = true;
46620
46758
  updateImportActions();
46621
46759
  let committedThreadId = null;
46622
- void context2.runLatest(
46760
+ void context.runLatest(
46623
46761
  async (signal) => {
46624
46762
  importStatus.replaceChildren();
46625
46763
  const result = await client.importHarnessSession({
@@ -46663,7 +46801,7 @@ ${detail}` : ""}`
46663
46801
  updateImportActions();
46664
46802
  };
46665
46803
  const load = (refreshDiagnostics = false) => {
46666
- if (importingId !== null || context2.signal.aborted) return;
46804
+ if (importingId !== null || context.signal.aborted) return;
46667
46805
  loadedClient = null;
46668
46806
  let client = getClient(selectedHostId);
46669
46807
  if (client?.hostId === "durable") {
@@ -46679,7 +46817,7 @@ ${detail}` : ""}`
46679
46817
  else renderUnavailable();
46680
46818
  const requestedHarness = selectedHarness;
46681
46819
  const pageParams = listControls.params();
46682
- void context2.runLatest(
46820
+ void context.runLatest(
46683
46821
  async (signal) => {
46684
46822
  if (!client) throw new RendererSessionImportUnavailableError();
46685
46823
  const harnesses = await loadSessionImportSources(
@@ -46745,8 +46883,8 @@ ${detail}` : ""}`
46745
46883
  }
46746
46884
 
46747
46885
  // src/settings/loaded-sessions-table.ts
46748
- function mountLoadedSessionsTable(context2, messages, getClient) {
46749
- const document2 = context2.content.ownerDocument;
46886
+ function mountLoadedSessionsTable(context, messages, getClient) {
46887
+ const document2 = context.content.ownerDocument;
46750
46888
  const owner = document2.defaultView;
46751
46889
  if (!owner) return () => void 0;
46752
46890
  const text2 = messages.loadedSessions;
@@ -46782,7 +46920,7 @@ ${detail}` : ""}`
46782
46920
  scroll.hidden = true;
46783
46921
  header.append(title, description);
46784
46922
  container.append(header, status, scroll);
46785
- context2.content.append(container);
46923
+ context.content.append(container);
46786
46924
  let disposed = false;
46787
46925
  let timer;
46788
46926
  let requestTimer;
@@ -46804,7 +46942,7 @@ ${detail}` : ""}`
46804
46942
  );
46805
46943
  })
46806
46944
  ]);
46807
- if (disposed || context2.signal.aborted) return;
46945
+ if (disposed || context.signal.aborted) return;
46808
46946
  body.replaceChildren();
46809
46947
  for (const row of rows.toSorted(
46810
46948
  (a, b) => b.inactiveMs - a.inactiveMs || a.harnessId.localeCompare(b.harnessId) || a.threadId.localeCompare(b.threadId)
@@ -46828,13 +46966,13 @@ ${detail}` : ""}`
46828
46966
  status.hidden = rows.length > 0;
46829
46967
  scroll.hidden = rows.length === 0;
46830
46968
  } catch (error62) {
46831
- if (disposed || context2.signal.aborted) return;
46969
+ if (disposed || context.signal.aborted) return;
46832
46970
  status.textContent = error62 instanceof RendererMethodUnavailableError ? text2.unavailable : text2.failed;
46833
46971
  status.hidden = false;
46834
46972
  scroll.hidden = true;
46835
46973
  } finally {
46836
46974
  owner.clearTimeout(requestTimer);
46837
- if (!disposed && !context2.signal.aborted)
46975
+ if (!disposed && !context.signal.aborted)
46838
46976
  timer = owner.setTimeout(() => void refresh(), 1e4);
46839
46977
  }
46840
46978
  };
@@ -46847,8 +46985,8 @@ ${detail}` : ""}`
46847
46985
  }
46848
46986
 
46849
46987
  // src/settings/idle-release-controls.ts
46850
- function mountIdleReleaseControls(context2, messages, getLoadedSessionsClient) {
46851
- const { content } = context2;
46988
+ function mountIdleReleaseControls(context, messages, getLoadedSessionsClient) {
46989
+ const { content } = context;
46852
46990
  const document2 = content.ownerDocument;
46853
46991
  const owner = document2.defaultView;
46854
46992
  if (!owner) return () => void 0;
@@ -46890,7 +47028,7 @@ ${detail}` : ""}`
46890
47028
  card.append(toggle.item, timeout.item);
46891
47029
  content.append(group);
46892
47030
  const disposeTable = mountLoadedSessionsTable(
46893
- { ...context2, content: card },
47031
+ { ...context, content: card },
46894
47032
  messages,
46895
47033
  getLoadedSessionsClient
46896
47034
  );
@@ -46957,8 +47095,8 @@ ${detail}` : ""}`
46957
47095
  id: "appearance",
46958
47096
  label: messages.pageLabels.appearance,
46959
47097
  icon: "settings",
46960
- mount(context2) {
46961
- const document2 = context2.content.ownerDocument;
47098
+ mount(context) {
47099
+ const document2 = context.content.ownerDocument;
46962
47100
  const ownerWindow = document2.defaultView;
46963
47101
  if (!ownerWindow) return;
46964
47102
  const heading = document2.createElement("div");
@@ -46985,9 +47123,9 @@ ${detail}` : ""}`
46985
47123
  ownerWindow.addEventListener(REASONING_SOFT_WRAP_CHANGE_EVENT, sync);
46986
47124
  row.item.append(toggle);
46987
47125
  card.append(row.item);
46988
- context2.content.append(heading, description, group);
47126
+ context.content.append(heading, description, group);
46989
47127
  const disposeIdleRelease = mountIdleReleaseControls(
46990
- context2,
47128
+ context,
46991
47129
  messages,
46992
47130
  getLoadedSessionsClient
46993
47131
  );
@@ -49858,8 +49996,8 @@ ${detail}` : ""}`
49858
49996
  id: "desktop-extensions",
49859
49997
  label: messages.pageLabels["desktop-extensions"],
49860
49998
  icon: "extensions",
49861
- mount(context2) {
49862
- const document2 = context2.content.ownerDocument;
49999
+ mount(context) {
50000
+ const document2 = context.content.ownerDocument;
49863
50001
  const ownerWindow = document2.defaultView;
49864
50002
  const root = createEl(document2, "div", "settings-extensions");
49865
50003
  const listViewWrap = createEl(document2, "div", "settings-extensions__list-view");
@@ -50118,7 +50256,7 @@ ${detail}` : ""}`
50118
50256
  const body = createEl(document2, "div", "settings-extensions__body");
50119
50257
  listViewWrap.append(header, stickyBar, banner, diagnosticsPanel, body);
50120
50258
  root.append(listViewWrap, pageViewHost);
50121
- context2.content.append(root);
50259
+ context.content.append(root);
50122
50260
  const initialHasCatalog = typeof resolveAvailableClient(getClient)?.listHostExtensionCatalog === "function";
50123
50261
  let disposed = false;
50124
50262
  let moreMenuOpen = false;
@@ -50185,7 +50323,7 @@ ${detail}` : ""}`
50185
50323
  const pageHost = createDesktopExtensionPageHost({
50186
50324
  document: document2,
50187
50325
  host: pageViewHost,
50188
- signal: context2.signal,
50326
+ signal: context.signal,
50189
50327
  messages,
50190
50328
  getClient: () => resolveAvailableClient(getClient),
50191
50329
  getContentLocale: resolveContentLocale,
@@ -50196,13 +50334,13 @@ ${detail}` : ""}`
50196
50334
  }
50197
50335
  });
50198
50336
  const openExtensionPage = (item) => {
50199
- if (disposed || context2.signal.aborted || !item.enabled || !item.manifest.page) return;
50337
+ if (disposed || context.signal.aborted || !item.enabled || !item.manifest.page) return;
50200
50338
  closeHeaderMenus();
50201
50339
  detailModal.close();
50202
50340
  importModal.close();
50203
50341
  createModal.close();
50204
50342
  const pageId = pluginPages?.getPageIdForExtension(item.id);
50205
- if (pageId && context2.navigateToPage?.(pageId)) return;
50343
+ if (pageId && context.navigateToPage?.(pageId)) return;
50206
50344
  const catalogEntry = catalogById.get(item.id);
50207
50345
  listViewWrap.hidden = true;
50208
50346
  pageViewHost.hidden = false;
@@ -50226,7 +50364,7 @@ ${detail}` : ""}`
50226
50364
  const detailModal = createDesktopExtensionDetailModal({
50227
50365
  document: document2,
50228
50366
  host: root,
50229
- signal: context2.signal,
50367
+ signal: context.signal,
50230
50368
  messages,
50231
50369
  catalogIconLoader,
50232
50370
  assetClient: {
@@ -50264,9 +50402,9 @@ ${detail}` : ""}`
50264
50402
  onOpenPage: (item) => {
50265
50403
  openExtensionPage(item);
50266
50404
  },
50267
- onOpenSettings: pluginPages && context2.navigateToPage ? (extensionId) => {
50405
+ onOpenSettings: pluginPages && context.navigateToPage ? (extensionId) => {
50268
50406
  const pageId = pluginPages.getPageIdForExtension(extensionId);
50269
- if (pageId) context2.navigateToPage?.(pageId);
50407
+ if (pageId) context.navigateToPage?.(pageId);
50270
50408
  } : void 0,
50271
50409
  onClose: () => {
50272
50410
  modalFeedback = null;
@@ -50275,14 +50413,14 @@ ${detail}` : ""}`
50275
50413
  const createModal = createDesktopExtensionCreateModal({
50276
50414
  document: document2,
50277
50415
  host: root,
50278
- signal: context2.signal,
50416
+ signal: context.signal,
50279
50417
  messages,
50280
50418
  getCopy: () => contentLocaleMessages(resolveContentLocale())
50281
50419
  });
50282
50420
  const importModal = createDesktopExtensionImportModal({
50283
50421
  document: document2,
50284
50422
  host: root,
50285
- signal: context2.signal,
50423
+ signal: context.signal,
50286
50424
  messages,
50287
50425
  onImport: async (source) => {
50288
50426
  await importExtension(source);
@@ -50470,7 +50608,7 @@ ${detail}` : ""}`
50470
50608
  if (filterMenuOpen) setFilterMenuOpen(false);
50471
50609
  };
50472
50610
  const openDetailModal = (extensionId) => {
50473
- if (disposed || context2.signal.aborted || activeRecoveryDialog || importModal.isOpen) {
50611
+ if (disposed || context.signal.aborted || activeRecoveryDialog || importModal.isOpen) {
50474
50612
  return;
50475
50613
  }
50476
50614
  closeHeaderMenus();
@@ -50824,9 +50962,9 @@ ${detail}` : ""}`
50824
50962
  };
50825
50963
  const schedulePoll = () => {
50826
50964
  clearPollTimer();
50827
- if (disposed || context2.signal.aborted || document2.visibilityState === "hidden") return;
50965
+ if (disposed || context.signal.aborted || document2.visibilityState === "hidden") return;
50828
50966
  pollTimer = setTimeout(() => {
50829
- if (disposed || context2.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
50967
+ if (disposed || context.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
50830
50968
  schedulePoll();
50831
50969
  return;
50832
50970
  }
@@ -50851,7 +50989,7 @@ ${detail}` : ""}`
50851
50989
  const token = ++listApplyToken;
50852
50990
  try {
50853
50991
  const refreshed = await client.listHostExtensions();
50854
- if (disposed || context2.signal.aborted) return;
50992
+ if (disposed || context.signal.aborted) return;
50855
50993
  applyLoadedList(refreshed, token);
50856
50994
  } catch {
50857
50995
  }
@@ -50876,7 +51014,7 @@ ${detail}` : ""}`
50876
51014
  }
50877
51015
  const listHostExtensions = client.listHostExtensions.bind(client);
50878
51016
  const token = ++listApplyToken;
50879
- await context2.runLatest(async () => listHostExtensions(), {
51017
+ await context.runLatest(async () => listHostExtensions(), {
50880
51018
  success(result) {
50881
51019
  loading = false;
50882
51020
  unavailable = false;
@@ -50933,7 +51071,7 @@ ${detail}` : ""}`
50933
51071
  try {
50934
51072
  const params = forceRefresh ? { forceRefresh: true } : {};
50935
51073
  const result = await client.listHostExtensionCatalog(params);
50936
- if (disposed || context2.signal.aborted || token !== catalogRequestToken) return;
51074
+ if (disposed || context.signal.aborted || token !== catalogRequestToken) return;
50937
51075
  catalogLoading = false;
50938
51076
  catalogUnavailable = false;
50939
51077
  catalogError = null;
@@ -50941,7 +51079,7 @@ ${detail}` : ""}`
50941
51079
  catalogById = new Map(result.extensions.map((entry) => [entry.id, entry]));
50942
51080
  render();
50943
51081
  } catch (error62) {
50944
- if (disposed || context2.signal.aborted || token !== catalogRequestToken) return;
51082
+ if (disposed || context.signal.aborted || token !== catalogRequestToken) return;
50945
51083
  catalogLoading = false;
50946
51084
  if (error62 instanceof RendererMethodUnavailableError) {
50947
51085
  catalogUnavailable = true;
@@ -50962,7 +51100,7 @@ ${detail}` : ""}`
50962
51100
  }
50963
51101
  };
50964
51102
  const installFromCatalog = async (entry, isUpdate) => {
50965
- if (recovering || pendingMutations.has(entry.id) || disposed || context2.signal.aborted)
51103
+ if (recovering || pendingMutations.has(entry.id) || disposed || context.signal.aborted)
50966
51104
  return;
50967
51105
  const client = resolveAvailableClient(getClient);
50968
51106
  const installedItem = listing?.extensions.find((item) => item.id === entry.id);
@@ -50990,7 +51128,7 @@ ${detail}` : ""}`
50990
51128
  } else {
50991
51129
  return;
50992
51130
  }
50993
- if (disposed || context2.signal.aborted) return;
51131
+ if (disposed || context.signal.aborted) return;
50994
51132
  const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || fallbackName;
50995
51133
  const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
50996
51134
  setFeedback(
@@ -51005,7 +51143,7 @@ ${detail}` : ""}`
51005
51143
  );
51006
51144
  await refreshInstalledAfterMutation();
51007
51145
  } catch (error62) {
51008
- if (disposed || context2.signal.aborted) return;
51146
+ if (disposed || context.signal.aborted) return;
51009
51147
  const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
51010
51148
  setFeedback(
51011
51149
  {
@@ -51016,7 +51154,7 @@ ${detail}` : ""}`
51016
51154
  );
51017
51155
  } finally {
51018
51156
  pendingMutations.delete(entry.id);
51019
- if (!disposed && !context2.signal.aborted) {
51157
+ if (!disposed && !context.signal.aborted) {
51020
51158
  render();
51021
51159
  if (!hasPendingMutations()) schedulePoll();
51022
51160
  }
@@ -51034,7 +51172,7 @@ ${detail}` : ""}`
51034
51172
  syncToolbarState();
51035
51173
  try {
51036
51174
  const result = await install2({ source });
51037
- if (disposed || context2.signal.aborted) return;
51175
+ if (disposed || context.signal.aborted) return;
51038
51176
  activeView = "installed";
51039
51177
  selectedCapability = "all";
51040
51178
  searchQuery = "";
@@ -51051,14 +51189,14 @@ ${detail}` : ""}`
51051
51189
  await refreshInstalledAfterMutation();
51052
51190
  } finally {
51053
51191
  importing = false;
51054
- if (!disposed && !context2.signal.aborted) {
51192
+ if (!disposed && !context.signal.aborted) {
51055
51193
  render();
51056
51194
  if (!hasPendingMutations()) schedulePoll();
51057
51195
  }
51058
51196
  }
51059
51197
  };
51060
51198
  const uninstallExtension = async (item) => {
51061
- if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
51199
+ if (recovering || pendingMutations.has(item.id) || disposed || context.signal.aborted)
51062
51200
  return;
51063
51201
  const client = resolveAvailableClient(getClient);
51064
51202
  const uninstall = client?.uninstallHostExtension?.bind(client);
@@ -51072,7 +51210,7 @@ ${detail}` : ""}`
51072
51210
  id: item.id,
51073
51211
  ...item.state === "valid" ? { expectedDigest: item.digest } : {}
51074
51212
  });
51075
- if (disposed || context2.signal.aborted) return;
51213
+ if (disposed || context.signal.aborted) return;
51076
51214
  if (pageHost.extensionId === item.id) {
51077
51215
  pageHost.close();
51078
51216
  }
@@ -51085,7 +51223,7 @@ ${detail}` : ""}`
51085
51223
  });
51086
51224
  await refreshInstalledAfterMutation();
51087
51225
  } catch (error62) {
51088
- if (disposed || context2.signal.aborted) return;
51226
+ if (disposed || context.signal.aborted) return;
51089
51227
  const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
51090
51228
  setFeedback(
51091
51229
  {
@@ -51096,14 +51234,14 @@ ${detail}` : ""}`
51096
51234
  );
51097
51235
  } finally {
51098
51236
  pendingMutations.delete(item.id);
51099
- if (!disposed && !context2.signal.aborted) {
51237
+ if (!disposed && !context.signal.aborted) {
51100
51238
  render();
51101
51239
  if (!hasPendingMutations()) schedulePoll();
51102
51240
  }
51103
51241
  }
51104
51242
  };
51105
51243
  const toggleExtension = async (item, enable) => {
51106
- if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
51244
+ if (recovering || pendingMutations.has(item.id) || disposed || context.signal.aborted)
51107
51245
  return;
51108
51246
  const client = resolveAvailableClient(getClient);
51109
51247
  const mutate = enable ? client?.enableHostExtension?.bind(client) : client?.disableHostExtension?.bind(client);
@@ -51118,10 +51256,10 @@ ${detail}` : ""}`
51118
51256
  render();
51119
51257
  let shouldReload = false;
51120
51258
  const runQueued = toggleQueue.then(async () => {
51121
- if (disposed || context2.signal.aborted) return;
51259
+ if (disposed || context.signal.aborted) return;
51122
51260
  const expectedRevision2 = listing?.configuration.revision ?? 0;
51123
51261
  const result = await mutate({ id: item.id, expectedRevision: expectedRevision2 });
51124
- if (disposed || context2.signal.aborted) return;
51262
+ if (disposed || context.signal.aborted) return;
51125
51263
  const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
51126
51264
  if (result.state === "saved") {
51127
51265
  if (!enable && pageHost.extensionId === item.id) {
@@ -51173,7 +51311,7 @@ ${detail}` : ""}`
51173
51311
  try {
51174
51312
  await runQueued;
51175
51313
  } catch (error62) {
51176
- if (disposed || context2.signal.aborted) return;
51314
+ if (disposed || context.signal.aborted) return;
51177
51315
  if (error62 instanceof RendererMethodUnavailableError) {
51178
51316
  unavailable = true;
51179
51317
  listing = null;
@@ -51190,7 +51328,7 @@ ${detail}` : ""}`
51190
51328
  );
51191
51329
  } finally {
51192
51330
  pendingMutations.delete(item.id);
51193
- if (!disposed && !context2.signal.aborted) {
51331
+ if (!disposed && !context.signal.aborted) {
51194
51332
  render();
51195
51333
  if (shouldReload) {
51196
51334
  await loadInstalled({ silent: true, keepFeedback: true });
@@ -51201,7 +51339,7 @@ ${detail}` : ""}`
51201
51339
  }
51202
51340
  };
51203
51341
  const openRecoveryDialog = () => {
51204
- if (disposed || context2.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
51342
+ if (disposed || context.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
51205
51343
  return;
51206
51344
  const client = resolveAvailableClient(getClient);
51207
51345
  if (!client?.recoverHostExtensions) return;
@@ -51247,7 +51385,7 @@ ${detail}` : ""}`
51247
51385
  modal.setAttribute("aria-busy", String(next));
51248
51386
  };
51249
51387
  const cleanupDialog = () => {
51250
- context2.signal.removeEventListener("abort", cleanupDialog);
51388
+ context.signal.removeEventListener("abort", cleanupDialog);
51251
51389
  if (activeRecoveryDialog === modal) activeRecoveryDialog = null;
51252
51390
  modal.remove();
51253
51391
  };
@@ -51258,7 +51396,7 @@ ${detail}` : ""}`
51258
51396
  if (dialogBusy) event.preventDefault();
51259
51397
  });
51260
51398
  modal.addEventListener("close", cleanupDialog);
51261
- context2.signal.addEventListener("abort", cleanupDialog, { once: true });
51399
+ context.signal.addEventListener("abort", cleanupDialog, { once: true });
51262
51400
  form.addEventListener("submit", (event) => {
51263
51401
  event.preventDefault();
51264
51402
  if (dialogBusy || hasPendingMutations()) return;
@@ -51276,7 +51414,7 @@ ${detail}` : ""}`
51276
51414
  render();
51277
51415
  const params = listing !== null ? { expectedRevision: listing.configuration.revision } : {};
51278
51416
  void recover(params).then(async (result) => {
51279
- if (disposed || context2.signal.aborted) return;
51417
+ if (disposed || context.signal.aborted) return;
51280
51418
  if (result.state === "saved") {
51281
51419
  pageHost.close();
51282
51420
  if (listing) {
@@ -51322,7 +51460,7 @@ ${detail}` : ""}`
51322
51460
  render();
51323
51461
  schedulePoll();
51324
51462
  }).catch((error62) => {
51325
- if (disposed || context2.signal.aborted) return;
51463
+ if (disposed || context.signal.aborted) return;
51326
51464
  recovering = false;
51327
51465
  setDialogBusy(false);
51328
51466
  render();
@@ -51357,7 +51495,7 @@ ${detail}` : ""}`
51357
51495
  };
51358
51496
  const onVisibilityChange = () => {
51359
51497
  if (document2.visibilityState === "hidden") clearPollTimer();
51360
- else if (!disposed && !context2.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
51498
+ else if (!disposed && !context.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
51361
51499
  void loadInstalled({ silent: true });
51362
51500
  }
51363
51501
  };
@@ -51431,12 +51569,12 @@ ${detail}` : ""}`
51431
51569
  }
51432
51570
  void clipboard.writeText(EXTENSIONS_ROOT_DISPLAY).then(
51433
51571
  () => {
51434
- if (!disposed && !context2.signal.aborted) {
51572
+ if (!disposed && !context.signal.aborted) {
51435
51573
  setFeedback({ tone: "success", text: copy.copiedDirectoryPath });
51436
51574
  }
51437
51575
  },
51438
51576
  () => {
51439
- if (!disposed && !context2.signal.aborted) {
51577
+ if (!disposed && !context.signal.aborted) {
51440
51578
  setFeedback({ tone: "danger", text: copy.copyPathFailed });
51441
51579
  }
51442
51580
  }
@@ -51482,7 +51620,7 @@ ${detail}` : ""}`
51482
51620
  }
51483
51621
  });
51484
51622
  const unsubscribePluginPages = pluginPages?.subscribe(() => {
51485
- if (!disposed && !context2.signal.aborted) {
51623
+ if (!disposed && !context.signal.aborted) {
51486
51624
  detailModal.sync(buildDetailModalState());
51487
51625
  }
51488
51626
  }) ?? null;
@@ -52127,7 +52265,7 @@ ${detail}` : ""}`
52127
52265
  }
52128
52266
  function defaultImportName(source, existing) {
52129
52267
  const base = source.provider === "openai-codex" ? "codex" : "grok";
52130
- const used = new Set(existing.map((record17) => record17.name));
52268
+ const used = new Set(existing.map((record19) => record19.name));
52131
52269
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
52132
52270
  if (!used.has(base)) return base;
52133
52271
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -52150,7 +52288,7 @@ ${detail}` : ""}`
52150
52288
  const shown = (text2) => accountDisplayText(text2, hideEmails);
52151
52289
  const targetButtons = /* @__PURE__ */ new Map();
52152
52290
  const importedRecords = () => snapshot.targets.find((target2) => target2.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
52153
- const sourceOf = (record17) => snapshot.sources.find((source) => source.id === record17.source.id);
52291
+ const sourceOf = (record19) => snapshot.sources.find((source) => source.id === record19.source.id);
52154
52292
  const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
52155
52293
  const compatibleSources = () => {
52156
52294
  const target2 = piTarget();
@@ -52188,7 +52326,7 @@ ${detail}` : ""}`
52188
52326
  sectionImport.addEventListener("click", () => {
52189
52327
  const sources = compatibleSources();
52190
52328
  const free = sources.find(
52191
- (source2) => !importedRecords().some((record17) => record17.source.id === source2.id)
52329
+ (source2) => !importedRecords().some((record19) => record19.source.id === source2.id)
52192
52330
  );
52193
52331
  const source = free ?? sources[0];
52194
52332
  if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
@@ -52238,30 +52376,30 @@ ${detail}` : ""}`
52238
52376
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
52239
52377
  return mark;
52240
52378
  };
52241
- const renderRow = (record17) => {
52379
+ const renderRow = (record19) => {
52242
52380
  const row = document2.createElement("div");
52243
52381
  row.className = "settings-pi-accounts__row";
52244
52382
  row.tabIndex = -1;
52245
- row.dataset.importName = record17.name;
52246
- row.setAttribute("aria-label", shown(record17.source.label));
52247
- const agent = record17.source.harnessId;
52383
+ row.dataset.importName = record19.name;
52384
+ row.setAttribute("aria-label", shown(record19.source.label));
52385
+ const agent = record19.source.harnessId;
52248
52386
  const mark = createMark(agent);
52249
52387
  const identity3 = document2.createElement("div");
52250
52388
  identity3.className = "settings-pi-accounts__identity";
52251
52389
  const label = document2.createElement("strong");
52252
52390
  label.className = "settings-account-email";
52253
- label.textContent = shown(record17.source.label);
52391
+ label.textContent = shown(record19.source.label);
52254
52392
  label.title = label.textContent;
52255
52393
  label.translate = false;
52256
52394
  const meta3 = document2.createElement("div");
52257
52395
  meta3.className = "settings-account-metadata";
52258
- const source = sourceOf(record17);
52396
+ const source = sourceOf(record19);
52259
52397
  const parts = [
52260
52398
  metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
52261
- metaPart(`${record17.name}/\u2026`, void 0, true),
52399
+ metaPart(`${record19.name}/\u2026`, void 0, true),
52262
52400
  metaPart(messages.copied)
52263
52401
  ];
52264
- const time3 = formatImportedAt(record17.importedAt);
52402
+ const time3 = formatImportedAt(record19.importedAt);
52265
52403
  if (time3) parts.push(metaPart(time3));
52266
52404
  parts.forEach((part, index) => {
52267
52405
  if (index > 0) {
@@ -52278,23 +52416,23 @@ ${detail}` : ""}`
52278
52416
  reimport.type = "button";
52279
52417
  reimport.className = "settings-account-action";
52280
52418
  reimport.textContent = messages.rowReimport;
52281
- reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record17.source.label)}`);
52419
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record19.source.label)}`);
52282
52420
  reimport.disabled = busy || !source;
52283
52421
  reimport.title = messages.reimport;
52284
52422
  reimport.addEventListener("click", () => {
52285
- if (source) openDialog("reimport", { source, record: record17 }, `row:${record17.name}`);
52423
+ if (source) openDialog("reimport", { source, record: record19 }, `row:${record19.name}`);
52286
52424
  });
52287
52425
  const remove = document2.createElement("button");
52288
52426
  remove.type = "button";
52289
52427
  remove.className = "settings-account-action settings-pi-accounts__remove";
52290
52428
  remove.textContent = messages.rowRemove;
52291
- remove.setAttribute("aria-label", `${messages.remove}: ${shown(record17.source.label)}`);
52429
+ remove.setAttribute("aria-label", `${messages.remove}: ${shown(record19.source.label)}`);
52292
52430
  remove.disabled = busy;
52293
- remove.addEventListener("click", () => openDialog("remove", { record: record17 }, `row:${record17.name}`));
52431
+ remove.addEventListener("click", () => openDialog("remove", { record: record19 }, `row:${record19.name}`));
52294
52432
  if (source) actions.append(reimport);
52295
52433
  actions.append(remove);
52296
52434
  row.append(mark, identity3, actions);
52297
- rows.set(record17.name, row);
52435
+ rows.set(record19.name, row);
52298
52436
  return row;
52299
52437
  };
52300
52438
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -52447,7 +52585,7 @@ ${detail}` : ""}`
52447
52585
  const label = document2.createElement("strong");
52448
52586
  label.textContent = shown(choice.label);
52449
52587
  label.translate = false;
52450
- const existing = importedRecords().find((record17) => record17.source.id === choice.id);
52588
+ const existing = importedRecords().find((record19) => record19.source.id === choice.id);
52451
52589
  const agent = choice.harnessId;
52452
52590
  const detail = document2.createElement("span");
52453
52591
  detail.textContent = [
@@ -52488,7 +52626,7 @@ ${detail}` : ""}`
52488
52626
  const name = request.action === "list" ? void 0 : request.name;
52489
52627
  state = {
52490
52628
  source: state.source,
52491
- record: importedRecords().find((record17) => record17.name === name) ?? state.record
52629
+ record: importedRecords().find((record19) => record19.name === name) ?? state.record
52492
52630
  };
52493
52631
  show(next);
52494
52632
  } else {
@@ -52502,12 +52640,12 @@ ${detail}` : ""}`
52502
52640
  sourceRadios = [];
52503
52641
  body.replaceChildren();
52504
52642
  controls.replaceChildren();
52505
- const { source, record: record17 } = state;
52643
+ const { source, record: record19 } = state;
52506
52644
  const close = () => modal.close();
52507
52645
  if (mode === "add" || mode === "reimport") {
52508
52646
  title.textContent = mode === "add" ? messages.add : messages.reimport;
52509
52647
  modal.setAttribute("aria-label", title.textContent);
52510
- const active2 = source ?? record17?.source;
52648
+ const active2 = source ?? record19?.source;
52511
52649
  const choices = mode === "add" && state.choose ? compatibleSources() : [];
52512
52650
  if (choices.length > 1) body.append(sourcePicker(choices));
52513
52651
  else if (active2) body.append(line(messages.source, shown(active2.label)));
@@ -52516,8 +52654,8 @@ ${detail}` : ""}`
52516
52654
  input3.maxLength = 48;
52517
52655
  input3.autocomplete = "off";
52518
52656
  input3.spellcheck = false;
52519
- input3.value = record17?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
52520
- input3.readOnly = Boolean(record17);
52657
+ input3.value = record19?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
52658
+ input3.readOnly = Boolean(record19);
52521
52659
  input3.addEventListener("input", () => {
52522
52660
  nameEdited = true;
52523
52661
  });
@@ -52551,7 +52689,7 @@ ${detail}` : ""}`
52551
52689
  {
52552
52690
  action: mode === "reimport" ? "reimport" : "import",
52553
52691
  sourceId: source2.id,
52554
- name: record17?.name ?? input3.value,
52692
+ name: record19?.name ?? input3.value,
52555
52693
  confirmed: true
52556
52694
  },
52557
52695
  "done"
@@ -52561,16 +52699,16 @@ ${detail}` : ""}`
52561
52699
  )
52562
52700
  );
52563
52701
  (mode === "add" ? input3 : controls.children[0]).focus();
52564
- } else if (mode === "remove" && record17) {
52702
+ } else if (mode === "remove" && record19) {
52565
52703
  title.textContent = messages.remove;
52566
52704
  modal.setAttribute("aria-label", title.textContent);
52567
- body.append(note(messages.removeWarning.replace("{name}", record17.name)));
52705
+ body.append(note(messages.removeWarning.replace("{name}", record19.name)));
52568
52706
  const cancel = command(messages.cancel, close);
52569
52707
  controls.append(
52570
52708
  cancel,
52571
52709
  command(
52572
52710
  messages.remove,
52573
- () => submit({ action: "remove", name: record17.name, confirmed: true }, null),
52711
+ () => submit({ action: "remove", name: record19.name, confirmed: true }, null),
52574
52712
  "danger"
52575
52713
  )
52576
52714
  );
@@ -52578,7 +52716,7 @@ ${detail}` : ""}`
52578
52716
  } else {
52579
52717
  title.textContent = messages.doneTitle;
52580
52718
  modal.setAttribute("aria-label", title.textContent);
52581
- const name = record17?.name;
52719
+ const name = record19?.name;
52582
52720
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
52583
52721
  body.append(note(messages.done));
52584
52722
  const done = command(messages.close, close, "primary");
@@ -52625,21 +52763,21 @@ ${detail}` : ""}`
52625
52763
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
52626
52764
  );
52627
52765
  if (!source || !target2) return null;
52628
- const record17 = target2.imports.find((candidate) => candidate.source.id === source.id);
52766
+ const record19 = target2.imports.find((candidate) => candidate.source.id === source.id);
52629
52767
  const key2 = `${harnessId}:${accountLabel}:import`;
52630
52768
  const button2 = document2.createElement("button");
52631
52769
  button2.type = "button";
52632
52770
  button2.className = "settings-account-pi-import";
52633
52771
  button2.dataset.accountFocus = key2;
52634
52772
  button2.disabled = busy;
52635
- const hint = record17 ? messages.importedHint.replace("{name}", record17.name) : messages.add;
52773
+ const hint = record19 ? messages.importedHint.replace("{name}", record19.name) : messages.add;
52636
52774
  button2.title = hint;
52637
52775
  button2.setAttribute("aria-label", hint);
52638
52776
  button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
52639
- if (record17) {
52777
+ if (record19) {
52640
52778
  button2.dataset.state = "imported";
52641
52779
  const name = document2.createElement("code");
52642
- name.textContent = `${record17.name}/\u2026`;
52780
+ name.textContent = `${record19.name}/\u2026`;
52643
52781
  name.translate = false;
52644
52782
  button2.append(name, createRendererSettingsIcon("check", 12));
52645
52783
  } else {
@@ -52647,7 +52785,7 @@ ${detail}` : ""}`
52647
52785
  button2.append(messages.add);
52648
52786
  }
52649
52787
  button2.addEventListener("click", () => {
52650
- if (!record17) {
52788
+ if (!record19) {
52651
52789
  openDialog("add", { source }, key2);
52652
52790
  return;
52653
52791
  }
@@ -52656,7 +52794,7 @@ ${detail}` : ""}`
52656
52794
  renderSection();
52657
52795
  sectionToggle.setAttribute("aria-expanded", "true");
52658
52796
  }
52659
- const row = rows.get(record17.name);
52797
+ const row = rows.get(record19.name);
52660
52798
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
52661
52799
  row?.focus();
52662
52800
  });
@@ -53359,8 +53497,8 @@ ${detail}` : ""}`
53359
53497
  id: "accounts",
53360
53498
  label: messages.pageLabels.accounts,
53361
53499
  icon: "accounts",
53362
- mount(context2) {
53363
- const document2 = context2.content.ownerDocument;
53500
+ mount(context) {
53501
+ const document2 = context.content.ownerDocument;
53364
53502
  const header = document2.createElement("div");
53365
53503
  header.className = "settings-account-header";
53366
53504
  const copy = document2.createElement("div");
@@ -53445,15 +53583,15 @@ ${detail}` : ""}`
53445
53583
  let plugins = [];
53446
53584
  const pluginFor = (id2) => plugins.find((plugin) => plugin.id === id2);
53447
53585
  const credentialImports = mountCredentialImports(
53448
- context2.content,
53449
- context2.signal,
53586
+ context.content,
53587
+ context.signal,
53450
53588
  getClient,
53451
53589
  messages.credentialImports,
53452
53590
  () => render(),
53453
53591
  pluginFor
53454
53592
  );
53455
- context2.content.append(header, status, toolbar, list, credentialImports.section);
53456
- const stopCountdowns = mountAccountResetCountdowns(list, messages, context2.signal);
53593
+ context.content.append(header, status, toolbar, list, credentialImports.section);
53594
+ const stopCountdowns = mountAccountResetCountdowns(list, messages, context.signal);
53457
53595
  let accounts = [];
53458
53596
  let currentAccountId = null;
53459
53597
  let accountPhase = "unavailable";
@@ -53559,7 +53697,7 @@ ${detail}` : ""}`
53559
53697
  requests.map(async ({ account, loading }) => {
53560
53698
  try {
53561
53699
  const result = await inspect({ accountId: account.accountId });
53562
- if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53700
+ if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53563
53701
  return;
53564
53702
  usageByAccountId.set(
53565
53703
  account.accountId,
@@ -53571,7 +53709,7 @@ ${detail}` : ""}`
53571
53709
  } : { status: "empty" }
53572
53710
  );
53573
53711
  } catch {
53574
- if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53712
+ if (context.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
53575
53713
  return;
53576
53714
  usageByAccountId.set(account.accountId, { status: "error" });
53577
53715
  }
@@ -53600,7 +53738,7 @@ ${detail}` : ""}`
53600
53738
  };
53601
53739
  const refreshInBackground = () => {
53602
53740
  if (!client().refreshCodexAccounts) return;
53603
- void context2.runLatest(
53741
+ void context.runLatest(
53604
53742
  () => client().refreshCodexAccounts?.() ?? client().listCodexAccounts(),
53605
53743
  {
53606
53744
  success(result) {
@@ -53612,7 +53750,7 @@ ${detail}` : ""}`
53612
53750
  );
53613
53751
  };
53614
53752
  const load = () => {
53615
- void context2.runLatest(() => client().listCodexAccounts(), {
53753
+ void context.runLatest(() => client().listCodexAccounts(), {
53616
53754
  success(result) {
53617
53755
  loadMessage = null;
53618
53756
  setAccounts(result);
@@ -53632,10 +53770,10 @@ ${detail}` : ""}`
53632
53770
  });
53633
53771
  } catch {
53634
53772
  }
53635
- const harnessAccounts = createHarnessAccounts(context2.signal, getClient, render);
53773
+ const harnessAccounts = createHarnessAccounts(context.signal, getClient, render);
53636
53774
  const directoryClient = getClient();
53637
53775
  void directoryClient?.listHarnessPlugins?.().then(({ plugins: next }) => {
53638
- if (context2.signal.aborted || getClient() !== directoryClient) return;
53776
+ if (context.signal.aborted || getClient() !== directoryClient) return;
53639
53777
  plugins = next;
53640
53778
  render();
53641
53779
  void credentialImports.refresh();
@@ -54458,8 +54596,8 @@ ${detail}` : ""}`
54458
54596
  id: "delegation",
54459
54597
  label: messages.pageLabels.delegation,
54460
54598
  icon: "delegation",
54461
- mount(context2) {
54462
- const doc = context2.content.ownerDocument;
54599
+ mount(context) {
54600
+ const doc = context.content.ownerDocument;
54463
54601
  const ownerWindow = doc.defaultView;
54464
54602
  const root = doc.createElement("div");
54465
54603
  root.className = "settings-delegation";
@@ -54483,7 +54621,7 @@ ${detail}` : ""}`
54483
54621
  const rowViews = /* @__PURE__ */ new Map();
54484
54622
  let disposed = false;
54485
54623
  let preferencesLoadGeneration = 0;
54486
- const isActive = () => !disposed && !context2.signal.aborted;
54624
+ const isActive = () => !disposed && !context.signal.aborted;
54487
54625
  const diagramAgents = () => readyAgents.map((agent) => {
54488
54626
  const summary = formatEffectiveSummary(
54489
54627
  agent.id,
@@ -54605,7 +54743,7 @@ ${detail}` : ""}`
54605
54743
  footnote.textContent = copy.footnote;
54606
54744
  modelsSection.append(sectionHead, unavailableNotice, group, footnote);
54607
54745
  root.append(header, diagram.element, howto, modelsSection);
54608
- context2.content.append(root);
54746
+ context.content.append(root);
54609
54747
  const canPersist = () => {
54610
54748
  const client = getClient();
54611
54749
  return Boolean(client?.getHarnessPreferences && client?.patchHarnessPreferences);
@@ -55019,14 +55157,14 @@ ${detail}` : ""}`
55019
55157
  id: "harness-schedules",
55020
55158
  label: t("\u5B9A\u65F6\u4EFB\u52A1", "Schedules"),
55021
55159
  icon: "schedules",
55022
- mount(context2) {
55160
+ mount(context) {
55023
55161
  const navigate = () => {
55024
- context2.content.replaceChildren();
55025
- void context2.runLatest((signal) => options.openSchedules(signal), {
55162
+ context.content.replaceChildren();
55163
+ void context.runLatest((signal) => options.openSchedules(signal), {
55026
55164
  success() {
55027
55165
  },
55028
55166
  failure() {
55029
- const document2 = context2.content.ownerDocument;
55167
+ const document2 = context.content.ownerDocument;
55030
55168
  const status = document2.createElement("p");
55031
55169
  status.setAttribute("role", "status");
55032
55170
  status.className = "text-sm text-settings-muted";
@@ -55039,7 +55177,7 @@ ${detail}` : ""}`
55039
55177
  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";
55040
55178
  retry.textContent = t("\u91CD\u8BD5", "Retry");
55041
55179
  retry.addEventListener("click", navigate);
55042
- context2.content.replaceChildren(status, retry);
55180
+ context.content.replaceChildren(status, retry);
55043
55181
  }
55044
55182
  });
55045
55183
  };
@@ -55095,12 +55233,12 @@ ${detail}` : ""}`
55095
55233
  // src/settings/update-status-poll.ts
55096
55234
  var RENDERER_UPDATE_STATUS_WAIT_MS = 10 * 6e4;
55097
55235
  var STATUS_POLL_INTERVAL_MS = 750;
55098
- function createRendererUpdateStatusPoll(context2, handlers) {
55099
- const window2 = context2.content.ownerDocument.defaultView;
55236
+ function createRendererUpdateStatusPoll(context, handlers) {
55237
+ const window2 = context.content.ownerDocument.defaultView;
55100
55238
  let timer;
55101
55239
  let deadline = 0;
55102
55240
  let disposed = false;
55103
- const active2 = () => !disposed && !context2.signal.aborted;
55241
+ const active2 = () => !disposed && !context.signal.aborted;
55104
55242
  const clearTimer = () => {
55105
55243
  if (timer !== void 0) window2?.clearTimeout(timer);
55106
55244
  timer = void 0;
@@ -55122,7 +55260,7 @@ ${detail}` : ""}`
55122
55260
  handlers.unavailable();
55123
55261
  return;
55124
55262
  }
55125
- void context2.runLatest(
55263
+ void context.runLatest(
55126
55264
  (signal) => runBoundedRendererUpdateRequest(
55127
55265
  readStatus,
55128
55266
  signal,
@@ -55366,8 +55504,8 @@ ${detail}` : ""}`
55366
55504
  id: "about",
55367
55505
  label: messages.pageLabels.about,
55368
55506
  icon: "about",
55369
- mount(context2) {
55370
- const document2 = context2.content.ownerDocument;
55507
+ mount(context) {
55508
+ const document2 = context.content.ownerDocument;
55371
55509
  const heading = document2.createElement("div");
55372
55510
  heading.className = "settings-section-label";
55373
55511
  heading.textContent = messages.pageLabels.about;
@@ -55409,7 +55547,7 @@ ${detail}` : ""}`
55409
55547
  panel.append(product, tagline, introduction, starCallout, repositorySection);
55410
55548
  const consoleEntry = consoleSection(document2, messages, getClient());
55411
55549
  if (consoleEntry) panel.append(consoleEntry);
55412
- context2.content.append(heading, panel);
55550
+ context.content.append(heading, panel);
55413
55551
  return void 0;
55414
55552
  }
55415
55553
  });
@@ -55436,8 +55574,8 @@ ${detail}` : ""}`
55436
55574
  id: "updates",
55437
55575
  label: messages.pageLabels.updates,
55438
55576
  icon: "updates",
55439
- mount(context2) {
55440
- const document2 = context2.content.ownerDocument;
55577
+ mount(context) {
55578
+ const document2 = context.content.ownerDocument;
55441
55579
  const windows = isWindowsRenderer(document2.defaultView);
55442
55580
  const header = document2.createElement("div");
55443
55581
  header.className = "settings-update-header";
@@ -55456,8 +55594,8 @@ ${detail}` : ""}`
55456
55594
  let currentAnnouncement = null;
55457
55595
  let announcementDialog = null;
55458
55596
  announcementButton.addEventListener("click", () => {
55459
- if (!currentAnnouncement || context2.signal.aborted) return;
55460
- const rootNode = context2.content.getRootNode();
55597
+ if (!currentAnnouncement || context.signal.aborted) return;
55598
+ const rootNode = context.content.getRootNode();
55461
55599
  const hostScheme = rootNode instanceof ShadowRoot && rootNode.host instanceof HTMLElement ? rootNode.host.style.colorScheme : "";
55462
55600
  const colorScheme2 = hostScheme === "light" || hostScheme === "dark" ? hostScheme : "inherit";
55463
55601
  announcementDialog?.dispose();
@@ -55566,9 +55704,9 @@ ${detail}` : ""}`
55566
55704
  controls.append(manualTitle, manualNpm, manualWindowsInstaller, actions);
55567
55705
  const notes = document2.createElement("div");
55568
55706
  notes.className = "settings-update-notes-section";
55569
- const macosSigning = createMacOsSigningSection(document2, messages, context2.signal);
55707
+ const macosSigning = createMacOsSigningSection(document2, messages, context.signal);
55570
55708
  const starBanner = updateStarBanner(document2, messages);
55571
- context2.content.append(
55709
+ context.content.append(
55572
55710
  header,
55573
55711
  metadata,
55574
55712
  panel,
@@ -55584,7 +55722,7 @@ ${detail}` : ""}`
55584
55722
  };
55585
55723
  let pending2 = false;
55586
55724
  let checkedStatus = null;
55587
- const statusPoll = createRendererUpdateStatusPoll(context2, {
55725
+ const statusPoll = createRendererUpdateStatusPoll(context, {
55588
55726
  status(status) {
55589
55727
  const message2 = statusMessage(status, messages);
55590
55728
  if (message2) renderPendingStatus(status, message2);
@@ -55690,23 +55828,23 @@ ${detail}` : ""}`
55690
55828
  try {
55691
55829
  const fresh = await runBoundedRendererUpdateRequest(
55692
55830
  () => client.checkUpdate(),
55693
- context2.signal
55831
+ context.signal
55694
55832
  );
55695
- if (context2.signal.aborted) return;
55833
+ if (context.signal.aborted) return;
55696
55834
  if (fresh) latestRunningTaskCount = fresh.runningTaskCount ?? 0;
55697
55835
  } catch {
55698
- if (context2.signal.aborted) return;
55836
+ if (context.signal.aborted) return;
55699
55837
  }
55700
55838
  if (latestRunningTaskCount > 0) {
55701
55839
  const confirmed = await confirmUpdateWithRunningTasks(
55702
- context2.content,
55840
+ context.content,
55703
55841
  messages,
55704
- context2.signal,
55842
+ context.signal,
55705
55843
  latestRunningTaskCount
55706
55844
  );
55707
- if (!confirmed || context2.signal.aborted) return;
55845
+ if (!confirmed || context.signal.aborted) return;
55708
55846
  }
55709
- if (!context2.signal.aborted) start(client);
55847
+ if (!context.signal.aborted) start(client);
55710
55848
  } finally {
55711
55849
  confirming = false;
55712
55850
  }
@@ -55717,7 +55855,7 @@ ${detail}` : ""}`
55717
55855
  pending2 = true;
55718
55856
  const previousStatus = checkedStatus;
55719
55857
  renderPendingStatus(null, messages.updatePreparing);
55720
- void context2.runLatest(
55858
+ void context.runLatest(
55721
55859
  (signal) => runBoundedRendererUpdateRequest(() => client.startUpdate(), signal),
55722
55860
  {
55723
55861
  success(result) {
@@ -55897,7 +56035,7 @@ ${detail}` : ""}`
55897
56035
  }
55898
56036
  pending2 = true;
55899
56037
  renderPendingStatus(null, messages.updateChecking);
55900
- return context2.runLatest(
56038
+ return context.runLatest(
55901
56039
  (signal) => runBoundedRendererUpdateRequest(() => client.checkUpdate(), signal),
55902
56040
  {
55903
56041
  success(result) {
@@ -55915,7 +56053,7 @@ ${detail}` : ""}`
55915
56053
  const client = getClient();
55916
56054
  if (!client?.getReleaseAnnouncement) return;
55917
56055
  void client.getReleaseAnnouncement({ manual: true }).then((result) => {
55918
- if (context2.signal.aborted || !result?.announcement) return;
56056
+ if (context.signal.aborted || !result?.announcement) return;
55919
56057
  currentAnnouncement = result.announcement;
55920
56058
  announcementButton.hidden = false;
55921
56059
  }).catch(() => {
@@ -66348,13 +66486,13 @@ ${renderer_brand_mark_default}`;
66348
66486
  var ROW = "data-app-action-sidebar-thread-row";
66349
66487
  var ID = "data-app-action-sidebar-thread-id";
66350
66488
  var HOST = "data-app-action-sidebar-thread-host-id";
66351
- function record13(value) {
66489
+ function record14(value) {
66352
66490
  return typeof value === "object" && value !== null && !Array.isArray(value);
66353
66491
  }
66354
66492
  function hooks(owner) {
66355
66493
  const result = [];
66356
66494
  let hook = owner.memoizedState;
66357
- while (record13(hook) && result.length < 4096) {
66495
+ while (record14(hook) && result.length < 4096) {
66358
66496
  result.push(hook);
66359
66497
  hook = hook.next;
66360
66498
  }
@@ -66362,7 +66500,7 @@ ${renderer_brand_mark_default}`;
66362
66500
  }
66363
66501
  function identity2(owner) {
66364
66502
  const props = owner.memoizedProps;
66365
- if (!record13(props) || !record13(props.dataAttributes)) return null;
66503
+ if (!record14(props) || !record14(props.dataAttributes)) return null;
66366
66504
  const { conversationId: threadId, hostId: hostId2, dataAttributes: attributes } = props;
66367
66505
  if (typeof threadId !== "string" || !threadId || typeof hostId2 !== "string" || !hostId2 || !(ROW in attributes) || attributes[HOST] !== hostId2 || attributes[ID] !== threadId && attributes[ID] !== `${hostId2}:${threadId}`)
66368
66506
  return null;
@@ -66374,10 +66512,10 @@ ${renderer_brand_mark_default}`;
66374
66512
  const [subscriber, deps] = memo2;
66375
66513
  const signal = deps[0];
66376
66514
  const next = hook.next;
66377
- const instance = record13(next) ? next.queue : null;
66378
- const effectHook = record13(next) ? next.next : null;
66379
- const effect = record13(effectHook) ? effectHook.memoizedState : null;
66380
- 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)
66515
+ const instance = record14(next) ? next.queue : null;
66516
+ const effectHook = record14(next) ? next.next : null;
66517
+ const effect = record14(effectHook) ? effectHook.memoizedState : null;
66518
+ 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)
66381
66519
  return null;
66382
66520
  return {
66383
66521
  atom: signal.atom,
@@ -66388,7 +66526,7 @@ ${renderer_brand_mark_default}`;
66388
66526
  };
66389
66527
  }
66390
66528
  function repairSidebarThreadState(owner) {
66391
- if (!record13(owner)) return null;
66529
+ if (!record14(owner)) return null;
66392
66530
  const key2 = identity2(owner);
66393
66531
  if (!key2) return null;
66394
66532
  const candidates = [];
@@ -66400,7 +66538,7 @@ ${renderer_brand_mark_default}`;
66400
66538
  if (instance2.value !== null || store2.get(atom2) !== null || subscriber2.getSnapshot() !== null || instance2.getSnapshot() !== null)
66401
66539
  continue;
66402
66540
  const value = atom2.read((dependency) => store2.get(dependency));
66403
- 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")
66541
+ 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")
66404
66542
  candidates.push(candidate2);
66405
66543
  }
66406
66544
  } catch {
@@ -66482,8 +66620,8 @@ ${renderer_brand_mark_default}`;
66482
66620
  if (seen.has(fiber)) return /* @__PURE__ */ new Set();
66483
66621
  seen.add(fiber);
66484
66622
  if (identity2(fiber)) owners.add(fiber);
66485
- if (fiber !== first && record13(fiber.sibling)) stack.push(fiber.sibling);
66486
- if (record13(fiber.child)) stack.push(fiber.child);
66623
+ if (fiber !== first && record14(fiber.sibling)) stack.push(fiber.sibling);
66624
+ if (record14(fiber.child)) stack.push(fiber.child);
66487
66625
  }
66488
66626
  if (stack.length) return /* @__PURE__ */ new Set();
66489
66627
  }
@@ -66495,7 +66633,7 @@ ${renderer_brand_mark_default}`;
66495
66633
  refresh() {
66496
66634
  const owners = sidebarOwners(root);
66497
66635
  for (const [owner, repair] of repairs) {
66498
- const current = owners.has(owner) ? owner : record13(owner.alternate) && owners.has(owner.alternate) ? owner.alternate : null;
66636
+ const current = owners.has(owner) ? owner : record14(owner.alternate) && owners.has(owner.alternate) ? owner.alternate : null;
66499
66637
  if (current && repair.isBound(current)) owners.delete(current);
66500
66638
  else {
66501
66639
  repair.dispose();
@@ -66572,10 +66710,10 @@ ${renderer_brand_mark_default}`;
66572
66710
  // src/renderer-skill-library.ts
66573
66711
  function createRendererSkillLibrary(options) {
66574
66712
  let active2 = null;
66575
- const key2 = (context2) => JSON.stringify(context2.params);
66713
+ const key2 = (context) => JSON.stringify(context.params);
66576
66714
  const current = (state) => {
66577
- const context2 = options.context(state.editor);
66578
- return active2 === state && context2?.client === state.context.client && key2(context2) === state.key;
66715
+ const context = options.context(state.editor);
66716
+ return active2 === state && context?.client === state.context.client && key2(context) === state.key;
66579
66717
  };
66580
66718
  const close = () => {
66581
66719
  active2?.unsubscribe?.();
@@ -66606,28 +66744,28 @@ ${renderer_brand_mark_default}`;
66606
66744
  } while (state.dirty && current(state));
66607
66745
  };
66608
66746
  const open2 = (editor) => {
66609
- const context2 = options.context(editor);
66610
- if (!context2) {
66747
+ const context = options.context(editor);
66748
+ if (!context) {
66611
66749
  close();
66612
66750
  return;
66613
66751
  }
66614
- if (active2?.context.client === context2.client && active2.key === key2(context2)) {
66752
+ if (active2?.context.client === context.client && active2.key === key2(context)) {
66615
66753
  active2.editor = editor;
66616
66754
  return;
66617
66755
  }
66618
66756
  close();
66619
66757
  const state = {
66620
66758
  editor,
66621
- context: context2,
66622
- key: key2(context2),
66759
+ context,
66760
+ key: key2(context),
66623
66761
  pending: false,
66624
66762
  dirty: false
66625
66763
  };
66626
66764
  active2 = state;
66627
- if (context2.client.subscribeSkillsChanged) {
66628
- state.unsubscribe = context2.client.subscribeSkillsChanged((change) => {
66765
+ if (context.client.subscribeSkillsChanged) {
66766
+ state.unsubscribe = context.client.subscribeSkillsChanged((change) => {
66629
66767
  if (!current(state)) return;
66630
- if (change.cwd && !context2.params.threadId && change.cwd !== context2.params.cwd) return;
66768
+ if (change.cwd && !context.params.threadId && change.cwd !== context.params.cwd) return;
66631
66769
  void query(state);
66632
66770
  });
66633
66771
  }
@@ -66637,9 +66775,9 @@ ${renderer_brand_mark_default}`;
66637
66775
  open: open2,
66638
66776
  close,
66639
66777
  read(editor) {
66640
- const context2 = options.context(editor);
66641
- if (!context2) return null;
66642
- if (!active2 || active2.context.client !== context2.client || active2.key !== key2(context2))
66778
+ const context = options.context(editor);
66779
+ if (!context) return null;
66780
+ if (!active2 || active2.context.client !== context.client || active2.key !== key2(context))
66643
66781
  open2(editor);
66644
66782
  const state = active2;
66645
66783
  if (!state) return null;
@@ -67558,8 +67696,109 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67558
67696
  return event.defaultPrevented;
67559
67697
  }
67560
67698
 
67699
+ // src/codex-thread-unread.ts
67700
+ var record15 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
67701
+ function isNativeThreadReadState(value) {
67702
+ return record15(value) && Object.hasOwn(value, "identityKey") && Object.hasOwn(value, "isReady") && ["read", "identityKey", "isReady", "isUnread", "subscribe"].every(
67703
+ (key2) => typeof value[key2] === "function"
67704
+ );
67705
+ }
67706
+ function isNativeSidebarUnread(value) {
67707
+ if (typeof value !== "function" || value.length !== 2) return false;
67708
+ const source = Function.prototype.toString.call(value);
67709
+ 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);
67710
+ }
67711
+ function createDesktopThreadUnreadWatcher(ownerWindow, importModule) {
67712
+ let loading;
67713
+ const load = () => loading ??= Promise.all([
67714
+ loadCodexNativeServices(ownerWindow, isNativeThreadReadState, importModule),
67715
+ loadCodexNativeServices(ownerWindow, isNativeSidebarUnread, importModule)
67716
+ ]).then(
67717
+ (services) => {
67718
+ if (services.some((service) => !service)) loading = void 0;
67719
+ return services;
67720
+ },
67721
+ () => {
67722
+ loading = void 0;
67723
+ return [null, null];
67724
+ }
67725
+ );
67726
+ return (threadIds, receive) => {
67727
+ const ids = [...new Set(threadIds)];
67728
+ let disposed = false;
67729
+ let revision = 0;
67730
+ let stopScope = () => {
67731
+ };
67732
+ let stopState = () => {
67733
+ };
67734
+ let previous;
67735
+ const unknown2 = () => Object.fromEntries(ids.map((id2) => [id2, null]));
67736
+ const publish = (snapshot) => {
67737
+ if (disposed || previous && ids.every((id2) => snapshot[id2] === previous?.[id2])) return;
67738
+ previous = snapshot;
67739
+ receive(Object.freeze(snapshot));
67740
+ };
67741
+ publish(unknown2());
67742
+ if (ids.length) {
67743
+ void load().then(([state, unread]) => {
67744
+ if (disposed || !state || !unread) return;
67745
+ const refresh = () => {
67746
+ const current = ++revision;
67747
+ stopScope();
67748
+ stopScope = () => {
67749
+ };
67750
+ if (disposed) return;
67751
+ const scope = readRendererAppScope(ownerWindow.document);
67752
+ if (!scope) return publish(unknown2());
67753
+ try {
67754
+ const ready = () => {
67755
+ const saved = state.read();
67756
+ return state.isReady() && record15(saved) && Array.isArray(saved.local);
67757
+ };
67758
+ if (!ready()) return publish(unknown2());
67759
+ const identity3 = state.identityKey();
67760
+ const closeScope = scope.watch(({ get }) => {
67761
+ if (disposed || current !== revision) return;
67762
+ try {
67763
+ if (!ready() || identity3 !== state.identityKey()) return publish(unknown2());
67764
+ const snapshot = Object.fromEntries(
67765
+ ids.map((id2) => {
67766
+ const value = unread(get, `local:${id2}`);
67767
+ return [id2, typeof value === "boolean" ? value : null];
67768
+ })
67769
+ );
67770
+ publish(snapshot);
67771
+ } catch {
67772
+ publish(unknown2());
67773
+ }
67774
+ });
67775
+ if (disposed || current !== revision) closeScope();
67776
+ else stopScope = closeScope;
67777
+ } catch {
67778
+ publish(unknown2());
67779
+ }
67780
+ };
67781
+ try {
67782
+ stopState = state.subscribe({ type: "snapshot", listener: refresh });
67783
+ refresh();
67784
+ } catch {
67785
+ stopScope();
67786
+ stopState();
67787
+ publish(unknown2());
67788
+ }
67789
+ });
67790
+ }
67791
+ return () => {
67792
+ disposed = true;
67793
+ revision++;
67794
+ stopScope();
67795
+ stopState();
67796
+ };
67797
+ };
67798
+ }
67799
+
67561
67800
  // src/remote-sidebar-history.ts
67562
- function record14(value) {
67801
+ function record16(value) {
67563
67802
  return typeof value === "object" && value !== null;
67564
67803
  }
67565
67804
  function sidebarCatalogForWindow(load) {
@@ -67575,22 +67814,22 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67575
67814
  async function loadSidebarCatalog(view) {
67576
67815
  const services = await loadCodexNativeServices(
67577
67816
  view,
67578
- (value) => record14(value) && Object.hasOwn(value, "appServerManagers") && Object.hasOwn(value, "localThreadCatalog") && typeof value.localThreadCatalog?.notifyThread === "function" && typeof value.localThreadCatalog?.readEntries === "function"
67817
+ (value) => record16(value) && Object.hasOwn(value, "appServerManagers") && Object.hasOwn(value, "localThreadCatalog") && typeof value.localThreadCatalog?.notifyThread === "function" && typeof value.localThreadCatalog?.readEntries === "function"
67579
67818
  );
67580
67819
  return services?.localThreadCatalog ?? null;
67581
67820
  }
67582
67821
  function observeRemoteSidebarClosures(view, closed) {
67583
67822
  const listen = ({ data, source }) => {
67584
- 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")
67823
+ 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")
67585
67824
  return;
67586
- if (data.method === "thread/closed" || data.method === "thread/status/changed" && record14(data.params.status) && data.params.status.type === "notLoaded")
67825
+ if (data.method === "thread/closed" || data.method === "thread/status/changed" && record16(data.params.status) && data.params.status.type === "notLoaded")
67587
67826
  closed(data.hostId, data.params.threadId);
67588
67827
  };
67589
67828
  view.addEventListener("message", listen);
67590
67829
  return () => view.removeEventListener("message", listen);
67591
67830
  }
67592
67831
  function emptyCachedThread(value, key2, cwd) {
67593
- 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;
67832
+ 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;
67594
67833
  }
67595
67834
  async function reconcileRemoteSidebarThread(manager, key2, cwd, catalogForWindow, isCurrent) {
67596
67835
  if (!manager.getConversation || !manager.discardConversationFromCache || !isCurrent()) return;
@@ -67598,7 +67837,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67598
67837
  await manager.sendRequest("thread/read", { threadId: key2.threadId, includeTurns: false });
67599
67838
  return;
67600
67839
  } catch (error62) {
67601
- if (!record14(error62) || (error62.jsonRpcCode ?? error62.code) !== -32600) throw error62;
67840
+ if (!record16(error62) || (error62.jsonRpcCode ?? error62.code) !== -32600) throw error62;
67602
67841
  if (error62.message !== `thread not loaded: ${key2.threadId}`) return;
67603
67842
  }
67604
67843
  if (!isCurrent()) return;
@@ -67607,7 +67846,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67607
67846
  const entries = await catalog.readEntries([key2]);
67608
67847
  if (!Array.isArray(entries) || entries.length > 1) return;
67609
67848
  const entry = entries[0];
67610
- if (entry != null && (!record14(entry) || entry.hostId !== key2.hostId || entry.threadId !== key2.threadId || entry.modelProvider === "codexhost" || entry.cwd !== cwd || entry.displayTitle !== cwd))
67849
+ if (entry != null && (!record16(entry) || entry.hostId !== key2.hostId || entry.threadId !== key2.threadId || entry.modelProvider === "codexhost" || entry.cwd !== cwd || entry.displayTitle !== cwd))
67611
67850
  return;
67612
67851
  const cached2 = await manager.getConversation(key2.threadId);
67613
67852
  if (!isCurrent() || cached2 != null && !emptyCachedThread(cached2, key2, cwd)) return;
@@ -67738,10 +67977,10 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
67738
67977
  getClient,
67739
67978
  getLocale
67740
67979
  });
67741
- const record17 = { module, surface };
67742
- instances.set(id2, record17);
67980
+ const record19 = { module, surface };
67981
+ instances.set(id2, record19);
67743
67982
  void surface.mount(() => document2.body.append(container)).catch(() => {
67744
- if (instances.get(id2) === record17) delete record17.surface;
67983
+ if (instances.get(id2) === record19) delete record19.surface;
67745
67984
  surface.dispose();
67746
67985
  });
67747
67986
  } catch (cause) {
@@ -71463,6 +71702,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71463
71702
  ready: () => !disposed && window.__codexhostRendererBindingProbeV1?.status().adapter.state === "ready",
71464
71703
  sidebar: sidebarDom,
71465
71704
  watchTree: treeRelay.subscribe,
71705
+ watchUnread: createDesktopThreadUnreadWatcher(window),
71466
71706
  describe: (id2) => {
71467
71707
  const plugin = pluginForHost("local", id2);
71468
71708
  return plugin ? { name: plugin.name, ...plugin.icon ? { icon: plugin.icon } : {} } : id2 === "codex" ? { name: "Codex" } : void 0;
@@ -71704,7 +71944,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71704
71944
 
71705
71945
  // src/renderer-rpc-steering-queue.ts
71706
71946
  var INTERRUPTED = "Interrupted before the steer was accepted.";
71707
- var record15 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71947
+ var record17 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71708
71948
  async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
71709
71949
  const snapshot = Promise.withResolvers();
71710
71950
  let lease;
@@ -71738,7 +71978,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71738
71978
  for (const value of /* @__PURE__ */ new Set([pending2, lease])) dispose(value);
71739
71979
  }
71740
71980
  if (messages.some(
71741
- (message2) => record15(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
71981
+ (message2) => record17(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
71742
71982
  ))
71743
71983
  throw new Error(
71744
71984
  "Resume or remove the other previously paused messages before changing direction"
@@ -71746,23 +71986,34 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71746
71986
  return async (turnId) => {
71747
71987
  await coordinator("removeQueuedMessage", threadId, messageId);
71748
71988
  const state = await manager("getThreadExecutionState", threadId);
71749
- const stillRunning = record15(state) && state.inProgress === true && state.activeTurnId === turnId;
71989
+ const stillRunning = record17(state) && state.inProgress === true && state.activeTurnId === turnId;
71750
71990
  const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
71751
- if (stillRunning || record15(turn) && turn.status === "completed")
71991
+ if (stillRunning || record17(turn) && turn.status === "completed")
71752
71992
  await coordinator("resumeInterruptedQueuedMessages", threadId);
71753
71993
  };
71754
71994
  }
71755
71995
 
71756
71996
  // src/renderer-rpc-steering.ts
71757
- var record16 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71997
+ var record18 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71758
71998
  var invoke = (target2, name, ...args) => Reflect.apply(Reflect.get(target2, name), target2, args);
71759
- var running = (state) => record16(state) && (state.inProgress === true || !!state.activeTurnId);
71760
- var context = (previous, marker) => ({
71761
- ...record16(previous) ? previous : {},
71762
- [THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
71999
+ var running = (state) => record18(state) && (state.inProgress === true || !!state.activeTurnId);
72000
+ var withApplicationContext = (params, key2, value) => ({
72001
+ ...params,
72002
+ additionalContext: {
72003
+ ...record18(params.additionalContext) ? params.additionalContext : {},
72004
+ [key2]: { kind: "application", value }
72005
+ }
71763
72006
  });
71764
- function installRendererRpcSteering(value) {
71765
- if (!record16(value) || typeof value.forHost !== "function") return null;
72007
+ function withReferenceHost(prepared, hostId2) {
72008
+ const stamp = (params) => withApplicationContext(params, THREAD_REFERENCE_SOURCE_HOST_PARAM, hostId2);
72009
+ return {
72010
+ ...prepared,
72011
+ ...record18(prepared.steer) ? { steer: stamp(prepared.steer) } : {},
72012
+ ...record18(prepared.start) && record18(prepared.start.request) ? { start: { ...prepared.start, request: stamp(prepared.start.request) } } : {}
72013
+ };
72014
+ }
72015
+ function installRendererRpcSteering(value, routing) {
72016
+ if (!record18(value) || typeof value.forHost !== "function") return null;
71766
72017
  const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
71767
72018
  if (!descriptor?.writable) return null;
71768
72019
  const controller = value;
@@ -71777,7 +72028,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71777
72028
  throw new Error("Steering connection was retired");
71778
72029
  };
71779
72030
  const inspect = async (threadId, input3) => {
71780
- const text2 = Array.isArray(input3) ? input3.filter(record16).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
72031
+ const text2 = Array.isArray(input3) ? input3.filter(record18).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
71781
72032
  current();
71782
72033
  const delivery = await inspectRendererSteeringDelivery(
71783
72034
  (method, params) => {
@@ -71793,19 +72044,19 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71793
72044
  const target2 = async (threadId, messageId, delivery) => {
71794
72045
  const state = await invoke(rpc, "getThreadExecutionState", threadId);
71795
72046
  current();
71796
- if (!record16(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
72047
+ if (!record18(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
71797
72048
  throw new Error("Native steering target or message identity is unavailable");
71798
72049
  return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
71799
72050
  };
71800
72051
  const withoutQueueRow = async (request) => {
71801
- if (!record16(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
72052
+ if (!record18(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
71802
72053
  return request;
71803
72054
  try {
71804
72055
  const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
71805
72056
  current();
71806
72057
  if (!running(state)) return request;
71807
72058
  const message2 = request.message;
71808
- const text2 = record16(message2) && typeof message2.text === "string" ? message2.text : "";
72059
+ const text2 = record18(message2) && typeof message2.text === "string" ? message2.text : "";
71809
72060
  const delivery = await inspect(request.conversationId, [{ text: text2 }]);
71810
72061
  return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
71811
72062
  } catch {
@@ -71827,53 +72078,64 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71827
72078
  const callback = args[index];
71828
72079
  if (typeof callback !== "function")
71829
72080
  throw new Error("Native submission preparation is unavailable");
72081
+ const route = isDesktopSshHostId(hostId2) ? routing?.forHost(hostId2) : null;
72082
+ const isSameGeneration = route && captureThreadReferenceGeneration(routing, hostId2);
72083
+ let capability;
72084
+ const stamp = async (prepared) => {
72085
+ if (!isSameGeneration?.() || routing?.forHost(hostId2) !== route) return prepared;
72086
+ capability ??= supportsThreadReferenceContext(
72087
+ (method, params) => invoke(rpc, "sendRequest", method, params)
72088
+ );
72089
+ const supported = await capability;
72090
+ current();
72091
+ return supported && isSameGeneration() && routing?.forHost(hostId2) === route ? withReferenceHost(prepared, hostId2) : prepared;
72092
+ };
71830
72093
  let marker = null;
71831
72094
  let threadId;
71832
72095
  let messageId;
71833
72096
  let finish;
71834
72097
  const apply = (prepared) => {
71835
- if (!marker || !record16(prepared.steer)) return prepared;
72098
+ if (!marker || !record18(prepared.steer)) return prepared;
72099
+ const value2 = JSON.stringify(marker);
71836
72100
  const result2 = {
71837
72101
  ...prepared,
71838
- steer: {
71839
- ...prepared.steer,
71840
- additionalContext: context(prepared.steer.additionalContext, marker)
71841
- }
72102
+ steer: withApplicationContext(prepared.steer, THREAD_STEERING_CONTEXT_PARAM, value2)
71842
72103
  };
71843
72104
  if (marker.delivery !== "newTurn") return result2;
71844
- if (!record16(prepared.start) || !record16(prepared.start.request))
72105
+ if (!record18(prepared.start) || !record18(prepared.start.request))
71845
72106
  throw new Error("Native start preparation is unavailable for steering");
71846
72107
  return {
71847
72108
  ...result2,
71848
72109
  afterInactiveTurnId: marker.expectedTurnId,
71849
72110
  start: {
71850
72111
  ...prepared.start,
71851
- request: {
71852
- ...prepared.start.request,
71853
- additionalContext: context(prepared.start.request.additionalContext, marker)
71854
- }
72112
+ request: withApplicationContext(
72113
+ prepared.start.request,
72114
+ THREAD_STEERING_CONTEXT_PARAM,
72115
+ value2
72116
+ )
71855
72117
  }
71856
72118
  };
71857
72119
  };
71858
72120
  const prepare = async (...input3) => {
71859
72121
  current();
71860
- const prepared = await callback(...input3);
72122
+ const raw = await callback(...input3);
71861
72123
  current();
71862
- if (!record16(prepared)) throw new Error("Native submission preparation is malformed");
71863
- if (marker) return apply(prepared);
71864
- if (input3[1] !== "steer" || !record16(prepared.steer) || typeof prepared.conversationId !== "string")
71865
- return prepared;
71866
- threadId = prepared.conversationId;
72124
+ if (!record18(raw)) throw new Error("Native submission preparation is malformed");
72125
+ if (marker) return apply(await stamp(raw));
72126
+ if (input3[1] !== "steer" || !record18(raw.steer) || typeof raw.conversationId !== "string")
72127
+ return stamp(raw);
72128
+ threadId = raw.conversationId;
71867
72129
  const execution = await invoke(rpc, "getThreadExecutionState", threadId);
71868
72130
  current();
71869
- if (!running(execution)) return prepared;
71870
- const delivery = await inspect(threadId, prepared.steer.input);
71871
- if (delivery === "official") return prepared;
71872
- const restore = prepared.steer.restoreMessage;
71873
- messageId = record16(restore) && typeof restore.id === "string" ? restore.id : void 0;
71874
- const clientId = prepared.steer.clientUserMessageId ?? messageId;
72131
+ if (!running(execution)) return stamp(raw);
72132
+ const delivery = await inspect(threadId, raw.steer.input);
72133
+ if (delivery === "official") return stamp(raw);
72134
+ const restore = raw.steer.restoreMessage;
72135
+ messageId = record18(restore) && typeof restore.id === "string" ? restore.id : void 0;
72136
+ const clientId = raw.steer.clientUserMessageId ?? messageId;
71875
72137
  marker = await target2(threadId, clientId, delivery);
71876
- if (delivery === "activeTurn") return apply(prepared);
72138
+ if (delivery === "activeTurn") return apply(await stamp(raw));
71877
72139
  if (!messageId) throw new Error("Native queued message identity is unavailable");
71878
72140
  finish = await prepareRpcSteeringQueue(
71879
72141
  hostId2,
@@ -71884,14 +72146,14 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71884
72146
  );
71885
72147
  const start = await callback(input3[0], "start");
71886
72148
  current();
71887
- if (!record16(start)) throw new Error("Native start preparation is malformed");
71888
- return apply(start);
72149
+ if (!record18(start)) throw new Error("Native start preparation is malformed");
72150
+ return apply(await stamp(start));
71889
72151
  };
71890
72152
  const forwarded = [...args];
71891
72153
  forwarded[index] = prepare;
71892
72154
  if (key2 === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
71893
72155
  const result = await invoke(handle, key2, ...forwarded);
71894
- if (finish && record16(result) && result.status === "sent" && typeof result.turnId === "string") {
72156
+ if (finish && record18(result) && result.status === "sent" && typeof result.turnId === "string") {
71895
72157
  await finish(result.turnId).catch(
71896
72158
  () => console.error("codexhost could not reconcile native steering queue")
71897
72159
  );
@@ -71939,7 +72201,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
71939
72201
  return window.__codexhostRpcSteeringV1?.controller === controller;
71940
72202
  const routing = window.__codexhostHostRoutingV1;
71941
72203
  if (!routing) return false;
71942
- const cleanup = installRendererRpcSteering(controller);
72204
+ const cleanup = installRendererRpcSteering(controller, routing);
71943
72205
  if (!cleanup) return false;
71944
72206
  const originalDispose = routing.dispose;
71945
72207
  const dispose = () => {