@codexhost/cli-linux-arm64 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +3166 -3040
  4. package/app/console-web.js +1156 -585
  5. package/app/desktop-controller.mjs +645 -264
  6. package/app/host-runtime.mjs +10906 -10282
  7. package/app/plugins/antigravity/plugin.mjs +515 -369
  8. package/app/plugins/claude-code/plugin.mjs +583 -438
  9. package/app/plugins/codebuddy/plugin.mjs +551 -429
  10. package/app/plugins/codex-usage/plugin.mjs +344 -224
  11. package/app/plugins/copilot/plugin.mjs +408 -286
  12. package/app/plugins/cursor-cli/plugin.mjs +499 -360
  13. package/app/plugins/deepseek-harness/plugin.mjs +759 -520
  14. package/app/plugins/devin/plugin.mjs +385 -265
  15. package/app/plugins/grok/plugin.mjs +638 -516
  16. package/app/plugins/hermes/plugin.mjs +456 -334
  17. package/app/plugins/kimi-code/plugin.mjs +454 -332
  18. package/app/plugins/kiro-cli/plugin.mjs +445 -325
  19. package/app/plugins/omp/plugin.mjs +707 -339
  20. package/app/plugins/opencode/plugin.mjs +873 -741
  21. package/app/plugins/pi/plugin.mjs +481 -359
  22. package/app/plugins/qoder/plugin.mjs +682 -560
  23. package/app/plugins/qoder-cn/plugin.mjs +682 -560
  24. package/app/plugins/qwen-code/plugin.mjs +475 -355
  25. package/app/plugins/workbuddy/plugin.mjs +549 -429
  26. package/app/plugins/zcode/plugin.mjs +352 -232
  27. package/app/renderer-extension.js +1706 -945
  28. package/app/web/assets/{index-IvFk9KT-.js → index-DUOvhHbV.js} +82 -82
  29. package/app/web/codexhost-settings.js +416 -51
  30. package/app/web/index.html +1 -1
  31. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
  32. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  33. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +97 -97
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
  44. package/app/web-modules/server.mjs +2132 -1312
  45. package/bin/codexhost +0 -0
  46. package/libexec/codexhost-shim +0 -0
  47. package/libexec/codexhost-updater +0 -0
  48. package/package.json +1 -1
@@ -147,8 +147,8 @@ var VERSION_MANAGER_ROOTS = "<version-managers>";
147
147
  function installRootExtensions(platform) {
148
148
  return platform === "win32" ? [".exe", ".cmd"] : [""];
149
149
  }
150
- function resolveHomeDirectory(input) {
151
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
150
+ function resolveHomeDirectory(input2) {
151
+ return input2.homeDirectory ?? environmentValue(input2.environment, "HOME") ?? environmentValue(input2.environment, "USERPROFILE") ?? os.homedir();
152
152
  }
153
153
  function templateVariables(environment, platform, home) {
154
154
  const pathFlavor = targetPath(platform);
@@ -181,36 +181,36 @@ function expandInstallRoot(template, environment, platform, home) {
181
181
  });
182
182
  return unresolved ? void 0 : joinTemplate(platform, substituted);
183
183
  }
