@codexhost/cli-win32-x64 0.34.0 → 0.35.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 (113) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +479 -107
  4. package/app/console-web.js +1106 -145
  5. package/app/desktop-controller.mjs +356 -63
  6. package/app/host-runtime.mjs +4345 -1470
  7. package/app/plugins/antigravity/plugin.mjs +1002 -99
  8. package/app/plugins/claude-code/plugin.mjs +336 -61
  9. package/app/plugins/codebuddy/plugin.mjs +389 -84
  10. package/app/plugins/codex-usage/plugin.mjs +468 -65
  11. package/app/plugins/copilot/plugin.mjs +336 -63
  12. package/app/plugins/cursor-cli/plugin.mjs +336 -61
  13. package/app/plugins/deepseek-harness/plugin.mjs +336 -61
  14. package/app/plugins/devin/plugin.mjs +336 -61
  15. package/app/plugins/grok/plugin.mjs +389 -83
  16. package/app/plugins/hermes/plugin.mjs +335 -60
  17. package/app/plugins/kimi-code/plugin.mjs +336 -61
  18. package/app/plugins/kiro-cli/plugin.mjs +336 -61
  19. package/app/plugins/omp/plugin.mjs +336 -61
  20. package/app/plugins/opencode/plugin.mjs +336 -61
  21. package/app/plugins/pi/plugin.mjs +336 -61
  22. package/app/plugins/qoder/plugin.mjs +337 -62
  23. package/app/plugins/qoder-cn/plugin.mjs +337 -62
  24. package/app/plugins/qwen-code/plugin.mjs +335 -60
  25. package/app/plugins/workbuddy/plugin.mjs +408 -95
  26. package/app/plugins/workbuddy-cn/plugin.mjs +408 -95
  27. package/app/plugins/zcode/plugin.mjs +337 -61
  28. package/app/renderer-extension.js +1516 -346
  29. package/app/web/assets/{abnfDiagram-XWFEHMT6-Cg-E7mc4.js → abnfDiagram-XWFEHMT6-CGkBtBVj.js} +1 -1
  30. package/app/web/assets/{architectureDiagram-CSQXQB3N-B__CwXjW.js → architectureDiagram-CSQXQB3N-Byv-cZeH.js} +1 -1
  31. package/app/web/assets/{blockDiagram-BEDRHYPZ-Bk2gCIVM.js → blockDiagram-BEDRHYPZ-DjLzUtwg.js} +1 -1
  32. package/app/web/assets/{c4Diagram-M2UUVUY5-DU_TpjJ3.js → c4Diagram-M2UUVUY5-CJlsb6QO.js} +1 -1
  33. package/app/web/assets/{chunk-2Q5K7J3B-DnJEi6e4.js → chunk-2Q5K7J3B-CWm537bw.js} +1 -1
  34. package/app/web/assets/{chunk-3GCGMST5-Dia9jGkf.js → chunk-3GCGMST5-NpcInIx4.js} +1 -1
  35. package/app/web/assets/{chunk-5VM5RSS4-2PGDiDvK.js → chunk-5VM5RSS4-CeyyP0dm.js} +1 -1
  36. package/app/web/assets/{chunk-7U7NFRK5-BLPm3d5H.js → chunk-7U7NFRK5-Bto5OgbF.js} +1 -1
  37. package/app/web/assets/{chunk-CNRTWJTD-GH_nAEXs.js → chunk-CNRTWJTD-CuRMFCjT.js} +1 -1
  38. package/app/web/assets/{chunk-D5HYT7QG-DnIm-Ely.js → chunk-D5HYT7QG-DtQM1-2k.js} +1 -1
  39. package/app/web/assets/{chunk-EBZ3SEQC-C6N5qLCR.js → chunk-EBZ3SEQC-DbUb3ZJ4.js} +2 -2
  40. package/app/web/assets/{chunk-JWPE2WC7-D_kMgdmr.js → chunk-JWPE2WC7-Dxh3d9Ag.js} +1 -1
  41. package/app/web/assets/{chunk-KTR4FSNJ-BRb9femQ.js → chunk-KTR4FSNJ-BfwavXUO.js} +1 -1
  42. package/app/web/assets/{chunk-XXDRQBXY-BFaK95zq.js → chunk-XXDRQBXY-CxR1flID.js} +1 -1
  43. package/app/web/assets/{classDiagram-v2-KXABOMEV--_hR_XrU.js → classDiagram-v2-KXABOMEV-2WV2q_X2.js} +1 -1
  44. package/app/web/assets/{cose-bilkent-JH36ORCC-C7ghEB3_.js → cose-bilkent-JH36ORCC-C-ENrCL_.js} +1 -1
  45. package/app/web/assets/{cynefin-EF2NZ3EQ-Ce1lURwZ.js → cynefin-EF2NZ3EQ-Bg5LeTZO.js} +1 -1
  46. package/app/web/assets/{cynefinDiagram-NJNITYFG-Cgr5aSTS.js → cynefinDiagram-NJNITYFG-CRAdbGGt.js} +1 -1
  47. package/app/web/assets/{dagre-KIHZ2IZ3-BBFKmRP1.js → dagre-KIHZ2IZ3-dNHEvUqL.js} +1 -1
  48. package/app/web/assets/{diagram-7YQZDPLS-CJQih32K.js → diagram-7YQZDPLS-7F4O37o5.js} +1 -1
  49. package/app/web/assets/{diagram-QBROCOUO-Cl3S7IUT.js → diagram-QBROCOUO-B-5KpeI2.js} +1 -1
  50. package/app/web/assets/{diagram-RJJCUUZO-B6C8N2cV.js → diagram-RJJCUUZO-DqDsyDaL.js} +1 -1
  51. package/app/web/assets/{diagram-WERXNKYE-NkciBSQl.js → diagram-WERXNKYE-f1oaPKos.js} +1 -1
  52. package/app/web/assets/{diagram-YHHI257C-DlEvljeY.js → diagram-YHHI257C-DVMtl9Bt.js} +1 -1
  53. package/app/web/assets/{diagram-YR4HJLHV-e4_Gzbt6.js → diagram-YR4HJLHV-BWFCNFFF.js} +1 -1
  54. package/app/web/assets/{ebnfDiagram-N527522P-WvQEFmPi.js → ebnfDiagram-N527522P-B4N7d-Bi.js} +1 -1
  55. package/app/web/assets/{elk-O5DQBFGD-CkyJsjzf.js → elk-O5DQBFGD-DRdfF_UQ.js} +1 -1
  56. package/app/web/assets/{erDiagram-K3K3BIDK-B93gK3X0.js → erDiagram-K3K3BIDK-BW4-_5sZ.js} +1 -1
  57. package/app/web/assets/{flowDiagram-Z6JWZHQI-NFaGX6B4.js → flowDiagram-Z6JWZHQI-DIQa5yEv.js} +1 -1
  58. package/app/web/assets/{ganttDiagram-3PRQTZWP-Czh68CQm.js → ganttDiagram-3PRQTZWP-JBK9PM7A.js} +1 -1
  59. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-t95UHKja.js → gitGraphDiagram-VXDFKS5L-TPI9Su0g.js} +1 -1
  60. package/app/web/assets/{grid-E2QIVN74-C87DucDN.js → grid-E2QIVN74-DmHbunuP.js} +1 -1
  61. package/app/web/assets/index-BKDmniRf.js +209 -0
  62. package/app/web/assets/index-BPMnQdGr.css +1 -0
  63. package/app/web/assets/{infoDiagram-EZ3ZOAHP-CxFlfQbY.js → infoDiagram-EZ3ZOAHP-BeFwO9PI.js} +1 -1
  64. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-D4IwQJde.js → ishikawaDiagram-S3EKX5GW-BTbrKF_p.js} +1 -1
  65. package/app/web/assets/{journeyDiagram-POQNLL5X-C0Bf5W4T.js → journeyDiagram-POQNLL5X-DR0yWxJi.js} +1 -1
  66. package/app/web/assets/{kanban-definition-BH5XI6FM-Cda7r2yr.js → kanban-definition-BH5XI6FM-DMHrC9oV.js} +1 -1
  67. package/app/web/assets/{mermaid.core-f4LJm6AC.js → mermaid.core-Brmc1kJw.js} +4 -4
  68. package/app/web/assets/{mindmap-definition-WVAN44T4-DKapinG7.js → mindmap-definition-WVAN44T4-NT_XVwlI.js} +1 -1
  69. package/app/web/assets/{pegDiagram-D4NLKWP3-D7iEZGN2.js → pegDiagram-D4NLKWP3-K67_THcc.js} +1 -1
  70. package/app/web/assets/{pieDiagram-36ENHN4W-CopXZ5qt.js → pieDiagram-36ENHN4W-GlTgKnTi.js} +1 -1
  71. package/app/web/assets/{quadrantDiagram-ZQUDMS73-mmkKPDGK.js → quadrantDiagram-ZQUDMS73-yMEZ6-Nr.js} +1 -1
  72. package/app/web/assets/{railroadDiagram-JIZHGYPL-BAGwIIkV.js → railroadDiagram-JIZHGYPL-MXCqwbuq.js} +1 -1
  73. package/app/web/assets/{render-VIF2ZAQL-dXxGa09y.js → render-VIF2ZAQL-BRUlhHPG.js} +2 -2
  74. package/app/web/assets/{requirementDiagram-AXW2TVFA-C35tmLFs.js → requirementDiagram-AXW2TVFA-Dqx4p0Bz.js} +1 -1
  75. package/app/web/assets/{sankeyDiagram-FBCJTAIF-BbSo5yeK.js → sankeyDiagram-FBCJTAIF-COp3IWvs.js} +1 -1
  76. package/app/web/assets/{sequenceDiagram-3LA2ROMG-Cgm2unNy.js → sequenceDiagram-3LA2ROMG-j1xwrmp8.js} +1 -1
  77. package/app/web/assets/{sizeCapture-2Q2CQKSF-DCXFjl2x.js → sizeCapture-2Q2CQKSF-ZEXdxLeY.js} +1 -1
  78. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-B349iAao.js → stateDiagram-v2-ATKHQDJO-2pt2L-Zd.js} +1 -1
  79. package/app/web/assets/{swimlanes-YQL5WMAO-6OvL1sEz.js → swimlanes-YQL5WMAO-BHpgfPPd.js} +1 -1
  80. package/app/web/assets/swimlanesDiagram-UCCPES4V-BrYKheZO.js +8 -0
  81. package/app/web/assets/{timeline-definition-7Z437IG3-Bh1E3mhW.js → timeline-definition-7Z437IG3-Cw4F_3FM.js} +1 -1
  82. package/app/web/assets/{usecaseDiagram-RDK6N6HP-Dr5A05lL.js → usecaseDiagram-RDK6N6HP-DefiMBIg.js} +1 -1
  83. package/app/web/assets/{vennDiagram-SHRQU5PJ-CQPPBa27.js → vennDiagram-SHRQU5PJ-D30EMFrI.js} +1 -1
  84. package/app/web/assets/{wardleyDiagram-F3OXNVQS-BHin00q8.js → wardleyDiagram-F3OXNVQS-4ok25PKp.js} +1 -1
  85. package/app/web/assets/{xychartDiagram-GDYJKCDI-D4BAWlQZ.js → xychartDiagram-GDYJKCDI-BB0uAQX5.js} +1 -1
  86. package/app/web/codexhost-settings.js +157 -87
  87. package/app/web/index.html +2 -2
  88. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  89. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +63 -63
  90. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +70 -70
  91. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  92. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  93. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +90 -78
  94. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +98 -98
  95. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +65 -65
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +1 -1
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +62 -62
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +80 -80
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
  102. package/app/web/plugins.json +1 -0
  103. package/app/web-modules/server.mjs +1862 -1096
  104. package/bin/codexhost.exe +0 -0
  105. package/libexec/codexhost-node-repl.exe +0 -0
  106. package/libexec/codexhost-screenshot.exe +0 -0
  107. package/libexec/codexhost-shell.exe +0 -0
  108. package/libexec/codexhost-shim.exe +0 -0
  109. package/libexec/codexhost-updater.exe +0 -0
  110. package/package.json +1 -1
  111. package/app/web/assets/index-CGI50Nfg.css +0 -1
  112. package/app/web/assets/index-Dr6wHi0A.js +0 -208
  113. package/app/web/assets/swimlanesDiagram-UCCPES4V-CIKaQUvP.js +0 -8
@@ -19833,26 +19833,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19833
19833
  external_exports.boolean(),
19834
19834
  external_exports.null()
19835
19835
  ]);
