@chibitek/chibi 0.1.162 → 0.1.168

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 (104) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-D0_WX2x_.js → abnfDiagram-O67JEVCF-DUyzT6Xq.js} +1 -1
  2. package/dist/assets/{arc-lzBXqTbJ.js → arc-B4-kO642.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-KQZbO2M3.js → architectureDiagram-NJMV4G6O-DgKdnNL2.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-zb3pW64Y.js → blockDiagram-BEXU5L5S-B6oV3kDr.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-CADaXczd.js → c4Diagram-YGBWAQC7-Dp0E43jx.js} +1 -1
  6. package/dist/assets/channel-BidDehbw.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-DJP27cEp.js → chunk-2Q5K7J3B-Cfv1WVUo.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-Cp9Z7Ybl.js → chunk-3FUC2YCW-_-STY2yO.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-DjXxom_0.js → chunk-5VM5RSS4-C6MZm1cm.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-DpEJ08zA.js → chunk-GTNCS2PH-C__aVIJy.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-CQ4Kadr-.js → chunk-GWA4HPMP-fSrARJuB.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-CwXmVMdh.js → chunk-JWPE2WC7-CJioJB6h.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-Vl_kib_R.js → chunk-NETBCI7D-o6MBGCq_.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-BhAVbfJe.js → chunk-WEXAMYUT-O-TFLbdc.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-s1a4nKQE.js → chunk-XXDRQBXY-DYS9CQbl.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-DeGQSNky.js → classDiagram-v2-NBCMYWYE-BC4bSH09.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-D5sUHYFG.js → cose-bilkent-JH36ORCC-7NKuC3-C.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-DmTvN9T2.js → cynefin-OW5HDTMX-CuWv5cOw.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-Cqtt1jCF.js → cynefinDiagram-VND7K2PF-D_l_JrG5.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-DRZKkSJg.js → dagre-6A5THRUB-D7eucSmr.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-1od4dKOU.js → diagram-22UHCM2B-CADR5v1e.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-D3_yCQOJ.js → diagram-3UASUU5V-DF_fBOZn.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-D9UgsVGC.js → diagram-ATOU4E4O-DE5p59WH.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-DMxsJ_X5.js → diagram-CDSNMT55-vthvYooA.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-CK47Pp3D.js → diagram-MLGK6HIB-ByMHy4S-.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-D0axYDk-.js → diagram-MPIPVDR6-C9hKBUnO.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-hkbV8j2o.js → ebnfDiagram-ZINNZB2B-Djv6hWEl.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-DL9jncwy.js → elk-276RUBZZ-CmUjf18z.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-etb_6SR6.js → erDiagram-OPXOYQCR-DkmXQUok.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-4Dgg4I8f.js → flowDiagram-KWPJA3E3-6pz2poYn.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-DRBB4AaO.js → ganttDiagram-FUAMR5RP-Cx9Fbw75.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-CzgKN-tE.js → gitGraphDiagram-X574FWY7-BR5MsYkP.js} +1 -1
  33. package/dist/assets/{index-BT2giPxq.js → index-BoF5cGZq.js} +1 -1
  34. package/dist/assets/index-COwCaN7p.css +1 -0
  35. package/dist/assets/{index-fHtcwzVK.js → index-Ckv52eaP.js} +178 -179
  36. package/dist/assets/{infoDiagram-VRGFBTTK-DwpjLCMe.js → infoDiagram-VRGFBTTK-DoF183Am.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-OU5B5YK6-H-CWnU1-.js → ishikawaDiagram-OU5B5YK6-4T_-hM1-.js} +1 -1
  38. package/dist/assets/{journeyDiagram-ZHPQQLJL-CY-oDrpq.js → journeyDiagram-ZHPQQLJL-Ca0T3Ngd.js} +1 -1
  39. package/dist/assets/{kanban-definition-PNTS6WVX-DMGIKH3g.js → kanban-definition-PNTS6WVX-DNp_DAr9.js} +1 -1
  40. package/dist/assets/{linear-BHhtTLK8.js → linear-COUoS2bF.js} +1 -1
  41. package/dist/assets/{mermaid.core-BWK_Ui3n.js → mermaid.core-DQHowMIV.js} +5 -5
  42. package/dist/assets/{mindmap-definition-NLK3R4M7-Cc17hw2c.js → mindmap-definition-NLK3R4M7-CMgO1Mkh.js} +1 -1
  43. package/dist/assets/{pegDiagram-GJSIUBJH-BqFjUBJK.js → pegDiagram-GJSIUBJH-BCVCZbsq.js} +1 -1
  44. package/dist/assets/{pieDiagram-5QR66LMP-ikmgTCa3.js → pieDiagram-5QR66LMP-DxaMlX62.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-O4NWA36T-CC3s5Dsc.js → quadrantDiagram-O4NWA36T-qUD0pkur.js} +1 -1
  46. package/dist/assets/{railroadDiagram-XR7U4H2S-Dtwf869F.js → railroadDiagram-XR7U4H2S-Dc6rcAJB.js} +1 -1
  47. package/dist/assets/{requirementDiagram-PLB6GJNP-C5p7AgwQ.js → requirementDiagram-PLB6GJNP-DMTfI_lR.js} +1 -1
  48. package/dist/assets/{sankeyDiagram-IPEJSGJF-8NKN770X.js → sankeyDiagram-IPEJSGJF-B0BWZys8.js} +1 -1
  49. package/dist/assets/{sequenceDiagram-PO4LG4MO-DQucgrWO.js → sequenceDiagram-PO4LG4MO-DZVt17mL.js} +1 -1
  50. package/dist/assets/{sizeCapture-INFHLROL-Cxmcj9Nl.js → sizeCapture-INFHLROL-BFQztpNW.js} +1 -1
  51. package/dist/assets/{stateDiagram-v2-GCMORJYK-DEdvHXnJ.js → stateDiagram-v2-GCMORJYK-GeFCVCDr.js} +1 -1
  52. package/dist/assets/{swimlanes-2SLR337P-BOGePqj1.js → swimlanes-2SLR337P-DTqQXTvP.js} +1 -1
  53. package/dist/assets/swimlanesDiagram-TC7HE7FX-CRQqFEdH.js +8 -0
  54. package/dist/assets/{timeline-definition-EJHVYXUP-DfpRxJgE.js → timeline-definition-EJHVYXUP-BoiNrkP7.js} +1 -1
  55. package/dist/assets/{usecaseDiagram-POWQR4AR-BOmQFDT4.js → usecaseDiagram-POWQR4AR-CdfsSO2g.js} +1 -1
  56. package/dist/assets/{vennDiagram-UO4OBE2U-84pfbvUi.js → vennDiagram-UO4OBE2U-CHc_Fn1O.js} +1 -1
  57. package/dist/assets/{wardleyDiagram-VNRHLVJA-Cbxnw8ip.js → wardleyDiagram-VNRHLVJA-Bv3KWVEF.js} +1 -1
  58. package/dist/assets/{xychartDiagram-PMCCYNJV-BLiz8vqY.js → xychartDiagram-PMCCYNJV-CQFknLPS.js} +1 -1
  59. package/dist/handbook/atomic-handbook.html +5 -0
  60. package/dist/index.html +2 -2
  61. package/dist-server/container-mcp.js +5 -0
  62. package/dist-server/drivers/agents-proxy.js +65 -41
  63. package/dist-server/index.js +4652 -4232
  64. package/dist-server/openmausbot.js +499 -282
  65. package/dist-server/pair-cli.js +499 -282
  66. package/dist-server/server/auto-approve.js +4 -1
  67. package/dist-server/server/brand.js +11 -0
  68. package/dist-server/server/config.js +13 -18
  69. package/dist-server/server/connection-credential.js +59 -0
  70. package/dist-server/server/container-computer.js +5 -26
  71. package/dist-server/server/credential-card-request.js +52 -0
  72. package/dist-server/server/dictation.js +6 -3
  73. package/dist-server/server/drivers/agents-call.js +3 -23
  74. package/dist-server/server/drivers/agents-catalog.js +2 -20
  75. package/dist-server/server/drivers/agents-credential.js +57 -0
  76. package/dist-server/server/drivers/builtIn.js +9 -1
  77. package/dist-server/server/drivers/claude-elicitation.js +76 -0
  78. package/dist-server/server/drivers/claude-stdin.js +47 -0
  79. package/dist-server/server/drivers/claude.js +23 -39
  80. package/dist-server/server/drivers/codex-elicitation.js +93 -0
  81. package/dist-server/server/drivers/codex.js +41 -107
  82. package/dist-server/server/engine-platform-fleet.js +32 -0
  83. package/dist-server/server/external-room.js +24 -0
  84. package/dist-server/server/index.js +101 -114
  85. package/dist-server/server/mcp-elicitation.js +120 -0
  86. package/dist-server/server/mcp-http.js +52 -2
  87. package/dist-server/server/mcp-probe.js +3 -0
  88. package/dist-server/server/peer-roster.js +43 -0
  89. package/dist-server/server/phone-secret.js +12 -4
  90. package/dist-server/server/routes/dictation.js +6 -1
  91. package/dist-server/server/system-prompt.js +1 -1
  92. package/dist-server/server/text-actions.js +25 -0
  93. package/dist-server/shared/credential-request.js +15 -6
  94. package/dist-server/shared/engine-platforms.js +19 -0
  95. package/dist-server/vps-container-mcp.js +5 -0
  96. package/package.json +1 -1
  97. package/dist/assets/channel-Br57lm8F.js +0 -1
  98. package/dist/assets/index-B2fJMh8N.css +0 -1
  99. package/dist/assets/swimlanesDiagram-TC7HE7FX-BSe9TZ6t.js +0 -8
  100. package/dist-server/connector-proxy.js +0 -205
  101. package/dist-server/server/composio.js +0 -1051
  102. package/dist-server/server/connector-proxy.js +0 -249
  103. package/dist-server/server/mcp-public-registry.js +0 -325
  104. package/dist-server/shared/connector-availability.js +0 -12
@@ -18471,9 +18471,9 @@ var init_image_generation = __esm({
18471
18471
  });
18472
18472
 
18473
18473
  // shared/removed-integration.ts