184
- function installRootDirectories(spec, input, dependencies, platform, home) {
184
+ function installRootDirectories(spec, input2, dependencies, platform, home) {
185
185
  const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
186
186
  const directories = [];
187
187
  for (const template of templates) {
188
188
  if (template === VERSION_MANAGER_ROOTS) {
189
189
  directories.push(...versionManagerBinaryDirectories({
190
190
  platform,
191
- environment: input.environment,
191
+ environment: input2.environment,
192
192
  home,
193
193
  ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
194
194
  }));
195
195
  continue;
196
196
  }
197
- const directory = expandInstallRoot(template, input.environment, platform, home);
197
+ const directory = expandInstallRoot(template, input2.environment, platform, home);
198
198
  if (directory !== void 0)
199
199
  directories.push(directory);
200
200
  }
201
201
  return directories;
202
202
  }
203
- function harnessCandidates(spec, input, dependencies = {}) {
204
- const platform = input.platform ?? process.platform;
203
+ function harnessCandidates(spec, input2, dependencies = {}) {
204
+ const platform = input2.platform ?? process.platform;
205
205
  const pathFlavor = targetPath(platform);
206
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
206
+ const configured = input2.command ?? (spec.commandEnvironmentVariable ? environmentValue(input2.environment, spec.commandEnvironmentVariable) : void 0);
207
207
  const command = configured ?? spec.command;
208
208
  if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
209
209
  return [{ candidate: command, source: "configured" }];
210
210
  }
211
211
  const candidates = [];
212
- const extensions = executableExtensions(command, platform, input.environment);
213
- for (const directory of pathDirectories(input.environment, platform)) {
212
+ const extensions = executableExtensions(command, platform, input2.environment);
213
+ for (const directory of pathDirectories(input2.environment, platform)) {
214
214
  for (const extension of extensions) {
215
215
  candidates.push({
216
216
  candidate: pathFlavor.join(directory, command + extension),
@@ -220,8 +220,8 @@ function harnessCandidates(spec, input, dependencies = {}) {
220
220
  }
221
221
  if (configured !== void 0)
222
222
  return candidates;
223
- const home = resolveHomeDirectory(input);
224
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
223
+ const home = resolveHomeDirectory(input2);
224
+ for (const directory of installRootDirectories(spec, input2, dependencies, platform, home)) {
225
225
  for (const extension of installRootExtensions(platform)) {
226
226
  candidates.push({
227
227
  candidate: pathFlavor.join(directory, spec.command + extension),
@@ -231,12 +231,12 @@ function harnessCandidates(spec, input, dependencies = {}) {
231
231
  }
232
232
  return candidates;
233
233
  }
234
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
235
- const platform = input.platform ?? process.platform;
234
+ function resolveHarnessExecutable(spec, input2, dependencies = {}) {
235
+ const platform = input2.platform ?? process.platform;
236
236
  const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
237
237
  const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
238
238
  const context = { platform, isExecutable };
239
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
239
+ for (const { candidate, source } of harnessCandidates(spec, input2, dependencies)) {
240
240
  const executable = runnable(candidate, context);
241
241
  if (executable !== void 0 && isExecutable(executable))
242
242
  return { executable, source };
@@ -247,13 +247,13 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
247
247
  // ../../harness-discovery/dist/installation.js
248
248
  import { execFile } from "node:child_process";
249
249
  import { homedir } from "node:os";
250
- function runInstallationCommand(command, args, environment, timeout = 3e4) {
250
+ function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
251
251
  const env = withNodeRuntimeOnPath(environment);
252
252
  const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
253
253
  return new Promise((resolve, reject) => {
254
254
  const child = execFile(invocation.command, invocation.arguments, {
255
255
  env,
256
- cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
256
+ cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
257
257
  encoding: "utf8",
258
258
  timeout,
259
259
  killSignal: "SIGKILL",
@@ -275,7 +275,7 @@ function createInstallationManager(options) {
275
275
  const check2 = () => checking ??= options.check().finally(() => {
276
276
  checking = void 0;
277
277
  });
278
- return (action) => {
278
+ return (action, confirmedVersion) => {
279
279
  if (updating)
280
280
  return updating;
281
281
  if (action === "check")
@@ -286,6 +286,8 @@ function createInstallationManager(options) {
286
286
  return before;
287
287
  if (!before.canUpdate)
288
288
  throw new Error(before.message ?? "This installation cannot be updated automatically");
289
+ if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
290
+ return { ...before, confirmationRequired: true };
289
291
  await options.update(before);
290
292
  const after = await check2();
291
293
  if (after.currentVersion === before.currentVersion)
@@ -1077,8 +1079,8 @@ function cached(getter) {
1077
1079
  }
1078
1080
  };
1079
1081
  }
1080
- function nullish(input) {
1081
- return input === null || input === void 0;
1082
+ function nullish(input2) {
1083
+ return input2 === null || input2 === void 0;
1082
1084
  }
1083
1085
  function cleanRegex(source) {
1084
1086
  const start = source.startsWith("^") ? 1 : 0;
@@ -1165,8 +1167,8 @@ function randomString(length = 10) {
1165
1167
  function esc(str) {
1166
1168
  return JSON.stringify(str);
1167
1169
  }
1168
- function slugify(input) {
1169
- return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1170
+ function slugify(input2) {
1171
+ return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1170
1172
  }
1171
1173
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1172
1174
  };
@@ -1571,19 +1573,19 @@ function finalizeIssue(iss, ctx, config2) {
1571
1573
  }
1572
1574
  return rest;
1573
1575
  }
1574
- function getSizableOrigin(input) {
1575
- if (input instanceof Set)
1576
+ function getSizableOrigin(input2) {
1577
+ if (input2 instanceof Set)
1576
1578
  return "set";
1577
- if (input instanceof Map)
1579
+ if (input2 instanceof Map)
1578
1580
  return "map";
1579
- if (input instanceof File)
1581
+ if (input2 instanceof File)
1580
1582
  return "file";
1581
1583
  return "unknown";
1582
1584
  }
1583
- function getLengthableOrigin(input) {
1584
- if (Array.isArray(input))
1585
+ function getLengthableOrigin(input2) {
1586
+ if (Array.isArray(input2))
1585
1587
  return "array";
1586
- if (typeof input === "string")
1588
+ if (typeof input2 === "string")
1587
1589
  return "string";
1588
1590
  return "unknown";
1589
1591
  }
@@ -1609,12 +1611,12 @@ function parsedType(data) {
1609
1611
  return t;
1610
1612
  }
1611
1613
  function issue(...args) {
1612
- const [iss, input, inst] = args;
1614
+ const [iss, input2, inst] = args;
1613
1615
  if (typeof iss === "string") {
1614
1616
  return {
1615
1617
  message: iss,
1616
1618
  code: "custom",
1617
- input,
1619
+ input: input2,
1618
1620
  inst
1619
1621
  };
1620
1622
  }
@@ -2158,23 +2160,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2158
2160
  bag.pattern = integer;
2159
2161
  });
2160
2162
  inst._zod.check = (payload) => {
2161
- const input = payload.value;
2163
+ const input2 = payload.value;
2162
2164
  if (isInt) {
2163
- if (!Number.isInteger(input)) {
2165
+ if (!Number.isInteger(input2)) {
2164
2166
  payload.issues.push({
2165
2167
  expected: origin,
2166
2168
  format: def.format,
2167
2169
  code: "invalid_type",
2168
2170
  continue: false,
2169
- input,
2171
+ input: input2,
2170
2172
  inst
2171
2173
  });
2172
2174
  return;
2173
2175
  }
2174
- if (!Number.isSafeInteger(input)) {
2175
- if (input > 0) {
2176
+ if (!Number.isSafeInteger(input2)) {
2177
+ if (input2 > 0) {
2176
2178
  payload.issues.push({
2177
- input,
2179
+ input: input2,
2178
2180
  code: "too_big",
2179
2181
  maximum: Number.MAX_SAFE_INTEGER,
2180
2182
  note: "Integers must be within the safe integer range.",
@@ -2185,7 +2187,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2185
2187
  });
2186
2188
  } else {
2187
2189
  payload.issues.push({
2188
- input,
2190
+ input: input2,
2189
2191
  code: "too_small",
2190
2192
  minimum: Number.MIN_SAFE_INTEGER,
2191
2193
  note: "Integers must be within the safe integer range.",
@@ -2198,10 +2200,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2198
2200
  return;
2199
2201
  }
2200
2202
  }
2201
- if (input < minimum) {
2203
+ if (input2 < minimum) {
2202
2204
  payload.issues.push({
2203
2205
  origin: "number",
2204
- input,
2206
+ input: input2,
2205
2207
  code: "too_small",
2206
2208
  minimum,
2207
2209
  inclusive: true,
@@ -2209,10 +2211,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2209
2211
  continue: !def.abort
2210
2212
  });
2211
2213
  }
2212
- if (input > maximum) {
2214
+ if (input2 > maximum) {
2213
2215
  payload.issues.push({
2214
2216
  origin: "number",
2215
- input,
2217
+ input: input2,
2216
2218
  code: "too_big",
2217
2219
  maximum,
2218
2220
  inclusive: true,
@@ -2232,11 +2234,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2232
2234
  bag.maximum = maximum;
2233
2235
  });
2234
2236
  inst._zod.check = (payload) => {
2235
- const input = payload.value;
2236
- if (input < minimum) {
2237
+ const input2 = payload.value;
2238
+ if (input2 < minimum) {
2237
2239
  payload.issues.push({
2238
2240
  origin: "bigint",
2239
- input,
2241
+ input: input2,
2240
2242
  code: "too_small",
2241
2243
  minimum,
2242
2244
  inclusive: true,
@@ -2244,10 +2246,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2244
2246
  continue: !def.abort
2245
2247
  });
2246
2248
  }
2247
- if (input > maximum) {
2249
+ if (input2 > maximum) {
2248
2250
  payload.issues.push({
2249
2251
  origin: "bigint",
2250
- input,
2252
+ input: input2,
2251
2253
  code: "too_big",
2252
2254
  maximum,
2253
2255
  inclusive: true,
@@ -2270,16 +2272,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2270
2272
  inst2._zod.bag.maximum = def.maximum;
2271
2273
  });
2272
2274
  inst._zod.check = (payload) => {
2273
- const input = payload.value;
2274
- const size = input.size;
2275
+ const input2 = payload.value;
2276
+ const size = input2.size;
2275
2277
  if (size <= def.maximum)
2276
2278
  return;
2277
2279
  payload.issues.push({
2278
- origin: getSizableOrigin(input),
2280
+ origin: getSizableOrigin(input2),
2279
2281
  code: "too_big",
2280
2282
  maximum: def.maximum,
2281
2283
  inclusive: true,
2282
- input,
2284
+ input: input2,
2283
2285
  inst,
2284
2286
  continue: !def.abort
2285
2287
  });
@@ -2298,16 +2300,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2298
2300
  inst2._zod.bag.minimum = def.minimum;
2299
2301
  });
2300
2302
  inst._zod.check = (payload) => {
2301
- const input = payload.value;
2302
- const size = input.size;
2303
+ const input2 = payload.value;
2304
+ const size = input2.size;
2303
2305
  if (size >= def.minimum)
2304
2306
  return;
2305
2307
  payload.issues.push({
2306
- origin: getSizableOrigin(input),
2308
+ origin: getSizableOrigin(input2),
2307
2309
  code: "too_small",
2308
2310
  minimum: def.minimum,
2309
2311
  inclusive: true,
2310
- input,
2312
+ input: input2,
2311
2313
  inst,
2312
2314
  continue: !def.abort
2313
2315
  });
@@ -2327,13 +2329,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2327
2329
  bag.size = def.size;
2328
2330
  });
2329
2331
  inst._zod.check = (payload) => {
2330
- const input = payload.value;
2331
- const size = input.size;
2332
+ const input2 = payload.value;
2333
+ const size = input2.size;
2332
2334
  if (size === def.size)
2333
2335
  return;
2334
2336
  const tooBig = size > def.size;
2335
2337
  payload.issues.push({
2336
- origin: getSizableOrigin(input),
2338
+ origin: getSizableOrigin(input2),
2337
2339
  ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
2338
2340
  inclusive: true,
2339
2341
  exact: true,
@@ -2356,17 +2358,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2356
2358
  inst2._zod.bag.maximum = def.maximum;
2357
2359
  });
2358
2360
  inst._zod.check = (payload) => {
2359
- const input = payload.value;
2360
- const length = input.length;
2361
+ const input2 = payload.value;
2362
+ const length = input2.length;
2361
2363
  if (length <= def.maximum)
2362
2364
  return;
2363
- const origin = getLengthableOrigin(input);
2365
+ const origin = getLengthableOrigin(input2);
2364
2366
  payload.issues.push({
2365
2367
  origin,
2366
2368
  code: "too_big",
2367
2369
  maximum: def.maximum,
2368
2370
  inclusive: true,
2369
- input,
2371
+ input: input2,
2370
2372
  inst,
2371
2373
  continue: !def.abort
2372
2374
  });
@@ -2385,17 +2387,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2385
2387
  inst2._zod.bag.minimum = def.minimum;
2386
2388
  });
2387
2389
  inst._zod.check = (payload) => {
2388
- const input = payload.value;
2389
- const length = input.length;
2390
+ const input2 = payload.value;
2391
+ const length = input2.length;
2390
2392
  if (length >= def.minimum)
2391
2393
  return;
2392
- const origin = getLengthableOrigin(input);
2394
+ const origin = getLengthableOrigin(input2);
2393
2395
  payload.issues.push({
2394
2396
  origin,
2395
2397
  code: "too_small",
2396
2398
  minimum: def.minimum,
2397
2399
  inclusive: true,
2398
- input,
2400
+ input: input2,
2399
2401
  inst,
2400
2402
  continue: !def.abort
2401
2403
  });
@@ -2415,11 +2417,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2415
2417
  bag.length = def.length;
2416
2418
  });
2417
2419
  inst._zod.check = (payload) => {
2418
- const input = payload.value;
2419
- const length = input.length;
2420
+ const input2 = payload.value;
2421
+ const length = input2.length;
2420
2422
  if (length === def.length)
2421
2423
  return;
2422
- const origin = getLengthableOrigin(input);
2424
+ const origin = getLengthableOrigin(input2);
2423
2425
  const tooBig = length > def.length;
2424
2426
  payload.issues.push({
2425
2427
  origin,
@@ -3090,15 +3092,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3090
3092
  payload.value = Number(payload.value);
3091
3093
  } catch (_) {
3092
3094
  }
3093
- const input = payload.value;
3094
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
3095
+ const input2 = payload.value;
3096
+ if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
3095
3097
  return payload;
3096
3098
  }
3097
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
3099
+ const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
3098
3100
  payload.issues.push({
3099
3101
  expected: "number",
3100
3102
  code: "invalid_type",
3101
- input,
3103
+ input: input2,
3102
3104
  inst,
3103
3105
  ...received ? { received } : {}
3104
3106
  });
@@ -3118,13 +3120,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
3118
3120
  payload.value = Boolean(payload.value);
3119
3121
  } catch (_) {
3120
3122
  }
3121
- const input = payload.value;
3122
- if (typeof input === "boolean")
3123
+ const input2 = payload.value;
3124
+ if (typeof input2 === "boolean")
3123
3125
  return payload;
3124
3126
  payload.issues.push({
3125
3127
  expected: "boolean",
3126
3128
  code: "invalid_type",
3127
- input,
3129
+ input: input2,
3128
3130
  inst
3129
3131
  });
3130
3132
  return payload;
@@ -3157,13 +3159,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
3157
3159
  var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
3158
3160
  $ZodType.init(inst, def);
3159
3161
  inst._zod.parse = (payload, _ctx) => {
3160
- const input = payload.value;
3161
- if (typeof input === "symbol")
3162
+ const input2 = payload.value;
3163
+ if (typeof input2 === "symbol")
3162
3164
  return payload;
3163
3165
  payload.issues.push({
3164
3166
  expected: "symbol",
3165
3167
  code: "invalid_type",
3166
- input,
3168
+ input: input2,
3167
3169
  inst
3168
3170
  });
3169
3171
  return payload;
@@ -3174,13 +3176,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
3174
3176
  inst._zod.pattern = _undefined;
3175
3177
  inst._zod.values = /* @__PURE__ */ new Set([void 0]);
3176
3178
  inst._zod.parse = (payload, _ctx) => {
3177
- const input = payload.value;
3178
- if (typeof input === "undefined")
3179
+ const input2 = payload.value;
3180
+ if (typeof input2 === "undefined")
3179
3181
  return payload;
3180
3182
  payload.issues.push({
3181
3183
  expected: "undefined",
3182
3184
  code: "invalid_type",
3183
- input,
3185
+ input: input2,
3184
3186
  inst
3185
3187
  });
3186
3188
  return payload;
@@ -3191,13 +3193,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
3191
3193
  inst._zod.pattern = _null;
3192
3194
  inst._zod.values = /* @__PURE__ */ new Set([null]);
3193
3195
  inst._zod.parse = (payload, _ctx) => {
3194
- const input = payload.value;
3195
- if (input === null)
3196
+ const input2 = payload.value;
3197
+ if (input2 === null)
3196
3198
  return payload;
3197
3199
  payload.issues.push({
3198
3200
  expected: "null",
3199
3201
  code: "invalid_type",
3200
- input,
3202
+ input: input2,
3201
3203
  inst
3202
3204
  });
3203
3205
  return payload;
@@ -3226,13 +3228,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
3226
3228
  var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
3227
3229
  $ZodType.init(inst, def);
3228
3230
  inst._zod.parse = (payload, _ctx) => {
3229
- const input = payload.value;
3230
- if (typeof input === "undefined")
3231
+ const input2 = payload.value;
3232
+ if (typeof input2 === "undefined")
3231
3233
  return payload;
3232
3234
  payload.issues.push({
3233
3235
  expected: "void",
3234
3236
  code: "invalid_type",
3235
- input,
3237
+ input: input2,
3236
3238
  inst
3237
3239
  });
3238
3240
  return payload;
@@ -3247,15 +3249,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3247
3249
  } catch (_err) {
3248
3250
  }
3249
3251
  }
3250
- const input = payload.value;
3251
- const isDate = input instanceof Date;
3252
- const isValidDate = isDate && !Number.isNaN(input.getTime());
3252
+ const input2 = payload.value;
3253
+ const isDate = input2 instanceof Date;
3254
+ const isValidDate = isDate && !Number.isNaN(input2.getTime());
3253
3255
  if (isValidDate)
3254
3256
  return payload;
3255
3257
  payload.issues.push({
3256
3258
  expected: "date",
3257
3259
  code: "invalid_type",
3258
- input,
3260
+ input: input2,
3259
3261
  ...isDate ? { received: "Invalid Date" } : {},
3260
3262
  inst
3261
3263
  });
@@ -3271,20 +3273,20 @@ function handleArrayResult(result, final, index) {
3271
3273
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3272
3274
  $ZodType.init(inst, def);
3273
3275
  inst._zod.parse = (payload, ctx) => {
3274
- const input = payload.value;
3275
- if (!Array.isArray(input)) {
3276
+ const input2 = payload.value;
3277
+ if (!Array.isArray(input2)) {
3276
3278
  payload.issues.push({
3277
3279
  expected: "array",
3278
3280
  code: "invalid_type",
3279
- input,
3281
+ input: input2,
3280
3282
  inst
3281
3283
  });
3282
3284
  return payload;
3283
3285
  }
3284
- payload.value = Array(input.length);
3286
+ payload.value = Array(input2.length);
3285
3287
  const proms = [];
3286
- for (let i = 0; i < input.length; i++) {
3287
- const item = input[i];
3288
+ for (let i = 0; i < input2.length; i++) {
3289
+ const item = input2[i];
3288
3290
  const result = def.element._zod.run({
3289
3291
  value: item,
3290
3292
  issues: []
@@ -3301,8 +3303,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3301
3303
  return payload;
3302
3304
  };
3303
3305
  });
3304
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
3305
- const isPresent = key in input;
3306
+ function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
3307
+ const isPresent = key in input2;
3306
3308
  if (result.issues.length) {
3307
3309
  if (isOptionalIn && isOptionalOut && !isPresent) {
3308
3310
  return;
@@ -3344,14 +3346,14 @@ function normalizeDef(def) {
3344
3346
  optionalKeys: new Set(okeys)
3345
3347
  };
3346
3348
  }
3347
- function handleCatchall(proms, input, payload, ctx, def, inst) {
3349
+ function handleCatchall(proms, input2, payload, ctx, def, inst) {
3348
3350
  const unrecognized = [];
3349
3351
  const keySet = def.keySet;
3350
3352
  const _catchall = def.catchall._zod;
3351
3353
  const t = _catchall.def.type;
3352
3354
  const isOptionalIn = _catchall.optin === "optional";
3353
3355
  const isOptionalOut = _catchall.optout === "optional";
3354
- for (const key in input) {
3356
+ for (const key in input2) {
3355
3357
  if (key === "__proto__")
3356
3358
  continue;
3357
3359
  if (keySet.has(key))
@@ -3360,18 +3362,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3360
3362
  unrecognized.push(key);
3361
3363
  continue;
3362
3364
  }
3363
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
3365
+ const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
3364
3366
  if (r instanceof Promise) {
3365
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3367
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3366
3368
  } else {
3367
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3369
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3368
3370
  }
3369
3371
  }
3370
3372
  if (unrecognized.length) {
3371
3373
  payload.issues.push({
3372
3374
  code: "unrecognized_keys",
3373
3375
  keys: unrecognized,
3374
- input,
3376
+ input: input2,
3375
3377
  inst
3376
3378
  });
3377
3379
  }
@@ -3415,12 +3417,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3415
3417
  let value;
3416
3418
  inst._zod.parse = (payload, ctx) => {
3417
3419
  value ?? (value = _normalized.value);
3418
- const input = payload.value;
3419
- if (!isObject2(input)) {
3420
+ const input2 = payload.value;
3421
+ if (!isObject2(input2)) {
3420
3422
  payload.issues.push({
3421
3423
  expected: "object",
3422
3424
  code: "invalid_type",
3423
- input,
3425
+ input: input2,
3424
3426
  inst
3425
3427
  });
3426
3428
  return payload;
@@ -3432,17 +3434,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3432
3434
  const el = shape[key];
3433
3435
  const isOptionalIn = el._zod.optin === "optional";
3434
3436
  const isOptionalOut = el._zod.optout === "optional";
3435
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
3437
+ const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
3436
3438
  if (r instanceof Promise) {
3437
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3439
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3438
3440
  } else {
3439
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3441
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3440
3442
  }
3441
3443
  }
3442
3444
  if (!catchall) {
3443
3445
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3444
3446
  }
3445
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
3447
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
3446
3448
  };
3447
3449
  });
3448
3450
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3551,12 +3553,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3551
3553
  let value;
3552
3554
  inst._zod.parse = (payload, ctx) => {
3553
3555
  value ?? (value = _normalized.value);
3554
- const input = payload.value;
3555
- if (!isObject2(input)) {
3556
+ const input2 = payload.value;
3557
+ if (!isObject2(input2)) {
3556
3558
  payload.issues.push({
3557
3559
  expected: "object",
3558
3560
  code: "invalid_type",
3559
- input,
3561
+ input: input2,
3560
3562
  inst
3561
3563
  });
3562
3564
  return payload;
@@ -3567,7 +3569,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3567
3569
  payload = fastpass(payload, ctx);
3568
3570
  if (!catchall)
3569
3571
  return payload;
3570
- return handleCatchall([], input, payload, ctx, value, inst);
3572
+ return handleCatchall([], input2, payload, ctx, value, inst);
3571
3573
  }
3572
3574
  return superParse(payload, ctx);
3573
3575
  };
@@ -3727,17 +3729,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3727
3729
  return map2;
3728
3730
  });
3729
3731
  inst._zod.parse = (payload, ctx) => {
3730
- const input = payload.value;
3731
- if (!isObject(input)) {
3732
+ const input2 = payload.value;
3733
+ if (!isObject(input2)) {
3732
3734
  payload.issues.push({
3733
3735
  code: "invalid_type",
3734
3736
  expected: "object",
3735
- input,
3737
+ input: input2,
3736
3738
  inst
3737
3739
  });
3738
3740
  return payload;
3739
3741
  }
3740
- const opt = disc.value.get(input?.[def.discriminator]);
3742
+ const opt = disc.value.get(input2?.[def.discriminator]);
3741
3743
  if (opt) {
3742
3744
  return opt._zod.run(payload, ctx);
3743
3745
  }
@@ -3750,7 +3752,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3750
3752
  note: "No matching discriminator",
3751
3753
  discriminator: def.discriminator,
3752
3754
  options: Array.from(disc.value.keys()),
3753
- input,
3755
+ input: input2,
3754
3756
  path: [def.discriminator],
3755
3757
  inst
3756
3758
  });
@@ -3760,9 +3762,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3760
3762
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
3761
3763
  $ZodType.init(inst, def);
3762
3764
  inst._zod.parse = (payload, ctx) => {
3763
- const input = payload.value;
3764
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
3765
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
3765
+ const input2 = payload.value;
3766
+ const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
3767
+ const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
3766
3768
  const async = left instanceof Promise || right instanceof Promise;
3767
3769
  if (async) {
3768
3770
  return Promise.all([left, right]).then(([left2, right2]) => {
@@ -3859,10 +3861,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3859
3861
  $ZodType.init(inst, def);
3860
3862
  const items = def.items;
3861
3863
  inst._zod.parse = (payload, ctx) => {
3862
- const input = payload.value;
3863
- if (!Array.isArray(input)) {
3864
+ const input2 = payload.value;
3865
+ if (!Array.isArray(input2)) {
3864
3866
  payload.issues.push({
3865
- input,
3867
+ input: input2,
3866
3868
  inst,
3867
3869
  expected: "tuple",
3868
3870
  code: "invalid_type"
@@ -3874,23 +3876,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3874
3876
  const optinStart = getTupleOptStart(items, "optin");
3875
3877
  const optoutStart = getTupleOptStart(items, "optout");
3876
3878
  if (!def.rest) {
3877
- if (input.length < optinStart) {
3879
+ if (input2.length < optinStart) {
3878
3880
  payload.issues.push({
3879
3881
  code: "too_small",
3880
3882
  minimum: optinStart,
3881
3883
  inclusive: true,
3882
- input,
3884
+ input: input2,
3883
3885
  inst,
3884
3886
  origin: "array"
3885
3887
  });
3886
3888
  return payload;
3887
3889
  }
3888
- if (input.length > items.length) {
3890
+ if (input2.length > items.length) {
3889
3891
  payload.issues.push({
3890
3892
  code: "too_big",
3891
3893
  maximum: items.length,
3892
3894
  inclusive: true,
3893
- input,
3895
+ input: input2,
3894
3896
  inst,
3895
3897
  origin: "array"
3896
3898
  });
@@ -3898,7 +3900,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3898
3900
  }
3899
3901
  const itemResults = new Array(items.length);
3900
3902
  for (let i = 0; i < items.length; i++) {
3901
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
3903
+ const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
3902
3904
  if (r instanceof Promise) {
3903
3905
  proms.push(r.then((rr) => {
3904
3906
  itemResults[i] = rr;
@@ -3909,7 +3911,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3909
3911
  }
3910
3912
  if (def.rest) {
3911
3913
  let i = items.length - 1;
3912
- const rest = input.slice(items.length);
3914
+ const rest = input2.slice(items.length);
3913
3915
  for (const el of rest) {
3914
3916
  i++;
3915
3917
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
@@ -3921,9 +3923,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3921
3923
  }
3922
3924
  }
3923
3925
  if (proms.length) {
3924
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
3926
+ return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
3925
3927
  }
3926
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
3928
+ return handleTupleResults(itemResults, payload, items, input2, optoutStart);
3927
3929
  };
3928
3930
  });
3929
3931
  function getTupleOptStart(items, key) {
@@ -3939,10 +3941,10 @@ function handleTupleResult(result, final, index) {
3939
3941
  }
3940
3942
  final.value[index] = result.value;
3941
3943
  }
3942
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
3944
+ function handleTupleResults(itemResults, final, items, input2, optoutStart) {
3943
3945
  for (let i = 0; i < items.length; i++) {
3944
3946
  const r = itemResults[i];
3945
- const isPresent = i < input.length;
3947
+ const isPresent = i < input2.length;
3946
3948
  if (r.issues.length) {
3947
3949
  if (!isPresent && i >= optoutStart) {
3948
3950
  final.value.length = i;
@@ -3952,7 +3954,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
3952
3954
  }
3953
3955
  final.value[i] = r.value;
3954
3956
  }
3955
- for (let i = final.value.length - 1; i >= input.length; i--) {
3957
+ for (let i = final.value.length - 1; i >= input2.length; i--) {
3956
3958
  if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
3957
3959
  final.value.length = i;
3958
3960
  } else {
@@ -3964,12 +3966,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
3964
3966
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3965
3967
  $ZodType.init(inst, def);
3966
3968
  inst._zod.parse = (payload, ctx) => {
3967
- const input = payload.value;
3968
- if (!isPlainObject(input)) {
3969
+ const input2 = payload.value;
3970
+ if (!isPlainObject(input2)) {
3969
3971
  payload.issues.push({
3970
3972
  expected: "record",
3971
3973
  code: "invalid_type",
3972
- input,
3974
+ input: input2,
3973
3975
  inst
3974
3976
  });
3975
3977
  return payload;
@@ -3998,7 +4000,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3998
4000
  continue;
3999
4001
  }
4000
4002
  const outKey = keyResult.value;
4001
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
4003
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
4002
4004
  if (result instanceof Promise) {
4003
4005
  proms.push(result.then((result2) => {
4004
4006
  if (result2.issues.length) {
@@ -4015,7 +4017,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4015
4017
  }
4016
4018
  }
4017
4019
  let unrecognized;
4018
- for (const key in input) {
4020
+ for (const key in input2) {
4019
4021
  if (!recordKeys.has(key)) {
4020
4022
  unrecognized = unrecognized ?? [];
4021
4023
  unrecognized.push(key);
@@ -4024,17 +4026,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4024
4026
  if (unrecognized && unrecognized.length > 0) {
4025
4027
  payload.issues.push({
4026
4028
  code: "unrecognized_keys",
4027
- input,
4029
+ input: input2,
4028
4030
  inst,
4029
4031
  keys: unrecognized
4030
4032
  });
4031
4033
  }
4032
4034
  } else {
4033
4035
  payload.value = {};
4034
- for (const key of Reflect.ownKeys(input)) {
4036
+ for (const key of Reflect.ownKeys(input2)) {
4035
4037
  if (key === "__proto__")
4036
4038
  continue;
4037
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
4039
+ if (!Object.prototype.propertyIsEnumerable.call(input2, key))
4038
4040
  continue;
4039
4041
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4040
4042
  if (keyResult instanceof Promise) {
@@ -4052,7 +4054,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4052
4054
  }
4053
4055
  if (keyResult.issues.length) {
4054
4056
  if (def.mode === "loose") {
4055
- payload.value[key] = input[key];
4057
+ payload.value[key] = input2[key];
4056
4058
  } else {
4057
4059
  payload.issues.push({
4058
4060
  code: "invalid_key",
@@ -4065,7 +4067,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4065
4067
  }
4066
4068
  continue;
4067
4069
  }
4068
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
4070
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
4069
4071
  if (result instanceof Promise) {
4070
4072
  proms.push(result.then((result2) => {
4071
4073
  if (result2.issues.length) {
@@ -4090,27 +4092,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4090
4092
  var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4091
4093
  $ZodType.init(inst, def);
4092
4094
  inst._zod.parse = (payload, ctx) => {
4093
- const input = payload.value;
4094
- if (!(input instanceof Map)) {
4095
+ const input2 = payload.value;
4096
+ if (!(input2 instanceof Map)) {
4095
4097
  payload.issues.push({
4096
4098
  expected: "map",
4097
4099
  code: "invalid_type",
4098
- input,
4100
+ input: input2,
4099
4101
  inst
4100
4102
  });
4101
4103
  return payload;
4102
4104
  }
4103
4105
  const proms = [];
4104
4106
  payload.value = /* @__PURE__ */ new Map();
4105
- for (const [key, value] of input) {
4107
+ for (const [key, value] of input2) {
4106
4108
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4107
4109
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4108
4110
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
4109
4111
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
4110
- handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
4112
+ handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
4111
4113
  }));
4112
4114
  } else {
4113
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
4115
+ handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
4114
4116
  }
4115
4117
  }
4116
4118
  if (proms.length)
@@ -4118,7 +4120,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4118
4120
  return payload;
4119
4121
  };
4120
4122
  });
4121
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4123
+ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
4122
4124
  if (keyResult.issues.length) {
4123
4125
  if (propertyKeyTypes.has(typeof key)) {
4124
4126
  final.issues.push(...prefixIssues(key, keyResult.issues));
@@ -4126,7 +4128,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4126
4128
  final.issues.push({
4127
4129
  code: "invalid_key",
4128
4130
  origin: "map",
4129
- input,
4131
+ input: input2,
4130
4132
  inst,
4131
4133
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
4132
4134
  });
@@ -4139,7 +4141,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4139
4141
  final.issues.push({
4140
4142
  origin: "map",
4141
4143
  code: "invalid_element",
4142
- input,
4144
+ input: input2,
4143
4145
  inst,
4144
4146
  key,
4145
4147
  issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
@@ -4151,10 +4153,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4151
4153
  var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4152
4154
  $ZodType.init(inst, def);
4153
4155
  inst._zod.parse = (payload, ctx) => {
4154
- const input = payload.value;
4155
- if (!(input instanceof Set)) {
4156
+ const input2 = payload.value;
4157
+ if (!(input2 instanceof Set)) {
4156
4158
  payload.issues.push({
4157
- input,
4159
+ input: input2,
4158
4160
  inst,
4159
4161
  expected: "set",
4160
4162
  code: "invalid_type"
@@ -4163,7 +4165,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4163
4165
  }
4164
4166
  const proms = [];
4165
4167
  payload.value = /* @__PURE__ */ new Set();
4166
- for (const item of input) {
4168
+ for (const item of input2) {
4167
4169
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4168
4170
  if (result instanceof Promise) {
4169
4171
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4188,14 +4190,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4188
4190
  inst._zod.values = valuesSet;
4189
4191
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
4190
4192
  inst._zod.parse = (payload, _ctx) => {
4191
- const input = payload.value;
4192
- if (valuesSet.has(input)) {
4193
+ const input2 = payload.value;
4194
+ if (valuesSet.has(input2)) {
4193
4195
  return payload;
4194
4196
  }
4195
4197
  payload.issues.push({
4196
4198
  code: "invalid_value",
4197
4199
  values,
4198
- input,
4200
+ input: input2,
4199
4201
  inst
4200
4202
  });
4201
4203
  return payload;
@@ -4210,14 +4212,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4210
4212
  inst._zod.values = values;
4211
4213
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
4212
4214
  inst._zod.parse = (payload, _ctx) => {
4213
- const input = payload.value;
4214
- if (values.has(input)) {
4215
+ const input2 = payload.value;
4216
+ if (values.has(input2)) {
4215
4217
  return payload;
4216
4218
  }
4217
4219
  payload.issues.push({
4218
4220
  code: "invalid_value",
4219
4221
  values: def.values,
4220
- input,
4222
+ input: input2,
4221
4223
  inst
4222
4224
  });
4223
4225
  return payload;
@@ -4226,13 +4228,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4226
4228
  var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
4227
4229
  $ZodType.init(inst, def);
4228
4230
  inst._zod.parse = (payload, _ctx) => {
4229
- const input = payload.value;
4230
- if (input instanceof File)
4231
+ const input2 = payload.value;
4232
+ if (input2 instanceof File)
4231
4233
  return payload;
4232
4234
  payload.issues.push({
4233
4235
  expected: "file",
4234
4236
  code: "invalid_type",
4235
- input,
4237
+ input: input2,
4236
4238
  inst
4237
4239
  });
4238
4240
  return payload;
@@ -4262,8 +4264,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
4262
4264
  return payload;
4263
4265
  };
4264
4266
  });
4265
- function handleOptionalResult(result, input) {
4266
- if (input === void 0 && (result.issues.length || result.fallback)) {
4267
+ function handleOptionalResult(result, input2) {
4268
+ if (input2 === void 0 && (result.issues.length || result.fallback)) {
4267
4269
  return { issues: [], value: void 0 };
4268
4270
  }
4269
4271
  return result;
@@ -4281,11 +4283,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
4281
4283
  });
4282
4284
  inst._zod.parse = (payload, ctx) => {
4283
4285
  if (def.innerType._zod.optin === "optional") {
4284
- const input = payload.value;
4286
+ const input2 = payload.value;
4285
4287
  const result = def.innerType._zod.run(payload, ctx);
4286
4288
  if (result instanceof Promise)
4287
- return result.then((r) => handleOptionalResult(r, input));
4288
- return handleOptionalResult(result, input);
4289
+ return result.then((r) => handleOptionalResult(r, input2));
4290
+ return handleOptionalResult(result, input2);
4289
4291
  }
4290
4292
  if (payload.value === void 0) {
4291
4293
  return payload;
@@ -4710,20 +4712,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
4710
4712
  return payload;
4711
4713
  };
4712
4714
  inst._zod.check = (payload) => {
4713
- const input = payload.value;
4714
- const r = def.fn(input);
4715
+ const input2 = payload.value;
4716
+ const r = def.fn(input2);
4715
4717
  if (r instanceof Promise) {
4716
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
4718
+ return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
4717
4719
  }
4718
- handleRefineResult(r, payload, input, inst);
4720
+ handleRefineResult(r, payload, input2, inst);
4719
4721
  return;
4720
4722
  };
4721
4723
  });
4722
- function handleRefineResult(result, payload, input, inst) {
4724
+ function handleRefineResult(result, payload, input2, inst) {
4723
4725
  if (!result) {
4724
4726
  const _iss = {
4725
4727
  code: "custom",
4726
- input,
4728
+ input: input2,
4727
4729
  inst,
4728
4730
  // incorporates params.error into issue reporting
4729
4731
  path: [...inst._zod.def.path ?? []],
@@ -8010,8 +8012,8 @@ function ko_default() {
8010
8012
  }
8011
8013
 
8012
8014
  // ../../../node_modules/zod/v4/locales/lt.js
8013
- var capitalizeFirstCharacter = (text2) => {
8014
- return text2.charAt(0).toUpperCase() + text2.slice(1);
8015
+ var capitalizeFirstCharacter = (text3) => {
8016
+ return text3.charAt(0).toUpperCase() + text3.slice(1);
8015
8017
  };
8016
8018
  function getUnitTypeFromNumber(number4) {
8017
8019
  const abs = Math.abs(number4);
@@ -11411,23 +11413,23 @@ function _overwrite(tx) {
11411
11413
  }
11412
11414
  // @__NO_SIDE_EFFECTS__
11413
11415
  function _normalize(form) {
11414
- return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
11416
+ return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
11415
11417
  }
11416
11418
  // @__NO_SIDE_EFFECTS__
11417
11419
  function _trim() {
11418
- return /* @__PURE__ */ _overwrite((input) => input.trim());
11420
+ return /* @__PURE__ */ _overwrite((input2) => input2.trim());
11419
11421
  }
11420
11422
  // @__NO_SIDE_EFFECTS__
11421
11423
  function _toLowerCase() {
11422
- return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
11424
+ return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
11423
11425
  }
11424
11426
  // @__NO_SIDE_EFFECTS__
11425
11427
  function _toUpperCase() {
11426
- return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
11428
+ return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
11427
11429
  }
11428
11430
  // @__NO_SIDE_EFFECTS__
11429
11431
  function _slugify() {
11430
- return /* @__PURE__ */ _overwrite((input) => slugify(input));
11432
+ return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
11431
11433
  }
11432
11434
  // @__NO_SIDE_EFFECTS__
11433
11435
  function _array(Class2, element, params) {
@@ -11732,8 +11734,8 @@ function _stringbool(Classes, _params) {
11732
11734
  type: "pipe",
11733
11735
  in: stringSchema,
11734
11736
  out: booleanSchema,
11735
- transform: ((input, payload) => {
11736
- let data = input;
11737
+ transform: ((input2, payload) => {
11738
+ let data = input2;
11737
11739
  if (params.case !== "sensitive")
11738
11740
  data = data.toLowerCase();
11739
11741
  if (truthySet.has(data)) {
@@ -11752,8 +11754,8 @@ function _stringbool(Classes, _params) {
11752
11754
  return {};
11753
11755
  }
11754
11756
  }),
11755
- reverseTransform: ((input, _payload) => {
11756
- if (input === true) {
11757
+ reverseTransform: ((input2, _payload) => {
11758
+ if (input2 === true) {
11757
11759
  return truthyArray[0] || "true";
11758
11760
  } else {
11759
11761
  return falsyArray[0] || "false";
@@ -12649,9 +12651,9 @@ var allProcessors = {
12649
12651
  optional: optionalProcessor,
12650
12652
  lazy: lazyProcessor
12651
12653
  };
12652
- function toJSONSchema(input, params) {
12653
- if ("_idmap" in input) {
12654
- const registry2 = input;
12654
+ function toJSONSchema(input2, params) {
12655
+ if ("_idmap" in input2) {
12656
+ const registry2 = input2;
12655
12657
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
12656
12658
  const defs = {};
12657
12659
  for (const entry of registry2._idmap.entries()) {
@@ -12679,9 +12681,9 @@ function toJSONSchema(input, params) {
12679
12681
  return { schemas };
12680
12682
  }
12681
12683
  const ctx = initializeContext({ ...params, processors: allProcessors });
12682
- process2(input, ctx);
12683
- extractDefs(ctx, input);
12684
- return finalize(ctx, input);
12684
+ process2(input2, ctx);
12685
+ extractDefs(ctx, input2);
12686
+ return finalize(ctx, input2);
12685
12687
  }
12686
12688
 
12687
12689
  // ../../../node_modules/zod/v4/core/json-schema-generator.js
@@ -14958,7 +14960,7 @@ var codexhostErrorSchema = external_exports.strictObject({
14958
14960
 
14959
14961
  // ../../shared-contracts/dist/harness-presentation.js
14960
14962
  var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14961
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14963
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text3) => text3.trim().length > 0);
14962
14964
  var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14963
14965
  label: displayText(256).optional(),
14964
14966
  description: displayText(1024).optional()
@@ -15047,7 +15049,7 @@ var usageMeasurementsSchema = external_exports.object({
15047
15049
  outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15048
15050
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15049
15051
  }).strict();
15050
- var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
15052
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text3) => text3.length <= maximum));
15051
15053
  var composerIndicatorsSchema = external_exports.array(external_exports.object({
15052
15054
  kind: external_exports.literal("countdown"),
15053
15055
  id: external_exports.string().min(1).max(64),
@@ -15430,6 +15432,8 @@ var externalThreadInspectionSchema = external_exports.object({
15430
15432
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15431
15433
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15432
15434
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15435
+ /** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
15436
+ catalog: harnessModelCatalogSchema.optional(),
15433
15437
  history: harnessHistoryCapabilitiesSchema,
15434
15438
  usage: threadUsageSnapshotSchema.optional(),
15435
15439
  locked: external_exports.literal(true)
@@ -15488,9 +15492,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
15488
15492
  }).strict();
15489
15493
  var threadSteeringContextSchema = external_exports.object({
15490
15494
  kind: external_exports.literal("application"),
15491
- value: external_exports.string().transform((text2, context) => {
15495
+ value: external_exports.string().transform((text3, context) => {
15492
15496
  try {
15493
- return JSON.parse(text2);
15497
+ return JSON.parse(text3);
15494
15498
  } catch {
15495
15499
  context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15496
15500
  return external_exports.NEVER;
@@ -15625,8 +15629,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
15625
15629
  const { username, password } = new URL(value);
15626
15630
  return !username && !password && !/[\\\s]/u.test(value);
15627
15631
  }, "URL must not contain credentials, backslashes, or whitespace");
15628
- function localizedText(text2) {
15629
- return external_exports.strictObject({ en: text2, "zh-CN": text2 });
15632
+ function localizedText(text3) {
15633
+ return external_exports.strictObject({ en: text3, "zh-CN": text3 });
15630
15634
  }
15631
15635
  var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15632
15636
  var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
@@ -15743,8 +15747,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
15743
15747
  function isGitHubDesktopExtensionZipballUrl(url2) {
15744
15748
  return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15745
15749
  }
15746
- var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15747
- const url2 = new URL(input);
15750
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
15751
+ const url2 = new URL(input2);
15748
15752
  return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
15749
15753
  }, "Expected a .zip download URL or a GitHub zipball URL");
15750
15754
  var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
@@ -16095,6 +16099,8 @@ var CLIENT_CHANNEL_METHODS = [
16095
16099
  "codexhost/workspace/read",
16096
16100
  "codexhost/thread/tree/read",
16097
16101
  "codexhost/thread/pins/list",
16102
+ "codexhost/thread/sections/list",
16103
+ "codexhost/thread/sections/move",
16098
16104
  "codexhost/thread/pins/set",
16099
16105
  "codexhost/harness/plugins/list",
16100
16106
  "codexhost/harness/inspect",
@@ -16133,8 +16139,21 @@ var CLIENT_CHANNEL_METHODS = [
16133
16139
  "codexhost/update/check",
16134
16140
  "codexhost/update/start",
16135
16141
  "codexhost/update/status",
16142
+ "codexhost/announcement/get",
16143
+ "codexhost/announcement/acknowledge",
16136
16144
  "codexhost/sessions/loaded/list"
16137
16145
  ];
16146
+ var clientThreadSectionsSchema = external_exports.object({
16147
+ sections: external_exports.array(external_exports.object({
16148
+ id: external_exports.string().min(1),
16149
+ name: external_exports.string().min(1),
16150
+ threads: external_exports.array(jsonObjectSchema)
16151
+ }).strict())
16152
+ }).strict();
16153
+ var clientThreadSectionMoveSchema = external_exports.object({
16154
+ threadId: external_exports.string().min(1).max(1024),
16155
+ sectionId: external_exports.string().min(1).max(1024).nullable()
16156
+ }).strict();
16138
16157
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
16139
16158
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
16140
16159
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -16676,8 +16695,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
16676
16695
  operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
16677
16696
  initializeOnly: external_exports.boolean().optional(),
16678
16697
  expectedRevision: external_exports.number().int().nonnegative().optional()
16679
- }).superRefine((input, ctx) => {
16680
- for (const operation of input.operations) {
16698
+ }).superRefine((input2, ctx) => {
16699
+ for (const operation of input2.operations) {
16681
16700
  if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
16682
16701
  ctx.addIssue({
16683
16702
  code: "custom",
@@ -17079,13 +17098,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
17079
17098
  // ../../shared-contracts/dist/harness-installation.js
17080
17099
  var harnessInstallationParamsSchema = external_exports.object({
17081
17100
  harnessId: harnessIdSchema,
17082
- action: external_exports.enum(["check", "update", "install"])
17083
- }).strict();
17101
+ action: external_exports.enum(["check", "update", "install"]),
17102
+ confirmedVersion: external_exports.string().min(1).max(128).optional()
17103
+ }).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
17084
17104
  var harnessInstallationStateSchema = external_exports.object({
17085
17105
  currentVersion: external_exports.string().min(1).max(128),
17086
17106
  latestVersion: external_exports.string().min(1).max(128),
17087
17107
  updateAvailable: external_exports.boolean(),
17088
17108
  canUpdate: external_exports.boolean(),
17109
+ /** Present when the Adapter has a verified list and the available target is outside it. */
17110
+ latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
17111
+ /** Update preflight stopped before running the installer; latestVersion needs confirmation. */
17112
+ confirmationRequired: external_exports.literal(true).optional(),
17089
17113
  /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
17090
17114
  versionKind: external_exports.enum(["cli", "application"]).optional(),
17091
17115
  /** Official download opened by the user; does not imply an automatic installation. */
@@ -17415,6 +17439,38 @@ var updateStatusResultSchema = external_exports.strictObject({
17415
17439
  status: updateStatusSchema.nullable()
17416
17440
  });
17417
17441
 
17442
+ // ../../shared-contracts/dist/release-announcement.js
17443
+ var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
17444
+ var releaseAnnouncementThemeSchema = external_exports.strictObject({
17445
+ icon: external_exports.string().min(1).max(16).optional(),
17446
+ title: external_exports.string().min(1).max(120),
17447
+ body: external_exports.string().min(1).max(1200),
17448
+ contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
17449
+ });
17450
+ var releaseAnnouncementContentSchema = external_exports.strictObject({
17451
+ summary: external_exports.string().min(1).max(600).optional(),
17452
+ themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
17453
+ });
17454
+ var releaseAnnouncementSchema = external_exports.strictObject({
17455
+ version: updateSemanticVersionSchema,
17456
+ publishedAt: external_exports.iso.datetime(),
17457
+ url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
17458
+ zh: releaseAnnouncementContentSchema.nullable(),
17459
+ en: releaseAnnouncementContentSchema.nullable()
17460
+ }).refine((value) => value.zh !== null || value.en !== null, {
17461
+ message: "an announcement needs at least one language"
17462
+ });
17463
+ var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
17464
+ manual: external_exports.boolean().optional()
17465
+ });
17466
+ var releaseAnnouncementGetResultSchema = external_exports.strictObject({
17467
+ announcement: releaseAnnouncementSchema.nullable(),
17468
+ unread: external_exports.boolean()
17469
+ });
17470
+ var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
17471
+ version: updateSemanticVersionSchema
17472
+ });
17473
+
17418
17474
  // ../../shared-contracts/dist/thread-watch-notice.js
17419
17475
  var THREAD_WATCH_NOTICE_OUTCOMES = [
17420
17476
  "completed",
@@ -17462,17 +17518,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
17462
17518
 
17463
17519
  // ../../shared-contracts/dist/remote-sessions.js
17464
17520
  var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
17465
- var identity = external_exports.string().min(1).max(1024);
17521
+ var REMOTE_IDENTITY_MAX_LENGTH = 1024;
17522
+ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
17466
17523
  var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17467
17524
  var thread = { ...target, threadId: identity };
17525
+ var text = external_exports.string().min(1).max(8e3);
17526
+ var input = { text, requestId: identity };
17527
+ var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
17528
+ external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
17529
+ external_exports.object({
17530
+ accepted: external_exports.literal(false),
17531
+ code: external_exports.enum([
17532
+ "remote/queue-unavailable",
17533
+ "remote/steer-unavailable",
17534
+ "remote/turn-changed",
17535
+ "remote/send-rejected",
17536
+ "session/queue-item-not-found",
17537
+ "session/queue-item-starting"
17538
+ ]),
17539
+ message: external_exports.string()
17540
+ })
17541
+ ]);
17542
+ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
17543
+ external_exports.object({ available: external_exports.literal(false) }),
17544
+ external_exports.object({
17545
+ available: external_exports.literal(true),
17546
+ items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
17547
+ })
17548
+ ]);
17468
17549
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17469
17550
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17551
+ external_exports.strictObject({
17552
+ kind: external_exports.literal("create"),
17553
+ ...target,
17554
+ cwd: external_exports.string().min(1).max(8192),
17555
+ epoch: identity
17556
+ }),
17557
+ external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
17558
+ external_exports.strictObject({
17559
+ kind: external_exports.literal("inspectHarness"),
17560
+ ...target,
17561
+ epoch: identity,
17562
+ cwd: external_exports.string().min(1).max(8192),
17563
+ harnessId: identity
17564
+ }),
17565
+ external_exports.strictObject({
17566
+ kind: external_exports.literal("startSelected"),
17567
+ ...target,
17568
+ epoch: identity,
17569
+ cwd: external_exports.string().min(1).max(8192),
17570
+ harnessId: identity,
17571
+ model: external_exports.string().min(1).max(4096),
17572
+ serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
17573
+ reasoningEffort: identity.optional()
17574
+ }),
17470
17575
  external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17471
17576
  external_exports.strictObject({
17472
17577
  kind: external_exports.literal("list"),
17473
17578
  ...target,
17474
17579
  cursor: external_exports.string().nullable(),
17475
- archived: external_exports.boolean()
17580
+ archived: external_exports.boolean(),
17581
+ includeLoaded: external_exports.literal(true).optional()
17476
17582
  }),
17477
17583
  external_exports.strictObject({
17478
17584
  kind: external_exports.literal("read"),
@@ -17502,9 +17608,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17502
17608
  kind: external_exports.literal("prompt"),
17503
17609
  ...thread,
17504
17610
  epoch: identity,
17505
- text: external_exports.string().min(1).max(8e3),
17611
+ text,
17506
17612
  requestId: identity.optional()
17507
17613
  }),
17614
+ external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
17615
+ external_exports.strictObject({
17616
+ kind: external_exports.literal("delivery"),
17617
+ ...thread,
17618
+ epoch: identity,
17619
+ action: external_exports.discriminatedUnion("kind", [
17620
+ external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
17621
+ external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
17622
+ external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
17623
+ external_exports.strictObject({
17624
+ kind: external_exports.literal("start"),
17625
+ itemId: identity,
17626
+ onlyIfHead: external_exports.literal(true).optional()
17627
+ })
17628
+ ])
17629
+ }),
17508
17630
  external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
17509
17631
  external_exports.strictObject({
17510
17632
  kind: external_exports.literal("rename"),
@@ -18826,8 +18948,8 @@ var HERMES_GATEWAY_COMMANDS = [
18826
18948
  input: { hint: "Optional compression focus" }
18827
18949
  }
18828
18950
  ];
18829
- function hermesGatewayCommandName(text2, commands = HERMES_GATEWAY_COMMANDS) {
18830
- const match = /^\/([\w-]+)(?:\s+([\s\S]*))?$/u.exec(text2.trim());
18951
+ function hermesGatewayCommandName(text3, commands = HERMES_GATEWAY_COMMANDS) {
18952
+ const match = /^\/([\w-]+)(?:\s+([\s\S]*))?$/u.exec(text3.trim());
18831
18953
  const name = match?.[1]?.toLowerCase();
18832
18954
  const command = commands.find((entry) => entry.name === name && !isExcludedHermesCommand(entry.name));
18833
18955
  return command && (command.input || !match?.[2]?.trim()) ? command.name : null;
@@ -19010,18 +19132,18 @@ function projectCandidate(value) {
19010
19132
  });
19011
19133
  return parsed2.success ? parsed2.data : null;
19012
19134
  }
19013
- async function listHermesSessionCandidates(input) {
19135
+ async function listHermesSessionCandidates(input2) {
19014
19136
  const candidates = /* @__PURE__ */ new Map();
19015
- for (const row of await readHermesSessions(input)) {
19137
+ for (const row of await readHermesSessions(input2)) {
19016
19138
  const candidate = projectCandidate(row);
19017
19139
  if (candidate && !candidates.has(candidate.nativeSessionId))
19018
19140
  candidates.set(candidate.nativeSessionId, candidate);
19019
19141
  }
19020
19142
  return [...candidates.values()];
19021
19143
  }
19022
- async function resolveHermesSessionCandidate(input) {
19023
- const candidates = await listHermesSessionCandidates(input);
19024
- const candidate = candidates.find((row) => row.nativeSessionId === input.nativeSessionId);
19144
+ async function resolveHermesSessionCandidate(input2) {
19145
+ const candidates = await listHermesSessionCandidates(input2);
19146
+ const candidate = candidates.find((row) => row.nativeSessionId === input2.nativeSessionId);
19025
19147
  if (!candidate)
19026
19148
  return null;
19027
19149
  return {
@@ -19048,12 +19170,12 @@ var hermesDiscoverySpec = {
19048
19170
  windows: ["${APPDATA}/npm", "~/.local/bin", VERSION_MANAGER_ROOTS]
19049
19171
  }
19050
19172
  };
19051
- function resolveHermesExecutable(input = {}) {
19052
- const platform = input.platform ?? process.platform;
19173
+ function resolveHermesExecutable(input2 = {}) {
19174
+ const platform = input2.platform ?? process.platform;
19053
19175
  const resolution = resolveHarnessExecutable(hermesDiscoverySpec, {
19054
- ...input.command ? { command: input.command } : {},
19055
- environment: input.environment ?? process.env,
19056
- ...input.homeDirectory ? { homeDirectory: input.homeDirectory } : {},
19176
+ ...input2.command ? { command: input2.command } : {},
19177
+ environment: input2.environment ?? process.env,
19178
+ ...input2.homeDirectory ? { homeDirectory: input2.homeDirectory } : {},
19057
19179
  platform
19058
19180
  });
19059
19181
  if (!resolution)
@@ -19302,11 +19424,11 @@ print(json.dumps(result, ensure_ascii=True), file=output)
19302
19424
  function record3(value) {
19303
19425
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
19304
19426
  }
19305
- function text(value) {
19427
+ function text2(value) {
19306
19428
  if (typeof value === "string")
19307
19429
  return value;
19308
19430
  if (Array.isArray(value))
19309
- return value.map((part) => text(record3(part).text)).join("\n");
19431
+ return value.map((part) => text2(record3(part).text)).join("\n");
19310
19432
  return "";
19311
19433
  }
19312
19434
  function parsed(value) {
@@ -19363,13 +19485,13 @@ function projectGatewayHistory(sessionId, data) {
19363
19485
  continue;
19364
19486
  const itemId = (suffix) => hostItemIdSchema.parse(`hermes:${id2}:${suffix}`);
19365
19487
  if (row.role === "assistant") {
19366
- const reasoning = row.display_visible === false ? "" : text(row.reasoning_content) || text(row.reasoning);
19488
+ const reasoning = row.display_visible === false ? "" : text2(row.reasoning_content) || text2(row.reasoning);
19367
19489
  if (reasoning)
19368
19490
  turn.items.push({
19369
19491
  item: { type: "reasoning", itemId: itemId("reasoning"), text: reasoning },
19370
19492
  outcome: { status: "succeeded" }
19371
19493
  });
19372
- const content = typeof row.display_text === "string" ? row.display_text : text(row.content);
19494
+ const content = typeof row.display_text === "string" ? row.display_text : text2(row.content);
19373
19495
  if (content)
19374
19496
  turn.items.push({
19375
19497
  item: { type: "agentMessage", itemId: itemId("message"), text: content },
@@ -19438,15 +19560,15 @@ var HermesGatewayHistory = class {
19438
19560
  throw new Error("Missing Hermes storage identity");
19439
19561
  return data.physicalSessionId;
19440
19562
  }
19441
- async ensureCreated(input) {
19442
- await this.#run({ operation: "ensure", ...input });
19563
+ async ensureCreated(input2) {
19564
+ await this.#run({ operation: "ensure", ...input2 });
19443
19565
  }
19444
- async derive(input = {}) {
19445
- if (input.checkpoint && input.rollbackLastTurn)
19566
+ async derive(input2 = {}) {
19567
+ if (input2.checkpoint && input2.rollbackLastTurn)
19446
19568
  throw new Error("Conflicting Hermes derivation boundaries");
19447
- if (input.checkpoint && (input.checkpoint.harnessId !== "hermes" || input.checkpoint.nativeSessionId !== this.options.nativeSessionId))
19569
+ if (input2.checkpoint && (input2.checkpoint.harnessId !== "hermes" || input2.checkpoint.nativeSessionId !== this.options.nativeSessionId))
19448
19570
  throw new Error("Hermes checkpoint belongs to another session");
19449
- const data = await this.#run({ operation: "derive", ...input });
19571
+ const data = await this.#run({ operation: "derive", ...input2 });
19450
19572
  const ref = nativeSessionRefSchema.parse({
19451
19573
  harnessId: "hermes",
19452
19574
  nativeSessionId: data.sessionId,
@@ -19471,7 +19593,7 @@ var HermesGatewayHistory = class {
19471
19593
  this.#derived.delete(ref.nativeSessionId);
19472
19594
  return result.deleted === true;
19473
19595
  }
19474
- async #run(input) {
19596
+ async #run(input2) {
19475
19597
  const command = await hermesPythonCommand(this.options.python, GATEWAY_HISTORY_SCRIPT, {
19476
19598
  ...process.env,
19477
19599
  ...this.options.environment
@@ -19516,7 +19638,7 @@ var HermesGatewayHistory = class {
19516
19638
  reject(new Error("Malformed Hermes native history response"));
19517
19639
  }
19518
19640
  });
19519
- child.stdin.end(JSON.stringify({ ...input, sessionId: this.options.nativeSessionId }));
19641
+ child.stdin.end(JSON.stringify({ ...input2, sessionId: this.options.nativeSessionId }));
19520
19642
  });
19521
19643
  }
19522
19644
  };
@@ -19615,8 +19737,8 @@ function question(entry, fallbackId) {
19615
19737
  optional: false
19616
19738
  } : { id: id2, type: "text", prompt, multiline: true, secret: false, optional: false };
19617
19739
  }
19618
- function gatewayDiff(text2) {
19619
- if (!text2 || text2.length > 1024 * 1024)
19740
+ function gatewayDiff(text3) {
19741
+ if (!text3 || text3.length > 1024 * 1024)
19620
19742
  return [];
19621
19743
  const result = [];
19622
19744
  let path8 = "";
@@ -19633,7 +19755,7 @@ function gatewayDiff(text2) {
19633
19755
  oldLines = [];
19634
19756
  newLines = [];
19635
19757
  };
19636
- for (const raw of text2.split("\n")) {
19758
+ for (const raw of text3.split("\n")) {
19637
19759
  const line = raw.replace(/\u001b\[[0-9;]*m/gu, "");
19638
19760
  const header = /^(a\/.+|\/dev\/null) → (b\/.+|\/dev\/null)$/u.exec(line);
19639
19761
  if (header) {
@@ -19672,9 +19794,9 @@ var HermesGatewaySessionTransport = class {
19672
19794
  #commands = HERMES_GATEWAY_COMMANDS;
19673
19795
  onUsage;
19674
19796
  #knownCommands = /* @__PURE__ */ new Set();
19675
- rejectsCommand(text2) {
19676
- const name = /^\/([\w-]+)(?:\s|$)/u.exec(text2.trim())?.[1]?.toLowerCase();
19677
- return !!name && this.#knownCommands.has(name) && !this.nativeCommandName(text2);
19797
+ rejectsCommand(text3) {
19798
+ const name = /^\/([\w-]+)(?:\s|$)/u.exec(text3.trim())?.[1]?.toLowerCase();
19799
+ return !!name && this.#knownCommands.has(name) && !this.nativeCommandName(text3);
19678
19800
  }
19679
19801
  get availableCommands() {
19680
19802
  return this.#commands;
@@ -19821,10 +19943,10 @@ var HermesGatewaySessionTransport = class {
19821
19943
  throw new Error("Hermes effective approval policy differs from the requested mode; check native global approvals policy");
19822
19944
  this.#info = { ...this.#info, yolo: modeId === "dont_ask" };
19823
19945
  }
19824
- nativeCommandName(text2) {
19825
- return hermesGatewayCommandName(text2, this.#commands);
19946
+ nativeCommandName(text3) {
19947
+ return hermesGatewayCommandName(text3, this.#commands);
19826
19948
  }
19827
- async runTurn(text2, emit, permission, question2) {
19949
+ async runTurn(text3, emit, permission, question2) {
19828
19950
  if (this.#active || this.#closed)
19829
19951
  throw new Error("Hermes gateway Session is unavailable");
19830
19952
  let resolveResult = () => void 0;
@@ -19847,8 +19969,8 @@ var HermesGatewaySessionTransport = class {
19847
19969
  };
19848
19970
  this.#active = active2;
19849
19971
  void this.#adoptedPrompts.splice(0).map((prompt) => void this.#respondAdoptedApproval(prompt, active2).catch(() => void 0));
19850
- const commandText = text2.trim();
19851
- const nativeCommand = this.nativeCommandName(text2);
19972
+ const commandText = text3.trim();
19973
+ const nativeCommand = this.nativeCommandName(text3);
19852
19974
  try {
19853
19975
  if (nativeCommand === "compress") {
19854
19976
  const compact = await this.transport.request("session.compress", { session_id: this.sessionId, focus_topic: commandText.slice(9).trim() }, 3e5);
@@ -19889,12 +20011,12 @@ var HermesGatewaySessionTransport = class {
19889
20011
  this.#delegationGuidance = null;
19890
20012
  const submitted = await this.transport.request("prompt.submit", {
19891
20013
  session_id: this.sessionId,
19892
- text: text2,
20014
+ text: text3,
19893
20015
  submission_id: `codexhost-turn-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
19894
20016
  clarify_batch: true,
19895
20017
  ...guidance ? { api_text: `${guidance}
19896
20018
 
19897
- ${text2}` } : {}
20019
+ ${text3}` } : {}
19898
20020
  });
19899
20021
  if (submitted.status !== "queued" && submitted.status !== "started")
19900
20022
  this.#fault(new Error(`Hermes did not accept the turn (${String(submitted.status)})`));
@@ -19992,27 +20114,27 @@ ${text2}` } : {}
19992
20114
  if (eventType.startsWith("message.") || eventType.startsWith("reasoning."))
19993
20115
  return;
19994
20116
  }
19995
- const text2 = gatewayString(payload.text);
20117
+ const text3 = gatewayString(payload.text);
19996
20118
  if (event.type === "message.delta") {
19997
- active2.streamed += text2;
19998
- active2.emit({ type: "agent.text", text: text2 });
20119
+ active2.streamed += text3;
20120
+ active2.emit({ type: "agent.text", text: text3 });
19999
20121
  } else if (event.type === "reasoning.delta" || event.type === "reasoning.available") {
20000
20122
  if (event.type === "reasoning.delta" || !active2.reasoning) {
20001
- active2.reasoning += text2;
20002
- active2.emit({ type: "agent.thought", text: text2 });
20123
+ active2.reasoning += text3;
20124
+ active2.emit({ type: "agent.thought", text: text3 });
20003
20125
  }
20004
20126
  } else if (event.type === "message.interim") {
20005
20127
  if (payload.already_streamed !== true)
20006
- active2.emit({ type: "agent.text", text: text2 });
20128
+ active2.emit({ type: "agent.text", text: text3 });
20007
20129
  active2.streamed = "";
20008
20130
  active2.reasoning = "";
20009
20131
  } else if (event.type === "status.update") {
20010
20132
  if (payload.kind === "compacting")
20011
- active2.emit({ type: "compaction.started", text: text2 });
20133
+ active2.emit({ type: "compaction.started", text: text3 });
20012
20134
  else if (payload.kind === "compacted")
20013
- active2.emit({ type: "compaction.finished", text: text2 });
20135
+ active2.emit({ type: "compaction.finished", text: text3 });
20014
20136
  else if (payload.kind === "warning")
20015
- active2.emit({ type: "status.warning", text: text2 });
20137
+ active2.emit({ type: "status.warning", text: text3 });
20016
20138
  } else if (event.type === "tool.start" || event.type === "tool.complete") {
20017
20139
  const toolCallId = gatewayString(payload.tool_id);
20018
20140
  if (!toolCallId)
@@ -20055,9 +20177,9 @@ ${text2}` } : {}
20055
20177
  });
20056
20178
  } else if (event.type === "message.complete") {
20057
20179
  if (!active2.streamed)
20058
- active2.emit({ type: "agent.text", text: text2 });
20059
- else if (text2.startsWith(active2.streamed) && text2.length > active2.streamed.length)
20060
- active2.emit({ type: "agent.text", text: text2.slice(active2.streamed.length) });
20180
+ active2.emit({ type: "agent.text", text: text3 });
20181
+ else if (text3.startsWith(active2.streamed) && text3.length > active2.streamed.length)
20182
+ active2.emit({ type: "agent.text", text: text3.slice(active2.streamed.length) });
20061
20183
  const reasoning = gatewayString(payload.reasoning);
20062
20184
  if (reasoning && !active2.reasoning)
20063
20185
  active2.emit({ type: "agent.thought", text: reasoning });
@@ -20071,7 +20193,7 @@ ${text2}` } : {}
20071
20193
  else
20072
20194
  active2.resolve({
20073
20195
  stopReason: payload.status === "interrupted" ? "cancelled" : "end_turn",
20074
- ...payload.status === "complete" && text2.trim() ? { finalAnswerText: text2 } : {},
20196
+ ...payload.status === "complete" && text3.trim() ? { finalAnswerText: text3 } : {},
20075
20197
  ...terminalUsage ? { usage: terminalUsage } : {}
20076
20198
  });
20077
20199
  } else if (event.type === "error")
@@ -20271,12 +20393,12 @@ function tokenCount(value) {
20271
20393
  }
20272
20394
  function hermesUsageEntry(row) {
20273
20395
  const apiCalls = tokenCount(row.api_call_count) ? row.api_call_count : 0;
20274
- const input = tokenCount(row.input_tokens) ? row.input_tokens : 0;
20396
+ const input2 = tokenCount(row.input_tokens) ? row.input_tokens : 0;
20275
20397
  const output = tokenCount(row.output_tokens) ? row.output_tokens : 0;
20276
20398
  const cacheRead = tokenCount(row.cache_read_tokens) ? row.cache_read_tokens : 0;
20277
20399
  const cacheWrite = tokenCount(row.cache_write_tokens) ? row.cache_write_tokens : 0;
20278
20400
  const reasoning = tokenCount(row.reasoning_tokens) ? row.reasoning_tokens : 0;
20279
- if (apiCalls === 0 && input === 0 && output === 0 && cacheRead === 0 && cacheWrite === 0) {
20401
+ if (apiCalls === 0 && input2 === 0 && output === 0 && cacheRead === 0 && cacheWrite === 0) {
20280
20402
  return null;
20281
20403
  }
20282
20404
  const id2 = typeof row.id === "string" && row.id.length > 0 ? row.id : null;
@@ -20292,7 +20414,7 @@ function hermesUsageEntry(row) {
20292
20414
  const request = {
20293
20415
  requestId: id2,
20294
20416
  ...typeof row.model === "string" && row.model.length > 0 ? { model: row.model } : {},
20295
- inputTokens: input + cacheRead + cacheWrite,
20417
+ inputTokens: input2 + cacheRead + cacheWrite,
20296
20418
  outputTokens: output,
20297
20419
  ...reasoning > 0 ? { reasoningOutputTokens: reasoning } : {},
20298
20420
  // Both buckets exist whenever either does: the writer records them as a pair.
@@ -20420,22 +20542,22 @@ var HermesQuestions = class {
20420
20542
  import { randomUUID as randomUUID2 } from "node:crypto";
20421
20543
  var HermesCompactionActivity = class {
20422
20544
  #item = null;
20423
- start(text2) {
20545
+ start(text3) {
20424
20546
  if (this.#item)
20425
20547
  return null;
20426
20548
  this.#item = {
20427
20549
  type: "agentMessage",
20428
20550
  itemId: hostItemIdSchema.parse(randomUUID2()),
20429
20551
  phase: "commentary",
20430
- text: `Hermes 自动压缩:${text2 || "进行中"}`
20552
+ text: `Hermes 自动压缩:${text3 || "进行中"}`
20431
20553
  };
20432
20554
  return this.#item;
20433
20555
  }
20434
- appendNotice(text2) {
20435
- if (!this.#item || !text2)
20556
+ appendNotice(text3) {
20557
+ if (!this.#item || !text3)
20436
20558
  return null;
20437
20559
  const addition = `
20438
- Hermes 提示:${text2}`;
20560
+ Hermes 提示:${text3}`;
20439
20561
  this.#item = { ...this.#item, text: this.#item.text + addition };
20440
20562
  return { itemId: this.#item.itemId, text: addition };
20441
20563
  }
@@ -20853,9 +20975,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
20853
20975
  } }));
20854
20976
  }
20855
20977
  }
20856
- function splitLines(text2) {
20857
- const hasTrailingNl = text2.endsWith("\n");
20858
- const result = text2.split("\n").map((line) => line + "\n");
20978
+ function splitLines(text3) {
20979
+ const hasTrailingNl = text3.endsWith("\n");
20980
+ const result = text3.split("\n").map((line) => line + "\n");
20859
20981
  if (hasTrailingNl) {
20860
20982
  result.pop();
20861
20983
  } else {
@@ -20976,16 +21098,16 @@ var ActiveTurn = class {
20976
21098
  this.#emittedTerminalItemIds.add(item.itemId);
20977
21099
  return snapshot;
20978
21100
  }
20979
- constructor(turnId, turnKey, input, persistsHistory, compaction) {
21101
+ constructor(turnId, turnKey, input2, persistsHistory, compaction) {
20980
21102
  this.turnId = hostTurnIdSchema.parse(turnId);
20981
21103
  this.turnKey = turnKey;
20982
- this.input = input;
21104
+ this.input = input2;
20983
21105
  this.persistsHistory = persistsHistory;
20984
21106
  this.compactionItem = compaction ? { type: "contextCompaction", itemId: hostItemIdSchema.parse(randomUUID3()) } : null;
20985
21107
  }
20986
- appendText(kind, text2) {
21108
+ appendText(kind, text3) {
20987
21109
  if (this.#currentText && this.#currentText.kind === kind) {
20988
- const item2 = { ...this.#currentText.item, text: this.#currentText.item.text + text2 };
21110
+ const item2 = { ...this.#currentText.item, text: this.#currentText.item.text + text3 };
20989
21111
  this.#currentText = { kind, item: item2 };
20990
21112
  return { startedItem: null, item: item2 };
20991
21113
  }
@@ -20996,7 +21118,7 @@ var ActiveTurn = class {
20996
21118
  });
20997
21119
  }
20998
21120
  const item = kind === "reasoning" ? { type: "reasoning", itemId: hostItemIdSchema.parse(randomUUID3()), text: "" } : { type: "agentMessage", itemId: hostItemIdSchema.parse(randomUUID3()), text: "" };
20999
- const appended = { ...item, text: text2 };
21121
+ const appended = { ...item, text: text3 };
21000
21122
  this.#currentText = { kind, item: appended };
21001
21123
  return { startedItem: item, item: appended };
21002
21124
  }
@@ -21139,13 +21261,13 @@ var HermesSession = class {
21139
21261
  const catalog = await this.commands.list();
21140
21262
  if (!catalog.ok)
21141
21263
  return catalog;
21142
- const text2 = hermesCommandText(command, catalog.value);
21143
- if (!text2.ok)
21144
- return text2;
21264
+ const text3 = hermesCommandText(command, catalog.value);
21265
+ if (!text3.ok)
21266
+ return text3;
21145
21267
  return this.#startTurn({
21146
21268
  type: "turn.start",
21147
21269
  turnId: command.turnId,
21148
- input: [{ type: "text", text: text2.value }]
21270
+ input: [{ type: "text", text: text3.value }]
21149
21271
  }, true);
21150
21272
  }
21151
21273
  };
@@ -21269,40 +21391,40 @@ var HermesSession = class {
21269
21391
  if (this.busy) {
21270
21392
  return err("sessionBusy", "Hermes Session already has an active Turn", true);
21271
21393
  }
21272
- const text2 = command.input.map((chunk) => chunk.text).join("\n");
21273
- if (text2.trim().length === 0) {
21394
+ const text3 = command.input.map((chunk) => chunk.text).join("\n");
21395
+ if (text3.trim().length === 0) {
21274
21396
  return err("invalidRequest", "turn.start requires non-empty text input");
21275
21397
  }
21276
21398
  this.#startingTurn = true;
21277
21399
  try {
21278
- if (text2.trim().startsWith("/")) {
21400
+ if (text3.trim().startsWith("/")) {
21279
21401
  const catalog = await this.commands.list();
21280
21402
  if (!catalog.ok)
21281
21403
  return catalog;
21282
- const name = /^\/([\w-]+)(?:\s|$)/u.exec(text2.trim())?.[1]?.toLowerCase();
21283
- if (name && isExcludedHermesCommand(name) || this.#transport.rejectsCommand?.(text2))
21404
+ const name = /^\/([\w-]+)(?:\s|$)/u.exec(text3.trim())?.[1]?.toLowerCase();
21405
+ if (name && isExcludedHermesCommand(name) || this.#transport.rejectsCommand?.(text3))
21284
21406
  return err("unsupported", "This Hermes command or its arguments are not supported in a Host Thread");
21285
21407
  }
21286
21408
  if (this.#closed || this.#faulted)
21287
21409
  return err("invalidState", "Hermes Session is unavailable");
21288
- return this.#acceptTurn(command, text2, requireNativeCommand);
21410
+ return this.#acceptTurn(command, text3, requireNativeCommand);
21289
21411
  } finally {
21290
21412
  this.#startingTurn = false;
21291
21413
  }
21292
21414
  }
21293
- #acceptTurn(command, text2, requireNativeCommand) {
21415
+ #acceptTurn(command, text3, requireNativeCommand) {
21294
21416
  const turnKey = randomUUID3();
21295
- const nativeCommand = this.#transport.nativeCommandName?.(text2) ?? null;
21417
+ const nativeCommand = this.#transport.nativeCommandName?.(text3) ?? null;
21296
21418
  if (requireNativeCommand && !nativeCommand)
21297
21419
  return err("unsupported", "Hermes no longer advertises this command");
21298
21420
  const isNativeCommand = nativeCommand != null;
21299
21421
  const active2 = new ActiveTurn(command.turnId, turnKey, command.input, !isNativeCommand, isNativeCommand && nativeCommand === "compress");
21300
21422
  this.#activeTurn = active2;
21301
21423
  this.#activeTurnId = active2.turnId;
21302
- void this.#runTurn(active2, text2);
21424
+ void this.#runTurn(active2, text3);
21303
21425
  return ok({ turnId: active2.turnId });
21304
21426
  }
21305
- async #runTurn(active2, text2) {
21427
+ async #runTurn(active2, text3) {
21306
21428
  this.#emit({ type: "turn.started", turnId: active2.turnId });
21307
21429
  if (active2.compactionItem)
21308
21430
  this.#emit({ type: "item.started", turnId: active2.turnId, item: active2.compactionItem });
@@ -21312,7 +21434,7 @@ var HermesSession = class {
21312
21434
  try {
21313
21435
  if (active2.persistsHistory && this.#transport.readNativeSnapshot)
21314
21436
  previousNativeTurnKey = (await this.#transport.readNativeSnapshot()).turns.at(-1)?.nativeTurnRef.nativeTurnKey;
21315
- promptResponse = await this.#transport.runTurn(text2, (event) => this.#handleTransportEvent(active2, event), (request) => this.#handlePermissionRequest(active2, request), (request) => this.#handleQuestionRequest(active2, request));
21437
+ promptResponse = await this.#transport.runTurn(text3, (event) => this.#handleTransportEvent(active2, event), (request) => this.#handlePermissionRequest(active2, request), (request) => this.#handleQuestionRequest(active2, request));
21316
21438
  } catch (error51) {
21317
21439
  failure2 = error51 instanceof HermesTransportError ? transportErrorToHarness(error51) : harnessError("nativeFailure", error51 instanceof Error ? error51.message : String(error51));
21318
21440
  }
@@ -21458,8 +21580,8 @@ ${reason}` }
21458
21580
  this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot });
21459
21581
  return true;
21460
21582
  }
21461
- #appendTextItem(active2, kind, text2) {
21462
- const appended = active2.appendText(kind, text2);
21583
+ #appendTextItem(active2, kind, text3) {
21584
+ const appended = active2.appendText(kind, text3);
21463
21585
  if (!appended)
21464
21586
  return;
21465
21587
  if (appended.startedItem) {
@@ -21469,7 +21591,7 @@ ${reason}` }
21469
21591
  type: "item.updated",
21470
21592
  turnId: active2.turnId,
21471
21593
  itemId: appended.item.itemId,
21472
- update: { type: "text.append", text: text2 }
21594
+ update: { type: "text.append", text: text3 }
21473
21595
  });
21474
21596
  }
21475
21597
  #startToolItem(active2, toolCallId, title, name, rawInput) {
@@ -21731,20 +21853,20 @@ function gatewayPermissionModes() {
21731
21853
  function isGatewayRef(ref) {
21732
21854
  return ref.harnessId === "hermes" && gatewayRecord(ref.locator).transport === "gateway";
21733
21855
  }
21734
- async function openGatewaySession(input, transport, onSettle, inheritedPermissionMode) {
21735
- const source = input.kind === "create" ? null : input.kind === "resume" ? input.nativeRef : input.sourceRef;
21736
- if (source && !isGatewayRef(source) && !(input.kind === "resume" && source.harnessId === "hermes" && !source.locator))
21856
+ async function openGatewaySession(input2, transport, onSettle, inheritedPermissionMode) {
21857
+ const source = input2.kind === "create" ? null : input2.kind === "resume" ? input2.nativeRef : input2.sourceRef;
21858
+ if (source && !isGatewayRef(source) && !(input2.kind === "resume" && source.harnessId === "hermes" && !source.locator))
21737
21859
  throw new HermesGatewayHistoryError("unsupported", "This Hermes native reference is not a supported gateway Session");
21738
21860
  const savedMode = source ? gatewayRecord(source.locator).permissionModeId : void 0;
21739
- const mode = (input.kind === "fork" ? inheritedPermissionMode : input.permissionModeId) ?? (typeof savedMode === "string" ? savedMode : void 0);
21861
+ const mode = (input2.kind === "fork" ? inheritedPermissionMode : input2.permissionModeId) ?? (typeof savedMode === "string" ? savedMode : void 0);
21740
21862
  if (mode && mode !== "default" && mode !== "dont_ask")
21741
21863
  throw new HermesGatewayHistoryError("unsupported", "Hermes gateway supports only native approval policy and session YOLO");
21742
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access" && mode && mode !== "dont_ask")
21864
+ if (input2.kind === "create" && input2.executionPolicy === "unattended-full-access" && mode && mode !== "dont_ask")
21743
21865
  throw new HermesGatewayHistoryError("invalidRequest", "unattended-full-access requires dont_ask");
21744
- const model2 = input.kind !== "fork" ? input.model?.id : void 0;
21745
- if (input.kind !== "fork" && input.model && !model2)
21866
+ const model2 = input2.kind !== "fork" ? input2.model?.id : void 0;
21867
+ if (input2.kind !== "fork" && input2.model && !model2)
21746
21868
  throw new HermesGatewayHistoryError("invalidRequest", "Model Ref does not belong to Hermes");
21747
- if (source && gatewayRecord(source.locator).cwd && !await sameDirectory(String(gatewayRecord(source?.locator).cwd), input.cwd))
21869
+ if (source && gatewayRecord(source.locator).cwd && !await sameDirectory(String(gatewayRecord(source?.locator).cwd), input2.cwd))
21748
21870
  throw new HermesGatewayHistoryError("unsupported", "Hermes gateway preserves the native Session working directory");
21749
21871
  let nativeRef = source;
21750
21872
  let sourceHistory;
@@ -21753,23 +21875,23 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
21753
21875
  await transport.prepareSession();
21754
21876
  await transport.start();
21755
21877
  }
21756
- if (source && (input.kind === "fork" || input.kind === "rollbackLastTurn")) {
21878
+ if (source && (input2.kind === "fork" || input2.kind === "rollbackLastTurn")) {
21757
21879
  sourceHistory = new HermesGatewayHistory({
21758
21880
  python: transport.runtime,
21759
21881
  cwd: transport.cwd,
21760
21882
  environment: transport.environment,
21761
21883
  nativeSessionId: source.nativeSessionId
21762
21884
  });
21763
- nativeRef = await sourceHistory.derive(input.kind === "fork" ? { checkpoint: input.checkpoint } : { rollbackLastTurn: true });
21885
+ nativeRef = await sourceHistory.derive(input2.kind === "fork" ? { checkpoint: input2.checkpoint } : { rollbackLastTurn: true });
21764
21886
  }
21765
21887
  const response = await transport.request(
21766
21888
  nativeRef ? "session.resume" : "session.create",
21767
21889
  // Canonical wire (hermes-gateway-v1, CanonicalCreateParams/CanonicalResumeParams):
21768
21890
  // no close_on_disconnect / eager_build keys, and the effort key is "reasoning".
21769
21891
  nativeRef ? { session_id: nativeRef.nativeSessionId, omit_messages: true } : {
21770
- cwd: input.cwd,
21892
+ cwd: input2.cwd,
21771
21893
  ...model2 ? { model: model2 } : {},
21772
- ...input.kind === "create" && input.thinkingOptionId ? { reasoning: input.thinkingOptionId } : {}
21894
+ ...input2.kind === "create" && input2.thinkingOptionId ? { reasoning: input2.thinkingOptionId } : {}
21773
21895
  }
21774
21896
  );
21775
21897
  const runtimeId = gatewayString(response.session_id);
@@ -21778,7 +21900,7 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
21778
21900
  throw new Error("Hermes gateway did not return Session identity");
21779
21901
  const info = gatewayRecord(response.info);
21780
21902
  const nativeCwd = gatewayString(info.cwd);
21781
- if (nativeCwd && !await sameDirectory(nativeCwd, input.cwd))
21903
+ if (nativeCwd && !await sameDirectory(nativeCwd, input2.cwd))
21782
21904
  throw new HermesGatewayHistoryError("unsupported", "Hermes resumed a different native working directory");
21783
21905
  const bridge = new HermesGatewaySessionTransport(transport, runtimeId, storedId, info, {
21784
21906
  revision: response.revision,
@@ -21791,9 +21913,9 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
21791
21913
  }
21792
21914
  if (model2)
21793
21915
  await bridge.setModel(model2);
21794
- if (input.kind !== "fork" && input.thinkingOptionId)
21795
- await bridge.setThinking(input.thinkingOptionId);
21796
- const desiredMode = input.kind === "create" && input.executionPolicy === "unattended-full-access" ? "dont_ask" : mode;
21916
+ if (input2.kind !== "fork" && input2.thinkingOptionId)
21917
+ await bridge.setThinking(input2.thinkingOptionId);
21918
+ const desiredMode = input2.kind === "create" && input2.executionPolicy === "unattended-full-access" ? "dont_ask" : mode;
21797
21919
  if (desiredMode)
21798
21920
  await bridge.setPermissionMode(desiredMode);
21799
21921
  const open = await bridge.openResult();
@@ -21804,7 +21926,7 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
21804
21926
  formatVersion: 1,
21805
21927
  locator: {
21806
21928
  transport: "gateway",
21807
- cwd: input.cwd,
21929
+ cwd: input2.cwd,
21808
21930
  permissionModeId: open.session.modes?.currentModeId
21809
21931
  }
21810
21932
  }),
@@ -21849,11 +21971,11 @@ var HermesAdapter = class {
21849
21971
  this.#options = options;
21850
21972
  this.usageStatistics = createHermesUsageStatistics(options.environment ?? process.env);
21851
21973
  }
21852
- async inspect(input = {}) {
21853
- const cwd = input.cwd ?? process.cwd();
21854
- if (!input.refresh && this.#inspectionCache && this.#inspectionCacheScope === cwd)
21974
+ async inspect(input2 = {}) {
21975
+ const cwd = input2.cwd ?? process.cwd();
21976
+ if (!input2.refresh && this.#inspectionCache && this.#inspectionCacheScope === cwd)
21855
21977
  return this.#inspectionCache;
21856
- if (input.refresh)
21978
+ if (input2.refresh)
21857
21979
  this.#gatewayProbes.clear();
21858
21980
  try {
21859
21981
  if (!await this.#gatewayRuntime(cwd, this.#effectiveEnvironment()))
@@ -21906,24 +22028,24 @@ var HermesAdapter = class {
21906
22028
  });
21907
22029
  return this.#inventoryRead;
21908
22030
  }
21909
- async open(input) {
22031
+ async open(input2) {
21910
22032
  if (this.#closed)
21911
22033
  return failure("invalidState", "Hermes Adapter is closed");
21912
- if (typeof input.cwd !== "string" || input.cwd.trim().length === 0)
22034
+ if (typeof input2.cwd !== "string" || input2.cwd.trim().length === 0)
21913
22035
  return failure("invalidRequest", "open requires a cwd");
21914
- const nativeRef = input.kind === "create" ? null : input.kind === "resume" ? input.nativeRef : input.sourceRef;
22036
+ const nativeRef = input2.kind === "create" ? null : input2.kind === "resume" ? input2.nativeRef : input2.sourceRef;
21915
22037
  if (nativeRef && nativeRef.harnessId !== this.harnessId)
21916
22038
  return failure("invalidRequest", "Native Ref does not belong to Hermes");
21917
- if (nativeRef && !isGatewayRef(nativeRef) && !(input.kind === "resume" && !nativeRef.locator))
22039
+ if (nativeRef && !isGatewayRef(nativeRef) && !(input2.kind === "resume" && !nativeRef.locator))
21918
22040
  return failure("unsupported", "Hermes chat Sessions require a supported Gateway native reference");
21919
- const environment = this.#effectiveEnvironment(input.environment);
22041
+ const environment = this.#effectiveEnvironment(input2.environment);
21920
22042
  try {
21921
- const runtime = await this.#gatewayRuntime(input.cwd, environment);
22043
+ const runtime = await this.#gatewayRuntime(input2.cwd, environment);
21922
22044
  if (this.#closed)
21923
22045
  return failure("invalidState", "Hermes Adapter is closed");
21924
22046
  if (!runtime)
21925
22047
  return failure("unavailable", "Hermes requires a Gateway with exclusive turn support; ACP chat fallback is not supported");
21926
- return this.#openGateway(input, runtime, environment);
22048
+ return this.#openGateway(input2, runtime, environment);
21927
22049
  } catch (error51) {
21928
22050
  if (error51 instanceof HermesExecutableError)
21929
22051
  return failure("notInstalled", error51.message);
@@ -21943,12 +22065,12 @@ var HermesAdapter = class {
21943
22065
  }
21944
22066
  return pending;
21945
22067
  }
21946
- async #openGateway(input, runtime, environment) {
22068
+ async #openGateway(input2, runtime, environment) {
21947
22069
  if (this.#closed)
21948
22070
  return failure("invalidState", "Hermes Adapter is closed");
21949
- const ref = input.kind === "resume" ? input.nativeRef : null;
21950
- if (input.kind === "fork" || input.kind === "rollbackLastTurn") {
21951
- const source = [...this.#sessions].find((s) => s.initialState.nativeRef?.nativeSessionId === input.sourceRef.nativeSessionId);
22071
+ const ref = input2.kind === "resume" ? input2.nativeRef : null;
22072
+ if (input2.kind === "fork" || input2.kind === "rollbackLastTurn") {
22073
+ const source = [...this.#sessions].find((s) => s.initialState.nativeRef?.nativeSessionId === input2.sourceRef.nativeSessionId);
21952
22074
  if (source?.busy)
21953
22075
  return failure("sessionBusy", "Cannot derive a Hermes Session while its source Turn is active", true);
21954
22076
  }
@@ -21959,16 +22081,16 @@ var HermesAdapter = class {
21959
22081
  this.#openingNativeIds.add(ref.nativeSessionId);
21960
22082
  let transport;
21961
22083
  try {
21962
- transport = this.#gatewayPool.acquire(runtime, input.cwd, environment) ?? await startGatewayTransport(runtime, input.cwd, environment, this.#options.commandTimeoutMs);
22084
+ transport = this.#gatewayPool.acquire(runtime, input2.cwd, environment) ?? await startGatewayTransport(runtime, input2.cwd, environment, this.#options.commandTimeoutMs);
21963
22085
  this.#gatewayTransports.add(transport);
21964
22086
  let inheritedMode;
21965
- if (input.kind === "fork") {
21966
- const source = [...this.#sessions].find((s) => s.initialState.nativeRef?.nativeSessionId === input.sourceRef.nativeSessionId);
22087
+ if (input2.kind === "fork") {
22088
+ const source = [...this.#sessions].find((s) => s.initialState.nativeRef?.nativeSessionId === input2.sourceRef.nativeSessionId);
21967
22089
  const snapshot = await source?.readSnapshot();
21968
22090
  if (snapshot?.ok)
21969
22091
  inheritedMode = snapshot.value.state?.effectivePermissionModeId;
21970
22092
  }
21971
- const session = await openGatewaySession(input, transport, (settled) => {
22093
+ const session = await openGatewaySession(input2, transport, (settled) => {
21972
22094
  this.#sessions.delete(settled);
21973
22095
  this.#gatewayTransports.delete(transport);
21974
22096
  this.#gatewayPool.release(transport);