19836
- function hasNoCircularReferences(value) {
19837
- const ancestors = /* @__PURE__ */ new WeakSet();
19838
- const stack = [{ value, leaving: false }];
19836
+ function isPlainObject2(value) {
19837
+ const prototype = Object.getPrototypeOf(value);
19838
+ return prototype === Object.prototype || prototype === null;
19839
+ }
19840
+ var JSON_VALIDATION_LEAVE = /* @__PURE__ */ Symbol("json-validation-leave");
19841
+ function isValidJsonValue(value) {
19842
+ if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
19843
+ return true;
19844
+ }
19845
+ if (typeof value !== "object")
19846
+ return false;
19847
+ const ancestors = /* @__PURE__ */ new Set();
19848
+ const stack = [value];
19839
19849
  try {
19840
19850
  while (stack.length > 0) {
19841
- const frame = stack.pop();
19842
- if (!frame)
19843
- break;
19844
- if (frame.leaving) {
19845
- ancestors.delete(frame.value);
19851
+ const current = stack.pop();
19852
+ if (current === JSON_VALIDATION_LEAVE) {
19853
+ ancestors.delete(stack.pop());
19854
+ continue;
19855
+ }
19856
+ if (current === null || typeof current === "string" || typeof current === "boolean" || typeof current === "number" && Number.isFinite(current)) {
19846
19857
  continue;
19847
19858
  }
19848
- if (typeof frame.value !== "object" || frame.value === null)
19859
+ if (typeof current !== "object")
19860
+ return false;
19861
+ if (ancestors.has(current))
19862
+ return false;
19863
+ if (Array.isArray(current)) {
19864
+ ancestors.add(current);
19865
+ stack.push(current, JSON_VALIDATION_LEAVE);
19866
+ for (let index = current.length - 1; index >= 0; index -= 1) {
19867
+ stack.push(current[index]);
19868
+ }
19849
19869
  continue;
19850
- if (ancestors.has(frame.value))
19870
+ }
19871
+ if (!isPlainObject2(current))
19851
19872
  return false;
19852
- ancestors.add(frame.value);
19853
- stack.push({ value: frame.value, leaving: true });
19854
- for (const child of Object.values(frame.value)) {
19855
- stack.push({ value: child, leaving: false });
19873
+ ancestors.add(current);
19874
+ stack.push(current, JSON_VALIDATION_LEAVE);
19875
+ for (const key2 in current) {
19876
+ if (Object.hasOwn(current, key2)) {
19877
+ if (key2 === "__proto__")
19878
+ return false;
19879
+ stack.push(current[key2]);
19880
+ }
19856
19881
  }
19857
19882
  }
19858
19883
  } catch {
@@ -19860,17 +19885,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19860
19885
  }
19861
19886
  return true;
19862
19887
  }
19863
- var nonCircularSchema = external_exports.custom(hasNoCircularReferences, {
19864
- message: "JSON value must not contain circular references"
19888
+ var jsonValueSchema = external_exports.custom(isValidJsonValue, {
19889
+ message: "Invalid JSON value"
19865
19890
  });
19866
- var recursiveJsonValueSchema = external_exports.lazy(() => external_exports.union([
19867
- jsonPrimitiveSchema,
19868
- external_exports.array(recursiveJsonValueSchema),
19869
- external_exports.record(external_exports.string(), recursiveJsonValueSchema)
19870
- ]));
19871
- var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
19872
- var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
19873
- var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
19891
+ var jsonArraySchema = external_exports.custom((value) => Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON array" });
19892
+ var jsonObjectSchema = external_exports.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON object" });
19874
19893
 
19875
19894
  // ../shared-contracts/dist/errors.js
19876
19895
  var codexhostErrorSchema = external_exports.strictObject({
@@ -20906,11 +20925,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20906
20925
  });
20907
20926
  var semver = /^v?(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?)?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?$/iu;
20908
20927
  var order = (a, b) => a < b ? -1 : a > b ? 1 : 0;
20909
- function compareExtensionVersions(a, b) {
20928
+ function tryCompareExtensionVersions(a, b) {
20910
20929
  const left = semver.exec(a.trim());
20911
20930
  const right = semver.exec(b.trim());
20912
20931
  if (!left || !right)
20913
- return 0;
20932
+ return null;
20914
20933
  for (const index of [1, 2, 3]) {
20915
20934
  const result = order(BigInt(left[index] ?? "0"), BigInt(right[index] ?? "0"));
20916
20935
  if (result)
@@ -20932,6 +20951,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20932
20951
  }
20933
20952
  return order(BigInt(preA.length), BigInt(preB.length));
20934
20953
  }
20954
+ function compareExtensionVersions(a, b) {
20955
+ return tryCompareExtensionVersions(a, b) ?? 0;
20956
+ }
20935
20957
  function resolveDesktopExtensionSlots(enabledOrder, manifests) {
20936
20958
  const byId = new Map(Array.from(manifests, ({ id: id2, slots = [] }) => [id2, slots]));
20937
20959
  const owners = /* @__PURE__ */ new Map();
@@ -21101,6 +21123,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21101
21123
  backend: external_exports.int().positive().optional()
21102
21124
  }),
21103
21125
  downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS"),
21126
+ downloads7d: external_exports.number().int().min(0).optional(),
21104
21127
  featured: external_exports.boolean().optional(),
21105
21128
  featuredOrder: external_exports.int().nonnegative().optional(),
21106
21129
  changelog: external_exports.array(hostExtensionChangelogEntrySchema).max(20).optional()
@@ -21170,24 +21193,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21170
21193
  var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
21171
21194
  var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
21172
21195
  var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
21196
+ var HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH = 512;
21197
+ var hostExtensionOperationStatusSchema = external_exports.discriminatedUnion("state", [
21198
+ external_exports.object({
21199
+ state: external_exports.literal("updating"),
21200
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
21201
+ startedAt: external_exports.iso.datetime()
21202
+ }),
21203
+ external_exports.object({
21204
+ state: external_exports.literal("failed"),
21205
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
21206
+ startedAt: external_exports.iso.datetime(),
21207
+ updatedAt: external_exports.iso.datetime(),
21208
+ error: external_exports.string().min(1).max(HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH),
21209
+ interruptedByShutdown: external_exports.boolean().optional()
21210
+ })
21211
+ ]);
21173
21212
  var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
21174
- hostExtensionInstallationSchema.extend({
21213
+ external_exports.object({
21214
+ ...hostExtensionInstallationSchema.shape,
21175
21215
  state: external_exports.literal("valid"),
21176
21216
  enabled: external_exports.boolean(),
21177
21217
  ...desktopConflict,
21178
21218
  iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
21179
21219
  screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
21180
21220
  backendState: backendState.optional(),
21181
- backendError: external_exports.string().optional()
21221
+ backendError: external_exports.string().optional(),
21222
+ operation: hostExtensionOperationStatusSchema.optional()
21182
21223
  }),
21183
- external_exports.strictObject({
21224
+ external_exports.object({
21184
21225
  state: external_exports.enum(["invalid", "incompatible"]),
21185
21226
  id: external_exports.string().min(1),
21186
21227
  enabled: external_exports.boolean(),
21187
21228
  error: external_exports.string()
21188
21229
  })
21189
21230
  ]);
21190
- var hostExtensionsListResultSchema = external_exports.strictObject({
21231
+ var hostExtensionsListResultSchema = external_exports.object({
21191
21232
  revision: hostExtensionRevisionSchema,
21192
21233
  configuration: hostExtensionConfigurationSchema,
21193
21234
  diagnostics: external_exports.array(external_exports.string()),
@@ -21226,7 +21267,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21226
21267
  var noParams = external_exports.strictObject({});
21227
21268
  var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
21228
21269
  var selection = external_exports.strictObject({ ...id, ...expectedRevision });
21229
- var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
21270
+ var installationResult = external_exports.object({
21271
+ ...hostExtensionInstallationSchema.shape,
21272
+ replaced: external_exports.boolean()
21273
+ });
21230
21274
  var mutationResult = external_exports.discriminatedUnion("state", [
21231
21275
  external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
21232
21276
  external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
@@ -21255,7 +21299,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21255
21299
  values: jsonObjectSchema
21256
21300
  });
21257
21301
  var hostExtensionsRpcSchemas = {
21258
- [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
21302
+ [HOST_EXTENSIONS_RPC.list]: {
21303
+ params: external_exports.object({
21304
+ includeOperations: external_exports.boolean().optional()
21305
+ }),
21306
+ result: hostExtensionsListResultSchema
21307
+ },
21259
21308
  [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
21260
21309
  [HOST_EXTENSIONS_RPC.catalog]: {
21261
21310
  params: external_exports.strictObject({
@@ -21281,6 +21330,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21281
21330
  ...id,
21282
21331
  expectedDigest: active.digest,
21283
21332
  expectedActivationId: active.activationId.optional(),
21333
+ expectedVersion: external_exports.string().trim().min(1).max(128).optional(),
21284
21334
  source: hostExtensionInstallSourceSchema.optional()
21285
21335
  }),
21286
21336
  result: installationResult
@@ -21330,9 +21380,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21330
21380
  };
21331
21381
 
21332
21382
  // ../shared-contracts/dist/group-chat.js
21333
- var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
21334
- var MAX_GROUP_AGENT_HOPS = 20;
21383
+ var GROUP_MEMORY_MAX_BYTES = 4096;
21384
+ var DEFAULT_GROUP_MAX_AGENT_HOPS = 10;
21385
+ var MAX_GROUP_AGENT_HOPS = 200;
21335
21386
  var GROUP_NOTICE_MAX_LENGTH = 2e3;
21387
+ var cachedUtf8Encoder;
21388
+ function groupUtf8ByteLength(text2) {
21389
+ if (cachedUtf8Encoder === void 0) {
21390
+ cachedUtf8Encoder = typeof TextEncoder === "function" ? new TextEncoder() : null;
21391
+ }
21392
+ if (cachedUtf8Encoder !== null) {
21393
+ return cachedUtf8Encoder.encode(text2).length;
21394
+ }
21395
+ let bytes = 0;
21396
+ for (let i = 0; i < text2.length; i += 1) {
21397
+ const code = text2.charCodeAt(i);
21398
+ if (code <= 127) {
21399
+ bytes += 1;
21400
+ } else if (code <= 2047) {
21401
+ bytes += 2;
21402
+ } else if (code >= 55296 && code <= 56319 && i + 1 < text2.length) {
21403
+ const next = text2.charCodeAt(i + 1);
21404
+ if (next >= 56320 && next <= 57343) {
21405
+ bytes += 4;
21406
+ i += 1;
21407
+ } else {
21408
+ bytes += 3;
21409
+ }
21410
+ } else {
21411
+ bytes += 3;
21412
+ }
21413
+ }
21414
+ return bytes;
21415
+ }
21336
21416
  var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
21337
21417
  var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
21338
21418
  var groupMemberIdSchema = external_exports.uuidv4();
@@ -21341,7 +21421,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21341
21421
  var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
21342
21422
  var nonnegativeInteger = external_exports.int().nonnegative();
21343
21423
  var positiveInteger = external_exports.int().positive();
21344
- var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
21424
+ var maxAgentHopsSchema = nonnegativeInteger.max(MAX_GROUP_AGENT_HOPS);
21345
21425
  var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
21346
21426
  var timestamp = external_exports.iso.datetime();
21347
21427
  var optionalMemberEdits = {
@@ -21360,9 +21440,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21360
21440
  harnessId: harnessIdSchema,
21361
21441
  status: groupMemberStatusSchema,
21362
21442
  projectless: external_exports.boolean().optional(),
21443
+ showInSidebar: external_exports.boolean().optional(),
21363
21444
  joinedAtSeq: nonnegativeInteger,
21364
21445
  lastDeliveredSeq: nonnegativeInteger,
21365
21446
  lastRosterVersion: nonnegativeInteger,
21447
+ lastMemoryVersion: nonnegativeInteger.default(0),
21366
21448
  createdAt: timestamp
21367
21449
  });
21368
21450
  var groupProjectlessWorkspaceSchema = external_exports.object({
@@ -21374,19 +21456,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21374
21456
  displayName: nonblankString,
21375
21457
  state: nonblankString.optional(),
21376
21458
  color: external_exports.string().optional(),
21377
- filePreview: external_exports.boolean().optional()
21459
+ filePreview: external_exports.boolean().optional(),
21460
+ memberSidebarVisibility: external_exports.boolean().optional(),
21461
+ sharedMemory: external_exports.boolean().optional()
21378
21462
  });
21379
- var groupRoomSchema = external_exports.object({
21463
+ var groupRoomObjectSchema = external_exports.object({
21380
21464
  roomId: groupRoomIdSchema,
21381
21465
  title: nonblankString,
21382
21466
  defaultCwd: nonblankString,
21383
21467
  projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
21384
21468
  unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
21469
+ unmentionedMemberId: groupMemberIdSchema.optional(),
21385
21470
  allowAgentMentions: external_exports.boolean().default(true),
21386
21471
  maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
21472
+ relayHopLimit: maxAgentHopsSchema.optional(),
21387
21473
  lastSeq: nonnegativeInteger,
21388
21474
  lastSpeakerMemberId: groupMemberIdSchema.optional(),
21389
21475
  rosterVersion: nonnegativeInteger,
21476
+ memoryVersion: nonnegativeInteger.default(0),
21477
+ memorySha256: external_exports.string().regex(/^[0-9a-f]{64}$/u).optional(),
21390
21478
  humanEpoch: nonnegativeInteger,
21391
21479
  relayPaused: external_exports.boolean(),
21392
21480
  pinned: external_exports.boolean(),
@@ -21394,7 +21482,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21394
21482
  updatedAt: timestamp,
21395
21483
  members: external_exports.array(groupMemberSchema),
21396
21484
  remote: groupRoomRemoteHostSchema.optional()
21397
- }).superRefine(({ members: members2 }, context) => {
21485
+ }).superRefine(({ members: members2, unmentionedPolicy, unmentionedMemberId }, context) => {
21486
+ if (unmentionedMemberId !== void 0 && unmentionedPolicy !== "none") {
21487
+ context.addIssue({
21488
+ code: "custom",
21489
+ path: ["unmentionedMemberId"],
21490
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
21491
+ });
21492
+ }
21398
21493
  const handles = /* @__PURE__ */ new Set();
21399
21494
  for (const [index, { handle, status }] of members2.entries()) {
21400
21495
  if (status === "removed")
@@ -21409,6 +21504,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21409
21504
  handles.add(handle);
21410
21505
  }
21411
21506
  });
21507
+ var groupRoomSchema = external_exports.preprocess((value) => {
21508
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
21509
+ const record3 = value;
21510
+ if (record3.unmentionedPolicy === "member" && record3.unmentionedMemberId !== void 0) {
21511
+ return { ...record3, unmentionedPolicy: "none" };
21512
+ }
21513
+ }
21514
+ return value;
21515
+ }, groupRoomObjectSchema);
21412
21516
  var groupAttachmentSchema = external_exports.object({
21413
21517
  kind: external_exports.enum(["image", "file"]),
21414
21518
  attachmentId: nonblankString.max(256),
@@ -21435,6 +21539,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21435
21539
  mentionedMemberIds: external_exports.array(groupMemberIdSchema),
21436
21540
  mentionAll: external_exports.boolean().optional(),
21437
21541
  hopCount: nonnegativeInteger,
21542
+ durationMs: nonnegativeInteger.optional(),
21438
21543
  createdAt: timestamp
21439
21544
  });
21440
21545
  var newThreadOptions = {
@@ -21464,6 +21569,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21464
21569
  var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
21465
21570
  var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
21466
21571
  var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
21572
+ var GROUPS_READ_MEMORY_METHOD = "codexhost/groups/memory/read";
21573
+ var GROUPS_UPDATE_MEMORY_METHOD = "codexhost/groups/memory/update";
21467
21574
  var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
21468
21575
  var GROUPS_CHANGED_EVENT = "codexhost/groups/changed";
21469
21576
  var roomIdentity = { roomId: groupRoomIdSchema };
@@ -21495,8 +21602,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21495
21602
  var groupsUpdateParamsSchema = external_exports.strictObject({
21496
21603
  ...roomIdentity,
21497
21604
  ...roomEdits,
21605
+ unmentionedMemberId: groupMemberIdSchema.nullable().optional(),
21498
21606
  pinned: external_exports.boolean().optional(),
21499
21607
  relayPaused: external_exports.boolean().optional()
21608
+ }).superRefine(({ unmentionedPolicy, unmentionedMemberId }, context) => {
21609
+ if (unmentionedMemberId !== void 0 && unmentionedMemberId !== null && unmentionedPolicy !== void 0 && unmentionedPolicy !== "none") {
21610
+ context.addIssue({
21611
+ code: "custom",
21612
+ path: ["unmentionedMemberId"],
21613
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
21614
+ });
21615
+ }
21500
21616
  });
21501
21617
  var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
21502
21618
  var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
@@ -21511,7 +21627,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21511
21627
  var groupsUpdateMemberParamsSchema = external_exports.strictObject({
21512
21628
  ...memberIdentity,
21513
21629
  ...optionalMemberEdits,
21514
- status: groupMemberStatusSchema.optional()
21630
+ status: groupMemberStatusSchema.optional(),
21631
+ showInSidebar: external_exports.boolean().optional()
21515
21632
  });
21516
21633
  var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
21517
21634
  var groupsRebindMemberParamsSchema = external_exports.strictObject({
@@ -21614,6 +21731,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21614
21731
  messages: external_exports.array(groupMessageSchema),
21615
21732
  totalSeq: nonnegativeInteger
21616
21733
  });
21734
+ var groupsReadMemoryParamsSchema = external_exports.strictObject(roomIdentity);
21735
+ var groupsReadMemoryResultSchema = external_exports.object({
21736
+ ...roomIdentity,
21737
+ memoryVersion: nonnegativeInteger,
21738
+ content: external_exports.string(),
21739
+ updatedAt: timestamp
21740
+ });
21741
+ var groupsUpdateMemoryParamsSchema = external_exports.strictObject({
21742
+ ...roomIdentity,
21743
+ content: external_exports.string().refine((value) => groupUtf8ByteLength(value) <= GROUP_MEMORY_MAX_BYTES, `Shared room memory must be at most ${GROUP_MEMORY_MAX_BYTES} UTF-8 bytes`),
21744
+ expectedVersion: nonnegativeInteger.optional()
21745
+ });
21746
+ var groupsUpdateMemoryResultSchema = external_exports.object({
21747
+ room: groupRoomSchema,
21748
+ memoryVersion: nonnegativeInteger,
21749
+ content: external_exports.string(),
21750
+ updatedAt: timestamp
21751
+ });
21617
21752
  var groupsInspectCwdParamsSchema = external_exports.strictObject({
21618
21753
  cwd: nonblankString,
21619
21754
  roomId: groupRoomIdSchema.optional()
@@ -21749,6 +21884,149 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21749
21884
  }).nullable()
21750
21885
  });
21751
21886
 
21887
+ // ../shared-contracts/dist/voice.js
21888
+ var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
21889
+ var VOICE_CONFIG_GET_METHOD = "codexhost/voice/config/get";
21890
+ var VOICE_CONFIG_SET_METHOD = "codexhost/voice/config/set";
21891
+ var voiceProviderModeSchema = external_exports.enum([
21892
+ "codex",
21893
+ "openai-compatible",
21894
+ "deepseek-asr",
21895
+ "openai-chat-audio"
21896
+ ]);
21897
+ var voiceAudioFormatSchema = external_exports.enum(["native", "wav"]);
21898
+ var SENSITIVE_VOICE_QUERY_PARAM = /(?:^|[_-])(?:key|token|secret|password|passwd|pwd|auth|authorization|credential|signature|sig)(?:$|[_-])|(?:api|access|auth|client|app|private|bearer)[_-]?(?:key|token|secret)/i;
21899
+ function isLoopbackVoiceHost(hostname3) {
21900
+ const bare = hostname3.trim().toLowerCase().replace(/^\[|\]$/g, "");
21901
+ if (bare === "localhost" || bare.endsWith(".localhost") || bare === "::1")
21902
+ return true;
21903
+ return /^127(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(bare);
21904
+ }
21905
+ function isValidVoiceBaseUrl(value) {
21906
+ const trimmed = value.trim();
21907
+ if (!trimmed)
21908
+ return false;
21909
+ try {
21910
+ const parsed = new URL(trimmed);
21911
+ if (!parsed.hostname)
21912
+ return false;
21913
+ if (parsed.username !== "" || parsed.password !== "" || parsed.hash !== "")
21914
+ return false;
21915
+ if (parsed.protocol === "https:") {
21916
+ } else if (parsed.protocol === "http:") {
21917
+ if (!isLoopbackVoiceHost(parsed.hostname))
21918
+ return false;
21919
+ } else {
21920
+ return false;
21921
+ }
21922
+ for (const key2 of parsed.searchParams.keys()) {
21923
+ if (SENSITIVE_VOICE_QUERY_PARAM.test(key2))
21924
+ return false;
21925
+ }
21926
+ return true;
21927
+ } catch {
21928
+ return false;
21929
+ }
21930
+ }
21931
+ var voiceBaseUrlSchema = external_exports.string().max(2048).refine((value) => value === "" || isValidVoiceBaseUrl(value), {
21932
+ message: "Base URL must be empty or a valid https:// URL (http:// is allowed only for localhost/127.0.0.1/[::1]) without embedded credentials"
21933
+ });
21934
+ var voiceProviderConfigSnapshotSchema = external_exports.object({
21935
+ baseUrl: voiceBaseUrlSchema,
21936
+ model: external_exports.string().max(256),
21937
+ hasApiKey: external_exports.boolean(),
21938
+ apiKeyHint: external_exports.string().max(64).optional(),
21939
+ apiKey: external_exports.never().optional()
21940
+ });
21941
+ var voiceConfigSnapshotSchema = external_exports.object({
21942
+ mode: voiceProviderModeSchema,
21943
+ baseUrl: voiceBaseUrlSchema,
21944
+ model: external_exports.string().max(256),
21945
+ hasApiKey: external_exports.boolean(),
21946
+ apiKeyHint: external_exports.string().max(64).optional(),
21947
+ apiKey: external_exports.never().optional(),
21948
+ audioFormat: voiceAudioFormatSchema.optional(),
21949
+ providers: external_exports.object({
21950
+ "openai-compatible": voiceProviderConfigSnapshotSchema,
21951
+ "deepseek-asr": voiceProviderConfigSnapshotSchema,
21952
+ "openai-chat-audio": voiceProviderConfigSnapshotSchema
21953
+ }).optional(),
21954
+ codexAvailable: external_exports.boolean(),
21955
+ available: external_exports.boolean()
21956
+ });
21957
+ var voiceConfigUpdateParamsSchema = external_exports.object({
21958
+ mode: voiceProviderModeSchema,
21959
+ baseUrl: external_exports.string().max(2048).optional(),
21960
+ model: external_exports.string().max(256).optional(),
21961
+ apiKey: external_exports.string().max(4096).nullable().optional()
21962
+ }).strict().superRefine((value, ctx) => {
21963
+ const trimmedBaseUrl = value.baseUrl?.trim() ?? "";
21964
+ const trimmedModel = value.model?.trim() ?? "";
21965
+ if (value.mode === "openai-compatible") {
21966
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
21967
+ ctx.addIssue({
21968
+ code: external_exports.ZodIssueCode.custom,
21969
+ path: ["baseUrl"],
21970
+ message: "OpenAI-compatible mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
21971
+ });
21972
+ }
21973
+ return;
21974
+ }
21975
+ if (value.mode === "openai-chat-audio") {
21976
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
21977
+ ctx.addIssue({
21978
+ code: external_exports.ZodIssueCode.custom,
21979
+ path: ["baseUrl"],
21980
+ message: "Multimodal Chat Audio mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
21981
+ });
21982
+ }
21983
+ if (!trimmedModel) {
21984
+ ctx.addIssue({
21985
+ code: external_exports.ZodIssueCode.custom,
21986
+ path: ["model"],
21987
+ message: "Multimodal Chat Audio mode requires a model name"
21988
+ });
21989
+ }
21990
+ return;
21991
+ }
21992
+ if (trimmedBaseUrl !== "" && !isValidVoiceBaseUrl(trimmedBaseUrl)) {
21993
+ ctx.addIssue({
21994
+ code: external_exports.ZodIssueCode.custom,
21995
+ path: ["baseUrl"],
21996
+ message: "Base URL must be empty or a valid https:// URL (http:// is allowed only for loopback hosts)"
21997
+ });
21998
+ }
21999
+ });
22000
+ var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
22001
+ var voiceStatusResultSchema = external_exports.object({
22002
+ available: external_exports.boolean(),
22003
+ audioFormat: voiceAudioFormatSchema.optional()
22004
+ });
22005
+ var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
22006
+ var voiceErrorCodeSchema = external_exports.enum([
22007
+ "credentials-unavailable",
22008
+ "login-expired",
22009
+ "rate-limited",
22010
+ "service-rejected",
22011
+ "host-incompatible",
22012
+ "network",
22013
+ "timeout",
22014
+ "audio-empty",
22015
+ "audio-too-large",
22016
+ "audio-format",
22017
+ "audio-invalid"
22018
+ ]);
22019
+ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
22020
+ external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
22021
+ external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
22022
+ ]);
22023
+
22024
+ // ../shared-contracts/dist/github-star.js
22025
+ var GITHUB_STAR_STATUS_METHOD = "codexhost/githubStar/status";
22026
+ var GITHUB_STAR_ADD_METHOD = "codexhost/githubStar/star";
22027
+ var githubStarParamsSchema = external_exports.object({}).strict();
22028
+ var githubStarStateSchema = external_exports.object({ ghAvailable: external_exports.boolean(), starred: external_exports.boolean() });
22029
+
21752
22030
  // ../shared-contracts/dist/client-channel.js
21753
22031
  var CLIENT_CHANNEL_VERSION = 1;
21754
22032
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -21810,9 +22088,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21810
22088
  GROUPS_REBIND_MEMBER_METHOD,
21811
22089
  GROUPS_POST_MESSAGE_METHOD,
21812
22090
  GROUPS_READ_MESSAGES_METHOD,
22091
+ GROUPS_READ_MEMORY_METHOD,
22092
+ GROUPS_UPDATE_MEMORY_METHOD,
21813
22093
  GROUPS_INSPECT_CWD_METHOD,
21814
22094
  "codexhost/voice/status",
21815
22095
  "codexhost/voice/transcribe",
22096
+ VOICE_CONFIG_GET_METHOD,
22097
+ VOICE_CONFIG_SET_METHOD,
21816
22098
  "codexhost/harness/display-settings/get",
21817
22099
  "codexhost/harness/display-settings/set",
21818
22100
  "codexhost/harness/display-settings/capabilities",
@@ -21878,6 +22160,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
21878
22160
  "codexhost/harness/session-import/list",
21879
22161
  "codexhost/harness/session-import/import",
21880
22162
  // Host settings shared across Desktop and Web.
22163
+ GITHUB_STAR_STATUS_METHOD,
22164
+ GITHUB_STAR_ADD_METHOD,
21881
22165
  ...HOST_EXTENSION_MANAGEMENT_METHODS,
21882
22166
  "codexhost/harness/installation",
21883
22167
  "codexhost/harness/installation/start",
@@ -22217,28 +22501,332 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22217
22501
  })).max(256)
22218
22502
  });
22219
22503
 
22220
- // ../shared-contracts/dist/voice.js
22221
- var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
22222
- var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
22223
- var voiceStatusResultSchema = external_exports.object({ available: external_exports.boolean() }).strict();
22224
- var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
22225
- var voiceErrorCodeSchema = external_exports.enum([
22226
- "credentials-unavailable",
22227
- "login-expired",
22228
- "rate-limited",
22229
- "service-rejected",
22230
- "host-incompatible",
22231
- "network",
22232
- "timeout",
22233
- "audio-empty",
22234
- "audio-too-large",
22235
- "audio-format",
22236
- "audio-invalid"
22237
- ]);
22238
- var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
22239
- external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
22240
- external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
22241
- ]);
22504
+ // ../shared-contracts/dist/host-extension-ranking.js
22505
+ var HOST_EXTENSION_MARKETPLACE_SORT_MODES = [
22506
+ "recommended",
22507
+ "downloads",
22508
+ "newest",
22509
+ "updated"
22510
+ ];
22511
+ var HOST_EXTENSION_FEATURED_LIMIT = 3;
22512
+ var DAY_MS = 24 * 60 * 60 * 1e3;
22513
+ var NEW_BOOST_WINDOW_DAYS = 10;
22514
+ var NEW_BOOST_MAX = 0.5;
22515
+ var UPDATE_BOOST_WINDOW_DAYS = 14;
22516
+ var UPDATE_BOOST_MAX = 0.15;
22517
+ var FALLBACK_VELOCITY_DEFAULT_AGE_DAYS = 30;
22518
+ var TOP_DIVERSITY_WINDOW = 6;
22519
+ var TOP_DIVERSITY_MAX_PER_GROUP = 2;
22520
+ var CATEGORY_SEARCH_LABELS = Object.freeze({
22521
+ appearance: ["appearance", "\u5916\u89C2\u4E3B\u9898"],
22522
+ interface: ["interface", "\u754C\u9762\u589E\u5F3A"],
22523
+ workflow: ["workflow", "\u6548\u7387\u4E0E\u534F\u4F5C"],
22524
+ analytics: ["analytics", "\u6570\u636E\u4E0E\u7EDF\u8BA1"],
22525
+ integrations: ["integrations", "\u5916\u90E8\u96C6\u6210"],
22526
+ tools: ["tools", "\u5B9E\u7528\u5DE5\u5177"]
22527
+ });
22528
+ function parseTimestampMs(raw) {
22529
+ if (!raw)
22530
+ return null;
22531
+ const parsed = Date.parse(raw);
22532
+ return Number.isFinite(parsed) ? parsed : null;
22533
+ }
22534
+ function daysSince(raw, nowMs) {
22535
+ const timestamp2 = parseTimestampMs(raw);
22536
+ if (timestamp2 === null)
22537
+ return null;
22538
+ return Math.max(0, (nowMs - timestamp2) / DAY_MS);
22539
+ }
22540
+ function isHostExtensionCompatibleWithHost(entry, host) {
22541
+ if (!entry.targets.includes(host))
22542
+ return false;
22543
+ if (entry.categories?.includes("appearance")) {
22544
+ if (host === "desktop" && Boolean(entry.apis.web) && !entry.apis.desktop) {
22545
+ return false;
22546
+ }
22547
+ if (host === "web" && Boolean(entry.apis.desktop) && !entry.apis.web) {
22548
+ return false;
22549
+ }
22550
+ }
22551
+ return true;
22552
+ }
22553
+ function scoreHostExtensionForRecommended(entry, nowMs = Date.now()) {
22554
+ const downloads = Math.max(0, entry.downloads ?? 0);
22555
+ const stars = Math.max(0, entry.stars ?? 0);
22556
+ const publishedAgeDays = daysSince(entry.publishedAt, nowMs);
22557
+ const updatedAgeDays = daysSince(entry.updatedAt, nowMs);
22558
+ let trendTerm;
22559
+ if (typeof entry.downloads7d === "number" && Number.isFinite(entry.downloads7d) && entry.downloads7d >= 0) {
22560
+ trendTerm = 0.55 * Math.log10(entry.downloads7d + 1);
22561
+ } else {
22562
+ const effectiveAge = publishedAgeDays ?? FALLBACK_VELOCITY_DEFAULT_AGE_DAYS;
22563
+ const velocity = downloads / Math.pow(effectiveAge + 3, 0.75);
22564
+ trendTerm = 0.5 * Math.log10(velocity + 1);
22565
+ }
22566
+ const historyTerm = 0.25 * Math.log10(downloads + 1);
22567
+ const starsTerm = 0.2 * Math.log10(stars + 1);
22568
+ const hasIcon = Boolean(entry.icon);
22569
+ const hasScreenshots = (entry.screenshots?.length ?? 0) > 0;
22570
+ const newBoost = hasIcon && hasScreenshots && publishedAgeDays !== null && publishedAgeDays < NEW_BOOST_WINDOW_DAYS ? NEW_BOOST_MAX * Math.max(0, 1 - publishedAgeDays / NEW_BOOST_WINDOW_DAYS) : 0;
22571
+ const updBoost = updatedAgeDays !== null && updatedAgeDays < UPDATE_BOOST_WINDOW_DAYS ? UPDATE_BOOST_MAX * Math.max(0, 1 - updatedAgeDays / UPDATE_BOOST_WINDOW_DAYS) : 0;
22572
+ const qualityScore = (hasIcon ? 0.15 : 0) + (hasScreenshots ? 0.15 : 0);
22573
+ const score = trendTerm + historyTerm + starsTerm + newBoost + updBoost + qualityScore;
22574
+ return Number.isFinite(score) ? score : 0;
22575
+ }
22576
+ function scoreHostExtensionSearchRelevance(entry, rawQuery) {
22577
+ const query = rawQuery.trim().toLowerCase();
22578
+ if (!query)
22579
+ return 0;
22580
+ const tokens = query.split(/\s+/u).filter(Boolean);
22581
+ if (tokens.length === 0)
22582
+ return 0;
22583
+ const idText = entry.id.toLowerCase();
22584
+ const nameEn = entry.name.en.toLowerCase();
22585
+ const nameZh = entry.name["zh-CN"].toLowerCase();
22586
+ const titleFields = [idText, nameEn, nameZh];
22587
+ const titleJoined = titleFields.join("\n");
22588
+ const authorText = entry.author.toLowerCase();
22589
+ const categoryTerms = [];
22590
+ for (const cat of entry.categories ?? []) {
22591
+ categoryTerms.push(...CATEGORY_SEARCH_LABELS[cat]);
22592
+ }
22593
+ const metaJoined = [authorText, ...categoryTerms].join("\n");
22594
+ const descJoined = `${entry.description.en}
22595
+ ${entry.description["zh-CN"]}`.toLowerCase();
22596
+ const detailsJoined = entry.details ? `${entry.details.en}
22597
+ ${entry.details["zh-CN"]}`.toLowerCase() : "";
22598
+ const fullHaystack = `${titleJoined}
22599
+ ${metaJoined}
22600
+ ${descJoined}
22601
+ ${detailsJoined}`;
22602
+ if (!tokens.every((token) => fullHaystack.includes(token)))
22603
+ return 0;
22604
+ if (titleFields.some((field2) => field2 === query))
22605
+ return 1e3;
22606
+ if (titleFields.some((field2) => field2.startsWith(query)))
22607
+ return 750;
22608
+ let score = 0;
22609
+ if (titleFields.some((field2) => field2.includes(query))) {
22610
+ score = 500;
22611
+ } else if (tokens.every((token) => titleJoined.includes(token))) {
22612
+ score = 450;
22613
+ } else if (tokens.every((token) => `${titleJoined}
22614
+ ${metaJoined}`.includes(token))) {
22615
+ score = 260;
22616
+ } else if (tokens.every((token) => `${titleJoined}
22617
+ ${metaJoined}
22618
+ ${descJoined}`.includes(token))) {
22619
+ score = 130;
22620
+ } else {
22621
+ score = 40;
22622
+ }
22623
+ for (const token of tokens) {
22624
+ if (titleFields.some((field2) => field2 === token || field2.startsWith(token)))
22625
+ score += 30;
22626
+ else if (titleJoined.includes(token))
22627
+ score += 20;
22628
+ else if (metaJoined.includes(token))
22629
+ score += 10;
22630
+ else if (descJoined.includes(token))
22631
+ score += 4;
22632
+ }
22633
+ return score;
22634
+ }
22635
+ function compareByRecommendedScore(left, right, scores) {
22636
+ const leftScore = scores.get(left.id) ?? 0;
22637
+ const rightScore = scores.get(right.id) ?? 0;
22638
+ if (rightScore !== leftScore)
22639
+ return rightScore - leftScore;
22640
+ const downloadsDelta = (right.downloads ?? 0) - (left.downloads ?? 0);
22641
+ if (downloadsDelta !== 0)
22642
+ return downloadsDelta;
22643
+ const starsDelta = (right.stars ?? 0) - (left.stars ?? 0);
22644
+ if (starsDelta !== 0)
22645
+ return starsDelta;
22646
+ return left.id.localeCompare(right.id, "en");
22647
+ }
22648
+ function uniqueEntrySlots(entry) {
22649
+ const slots = entry.slots;
22650
+ if (!slots || slots.length <= 1)
22651
+ return slots ?? [];
22652
+ return [...new Set(slots)];
22653
+ }
22654
+ function recordDiversityCounts(entry, authorCounts, slotCounts) {
22655
+ const authorKey = entry.author.trim().toLowerCase();
22656
+ if (authorKey !== "") {
22657
+ authorCounts.set(authorKey, (authorCounts.get(authorKey) ?? 0) + 1);
22658
+ }
22659
+ for (const slot2 of uniqueEntrySlots(entry)) {
22660
+ slotCounts.set(slot2, (slotCounts.get(slot2) ?? 0) + 1);
22661
+ }
22662
+ }
22663
+ function computeDiversityViolation(entry, authorCounts, slotCounts, maxPerGroup) {
22664
+ const authorKey = entry.author.trim().toLowerCase();
22665
+ const authorNext = authorKey !== "" ? (authorCounts.get(authorKey) ?? 0) + 1 : 0;
22666
+ let totalExcess = authorNext > maxPerGroup ? authorNext - maxPerGroup : 0;
22667
+ let maxCount = authorNext;
22668
+ for (const slot2 of uniqueEntrySlots(entry)) {
22669
+ const slotNext = (slotCounts.get(slot2) ?? 0) + 1;
22670
+ if (slotNext > maxPerGroup) {
22671
+ totalExcess += slotNext - maxPerGroup;
22672
+ }
22673
+ if (slotNext > maxCount) {
22674
+ maxCount = slotNext;
22675
+ }
22676
+ }
22677
+ return { totalExcess, maxCount };
22678
+ }
22679
+ function applyTopWindowDiversity(entries, windowSize = TOP_DIVERSITY_WINDOW, maxPerGroup = TOP_DIVERSITY_MAX_PER_GROUP) {
22680
+ if (windowSize <= 0 || entries.length <= maxPerGroup)
22681
+ return [...entries];
22682
+ const topWindow = [];
22683
+ const deferred = [];
22684
+ const authorCounts = /* @__PURE__ */ new Map();
22685
+ const slotCounts = /* @__PURE__ */ new Map();
22686
+ let index = 0;
22687
+ for (; index < entries.length && topWindow.length < windowSize; index += 1) {
22688
+ const entry = entries[index];
22689
+ const { totalExcess } = computeDiversityViolation(entry, authorCounts, slotCounts, maxPerGroup);
22690
+ if (totalExcess > 0) {
22691
+ deferred.push(entry);
22692
+ continue;
22693
+ }
22694
+ topWindow.push(entry);
22695
+ recordDiversityCounts(entry, authorCounts, slotCounts);
22696
+ }
22697
+ while (topWindow.length < windowSize && deferred.length > 0) {
22698
+ let bestIndex = 0;
22699
+ let bestCost = computeDiversityViolation(deferred[0], authorCounts, slotCounts, maxPerGroup);
22700
+ for (let i = 1; i < deferred.length; i += 1) {
22701
+ const candidateCost = computeDiversityViolation(deferred[i], authorCounts, slotCounts, maxPerGroup);
22702
+ if (candidateCost.totalExcess < bestCost.totalExcess || candidateCost.totalExcess === bestCost.totalExcess && candidateCost.maxCount < bestCost.maxCount) {
22703
+ bestIndex = i;
22704
+ bestCost = candidateCost;
22705
+ }
22706
+ }
22707
+ const [picked] = deferred.splice(bestIndex, 1);
22708
+ topWindow.push(picked);
22709
+ recordDiversityCounts(picked, authorCounts, slotCounts);
22710
+ }
22711
+ return [...topWindow, ...deferred, ...entries.slice(index)];
22712
+ }
22713
+ function selectFeaturedHostExtensions(entries, options = {}) {
22714
+ if (entries.length === 0)
22715
+ return [];
22716
+ const fallbackLimit = Math.max(0, Math.floor(options.limit ?? HOST_EXTENSION_FEATURED_LIMIT));
22717
+ const nowMs = options.nowMs ?? Date.now();
22718
+ const host = options.host;
22719
+ const compatible = host ? entries.filter((entry) => isHostExtensionCompatibleWithHost(entry, host)) : [...entries];
22720
+ if (compatible.length === 0)
22721
+ return [];
22722
+ const scores = /* @__PURE__ */ new Map();
22723
+ for (const entry of compatible) {
22724
+ scores.set(entry.id, scoreHostExtensionForRecommended(entry, nowMs));
22725
+ }
22726
+ const hasExplicitFeaturedInCatalog = entries.some((entry) => entry.featured === true);
22727
+ if (hasExplicitFeaturedInCatalog) {
22728
+ return compatible.filter((entry) => entry.featured === true).sort((left, right) => {
22729
+ const leftOrder = left.featuredOrder ?? Number.POSITIVE_INFINITY;
22730
+ const rightOrder = right.featuredOrder ?? Number.POSITIVE_INFINITY;
22731
+ if (leftOrder !== rightOrder)
22732
+ return leftOrder - rightOrder;
22733
+ return compareByRecommendedScore(left, right, scores);
22734
+ });
22735
+ }
22736
+ if (fallbackLimit === 0)
22737
+ return [];
22738
+ return [...compatible].sort((left, right) => {
22739
+ const officialDelta = Number(right.trustTier === "official") - Number(left.trustTier === "official");
22740
+ if (officialDelta !== 0)
22741
+ return officialDelta;
22742
+ return compareByRecommendedScore(left, right, scores);
22743
+ }).slice(0, fallbackLimit);
22744
+ }
22745
+ function rankHostExtensionCatalogEntries(entries, options = {}) {
22746
+ if (entries.length <= 1)
22747
+ return [...entries];
22748
+ const nowMs = options.nowMs ?? Date.now();
22749
+ const host = options.host;
22750
+ const sortMode = options.sortMode ?? "recommended";
22751
+ const normalizedQuery = options.query?.trim().toLowerCase() ?? "";
22752
+ const scores = /* @__PURE__ */ new Map();
22753
+ const relevance = /* @__PURE__ */ new Map();
22754
+ for (const entry of entries) {
22755
+ scores.set(entry.id, scoreHostExtensionForRecommended(entry, nowMs));
22756
+ if (normalizedQuery) {
22757
+ relevance.set(entry.id, scoreHostExtensionSearchRelevance(entry, normalizedQuery));
22758
+ }
22759
+ }
22760
+ const compareCore = (left, right) => {
22761
+ if (normalizedQuery) {
22762
+ const relDelta = (relevance.get(right.id) ?? 0) - (relevance.get(left.id) ?? 0);
22763
+ if (relDelta !== 0)
22764
+ return relDelta;
22765
+ return compareByRecommendedScore(left, right, scores);
22766
+ }
22767
+ switch (sortMode) {
22768
+ case "downloads": {
22769
+ const downloadsDelta = (right.downloads ?? 0) - (left.downloads ?? 0);
22770
+ if (downloadsDelta !== 0)
22771
+ return downloadsDelta;
22772
+ const downloads7dDelta = (right.downloads7d ?? 0) - (left.downloads7d ?? 0);
22773
+ if (downloads7dDelta !== 0)
22774
+ return downloads7dDelta;
22775
+ const starsDelta = (right.stars ?? 0) - (left.stars ?? 0);
22776
+ if (starsDelta !== 0)
22777
+ return starsDelta;
22778
+ return left.id.localeCompare(right.id, "en");
22779
+ }
22780
+ case "newest": {
22781
+ const leftPublished = parseTimestampMs(left.publishedAt) ?? -1;
22782
+ const rightPublished = parseTimestampMs(right.publishedAt) ?? -1;
22783
+ if (rightPublished !== leftPublished)
22784
+ return rightPublished - leftPublished;
22785
+ const leftUpdated = parseTimestampMs(left.updatedAt) ?? -1;
22786
+ const rightUpdated = parseTimestampMs(right.updatedAt) ?? -1;
22787
+ if (rightUpdated !== leftUpdated)
22788
+ return rightUpdated - leftUpdated;
22789
+ const downloadsDelta = (right.downloads ?? 0) - (left.downloads ?? 0);
22790
+ if (downloadsDelta !== 0)
22791
+ return downloadsDelta;
22792
+ return left.id.localeCompare(right.id, "en");
22793
+ }
22794
+ case "updated": {
22795
+ const leftUpdated = parseTimestampMs(left.updatedAt ?? left.publishedAt) ?? -1;
22796
+ const rightUpdated = parseTimestampMs(right.updatedAt ?? right.publishedAt) ?? -1;
22797
+ if (rightUpdated !== leftUpdated)
22798
+ return rightUpdated - leftUpdated;
22799
+ const downloadsDelta = (right.downloads ?? 0) - (left.downloads ?? 0);
22800
+ if (downloadsDelta !== 0)
22801
+ return downloadsDelta;
22802
+ return left.id.localeCompare(right.id, "en");
22803
+ }
22804
+ case "recommended":
22805
+ default:
22806
+ return compareByRecommendedScore(left, right, scores);
22807
+ }
22808
+ };
22809
+ if (!host) {
22810
+ const sorted = [...entries].sort(compareCore);
22811
+ if (options.applyDiversity && !normalizedQuery && sortMode === "recommended") {
22812
+ return applyTopWindowDiversity(sorted);
22813
+ }
22814
+ return sorted;
22815
+ }
22816
+ const compatible = [];
22817
+ const incompatible = [];
22818
+ for (const entry of entries) {
22819
+ if (isHostExtensionCompatibleWithHost(entry, host)) {
22820
+ compatible.push(entry);
22821
+ } else {
22822
+ incompatible.push(entry);
22823
+ }
22824
+ }
22825
+ compatible.sort(compareCore);
22826
+ incompatible.sort(compareCore);
22827
+ const orderedCompatible = options.applyDiversity && !normalizedQuery && sortMode === "recommended" ? applyTopWindowDiversity(compatible) : compatible;
22828
+ return [...orderedCompatible, ...incompatible];
22829
+ }
22242
22830
 
22243
22831
  // ../shared-contracts/dist/skills.js
22244
22832
  var SKILLS_LIST_METHOD = "codexhost/skills/list";
@@ -22550,7 +23138,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22550
23138
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
22551
23139
  delegation: external_exports.literal(1).optional(),
22552
23140
  /** POST /api/peer/v1/peers is available. */
22553
- peerPairing: external_exports.literal(1).optional()
23141
+ peerPairing: external_exports.literal(1).optional(),
23142
+ /** Host supports includeOperations on extensions/list and expectedVersion on extensions/update. */
23143
+ extensionUpdateTracking: external_exports.literal(1).optional(),
23144
+ /** Peer supports per-member `showInSidebar` in `codexhost/groups/member/update`. */
23145
+ groupMemberSidebarVisibility: external_exports.literal(1).optional(),
23146
+ /** Peer supports `codexhost/groups/memory/read` and `codexhost/groups/memory/update`. */
23147
+ groupSharedMemory: external_exports.literal(1).optional()
22554
23148
  });
22555
23149
  var remotePeerManifestSchema = external_exports.object({
22556
23150
  version: external_exports.string().max(128),
@@ -24148,6 +24742,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24148
24742
  return createSVGElement([tag, attrs, iconNode]);
24149
24743
  };
24150
24744
 
24745
+ // ../../node_modules/lucide/dist/esm/icons/arrow-up-down.mjs
24746
+ var ArrowUpDown = [
24747
+ ["path", { d: "m21 16-4 4-4-4" }],
24748
+ ["path", { d: "M17 20V4" }],
24749
+ ["path", { d: "m3 8 4-4 4 4" }],
24750
+ ["path", { d: "M7 4v16" }]
24751
+ ];
24752
+
24151
24753
  // ../../node_modules/lucide/dist/esm/icons/smartphone.mjs
24152
24754
  var Smartphone = [
24153
24755
  ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }],
@@ -24668,6 +25270,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24668
25270
  ["polyline", { points: "17 11 12 6 7 11" }],
24669
25271
  ["line", { x1: "12", y1: "6", x2: "12", y2: "18" }]
24670
25272
  ],