18474
- function withoutRemovedKey(record5) {
18475
- if (!isRecord(record5) || !Object.hasOwn(record5, REMOVED_INTEGRATION_KEY)) return record5;
18476
- const { [REMOVED_INTEGRATION_KEY]: _removed, ...rest } = record5;
18474
+ function withoutRemovedKey(record6) {
18475
+ if (!isRecord(record6) || !Object.hasOwn(record6, REMOVED_INTEGRATION_KEY)) return record6;
18476
+ const { [REMOVED_INTEGRATION_KEY]: _removed, ...rest } = record6;
18477
18477
  return rest;
18478
18478
  }
18479
18479
  function configWithoutRemovedIntegration(document) {
@@ -20072,6 +20072,37 @@ var init_schema = __esm({
20072
20072
  }
20073
20073
  });
20074
20074
 
20075
+ // shared/engine-platforms.ts
20076
+ function engineOnPlatform(driverKind, platform) {
20077
+ return !(ENGINES_OFF_BY_PLATFORM[platform] ?? []).includes(driverKind);
20078
+ }
20079
+ var ENGINES_OFF_BY_PLATFORM;
20080
+ var init_engine_platforms = __esm({
20081
+ "shared/engine-platforms.ts"() {
20082
+ "use strict";
20083
+ ENGINES_OFF_BY_PLATFORM = Object.freeze({
20084
+ win32: Object.freeze(["qwenAgent"])
20085
+ });
20086
+ }
20087
+ });
20088
+
20089
+ // server/engine-platform-fleet.ts
20090
+ function onDeviceFleet(platform = process.platform, arch = process.arch) {
20091
+ return platform === "darwin" && arch === "arm64" ? { appleIntelligence: { driver: "appleIntelligence", displayName: "Apple Intelligence (on this Mac)" } } : {};
20092
+ }
20093
+ function dropEnginesOffPlatform(map3, platform) {
20094
+ for (const [id, entry] of Object.entries(map3)) {
20095
+ if (!engineOnPlatform(entry.driver, platform)) delete map3[id];
20096
+ }
20097
+ return map3;
20098
+ }
20099
+ var init_engine_platform_fleet = __esm({
20100
+ "server/engine-platform-fleet.ts"() {
20101
+ "use strict";
20102
+ init_engine_platforms();
20103
+ }
20104
+ });
20105
+
20075
20106
  // server/config.ts
20076
20107
  import { readFileSync as readFileSync4, mkdirSync as mkdirSync6, existsSync as existsSync8, renameSync as renameSync3 } from "node:fs";
20077
20108
  import { homedir as homedir5 } from "node:os";
@@ -20217,7 +20248,9 @@ function loadConfig() {
20217
20248
  let cfg = {};
20218
20249
  try {
20219
20250
  cfg = parseStoredConfig(parseJson(readFileSync4(join12(DATA_DIR, "config.json"), "utf8")));
20220
- } catch {
20251
+ } catch (error51) {
20252
+ if (error51.code !== "ENOENT")
20253
+ throw new Error("Saved Atomic settings could not be read; config.json has been left untouched.", { cause: error51 });
20221
20254
  }
20222
20255
  if (cfg.mcpServers) cfg.mcpServers = hydrateMcpServers(cfg.mcpServers);
20223
20256
  cfg.mistral = { ...cfg.mistral };
@@ -20268,9 +20301,10 @@ function saveConfig(patch, options = {}) {
20268
20301
  const p3 = join12(DATA_DIR, "config.json");
20269
20302
  let disk = {};
20270
20303
  try {
20271
- const parsed = jsonObjectSchema.safeParse(parseJson(readFileSync4(p3, "utf8")));
20272
- if (parsed.success) disk = configWithoutRemovedIntegration(parsed.data).document;
20273
- } catch {
20304
+ disk = configWithoutRemovedIntegration(jsonObjectSchema.parse(parseJson(readFileSync4(p3, "utf8")))).document;
20305
+ } catch (error51) {
20306
+ if (error51.code !== "ENOENT")
20307
+ throw new Error("Cannot save over unreadable Atomic settings; config.json has been left untouched.", { cause: error51 });
20274
20308
  }
20275
20309
  const checkedPatch = appConfigSchema.partial().extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional() }).parse(patch);
20276
20310
  const before = configSaveListeners.size ? structuredClone(disk) : disk;
@@ -20399,9 +20433,6 @@ function injectedEnvironment(cfg, driver) {
20399
20433
  if (driver === "opencodeGo" && cfg.opencodeGo?.apiKey) environment.set("OPENCODE_API_KEY", cfg.opencodeGo.apiKey);
20400
20434
  return environment;
20401
20435
  }
20402
- function onDeviceFleet(platform = process.platform, arch = process.arch) {
20403
- return platform === "darwin" && arch === "arm64" ? { appleIntelligence: { driver: "appleIntelligence", displayName: "Apple Intelligence (on this Mac)" } } : {};
20404
- }
20405
20436
  function plainObject2(value) {
20406
20437
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
20407
20438
  }
@@ -20422,7 +20453,7 @@ function separateClaudeLogin(instanceId, entry) {
20422
20453
  const configDir2 = plainObject2(entry.config)?.configDir;
20423
20454
  return typeof configDir2 === "string" && configDir2.trim() !== "";
20424
20455
  }
20425
- function instanceConfigs(cfg, onDevice = onDeviceFleet(), accountKeys = instanceKeys()) {
20456
+ function instanceConfigs(cfg, onDevice = onDeviceFleet(), accountKeys = instanceKeys(), platform = process.platform) {
20426
20457
  const DEFAULT_FLEET = {
20427
20458
  grok: { driver: "grokAgent" },
20428
20459
  kimi: { driver: "kimiAgent" },
@@ -20468,6 +20499,7 @@ function instanceConfigs(cfg, onDevice = onDeviceFleet(), accountKeys = instance
20468
20499
  for (const [id, fallback] of Object.entries(ATOMIC_FLEET)) {
20469
20500
  if (Object.hasOwn(map3, id)) map3[id] = withFleetDefaults(map3[id], fallback);
20470
20501
  }
20502
+ dropEnginesOffPlatform(map3, platform);
20471
20503
  for (const [id, sourceEntry] of Object.entries(map3)) {
20472
20504
  const entry = { ...sourceEntry };
20473
20505
  map3[id] = entry;
@@ -20517,6 +20549,7 @@ var init_config = __esm({
20517
20549
  init_mcp_secrets2();
20518
20550
  init_mcp_secrets();
20519
20551
  init_schema();
20552
+ init_engine_platform_fleet();
20520
20553
  optionalText = external_exports.string().optional();
20521
20554
  SSH_ALIAS = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
20522
20555
  LEGACY_BROWSER_PROFILE_ID = /^[A-Za-z0-9_-]{1,40}$/;
@@ -21018,14 +21051,14 @@ function parseRecord(path4, invalidMessage, validate) {
21018
21051
  if (error51?.code === "ENOENT") return null;
21019
21052
  throw leaseError("Atomic cannot read the data-directory lease; refusing to start to protect its state.", error51);
21020
21053
  }
21021
- let record5;
21054
+ let record6;
21022
21055
  try {
21023
- record5 = JSON.parse(raw);
21056
+ record6 = JSON.parse(raw);
21024
21057
  } catch (error51) {
21025
21058
  throw leaseError(invalidMessage, error51);
21026
21059
  }
21027
- if (!validate(record5)) throw leaseError(invalidMessage);
21028
- return record5;
21060
+ if (!validate(record6)) throw leaseError(invalidMessage);
21061
+ return record6;
21029
21062
  }
21030
21063
  function readOwner(path4) {
21031
21064
  return parseRecord(
@@ -21105,10 +21138,10 @@ function unlinkExact(path4, message2) {
21105
21138
  if (error51?.code !== "ENOENT") throw leaseError(message2, error51);
21106
21139
  }
21107
21140
  }
21108
- function publishRecord(path4, record5, prepareMessage, acquireMessage) {
21109
- const candidatePath = `${path4}.candidate-${record5.pid}-${record5.token}`;
21141
+ function publishRecord(path4, record6, prepareMessage, acquireMessage) {
21142
+ const candidatePath = `${path4}.candidate-${record6.pid}-${record6.token}`;
21110
21143
  try {
21111
- writeFileSync4(candidatePath, `${JSON.stringify(record5)}
21144
+ writeFileSync4(candidatePath, `${JSON.stringify(record6)}
21112
21145
  `, { flag: "wx", mode: 384, flush: true });
21113
21146
  } catch (error51) {
21114
21147
  throw leaseError(prepareMessage, error51);
@@ -24986,10 +25019,10 @@ function readUnslothKey(env) {
24986
25019
  }
24987
25020
  function idsFromModelsPayload(payload) {
24988
25021
  const records = Array.isArray(payload) ? payload : payload && typeof payload === "object" && Array.isArray(payload.data) ? payload.data : payload && typeof payload === "object" && Array.isArray(payload.models) ? payload.models : [];
24989
- return records.flatMap((record5) => {
24990
- if (typeof record5 === "string") return MODEL_ID.test(record5) ? [record5] : [];
24991
- if (!record5 || typeof record5 !== "object") return [];
24992
- const id = record5.id ?? record5.name;
25022
+ return records.flatMap((record6) => {
25023
+ if (typeof record6 === "string") return MODEL_ID.test(record6) ? [record6] : [];
25024
+ if (!record6 || typeof record6 !== "object") return [];
25025
+ const id = record6.id ?? record6.name;
24993
25026
  if (typeof id !== "string" || !MODEL_ID.test(id)) return [];
24994
25027
  const low = id.toLowerCase();
24995
25028
  if (low.includes("embed") || low.includes("bge-") || low.includes("nomic")) return [];
@@ -26258,9 +26291,9 @@ ${value.slice(-limit)}`;
26258
26291
  });
26259
26292
  }
26260
26293
  if (!value || typeof value !== "object") return value;
26261
- const record5 = value;
26262
- return Object.fromEntries(Object.entries(record5).flatMap(([key, entry]) => {
26263
- if (record5.type === "image" && (key === "data" || key === "blob") || key === "blob" && typeof record5.mimeType === "string" && record5.mimeType.startsWith("image/")) return [];
26294
+ const record6 = value;
26295
+ return Object.fromEntries(Object.entries(record6).flatMap(([key, entry]) => {
26296
+ if (record6.type === "image" && (key === "data" || key === "blob") || key === "blob" && typeof record6.mimeType === "string" && record6.mimeType.startsWith("image/")) return [];
26264
26297
  const sanitized = sanitizeToolLogValue(entry, budget, depth + 1);
26265
26298
  return sanitized === void 0 ? [] : [[key, sanitized]];
26266
26299
  }));
@@ -28062,8 +28095,8 @@ async function executableFile(path4, bytes) {
28062
28095
  }
28063
28096
  async function completedRelease(directory, asset) {
28064
28097
  try {
28065
- const record5 = JSON.parse(await readFile3(join21(directory, INSTALL_RECORD), "utf8"));
28066
- if (record5.sha256 !== asset.sha256 || record5.version !== asset.version || record5.executable.name !== asset.executable.name || record5.executable.bytes !== asset.executable.bytes || record5.harness.name !== asset.harness.name || record5.harness.bytes !== asset.harness.bytes) return null;
28098
+ const record6 = JSON.parse(await readFile3(join21(directory, INSTALL_RECORD), "utf8"));
28099
+ if (record6.sha256 !== asset.sha256 || record6.version !== asset.version || record6.executable.name !== asset.executable.name || record6.executable.bytes !== asset.executable.bytes || record6.harness.name !== asset.harness.name || record6.harness.bytes !== asset.harness.bytes) return null;
28067
28100
  const executablePath = join21(directory, asset.executable.name);
28068
28101
  const harnessPath = join21(directory, asset.harness.name);
28069
28102
  if (!await executableFile(executablePath, asset.executable.bytes)) return null;
@@ -28333,13 +28366,13 @@ async function installOnce2(options) {
28333
28366
  await removeQuietly(destination);
28334
28367
  throw error51;
28335
28368
  }
28336
- const record5 = {
28369
+ const record6 = {
28337
28370
  sha256: asset.sha256,
28338
28371
  version: asset.version,
28339
28372
  executable: asset.executable,
28340
28373
  harness: asset.harness
28341
28374
  };
28342
- await writeFile2(join21(destination, INSTALL_RECORD), `${JSON.stringify(record5)}
28375
+ await writeFile2(join21(destination, INSTALL_RECORD), `${JSON.stringify(record6)}
28343
28376
  `, { flag: "wx", mode: 384 });
28344
28377
  const installed = await completedRelease(destination, asset);
28345
28378
  if (!installed) throw new Error("The installed Antigravity runtime is incomplete.");
@@ -29296,6 +29329,177 @@ var init_rtk_rewrite = __esm({
29296
29329
  }
29297
29330
  });
29298
29331
 
29332
+ // server/drivers/claude-stdin.ts
29333
+ import { readFileSync as readFileSync9 } from "node:fs";
29334
+ function claudeUserMessage(text4, images) {
29335
+ if (!images?.length) return { type: "user", message: { role: "user", content: text4 } };
29336
+ const content = images.map((image) => ({
29337
+ type: "image",
29338
+ source: {
29339
+ type: "base64",
29340
+ media_type: image.mime,
29341
+ data: readFileSync9(image.path).toString("base64")
29342
+ }
29343
+ }));
29344
+ if (text4) content.push({ type: "text", text: text4 });
29345
+ return { type: "user", message: { role: "user", content } };
29346
+ }
29347
+ function diagnosticClaudeUserMessage(message2) {
29348
+ if (!Array.isArray(message2.message.content)) return message2;
29349
+ return {
29350
+ ...message2,
29351
+ message: {
29352
+ ...message2.message,
29353
+ content: message2.message.content.map(
29354
+ (block2) => block2.type === "image" ? {
29355
+ ...block2,
29356
+ source: {
29357
+ ...block2.source,
29358
+ data: `[image data: ${block2.source.data.length} base64 chars]`
29359
+ }
29360
+ } : block2
29361
+ )
29362
+ }
29363
+ };
29364
+ }
29365
+ function claudeControlResponse(requestId, response) {
29366
+ return { type: "control_response", response: { subtype: "success", request_id: requestId, response } };
29367
+ }
29368
+ var init_claude_stdin = __esm({
29369
+ "server/drivers/claude-stdin.ts"() {
29370
+ "use strict";
29371
+ }
29372
+ });
29373
+
29374
+ // server/mcp-elicitation.ts
29375
+ function record2(value) {
29376
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
29377
+ }
29378
+ function isControl(char) {
29379
+ const code = char.codePointAt(0) ?? 0;
29380
+ return code < 32 || code === 127;
29381
+ }
29382
+ function oneLine(value) {
29383
+ if (typeof value !== "string") return null;
29384
+ const text4 = Array.from(value, (char) => isControl(char) ? " " : char).join("").replace(/\s+/g, " ").trim();
29385
+ if (!text4) return null;
29386
+ return text4.length > MAX_MESSAGE ? `${text4.slice(0, MAX_MESSAGE - 1)}\u2026` : text4;
29387
+ }
29388
+ function yesValue(field) {
29389
+ if (field.type === "boolean") return true;
29390
+ if (field.type !== "string") return void 0;
29391
+ const options = Array.isArray(field.enum) ? field.enum : Array.isArray(field.oneOf) ? field.oneOf.map((option) => record2(option)?.const) : [];
29392
+ const strings3 = options.filter((option) => typeof option === "string");
29393
+ if (strings3.length < 1 || strings3.length > 4) return void 0;
29394
+ const yes = strings3.filter((option) => YES.test(option.trim()));
29395
+ return yes.length === 1 ? yes[0] : void 0;
29396
+ }
29397
+ function elicitationConfirm(params) {
29398
+ const request = record2(params);
29399
+ if (!request) return null;
29400
+ if (request.mode !== void 0 && request.mode !== "form") return null;
29401
+ const message2 = oneLine(request.message);
29402
+ if (!message2) return null;
29403
+ const rawSchema = request.requestedSchema ?? request.requested_schema;
29404
+ if (rawSchema === void 0 || rawSchema === null) return { message: message2, content: {} };
29405
+ const schema4 = record2(rawSchema);
29406
+ if (!schema4 || schema4.type !== void 0 && schema4.type !== "object") return null;
29407
+ const properties = schema4.properties === void 0 ? {} : record2(schema4.properties);
29408
+ if (!properties) return null;
29409
+ const names = Object.keys(properties);
29410
+ if (names.length === 0) return { message: message2, content: {} };
29411
+ if (names.length !== 1) return null;
29412
+ const name = names[0];
29413
+ const field = record2(properties[name]);
29414
+ if (!field) return null;
29415
+ const yes = yesValue(field);
29416
+ return yes === void 0 ? null : { message: message2, content: { [name]: yes } };
29417
+ }
29418
+ function elicitationAnswer(confirm2, allowed) {
29419
+ return allowed ? { action: "accept", content: confirm2.content } : { action: "decline" };
29420
+ }
29421
+ function elicitationSummary(server, confirm2) {
29422
+ const name = oneLine(server);
29423
+ return name ? `${name} asks: ${confirm2.message}` : confirm2.message;
29424
+ }
29425
+ function elicitationTool(server) {
29426
+ return `${ELICITATION_TOOL_PREFIX}${oneLine(server)?.replace(/\s+/g, "_") ?? "mcp"}`;
29427
+ }
29428
+ var MAX_MESSAGE, YES, ELICITATION_TOOL_PREFIX;
29429
+ var init_mcp_elicitation = __esm({
29430
+ "server/mcp-elicitation.ts"() {
29431
+ "use strict";
29432
+ MAX_MESSAGE = 600;
29433
+ YES = /^(yes|y|true|confirm|confirmed|approve|approved|accept|accepted|allow|proceed|continue|ok)$/i;
29434
+ ELICITATION_TOOL_PREFIX = "mcp_elicitation__";
29435
+ }
29436
+ });
29437
+
29438
+ // server/drivers/claude-elicitation.ts
29439
+ function createClaudeElicitations(deps) {
29440
+ const open2 = /* @__PURE__ */ new Map();
29441
+ return {
29442
+ /** A control_request frame from the CLI's stdout. True when it was an
29443
+ * elicitation (answered now or once the person decides). */
29444
+ handle(frame, ctx) {
29445
+ const o = frame;
29446
+ if (!o || o.request?.subtype !== "elicitation") return false;
29447
+ if (typeof o.request_id !== "string") return true;
29448
+ const controlId = o.request_id;
29449
+ const reply = (result) => ctx.write(claudeControlResponse(controlId, result));
29450
+ const confirm2 = elicitationConfirm(o.request);
29451
+ if (!confirm2 || ctx.closing) {
29452
+ reply({ action: "cancel" });
29453
+ return true;
29454
+ }
29455
+ const server = typeof o.request.mcp_server_name === "string" ? o.request.mcp_server_name : void 0;
29456
+ const requestId = newId();
29457
+ const finish = (allowed, source2) => {
29458
+ if (!open2.delete(requestId)) return;
29459
+ clearTimeout(timer);
29460
+ reply(allowed === null ? { action: "cancel" } : elicitationAnswer(confirm2, allowed));
29461
+ deps.emit({ ...deps.base(ctx.threadId, ctx.turnId), type: "request.resolved", requestId, behavior: allowed ? "allow" : "deny", source: source2 });
29462
+ };
29463
+ const timer = setTimeout(() => finish(null, "timeout"), deps.timeoutMs ?? ELICITATION_TIMEOUT_MS);
29464
+ timer.unref?.();
29465
+ open2.set(requestId, { threadId: ctx.threadId, finish });
29466
+ deps.emit({
29467
+ ...deps.base(ctx.threadId, ctx.turnId),
29468
+ type: "request.opened",
29469
+ requestId,
29470
+ requestType: "permission",
29471
+ tool: elicitationTool(server),
29472
+ summary: elicitationSummary(server, confirm2),
29473
+ requiresExplicitApproval: true
29474
+ });
29475
+ return true;
29476
+ },
29477
+ /** The person's answer to a card, or null when the card is not one of these. */
29478
+ respond(threadId, requestId, decision) {
29479
+ const entry = open2.get(requestId);
29480
+ if (!entry) return null;
29481
+ if (entry.threadId !== threadId) return "unavailable";
29482
+ const allowed = decision.behavior === "allow";
29483
+ entry.finish(allowed, "user");
29484
+ return allowed ? "allowed-once" : "rejected";
29485
+ },
29486
+ /** The session ended: every open question goes back as "no answer". */
29487
+ endThread(threadId) {
29488
+ for (const entry of Array.from(open2.values())) if (entry.threadId === threadId) entry.finish(null, "system");
29489
+ }
29490
+ };
29491
+ }
29492
+ var ELICITATION_TIMEOUT_MS;
29493
+ var init_claude_elicitation = __esm({
29494
+ "server/drivers/claude-elicitation.ts"() {
29495
+ "use strict";
29496
+ init_contracts();
29497
+ init_mcp_elicitation();
29498
+ init_claude_stdin();
29499
+ ELICITATION_TIMEOUT_MS = 15 * 6e4;
29500
+ }
29501
+ });
29502
+
29299
29503
  // shared/ask-question.ts
29300
29504
  function text3(value, limit) {
29301
29505
  if (typeof value !== "string") return void 0;
@@ -29402,7 +29606,7 @@ var init_ask_question = __esm({
29402
29606
 
29403
29607
  // server/drivers/claude.ts
29404
29608
  import { createHash as createHash7, randomBytes as randomBytes2 } from "node:crypto";
29405
- import { chmodSync as chmodSync4, existsSync as existsSync13, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync3, readFileSync as readFileSync9, rmSync as rmSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync7 } from "node:fs";
29609
+ import { chmodSync as chmodSync4, existsSync as existsSync13, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync3, readFileSync as readFileSync10, rmSync as rmSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync7 } from "node:fs";
29406
29610
  import { createServer as createNetServer } from "node:net";
29407
29611
  import { homedir as homedir9, tmpdir as tmpdir3 } from "node:os";
29408
29612
  import { join as join23, dirname as dirname9, isAbsolute as isAbsolute4, normalize } from "node:path";
@@ -29461,7 +29665,7 @@ function claudeInheritWarning(env) {
29461
29665
  function readClaudeAuthSettings(env, instanceEnvironment = {}) {
29462
29666
  if (CLAUDE_ACCOUNT_ENV_KEYS.some((key) => instanceEnvironment[key])) return {};
29463
29667
  try {
29464
- const settings2 = JSON.parse(readFileSync9(join23(resolveClaudeConfigDir(void 0, env), "settings.json"), "utf8"));
29668
+ const settings2 = JSON.parse(readFileSync10(join23(resolveClaudeConfigDir(void 0, env), "settings.json"), "utf8"));
29465
29669
  const authEnv = {};
29466
29670
  for (const key of CLAUDE_ACCOUNT_ENV_KEYS) {
29467
29671
  if (!key.endsWith("_FILE_DESCRIPTOR") && typeof settings2?.env?.[key] === "string") {
@@ -29479,7 +29683,7 @@ function readClaudeAuthSettings(env, instanceEnvironment = {}) {
29479
29683
  function projectMcpServers(cwd) {
29480
29684
  let parsed;
29481
29685
  try {
29482
- parsed = JSON.parse(readFileSync9(join23(cwd, ".mcp.json"), "utf8"));
29686
+ parsed = JSON.parse(readFileSync10(join23(cwd, ".mcp.json"), "utf8"));
29483
29687
  } catch {
29484
29688
  return {};
29485
29689
  }
@@ -29552,7 +29756,7 @@ function extrasFromUnknown(value) {
29552
29756
  function readClaudeModelCatalog(env = process.env) {
29553
29757
  let settings2 = {};
29554
29758
  try {
29555
- settings2 = JSON.parse(readFileSync9(join23(resolveClaudeConfigDir(void 0, env), "settings.json"), "utf8"));
29759
+ settings2 = JSON.parse(readFileSync10(join23(resolveClaudeConfigDir(void 0, env), "settings.json"), "utf8"));
29556
29760
  } catch {
29557
29761
  settings2 = {};
29558
29762
  }
@@ -29837,37 +30041,6 @@ function decodeConfig2(raw) {
29837
30041
  ...disallowedTools !== void 0 ? { disallowedTools } : {}
29838
30042
  };
29839
30043
  }
29840
- function claudeUserMessage(text4, images) {
29841
- if (!images?.length) return { type: "user", message: { role: "user", content: text4 } };
29842
- const content = images.map((image) => ({
29843
- type: "image",
29844
- source: {
29845
- type: "base64",
29846
- media_type: image.mime,
29847
- data: readFileSync9(image.path).toString("base64")
29848
- }
29849
- }));
29850
- if (text4) content.push({ type: "text", text: text4 });
29851
- return { type: "user", message: { role: "user", content } };
29852
- }
29853
- function diagnosticClaudeUserMessage(message2) {
29854
- if (!Array.isArray(message2.message.content)) return message2;
29855
- return {
29856
- ...message2,
29857
- message: {
29858
- ...message2.message,
29859
- content: message2.message.content.map(
29860
- (block2) => block2.type === "image" ? {
29861
- ...block2,
29862
- source: {
29863
- ...block2.source,
29864
- data: `[image data: ${block2.source.data.length} base64 chars]`
29865
- }
29866
- } : block2
29867
- )
29868
- }
29869
- };
29870
- }
29871
30044
  var CONNECTOR_CACHE_MS, CLAUDE_ACCOUNT_ENV_KEYS, DEFAULT_AUTOCOMPACT_TOKENS, CLAUDE_FLAG_FLOORS, CLAUDE_CONTEXT_CONTROL_MIN_VERSION, DRIVER_KIND2, HARNESS_REPLACED_BUILTINS, STATIC_CLAUDE_MODELS, CLAUDE_MODEL_ID, PERM_PROXY_PATH, DWEB_PROXY_PATH, HOOK_HELPER_PATH, RTK_HOOK_PATH, NODE_ENV_FLAG, DENY_TIMEOUT_NOTE, QUESTION_TIMEOUT_NOTE, DUPLICATE_ASK_ID_NOTE, NEXUS_PRIVATE_SCOPE_TOOLS, ClaudeDriver;
29872
30045
  var init_claude = __esm({
29873
30046
  "server/drivers/claude.ts"() {
@@ -29892,6 +30065,8 @@ var init_claude = __esm({
29892
30065
  init_rtk_rewrite();
29893
30066
  init_volatile_notes();
29894
30067
  init_mcp_tool_images();
30068
+ init_claude_stdin();
30069
+ init_claude_elicitation();
29895
30070
  init_ask_question();
29896
30071
  CONNECTOR_CACHE_MS = 5 * 60 * 1e3;
29897
30072
  CLAUDE_ACCOUNT_ENV_KEYS = [
@@ -30007,6 +30182,7 @@ var init_claude = __esm({
30007
30182
  const sumCost = (a2, b3) => a2 === null ? b3 : b3 === null ? a2 : a2 + b3;
30008
30183
  const STEER_FOLLOWUP_MS = 1500;
30009
30184
  const sessions = /* @__PURE__ */ new Map();
30185
+ const elicitations = createClaudeElicitations({ emit: (event) => emit(event), base: (threadId, turnId) => base3(threadId, turnId) });
30010
30186
  const sessionAllows = /* @__PURE__ */ new Map();
30011
30187
  const deliveredVolatile = /* @__PURE__ */ new Map();
30012
30188
  const volatileNoteFor = (threadId, sessionId, turn) => {
@@ -30031,6 +30207,7 @@ var init_claude = __esm({
30031
30207
  const s4 = sessions.get(threadId);
30032
30208
  if (!s4 || s4.closing) return;
30033
30209
  s4.closing = true;
30210
+ elicitations.endThread(threadId);
30034
30211
  if (s4.idleTimer) clearTimeout(s4.idleTimer);
30035
30212
  const broker = s4.broker;
30036
30213
  s4.broker = void 0;
@@ -30660,6 +30837,20 @@ var init_claude = __esm({
30660
30837
  }
30661
30838
  break;
30662
30839
  }
30840
+ case "control_request":
30841
+ elicitations.handle(o, {
30842
+ threadId,
30843
+ turnId: currentTurnId(),
30844
+ closing: session.closing,
30845
+ write: (frame) => {
30846
+ try {
30847
+ if (session.child.stdin.writable && !session.child.stdin.destroyed) session.child.stdin.write(JSON.stringify(frame) + "\n");
30848
+ appendNative(threadId, { dir: "out", source: "claude.sdk.message", msg: frame });
30849
+ } catch {
30850
+ }
30851
+ }
30852
+ });
30853
+ break;
30663
30854
  case "user":
30664
30855
  for (const b3 of Array.isArray(o.message?.content) ? o.message.content : []) {
30665
30856
  if (b3.type === "tool_result") {
@@ -31008,6 +31199,8 @@ var init_claude = __esm({
31008
31199
  steer,
31009
31200
  interruptTurn: async (threadId) => active.get(threadId)?.stop(),
31010
31201
  respondToRequest: async (threadId, requestId, decision) => {
31202
+ const confirmation = elicitations.respond(threadId, requestId, decision);
31203
+ if (confirmation) return confirmation;
31011
31204
  const broker = sessions.get(threadId)?.broker ?? active.get(threadId)?.broker;
31012
31205
  if (!broker) return "unavailable";
31013
31206
  const behavior = decision.behavior === "answer" ? "answer" : decision.behavior;
@@ -31264,7 +31457,7 @@ var init_toml_lite = __esm({
31264
31457
  });
31265
31458
 
31266
31459
  // server/mcp-auth-signal.ts
31267
- import { mkdirSync as mkdirSync12, readFileSync as readFileSync10, readdirSync as readdirSync3, renameSync as renameSync7, rmSync as rmSync7, writeFileSync as writeFileSync8 } from "node:fs";
31460
+ import { mkdirSync as mkdirSync12, readFileSync as readFileSync11, readdirSync as readdirSync3, renameSync as renameSync7, rmSync as rmSync7, writeFileSync as writeFileSync8 } from "node:fs";
31268
31461
  import { join as join24 } from "node:path";
31269
31462
  function writeMcpAuthSignal(dir, signal) {
31270
31463
  if (!dir) return;
@@ -31287,7 +31480,7 @@ var init_mcp_auth_signal = __esm({
31287
31480
  });
31288
31481
 
31289
31482
  // server/drivers/codex-mcp-names.ts
31290
- import { readFileSync as readFileSync11 } from "node:fs";
31483
+ import { readFileSync as readFileSync12 } from "node:fs";
31291
31484
  import { homedir as homedir10 } from "node:os";
31292
31485
  import { isAbsolute as isAbsolute5, join as join25, resolve as resolve7 } from "node:path";
31293
31486
  function mcpServerNamesInToml(toml) {
@@ -31321,7 +31514,7 @@ function codexHomeFor(env, cwd) {
31321
31514
  }
31322
31515
  function codexConfigMcpServers(env, cwd) {
31323
31516
  try {
31324
- return mcpServersInToml(readFileSync11(join25(codexHomeFor(env, cwd), "config.toml"), "utf8"));
31517
+ return mcpServersInToml(readFileSync12(join25(codexHomeFor(env, cwd), "config.toml"), "utf8"));
31325
31518
  } catch {
31326
31519
  return /* @__PURE__ */ new Map();
31327
31520
  }
@@ -31567,10 +31760,10 @@ var init_mcp_remote_bridge = __esm({
31567
31760
  // server/mcp-tool-hints.ts
31568
31761
  function toolAnnotations(raw) {
31569
31762
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
31570
- const record5 = raw;
31763
+ const record6 = raw;
31571
31764
  const out = {};
31572
31765
  for (const key of HINT_KEYS) {
31573
- const value = record5[key] ?? record5[SNAKE[key]];
31766
+ const value = record6[key] ?? record6[SNAKE[key]];
31574
31767
  if (typeof value === "boolean") out[key] = value;
31575
31768
  }
31576
31769
  return Object.keys(out).length ? out : void 0;
@@ -31594,8 +31787,76 @@ var init_mcp_tool_hints = __esm({
31594
31787
  }
31595
31788
  });
31596
31789
 
31790
+ // server/drivers/codex-elicitation.ts
31791
+ function boundedLabel(value) {
31792
+ if (typeof value !== "string") return null;
31793
+ const label = value.trim();
31794
+ return label && label.length <= 160 && !containsControlCharacter(label) ? label : null;
31795
+ }
31796
+ function ordinaryApprovalValue(value) {
31797
+ const normalized = value.trim().toLowerCase();
31798
+ if (/session|always|permanent|forever|persistent/.test(normalized)) return false;
31799
+ return normalized === "once" || /^(?:accept|approve|allow)(?:ed|[-_]?once)?$/.test(normalized);
31800
+ }
31801
+ function mcpAppApprovalForm(params) {
31802
+ const request = plainRecord(params);
31803
+ if (!request || request.mode !== "form") return null;
31804
+ const metadata = plainRecord(request._meta);
31805
+ const target = plainRecord(metadata?.target);
31806
+ const toolParams = plainRecord(metadata?.tool_params);
31807
+ const message2 = boundedLabel(request.message) ?? "App access requested";
31808
+ const appName = [
31809
+ metadata?.app_name,
31810
+ metadata?.appName,
31811
+ metadata?.app,
31812
+ target?.app,
31813
+ target?.name,
31814
+ toolParams?.app_name,
31815
+ toolParams?.app,
31816
+ metadata?.connector_name,
31817
+ metadata?.connectorName
31818
+ ].map(boundedLabel).find(Boolean) ?? message2.match(/^Allow ChatGPT to use (.+?)\?$/i)?.[1]?.trim();
31819
+ if (!appName) return null;
31820
+ const schema4 = plainRecord(request.requestedSchema);
31821
+ const properties = plainRecord(schema4?.properties);
31822
+ const required2 = schema4?.required;
31823
+ if (!properties || !Array.isArray(required2) || required2.length === 0 || required2.length > 8 || !required2.every((key) => typeof key === "string" && key.length > 0 && key.length <= 100)) return null;
31824
+ const content = {};
31825
+ for (const key of required2) {
31826
+ const field = plainRecord(properties[key]);
31827
+ if (!field) return null;
31828
+ const enumValues = Array.isArray(field.enum) ? field.enum.filter((value) => typeof value === "string") : [];
31829
+ const oneOfValues = Array.isArray(field.oneOf) ? field.oneOf.map((option) => boundedLabel(plainRecord(option)?.const)).filter((value) => Boolean(value)) : [];
31830
+ const chosen = [...oneOfValues, ...enumValues].find(ordinaryApprovalValue);
31831
+ if (!chosen) return null;
31832
+ content[key] = chosen;
31833
+ }
31834
+ const tool2 = boundedLabel(appName) ?? boundedLabel(request.serverName) ?? "app_access";
31835
+ return { tool: tool2, summary: message2, allowResult: { action: "accept", content } };
31836
+ }
31837
+ function codexServerConfirm(params, customByMountName) {
31838
+ const serverName = plainRecord(params)?.serverName;
31839
+ if (typeof serverName !== "string" || !customByMountName.has(serverName)) return null;
31840
+ return elicitationConfirm(params);
31841
+ }
31842
+ var plainRecord, containsControlCharacter;
31843
+ var init_codex_elicitation = __esm({
31844
+ "server/drivers/codex-elicitation.ts"() {
31845
+ "use strict";
31846
+ init_mcp_elicitation();
31847
+ plainRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
31848
+ containsControlCharacter = (value) => {
31849
+ for (const character of value) {
31850
+ const code = character.charCodeAt(0);
31851
+ if (code <= 31 || code === 127) return true;
31852
+ }
31853
+ return false;
31854
+ };
31855
+ }
31856
+ });
31857
+
31597
31858
  // server/drivers/codex-catalog.ts
31598
- import { readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
31859
+ import { readdirSync as readdirSync5, readFileSync as readFileSync13 } from "node:fs";
31599
31860
  import { homedir as homedir12 } from "node:os";
31600
31861
  import { basename as basename7, join as join28 } from "node:path";
31601
31862
  function encodeCodexSelection(provider, model) {
@@ -31776,7 +32037,7 @@ function parseCodexToml(text4) {
31776
32037
  }
31777
32038
  function readText(path4) {
31778
32039
  try {
31779
- return readFileSync12(path4, "utf8");
32040
+ return readFileSync13(path4, "utf8");
31780
32041
  } catch {
31781
32042
  return null;
31782
32043
  }
@@ -31812,9 +32073,9 @@ function collectCatalogNames(home) {
31812
32073
  continue;
31813
32074
  }
31814
32075
  const records = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.models) ? parsed.models : parsed && typeof parsed === "object" && Array.isArray(parsed.data) ? parsed.data : [];
31815
- for (const record5 of records) {
31816
- if (!record5 || typeof record5 !== "object") continue;
31817
- const row = record5;
32076
+ for (const record6 of records) {
32077
+ if (!record6 || typeof record6 !== "object") continue;
32078
+ const row = record6;
31818
32079
  const slug = typeof row.slug === "string" ? row.slug : typeof row.id === "string" ? row.id : "";
31819
32080
  if (!MODEL_ID2.test(slug)) continue;
31820
32081
  const label = typeof row.display_name === "string" ? row.display_name : typeof row.name === "string" ? row.name : "";
@@ -31825,10 +32086,10 @@ function collectCatalogNames(home) {
31825
32086
  }
31826
32087
  function idsFromModelsPayload2(payload) {
31827
32088
  const records = Array.isArray(payload) ? payload : payload && typeof payload === "object" && Array.isArray(payload.data) ? payload.data : payload && typeof payload === "object" && Array.isArray(payload.models) ? payload.models : [];
31828
- return records.flatMap((record5) => {
31829
- if (typeof record5 === "string") return MODEL_ID2.test(record5) ? [record5] : [];
31830
- if (!record5 || typeof record5 !== "object") return [];
31831
- const id = record5.id ?? record5.slug;
32089
+ return records.flatMap((record6) => {
32090
+ if (typeof record6 === "string") return MODEL_ID2.test(record6) ? [record6] : [];
32091
+ if (!record6 || typeof record6 !== "object") return [];
32092
+ const id = record6.id ?? record6.slug;
31832
32093
  return typeof id === "string" && MODEL_ID2.test(id) ? [id] : [];
31833
32094
  });
31834
32095
  }
@@ -31936,7 +32197,7 @@ var init_codex_catalog = __esm({
31936
32197
 
31937
32198
  // server/drivers/codex-instructions.ts
31938
32199
  import { createHash as createHash8 } from "node:crypto";
31939
- import { mkdirSync as mkdirSync13, readFileSync as readFileSync13 } from "node:fs";
32200
+ import { mkdirSync as mkdirSync13, readFileSync as readFileSync14 } from "node:fs";
31940
32201
  import { join as join29 } from "node:path";
31941
32202
  function codexDeveloperInstructions(config2, botInstructions) {
31942
32203
  if (!config2 || typeof config2 !== "object" || Array.isArray(config2)) {
@@ -31956,7 +32217,7 @@ async function syncCodexInstructions(key, nativeThreadId, instructions, resumed,
31956
32217
  const fingerprint2 = digest(instructions);
31957
32218
  let previous;
31958
32219
  try {
31959
- previous = readFileSync13(path4, "utf8");
32220
+ previous = readFileSync14(path4, "utf8");
31960
32221
  } catch (error51) {
31961
32222
  if (error51.code !== "ENOENT") throw error51;
31962
32223
  }
@@ -32514,52 +32775,6 @@ function additionalPermissionSummary(permissions, reason) {
32514
32775
  const prefix = typeof reason === "string" && reason.trim() ? `${reason.trim()} \u2014 ` : "";
32515
32776
  return `${prefix}Requested permissions: ${exact}`;
32516
32777
  }
32517
- function boundedLabel(value) {
32518
- if (typeof value !== "string") return null;
32519
- const label = value.trim();
32520
- return label && label.length <= 160 && !containsControlCharacter(label) ? label : null;
32521
- }
32522
- function ordinaryApprovalValue(value) {
32523
- const normalized = value.trim().toLowerCase();
32524
- if (/session|always|permanent|forever|persistent/.test(normalized)) return false;
32525
- return normalized === "once" || /^(?:accept|approve|allow)(?:ed|[-_]?once)?$/.test(normalized);
32526
- }
32527
- function mcpAppApprovalForm(params) {
32528
- const request = plainRecord(params);
32529
- if (!request || request.mode !== "form") return null;
32530
- const metadata = plainRecord(request._meta);
32531
- const target = plainRecord(metadata?.target);
32532
- const toolParams = plainRecord(metadata?.tool_params);
32533
- const message2 = boundedLabel(request.message) ?? "App access requested";
32534
- const appName = [
32535
- metadata?.app_name,
32536
- metadata?.appName,
32537
- metadata?.app,
32538
- target?.app,
32539
- target?.name,
32540
- toolParams?.app_name,
32541
- toolParams?.app,
32542
- metadata?.connector_name,
32543
- metadata?.connectorName
32544
- ].map(boundedLabel).find(Boolean) ?? message2.match(/^Allow ChatGPT to use (.+?)\?$/i)?.[1]?.trim();
32545
- if (!appName) return null;
32546
- const schema4 = plainRecord(request.requestedSchema);
32547
- const properties = plainRecord(schema4?.properties);
32548
- const required2 = schema4?.required;
32549
- if (!properties || !Array.isArray(required2) || required2.length === 0 || required2.length > 8 || !required2.every((key) => typeof key === "string" && key.length > 0 && key.length <= 100)) return null;
32550
- const content = {};
32551
- for (const key of required2) {
32552
- const field = plainRecord(properties[key]);
32553
- if (!field) return null;
32554
- const enumValues = Array.isArray(field.enum) ? field.enum.filter((value) => typeof value === "string") : [];
32555
- const oneOfValues = Array.isArray(field.oneOf) ? field.oneOf.map((option) => boundedLabel(plainRecord(option)?.const)).filter((value) => Boolean(value)) : [];
32556
- const chosen = [...oneOfValues, ...enumValues].find(ordinaryApprovalValue);
32557
- if (!chosen) return null;
32558
- content[key] = chosen;
32559
- }
32560
- const tool2 = boundedLabel(appName) ?? boundedLabel(request.serverName) ?? "app_access";
32561
- return { tool: tool2, summary: message2, allowResult: { action: "accept", content } };
32562
- }
32563
32778
  function namedApprovalParams(mode) {
32564
32779
  if (mode === "full") {
32565
32780
  return {
@@ -32590,15 +32805,15 @@ function namedApprovalParams(mode) {
32590
32805
  }
32591
32806
  function withWritableRoots(turnParams, dirs) {
32592
32807
  if (!dirs?.length) return turnParams;
32593
- const policy = plainRecord(turnParams.sandboxPolicy);
32808
+ const policy = plainRecord2(turnParams.sandboxPolicy);
32594
32809
  if (!policy || policy.type !== "workspaceWrite") return turnParams;
32595
32810
  const existing = Array.isArray(policy.writableRoots) ? policy.writableRoots.filter((root) => typeof root === "string") : [];
32596
32811
  return { ...turnParams, sandboxPolicy: { ...policy, writableRoots: [.../* @__PURE__ */ new Set([...existing, ...dirs])] } };
32597
32812
  }
32598
32813
  function withResolvedSandbox(params, session) {
32599
- const requested = plainRecord(params.turn.sandboxPolicy);
32814
+ const requested = plainRecord2(params.turn.sandboxPolicy);
32600
32815
  if (!requested) return params;
32601
- const sandbox = plainRecord(plainRecord(session)?.sandbox);
32816
+ const sandbox = plainRecord2(plainRecord2(session)?.sandbox);
32602
32817
  if (!sandbox || typeof sandbox.type !== "string") {
32603
32818
  throw new Error("Codex did not return its resolved sandbox policy. Update Codex, then retry; the turn was not started because its permissions could not be verified.");
32604
32819
  }
@@ -32609,7 +32824,7 @@ function withResolvedSandbox(params, session) {
32609
32824
  }
32610
32825
  function effectiveApprovalPolicy(value) {
32611
32826
  if (value === "untrusted" || value === "on-request" || value === "never") return value;
32612
- const granular = plainRecord(plainRecord(value)?.granular);
32827
+ const granular = plainRecord2(plainRecord2(value)?.granular);
32613
32828
  if (granular && typeof granular.mcp_elicitations === "boolean" && typeof granular.rules === "boolean" && typeof granular.sandbox_approval === "boolean" && (granular.request_permissions === void 0 || typeof granular.request_permissions === "boolean") && (granular.skill_approval === void 0 || typeof granular.skill_approval === "boolean")) {
32614
32829
  return {
32615
32830
  granular: {
@@ -32672,20 +32887,20 @@ function permissionProfileUnsupported(error51) {
32672
32887
  }
32673
32888
  function codexNativeLogMessage(message2) {
32674
32889
  if (!message2 || typeof message2 !== "object" || Array.isArray(message2)) return message2;
32675
- const record5 = message2;
32676
- const params = record5.params;
32890
+ const record6 = message2;
32891
+ const params = record6.params;
32677
32892
  if (!params || typeof params !== "object" || Array.isArray(params)) return message2;
32678
- if (record5.method === "thread/start" || record5.method === "thread/resume") {
32679
- return { ...record5, params: { ...params, developerInstructions: "[developer instructions omitted]" } };
32893
+ if (record6.method === "thread/start" || record6.method === "thread/resume") {
32894
+ return { ...record6, params: { ...params, developerInstructions: "[developer instructions omitted]" } };
32680
32895
  }
32681
- if (record5.method === "thread/inject_items") {
32682
- return { ...record5, params: { ...params, items: "[developer instruction update omitted]" } };
32896
+ if (record6.method === "thread/inject_items") {
32897
+ return { ...record6, params: { ...params, items: "[developer instruction update omitted]" } };
32683
32898
  }
32684
- if (record5.method !== "turn/start") return message2;
32899
+ if (record6.method !== "turn/start") return message2;
32685
32900
  const input = params.input;
32686
32901
  if (!Array.isArray(input)) return message2;
32687
32902
  return {
32688
- ...record5,
32903
+ ...record6,
32689
32904
  params: {
32690
32905
  ...params,
32691
32906
  input: input.map((item) => {
@@ -32756,7 +32971,7 @@ function mountMcpServer(appServerArgs, env, name, server, preApproved = true) {
32756
32971
  appServerArgs.push("-c", `${prefix}.default_tools_approval_mode="auto"`);
32757
32972
  }
32758
32973
  }
32759
- var DRIVER_KIND3, ASTRA_MODEL_ID, ASTRA_MIN_CODEX_VERSION, CodexRpcError, QUESTION_TIMEOUT_NOTE2, DENY_TIMEOUT_NOTE2, notedMcpServers, plainRecord, containsControlCharacter, CodexDriver;
32974
+ var DRIVER_KIND3, ASTRA_MODEL_ID, ASTRA_MIN_CODEX_VERSION, CodexRpcError, QUESTION_TIMEOUT_NOTE2, DENY_TIMEOUT_NOTE2, notedMcpServers, plainRecord2, CodexDriver;
32760
32975
  var init_codex = __esm({
32761
32976
  "server/drivers/codex.ts"() {
32762
32977
  "use strict";
@@ -32769,6 +32984,8 @@ var init_codex = __esm({
32769
32984
  init_setup_log();
32770
32985
  init_mcp_registry();
32771
32986
  init_mcp_tool_hints();
32987
+ init_mcp_elicitation();
32988
+ init_codex_elicitation();
32772
32989
  init_contracts();
32773
32990
  init_codex_catalog();
32774
32991
  init_local_inject();
@@ -32797,14 +33014,7 @@ var init_codex = __esm({
32797
33014
  QUESTION_TIMEOUT_NOTE2 = "No answer was given \u2014 use your best judgment.";
32798
33015
  DENY_TIMEOUT_NOTE2 = "Atomic: nobody answered this permission request in time. Skip this action and finish what you can without it.";
32799
33016
  notedMcpServers = /* @__PURE__ */ new Set();
32800
- plainRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
32801
- containsControlCharacter = (value) => {
32802
- for (const character of value) {
32803
- const code = character.charCodeAt(0);
32804
- if (code <= 31 || code === 127) return true;
32805
- }
32806
- return false;
32807
- };
33017
+ plainRecord2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
32808
33018
  CodexDriver = {
32809
33019
  driverKind: DRIVER_KIND3,
32810
33020
  metadata: { displayName: "Codex", supportsMultipleInstances: true },
@@ -33104,7 +33314,8 @@ var init_codex = __esm({
33104
33314
  const isMcpElicitation = method === "mcpServer/elicitation/request";
33105
33315
  const isLegacyMcpPermission = method === "mcpServer/elicitation/request" && params?._meta?.codex_approval_kind === "mcp_tool_call";
33106
33316
  const mcpAppApproval = isMcpElicitation ? mcpAppApprovalForm(params) : null;
33107
- const isMcpPermission = isLegacyMcpPermission || mcpAppApproval !== null;
33317
+ const serverConfirm = isMcpElicitation && !isLegacyMcpPermission && !mcpAppApproval ? codexServerConfirm(params, customByMountName) : null;
33318
+ const isMcpPermission = isLegacyMcpPermission || mcpAppApproval !== null || serverConfirm !== null;
33108
33319
  const isQuestion = method === "item/tool/requestUserInput";
33109
33320
  const isAdditionalPermission = method === "item/permissions/requestApproval";
33110
33321
  const isPermission = legacy || isMcpPermission || isAdditionalPermission || method === "item/commandExecution/requestApproval" || method === "item/fileChange/requestApproval";
@@ -33135,9 +33346,9 @@ var init_codex = __esm({
33135
33346
  const mcpTool = isLegacyMcpPermission ? (typeof params?._meta?.tool_name === "string" ? params._meta.tool_name : void 0) ?? String(params.message ?? "").match(/tool "([^"]+)"/)?.[1] : void 0;
33136
33347
  const customServer = isLegacyMcpPermission && typeof params.serverName === "string" ? customByMountName.get(params.serverName) : void 0;
33137
33348
  const mcpToolRef = customServer && mcpTool ? { server: customServer, tool: mcpTool, ...toolAnnotations(params?._meta?.annotations) ? { annotations: toolAnnotations(params._meta.annotations) } : {} } : void 0;
33138
- const tool2 = mcpAppApproval ? mcpAppApproval.tool : isLegacyMcpPermission ? mcpTool ?? "mcp" : isAdditionalPermission ? "permissions" : method === "item/fileChange/requestApproval" || method === "applyPatchApproval" ? "edit" : isQuestion ? "ask_user" : "shell";
33139
- const permissionResult = (allow) => isMcpPermission ? allow ? mcpAppApproval?.allowResult ?? { action: "accept", content: {} } : { action: "decline" } : isAdditionalPermission ? { permissions: allow ? grantedPermissions(params.permissions) : {}, scope: "turn" } : { decision: allow ? legacy ? "approved" : "accept" : legacy ? "denied" : "decline" };
33140
- if (autoAcceptPermissions && isPermission) {
33349
+ const tool2 = serverConfirm ? elicitationTool(customByMountName.get(params.serverName)) : mcpAppApproval ? mcpAppApproval.tool : isLegacyMcpPermission ? mcpTool ?? "mcp" : isAdditionalPermission ? "permissions" : method === "item/fileChange/requestApproval" || method === "applyPatchApproval" ? "edit" : isQuestion ? "ask_user" : "shell";
33350
+ const permissionResult = (allow) => serverConfirm ? elicitationAnswer(serverConfirm, allow) : isMcpPermission ? allow ? mcpAppApproval?.allowResult ?? { action: "accept", content: {} } : { action: "decline" } : isAdditionalPermission ? { permissions: allow ? grantedPermissions(params.permissions) : {}, scope: "turn" } : { decision: allow ? legacy ? "approved" : "accept" : legacy ? "denied" : "decline" };
33351
+ if (autoAcceptPermissions && isPermission && !serverConfirm) {
33141
33352
  return send({
33142
33353
  jsonrpc: "2.0",
33143
33354
  id: msg.id,
@@ -33145,7 +33356,7 @@ var init_codex = __esm({
33145
33356
  });
33146
33357
  }
33147
33358
  const requestId = newId();
33148
- const summary = isAdditionalPermission ? additionalPermissionSummary(params.permissions, params.reason) : isMcpPermission ? mcpAppApproval?.summary ?? (typeof params.message === "string" ? params.message : "MCP access requested") : typeof params.command === "string" ? params.command : Array.isArray(params.questions) ? params.questions.map((q2) => q2.question ?? q2.header).filter(Boolean).join(" \xB7 ") : typeof params.reason === "string" ? params.reason : tool2;
33359
+ const summary = isAdditionalPermission ? additionalPermissionSummary(params.permissions, params.reason) : serverConfirm ? elicitationSummary(customByMountName.get(params.serverName), serverConfirm) : isMcpPermission ? mcpAppApproval?.summary ?? (typeof params.message === "string" ? params.message : "MCP access requested") : typeof params.command === "string" ? params.command : Array.isArray(params.questions) ? params.questions.map((q2) => q2.question ?? q2.header).filter(Boolean).join(" \xB7 ") : typeof params.reason === "string" ? params.reason : tool2;
33149
33360
  const choices = isQuestion ? (params.questions?.[0]?.options ?? []).map((o) => o.label).slice(0, 5) : void 0;
33150
33361
  const finish = (behavior, message2, source2 = "user") => {
33151
33362
  if (!asks.delete(requestId)) return;
@@ -33160,7 +33371,8 @@ var init_codex = __esm({
33160
33371
  send({
33161
33372
  jsonrpc: "2.0",
33162
33373
  id: msg.id,
33163
- result: permissionResult(behavior === "allow")
33374
+ // a server's question nobody answered is "no answer", not a no
33375
+ result: serverConfirm && source2 !== "user" ? { action: "cancel" } : permissionResult(behavior === "allow")
33164
33376
  });
33165
33377
  }
33166
33378
  emit({ ...base3(threadId, turnId), type: "request.resolved", requestId, behavior, source: source2 });
@@ -33180,7 +33392,7 @@ var init_codex = __esm({
33180
33392
  summary,
33181
33393
  choices,
33182
33394
  approvalScope: controlsHost ? "local-computer" : void 0,
33183
- requiresExplicitApproval: isAdditionalPermission || void 0,
33395
+ requiresExplicitApproval: isAdditionalPermission || serverConfirm !== null || void 0,
33184
33396
  ...mcpToolRef ? { mcpTool: mcpToolRef } : {}
33185
33397
  });
33186
33398
  };
@@ -41709,7 +41921,7 @@ var require_dist = __commonJS({
41709
41921
  });
41710
41922
 
41711
41923
  // server/drivers/chat-images.ts
41712
- import { readFileSync as readFileSync14, statSync as statSync4 } from "node:fs";
41924
+ import { readFileSync as readFileSync15, statSync as statSync4 } from "node:fs";
41713
41925
  function chatImageBudget() {
41714
41926
  let used = 0;
41715
41927
  return (parts) => {
@@ -41741,7 +41953,7 @@ function chatUserContent(turn) {
41741
41953
  const budget = chatImageBudget();
41742
41954
  return [{ type: "text", text: turn.text }, ...turn.images.map((image) => {
41743
41955
  if (statSync4(image.path).size > IMAGE_BYTES) throw new Error("Image exceeds 20 MB");
41744
- const part = chatImage({ mimeType: image.mime, data: readFileSync14(image.path).toString("base64") });
41956
+ const part = chatImage({ mimeType: image.mime, data: readFileSync15(image.path).toString("base64") });
41745
41957
  budget([part]);
41746
41958
  return part;
41747
41959
  })];
@@ -41767,7 +41979,7 @@ import {
41767
41979
  linkSync as linkSync2,
41768
41980
  mkdirSync as mkdirSync14,
41769
41981
  openSync as openSync5,
41770
- readFileSync as readFileSync15,
41982
+ readFileSync as readFileSync16,
41771
41983
  unlinkSync as unlinkSync4,
41772
41984
  writeFileSync as writeFileSync9
41773
41985
  } from "node:fs";
@@ -41778,7 +41990,7 @@ function hasCode(error51, code) {
41778
41990
  function readEnvironmentId(file2) {
41779
41991
  let contents;
41780
41992
  try {
41781
- contents = readFileSync15(file2, "utf8");
41993
+ contents = readFileSync16(file2, "utf8");
41782
41994
  } catch (error51) {
41783
41995
  if (hasCode(error51, "ENOENT")) return void 0;
41784
41996
  throw new Error(`Cannot read the existing environment identity at ${file2}; refusing to replace it.`, {
@@ -41834,7 +42046,7 @@ var init_environment = __esm({
41834
42046
 
41835
42047
  // server/box-create-idempotency.ts
41836
42048
  import { createHash as createHash9, randomUUID as randomUUID11 } from "node:crypto";
41837
- import { linkSync as linkSync3, mkdirSync as mkdirSync15, readFileSync as readFileSync16, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
42049
+ import { linkSync as linkSync3, mkdirSync as mkdirSync15, readFileSync as readFileSync17, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
41838
42050
  import { join as join33 } from "node:path";
41839
42051
  function isRequest(value) {
41840
42052
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
@@ -41852,7 +42064,7 @@ function recoveryStateError(detail, cause) {
41852
42064
  function loadFresh() {
41853
42065
  let raw;
41854
42066
  try {
41855
- raw = JSON.parse(readFileSync16(FILE, "utf8"));
42067
+ raw = JSON.parse(readFileSync17(FILE, "utf8"));
41856
42068
  } catch (error51) {
41857
42069
  if (error51?.code === "ENOENT") return [];
41858
42070
  throw recoveryStateError("unreadable", error51);
@@ -41891,7 +42103,7 @@ function isLockOwner(value) {
41891
42103
  function readLockOwner() {
41892
42104
  let raw;
41893
42105
  try {
41894
- raw = readFileSync16(LOCK_FILE, "utf8");
42106
+ raw = readFileSync17(LOCK_FILE, "utf8");
41895
42107
  } catch (error51) {
41896
42108
  if (error51?.code === "ENOENT") return null;
41897
42109
  throw recoveryStateError("lock is unreadable", error51);
@@ -41908,7 +42120,7 @@ function readLockOwner() {
41908
42120
  function readReaperOwner(path4, targetToken) {
41909
42121
  let raw;
41910
42122
  try {
41911
- raw = readFileSync16(path4, "utf8");
42123
+ raw = readFileSync17(path4, "utf8");
41912
42124
  } catch (error51) {
41913
42125
  if (error51?.code === "ENOENT") return null;
41914
42126
  throw recoveryStateError("stale-lock recovery record is unreadable", error51);
@@ -42110,7 +42322,7 @@ var init_box_create_idempotency = __esm({
42110
42322
 
42111
42323
  // server/box-delete-journal.ts
42112
42324
  import { createHash as createHash10, randomUUID as randomUUID12 } from "node:crypto";
42113
- import { linkSync as linkSync4, mkdirSync as mkdirSync16, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "node:fs";
42325
+ import { linkSync as linkSync4, mkdirSync as mkdirSync16, readFileSync as readFileSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "node:fs";
42114
42326
  import { join as join34 } from "node:path";
42115
42327
  function validTimestamp(value) {
42116
42328
  return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
@@ -42120,13 +42332,13 @@ function validName(value) {
42120
42332
  }
42121
42333
  function isRecord4(value) {
42122
42334
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
42123
- const record5 = value;
42124
- if (typeof record5.boxId !== "string" || !BOX_ID2.test(record5.boxId) || !validName(record5.name) || !(record5.ownerBotId === null || typeof record5.ownerBotId === "string" && BOT_ID2.test(record5.ownerBotId)) || !["prepared", "accepted", "blocked"].includes(record5.phase) || !validTimestamp(record5.requestedAt) || !validTimestamp(record5.updatedAt) || record5.updatedAt < record5.requestedAt || !(record5.operationId === void 0 || typeof record5.operationId === "string" && OPERATION_ID.test(record5.operationId)) || !(record5.status === void 0 || typeof record5.status === "string" && PROVIDER_STATUSES.has(record5.status))) return false;
42125
- if (record5.phase === "prepared") return record5.operationId === void 0 && record5.status === void 0;
42126
- if (record5.phase === "accepted") {
42127
- return typeof record5.operationId === "string" && (record5.status === "pending" || record5.status === "processing" || record5.status === "completed");
42335
+ const record6 = value;
42336
+ if (typeof record6.boxId !== "string" || !BOX_ID2.test(record6.boxId) || !validName(record6.name) || !(record6.ownerBotId === null || typeof record6.ownerBotId === "string" && BOT_ID2.test(record6.ownerBotId)) || !["prepared", "accepted", "blocked"].includes(record6.phase) || !validTimestamp(record6.requestedAt) || !validTimestamp(record6.updatedAt) || record6.updatedAt < record6.requestedAt || !(record6.operationId === void 0 || typeof record6.operationId === "string" && OPERATION_ID.test(record6.operationId)) || !(record6.status === void 0 || typeof record6.status === "string" && PROVIDER_STATUSES.has(record6.status))) return false;
42337
+ if (record6.phase === "prepared") return record6.operationId === void 0 && record6.status === void 0;
42338
+ if (record6.phase === "accepted") {
42339
+ return typeof record6.operationId === "string" && (record6.status === "pending" || record6.status === "processing" || record6.status === "completed");
42128
42340
  }
42129
- return record5.status === "blocked";
42341
+ return record6.status === "blocked";
42130
42342
  }
42131
42343
  function stateError(detail, cause) {
42132
42344
  return Object.assign(
@@ -42136,13 +42348,13 @@ function stateError(detail, cause) {
42136
42348
  { status: 503, cause }
42137
42349
  );
42138
42350
  }
42139
- function clone2(record5) {
42140
- return { ...record5 };
42351
+ function clone2(record6) {
42352
+ return { ...record6 };
42141
42353
  }
42142
42354
  function loadFresh2() {
42143
42355
  let raw;
42144
42356
  try {
42145
- raw = JSON.parse(readFileSync17(FILE2, "utf8"));
42357
+ raw = JSON.parse(readFileSync18(FILE2, "utf8"));
42146
42358
  } catch (error51) {
42147
42359
  if (error51?.code === "ENOENT") return [];
42148
42360
  throw stateError("unreadable", error51);
@@ -42151,12 +42363,12 @@ function loadFresh2() {
42151
42363
  if (!journal || typeof journal !== "object" || Array.isArray(journal) || journal.version !== 1 || !Array.isArray(journal.records) || journal.records.length > MAX_RECORDS || !journal.records.every(isRecord4)) throw stateError("invalid");
42152
42364
  const boxIds = /* @__PURE__ */ new Set();
42153
42365
  const operationIds = /* @__PURE__ */ new Set();
42154
- for (const record5 of journal.records) {
42155
- if (boxIds.has(record5.boxId)) throw stateError("invalid");
42156
- boxIds.add(record5.boxId);
42157
- if (record5.operationId) {
42158
- if (operationIds.has(record5.operationId)) throw stateError("invalid");
42159
- operationIds.add(record5.operationId);
42366
+ for (const record6 of journal.records) {
42367
+ if (boxIds.has(record6.boxId)) throw stateError("invalid");
42368
+ boxIds.add(record6.boxId);
42369
+ if (record6.operationId) {
42370
+ if (operationIds.has(record6.operationId)) throw stateError("invalid");
42371
+ operationIds.add(record6.operationId);
42160
42372
  }
42161
42373
  }
42162
42374
  return journal.records.map(clone2);
@@ -42169,7 +42381,7 @@ function isLockOwner2(value) {
42169
42381
  function readLockOwner2() {
42170
42382
  let raw;
42171
42383
  try {
42172
- raw = readFileSync17(LOCK_FILE2, "utf8");
42384
+ raw = readFileSync18(LOCK_FILE2, "utf8");
42173
42385
  } catch (error51) {
42174
42386
  if (error51?.code === "ENOENT") return null;
42175
42387
  throw stateError("lock is unreadable", error51);
@@ -42206,7 +42418,7 @@ function unlinkCandidate2(path4) {
42206
42418
  function readReaperOwner2(path4, targetToken) {
42207
42419
  let raw;
42208
42420
  try {
42209
- raw = readFileSync17(path4, "utf8");
42421
+ raw = readFileSync18(path4, "utf8");
42210
42422
  } catch (error51) {
42211
42423
  if (error51?.code === "ENOENT") return null;
42212
42424
  throw stateError("stale-lock recovery record is unreadable", error51);
@@ -42345,13 +42557,13 @@ function withJournalLock2(operation) {
42345
42557
  function getBoxDeletion(boxId) {
42346
42558
  if (!BOX_ID2.test(boxId)) throw new Error("invalid cloud computer id for deletion");
42347
42559
  return withJournalLock2((records) => {
42348
- const record5 = records.find((candidate) => candidate.boxId === boxId);
42349
- return record5 ? clone2(record5) : null;
42560
+ const record6 = records.find((candidate) => candidate.boxId === boxId);
42561
+ return record6 ? clone2(record6) : null;
42350
42562
  });
42351
42563
  }
42352
42564
  function hasPendingBoxDeletionForBot(botId) {
42353
42565
  if (!BOT_ID2.test(botId)) throw new Error("invalid bot id for cloud computer deletion");
42354
- return withJournalLock2((records) => records.some((record5) => record5.ownerBotId === botId));
42566
+ return withJournalLock2((records) => records.some((record6) => record6.ownerBotId === botId));
42355
42567
  }
42356
42568
  var FILE2, LOCK_FILE2, MAX_RECORDS, LOCK_WAIT_MS2, LOCK_RETRY_MS2, MAX_REAPER_GENERATIONS3, UUID4, BOT_ID2, BOX_ID2, OPERATION_ID, PROVIDER_STATUSES, lockWait2;
42357
42569
  var init_box_delete_journal = __esm({
@@ -43892,7 +44104,7 @@ var init_grok = __esm({
43892
44104
  });
43893
44105
 
43894
44106
  // server/drivers/acp/grok.ts
43895
- import { existsSync as existsSync16, readFileSync as readFileSync18, writeFileSync as writeFileSync12 } from "node:fs";
44107
+ import { existsSync as existsSync16, readFileSync as readFileSync19, writeFileSync as writeFileSync12 } from "node:fs";
43896
44108
  import { homedir as homedir16 } from "node:os";
43897
44109
  import { join as join35 } from "node:path";
43898
44110
  function decodeGrokModelText(text4) {
@@ -43941,7 +44153,7 @@ function readGrokModelCatalog(env = process.env, base3 = STATIC_GROK_MODELS) {
43941
44153
  const path4 = join35(grokHome(env), "config.toml");
43942
44154
  let text4 = "";
43943
44155
  try {
43944
- text4 = readFileSync18(path4, "utf8");
44156
+ text4 = readFileSync19(path4, "utf8");
43945
44157
  } catch {
43946
44158
  return base3;
43947
44159
  }
@@ -44020,7 +44232,7 @@ function ensureGrokInjectSlug(modelId, env = process.env) {
44020
44232
  const path4 = join35(grokHome(env), "config.toml");
44021
44233
  let text4 = "";
44022
44234
  try {
44023
- text4 = readFileSync18(path4, "utf8");
44235
+ text4 = readFileSync19(path4, "utf8");
44024
44236
  } catch {
44025
44237
  text4 = "";
44026
44238
  }
@@ -44186,12 +44398,12 @@ ${turn.text}` : turn.text
44186
44398
  });
44187
44399
 
44188
44400
  // server/drivers/acp/gemini.ts
44189
- import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
44401
+ import { existsSync as existsSync17, readFileSync as readFileSync20 } from "node:fs";
44190
44402
  import { homedir as homedir17 } from "node:os";
44191
44403
  import { join as join36 } from "node:path";
44192
44404
  function liveOauthCredential() {
44193
44405
  try {
44194
- const creds = JSON.parse(readFileSync19(join36(homedir17(), ".gemini", "oauth_creds.json"), "utf8"));
44406
+ const creds = JSON.parse(readFileSync20(join36(homedir17(), ".gemini", "oauth_creds.json"), "utf8"));
44195
44407
  if (typeof creds.access_token !== "string" || creds.access_token.trim().length === 0) return false;
44196
44408
  const hasRefresh = typeof creds.refresh_token === "string" && creds.refresh_token.trim().length > 0;
44197
44409
  if (creds.expiry_date !== void 0) {
@@ -44251,7 +44463,7 @@ ${turn.text}` : turn.text
44251
44463
  });
44252
44464
 
44253
44465
  // server/drivers/acp/kimi.ts
44254
- import { existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "node:fs";
44466
+ import { existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync21, writeFileSync as writeFileSync13 } from "node:fs";
44255
44467
  import { homedir as homedir18 } from "node:os";
44256
44468
  import { join as join37 } from "node:path";
44257
44469
  function isLocalInjectAlias(slug) {
@@ -44552,7 +44764,7 @@ function ensureKimiInjectAlias(modelId, env = process.env) {
44552
44764
  const path4 = join37(dataRoot, "config.toml");
44553
44765
  let text4 = "";
44554
44766
  try {
44555
- text4 = readFileSync20(path4, "utf8");
44767
+ text4 = readFileSync21(path4, "utf8");
44556
44768
  } catch {
44557
44769
  text4 = "";
44558
44770
  }
@@ -44614,7 +44826,7 @@ function readKimiModelCatalog(env) {
44614
44826
  const dataRoot = kimiDataRoot(env);
44615
44827
  let text4 = "";
44616
44828
  try {
44617
- text4 = readFileSync20(join37(dataRoot, "config.toml"), "utf8");
44829
+ text4 = readFileSync21(join37(dataRoot, "config.toml"), "utf8");
44618
44830
  } catch {
44619
44831
  return STATIC_KIMI_MODELS;
44620
44832
  }
@@ -44761,7 +44973,7 @@ ${turn.text}` : turn.text
44761
44973
  });
44762
44974
 
44763
44975
  // server/drivers/acp/droid.ts
44764
- import { existsSync as existsSync19, mkdirSync as mkdirSync18, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
44976
+ import { existsSync as existsSync19, mkdirSync as mkdirSync18, readFileSync as readFileSync22, writeFileSync as writeFileSync14 } from "node:fs";
44765
44977
  import { homedir as homedir19 } from "node:os";
44766
44978
  import { join as join38 } from "node:path";
44767
44979
  function authFilePaths(env) {
@@ -44786,7 +44998,7 @@ function ensureDroidInjectModel(modelId, env = process.env) {
44786
44998
  const path4 = join38(dir, "settings.json");
44787
44999
  let settings2 = {};
44788
45000
  try {
44789
- settings2 = JSON.parse(readFileSync21(path4, "utf8"));
45001
+ settings2 = JSON.parse(readFileSync22(path4, "utf8"));
44790
45002
  } catch (error51) {
44791
45003
  if (existsSync19(path4)) throw error51;
44792
45004
  }
@@ -44823,7 +45035,7 @@ function applyDroidLocalAuthEnv(env, modelId) {
44823
45035
  env.FACTORY_API_KEY = "openmausbot-local";
44824
45036
  }
44825
45037
  function readSettings(env) {
44826
- return JSON.parse(readFileSync21(join38(factoryHome(env), ".factory", "settings.json"), "utf8"));
45038
+ return JSON.parse(readFileSync22(join38(factoryHome(env), ".factory", "settings.json"), "utf8"));
44827
45039
  }
44828
45040
  async function resolveModels(env) {
44829
45041
  let catalog2 = MODELS3;
@@ -46709,7 +46921,7 @@ var init_muse_code_login = __esm({
46709
46921
  });
46710
46922
 
46711
46923
  // server/drivers/muse-code.ts
46712
- import { existsSync as existsSync20, mkdtempSync as mkdtempSync4, readFileSync as readFileSync22, rmSync as rmSync8, statSync as statSync5 } from "node:fs";
46924
+ import { existsSync as existsSync20, mkdtempSync as mkdtempSync4, readFileSync as readFileSync23, rmSync as rmSync8, statSync as statSync5 } from "node:fs";
46713
46925
  import { readFile as readFile4 } from "node:fs/promises";
46714
46926
  import { homedir as homedir20, tmpdir as tmpdir5 } from "node:os";
46715
46927
  import { join as join39 } from "node:path";
@@ -46722,7 +46934,7 @@ function museCredential(path4) {
46722
46934
  let raw;
46723
46935
  try {
46724
46936
  if (statSync5(path4).size > 1024 * 1024) return { signedIn: false };
46725
- raw = readFileSync22(path4, "utf8");
46937
+ raw = readFileSync23(path4, "utf8");
46726
46938
  } catch {
46727
46939
  return { signedIn: false };
46728
46940
  }
@@ -46764,8 +46976,8 @@ function museCatalog(result, preferred) {
46764
46976
  return { default: preferred ?? listedDefault ?? options[0].id, options };
46765
46977
  }
46766
46978
  function museListedFromAccount(result) {
46767
- const record5 = result ?? {};
46768
- return record5.source !== "bundledCatalog" && Array.isArray(record5.models) && record5.models.length > 0;
46979
+ const record6 = result ?? {};
46980
+ return record6.source !== "bundledCatalog" && Array.isArray(record6.models) && record6.models.length > 0;
46769
46981
  }
46770
46982
  function museApprovalMode(mode) {
46771
46983
  return mode === "full" ? "allowAll" : mode === "auto" ? "onRequest" : "promptUnmatched";
@@ -47474,7 +47686,7 @@ ${body}` : body;
47474
47686
  });
47475
47687
 
47476
47688
  // server/drivers/acp/opencode-go.ts
47477
- import { existsSync as existsSync21, mkdirSync as mkdirSync19, readFileSync as readFileSync23, writeFileSync as writeFileSync15 } from "node:fs";
47689
+ import { existsSync as existsSync21, mkdirSync as mkdirSync19, readFileSync as readFileSync24, writeFileSync as writeFileSync15 } from "node:fs";
47478
47690
  import { homedir as homedir21 } from "node:os";
47479
47691
  import { join as join40 } from "node:path";
47480
47692
  function labelForModel(id) {
@@ -47491,8 +47703,8 @@ function validModelSlug(value) {
47491
47703
  if (separator <= 0 || separator >= value.length - 1 || /\s/u.test(value)) return false;
47492
47704
  return [...value].every((character) => (character.codePointAt(0) ?? 0) > 31);
47493
47705
  }
47494
- function localModelRecord(record5) {
47495
- const api2 = record5.api && typeof record5.api === "object" && !Array.isArray(record5.api) ? record5.api : {};
47706
+ function localModelRecord(record6) {
47707
+ const api2 = record6.api && typeof record6.api === "object" && !Array.isArray(record6.api) ? record6.api : {};
47496
47708
  if (typeof api2.url !== "string") return false;
47497
47709
  try {
47498
47710
  const host = new URL(api2.url).hostname.replace(/^\[|\]$/gu, "");
@@ -47511,27 +47723,27 @@ function parseOpenCodeModelsOutput(stdout2) {
47511
47723
  const separator = slug.indexOf("/");
47512
47724
  const provider = slug.slice(0, separator);
47513
47725
  const model = slug.slice(separator + 1);
47514
- let record5 = {};
47726
+ let record6 = {};
47515
47727
  const raw = jsonLines.join("\n").trim();
47516
47728
  if (raw) {
47517
47729
  try {
47518
47730
  const parsed = JSON.parse(raw);
47519
47731
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
47520
- record5 = parsed;
47732
+ record6 = parsed;
47521
47733
  }
47522
47734
  } catch {
47523
47735
  }
47524
47736
  }
47525
- if (record5.status === "deprecated") return;
47526
- const name = typeof record5.name === "string" && record5.name.trim() ? record5.name.trim() : labelForModel(model);
47527
- const limit = record5.limit && typeof record5.limit === "object" && !Array.isArray(record5.limit) ? record5.limit : {};
47737
+ if (record6.status === "deprecated") return;
47738
+ const name = typeof record6.name === "string" && record6.name.trim() ? record6.name.trim() : labelForModel(model);
47739
+ const limit = record6.limit && typeof record6.limit === "object" && !Array.isArray(record6.limit) ? record6.limit : {};
47528
47740
  const contextWindow = typeof limit.context === "number" && Number.isFinite(limit.context) && limit.context > 0 ? Math.floor(limit.context) : void 0;
47529
- const variants = record5.variants && typeof record5.variants === "object" && !Array.isArray(record5.variants) ? Object.entries(record5.variants).filter(([, settings2]) => settings2 && typeof settings2 === "object" && !Array.isArray(settings2) && settings2.disabled !== true).map(([id]) => ({ id, label: labelForModel(id) })) : void 0;
47741
+ const variants = record6.variants && typeof record6.variants === "object" && !Array.isArray(record6.variants) ? Object.entries(record6.variants).filter(([, settings2]) => settings2 && typeof settings2 === "object" && !Array.isArray(settings2) && settings2.disabled !== true).map(([id]) => ({ id, label: labelForModel(id) })) : void 0;
47530
47742
  seen.add(slug);
47531
47743
  options.push({
47532
47744
  id: slug,
47533
47745
  label: `${providerLabel(provider)} \xB7 ${name}`,
47534
- ...localModelRecord(record5) ? { custom: true, loaded: true } : {},
47746
+ ...localModelRecord(record6) ? { custom: true, loaded: true } : {},
47535
47747
  ...contextWindow ? { contextWindow } : {},
47536
47748
  ...variants ? { variants } : {}
47537
47749
  });
@@ -47593,7 +47805,7 @@ function ensureOpenCodeInjectModel(modelId, env = process.env) {
47593
47805
  let config2 = { $schema: "https://opencode.ai/config.json" };
47594
47806
  if (existsSync21(path4)) {
47595
47807
  try {
47596
- config2 = JSON.parse(readFileSync23(path4, "utf8"));
47808
+ config2 = JSON.parse(readFileSync24(path4, "utf8"));
47597
47809
  } catch {
47598
47810
  }
47599
47811
  }
@@ -47644,7 +47856,7 @@ function hasStoredOpenCodeAuth(env) {
47644
47856
  if (env.OPENCODE_AUTH_CONTENT) candidates.push(env.OPENCODE_AUTH_CONTENT);
47645
47857
  for (const path4 of storedAuthPaths(env)) {
47646
47858
  try {
47647
- candidates.push(readFileSync23(path4, "utf8"));
47859
+ candidates.push(readFileSync24(path4, "utf8"));
47648
47860
  } catch {
47649
47861
  }
47650
47862
  }
@@ -47786,7 +47998,7 @@ ${turn.text}` : turn.text
47786
47998
  });
47787
47999
 
47788
48000
  // server/drivers/acp/qwen.ts
47789
- import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync20, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
48001
+ import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync20, readFileSync as readFileSync25, writeFileSync as writeFileSync16 } from "node:fs";
47790
48002
  import { createHash as createHash13 } from "node:crypto";
47791
48003
  import { homedir as homedir22 } from "node:os";
47792
48004
  import { join as join41 } from "node:path";
@@ -47804,7 +48016,7 @@ function qwenModelLabel(id, name) {
47804
48016
  function readQwenRoutes(env) {
47805
48017
  let settings2;
47806
48018
  try {
47807
- settings2 = JSON.parse(readFileSync24(join41(qwenHome(env), "settings.json"), "utf8"));
48019
+ settings2 = JSON.parse(readFileSync25(join41(qwenHome(env), "settings.json"), "utf8"));
47808
48020
  } catch {
47809
48021
  return [];
47810
48022
  }
@@ -47892,7 +48104,7 @@ function ensureQwenInjectModel(modelId, env = process.env) {
47892
48104
  let settings2 = {};
47893
48105
  if (existsSync22(path4)) {
47894
48106
  try {
47895
- settings2 = JSON.parse(readFileSync24(path4, "utf8"));
48107
+ settings2 = JSON.parse(readFileSync25(path4, "utf8"));
47896
48108
  } catch {
47897
48109
  }
47898
48110
  }
@@ -48375,7 +48587,7 @@ var init_claude_accounts = __esm({
48375
48587
  });
48376
48588
 
48377
48589
  // server/atomic-engine-accounts.ts
48378
- import { mkdirSync as mkdirSync21, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
48590
+ import { mkdirSync as mkdirSync21, readFileSync as readFileSync26, writeFileSync as writeFileSync17 } from "node:fs";
48379
48591
  import { homedir as homedir23 } from "node:os";
48380
48592
  import { join as join42 } from "node:path";
48381
48593
  function rawConfig2(entry) {
@@ -48478,7 +48690,7 @@ function writeAtomicEngineAccountsFile(engineHome, accounts) {
48478
48690
  `;
48479
48691
  const path4 = join42(engineHome, ACCOUNTS_FILE);
48480
48692
  try {
48481
- if (readFileSync25(path4, "utf8") === text4) return;
48693
+ if (readFileSync26(path4, "utf8") === text4) return;
48482
48694
  } catch {
48483
48695
  }
48484
48696
  try {
@@ -48552,7 +48764,7 @@ var init_atomic_engine_release = __esm({
48552
48764
 
48553
48765
  // server/atomic-engine-runtime.ts
48554
48766
  import { createHash as createHash14, randomUUID as randomUUID15 } from "node:crypto";
48555
- import { createWriteStream as createWriteStream2, existsSync as existsSync23, mkdirSync as mkdirSync22, readdirSync as readdirSync6, readFileSync as readFileSync26, rmSync as rmSync9, writeFileSync as writeFileSync18 } from "node:fs";
48767
+ import { createWriteStream as createWriteStream2, existsSync as existsSync23, mkdirSync as mkdirSync22, readdirSync as readdirSync6, readFileSync as readFileSync27, rmSync as rmSync9, writeFileSync as writeFileSync18 } from "node:fs";
48556
48768
  import { join as join43 } from "node:path";
48557
48769
  import { Readable, Transform as Transform2 } from "node:stream";
48558
48770
  import { pipeline as pipeline2 } from "node:stream/promises";
@@ -48566,7 +48778,7 @@ function managedAtomicEngine(baseDir = DATA_DIR, asset = atomicEngineAsset(), pl
48566
48778
  if (!asset) return null;
48567
48779
  const root = join43(atomicEngineHome(baseDir), asset.version);
48568
48780
  try {
48569
- if (readFileSync26(join43(root, MARKER2), "utf8").trim() !== asset.sha512) return null;
48781
+ if (readFileSync27(join43(root, MARKER2), "utf8").trim() !== asset.sha512) return null;
48570
48782
  } catch {
48571
48783
  return null;
48572
48784
  }
@@ -55570,11 +55782,11 @@ var init_memory_policy = __esm({
55570
55782
 
55571
55783
  // server/drivers/acp/hermes-memory-lock.ts
55572
55784
  import { createHash as createHash15 } from "node:crypto";
55573
- import { mkdirSync as mkdirSync23, readdirSync as readdirSync7, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "node:fs";
55785
+ import { mkdirSync as mkdirSync23, readdirSync as readdirSync7, readFileSync as readFileSync28, writeFileSync as writeFileSync19 } from "node:fs";
55574
55786
  import { join as join44 } from "node:path";
55575
55787
  function readText2(path4) {
55576
55788
  try {
55577
- return readFileSync27(path4, "utf8");
55789
+ return readFileSync28(path4, "utf8");
55578
55790
  } catch {
55579
55791
  return null;
55580
55792
  }
@@ -55587,7 +55799,7 @@ function parseYamlSafe(text4) {
55587
55799
  return null;
55588
55800
  }
55589
55801
  }
55590
- function record2(value) {
55802
+ function record3(value) {
55591
55803
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
55592
55804
  }
55593
55805
  function memoryProviderPlugins(pluginsDir) {
@@ -55600,12 +55812,12 @@ function memoryProviderPlugins(pluginsDir) {
55600
55812
  return dirs.flatMap((dir) => {
55601
55813
  const source2 = (readText2(join44(pluginsDir, dir, "__init__.py")) ?? "").slice(0, 8192);
55602
55814
  if (!source2.includes("register_memory_provider") && !source2.includes("MemoryProvider")) return [];
55603
- const name = record2(parseYamlSafe(readText2(join44(pluginsDir, dir, "plugin.yaml"))))?.name;
55815
+ const name = record3(parseYamlSafe(readText2(join44(pluginsDir, dir, "plugin.yaml"))))?.name;
55604
55816
  return typeof name === "string" && name.trim() && name.trim() !== dir ? [dir, name.trim()] : [dir];
55605
55817
  });
55606
55818
  }
55607
55819
  function lockHermesMemory(env, home, dataDir = DATA_DIR) {
55608
- const own = record2(record2(parseYamlSafe(readText2(join44(home, "config.yaml"))))?.plugins);
55820
+ const own = record3(record3(parseYamlSafe(readText2(join44(home, "config.yaml"))))?.plugins);
55609
55821
  const disabled = new Set(Array.isArray(own?.disabled) ? own.disabled.map(String) : []);
55610
55822
  for (const name of memoryProviderPlugins(join44(home, "plugins"))) disabled.add(name);
55611
55823
  for (const name of BLOCKED_HERMES_MEMORY_PLUGINS) disabled.add(name);
@@ -55631,7 +55843,7 @@ var init_hermes_memory_lock = __esm({
55631
55843
 
55632
55844
  // server/drivers/acp/hermes.ts
55633
55845
  import { spawn as spawn7 } from "node:child_process";
55634
- import { mkdirSync as mkdirSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync20 } from "node:fs";
55846
+ import { mkdirSync as mkdirSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync20 } from "node:fs";
55635
55847
  import { homedir as homedir24 } from "node:os";
55636
55848
  import { join as join45 } from "node:path";
55637
55849
  function bindHermesScreenshotCompat(env, modelId) {
@@ -55688,7 +55900,7 @@ function ensureHermesInjectProvider(modelId, env = process.env, home = hermesHom
55688
55900
  const path4 = join45(dir, "config.yaml");
55689
55901
  let text4 = "";
55690
55902
  try {
55691
- text4 = readFileSync28(path4, "utf8");
55903
+ text4 = readFileSync29(path4, "utf8");
55692
55904
  } catch {
55693
55905
  text4 = "";
55694
55906
  }
@@ -55756,13 +55968,13 @@ function hermesConfiguredModel(env = process.env) {
55756
55968
  const dir = hermesHome(env);
55757
55969
  let secrets = "";
55758
55970
  try {
55759
- secrets = readFileSync28(join45(dir, ".env"), "utf8");
55971
+ secrets = readFileSync29(join45(dir, ".env"), "utf8");
55760
55972
  } catch {
55761
55973
  }
55762
55974
  const hasHostedProviderKey = HERMES_HOSTED_PROVIDER_KEYS.some((name) => nonEmptyDotenvValue(secrets, name));
55763
55975
  let configuredDefault = null;
55764
55976
  try {
55765
- configuredDefault = hermesConfigDefault(readFileSync28(join45(dir, "config.yaml"), "utf8"));
55977
+ configuredDefault = hermesConfigDefault(readFileSync29(join45(dir, "config.yaml"), "utf8"));
55766
55978
  } catch {
55767
55979
  }
55768
55980
  const configuredProvider = configuredDefault?.provider.toLowerCase() ?? "";
@@ -55787,12 +55999,12 @@ function hermesModelProvider(modelId) {
55787
55999
  }
55788
56000
  function readJson(path4) {
55789
56001
  try {
55790
- return JSON.parse(readFileSync28(path4, "utf8"));
56002
+ return JSON.parse(readFileSync29(path4, "utf8"));
55791
56003
  } catch {
55792
56004
  return null;
55793
56005
  }
55794
56006
  }
55795
- function record3(value) {
56007
+ function record4(value) {
55796
56008
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
55797
56009
  }
55798
56010
  function notExpired(row, now) {
@@ -55807,18 +56019,18 @@ function oauthRowSignedIn(row, now) {
55807
56019
  return present(row.access_token) && notExpired(row, now);
55808
56020
  }
55809
56021
  function hermesSignedInProviders(env = process.env, now = Date.now()) {
55810
- const store = record3(readJson(join45(hermesHome(env), "auth.json")));
56022
+ const store = record4(readJson(join45(hermesHome(env), "auth.json")));
55811
56023
  const out = /* @__PURE__ */ new Set();
55812
56024
  if (!store) return out;
55813
- const providers = record3(store.providers) ?? {};
56025
+ const providers = record4(store.providers) ?? {};
55814
56026
  for (const [id, state2] of Object.entries(providers)) {
55815
- const row = record3(state2);
56027
+ const row = record4(state2);
55816
56028
  if (row && oauthRowSignedIn(row, now)) out.add(id.toLowerCase());
55817
56029
  }
55818
- for (const [id, rows] of Object.entries(record3(store.credential_pool) ?? {})) {
56030
+ for (const [id, rows] of Object.entries(record4(store.credential_pool) ?? {})) {
55819
56031
  if (id in providers || !Array.isArray(rows)) continue;
55820
56032
  const signedIn = rows.some((value) => {
55821
- const row = record3(value);
56033
+ const row = record4(value);
55822
56034
  if (!row) return false;
55823
56035
  const oauth = String(row.auth_type ?? "").toLowerCase().startsWith("oauth") || present(row.refresh_token);
55824
56036
  return oauth && present(row.access_token) && oauthRowSignedIn(row, now);
@@ -55831,7 +56043,7 @@ function hermesZaiCodingPlan(env = process.env) {
55831
56043
  const dir = hermesHome(env);
55832
56044
  let secrets = "";
55833
56045
  try {
55834
- secrets = readFileSync28(join45(dir, ".env"), "utf8");
56046
+ secrets = readFileSync29(join45(dir, ".env"), "utf8");
55835
56047
  } catch {
55836
56048
  }
55837
56049
  const keyed = ["GLM_API_KEY", "ZAI_API_KEY", "Z_AI_API_KEY"].some((name) => present(env[name]) || nonEmptyDotenvValue(secrets, name));
@@ -55839,21 +56051,21 @@ function hermesZaiCodingPlan(env = process.env) {
55839
56051
  const coding = (url2) => typeof url2 === "string" && /\/api\/coding\/paas\//i.test(url2);
55840
56052
  const override = present(env.GLM_BASE_URL) ? env.GLM_BASE_URL : nonEmptyDotenvValue(secrets, "GLM_BASE_URL");
55841
56053
  if (override) return coding(override);
55842
- const detected = record3(record3(record3(record3(readJson(join45(dir, "auth.json")))?.providers)?.zai)?.detected_endpoint);
56054
+ const detected = record4(record4(record4(record4(readJson(join45(dir, "auth.json")))?.providers)?.zai)?.detected_endpoint);
55843
56055
  return coding(detected?.base_url);
55844
56056
  }
55845
56057
  function hermesZaiPlanHosts(options, codingPlan) {
55846
56058
  return codingPlan ? options.map((option) => option.provider === "zai" ? { ...option, provider: "zai-coding-plan" } : option) : [...options];
55847
56059
  }
55848
56060
  function hermesCachedModels(home, provider) {
55849
- const catalog2 = record3(record3(record3(readJson(join45(home, "cache", "model_catalog.json")))?.providers)?.[provider]);
55850
- const name = String(record3(catalog2?.metadata)?.display_name ?? "").trim() || provider;
55851
- const rows = Array.isArray(catalog2?.models) ? catalog2.models.map(record3).filter((row) => row && present(row.id)) : [];
56061
+ const catalog2 = record4(record4(record4(readJson(join45(home, "cache", "model_catalog.json")))?.providers)?.[provider]);
56062
+ const name = String(record4(catalog2?.metadata)?.display_name ?? "").trim() || provider;
56063
+ const rows = Array.isArray(catalog2?.models) ? catalog2.models.map(record4).filter((row) => row && present(row.id)) : [];
55852
56064
  if (rows.length) {
55853
56065
  const ordered = [...rows.filter((row) => row.default === true), ...rows.filter((row) => row.default !== true)];
55854
56066
  return { ids: ordered.map((row) => String(row.id).trim()), name };
55855
56067
  }
55856
- const cached3 = record3(record3(readJson(join45(home, "provider_models_cache.json")))?.[provider])?.models;
56068
+ const cached3 = record4(record4(readJson(join45(home, "provider_models_cache.json")))?.[provider])?.models;
55857
56069
  return { ids: Array.isArray(cached3) ? cached3.filter(present).map((id) => String(id).trim()) : [], name };
55858
56070
  }
55859
56071
  function hermesAuthStoreModels(env = process.env, now = Date.now()) {
@@ -55871,7 +56083,7 @@ function hermesConfiguredHostModel(env = process.env) {
55871
56083
  const home = hermesHome(env);
55872
56084
  let configured = null;
55873
56085
  try {
55874
- configured = hermesConfigDefault(readFileSync28(join45(home, "config.yaml"), "utf8"));
56086
+ configured = hermesConfigDefault(readFileSync29(join45(home, "config.yaml"), "utf8"));
55875
56087
  } catch {
55876
56088
  return null;
55877
56089
  }
@@ -56245,8 +56457,8 @@ function decodeConfig5(raw) {
56245
56457
  return config2;
56246
56458
  }
56247
56459
  function ollamaCloudCatalog(body, configuredModel) {
56248
- const record5 = body && typeof body === "object" && !Array.isArray(body) ? body : null;
56249
- const rows = Array.isArray(body) ? body : Array.isArray(record5?.data) ? record5.data : [];
56460
+ const record6 = body && typeof body === "object" && !Array.isArray(body) ? body : null;
56461
+ const rows = Array.isArray(body) ? body : Array.isArray(record6?.data) ? record6.data : [];
56250
56462
  const options = [];
56251
56463
  const seen = /* @__PURE__ */ new Set();
56252
56464
  for (const row of rows) {
@@ -56502,13 +56714,13 @@ var init_openai_compat = __esm({
56502
56714
  });
56503
56715
 
56504
56716
  // server/drivers/pi.ts
56505
- import { chmodSync as chmodSync6, existsSync as existsSync24, mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync5, readFileSync as readFileSync29, rmSync as rmSync10, writeFileSync as writeFileSync21 } from "node:fs";
56717
+ import { chmodSync as chmodSync6, existsSync as existsSync24, mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync5, readFileSync as readFileSync30, rmSync as rmSync10, writeFileSync as writeFileSync21 } from "node:fs";
56506
56718
  import { homedir as homedir26, tmpdir as tmpdir6 } from "node:os";
56507
56719
  import { join as join47 } from "node:path";
56508
56720
  function readPiPromptImages(turn) {
56509
56721
  return (turn.images ?? []).map((image) => ({
56510
56722
  type: "image",
56511
- data: readFileSync29(image.path).toString("base64"),
56723
+ data: readFileSync30(image.path).toString("base64"),
56512
56724
  mimeType: image.mime
56513
56725
  }));
56514
56726
  }
@@ -56565,7 +56777,7 @@ function piMcpToolRef(title, customServers, hintsPath) {
56565
56777
  const tool2 = match[2];
56566
56778
  if (!hintsPath) return { server, tool: tool2 };
56567
56779
  try {
56568
- const hints = JSON.parse(readFileSync29(hintsPath, "utf8"));
56780
+ const hints = JSON.parse(readFileSync30(hintsPath, "utf8"));
56569
56781
  const known = hints?.[server]?.[tool2];
56570
56782
  return known && typeof known === "object" ? { server, tool: tool2, annotations: known } : { server, tool: tool2 };
56571
56783
  } catch {
@@ -56641,7 +56853,7 @@ function ensurePiInjectModel(modelId, env = process.env) {
56641
56853
  let root = { providers: {} };
56642
56854
  if (existsSync24(path4)) {
56643
56855
  try {
56644
- const parsed = JSON.parse(readFileSync29(path4, "utf8"));
56856
+ const parsed = JSON.parse(readFileSync30(path4, "utf8"));
56645
56857
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
56646
56858
  root = parsed;
56647
56859
  } else {
@@ -56693,7 +56905,7 @@ function ensurePiInjectModel(modelId, env = process.env) {
56693
56905
  function readPiDefaultModel(env) {
56694
56906
  const home = env.HOME || env.USERPROFILE || homedir26();
56695
56907
  try {
56696
- const s4 = JSON.parse(readFileSync29(`${home}/.pi/agent/settings.json`, "utf8"));
56908
+ const s4 = JSON.parse(readFileSync30(`${home}/.pi/agent/settings.json`, "utf8"));
56697
56909
  return s4.defaultProvider && s4.defaultModel ? `${s4.defaultProvider}/${s4.defaultModel}` : "";
56698
56910
  } catch {
56699
56911
  return "";
@@ -57358,7 +57570,7 @@ var init_mistral = __esm({
57358
57570
  });
57359
57571
 
57360
57572
  // server/drivers/minimax.ts
57361
- import { readFileSync as readFileSync30 } from "node:fs";
57573
+ import { readFileSync as readFileSync31 } from "node:fs";
57362
57574
  import { homedir as homedir27 } from "node:os";
57363
57575
  import { join as join48 } from "node:path";
57364
57576
  function normalizedApiUrl(value) {
@@ -57367,7 +57579,7 @@ function normalizedApiUrl(value) {
57367
57579
  }
57368
57580
  function loadLocalMiniMaxConfig(home = homedir27()) {
57369
57581
  try {
57370
- const raw = localConfigSchema.parse(JSON.parse(readFileSync30(join48(home, ".mmx", "config.json"), "utf8")));
57582
+ const raw = localConfigSchema.parse(JSON.parse(readFileSync31(join48(home, ".mmx", "config.json"), "utf8")));
57371
57583
  const configuredUrl = raw.base_url?.trim() ? raw.base_url : raw.region === "cn" ? CN_URL : DEFAULT_URL3;
57372
57584
  return {
57373
57585
  apiKey: raw.api_key?.trim() ?? "",
@@ -57843,10 +58055,14 @@ var init_apple_intelligence2 = __esm({
57843
58055
  });
57844
58056
 
57845
58057
  // server/drivers/builtIn.ts
57846
- var BUILT_IN_DRIVERS;
58058
+ function builtInDriversFor(platform) {
58059
+ return ALL_BUILT_IN_DRIVERS.filter((driver) => engineOnPlatform(driver.driverKind, platform));
58060
+ }
58061
+ var ALL_BUILT_IN_DRIVERS, BUILT_IN_DRIVERS;
57847
58062
  var init_builtIn = __esm({
57848
58063
  "server/drivers/builtIn.ts"() {
57849
58064
  "use strict";
58065
+ init_engine_platforms();
57850
58066
  init_antigravity();
57851
58067
  init_boxagent();
57852
58068
  init_claude();
@@ -57869,7 +58085,7 @@ var init_builtIn = __esm({
57869
58085
  init_minimax();
57870
58086
  init_ollama_cloud();
57871
58087
  init_apple_intelligence2();
57872
- BUILT_IN_DRIVERS = [
58088
+ ALL_BUILT_IN_DRIVERS = [
57873
58089
  GrokDriver,
57874
58090
  GrokAgentDriver,
57875
58091
  GeminiAgentDriver,
@@ -57893,6 +58109,7 @@ var init_builtIn = __esm({
57893
58109
  OllamaCloudDriver,
57894
58110
  AppleIntelligenceDriver
57895
58111
  ];
58112
+ BUILT_IN_DRIVERS = builtInDriversFor(process.platform);
57896
58113
  }
57897
58114
  });
57898
58115
 
@@ -57970,10 +58187,10 @@ async function setupJson(url2, key, body) {
57970
58187
  }
57971
58188
  }
57972
58189
  async function fetchSetupModels(url2, key) {
57973
- const json2 = record4(await setupJson(url2, key));
58190
+ const json2 = record5(await setupJson(url2, key));
57974
58191
  const models2 = /* @__PURE__ */ new Map();
57975
58192
  for (const entry of Array.isArray(json2?.data) ? json2.data : []) {
57976
- const item = record4(entry);
58193
+ const item = record5(entry);
57977
58194
  const id = typeof item?.id === "string" ? item.id.trim() : "";
57978
58195
  if (!id || /[\u0000-\u001f\u007f]/u.test(id) || models2.has(id)) continue;
57979
58196
  const name = typeof item?.name === "string" ? item.name.replace(/[\u0000-\u001f\u007f]/gu, "").trim() : "";
@@ -57987,19 +58204,19 @@ async function verifySetupCompletion(url2, key, model, provider) {
57987
58204
  if (!id || /[\u0000-\u001f\u007f]/u.test(id)) throw new SetupApiError("Choose a non-empty model ID without control characters.");
57988
58205
  const host = new URL(normalizeApiUrl(url2)).hostname.toLowerCase();
57989
58206
  const pinProvider = provider && (host === "openrouter.ai" || host.endsWith(".openrouter.ai"));
57990
- const json2 = record4(await setupJson(url2, key, {
58207
+ const json2 = record5(await setupJson(url2, key, {
57991
58208
  model: id,
57992
58209
  messages: [{ role: "user", content: "Reply with exactly OK." }],
57993
58210
  stream: false,
57994
58211
  ...pinProvider ? { provider: { order: [provider], allow_fallbacks: false } } : {}
57995
58212
  }));
57996
- const choice = record4(Array.isArray(json2?.choices) ? json2.choices[0] : void 0);
57997
- const message2 = record4(choice?.message);
58213
+ const choice = record5(Array.isArray(json2?.choices) ? json2.choices[0] : void 0);
58214
+ const message2 = record5(choice?.message);
57998
58215
  if (message2?.role !== "assistant" || typeof message2.content !== "string" || !message2.content.trim()) {
57999
58216
  throw new SetupApiError("The API did not return an assistant text reply. Choose a model that supports Chat Completions, then try again.");
58000
58217
  }
58001
58218
  }
58002
- var API_ENDPOINTS, SetupApiError, record4;
58219
+ var API_ENDPOINTS, SetupApiError, record5;
58003
58220
  var init_cli_api_setup = __esm({
58004
58221
  "server/cli-api-setup.ts"() {
58005
58222
  "use strict";
@@ -58010,7 +58227,7 @@ var init_cli_api_setup = __esm({
58010
58227
  ];
58011
58228
  SetupApiError = class extends Error {
58012
58229
  };
58013
- record4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
58230
+ record5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
58014
58231
  }
58015
58232
  });
58016
58233
 
@@ -58024,7 +58241,7 @@ __export(cli_setup_exports, {
58024
58241
  saveCliStartup: () => saveCliStartup
58025
58242
  });
58026
58243
  import { spawn as spawn9 } from "node:child_process";
58027
- import { readFileSync as readFileSync31 } from "node:fs";
58244
+ import { readFileSync as readFileSync32 } from "node:fs";
58028
58245
  import { join as join50, resolve as resolve11 } from "node:path";
58029
58246
  import { randomUUID as randomUUID16 } from "node:crypto";
58030
58247
  async function inspect(id, entry) {
@@ -58062,7 +58279,7 @@ function assertDataDir(dataDir) {
58062
58279
  }
58063
58280
  function checkStoredConfig(dataDir) {
58064
58281
  try {
58065
- parseStoredConfig(JSON.parse(readFileSync31(join50(dataDir, "config.json"), "utf8")));
58282
+ parseStoredConfig(JSON.parse(readFileSync32(join50(dataDir, "config.json"), "utf8")));
58066
58283
  } catch (error51) {
58067
58284
  if (error51.code === "ENOENT") return;
58068
58285
  throw new Error("Existing config.json could not be read or validated. Setup has not changed it; repair it before continuing.");
@@ -58472,7 +58689,7 @@ __export(browser_engine_exports, {
58472
58689
  resolveAgentBrowserBinary: () => resolveAgentBrowserBinary
58473
58690
  });
58474
58691
  import { createHash as createHash16, randomBytes as randomBytes3, randomUUID as randomUUID17 } from "node:crypto";
58475
- import { chmodSync as chmodSync7, constants as constants3, copyFileSync, existsSync as existsSync25, mkdirSync as mkdirSync26, readFileSync as readFileSync32, readdirSync as readdirSync8, renameSync as renameSync8, rmSync as rmSync11, statSync as statSync6, unlinkSync as unlinkSync7, writeFileSync as writeFileSync22 } from "node:fs";
58692
+ import { chmodSync as chmodSync7, constants as constants3, copyFileSync, existsSync as existsSync25, mkdirSync as mkdirSync26, readFileSync as readFileSync33, readdirSync as readdirSync8, renameSync as renameSync8, rmSync as rmSync11, statSync as statSync6, unlinkSync as unlinkSync7, writeFileSync as writeFileSync22 } from "node:fs";
58476
58693
  import { homedir as homedir28, tmpdir as tmpdir7 } from "node:os";
58477
58694
  import { delimiter as delimiter7, dirname as dirname12, join as join53, resolve as resolve12 } from "node:path";
58478
58695
  function browserRestoreKey(session) {
@@ -58496,7 +58713,7 @@ function ensureManagedBrowserConfig(env) {
58496
58713
  writeFileSync22(path4, "{}\n", { flag: "wx", mode: 384 });
58497
58714
  } catch (error51) {
58498
58715
  if (error51.code !== "EEXIST") throw error51;
58499
- if (readFileSync32(path4, "utf8").trim() !== "{}") throw new Error("The managed browser configuration was changed. Restore it to an empty JSON object before connecting.");
58716
+ if (readFileSync33(path4, "utf8").trim() !== "{}") throw new Error("The managed browser configuration was changed. Restore it to an empty JSON object before connecting.");
58500
58717
  }
58501
58718
  return path4;
58502
58719
  }
@@ -58752,12 +58969,12 @@ function ensureChrome(binaryPath, options = {}) {
58752
58969
  return new Promise((done, fail) => {
58753
58970
  const child = spawnCommand(binaryPath, args, { env: options.env ?? process.env, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
58754
58971
  let output = "";
58755
- const record5 = (chunk) => {
58972
+ const record6 = (chunk) => {
58756
58973
  output += String(chunk);
58757
58974
  if (output.length > 262144) output = output.slice(-262144);
58758
58975
  };
58759
- child.stdout?.on("data", record5);
58760
- child.stderr?.on("data", record5);
58976
+ child.stdout?.on("data", record6);
58977
+ child.stderr?.on("data", record6);
58761
58978
  let timedOut = false;
58762
58979
  let exited = false;
58763
58980
  const timer = setTimeout(() => {
@@ -58791,7 +59008,7 @@ function ensureChrome(binaryPath, options = {}) {
58791
59008
  function browserEngineEncryptionKey(dataDir = DATA_DIR) {
58792
59009
  const file2 = join53(dataDir, KEY_FILE);
58793
59010
  try {
58794
- const existing = readFileSync32(file2, "utf8").trim();
59011
+ const existing = readFileSync33(file2, "utf8").trim();
58795
59012
  if (/^[0-9a-f]{64}$/u.test(existing)) return existing;
58796
59013
  } catch {
58797
59014
  }
@@ -58872,7 +59089,7 @@ function agentBrowserFrame(input) {
58872
59089
  fail(error51);
58873
59090
  return;
58874
59091
  }
58875
- settle({ png: readFileSync32(file2).toString("base64"), format: "png" });
59092
+ settle({ png: readFileSync33(file2).toString("base64"), format: "png" });
58876
59093
  } catch {
58877
59094
  fail(new Error("the browser reported a picture it did not write"));
58878
59095
  } finally {
@@ -59037,7 +59254,7 @@ Or run without a global install: \`npx @chibitek/chibi\`. Node 24+ is required.
59037
59254
  var import_qrcode_terminal = __toESM(require_main(), 1);
59038
59255
  import { spawn as spawn10 } from "node:child_process";
59039
59256
  import { randomBytes as randomBytes4 } from "node:crypto";
59040
- import { closeSync as closeSync6, existsSync as existsSync26, mkdirSync as mkdirSync27, openSync as openSync6, readFileSync as readFileSync33 } from "node:fs";
59257
+ import { closeSync as closeSync6, existsSync as existsSync26, mkdirSync as mkdirSync27, openSync as openSync6, readFileSync as readFileSync34 } from "node:fs";
59041
59258
  import { homedir as homedir29 } from "node:os";
59042
59259
  import { dirname as dirname13, join as join54, resolve as resolve13 } from "node:path";
59043
59260
  import { createInterface as createInterface2 } from "node:readline/promises";
@@ -59062,18 +59279,18 @@ var isPlainRecord = (value) => {
59062
59279
  };
59063
59280
  var plainObject = (value) => {
59064
59281
  if (!isPlainRecord(value)) return null;
59065
- const record5 = {};
59282
+ const record6 = {};
59066
59283
  try {
59067
59284
  for (const key of Reflect.ownKeys(value)) {
59068
59285
  if (!Object.prototype.propertyIsEnumerable.call(value, key)) continue;
59069
59286
  if (typeof key !== "string") return null;
59070
59287
  if (key === "__proto__") continue;
59071
- record5[key] = value[key];
59288
+ record6[key] = value[key];
59072
59289
  }
59073
59290
  } catch {
59074
59291
  return null;
59075
59292
  }
59076
- return record5;
59293
+ return record6;
59077
59294
  };
59078
59295
  var validClientInstance = (value) => {
59079
59296
  const input = stringValue(value);
@@ -60553,14 +60770,14 @@ async function writeRow(dataDir, row) {
60553
60770
  }
60554
60771
  }
60555
60772
  function appendAdminAction(dataDir, row) {
60556
- const record5 = {
60773
+ const record6 = {
60557
60774
  ...row,
60558
60775
  at: row.at ?? (/* @__PURE__ */ new Date()).toISOString(),
60559
60776
  ...row.before ? { before: auditValues(row.before) } : {},
60560
60777
  ...row.after ? { after: auditValues(row.after) } : {}
60561
60778
  };
60562
60779
  const previous = writeQueues.get(dataDir) ?? Promise.resolve();
60563
- const queued = previous.then(() => writeRow(dataDir, record5)).catch(() => {
60780
+ const queued = previous.then(() => writeRow(dataDir, record6)).catch(() => {
60564
60781
  });
60565
60782
  writeQueues.set(dataDir, queued);
60566
60783
  void queued.finally(() => {
@@ -61293,16 +61510,16 @@ function emptyRegistry(domain2) {
61293
61510
  }
61294
61511
  function parseRegistry(text4) {
61295
61512
  const value = JSON.parse(text4);
61296
- const record5 = value && typeof value === "object" ? value : null;
61297
- if (!record5 || record5.version !== 1 || typeof record5.domain !== "string" || typeof record5.nextPort !== "number" || !record5.workspaces || typeof record5.workspaces !== "object") {
61513
+ const record6 = value && typeof value === "object" ? value : null;
61514
+ if (!record6 || record6.version !== 1 || typeof record6.domain !== "string" || typeof record6.nextPort !== "number" || !record6.workspaces || typeof record6.workspaces !== "object") {
61298
61515
  throw new Error("fleet.json is not a fleet registry this version understands");
61299
61516
  }
61300
61517
  return {
61301
61518
  version: 1,
61302
- domain: record5.domain,
61303
- nextPort: record5.nextPort,
61304
- ...typeof record5.operator === "string" ? { operator: record5.operator } : {},
61305
- workspaces: { ...record5.workspaces }
61519
+ domain: record6.domain,
61520
+ nextPort: record6.nextPort,
61521
+ ...typeof record6.operator === "string" ? { operator: record6.operator } : {},
61522
+ workspaces: { ...record6.workspaces }
61306
61523
  };
61307
61524
  }
61308
61525
  function fleetUser(slug) {
@@ -62867,7 +63084,7 @@ function defaultIo() {
62867
63084
  }
62868
63085
  function serverVersion(here = HERE2) {
62869
63086
  try {
62870
- const parsed = JSON.parse(readFileSync33(resolve13(here, "..", "package.json"), "utf8"));
63087
+ const parsed = JSON.parse(readFileSync34(resolve13(here, "..", "package.json"), "utf8"));
62871
63088
  const version2 = typeof parsed === "object" && parsed !== null ? Reflect.get(parsed, "version") : void 0;
62872
63089
  return typeof version2 === "string" && version2 ? version2 : "0.0.0";
62873
63090
  } catch {
@@ -62898,7 +63115,7 @@ async function isWorkspaceRunning(options) {
62898
63115
  try {
62899
63116
  const { status, body } = await api(options.port, "/api/health");
62900
63117
  if (status !== 200 || body?.app !== "openmausbot") return false;
62901
- const expected = readFileSync33(join54(options.dataDir, "environment-id"), "utf8").trim();
63118
+ const expected = readFileSync34(join54(options.dataDir, "environment-id"), "utf8").trim();
62902
63119
  const descriptor = await api(options.port, "/.well-known/openmausbot/environment");
62903
63120
  return /^[0-9a-f-]{36}$/i.test(expected) && descriptor.status === 200 && descriptor.body?.environmentId === expected;
62904
63121
  } catch {
@@ -63141,7 +63358,7 @@ async function runAccess(options, io2 = defaultIo()) {
63141
63358
  let raw = {};
63142
63359
  if (existsSync26(file2)) {
63143
63360
  try {
63144
- const parsed = JSON.parse(readFileSync33(file2, "utf8"));
63361
+ const parsed = JSON.parse(readFileSync34(file2, "utf8"));
63145
63362
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error("not an object");
63146
63363
  raw = Object.fromEntries(Object.entries(parsed));
63147
63364
  } catch (error51) {