@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
@@ -27517,26 +27517,51 @@ var jsonPrimitiveSchema = external_exports.union([
27517
27517
  external_exports.boolean(),
27518
27518
  external_exports.null()
27519
27519
  ]);
27520
- function hasNoCircularReferences(value) {
27521
- const ancestors = /* @__PURE__ */ new WeakSet();
27522
- const stack = [{ value, leaving: false }];
27520
+ function isPlainObject2(value) {
27521
+ const prototype = Object.getPrototypeOf(value);
27522
+ return prototype === Object.prototype || prototype === null;
27523
+ }
27524
+ var JSON_VALIDATION_LEAVE = /* @__PURE__ */ Symbol("json-validation-leave");
27525
+ function isValidJsonValue(value) {
27526
+ if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
27527
+ return true;
27528
+ }
27529
+ if (typeof value !== "object")
27530
+ return false;
27531
+ const ancestors = /* @__PURE__ */ new Set();
27532
+ const stack = [value];
27523
27533
  try {
27524
27534
  while (stack.length > 0) {
27525
- const frame = stack.pop();
27526
- if (!frame)
27527
- break;
27528
- if (frame.leaving) {
27529
- ancestors.delete(frame.value);
27535
+ const current = stack.pop();
27536
+ if (current === JSON_VALIDATION_LEAVE) {
27537
+ ancestors.delete(stack.pop());
27530
27538
  continue;
27531
27539
  }
27532
- if (typeof frame.value !== "object" || frame.value === null)
27540
+ if (current === null || typeof current === "string" || typeof current === "boolean" || typeof current === "number" && Number.isFinite(current)) {
27541
+ continue;
27542
+ }
27543
+ if (typeof current !== "object")
27544
+ return false;
27545
+ if (ancestors.has(current))
27546
+ return false;
27547
+ if (Array.isArray(current)) {
27548
+ ancestors.add(current);
27549
+ stack.push(current, JSON_VALIDATION_LEAVE);
27550
+ for (let index = current.length - 1; index >= 0; index -= 1) {
27551
+ stack.push(current[index]);
27552
+ }
27533
27553
  continue;
27534
- if (ancestors.has(frame.value))
27554
+ }
27555
+ if (!isPlainObject2(current))
27535
27556
  return false;
27536
- ancestors.add(frame.value);
27537
- stack.push({ value: frame.value, leaving: true });
27538
- for (const child of Object.values(frame.value)) {
27539
- stack.push({ value: child, leaving: false });
27557
+ ancestors.add(current);
27558
+ stack.push(current, JSON_VALIDATION_LEAVE);
27559
+ for (const key in current) {
27560
+ if (Object.hasOwn(current, key)) {
27561
+ if (key === "__proto__")
27562
+ return false;
27563
+ stack.push(current[key]);
27564
+ }
27540
27565
  }
27541
27566
  }
27542
27567
  } catch {
@@ -27544,17 +27569,11 @@ function hasNoCircularReferences(value) {
27544
27569
  }
27545
27570
  return true;
27546
27571
  }
27547
- var nonCircularSchema = external_exports.custom(hasNoCircularReferences, {
27548
- message: "JSON value must not contain circular references"
27572
+ var jsonValueSchema = external_exports.custom(isValidJsonValue, {
27573
+ message: "Invalid JSON value"
27549
27574
  });
27550
- var recursiveJsonValueSchema = external_exports.lazy(() => external_exports.union([
27551
- jsonPrimitiveSchema,
27552
- external_exports.array(recursiveJsonValueSchema),
27553
- external_exports.record(external_exports.string(), recursiveJsonValueSchema)
27554
- ]));
27555
- var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
27556
- var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
27557
- var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
27575
+ var jsonArraySchema = external_exports.custom((value) => Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON array" });
27576
+ var jsonObjectSchema = external_exports.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON object" });
27558
27577
 
27559
27578
  // ../../shared-contracts/dist/errors.js
27560
27579
  var codexhostErrorSchema = external_exports.strictObject({
@@ -28678,6 +28697,7 @@ var hostExtensionCatalogEntrySchema = external_exports.object({
28678
28697
  backend: external_exports.int().positive().optional()
28679
28698
  }),
28680
28699
  downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS"),
28700
+ downloads7d: external_exports.number().int().min(0).optional(),
28681
28701
  featured: external_exports.boolean().optional(),
28682
28702
  featuredOrder: external_exports.int().nonnegative().optional(),
28683
28703
  changelog: external_exports.array(hostExtensionChangelogEntrySchema).max(20).optional()
@@ -28747,24 +28767,42 @@ var hostExtensionInstallationSchema = external_exports.strictObject({
28747
28767
  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);
28748
28768
  var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
28749
28769
  var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
28770
+ var HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH = 512;
28771
+ var hostExtensionOperationStatusSchema = external_exports.discriminatedUnion("state", [
28772
+ external_exports.object({
28773
+ state: external_exports.literal("updating"),
28774
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
28775
+ startedAt: external_exports.iso.datetime()
28776
+ }),
28777
+ external_exports.object({
28778
+ state: external_exports.literal("failed"),
28779
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
28780
+ startedAt: external_exports.iso.datetime(),
28781
+ updatedAt: external_exports.iso.datetime(),
28782
+ error: external_exports.string().min(1).max(HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH),
28783
+ interruptedByShutdown: external_exports.boolean().optional()
28784
+ })
28785
+ ]);
28750
28786
  var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
28751
- hostExtensionInstallationSchema.extend({
28787
+ external_exports.object({
28788
+ ...hostExtensionInstallationSchema.shape,
28752
28789
  state: external_exports.literal("valid"),
28753
28790
  enabled: external_exports.boolean(),
28754
28791
  ...desktopConflict,
28755
28792
  iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
28756
28793
  screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
28757
28794
  backendState: backendState.optional(),
28758
- backendError: external_exports.string().optional()
28795
+ backendError: external_exports.string().optional(),
28796
+ operation: hostExtensionOperationStatusSchema.optional()
28759
28797
  }),
28760
- external_exports.strictObject({
28798
+ external_exports.object({
28761
28799
  state: external_exports.enum(["invalid", "incompatible"]),
28762
28800
  id: external_exports.string().min(1),
28763
28801
  enabled: external_exports.boolean(),
28764
28802
  error: external_exports.string()
28765
28803
  })
28766
28804
  ]);
28767
- var hostExtensionsListResultSchema = external_exports.strictObject({
28805
+ var hostExtensionsListResultSchema = external_exports.object({
28768
28806
  revision: hostExtensionRevisionSchema,
28769
28807
  configuration: hostExtensionConfigurationSchema,
28770
28808
  diagnostics: external_exports.array(external_exports.string()),
@@ -28803,7 +28841,10 @@ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
28803
28841
  var noParams = external_exports.strictObject({});
28804
28842
  var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
28805
28843
  var selection = external_exports.strictObject({ ...id, ...expectedRevision });
28806
- var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
28844
+ var installationResult = external_exports.object({
28845
+ ...hostExtensionInstallationSchema.shape,
28846
+ replaced: external_exports.boolean()
28847
+ });
28807
28848
  var mutationResult = external_exports.discriminatedUnion("state", [
28808
28849
  external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
28809
28850
  external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
@@ -28832,7 +28873,12 @@ var hostExtensionSettingsSchema = external_exports.strictObject({
28832
28873
  values: jsonObjectSchema
28833
28874
  });
28834
28875
  var hostExtensionsRpcSchemas = {
28835
- [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
28876
+ [HOST_EXTENSIONS_RPC.list]: {
28877
+ params: external_exports.object({
28878
+ includeOperations: external_exports.boolean().optional()
28879
+ }),
28880
+ result: hostExtensionsListResultSchema
28881
+ },
28836
28882
  [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
28837
28883
  [HOST_EXTENSIONS_RPC.catalog]: {
28838
28884
  params: external_exports.strictObject({
@@ -28858,6 +28904,7 @@ var hostExtensionsRpcSchemas = {
28858
28904
  ...id,
28859
28905
  expectedDigest: active.digest,
28860
28906
  expectedActivationId: active.activationId.optional(),
28907
+ expectedVersion: external_exports.string().trim().min(1).max(128).optional(),
28861
28908
  source: hostExtensionInstallSourceSchema.optional()
28862
28909
  }),
28863
28910
  result: installationResult
@@ -28907,9 +28954,39 @@ var hostExtensionsRpcSchemas = {
28907
28954
  };
28908
28955
 
28909
28956
  // ../../shared-contracts/dist/group-chat.js
28910
- var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
28911
- var MAX_GROUP_AGENT_HOPS = 20;
28957
+ var GROUP_MEMORY_MAX_BYTES = 4096;
28958
+ var DEFAULT_GROUP_MAX_AGENT_HOPS = 10;
28959
+ var MAX_GROUP_AGENT_HOPS = 200;
28912
28960
  var GROUP_NOTICE_MAX_LENGTH = 2e3;
28961
+ var cachedUtf8Encoder;
28962
+ function groupUtf8ByteLength(text3) {
28963
+ if (cachedUtf8Encoder === void 0) {
28964
+ cachedUtf8Encoder = typeof TextEncoder === "function" ? new TextEncoder() : null;
28965
+ }
28966
+ if (cachedUtf8Encoder !== null) {
28967
+ return cachedUtf8Encoder.encode(text3).length;
28968
+ }
28969
+ let bytes = 0;
28970
+ for (let i = 0; i < text3.length; i += 1) {
28971
+ const code = text3.charCodeAt(i);
28972
+ if (code <= 127) {
28973
+ bytes += 1;
28974
+ } else if (code <= 2047) {
28975
+ bytes += 2;
28976
+ } else if (code >= 55296 && code <= 56319 && i + 1 < text3.length) {
28977
+ const next = text3.charCodeAt(i + 1);
28978
+ if (next >= 56320 && next <= 57343) {
28979
+ bytes += 4;
28980
+ i += 1;
28981
+ } else {
28982
+ bytes += 3;
28983
+ }
28984
+ } else {
28985
+ bytes += 3;
28986
+ }
28987
+ }
28988
+ return bytes;
28989
+ }
28913
28990
  var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
28914
28991
  var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
28915
28992
  var groupMemberIdSchema = external_exports.uuidv4();
@@ -28918,7 +28995,7 @@ var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker"
28918
28995
  var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
28919
28996
  var nonnegativeInteger = external_exports.int().nonnegative();
28920
28997
  var positiveInteger = external_exports.int().positive();
28921
- var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
28998
+ var maxAgentHopsSchema = nonnegativeInteger.max(MAX_GROUP_AGENT_HOPS);
28922
28999
  var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
28923
29000
  var timestamp = external_exports.iso.datetime();
28924
29001
  var optionalMemberEdits = {
@@ -28937,9 +29014,11 @@ var groupMemberSchema = external_exports.object({
28937
29014
  harnessId: harnessIdSchema,
28938
29015
  status: groupMemberStatusSchema,
28939
29016
  projectless: external_exports.boolean().optional(),
29017
+ showInSidebar: external_exports.boolean().optional(),
28940
29018
  joinedAtSeq: nonnegativeInteger,
28941
29019
  lastDeliveredSeq: nonnegativeInteger,
28942
29020
  lastRosterVersion: nonnegativeInteger,
29021
+ lastMemoryVersion: nonnegativeInteger.default(0),
28943
29022
  createdAt: timestamp
28944
29023
  });
28945
29024
  var groupProjectlessWorkspaceSchema = external_exports.object({
@@ -28951,19 +29030,25 @@ var groupRoomRemoteHostSchema = external_exports.object({
28951
29030
  displayName: nonblankString,
28952
29031
  state: nonblankString.optional(),
28953
29032
  color: external_exports.string().optional(),
28954
- filePreview: external_exports.boolean().optional()
29033
+ filePreview: external_exports.boolean().optional(),
29034
+ memberSidebarVisibility: external_exports.boolean().optional(),
29035
+ sharedMemory: external_exports.boolean().optional()
28955
29036
  });
28956
- var groupRoomSchema = external_exports.object({
29037
+ var groupRoomObjectSchema = external_exports.object({
28957
29038
  roomId: groupRoomIdSchema,
28958
29039
  title: nonblankString,
28959
29040
  defaultCwd: nonblankString,
28960
29041
  projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
28961
29042
  unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
29043
+ unmentionedMemberId: groupMemberIdSchema.optional(),
28962
29044
  allowAgentMentions: external_exports.boolean().default(true),
28963
29045
  maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
29046
+ relayHopLimit: maxAgentHopsSchema.optional(),
28964
29047
  lastSeq: nonnegativeInteger,
28965
29048
  lastSpeakerMemberId: groupMemberIdSchema.optional(),
28966
29049
  rosterVersion: nonnegativeInteger,
29050
+ memoryVersion: nonnegativeInteger.default(0),
29051
+ memorySha256: external_exports.string().regex(/^[0-9a-f]{64}$/u).optional(),
28967
29052
  humanEpoch: nonnegativeInteger,
28968
29053
  relayPaused: external_exports.boolean(),
28969
29054
  pinned: external_exports.boolean(),
@@ -28971,7 +29056,14 @@ var groupRoomSchema = external_exports.object({
28971
29056
  updatedAt: timestamp,
28972
29057
  members: external_exports.array(groupMemberSchema),
28973
29058
  remote: groupRoomRemoteHostSchema.optional()
28974
- }).superRefine(({ members: members2 }, context) => {
29059
+ }).superRefine(({ members: members2, unmentionedPolicy, unmentionedMemberId }, context) => {
29060
+ if (unmentionedMemberId !== void 0 && unmentionedPolicy !== "none") {
29061
+ context.addIssue({
29062
+ code: "custom",
29063
+ path: ["unmentionedMemberId"],
29064
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
29065
+ });
29066
+ }
28975
29067
  const handles = /* @__PURE__ */ new Set();
28976
29068
  for (const [index, { handle, status }] of members2.entries()) {
28977
29069
  if (status === "removed")
@@ -28986,6 +29078,15 @@ var groupRoomSchema = external_exports.object({
28986
29078
  handles.add(handle);
28987
29079
  }
28988
29080
  });
29081
+ var groupRoomSchema = external_exports.preprocess((value) => {
29082
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
29083
+ const record4 = value;
29084
+ if (record4.unmentionedPolicy === "member" && record4.unmentionedMemberId !== void 0) {
29085
+ return { ...record4, unmentionedPolicy: "none" };
29086
+ }
29087
+ }
29088
+ return value;
29089
+ }, groupRoomObjectSchema);
28989
29090
  var groupAttachmentSchema = external_exports.object({
28990
29091
  kind: external_exports.enum(["image", "file"]),
28991
29092
  attachmentId: nonblankString.max(256),
@@ -29012,6 +29113,7 @@ var groupMessageSchema = external_exports.object({
29012
29113
  mentionedMemberIds: external_exports.array(groupMemberIdSchema),
29013
29114
  mentionAll: external_exports.boolean().optional(),
29014
29115
  hopCount: nonnegativeInteger,
29116
+ durationMs: nonnegativeInteger.optional(),
29015
29117
  createdAt: timestamp
29016
29118
  });
29017
29119
  var newThreadOptions = {
@@ -29041,6 +29143,8 @@ var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
29041
29143
  var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
29042
29144
  var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
29043
29145
  var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
29146
+ var GROUPS_READ_MEMORY_METHOD = "codexhost/groups/memory/read";
29147
+ var GROUPS_UPDATE_MEMORY_METHOD = "codexhost/groups/memory/update";
29044
29148
  var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
29045
29149
  var roomIdentity = { roomId: groupRoomIdSchema };
29046
29150
  var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
@@ -29071,8 +29175,17 @@ var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema }
29071
29175
  var groupsUpdateParamsSchema = external_exports.strictObject({
29072
29176
  ...roomIdentity,
29073
29177
  ...roomEdits,
29178
+ unmentionedMemberId: groupMemberIdSchema.nullable().optional(),
29074
29179
  pinned: external_exports.boolean().optional(),
29075
29180
  relayPaused: external_exports.boolean().optional()
29181
+ }).superRefine(({ unmentionedPolicy, unmentionedMemberId }, context) => {
29182
+ if (unmentionedMemberId !== void 0 && unmentionedMemberId !== null && unmentionedPolicy !== void 0 && unmentionedPolicy !== "none") {
29183
+ context.addIssue({
29184
+ code: "custom",
29185
+ path: ["unmentionedMemberId"],
29186
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
29187
+ });
29188
+ }
29076
29189
  });
29077
29190
  var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
29078
29191
  var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
@@ -29087,7 +29200,8 @@ var groupsAddMemberResultSchema = external_exports.object({
29087
29200
  var groupsUpdateMemberParamsSchema = external_exports.strictObject({
29088
29201
  ...memberIdentity,
29089
29202
  ...optionalMemberEdits,
29090
- status: groupMemberStatusSchema.optional()
29203
+ status: groupMemberStatusSchema.optional(),
29204
+ showInSidebar: external_exports.boolean().optional()
29091
29205
  });
29092
29206
  var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
29093
29207
  var groupsRebindMemberParamsSchema = external_exports.strictObject({
@@ -29190,6 +29304,24 @@ var groupsReadMessagesResultSchema = external_exports.object({
29190
29304
  messages: external_exports.array(groupMessageSchema),
29191
29305
  totalSeq: nonnegativeInteger
29192
29306
  });
29307
+ var groupsReadMemoryParamsSchema = external_exports.strictObject(roomIdentity);
29308
+ var groupsReadMemoryResultSchema = external_exports.object({
29309
+ ...roomIdentity,
29310
+ memoryVersion: nonnegativeInteger,
29311
+ content: external_exports.string(),
29312
+ updatedAt: timestamp
29313
+ });
29314
+ var groupsUpdateMemoryParamsSchema = external_exports.strictObject({
29315
+ ...roomIdentity,
29316
+ 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`),
29317
+ expectedVersion: nonnegativeInteger.optional()
29318
+ });
29319
+ var groupsUpdateMemoryResultSchema = external_exports.object({
29320
+ room: groupRoomSchema,
29321
+ memoryVersion: nonnegativeInteger,
29322
+ content: external_exports.string(),
29323
+ updatedAt: timestamp
29324
+ });
29193
29325
  var groupsInspectCwdParamsSchema = external_exports.strictObject({
29194
29326
  cwd: nonblankString,
29195
29327
  roomId: groupRoomIdSchema.optional()
@@ -29325,6 +29457,149 @@ var nativeCodexGoalResultSchema = external_exports.object({
29325
29457
  }).nullable()
29326
29458
  });
29327
29459
 
29460
+ // ../../shared-contracts/dist/voice.js
29461
+ var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
29462
+ var VOICE_CONFIG_GET_METHOD = "codexhost/voice/config/get";
29463
+ var VOICE_CONFIG_SET_METHOD = "codexhost/voice/config/set";
29464
+ var voiceProviderModeSchema = external_exports.enum([
29465
+ "codex",
29466
+ "openai-compatible",
29467
+ "deepseek-asr",
29468
+ "openai-chat-audio"
29469
+ ]);
29470
+ var voiceAudioFormatSchema = external_exports.enum(["native", "wav"]);
29471
+ 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;
29472
+ function isLoopbackVoiceHost(hostname3) {
29473
+ const bare = hostname3.trim().toLowerCase().replace(/^\[|\]$/g, "");
29474
+ if (bare === "localhost" || bare.endsWith(".localhost") || bare === "::1")
29475
+ return true;
29476
+ return /^127(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(bare);
29477
+ }
29478
+ function isValidVoiceBaseUrl(value) {
29479
+ const trimmed = value.trim();
29480
+ if (!trimmed)
29481
+ return false;
29482
+ try {
29483
+ const parsed = new URL(trimmed);
29484
+ if (!parsed.hostname)
29485
+ return false;
29486
+ if (parsed.username !== "" || parsed.password !== "" || parsed.hash !== "")
29487
+ return false;
29488
+ if (parsed.protocol === "https:") {
29489
+ } else if (parsed.protocol === "http:") {
29490
+ if (!isLoopbackVoiceHost(parsed.hostname))
29491
+ return false;
29492
+ } else {
29493
+ return false;
29494
+ }
29495
+ for (const key of parsed.searchParams.keys()) {
29496
+ if (SENSITIVE_VOICE_QUERY_PARAM.test(key))
29497
+ return false;
29498
+ }
29499
+ return true;
29500
+ } catch {
29501
+ return false;
29502
+ }
29503
+ }
29504
+ var voiceBaseUrlSchema = external_exports.string().max(2048).refine((value) => value === "" || isValidVoiceBaseUrl(value), {
29505
+ 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"
29506
+ });
29507
+ var voiceProviderConfigSnapshotSchema = external_exports.object({
29508
+ baseUrl: voiceBaseUrlSchema,
29509
+ model: external_exports.string().max(256),
29510
+ hasApiKey: external_exports.boolean(),
29511
+ apiKeyHint: external_exports.string().max(64).optional(),
29512
+ apiKey: external_exports.never().optional()
29513
+ });
29514
+ var voiceConfigSnapshotSchema = external_exports.object({
29515
+ mode: voiceProviderModeSchema,
29516
+ baseUrl: voiceBaseUrlSchema,
29517
+ model: external_exports.string().max(256),
29518
+ hasApiKey: external_exports.boolean(),
29519
+ apiKeyHint: external_exports.string().max(64).optional(),
29520
+ apiKey: external_exports.never().optional(),
29521
+ audioFormat: voiceAudioFormatSchema.optional(),
29522
+ providers: external_exports.object({
29523
+ "openai-compatible": voiceProviderConfigSnapshotSchema,
29524
+ "deepseek-asr": voiceProviderConfigSnapshotSchema,
29525
+ "openai-chat-audio": voiceProviderConfigSnapshotSchema
29526
+ }).optional(),
29527
+ codexAvailable: external_exports.boolean(),
29528
+ available: external_exports.boolean()
29529
+ });
29530
+ var voiceConfigUpdateParamsSchema = external_exports.object({
29531
+ mode: voiceProviderModeSchema,
29532
+ baseUrl: external_exports.string().max(2048).optional(),
29533
+ model: external_exports.string().max(256).optional(),
29534
+ apiKey: external_exports.string().max(4096).nullable().optional()
29535
+ }).strict().superRefine((value, ctx) => {
29536
+ const trimmedBaseUrl = value.baseUrl?.trim() ?? "";
29537
+ const trimmedModel = value.model?.trim() ?? "";
29538
+ if (value.mode === "openai-compatible") {
29539
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
29540
+ ctx.addIssue({
29541
+ code: external_exports.ZodIssueCode.custom,
29542
+ path: ["baseUrl"],
29543
+ message: "OpenAI-compatible mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
29544
+ });
29545
+ }
29546
+ return;
29547
+ }
29548
+ if (value.mode === "openai-chat-audio") {
29549
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
29550
+ ctx.addIssue({
29551
+ code: external_exports.ZodIssueCode.custom,
29552
+ path: ["baseUrl"],
29553
+ message: "Multimodal Chat Audio mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
29554
+ });
29555
+ }
29556
+ if (!trimmedModel) {
29557
+ ctx.addIssue({
29558
+ code: external_exports.ZodIssueCode.custom,
29559
+ path: ["model"],
29560
+ message: "Multimodal Chat Audio mode requires a model name"
29561
+ });
29562
+ }
29563
+ return;
29564
+ }
29565
+ if (trimmedBaseUrl !== "" && !isValidVoiceBaseUrl(trimmedBaseUrl)) {
29566
+ ctx.addIssue({
29567
+ code: external_exports.ZodIssueCode.custom,
29568
+ path: ["baseUrl"],
29569
+ message: "Base URL must be empty or a valid https:// URL (http:// is allowed only for loopback hosts)"
29570
+ });
29571
+ }
29572
+ });
29573
+ var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
29574
+ var voiceStatusResultSchema = external_exports.object({
29575
+ available: external_exports.boolean(),
29576
+ audioFormat: voiceAudioFormatSchema.optional()
29577
+ });
29578
+ var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
29579
+ var voiceErrorCodeSchema = external_exports.enum([
29580
+ "credentials-unavailable",
29581
+ "login-expired",
29582
+ "rate-limited",
29583
+ "service-rejected",
29584
+ "host-incompatible",
29585
+ "network",
29586
+ "timeout",
29587
+ "audio-empty",
29588
+ "audio-too-large",
29589
+ "audio-format",
29590
+ "audio-invalid"
29591
+ ]);
29592
+ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
29593
+ external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
29594
+ external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
29595
+ ]);
29596
+
29597
+ // ../../shared-contracts/dist/github-star.js
29598
+ var GITHUB_STAR_STATUS_METHOD = "codexhost/githubStar/status";
29599
+ var GITHUB_STAR_ADD_METHOD = "codexhost/githubStar/star";
29600
+ var githubStarParamsSchema = external_exports.object({}).strict();
29601
+ var githubStarStateSchema = external_exports.object({ ghAvailable: external_exports.boolean(), starred: external_exports.boolean() });
29602
+
29328
29603
  // ../../shared-contracts/dist/client-channel.js
29329
29604
  var CLIENT_CHANNEL_VERSION = 1;
29330
29605
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -29386,9 +29661,13 @@ var CLIENT_CHANNEL_METHODS = [
29386
29661
  GROUPS_REBIND_MEMBER_METHOD,
29387
29662
  GROUPS_POST_MESSAGE_METHOD,
29388
29663
  GROUPS_READ_MESSAGES_METHOD,
29664
+ GROUPS_READ_MEMORY_METHOD,
29665
+ GROUPS_UPDATE_MEMORY_METHOD,
29389
29666
  GROUPS_INSPECT_CWD_METHOD,
29390
29667
  "codexhost/voice/status",
29391
29668
  "codexhost/voice/transcribe",
29669
+ VOICE_CONFIG_GET_METHOD,
29670
+ VOICE_CONFIG_SET_METHOD,
29392
29671
  "codexhost/harness/display-settings/get",
29393
29672
  "codexhost/harness/display-settings/set",
29394
29673
  "codexhost/harness/display-settings/capabilities",
@@ -29454,6 +29733,8 @@ var CLIENT_CHANNEL_METHODS = [
29454
29733
  "codexhost/harness/session-import/list",
29455
29734
  "codexhost/harness/session-import/import",
29456
29735
  // Host settings shared across Desktop and Web.
29736
+ GITHUB_STAR_STATUS_METHOD,
29737
+ GITHUB_STAR_ADD_METHOD,
29457
29738
  ...HOST_EXTENSION_MANAGEMENT_METHODS,
29458
29739
  "codexhost/harness/installation",
29459
29740
  "codexhost/harness/installation/start",
@@ -29793,28 +30074,16 @@ var extensionActivitySchema = external_exports.strictObject({
29793
30074
  })).max(256)
29794
30075
  });
29795
30076
 
29796
- // ../../shared-contracts/dist/voice.js
29797
- var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
29798
- var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
29799
- var voiceStatusResultSchema = external_exports.object({ available: external_exports.boolean() }).strict();
29800
- var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
29801
- var voiceErrorCodeSchema = external_exports.enum([
29802
- "credentials-unavailable",
29803
- "login-expired",
29804
- "rate-limited",
29805
- "service-rejected",
29806
- "host-incompatible",
29807
- "network",
29808
- "timeout",
29809
- "audio-empty",
29810
- "audio-too-large",
29811
- "audio-format",
29812
- "audio-invalid"
29813
- ]);
29814
- var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
29815
- external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
29816
- external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
29817
- ]);
30077
+ // ../../shared-contracts/dist/host-extension-ranking.js
30078
+ var DAY_MS = 24 * 60 * 60 * 1e3;
30079
+ var CATEGORY_SEARCH_LABELS = Object.freeze({
30080
+ appearance: ["appearance", "外观主题"],
30081
+ interface: ["interface", "界面增强"],
30082
+ workflow: ["workflow", "效率与协作"],
30083
+ analytics: ["analytics", "数据与统计"],
30084
+ integrations: ["integrations", "外部集成"],
30085
+ tools: ["tools", "实用工具"]
30086
+ });
29818
30087
 
29819
30088
  // ../../shared-contracts/dist/skills.js
29820
30089
  var skillsListParamsSchema = external_exports.object({
@@ -30123,7 +30392,13 @@ var remotePeerCapabilitiesSchema = external_exports.object({
30123
30392
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
30124
30393
  delegation: external_exports.literal(1).optional(),
30125
30394
  /** POST /api/peer/v1/peers is available. */
30126
- peerPairing: external_exports.literal(1).optional()
30395
+ peerPairing: external_exports.literal(1).optional(),
30396
+ /** Host supports includeOperations on extensions/list and expectedVersion on extensions/update. */
30397
+ extensionUpdateTracking: external_exports.literal(1).optional(),
30398
+ /** Peer supports per-member `showInSidebar` in `codexhost/groups/member/update`. */
30399
+ groupMemberSidebarVisibility: external_exports.literal(1).optional(),
30400
+ /** Peer supports `codexhost/groups/memory/read` and `codexhost/groups/memory/update`. */
30401
+ groupSharedMemory: external_exports.literal(1).optional()
30127
30402
  });
30128
30403
  var remotePeerManifestSchema = external_exports.object({
30129
30404
  version: external_exports.string().max(128),
@@ -40882,8 +41157,140 @@ var EFFORT_LABELS = /* @__PURE__ */ new Map([
40882
41157
  ["high", "High"],
40883
41158
  ["xhigh", "XHigh"]
40884
41159
  ]);
40885
- var EFFORT_SUFFIX_PATTERN = /^(?<base>.+)-(?<effort>low|medium|high|xhigh)$/u;
41160
+ var EFFORT_SUFFIX_PATTERN = /^(?<base>.+)[:-](?<effort>low|medium|high|xhigh)$/u;
40886
41161
  var EFFORT_LABEL_SUFFIX_PATTERN = /\s*\((?:low|medium|high|xhigh)\)$/iu;
41162
+ function stripEffortLabel(label) {
41163
+ const trimmed = label.trim();
41164
+ return trimmed.replace(EFFORT_LABEL_SUFFIX_PATTERN, "").trim() || trimmed;
41165
+ }
41166
+ function normalizeModelNameKey(name) {
41167
+ return name.trim().replace(/\s+/gu, " ").toLowerCase();
41168
+ }
41169
+ function toAcpModelSlug(name) {
41170
+ return name.trim().toLowerCase().replace(/\s+/gu, "-");
41171
+ }
41172
+ function stripRouteGroupSuffix(value) {
41173
+ return value.replace(/(?:\s+|-)·.*$/u, "").trim();
41174
+ }
41175
+ function stripProviderPrefix(id2) {
41176
+ const slash = id2.indexOf("/");
41177
+ return slash >= 0 ? id2.slice(slash + 1) : id2;
41178
+ }
41179
+ function groupAvailableModels(availableModels) {
41180
+ const grouped = /* @__PURE__ */ new Map();
41181
+ for (const entry of availableModels) {
41182
+ const split = safeSplitAntigravityModelAndEffort(entry.modelId);
41183
+ if (!split)
41184
+ continue;
41185
+ const list = grouped.get(split.modelRef.id) ?? [];
41186
+ list.push(entry);
41187
+ grouped.set(split.modelRef.id, list);
41188
+ }
41189
+ const groups = [];
41190
+ for (const [baseId, entries] of grouped) {
41191
+ const sole = entries.length === 1 ? entries[0] : void 0;
41192
+ const soleSplit = sole ? safeSplitAntigravityModelAndEffort(sole.modelId) : void 0;
41193
+ const canonicalId = sole && soleSplit?.effort ? sole.modelId : baseId;
41194
+ const baseNames = /* @__PURE__ */ new Set();
41195
+ const rawNames = /* @__PURE__ */ new Set();
41196
+ for (const entry of entries) {
41197
+ const trimmed = entry.name.trim();
41198
+ if (trimmed) {
41199
+ rawNames.add(trimmed);
41200
+ baseNames.add(stripEffortLabel(trimmed));
41201
+ }
41202
+ }
41203
+ groups.push({ canonicalId, baseNames, rawNames });
41204
+ }
41205
+ return groups;
41206
+ }
41207
+ function canonicalModelIdForAcpChoice(acpValue, acpName, availableModels = [], catalog) {
41208
+ const trimmedValue = acpValue.trim();
41209
+ if (!trimmedValue)
41210
+ return acpValue;
41211
+ const trimmedName = acpName?.trim();
41212
+ const isBakedInChoice = Boolean(safeSplitAntigravityModelAndEffort(trimmedValue)?.effort) || trimmedName !== void 0 && stripEffortLabel(trimmedName) !== trimmedName;
41213
+ if (availableModels.length > 0) {
41214
+ const groups = groupAvailableModels(availableModels);
41215
+ if (groups.some((group) => group.canonicalId === trimmedValue)) {
41216
+ return trimmedValue;
41217
+ }
41218
+ if (isBakedInChoice) {
41219
+ return trimmedValue;
41220
+ }
41221
+ const exactAvailable = availableModels.find((entry) => entry.modelId === trimmedValue);
41222
+ if (exactAvailable) {
41223
+ const split = safeSplitAntigravityModelAndEffort(exactAvailable.modelId);
41224
+ const group = split ? groups.find((candidate) => candidate.canonicalId === split.modelRef.id || candidate.canonicalId === exactAvailable.modelId) : void 0;
41225
+ if (group)
41226
+ return group.canonicalId;
41227
+ }
41228
+ const targetNameKey = trimmedName ? normalizeModelNameKey(trimmedName) : void 0;
41229
+ const targetBaseNameKey = trimmedName ? normalizeModelNameKey(stripEffortLabel(trimmedName)) : void 0;
41230
+ const targetValueSlug = trimmedValue.toLowerCase();
41231
+ const matchedIds = /* @__PURE__ */ new Set();
41232
+ for (const group of groups) {
41233
+ const nameMatched = targetNameKey !== void 0 && ([...group.rawNames].some((name) => normalizeModelNameKey(name) === targetNameKey) || [...group.baseNames].some((name) => normalizeModelNameKey(name) === targetNameKey)) || targetBaseNameKey !== void 0 && [...group.baseNames].some((name) => normalizeModelNameKey(name) === targetBaseNameKey);
41234
+ const slugMatched = [...group.baseNames].some((name) => toAcpModelSlug(name) === targetValueSlug) || [...group.rawNames].some((name) => toAcpModelSlug(name) === targetValueSlug);
41235
+ if (nameMatched || slugMatched) {
41236
+ matchedIds.add(group.canonicalId);
41237
+ }
41238
+ }
41239
+ if (matchedIds.size === 1) {
41240
+ const [only] = matchedIds;
41241
+ if (only)
41242
+ return only;
41243
+ }
41244
+ }
41245
+ if (isBakedInChoice) {
41246
+ return trimmedValue;
41247
+ }
41248
+ if (catalog) {
41249
+ if (catalog.models.some(({ ref }) => ref.id === trimmedValue)) {
41250
+ return trimmedValue;
41251
+ }
41252
+ const targetNameKey = trimmedName ? normalizeModelNameKey(trimmedName) : void 0;
41253
+ const targetBaseNameKey = trimmedName ? normalizeModelNameKey(stripEffortLabel(trimmedName)) : void 0;
41254
+ const targetValueSlug = trimmedValue.toLowerCase();
41255
+ const matchedIds = /* @__PURE__ */ new Set();
41256
+ for (const model2 of catalog.models) {
41257
+ const label = model2.label.trim();
41258
+ const baseLabel = stripEffortLabel(label);
41259
+ const nameMatched = targetNameKey !== void 0 && (normalizeModelNameKey(label) === targetNameKey || normalizeModelNameKey(baseLabel) === targetNameKey) || targetBaseNameKey !== void 0 && normalizeModelNameKey(baseLabel) === targetBaseNameKey;
41260
+ const slugMatched = toAcpModelSlug(baseLabel) === targetValueSlug || toAcpModelSlug(label) === targetValueSlug;
41261
+ if (nameMatched || slugMatched) {
41262
+ matchedIds.add(model2.ref.id);
41263
+ }
41264
+ }
41265
+ if (matchedIds.size === 1) {
41266
+ const [only] = matchedIds;
41267
+ if (only)
41268
+ return only;
41269
+ }
41270
+ }
41271
+ return trimmedValue;
41272
+ }
41273
+ function buildCanonicalAcpChoiceMap(options, availableModels = [], catalog) {
41274
+ const tentative = options.map(({ value, name }) => ({
41275
+ value,
41276
+ canonicalId: canonicalModelIdForAcpChoice(value, name, availableModels, catalog)
41277
+ }));
41278
+ const counts = /* @__PURE__ */ new Map();
41279
+ for (const entry of tentative) {
41280
+ counts.set(entry.canonicalId, (counts.get(entry.canonicalId) ?? 0) + 1);
41281
+ }
41282
+ const resolved = /* @__PURE__ */ new Map();
41283
+ for (const entry of tentative) {
41284
+ const trimmedValue = entry.value.trim();
41285
+ const candidateId = (counts.get(entry.canonicalId) ?? 0) === 1 ? entry.canonicalId : trimmedValue;
41286
+ if (candidateId !== trimmedValue && availableModels.length > 0 && resolveAntigravityAcpModelSelection(options, availableModels, candidateId)?.targetValue !== entry.value) {
41287
+ resolved.set(entry.value, trimmedValue);
41288
+ continue;
41289
+ }
41290
+ resolved.set(entry.value, candidateId);
41291
+ }
41292
+ return resolved;
41293
+ }
40887
41294
  function listedModel(line) {
40888
41295
  const separator = line.indexOf(" ");
40889
41296
  if (separator <= 0)
@@ -40900,7 +41307,7 @@ function listedModel(line) {
40900
41307
  rawId: id2,
40901
41308
  rawLabel: label,
40902
41309
  baseId: match.groups.base,
40903
- baseLabel: label.replace(EFFORT_LABEL_SUFFIX_PATTERN, "").trim() || label,
41310
+ baseLabel: stripEffortLabel(label),
40904
41311
  effort: match.groups.effort
40905
41312
  };
40906
41313
  }
@@ -40985,11 +41392,16 @@ function parseAntigravityAcpModelCatalog(availableModels, configOptions = []) {
40985
41392
  id: harnessThinkingOptionIdSchema.parse(value),
40986
41393
  label: name
40987
41394
  }));
40988
- const listed = modelOption?.options.map(({ value, name }) => ({ modelId: value, name })) ?? availableModels;
41395
+ const canonicalChoices = modelOption ? buildCanonicalAcpChoiceMap(modelOption.options, availableModels) : void 0;
41396
+ const listed = modelOption?.options.map(({ value, name }) => ({
41397
+ modelId: canonicalChoices?.get(value) ?? value,
41398
+ name
41399
+ })) ?? availableModels;
40989
41400
  const first = listed[0];
40990
41401
  if (!first)
40991
41402
  throw new Error("Antigravity ACP returned no usable Models");
40992
- const currentModelId = modelOption?.currentValue ?? first.modelId;
41403
+ const currentChoice = modelOption?.options.find(({ value }) => value === modelOption.currentValue);
41404
+ const currentModelId = modelOption ? canonicalChoices?.get(modelOption.currentValue) ?? canonicalModelIdForAcpChoice(modelOption.currentValue, currentChoice?.name, availableModels) : first.modelId;
40993
41405
  return harnessModelCatalogSchema.parse({
40994
41406
  models: listed.map(({ modelId: modelId2, name }) => ({
40995
41407
  ref: { id: modelId2 },
@@ -41002,11 +41414,15 @@ function parseAntigravityAcpModelCatalog(availableModels, configOptions = []) {
41002
41414
  ...thoughtOption && thinkingOptions.some(({ id: id2 }) => id2 === thoughtOption.currentValue) ? { defaultThinkingOptionId: thoughtOption.currentValue } : {}
41003
41415
  });
41004
41416
  }
41005
- function readAcpEffectiveModelState(configOptions, catalog) {
41417
+ function readAcpEffectiveModelState(configOptions, catalog, availableModels = []) {
41006
41418
  const model2 = configOptions?.find(({ id: id2 }) => id2 === "model");
41007
41419
  const thought = configOptions?.find(({ id: id2 }) => id2 === "thought_level");
41008
- const effectiveModel = model2 ? harnessModelRefSchema.parse({ id: model2.currentValue }) : void 0;
41009
- const resolvedModelLabel = model2?.options.find(({ value }) => value === model2.currentValue)?.name ?? catalog?.models.find(({ ref }) => ref.id === effectiveModel?.id)?.resolvedModelLabel;
41420
+ const currentChoice = model2?.options.find(({ value }) => value === model2.currentValue);
41421
+ const canonicalChoices = model2 ? buildCanonicalAcpChoiceMap(model2.options, availableModels, catalog) : void 0;
41422
+ const effectiveModel = model2 ? harnessModelRefSchema.parse({
41423
+ id: canonicalChoices?.get(model2.currentValue) ?? canonicalModelIdForAcpChoice(model2.currentValue, currentChoice?.name, availableModels, catalog)
41424
+ }) : void 0;
41425
+ const resolvedModelLabel = currentChoice?.name ?? catalog?.models.find(({ ref }) => ref.id === effectiveModel?.id)?.resolvedModelLabel;
41010
41426
  const availableThinkingOptions = thought ? thought.options.map(({ value, name }) => ({
41011
41427
  id: harnessThinkingOptionIdSchema.parse(value),
41012
41428
  label: name
@@ -41019,8 +41435,12 @@ function readAcpEffectiveModelState(configOptions, catalog) {
41019
41435
  ...availableThinkingOptions ? { availableThinkingOptions } : {}
41020
41436
  };
41021
41437
  }
41022
- function splitAntigravityModelAndEffort(rawModelId) {
41023
- const match = EFFORT_SUFFIX_PATTERN.exec(rawModelId.trim());
41438
+ function safeSplitAntigravityModelAndEffort(rawModelId) {
41439
+ const trimmed = rawModelId.trim();
41440
+ const parsed = harnessModelRefSchema.safeParse({ id: trimmed });
41441
+ if (!parsed.success)
41442
+ return void 0;
41443
+ const match = EFFORT_SUFFIX_PATTERN.exec(trimmed);
41024
41444
  if (match?.groups?.base && match.groups.effort) {
41025
41445
  const baseRef = harnessModelRefSchema.safeParse({ id: match.groups.base });
41026
41446
  const effortId = harnessThinkingOptionIdSchema.safeParse(match.groups.effort);
@@ -41028,8 +41448,474 @@ function splitAntigravityModelAndEffort(rawModelId) {
41028
41448
  return { modelRef: baseRef.data, effort: effortId.data };
41029
41449
  }
41030
41450
  }
41451
+ return { modelRef: parsed.data };
41452
+ }
41453
+ function splitAntigravityModelAndEffort(rawModelId) {
41454
+ const parsed = safeSplitAntigravityModelAndEffort(rawModelId);
41455
+ if (parsed)
41456
+ return parsed;
41031
41457
  return { modelRef: harnessModelRefSchema.parse({ id: rawModelId.trim() }) };
41032
41458
  }
41459
+ function normalizeAntigravityStoredModelRef(ref, catalog) {
41460
+ const exact = catalog.models.find(({ ref: candidate }) => candidate.id === ref.id);
41461
+ if (exact)
41462
+ return exact.ref;
41463
+ const split = splitAntigravityModelAndEffort(ref.id);
41464
+ if (split.effort) {
41465
+ const byBase = catalog.models.find(({ ref: candidate }) => candidate.id === split.modelRef.id);
41466
+ if (byBase)
41467
+ return byBase.ref;
41468
+ }
41469
+ if (split.modelRef.id.includes("/")) {
41470
+ return void 0;
41471
+ }
41472
+ const targetKeys = /* @__PURE__ */ new Set([ref.id.trim().toLowerCase()]);
41473
+ if (split.effort) {
41474
+ targetKeys.add(split.modelRef.id.trim().toLowerCase());
41475
+ }
41476
+ const slugMatches = catalog.models.filter((model2) => {
41477
+ const label = model2.label.trim();
41478
+ const baseLabel = stripEffortLabel(label);
41479
+ return targetKeys.has(toAcpModelSlug(label)) || targetKeys.has(toAcpModelSlug(baseLabel)) || targetKeys.has(normalizeModelNameKey(label)) || targetKeys.has(normalizeModelNameKey(baseLabel));
41480
+ });
41481
+ if (slugMatches.length === 1 && slugMatches[0]) {
41482
+ return slugMatches[0].ref;
41483
+ }
41484
+ if (slugMatches.length > 1) {
41485
+ return void 0;
41486
+ }
41487
+ const strippedBase = toAcpModelSlug(stripRouteGroupSuffix(split.modelRef.id));
41488
+ if (!strippedBase)
41489
+ return void 0;
41490
+ const renamedGroupMatches = catalog.models.filter((model2) => {
41491
+ const candidateIdBase = toAcpModelSlug(stripRouteGroupSuffix(stripProviderPrefix(splitAntigravityModelAndEffort(model2.ref.id).modelRef.id)));
41492
+ const candidateLabelBase = toAcpModelSlug(stripRouteGroupSuffix(stripEffortLabel(model2.label)));
41493
+ return candidateIdBase === strippedBase || candidateLabelBase === strippedBase;
41494
+ });
41495
+ if (renamedGroupMatches.length === 1 && renamedGroupMatches[0]) {
41496
+ return renamedGroupMatches[0].ref;
41497
+ }
41498
+ return void 0;
41499
+ }
41500
+ function collectCatalogBaseIds(availableModels) {
41501
+ const baseIds = /* @__PURE__ */ new Set();
41502
+ for (const entry of availableModels) {
41503
+ const split = safeSplitAntigravityModelAndEffort(entry.modelId);
41504
+ if (split?.effort) {
41505
+ baseIds.add(split.modelRef.id);
41506
+ }
41507
+ }
41508
+ return baseIds;
41509
+ }
41510
+ function catalogEntryBaseId(entry, baseIdsWithVariants) {
41511
+ const trimmedId = entry.modelId.trim();
41512
+ if (baseIdsWithVariants.has(trimmedId)) {
41513
+ return trimmedId;
41514
+ }
41515
+ return safeSplitAntigravityModelAndEffort(entry.modelId)?.modelRef.id;
41516
+ }
41517
+ function catalogEntryEffortForBase(entry, baseId, baseIdsWithVariants) {
41518
+ const trimmedId = entry.modelId.trim();
41519
+ if (trimmedId === baseId || baseIdsWithVariants?.has(trimmedId))
41520
+ return void 0;
41521
+ const entrySplit = safeSplitAntigravityModelAndEffort(entry.modelId);
41522
+ return entrySplit?.effort && entrySplit.modelRef.id === baseId ? entrySplit.effort : void 0;
41523
+ }
41524
+ function collectGroupEfforts(entries, baseId, baseIdsWithVariants) {
41525
+ const efforts = /* @__PURE__ */ new Set();
41526
+ for (const entry of entries) {
41527
+ const effort = catalogEntryEffortForBase(entry, baseId, baseIdsWithVariants);
41528
+ if (effort) {
41529
+ efforts.add(effort);
41530
+ }
41531
+ }
41532
+ return efforts;
41533
+ }
41534
+ function hasCatalogDisplayNameConflict(availableModels, baseIdsWithVariants, displayName, expectedBaseId, mode) {
41535
+ const targetKey = normalizeModelNameKey(displayName);
41536
+ if (!targetKey)
41537
+ return false;
41538
+ const targetBaseKey = normalizeModelNameKey(stripEffortLabel(displayName));
41539
+ const matchingBaseIds = /* @__PURE__ */ new Set();
41540
+ const matchingExactModelIds = /* @__PURE__ */ new Set();
41541
+ for (const entry of availableModels) {
41542
+ const entryBaseId = catalogEntryBaseId(entry, baseIdsWithVariants);
41543
+ if (!entryBaseId)
41544
+ continue;
41545
+ const entryNameKey = normalizeModelNameKey(entry.name);
41546
+ const entryBaseKey = normalizeModelNameKey(stripEffortLabel(entry.name));
41547
+ if (mode === "base") {
41548
+ if (entryBaseKey === targetKey) {
41549
+ matchingBaseIds.add(entryBaseId);
41550
+ }
41551
+ } else if (entryNameKey === targetKey) {
41552
+ matchingBaseIds.add(entryBaseId);
41553
+ matchingExactModelIds.add(entry.modelId);
41554
+ } else if (entryBaseKey === targetKey) {
41555
+ matchingBaseIds.add(entryBaseId);
41556
+ }
41557
+ }
41558
+ if (matchingBaseIds.size > 1)
41559
+ return true;
41560
+ if (matchingBaseIds.size === 1 && !matchingBaseIds.has(expectedBaseId))
41561
+ return true;
41562
+ if (mode === "exact" && targetBaseKey !== targetKey && matchingExactModelIds.size > 1) {
41563
+ return true;
41564
+ }
41565
+ return false;
41566
+ }
41567
+ function hasCatalogSlugConflict(availableModels, baseIdsWithVariants, displayName, expectedBaseId, mode) {
41568
+ const targetSlug = toAcpModelSlug(displayName);
41569
+ if (!targetSlug)
41570
+ return false;
41571
+ const targetBaseSlug = toAcpModelSlug(stripEffortLabel(displayName));
41572
+ const matchingBaseIds = /* @__PURE__ */ new Set();
41573
+ const matchingExactModelIds = /* @__PURE__ */ new Set();
41574
+ for (const entry of availableModels) {
41575
+ const entryBaseId = catalogEntryBaseId(entry, baseIdsWithVariants);
41576
+ if (!entryBaseId)
41577
+ continue;
41578
+ const entrySlug = toAcpModelSlug(entry.name);
41579
+ const entryBaseSlug = toAcpModelSlug(stripEffortLabel(entry.name));
41580
+ if (mode === "base") {
41581
+ if (entryBaseSlug === targetSlug) {
41582
+ matchingBaseIds.add(entryBaseId);
41583
+ }
41584
+ } else if (entrySlug === targetSlug) {
41585
+ matchingBaseIds.add(entryBaseId);
41586
+ matchingExactModelIds.add(entry.modelId);
41587
+ } else if (entryBaseSlug === targetSlug) {
41588
+ matchingBaseIds.add(entryBaseId);
41589
+ }
41590
+ }
41591
+ if (matchingBaseIds.size > 1)
41592
+ return true;
41593
+ if (matchingBaseIds.size === 1 && !matchingBaseIds.has(expectedBaseId))
41594
+ return true;
41595
+ if (mode === "exact" && targetBaseSlug !== targetSlug && matchingExactModelIds.size > 1) {
41596
+ return true;
41597
+ }
41598
+ return false;
41599
+ }
41600
+ function isChoiceClaimedByOtherCatalogModel(choice, availableModels, baseIdsWithVariants, expectedBaseId) {
41601
+ const choiceValue = choice.value.trim();
41602
+ const choiceName = choice.name.trim();
41603
+ const choiceKey = normalizeModelNameKey(choiceName);
41604
+ const choiceHasEffortLabel = choiceKey !== "" && stripEffortLabel(choiceName) !== choiceName;
41605
+ for (const entry of availableModels) {
41606
+ const entryBaseId = catalogEntryBaseId(entry, baseIdsWithVariants);
41607
+ if (!entryBaseId || entryBaseId === expectedBaseId)
41608
+ continue;
41609
+ const entryModelId = entry.modelId.trim();
41610
+ if (choiceValue && (entryModelId === choiceValue || entryBaseId === choiceValue)) {
41611
+ return true;
41612
+ }
41613
+ if (!choiceKey)
41614
+ continue;
41615
+ const entryKey = normalizeModelNameKey(entry.name);
41616
+ const entryBaseKey = normalizeModelNameKey(stripEffortLabel(entry.name));
41617
+ if (entryKey === choiceKey || !choiceHasEffortLabel && entryBaseKey === choiceKey) {
41618
+ return true;
41619
+ }
41620
+ }
41621
+ return false;
41622
+ }
41623
+ function isNonBakedInBaseChoice(choice, baseIdsWithVariants) {
41624
+ const choiceValue = choice.value.trim();
41625
+ const choiceName = choice.name.trim();
41626
+ return stripEffortLabel(choiceName) === choiceName && (baseIdsWithVariants.has(choiceValue) || !safeSplitAntigravityModelAndEffort(choiceValue)?.effort);
41627
+ }
41628
+ function matchModelChoiceByName(options, availableModels, baseIdsWithVariants, name, expectedBaseId, mode) {
41629
+ const targetKey = normalizeModelNameKey(name);
41630
+ if (!targetKey)
41631
+ return { ambiguous: false };
41632
+ if (hasCatalogDisplayNameConflict(availableModels, baseIdsWithVariants, name, expectedBaseId, mode)) {
41633
+ return { ambiguous: true };
41634
+ }
41635
+ const targetSlug = toAcpModelSlug(name);
41636
+ const nameMatches = options.filter((choice) => {
41637
+ if (normalizeModelNameKey(choice.name) !== targetKey)
41638
+ return false;
41639
+ if (mode === "base") {
41640
+ return isNonBakedInBaseChoice(choice, baseIdsWithVariants);
41641
+ }
41642
+ return true;
41643
+ });
41644
+ if (nameMatches.length > 0) {
41645
+ if (nameMatches.length === 1 && nameMatches[0]) {
41646
+ return { matched: nameMatches[0], ambiguous: false };
41647
+ }
41648
+ return { ambiguous: true };
41649
+ }
41650
+ const slugMatches = options.filter((choice) => {
41651
+ const choiceValue = choice.value.trim();
41652
+ if (choiceValue.toLowerCase() !== targetSlug)
41653
+ return false;
41654
+ if (isChoiceClaimedByOtherCatalogModel(choice, availableModels, baseIdsWithVariants, expectedBaseId)) {
41655
+ return false;
41656
+ }
41657
+ if (mode === "base") {
41658
+ return isNonBakedInBaseChoice(choice, baseIdsWithVariants);
41659
+ }
41660
+ return true;
41661
+ });
41662
+ if (slugMatches.length === 0)
41663
+ return { ambiguous: false };
41664
+ if (hasCatalogSlugConflict(availableModels, baseIdsWithVariants, name, expectedBaseId, mode)) {
41665
+ return { ambiguous: true };
41666
+ }
41667
+ if (slugMatches.length === 1 && slugMatches[0]) {
41668
+ return { matched: slugMatches[0], ambiguous: false };
41669
+ }
41670
+ return { ambiguous: true };
41671
+ }
41672
+ function findBakedInVariants(options, baseId, baseIdsWithVariants = /* @__PURE__ */ new Set()) {
41673
+ return options.filter((choice) => {
41674
+ const choiceValue = choice.value.trim();
41675
+ if (baseIdsWithVariants.has(choiceValue))
41676
+ return false;
41677
+ const separator = choiceValue[baseId.length];
41678
+ return choiceValue.startsWith(baseId) && (separator === "-" || separator === ":") && /^(?:low|medium|high|xhigh)$/u.test(choiceValue.slice(baseId.length + 1));
41679
+ });
41680
+ }
41681
+ function findBakedInOption(options, baseId, effort, baseIdsWithVariants = /* @__PURE__ */ new Set()) {
41682
+ return options.find((choice) => {
41683
+ const choiceValue = choice.value.trim();
41684
+ if (baseIdsWithVariants.has(choiceValue))
41685
+ return false;
41686
+ return choiceValue === `${baseId}-${effort}` || choiceValue === `${baseId}:${effort}`;
41687
+ });
41688
+ }
41689
+ function resolveExactOptionSelection(context) {
41690
+ const { options, baseIdsWithVariants, requestedModelId, requestedThinking, split, hasExplicitEffortConflict, splitGroupEntries } = context;
41691
+ const exactOption = options.find((choice) => choice.value === requestedModelId);
41692
+ if (!exactOption)
41693
+ return void 0;
41694
+ if (!hasExplicitEffortConflict || !requestedThinking) {
41695
+ return { targetValue: exactOption.value, bakedInThinking: false };
41696
+ }
41697
+ const siblingBaked = findBakedInOption(options, split.modelRef.id, requestedThinking, baseIdsWithVariants);
41698
+ if (siblingBaked) {
41699
+ return { targetValue: siblingBaked.value, bakedInThinking: true };
41700
+ }
41701
+ const requestedTrimmed = requestedModelId.trim();
41702
+ const hasSiblingCatalogEntry = splitGroupEntries.some((entry) => entry.modelId.trim() !== requestedTrimmed);
41703
+ const isStandaloneCatalogVariant = splitGroupEntries.length === 1 && splitGroupEntries[0]?.modelId.trim() === requestedTrimmed;
41704
+ const isBakedInExactOption = requestedModelId.includes(":") && !isStandaloneCatalogVariant || options.some((choice) => choice.value === split.modelRef.id) || findBakedInVariants(options, split.modelRef.id, baseIdsWithVariants).length > 1 || hasSiblingCatalogEntry;
41705
+ if (!isBakedInExactOption) {
41706
+ return { targetValue: exactOption.value, bakedInThinking: false };
41707
+ }
41708
+ return void 0;
41709
+ }
41710
+ function resolveExplicitEffortOverride(context) {
41711
+ const { options, availableModels, baseIdsWithVariants, requestedThinking, split, hasExplicitEffortConflict, splitGroupEntries } = context;
41712
+ if (!hasExplicitEffortConflict || !requestedThinking) {
41713
+ return { handled: false };
41714
+ }
41715
+ const bakedOverride = findBakedInOption(options, split.modelRef.id, requestedThinking, baseIdsWithVariants);
41716
+ if (bakedOverride) {
41717
+ return {
41718
+ handled: true,
41719
+ resolution: { targetValue: bakedOverride.value, bakedInThinking: true }
41720
+ };
41721
+ }
41722
+ if (splitGroupEntries.length === 0) {
41723
+ return { handled: false };
41724
+ }
41725
+ const matchingEntries = splitGroupEntries.filter((entry) => catalogEntryEffortForBase(entry, split.modelRef.id, baseIdsWithVariants) === requestedThinking);
41726
+ if (matchingEntries.length !== 1 || !matchingEntries[0]) {
41727
+ return { handled: true };
41728
+ }
41729
+ const targetRawName = matchingEntries[0].name.trim();
41730
+ const targetExactMatch = matchModelChoiceByName(options, availableModels, baseIdsWithVariants, targetRawName, split.modelRef.id, "exact");
41731
+ if (targetExactMatch.matched) {
41732
+ const bakedIn = stripEffortLabel(targetRawName) !== targetRawName || Boolean(safeSplitAntigravityModelAndEffort(targetExactMatch.matched.value)?.effort);
41733
+ return {
41734
+ handled: true,
41735
+ resolution: {
41736
+ targetValue: targetExactMatch.matched.value,
41737
+ bakedInThinking: bakedIn
41738
+ }
41739
+ };
41740
+ }
41741
+ if (!targetExactMatch.ambiguous) {
41742
+ const targetBaseName = stripEffortLabel(targetRawName);
41743
+ if (targetBaseName !== targetRawName) {
41744
+ const targetBaseMatch = matchModelChoiceByName(options, availableModels, baseIdsWithVariants, targetBaseName, split.modelRef.id, "base");
41745
+ if (targetBaseMatch.matched) {
41746
+ return {
41747
+ handled: true,
41748
+ resolution: {
41749
+ targetValue: targetBaseMatch.matched.value,
41750
+ bakedInThinking: false
41751
+ }
41752
+ };
41753
+ }
41754
+ }
41755
+ }
41756
+ return { handled: true };
41757
+ }
41758
+ function resolveExactAvailableSelection(context) {
41759
+ const { options, availableModels, baseIdsWithVariants, requestedModelId, split, isRequestedBaseModel } = context;
41760
+ const exactAvailable = availableModels.find((entry) => entry.modelId === requestedModelId);
41761
+ if (!exactAvailable)
41762
+ return { ambiguous: false };
41763
+ const expectedBaseId = catalogEntryBaseId(exactAvailable, baseIdsWithVariants);
41764
+ if (!expectedBaseId)
41765
+ return { ambiguous: false };
41766
+ const rawName = exactAvailable.name.trim();
41767
+ const exactNameMatch = matchModelChoiceByName(options, availableModels, baseIdsWithVariants, rawName, expectedBaseId, "exact");
41768
+ if (exactNameMatch.matched) {
41769
+ const bakedIn = !isRequestedBaseModel && Boolean(split.effort) && (stripEffortLabel(rawName) !== rawName || Boolean(safeSplitAntigravityModelAndEffort(exactNameMatch.matched.value)?.effort));
41770
+ return {
41771
+ ambiguous: false,
41772
+ resolution: {
41773
+ targetValue: exactNameMatch.matched.value,
41774
+ ...!bakedIn && !isRequestedBaseModel && split.effort ? { impliedThinking: split.effort } : {},
41775
+ bakedInThinking: bakedIn
41776
+ }
41777
+ };
41778
+ }
41779
+ if (exactNameMatch.ambiguous) {
41780
+ return { ambiguous: true };
41781
+ }
41782
+ const baseName = stripEffortLabel(rawName);
41783
+ if (baseName !== rawName) {
41784
+ const baseNameMatch = matchModelChoiceByName(options, availableModels, baseIdsWithVariants, baseName, expectedBaseId, "base");
41785
+ if (baseNameMatch.matched) {
41786
+ return {
41787
+ ambiguous: false,
41788
+ resolution: {
41789
+ targetValue: baseNameMatch.matched.value,
41790
+ ...!isRequestedBaseModel && split.effort ? { impliedThinking: split.effort } : {},
41791
+ bakedInThinking: false
41792
+ }
41793
+ };
41794
+ }
41795
+ if (baseNameMatch.ambiguous) {
41796
+ return { ambiguous: true };
41797
+ }
41798
+ }
41799
+ return { ambiguous: false };
41800
+ }
41801
+ function resolveGroupedCatalogSelection(context) {
41802
+ const { options, availableModels, baseIdsWithVariants, requestedModelId, requestedThinking, split, requestedGroupEntries, splitGroupEntries } = context;
41803
+ const matchedRequestedGroup = requestedGroupEntries.length > 0;
41804
+ const groupEntries = matchedRequestedGroup ? requestedGroupEntries : splitGroupEntries;
41805
+ const expectedBaseId = matchedRequestedGroup ? requestedModelId : split.modelRef.id;
41806
+ if (groupEntries.length === 0)
41807
+ return void 0;
41808
+ const impliedThinking = !matchedRequestedGroup ? split.effort : void 0;
41809
+ const targetEffort = requestedThinking ?? impliedThinking;
41810
+ const offeredEfforts = collectGroupEfforts(groupEntries, expectedBaseId, baseIdsWithVariants);
41811
+ if (!matchedRequestedGroup && targetEffort && offeredEfforts.size > 0 && !offeredEfforts.has(targetEffort)) {
41812
+ return void 0;
41813
+ }
41814
+ const baseNames = /* @__PURE__ */ new Map();
41815
+ for (const entry of groupEntries) {
41816
+ const baseName = stripEffortLabel(entry.name);
41817
+ const key = normalizeModelNameKey(baseName);
41818
+ if (key && !baseNames.has(key)) {
41819
+ baseNames.set(key, baseName);
41820
+ }
41821
+ }
41822
+ if (baseNames.size === 1) {
41823
+ const [baseName] = baseNames.values();
41824
+ const baseNameMatch = baseName ? matchModelChoiceByName(options, availableModels, baseIdsWithVariants, baseName, expectedBaseId, "base") : void 0;
41825
+ if (baseNameMatch?.matched) {
41826
+ return {
41827
+ targetValue: baseNameMatch.matched.value,
41828
+ ...impliedThinking && !requestedThinking ? { impliedThinking } : {},
41829
+ bakedInThinking: false
41830
+ };
41831
+ }
41832
+ }
41833
+ if (targetEffort && offeredEfforts.size > 0 && !offeredEfforts.has(targetEffort)) {
41834
+ return void 0;
41835
+ }
41836
+ const targetEntry = targetEffort ? (() => {
41837
+ const matching = groupEntries.filter((entry) => catalogEntryEffortForBase(entry, expectedBaseId, baseIdsWithVariants) === targetEffort);
41838
+ return matching.length === 1 ? matching[0] : void 0;
41839
+ })() : groupEntries.length === 1 ? groupEntries[0] : void 0;
41840
+ if (!targetEntry)
41841
+ return void 0;
41842
+ const targetEntryEffort = catalogEntryEffortForBase(targetEntry, expectedBaseId, baseIdsWithVariants);
41843
+ const targetNameMatch = matchModelChoiceByName(options, availableModels, baseIdsWithVariants, targetEntry.name, expectedBaseId, "exact");
41844
+ if (!targetNameMatch.matched)
41845
+ return void 0;
41846
+ return {
41847
+ targetValue: targetNameMatch.matched.value,
41848
+ bakedInThinking: Boolean(targetEntryEffort)
41849
+ };
41850
+ }
41851
+ function resolveAntigravityAcpModelSelection(options, availableModels, requestedModelId, requestedThinking) {
41852
+ const split = splitAntigravityModelAndEffort(requestedModelId);
41853
+ const baseIdsWithVariants = collectCatalogBaseIds(availableModels);
41854
+ const requestedVariants = findBakedInVariants(options, requestedModelId, baseIdsWithVariants);
41855
+ const requestedHasVariantEntries = availableModels.some((entry) => Boolean(catalogEntryEffortForBase(entry, requestedModelId, baseIdsWithVariants)));
41856
+ const isRequestedBaseModel = requestedVariants.length > 0 || requestedHasVariantEntries;
41857
+ const requestedGroupEntries = availableModels.filter((entry) => catalogEntryBaseId(entry, baseIdsWithVariants) === requestedModelId);
41858
+ const splitGroupEntries = !isRequestedBaseModel && split.effort ? availableModels.filter((entry) => catalogEntryBaseId(entry, baseIdsWithVariants) === split.modelRef.id) : [];
41859
+ const splitOfferedEfforts = collectGroupEfforts(splitGroupEntries, split.modelRef.id, baseIdsWithVariants);
41860
+ const hasExplicitEffortConflict = !isRequestedBaseModel && Boolean(split.effort) && Boolean(requestedThinking) && requestedThinking !== split.effort;
41861
+ const context = {
41862
+ options,
41863
+ availableModels,
41864
+ baseIdsWithVariants,
41865
+ requestedModelId,
41866
+ requestedThinking,
41867
+ split,
41868
+ isRequestedBaseModel,
41869
+ hasExplicitEffortConflict,
41870
+ requestedGroupEntries,
41871
+ splitGroupEntries,
41872
+ splitOfferedEfforts
41873
+ };
41874
+ const exactOptionResolution = resolveExactOptionSelection(context);
41875
+ if (exactOptionResolution)
41876
+ return exactOptionResolution;
41877
+ if (split.effort && !isRequestedBaseModel && options.some((choice) => choice.value === split.modelRef.id)) {
41878
+ const targetEffort = requestedThinking ?? split.effort;
41879
+ if (splitOfferedEfforts.size > 0 && !splitOfferedEfforts.has(targetEffort)) {
41880
+ return void 0;
41881
+ }
41882
+ return {
41883
+ targetValue: split.modelRef.id,
41884
+ ...requestedThinking ? {} : { impliedThinking: split.effort },
41885
+ bakedInThinking: false
41886
+ };
41887
+ }
41888
+ const overrideResult = resolveExplicitEffortOverride(context);
41889
+ if (overrideResult.handled)
41890
+ return overrideResult.resolution;
41891
+ const exactAvailableResult = resolveExactAvailableSelection(context);
41892
+ if (exactAvailableResult.resolution)
41893
+ return exactAvailableResult.resolution;
41894
+ if (!exactAvailableResult.ambiguous) {
41895
+ const groupedResolution = resolveGroupedCatalogSelection(context);
41896
+ if (groupedResolution)
41897
+ return groupedResolution;
41898
+ }
41899
+ if (requestedVariants.length > 0) {
41900
+ if (requestedThinking) {
41901
+ const baked = findBakedInOption(requestedVariants, requestedModelId, requestedThinking, baseIdsWithVariants);
41902
+ if (baked) {
41903
+ return { targetValue: baked.value, bakedInThinking: true };
41904
+ }
41905
+ } else if (requestedVariants.length === 1 && requestedVariants[0]) {
41906
+ return { targetValue: requestedVariants[0].value, bakedInThinking: true };
41907
+ }
41908
+ return void 0;
41909
+ }
41910
+ if (split.effort && !isRequestedBaseModel) {
41911
+ const bakedEffort = requestedThinking ?? split.effort;
41912
+ const baked = findBakedInOption(options, split.modelRef.id, bakedEffort, baseIdsWithVariants);
41913
+ if (baked) {
41914
+ return { targetValue: baked.value, bakedInThinking: true };
41915
+ }
41916
+ }
41917
+ return void 0;
41918
+ }
41033
41919
 
41034
41920
  // dist/wake-observer.js
41035
41921
  var WAKE_COMMIT_POLL_DELAYS_MS = [150, 250, 400, 600, 1e3];
@@ -42266,6 +43152,7 @@ var AntigravitySession = class {
42266
43152
  #unsavedPromptWindows = [];
42267
43153
  #promptWindowWrites = Promise.resolve();
42268
43154
  #toolOwners = /* @__PURE__ */ new Map();
43155
+ #settledToolCallIds = /* @__PURE__ */ new Set();
42269
43156
  #pending = /* @__PURE__ */ new Map();
42270
43157
  #usage;
42271
43158
  #usageWork;
@@ -42519,9 +43406,18 @@ var AntigravitySession = class {
42519
43406
  if (this.#requested.model) {
42520
43407
  const applied = await this.#setModelConfig(this.#requested.model.id, this.#requested.thinkingOptionId);
42521
43408
  if (!applied.bakedInThinking) {
42522
- const desiredThinking = this.#resolveThinkingChoice(this.#requested.thinkingOptionId ?? applied.impliedThinking);
42523
- if (desiredThinking) {
42524
- await this.#setConfig("thinking", desiredThinking);
43409
+ if (this.#requested.thinkingOptionId) {
43410
+ const desiredThinking = this.#resolveThinkingChoice(this.#requested.thinkingOptionId);
43411
+ if (desiredThinking) {
43412
+ await this.#setConfig("thinking", desiredThinking);
43413
+ }
43414
+ } else if (applied.impliedThinking) {
43415
+ await this.#setConfig("thinking", applied.impliedThinking);
43416
+ } else {
43417
+ const desiredThinking = this.#resolveThinkingChoice();
43418
+ if (desiredThinking) {
43419
+ await this.#setConfig("thinking", desiredThinking);
43420
+ }
42525
43421
  }
42526
43422
  }
42527
43423
  } else if (this.#requested.thinkingOptionId && this.#hasConfigChoice("thinking", this.#requested.thinkingOptionId)) {
@@ -42584,7 +43480,7 @@ var AntigravitySession = class {
42584
43480
  executionPolicy: this.#options.unattended ? "unattended-full-access" : "default",
42585
43481
  permissionModeId: skip ? SKIP : opened.modes?.currentModeId ?? "default"
42586
43482
  };
42587
- const effective = readAcpEffectiveModelState(this.#configOptions, this.#catalog);
43483
+ const effective = readAcpEffectiveModelState(this.#configOptions, this.#catalog, this.#availableModels);
42588
43484
  if (!effective.effectiveModel && opened.models?.currentModelId) {
42589
43485
  const current = splitAntigravityModelAndEffort(opened.models.currentModelId);
42590
43486
  effective.effectiveModel = current.modelRef;
@@ -42610,7 +43506,7 @@ var AntigravitySession = class {
42610
43506
  this.#state = {
42611
43507
  ...nativeRef ? { nativeRef } : {},
42612
43508
  ...effectivePermissionModeId ? { effectivePermissionModeId } : {},
42613
- ...readAcpEffectiveModelState(config2, this.#catalog)
43509
+ ...readAcpEffectiveModelState(config2, this.#catalog, this.#availableModels)
42614
43510
  };
42615
43511
  this.#syncUsageModel(true);
42616
43512
  }
@@ -42634,29 +43530,14 @@ var AntigravitySession = class {
42634
43530
  if (!option) {
42635
43531
  throw new AntigravityTransportError("unsupported", `Antigravity does not offer model=${requestedModelId}`);
42636
43532
  }
42637
- let targetValue = requestedModelId;
42638
- let impliedThinking;
42639
- let bakedInThinking = false;
42640
- if (!option.options.some((choice) => choice.value === requestedModelId)) {
42641
- const split = splitAntigravityModelAndEffort(requestedModelId);
42642
- if (split.effort && option.options.some((choice) => choice.value === split.modelRef.id)) {
42643
- targetValue = split.modelRef.id;
42644
- impliedThinking = split.effort;
42645
- } else if (requestedThinking && option.options.some((choice) => choice.value === `${requestedModelId}-${requestedThinking}`)) {
42646
- targetValue = `${requestedModelId}-${requestedThinking}`;
42647
- bakedInThinking = true;
42648
- } else {
42649
- const variants = option.options.filter((choice) => choice.value.startsWith(`${requestedModelId}-`) && /^(?:low|medium|high|xhigh)$/u.test(choice.value.slice(requestedModelId.length + 1)));
42650
- if (!requestedThinking && variants.length === 1 && variants[0]) {
42651
- targetValue = variants[0].value;
42652
- bakedInThinking = true;
42653
- }
42654
- }
43533
+ const resolved = resolveAntigravityAcpModelSelection(option.options, this.#availableModels, requestedModelId, requestedThinking);
43534
+ if (!resolved) {
43535
+ throw new AntigravityTransportError("unsupported", `Antigravity does not offer model=${requestedModelId}`);
42655
43536
  }
42656
- await this.#setConfig("model", targetValue);
43537
+ await this.#setConfig("model", resolved.targetValue);
42657
43538
  return {
42658
- ...impliedThinking ? { impliedThinking } : {},
42659
- bakedInThinking
43539
+ ...resolved.impliedThinking ? { impliedThinking: resolved.impliedThinking } : {},
43540
+ bakedInThinking: resolved.bakedInThinking
42660
43541
  };
42661
43542
  }
42662
43543
  async #setConfig(category, value) {
@@ -42678,6 +43559,10 @@ var AntigravitySession = class {
42678
43559
  this.#handleToolEvent(owner, event);
42679
43560
  return;
42680
43561
  }
43562
+ if (event.type === "tool.call")
43563
+ this.#settledToolCallIds.delete(event.toolCallId);
43564
+ else if (this.#settledToolCallIds.has(event.toolCallId))
43565
+ return;
42681
43566
  }
42682
43567
  if ((event.type === "agent.text" || event.type === "agent.thought") && event.text.trim() || event.type === "tool.call" || event.type === "tool.update") {
42683
43568
  if (this.#opening || this.#historyOperation || this.#active?.cancelled)
@@ -43114,9 +43999,13 @@ var AntigravitySession = class {
43114
43999
  const applied = await this.#setModelConfig(command.model.id);
43115
44000
  try {
43116
44001
  if (!applied.bakedInThinking) {
43117
- const desiredThinking = this.#resolveThinkingChoice(applied.impliedThinking);
43118
- if (desiredThinking) {
43119
- await this.#setConfig("thinking", desiredThinking);
44002
+ if (applied.impliedThinking) {
44003
+ await this.#setConfig("thinking", applied.impliedThinking);
44004
+ } else {
44005
+ const desiredThinking = this.#resolveThinkingChoice();
44006
+ if (desiredThinking) {
44007
+ await this.#setConfig("thinking", desiredThinking);
44008
+ }
43120
44009
  }
43121
44010
  }
43122
44011
  } finally {
@@ -43372,9 +44261,19 @@ var AntigravitySession = class {
43372
44261
  #isCurrent(turn) {
43373
44262
  return this.#active === turn && !turn.ended;
43374
44263
  }
44264
+ #markToolSettled(toolCallId) {
44265
+ this.#settledToolCallIds.delete(toolCallId);
44266
+ this.#settledToolCallIds.add(toolCallId);
44267
+ if (this.#settledToolCallIds.size > 256) {
44268
+ const oldest = this.#settledToolCallIds.values().next().value;
44269
+ if (oldest !== void 0)
44270
+ this.#settledToolCallIds.delete(oldest);
44271
+ }
44272
+ }
43375
44273
  #handleToolEvent(turn, event) {
43376
44274
  if (!event.toolCallId || !turn.tracker || turn.cancelled || turn.ended && !turn.detachedToolCallIds.has(event.toolCallId))
43377
44275
  return;
44276
+ this.#settledToolCallIds.delete(event.toolCallId);
43378
44277
  this.#toolOwners.set(event.toolCallId, turn);
43379
44278
  turn.hasToolCalls = true;
43380
44279
  if (event.status === "completed" || event.status === "failed")
@@ -43383,6 +44282,7 @@ var AntigravitySession = class {
43383
44282
  if (event.status === "completed" || event.status === "failed") {
43384
44283
  turn.detachedToolCallIds.delete(event.toolCallId);
43385
44284
  this.#toolOwners.delete(event.toolCallId);
44285
+ this.#markToolSettled(event.toolCallId);
43386
44286
  }
43387
44287
  }
43388
44288
  #appendText(turn, type, text3) {
@@ -43503,8 +44403,10 @@ var AntigravitySession = class {
43503
44403
  this.#closeInteractions("cancelled", turn, outcome.status === "succeeded");
43504
44404
  turn.tracker?.finishPending(outcome);
43505
44405
  for (const [toolCallId, owner] of this.#toolOwners) {
43506
- if (owner === turn && !turn.detachedToolCallIds.has(toolCallId))
44406
+ if (owner === turn && !turn.detachedToolCallIds.has(toolCallId)) {
43507
44407
  this.#toolOwners.delete(toolCallId);
44408
+ this.#markToolSettled(toolCallId);
44409
+ }
43508
44410
  }
43509
44411
  turn.ended = true;
43510
44412
  this.#active = void 0;
@@ -43752,6 +44654,7 @@ var AntigravityAdapter = class {
43752
44654
  harnessId = harnessId;
43753
44655
  commandCatalog = ANTIGRAVITY_COMMAND_CATALOG;
43754
44656
  liveCommandCatalog = true;
44657
+ normalizeStoredModelRef = normalizeAntigravityStoredModelRef;
43755
44658
  sessionImport;
43756
44659
  usageStatistics;
43757
44660
  #environment;