25273
+ "arrow-up-down": ArrowUpDown,
24671
25274
  check: CircleCheck,
24672
25275
  "check-mark": Check,
24673
25276
  diagnose: Stethoscope,
@@ -28400,9 +29003,19 @@ th[aria-sort] .console-usage-sort__mark {
28400
29003
  },
28401
29004
  async listHostExtensions() {
28402
29005
  const schema = hostExtensionsRpcSchemas[HOST_EXTENSIONS_RPC.list];
28403
- return schema.result.parse(
28404
- await manager.sendRequest(HOST_EXTENSIONS_RPC.list, schema.params.parse({}))
28405
- );
29006
+ try {
29007
+ return schema.result.parse(
29008
+ await manager.sendRequest(
29009
+ HOST_EXTENSIONS_RPC.list,
29010
+ schema.params.parse({ includeOperations: true })
29011
+ )
29012
+ );
29013
+ } catch (error62) {
29014
+ if (!isInvalidParams(error62)) throw error62;
29015
+ return schema.result.parse(
29016
+ await manager.sendRequest(HOST_EXTENSIONS_RPC.list, schema.params.parse({}))
29017
+ );
29018
+ }
28406
29019
  },
28407
29020
  async snapshotHostExtensions() {
28408
29021
  const schema = hostExtensionsRpcSchemas[HOST_EXTENSIONS_RPC.snapshot];
@@ -28447,11 +29060,18 @@ th[aria-sort] .console-usage-sort__mark {
28447
29060
  },
28448
29061
  async updateHostExtension(input3) {
28449
29062
  const schema = hostExtensionsRpcSchemas[HOST_EXTENSIONS_RPC.update];
28450
- return extensionsChanged(
28451
- schema.result.parse(
28452
- await manager.sendRequest(HOST_EXTENSIONS_RPC.update, schema.params.parse(input3))
28453
- )
28454
- );
29063
+ const parsed = schema.params.parse(input3);
29064
+ try {
29065
+ return extensionsChanged(
29066
+ schema.result.parse(await manager.sendRequest(HOST_EXTENSIONS_RPC.update, parsed))
29067
+ );
29068
+ } catch (error62) {
29069
+ if (parsed.expectedVersion === void 0 || !isInvalidParams(error62)) throw error62;
29070
+ const { expectedVersion: _omitted, ...legacyParams } = parsed;
29071
+ return extensionsChanged(
29072
+ schema.result.parse(await manager.sendRequest(HOST_EXTENSIONS_RPC.update, legacyParams))
29073
+ );
29074
+ }
28455
29075
  },
28456
29076
  async enableHostExtension(input3) {
28457
29077
  const schema = hostExtensionsRpcSchemas[HOST_EXTENSIONS_RPC.enable];
@@ -28532,6 +29152,12 @@ th[aria-sort] .console-usage-sort__mark {
28532
29152
  );
28533
29153
  return updateStatusResultSchema.parse(result);
28534
29154
  },
29155
+ async getGitHubStarStatus() {
29156
+ return githubStarStateSchema.parse(await manager.sendRequest(GITHUB_STAR_STATUS_METHOD, {}));
29157
+ },
29158
+ async starGitHubRepository() {
29159
+ return githubStarStateSchema.parse(await manager.sendRequest(GITHUB_STAR_ADD_METHOD, {}));
29160
+ },
28535
29161
  async getMacOsSigningStatus() {
28536
29162
  const result = await manager.sendRequest(
28537
29163
  MACOS_SIGNING_STATUS_METHOD2,
@@ -28676,6 +29302,8 @@ th[aria-sort] .console-usage-sort__mark {
28676
29302
  GROUPS_REMOVE_MEMBER_METHOD,
28677
29303
  GROUPS_POST_MESSAGE_METHOD,
28678
29304
  GROUPS_READ_MESSAGES_METHOD,
29305
+ GROUPS_READ_MEMORY_METHOD,
29306
+ GROUPS_UPDATE_MEMORY_METHOD,
28679
29307
  GROUPS_INSPECT_CWD_METHOD,
28680
29308
  ROLES_LIST_METHOD,
28681
29309
  ROLES_GET_METHOD,
@@ -31143,6 +31771,11 @@ th[aria-sort] .console-usage-sort__mark {
31143
31771
  filterWeb: "CH Web",
31144
31772
  filterDesktop: "Codex Desktop",
31145
31773
  filterBackend: "Backend",
31774
+ sortLabel: "Sort plugins",
31775
+ sortRecommended: "Recommended",
31776
+ sortDownloads: "Most installed",
31777
+ sortNewest: "Newest",
31778
+ sortUpdated: "Recently updated",
31146
31779
  platformLabel: "Supported platforms",
31147
31780
  platformBoth: "Codex Desktop & CH Web",
31148
31781
  platformDesktopOnly: "Codex Desktop Only",
@@ -31184,7 +31817,15 @@ th[aria-sort] .console-usage-sort__mark {
31184
31817
  installing: "Installing\u2026",
31185
31818
  update: "Update",
31186
31819
  updating: "Updating\u2026",
31820
+ retryUpdate: "Retry update",
31187
31821
  updateToVersion: "Update to v{version}",
31822
+ updateFailedNotice: "Last update failed: {message}",
31823
+ updateInterruptedNotice: "Previous update was interrupted when the app closed. Click Retry update to try again.",
31824
+ errorDownloadTimeout: "Download timed out. Check your network and try again.",
31825
+ errorDownloadUnavailable: "The download server is temporarily unavailable. Please try again later.",
31826
+ errorVersionNotReady: "The new version is still syncing to the registry. Please try again shortly.",
31827
+ errorCatalogUnavailable: "The plugin catalog is temporarily unavailable. Check your network and try again.",
31828
+ errorChecksumMismatch: "The downloaded package failed integrity verification. Please try again.",
31188
31829
  installedBadge: "Installed",
31189
31830
  installedDisabledBadge: "Installed \xB7 Off",
31190
31831
  uninstall: "Uninstall",
@@ -31375,6 +32016,11 @@ th[aria-sort] .console-usage-sort__mark {
31375
32016
  filterWeb: "CH Web",
31376
32017
  filterDesktop: "Codex Desktop",
31377
32018
  filterBackend: "\u540E\u53F0",
32019
+ sortLabel: "\u6392\u5E8F\u65B9\u5F0F",
32020
+ sortRecommended: "\u63A8\u8350",
32021
+ sortDownloads: "\u6700\u591A\u5B89\u88C5",
32022
+ sortNewest: "\u6700\u65B0\u4E0A\u67B6",
32023
+ sortUpdated: "\u6700\u8FD1\u66F4\u65B0",
31378
32024
  platformLabel: "\u9002\u7528\u5E73\u53F0",
31379
32025
  platformBoth: "Codex Desktop \xB7 CH Web",
31380
32026
  platformDesktopOnly: "\u4EC5 Codex Desktop",
@@ -31416,7 +32062,15 @@ th[aria-sort] .console-usage-sort__mark {
31416
32062
  installing: "\u5B89\u88C5\u4E2D\u2026",
31417
32063
  update: "\u66F4\u65B0",
31418
32064
  updating: "\u66F4\u65B0\u4E2D\u2026",
32065
+ retryUpdate: "\u91CD\u8BD5\u66F4\u65B0",
31419
32066
  updateToVersion: "\u66F4\u65B0\u5230 v{version}",
32067
+ updateFailedNotice: "\u4E0A\u6B21\u66F4\u65B0\u5931\u8D25\uFF1A{message}",
32068
+ updateInterruptedNotice: "\u4E0A\u6B21\u66F4\u65B0\u56E0\u5E94\u7528\u9000\u51FA\u800C\u4E2D\u65AD\uFF0C\u8BF7\u70B9\u51FB\u300C\u91CD\u8BD5\u66F4\u65B0\u300D\u518D\u6B21\u5C1D\u8BD5\u3002",
32069
+ errorDownloadTimeout: "\u4E0B\u8F7D\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",
32070
+ errorDownloadUnavailable: "\u4E0B\u8F7D\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
32071
+ errorVersionNotReady: "\u65B0\u7248\u672C\u5C1A\u672A\u540C\u6B65\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
32072
+ errorCatalogUnavailable: "\u63D2\u4EF6\u76EE\u5F55\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",
32073
+ errorChecksumMismatch: "\u5B89\u88C5\u5305\u5B8C\u6574\u6027\u6821\u9A8C\u672A\u901A\u8FC7\uFF0C\u8BF7\u91CD\u8BD5\u3002",
31420
32074
  installedBadge: "\u5DF2\u5B89\u88C5",
31421
32075
  installedDisabledBadge: "\u5DF2\u5B89\u88C5 \xB7 \u672A\u542F\u7528",
31422
32076
  uninstall: "\u5378\u8F7D",
@@ -31873,8 +32527,10 @@ th[aria-sort] .console-usage-sort__mark {
31873
32527
  acknowledge: "Got it",
31874
32528
  fullNotes: "View full release notes"
31875
32529
  }),
31876
- updateStarCallout: "If CodexHost has helped you, please Star it on GitHub. It means a lot to us \u{1F449}",
31877
- updateStarLink: "GitHub",
32530
+ updateStarCallout: "If CodexHost has helped you, give it a star on GitHub.",
32531
+ githubStar: "Star",
32532
+ githubStarred: "Starred",
32533
+ githubStarring: "Starring\u2026",
31878
32534
  macosSigningTitle: "Keep macOS permissions after updates",
31879
32535
  macosSigningDescription: "Avoid re-granting notification or microphone permissions on updates (verified once on this Mac).",
31880
32536
  macosSigningStatusEnabled: "On",
@@ -32221,8 +32877,10 @@ th[aria-sort] .console-usage-sort__mark {
32221
32877
  acknowledge: "\u6211\u77E5\u9053\u4E86",
32222
32878
  fullNotes: "\u67E5\u770B\u5B8C\u6574\u66F4\u65B0\u8BF4\u660E"
32223
32879
  }),
32224
- updateStarCallout: "\u5982\u679C CodexHost \u5E2E\u5230\u4E86\u4F60\uFF0C\u8BF7\u5728 GitHub \u70B9\u4E2A Star\uFF0C\u8FD9\u5BF9\u6211\u4EEC\u610F\u4E49\u91CD\u5927 \u{1F449}",
32225
- updateStarLink: "GitHub",
32880
+ updateStarCallout: "\u5982\u679C CodexHost \u5E2E\u5230\u4E86\u4F60\uFF0C\u8BF7\u5728 GitHub \u70B9\u4E2A Star\u3002",
32881
+ githubStar: "Star",
32882
+ githubStarred: "\u5DF2 Star",
32883
+ githubStarring: "\u6B63\u5728 Star\u2026",
32226
32884
  macosSigningTitle: "\u66F4\u65B0\u540E\u4FDD\u7559\u7CFB\u7EDF\u6743\u9650",
32227
32885
  macosSigningDescription: "\u907F\u514D\u6BCF\u6B21\u66F4\u65B0\u540E\u91CD\u65B0\u6388\u4E88\u901A\u77E5\u3001\u9EA6\u514B\u98CE\u7B49\u6743\u9650\uFF08\u4EC5\u9700\u672C\u673A\u9A8C\u8BC1\u4E00\u6B21\uFF09\u3002",
32228
32886
  macosSigningStatusEnabled: "\u5DF2\u5F00\u542F",
@@ -40218,6 +40876,7 @@ ${error62.stderrTail}`] : []
40218
40876
  "desktop",
40219
40877
  "backend"
40220
40878
  ];
40879
+ var SORT_MODE_ORDER = HOST_EXTENSION_MARKETPLACE_SORT_MODES;
40221
40880
  var SAFE_SCREENSHOT_DATA_URL_PATTERN = /^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u;
40222
40881
  var SAFE_ICON_DATA_URL_PATTERN = /^data:image\/(?:png|jpeg|webp|gif|avif);base64,[A-Za-z0-9+/]+={0,2}$/u;
40223
40882
  var EXTENSION_CATEGORY_ICON_MAP = Object.freeze({
@@ -40298,6 +40957,18 @@ ${error62.stderrTail}`] : []
40298
40957
  return copy.filterBackend;
40299
40958
  }
40300
40959
  }
40960
+ function sortModeLabel(mode, copy) {
40961
+ switch (mode) {
40962
+ case "recommended":
40963
+ return copy.sortRecommended;
40964
+ case "downloads":
40965
+ return copy.sortDownloads;
40966
+ case "newest":
40967
+ return copy.sortNewest;
40968
+ case "updated":
40969
+ return copy.sortUpdated;
40970
+ }
40971
+ }
40301
40972
  function resolveExtensionIconCategory(categories) {
40302
40973
  const primary = categories?.[0];
40303
40974
  if (primary && Object.hasOwn(EXTENSION_CATEGORY_ICON_MAP, primary)) {
@@ -40385,32 +41056,8 @@ ${error62.stderrTail}`] : []
40385
41056
  }
40386
41057
  return container;
40387
41058
  }
40388
- function compareCatalogEntriesByRank(left, right) {
40389
- const officialDelta = Number(right.trustTier === "official") - Number(left.trustTier === "official");
40390
- if (officialDelta !== 0) return officialDelta;
40391
- const downloadsDelta = (right.downloads ?? 0) - (left.downloads ?? 0);
40392
- if (downloadsDelta !== 0) return downloadsDelta;
40393
- const iconDelta = Number(Boolean(right.icon)) - Number(Boolean(left.icon));
40394
- if (iconDelta !== 0) return iconDelta;
40395
- const crossPlatformDelta = Number(right.targets.includes("web") && right.targets.includes("desktop")) - Number(left.targets.includes("web") && left.targets.includes("desktop"));
40396
- if (crossPlatformDelta !== 0) return crossPlatformDelta;
40397
- const starsDelta = (right.stars ?? 0) - (left.stars ?? 0);
40398
- if (starsDelta !== 0) return starsDelta;
40399
- return left.id.localeCompare(right.id, "en");
40400
- }
40401
- var MAX_EXPLICIT_FEATURED_ENTRIES = 12;
40402
- function selectFeaturedCatalogEntries(entries, limit = 3) {
40403
- const explicit = entries.filter((entry) => entry.featured === true);
40404
- if (explicit.length > 0) {
40405
- return [...explicit].sort((left, right) => {
40406
- const leftOrder = left.featuredOrder ?? Number.POSITIVE_INFINITY;
40407
- const rightOrder = right.featuredOrder ?? Number.POSITIVE_INFINITY;
40408
- if (leftOrder !== rightOrder) return leftOrder - rightOrder;
40409
- return compareCatalogEntriesByRank(left, right);
40410
- }).slice(0, MAX_EXPLICIT_FEATURED_ENTRIES);
40411
- }
40412
- if (entries.length <= limit) return [...entries].sort(compareCatalogEntriesByRank);
40413
- return [...entries].sort(compareCatalogEntriesByRank).slice(0, limit);
41059
+ function selectFeaturedCatalogEntries(entries, limit = HOST_EXTENSION_FEATURED_LIMIT) {
41060
+ return selectFeaturedHostExtensions(entries, { host: "desktop", limit });
40414
41061
  }
40415
41062
  function formatMessage(template, values) {
40416
41063
  return template.replace(/\{([a-zA-Z0-9_]+)\}/gu, (match, key2) => values[key2] ?? match);
@@ -40440,11 +41087,37 @@ ${error62.stderrTail}`] : []
40440
41087
  if (item.state !== "valid") {
40441
41088
  return item.state === "incompatible" ? "incompatible" : "invalid";
40442
41089
  }
40443
- if (item.backendState === "failed") return "failed";
41090
+ if (item.backendState === "failed" || item.operation?.state === "failed") return "failed";
40444
41091
  if (item.desktopConflictWith) return "conflict";
40445
41092
  if (item.enabled && item.backendState === "starting") return "waiting";
40446
41093
  return item.enabled ? "running" : "disabled";
40447
41094
  }
41095
+ function localizeHostExtensionErrorMessage(message2, copy) {
41096
+ if (message2 === "Download timed out") {
41097
+ return copy.errorDownloadTimeout;
41098
+ }
41099
+ if (/^Download returned HTTP \d+$/u.test(message2) || message2 === "Download aborted") {
41100
+ return copy.errorDownloadUnavailable;
41101
+ }
41102
+ if (message2 === "Requested extension version is not yet available from the registry; please try again") {
41103
+ return copy.errorVersionNotReady;
41104
+ }
41105
+ if (message2 === "Host extension catalog unavailable") {
41106
+ return copy.errorCatalogUnavailable;
41107
+ }
41108
+ if (message2 === "Extension ZIP SHA-256 mismatch") {
41109
+ return copy.errorChecksumMismatch;
41110
+ }
41111
+ return message2;
41112
+ }
41113
+ function formatHostExtensionOperationError(operation, copy) {
41114
+ if (operation.interruptedByShutdown) {
41115
+ return copy.updateInterruptedNotice;
41116
+ }
41117
+ return formatMessage(copy.updateFailedNotice, {
41118
+ message: localizeHostExtensionErrorMessage(operation.error, copy)
41119
+ });
41120
+ }
40448
41121
  function needsAttention(state) {
40449
41122
  return state === "failed" || state === "conflict" || state === "invalid" || state === "incompatible";
40450
41123
  }
@@ -40555,6 +41228,12 @@ ${error62.stderrTail}`] : []
40555
41228
  text: item.backendError || copy.backendFailedNotice
40556
41229
  };
40557
41230
  }
41231
+ if (item.operation?.state === "failed") {
41232
+ return {
41233
+ tone: "danger",
41234
+ text: formatHostExtensionOperationError(item.operation, copy)
41235
+ };
41236
+ }
40558
41237
  if (item.desktopConflictWith) {
40559
41238
  const other = describeOtherExtension(item.desktopConflictWith, allExtensions, locale);
40560
41239
  const shared = overlappingSlots(item, item.desktopConflictWith, allExtensions);
@@ -43705,6 +44384,9 @@ ${error62.stderrTail}`] : []
43705
44384
  installedById,
43706
44385
  isDefaultHome = false,
43707
44386
  selectedCategory = null,
44387
+ sortMode = "recommended",
44388
+ searchQuery = "",
44389
+ applyDiversity = false,
43708
44390
  catalogIconLoader,
43709
44391
  canInstall,
43710
44392
  pendingMutations,
@@ -43720,7 +44402,10 @@ ${error62.stderrTail}`] : []
43720
44402
  const installed = installedById.get(entry.id);
43721
44403
  const updateAvailable = hasCatalogUpdate(installed, entry);
43722
44404
  const installState = installed ? updateAvailable ? "update" : installed.enabled ? "installed" : "installed-disabled" : "available";
43723
- const entryAction = pendingMutations.get(entry.id) ?? null;
44405
+ const hostOperation = installed?.state === "valid" ? installed.operation : void 0;
44406
+ const isHostUpdating = hostOperation?.state === "updating";
44407
+ const isHostUpdateFailed = hostOperation?.state === "failed";
44408
+ const entryAction = pendingMutations.get(entry.id) ?? (isHostUpdating ? "update" : null);
43724
44409
  const isBusyCard = entryAction !== null;
43725
44410
  const controlsDisabled = isBusyCard || globalBusy;
43726
44411
  const actionButton = createEl(document2, "button");
@@ -43744,7 +44429,12 @@ ${error62.stderrTail}`] : []
43744
44429
  actionButton.append(createRendererSettingsIcon("arrow-up", 11));
43745
44430
  }
43746
44431
  actionButton.append(
43747
- createEl(document2, "span", "", updatingThis ? copy.updating : copy.update)
44432
+ createEl(
44433
+ document2,
44434
+ "span",
44435
+ "",
44436
+ updatingThis ? copy.updating : isHostUpdateFailed ? copy.retryUpdate : copy.update
44437
+ )
43748
44438
  );
43749
44439
  actionButton.setAttribute("aria-busy", String(updatingThis));
43750
44440
  actionButton.disabled = controlsDisabled || !canInstall;
@@ -43802,7 +44492,11 @@ ${error62.stderrTail}`] : []
43802
44492
  version: updateAvailable && installed?.state === "valid" ? installed.manifest.version : entry.version,
43803
44493
  downloads: entry.downloads,
43804
44494
  trustTier: entry.trustTier,
43805
- statusDotOverride: installState === "update" && installed && !installed.enabled ? { tone: "neutral", label: copy.installedDisabledBadge } : void 0,
44495
+ statusDotOverride: isHostUpdateFailed ? { tone: "danger", label: copy.states.failed } : installState === "update" && installed && !installed.enabled ? { tone: "neutral", label: copy.installedDisabledBadge } : void 0,
44496
+ attention: hostOperation?.state === "failed" ? {
44497
+ tone: "danger",
44498
+ text: formatHostExtensionOperationError(hostOperation, copy)
44499
+ } : void 0,
43806
44500
  update: updateAvailable && installed?.state === "valid" ? {
43807
44501
  version: entry.version,
43808
44502
  label: formatMessage(copy.updateVersionCue, {
@@ -43824,10 +44518,19 @@ ${error62.stderrTail}`] : []
43824
44518
  });
43825
44519
  };
43826
44520
  const hasExplicitFeatured = visibleEntries.some((entry) => entry.featured === true);
43827
- const showFeaturedSection = isDefaultHome && (hasExplicitFeatured || visibleEntries.length > 3);
44521
+ const desktopCompatibleCount = visibleEntries.filter(
44522
+ (entry) => isHostExtensionCompatibleWithHost(entry, "desktop")
44523
+ ).length;
44524
+ const showFeaturedSection = isDefaultHome && (hasExplicitFeatured || desktopCompatibleCount > 3);
43828
44525
  const featuredEntries = showFeaturedSection ? selectFeaturedCatalogEntries(visibleEntries, 3) : [];
43829
44526
  const featuredIds = new Set(featuredEntries.map((entry) => entry.id));
43830
- const communityEntries = showFeaturedSection ? visibleEntries.filter((entry) => !featuredIds.has(entry.id)) : visibleEntries;
44527
+ const remainingEntries = showFeaturedSection ? visibleEntries.filter((entry) => !featuredIds.has(entry.id)) : visibleEntries;
44528
+ const communityEntries = rankHostExtensionCatalogEntries(remainingEntries, {
44529
+ host: "desktop",
44530
+ sortMode,
44531
+ query: searchQuery,
44532
+ applyDiversity: applyDiversity && !searchQuery && sortMode === "recommended"
44533
+ });
43831
44534
  const sections = createEl(document2, "div", "settings-extensions-sections");
43832
44535
  sections.setAttribute("aria-label", messages.pageLabels["desktop-extensions"]);
43833
44536
  if (featuredEntries.length > 0) {
@@ -43982,6 +44685,56 @@ ${error62.stderrTail}`] : []
43982
44685
  clearSearchButton.hidden = true;
43983
44686
  clearSearchButton.append(createRendererSettingsIcon("close", 12));
43984
44687
  searchBox.append(searchIcon, searchInput, clearSearchButton);
44688
+ const sortWrap = createEl(document2, "div", "settings-extensions__sort");
44689
+ const sortButton = createEl(document2, "button", "settings-extensions__filter-button");
44690
+ sortButton.type = "button";
44691
+ sortButton.dataset.action = "sort-menu";
44692
+ sortButton.title = copy.sortLabel;
44693
+ sortButton.setAttribute("aria-label", copy.sortLabel);
44694
+ sortButton.setAttribute("aria-haspopup", "menu");
44695
+ sortButton.setAttribute("aria-expanded", "false");
44696
+ const sortLabelSpan = createEl(document2, "span", "", copy.sortRecommended);
44697
+ const sortActiveDot = createEl(document2, "span", "settings-extensions__filter-dot");
44698
+ sortActiveDot.hidden = true;
44699
+ sortActiveDot.setAttribute("aria-hidden", "true");
44700
+ sortButton.append(
44701
+ createRendererSettingsIcon("arrow-up-down", 13),
44702
+ sortLabelSpan,
44703
+ sortActiveDot,
44704
+ createRendererSettingsIcon("chevron-down", 11)
44705
+ );
44706
+ const sortMenu = createEl(
44707
+ document2,
44708
+ "div",
44709
+ "settings-extensions-menu settings-extensions-menu--sort"
44710
+ );
44711
+ sortMenu.dataset.menu = "sort";
44712
+ sortMenu.setAttribute("role", "menu");
44713
+ sortMenu.setAttribute("aria-label", copy.sortLabel);
44714
+ sortMenu.hidden = true;
44715
+ const sortOptionButtons = /* @__PURE__ */ new Map();
44716
+ for (const mode of SORT_MODE_ORDER) {
44717
+ const itemButton = createEl(
44718
+ document2,
44719
+ "button",
44720
+ "settings-extensions-menu__item settings-extensions-menu__item--radio"
44721
+ );
44722
+ itemButton.type = "button";
44723
+ itemButton.setAttribute("role", "menuitemradio");
44724
+ itemButton.dataset.sortOption = mode;
44725
+ const labelSpan = createEl(
44726
+ document2,
44727
+ "span",
44728
+ "settings-extensions-menu__item-label",
44729
+ sortModeLabel(mode, copy)
44730
+ );
44731
+ const checkSlot = createEl(document2, "span", "settings-extensions-menu__check");
44732
+ checkSlot.append(createRendererSettingsIcon("check", 13));
44733
+ itemButton.append(labelSpan, checkSlot);
44734
+ sortMenu.append(itemButton);
44735
+ sortOptionButtons.set(mode, { button: itemButton, checkSlot });
44736
+ }
44737
+ sortWrap.append(sortButton, sortMenu);
43985
44738
  const filterWrap = createEl(document2, "div", "settings-extensions__filter");
43986
44739
  const filterButton = createEl(document2, "button", "settings-extensions__filter-button");
43987
44740
  filterButton.type = "button";
@@ -44134,7 +44887,7 @@ ${error62.stderrTail}`] : []
44134
44887
  );
44135
44888
  moreMenu.append(refreshMenuItem, copyDirectoryMenuItem, menuDivider, recoveryMenuItem);
44136
44889
  moreWrap.append(moreButton, moreMenu);
44137
- barActions.append(searchBox, filterWrap, moreWrap);
44890
+ barActions.append(searchBox, sortWrap, filterWrap, moreWrap);
44138
44891
  stickyBar.append(navTabs, barActions);
44139
44892
  const banner = createEl(document2, "div", "settings-extensions__banner");
44140
44893
  banner.hidden = true;
@@ -44159,6 +44912,7 @@ ${error62.stderrTail}`] : []
44159
44912
  let disposed = false;
44160
44913
  let moreMenuOpen = false;
44161
44914
  let filterMenuOpen = false;
44915
+ let sortMenuOpen = false;
44162
44916
  let contentLocalePreference = readContentLocalePreference(ownerWindow);
44163
44917
  let activeView = initialHasCatalog ? "all" : "installed";
44164
44918
  let listing = null;
@@ -44178,6 +44932,7 @@ ${error62.stderrTail}`] : []
44178
44932
  let pollTimer;
44179
44933
  let activeRecoveryDialog = null;
44180
44934
  let selectedCapability = "all";
44935
+ let selectedSort = "recommended";
44181
44936
  let searchQuery = "";
44182
44937
  let modalFeedback = null;
44183
44938
  const isInstalledView = () => activeView === "installed";
@@ -44202,6 +44957,21 @@ ${error62.stderrTail}`] : []
44202
44957
  };
44203
44958
  };
44204
44959
  const resolveContentLocale = () => contentLocalePreference === "system" ? messages.locale : contentLocalePreference;
44960
+ const syncSortControl = () => {
44961
+ const installed = isInstalledView();
44962
+ sortWrap.hidden = installed;
44963
+ if (installed && sortMenuOpen) setSortMenuOpen(false);
44964
+ const active2 = selectedSort !== "recommended";
44965
+ sortLabelSpan.textContent = sortModeLabel(selectedSort, copy);
44966
+ sortButton.dataset.sortMode = selectedSort;
44967
+ sortButton.dataset.active = active2 ? "true" : "false";
44968
+ sortActiveDot.hidden = !active2;
44969
+ for (const [mode, entry] of sortOptionButtons) {
44970
+ const selected = mode === selectedSort;
44971
+ entry.button.setAttribute("aria-checked", String(selected));
44972
+ entry.checkSlot.hidden = !selected;
44973
+ }
44974
+ };
44205
44975
  const syncFilterControl = () => {
44206
44976
  const effective = resolveContentLocale();
44207
44977
  const capabilityActive = selectedCapability !== "all";
@@ -44250,6 +45020,17 @@ ${error62.stderrTail}`] : []
44250
45020
  };
44251
45021
  const buildDetailModalState = () => {
44252
45022
  const { canInstall, canUninstall } = clientCapabilities();
45023
+ const combinedPending = new Map(pendingMutations);
45024
+ for (const item of listing?.extensions ?? []) {
45025
+ if (item.state === "valid" && item.operation?.state === "updating" && !combinedPending.has(item.id)) {
45026
+ combinedPending.set(item.id, "update");
45027
+ }
45028
+ }
45029
+ const openItem = detailModal.extensionId ? listing?.extensions.find((item) => item.id === detailModal.extensionId) : void 0;
45030
+ const hostFailureFeedback = openItem?.state === "valid" && openItem.operation?.state === "failed" ? {
45031
+ tone: "danger",
45032
+ text: formatHostExtensionOperationError(openItem.operation, copy)
45033
+ } : null;
44253
45034
  return {
44254
45035
  extensions: listing?.extensions ?? [],
44255
45036
  catalogExtensions: catalog?.extensions ?? [],
@@ -44258,9 +45039,9 @@ ${error62.stderrTail}`] : []
44258
45039
  unavailable,
44259
45040
  canInstall,
44260
45041
  canUninstall,
44261
- pendingMutations: new Map(pendingMutations),
45042
+ pendingMutations: combinedPending,
44262
45043
  globalBusy: recovering,
44263
- feedback: modalFeedback !== null && modalFeedback.extensionId === detailModal.extensionId ? modalFeedback.feedback : null
45044
+ feedback: modalFeedback !== null && modalFeedback.extensionId === detailModal.extensionId ? modalFeedback.feedback : hostFailureFeedback
44264
45045
  };
44265
45046
  };
44266
45047
  const detailModal = createDesktopExtensionDetailModal({
@@ -44417,6 +45198,7 @@ ${error62.stderrTail}`] : []
44417
45198
  createButton.disabled = recovering;
44418
45199
  recoveryMenuItem.disabled = hasPendingMutations() || !canRecover;
44419
45200
  syncNavTabs();
45201
+ syncSortControl();
44420
45202
  syncFilterControl();
44421
45203
  };
44422
45204
  const renderDiagnostics = () => {
@@ -44494,14 +45276,29 @@ ${error62.stderrTail}`] : []
44494
45276
  empty.append(copyBox, resetButton);
44495
45277
  body.replaceChildren(...prefixNodes, empty);
44496
45278
  };
45279
+ const setSortMenuOpen = (open2) => {
45280
+ if (open2) {
45281
+ if (filterMenuOpen) setFilterMenuOpen(false);
45282
+ if (moreMenuOpen) setMoreMenuOpen(false);
45283
+ }
45284
+ sortMenuOpen = open2;
45285
+ sortMenu.hidden = !open2;
45286
+ sortButton.setAttribute("aria-expanded", String(open2));
45287
+ };
44497
45288
  const setFilterMenuOpen = (open2) => {
44498
- if (open2 && moreMenuOpen) setMoreMenuOpen(false);
45289
+ if (open2) {
45290
+ if (sortMenuOpen) setSortMenuOpen(false);
45291
+ if (moreMenuOpen) setMoreMenuOpen(false);
45292
+ }
44499
45293
  filterMenuOpen = open2;
44500
45294
  filterMenu.hidden = !open2;
44501
45295
  filterButton.setAttribute("aria-expanded", String(open2));
44502
45296
  };
44503
45297
  const setMoreMenuOpen = (open2) => {
44504
- if (open2 && filterMenuOpen) setFilterMenuOpen(false);
45298
+ if (open2) {
45299
+ if (sortMenuOpen) setSortMenuOpen(false);
45300
+ if (filterMenuOpen) setFilterMenuOpen(false);
45301
+ }
44505
45302
  moreMenuOpen = open2;
44506
45303
  moreMenu.hidden = !open2;
44507
45304
  moreButton.setAttribute("aria-expanded", String(open2));
@@ -44509,6 +45306,7 @@ ${error62.stderrTail}`] : []
44509
45306
  const closeHeaderMenus = () => {
44510
45307
  if (moreMenuOpen) setMoreMenuOpen(false);
44511
45308
  if (filterMenuOpen) setFilterMenuOpen(false);
45309
+ if (sortMenuOpen) setSortMenuOpen(false);
44512
45310
  };
44513
45311
  const openDetailModal = (extensionId) => {
44514
45312
  if (disposed || context.signal.aborted || activeRecoveryDialog || importModal.isOpen) {
@@ -44527,7 +45325,10 @@ ${error62.stderrTail}`] : []
44527
45325
  const errorId = preferenceId(`host-ext-error-${item.id}`);
44528
45326
  const blocked = isToggleBlocked(item);
44529
45327
  const statusState = itemStatusState(item);
44530
- const extAction = pendingMutations.get(item.id) ?? null;
45328
+ const hostOperation = item.state === "valid" ? item.operation : void 0;
45329
+ const isHostUpdating = hostOperation?.state === "updating";
45330
+ const isHostUpdateFailed = hostOperation?.state === "failed";
45331
+ const extAction = pendingMutations.get(item.id) ?? (isHostUpdating ? "update" : null);
44531
45332
  const isExtBusy = extAction !== null;
44532
45333
  const controlsDisabled = isExtBusy || recovering;
44533
45334
  const toggle = createPreferenceSwitch(document2, switchId, errorId);
@@ -44587,7 +45388,14 @@ ${error62.stderrTail}`] : []
44587
45388
  if (!updating) {
44588
45389
  button2.append(createRendererSettingsIcon("arrow-up", 11));
44589
45390
  }
44590
- button2.append(createEl(document2, "span", "", updating ? copy.updating : copy.update));
45391
+ button2.append(
45392
+ createEl(
45393
+ document2,
45394
+ "span",
45395
+ "",
45396
+ updating ? copy.updating : isHostUpdateFailed ? copy.retryUpdate : copy.update
45397
+ )
45398
+ );
44591
45399
  button2.addEventListener("click", (event) => {
44592
45400
  event.stopPropagation?.();
44593
45401
  if (!button2.disabled) void installFromCatalog(catalogEntry, true);
@@ -44806,7 +45614,7 @@ ${error62.stderrTail}`] : []
44806
45614
  for (const item of listing?.extensions ?? []) {
44807
45615
  installedById.set(item.id, item);
44808
45616
  }
44809
- const isDefaultHome = activeView === "all" && normalizedQuery === "" && selectedCapability === "all";
45617
+ const isDefaultHome = activeView === "all" && normalizedQuery === "" && selectedCapability === "all" && selectedSort === "recommended";
44810
45618
  const { canInstall } = clientCapabilities();
44811
45619
  const marketView = renderDesktopExtensionsMarketplaceGrid({
44812
45620
  document: document2,
@@ -44817,6 +45625,9 @@ ${error62.stderrTail}`] : []
44817
45625
  installedById,
44818
45626
  isDefaultHome,
44819
45627
  selectedCategory: category,
45628
+ sortMode: selectedSort,
45629
+ searchQuery: normalizedQuery,
45630
+ applyDiversity: activeView === "all" && normalizedQuery === "" && selectedSort === "recommended",
44820
45631
  catalogIconLoader,
44821
45632
  canInstall,
44822
45633
  pendingMutations,
@@ -45059,6 +45870,7 @@ ${error62.stderrTail}`] : []
45059
45870
  id: entry.id,
45060
45871
  expectedDigest: installedItem.digest,
45061
45872
  expectedActivationId: installedItem.activationId,
45873
+ expectedVersion: entry.version,
45062
45874
  source: { type: "catalog", id: entry.id }
45063
45875
  });
45064
45876
  } else if (install) {
@@ -45075,6 +45887,10 @@ ${error62.stderrTail}`] : []
45075
45887
  setFeedback(buildInstallFeedback(result, isUpdate, fallbackName), modalTargetId);
45076
45888
  } catch (error62) {
45077
45889
  if (disposed || context.signal.aborted) return;
45890
+ if (isUpdate) {
45891
+ await refreshInstalledAfterMutation();
45892
+ if (disposed || context.signal.aborted) return;
45893
+ }
45078
45894
  const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
45079
45895
  setFeedback(
45080
45896
  {
@@ -45431,12 +46247,19 @@ ${error62.stderrTail}`] : []
45431
46247
  if (filterMenuOpen && !(event?.target && isWithinElement(event.target, filterWrap))) {
45432
46248
  setFilterMenuOpen(false);
45433
46249
  }
46250
+ if (sortMenuOpen && !(event?.target && isWithinElement(event.target, sortWrap))) {
46251
+ setSortMenuOpen(false);
46252
+ }
45434
46253
  };
45435
46254
  const onDocumentKeyDown = (event) => {
45436
- if (!moreMenuOpen && !filterMenuOpen) return;
46255
+ if (!moreMenuOpen && !filterMenuOpen && !sortMenuOpen) return;
45437
46256
  const key2 = event?.key;
45438
46257
  if (key2 !== "Escape") return;
45439
46258
  event?.preventDefault?.();
46259
+ if (sortMenuOpen) {
46260
+ setSortMenuOpen(false);
46261
+ sortButton.focus?.();
46262
+ }
45440
46263
  if (filterMenuOpen) {
45441
46264
  setFilterMenuOpen(false);
45442
46265
  filterButton.focus?.();
@@ -45446,6 +46269,18 @@ ${error62.stderrTail}`] : []
45446
46269
  moreButton.focus?.();
45447
46270
  }
45448
46271
  };
46272
+ sortButton.addEventListener("click", (event) => {
46273
+ event.stopPropagation?.();
46274
+ setSortMenuOpen(!sortMenuOpen);
46275
+ });
46276
+ for (const [mode, { button: button2 }] of sortOptionButtons) {
46277
+ button2.addEventListener("click", () => {
46278
+ setSortMenuOpen(false);
46279
+ if (selectedSort === mode) return;
46280
+ selectedSort = mode;
46281
+ render();
46282
+ });
46283
+ }
45449
46284
  filterButton.addEventListener("click", (event) => {
45450
46285
  event.stopPropagation?.();
45451
46286
  setFilterMenuOpen(!filterMenuOpen);
@@ -49149,8 +49984,77 @@ ${error62.stderrTail}`] : []
49149
49984
  return messages.locale === "zh-CN" ? `${reason}${recovery}` : `${reason} ${recovery}`;
49150
49985
  }
49151
49986
 
49152
- // src/settings/pages.ts
49987
+ // src/settings/github-star-control.ts
49153
49988
  var CODEXHOST_GITHUB_REPOSITORY_URL = "https://github.com/BytePioneer-AI/codex-host";
49989
+ function createGitHubStarControl(document2, messages, client, signal, includeRepositoryLink = false) {
49990
+ const actions = document2.createElement("div");
49991
+ actions.className = "settings-github-actions";
49992
+ const repoLink = () => {
49993
+ const link = document2.createElement("a");
49994
+ link.className = "settings-github-pill";
49995
+ link.href = CODEXHOST_GITHUB_REPOSITORY_URL;
49996
+ link.target = "_blank";
49997
+ link.rel = "noopener noreferrer";
49998
+ return link;
49999
+ };
50000
+ if (includeRepositoryLink) {
50001
+ const link = repoLink();
50002
+ link.append(createRendererSettingsIcon("github", 15), "GitHub");
50003
+ actions.append(link);
50004
+ }
50005
+ const starMark = () => {
50006
+ const star = document2.createElement("span");
50007
+ star.className = "settings-github-star-mark";
50008
+ star.setAttribute("aria-hidden", "true");
50009
+ star.textContent = "\u2605";
50010
+ return star;
50011
+ };
50012
+ const fallback = repoLink();
50013
+ fallback.append(starMark(), messages.githubStar, createRendererSettingsIcon("external-link", 13));
50014
+ const button2 = document2.createElement("button");
50015
+ button2.type = "button";
50016
+ button2.className = "settings-github-pill";
50017
+ const label = document2.createElement("span");
50018
+ label.textContent = messages.githubStar;
50019
+ button2.append(starMark(), label);
50020
+ const showStarred = (celebrate) => {
50021
+ label.textContent = messages.githubStarred;
50022
+ button2.disabled = true;
50023
+ button2.classList.add("is-starred");
50024
+ if (celebrate) button2.classList.add("is-celebrating");
50025
+ };
50026
+ const control = document2.createElement("div");
50027
+ control.className = "settings-github-control";
50028
+ control.append(fallback);
50029
+ actions.append(control);
50030
+ const check2 = client?.getGitHubStarStatus?.bind(client);
50031
+ const add = client?.starGitHubRepository?.bind(client);
50032
+ if (!check2 || !add) return actions;
50033
+ void runBoundedRendererUpdateRequest(check2, signal).then((state) => {
50034
+ if (signal.aborted || !state.ghAvailable) return;
50035
+ if (state.starred) showStarred(false);
50036
+ control.replaceChildren(button2);
50037
+ }).catch(() => {
50038
+ });
50039
+ button2.addEventListener("click", async () => {
50040
+ if (signal.aborted || button2.disabled) return;
50041
+ button2.disabled = true;
50042
+ button2.setAttribute("aria-busy", "true");
50043
+ label.textContent = messages.githubStarring;
50044
+ const result = await runBoundedRendererUpdateRequest(add, signal).catch(() => null);
50045
+ button2.removeAttribute("aria-busy");
50046
+ if (signal.aborted) return;
50047
+ if (result?.ghAvailable && result.starred) {
50048
+ showStarred(true);
50049
+ return;
50050
+ }
50051
+ control.replaceChildren(fallback);
50052
+ fallback.click();
50053
+ });
50054
+ return actions;
50055
+ }
50056
+
50057
+ // src/settings/pages.ts
49154
50058
  var CODEXHOST_RELEASES_URL = `${CODEXHOST_GITHUB_REPOSITORY_URL}/releases`;
49155
50059
  var CODEXHOST_RELEASES_LATEST_URL = `${CODEXHOST_RELEASES_URL}/latest`;
49156
50060
  var CODEXHOST_ISSUES_URL = `${CODEXHOST_GITHUB_REPOSITORY_URL}/issues`;
@@ -49333,7 +50237,12 @@ ${error62.stderrTail}`] : []
49333
50237
  tagline.className = "settings-about-tagline";
49334
50238
  tagline.textContent = messages.aboutTagline;
49335
50239
  brandMeta.append(titleRow, tagline);
49336
- brand.append(mark, brandMeta);
50240
+ const client = getClient();
50241
+ brand.append(
50242
+ mark,
50243
+ brandMeta,
50244
+ createGitHubStarControl(document2, messages, client, context.signal, true)
50245
+ );
49337
50246
  const introduction = document2.createElement("div");
49338
50247
  introduction.className = "settings-about-copy";
49339
50248
  for (const paragraphText of messages.aboutParagraphs) {
@@ -49370,7 +50279,6 @@ ${error62.stderrTail}`] : []
49370
50279
  href: CODEXHOST_ISSUES_URL
49371
50280
  })
49372
50281
  );
49373
- const client = getClient();
49374
50282
  const consoleEntry = consoleSection(document2, messages, client);
49375
50283
  if (consoleEntry) linksCard.append(consoleEntry);
49376
50284
  linksGroup.append(linksTitle, linksCard);
@@ -49388,21 +50296,14 @@ ${error62.stderrTail}`] : []
49388
50296
  }
49389
50297
  });
49390
50298
  }
49391
- function updateStarBanner(document2, messages) {
50299
+ function updateStarBanner(context, messages, client) {
50300
+ const document2 = context.content.ownerDocument;
49392
50301
  const banner = document2.createElement("div");
49393
50302
  banner.className = "settings-update-star";
49394
50303
  const copy = document2.createElement("p");
49395
50304
  copy.className = "settings-update-star__copy";
49396
50305
  copy.textContent = messages.updateStarCallout;
49397
- const link = document2.createElement("a");
49398
- link.className = "settings-update-link settings-update-star__link";
49399
- link.href = CODEXHOST_GITHUB_REPOSITORY_URL;
49400
- link.target = "_blank";
49401
- link.rel = "noopener noreferrer";
49402
- const star = createRendererSettingsIcon("star", 14);
49403
- star.classList.add("settings-update-star__mark");
49404
- link.append(createRendererSettingsIcon("github", 15), messages.updateStarLink, star);
49405
- banner.append(copy, link);
50306
+ banner.append(copy, createGitHubStarControl(document2, messages, client, context.signal));
49406
50307
  return banner;
49407
50308
  }
49408
50309
  function updatesPage(messages, getClient) {
@@ -49591,7 +50492,7 @@ ${error62.stderrTail}`] : []
49591
50492
  const notes = document2.createElement("div");
49592
50493
  notes.className = "settings-update-notes-section";
49593
50494
  const macosSigning = createMacOsSigningSection(document2, messages, context.signal);
49594
- const starBanner = updateStarBanner(document2, messages);
50495
+ const starBanner = updateStarBanner(context, messages, getClient());
49595
50496
  page.append(header, heroCard, macosSigning.card, controls, starBanner, notes);
49596
50497
  context.content.append(page);
49597
50498
  const setManualFallback = (fallback) => {
@@ -51684,7 +52585,8 @@ ${error62.stderrTail}`] : []
51684
52585
 
51685
52586
  .settings-about-brand {
51686
52587
  display: flex;
51687
- align-items: flex-start;
52588
+ flex-wrap: wrap;
52589
+ align-items: center;
51688
52590
  gap: 14px;
51689
52591
  min-width: 0;
51690
52592
  }
@@ -51705,7 +52607,7 @@ ${error62.stderrTail}`] : []
51705
52607
  .settings-about-brand__meta {
51706
52608
  display: grid;
51707
52609
  gap: 4px;
51708
- min-width: 0;
52610
+ min-width: min(100%, 9rem);
51709
52611
  flex: 1;
51710
52612
  }
51711
52613
 
@@ -52561,27 +53463,74 @@ ${error62.stderrTail}`] : []
52561
53463
  margin: 0;
52562
53464
  min-width: min(100%, 16rem);
52563
53465
  flex: 1;
52564
- color: var(--settings-focus);
53466
+ color: var(--settings-muted);
52565
53467
  font-size: 13px;
52566
- font-weight: 600;
53468
+ font-weight: 500;
52567
53469
  line-height: 20px;
52568
53470
  }
52569
53471
 
52570
- .settings-update-star__link {
52571
- color: var(--settings-focus);
52572
- background: light-dark(rgb(11 117 209 / 8%), rgb(102 170 249 / 12%));
52573
- border-color: light-dark(rgb(11 117 209 / 22%), rgb(102 170 249 / 32%));
53472
+ .settings-github-actions {
53473
+ display: flex;
53474
+ flex-wrap: wrap;
53475
+ justify-content: flex-end;
53476
+ gap: 8px;
53477
+ margin-inline-start: auto;
53478
+ }
53479
+
53480
+ .settings-github-pill {
53481
+ display: inline-flex;
53482
+ align-items: center;
53483
+ justify-content: center;
53484
+ gap: 6px;
53485
+ min-height: 32px;
53486
+ padding: 0 11px;
53487
+ border: 1px solid var(--settings-border);
53488
+ border-radius: 999px;
53489
+ background: var(--settings-surface);
53490
+ color: var(--settings-text);
53491
+ font: inherit;
53492
+ font-size: 12.5px;
53493
+ font-weight: 600;
53494
+ text-decoration: none;
53495
+ white-space: nowrap;
53496
+ cursor: pointer;
53497
+ }
53498
+
53499
+ .settings-github-pill:hover:not(:disabled) {
53500
+ background: var(--settings-surface-hover);
53501
+ }
53502
+
53503
+ .settings-github-pill:focus-visible {
53504
+ outline: 2px solid var(--settings-focus);
53505
+ outline-offset: 2px;
53506
+ }
53507
+
53508
+ .settings-github-pill[aria-busy="true"] {
53509
+ cursor: progress;
53510
+ color: var(--settings-muted);
52574
53511
  }
52575
53512
 
52576
- .settings-update-star__link:hover {
52577
- background: light-dark(rgb(11 117 209 / 14%), rgb(102 170 249 / 18%));
52578
- border-color: light-dark(rgb(11 117 209 / 32%), rgb(102 170 249 / 42%));
53513
+ .settings-github-pill.is-starred {
53514
+ cursor: default;
53515
+ color: light-dark(#593100, #ffe5ae);
53516
+ background: light-dark(#ffdf9a, #513317);
53517
+ border-color: light-dark(#e0aa51, #875e2b);
52579
53518
  }
52580
53519
 
52581
- .settings-update-star__mark {
52582
- color: light-dark(#f5b400, #ffd15c);
52583
- fill: currentColor;
52584
- stroke: none;
53520
+ .settings-github-star-mark {
53521
+ font-size: 14px;
53522
+ }
53523
+
53524
+ @media (prefers-reduced-motion: no-preference) {
53525
+ .settings-github-pill.is-celebrating .settings-github-star-mark {
53526
+ animation: settings-github-star-pop 260ms ease-out;
53527
+ }
53528
+ }
53529
+
53530
+ @keyframes settings-github-star-pop {
53531
+ 50% {
53532
+ transform: scale(1.25) rotate(-10deg);
53533
+ }
52585
53534
  }
52586
53535
 
52587
53536
  .codexhost-settings-icon {
@@ -53306,6 +54255,7 @@ ${error62.stderrTail}`] : []
53306
54255
  flex: none;
53307
54256
  }
53308
54257
 
54258
+ .settings-extensions__sort,
53309
54259
  .settings-extensions__filter,
53310
54260
  .settings-extensions__more {
53311
54261
  position: relative;
@@ -53313,6 +54263,10 @@ ${error62.stderrTail}`] : []
53313
54263
  align-items: center;
53314
54264
  }
53315
54265
 
54266
+ .settings-extensions__sort[hidden] {
54267
+ display: none;
54268
+ }
54269
+
53316
54270
  .settings-extensions__filter-button {
53317
54271
  display: inline-flex;
53318
54272
  align-items: center;
@@ -53364,6 +54318,10 @@ ${error62.stderrTail}`] : []
53364
54318
  min-width: 214px;
53365
54319
  }
53366
54320
 
54321
+ .settings-extensions-menu--sort {
54322
+ min-width: 164px;
54323
+ }
54324
+
53367
54325
  .settings-extensions-menu__heading {
53368
54326
  padding: 6px 9px 4px;
53369
54327
  color: var(--settings-subtle);
@@ -54348,11 +55306,13 @@ ${error62.stderrTail}`] : []
54348
55306
  .settings-extensions__bar-actions {
54349
55307
  width: 100%;
54350
55308
  margin-left: 0;
55309
+ flex-wrap: wrap;
54351
55310
  }
54352
55311
 
54353
55312
  .settings-extensions__search {
54354
- flex: 1;
55313
+ flex: 1 1 120px;
54355
55314
  width: auto;
55315
+ min-width: 110px;
54356
55316
  }
54357
55317
  }
54358
55318
 
@@ -56708,6 +57668,7 @@ ${connect_devices_default}`
56708
57668
 
56709
57669
  lucide/dist/esm/defaultAttributes.mjs:
56710
57670
  lucide/dist/esm/createElement.mjs:
57671
+ lucide/dist/esm/icons/arrow-up-down.mjs:
56711
57672
  lucide/dist/esm/icons/smartphone.mjs:
56712
57673
  lucide/dist/esm/icons/boxes.mjs:
56713
57674
  lucide/dist/esm/icons/calendar-clock.mjs: