@codexhost/cli-darwin-x64 0.24.0 → 0.25.1

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 (52) 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.app/Contents/Info.plist +30 -0
  47. package/libexec/CodexHost.app/Contents/MacOS/CodexHost +0 -0
  48. package/libexec/CodexHost.app/Contents/PkgInfo +1 -0
  49. package/libexec/CodexHost.app/Contents/Resources/AppIcon.icns +0 -0
  50. package/libexec/codexhost-shim +0 -0
  51. package/libexec/codexhost-updater +0 -0
  52. 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",
@@ -316,7 +316,7 @@ function createInstallationManager(options) {
316
316
  const check2 = () => checking ??= options.check().finally(() => {
317
317
  checking = void 0;
318
318
  });
319
- return (action) => {
319
+ return (action, confirmedVersion) => {
320
320
  if (updating)
321
321
  return updating;
322
322
  if (action === "check")
@@ -327,6 +327,8 @@ function createInstallationManager(options) {
327
327
  return before;
328
328
  if (!before.canUpdate)
329
329
  throw new Error(before.message ?? "This installation cannot be updated automatically");
330
+ if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
331
+ return { ...before, confirmationRequired: true };
330
332
  await options.update(before);
331
333
  const after = await check2();
332
334
  if (after.currentVersion === before.currentVersion)
@@ -1113,8 +1115,8 @@ function cached(getter) {
1113
1115
  }
1114
1116
  };
1115
1117
  }
1116
- function nullish(input) {
1117
- return input === null || input === void 0;
1118
+ function nullish(input2) {
1119
+ return input2 === null || input2 === void 0;
1118
1120
  }
1119
1121
  function cleanRegex(source) {
1120
1122
  const start = source.startsWith("^") ? 1 : 0;
@@ -1201,8 +1203,8 @@ function randomString(length = 10) {
1201
1203
  function esc(str) {
1202
1204
  return JSON.stringify(str);
1203
1205
  }
1204
- function slugify(input) {
1205
- return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1206
+ function slugify(input2) {
1207
+ return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1206
1208
  }
1207
1209
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1208
1210
  };
@@ -1607,19 +1609,19 @@ function finalizeIssue(iss, ctx, config2) {
1607
1609
  }
1608
1610
  return rest;
1609
1611
  }
1610
- function getSizableOrigin(input) {
1611
- if (input instanceof Set)
1612
+ function getSizableOrigin(input2) {
1613
+ if (input2 instanceof Set)
1612
1614
  return "set";
1613
- if (input instanceof Map)
1615
+ if (input2 instanceof Map)
1614
1616
  return "map";
1615
- if (input instanceof File)
1617
+ if (input2 instanceof File)
1616
1618
  return "file";
1617
1619
  return "unknown";
1618
1620
  }
1619
- function getLengthableOrigin(input) {
1620
- if (Array.isArray(input))
1621
+ function getLengthableOrigin(input2) {
1622
+ if (Array.isArray(input2))
1621
1623
  return "array";
1622
- if (typeof input === "string")
1624
+ if (typeof input2 === "string")
1623
1625
  return "string";
1624
1626
  return "unknown";
1625
1627
  }
@@ -1645,12 +1647,12 @@ function parsedType(data) {
1645
1647
  return t;
1646
1648
  }
1647
1649
  function issue(...args) {
1648
- const [iss, input, inst] = args;
1650
+ const [iss, input2, inst] = args;
1649
1651
  if (typeof iss === "string") {
1650
1652
  return {
1651
1653
  message: iss,
1652
1654
  code: "custom",
1653
- input,
1655
+ input: input2,
1654
1656
  inst
1655
1657
  };
1656
1658
  }
@@ -2194,23 +2196,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2194
2196
  bag.pattern = integer;
2195
2197
  });
2196
2198
  inst._zod.check = (payload) => {
2197
- const input = payload.value;
2199
+ const input2 = payload.value;
2198
2200
  if (isInt) {
2199
- if (!Number.isInteger(input)) {
2201
+ if (!Number.isInteger(input2)) {
2200
2202
  payload.issues.push({
2201
2203
  expected: origin,
2202
2204
  format: def.format,
2203
2205
  code: "invalid_type",
2204
2206
  continue: false,
2205
- input,
2207
+ input: input2,
2206
2208
  inst
2207
2209
  });
2208
2210
  return;
2209
2211
  }
2210
- if (!Number.isSafeInteger(input)) {
2211
- if (input > 0) {
2212
+ if (!Number.isSafeInteger(input2)) {
2213
+ if (input2 > 0) {
2212
2214
  payload.issues.push({
2213
- input,
2215
+ input: input2,
2214
2216
  code: "too_big",
2215
2217
  maximum: Number.MAX_SAFE_INTEGER,
2216
2218
  note: "Integers must be within the safe integer range.",
@@ -2221,7 +2223,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2221
2223
  });
2222
2224
  } else {
2223
2225
  payload.issues.push({
2224
- input,
2226
+ input: input2,
2225
2227
  code: "too_small",
2226
2228
  minimum: Number.MIN_SAFE_INTEGER,
2227
2229
  note: "Integers must be within the safe integer range.",
@@ -2234,10 +2236,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2234
2236
  return;
2235
2237
  }
2236
2238
  }
2237
- if (input < minimum) {
2239
+ if (input2 < minimum) {
2238
2240
  payload.issues.push({
2239
2241
  origin: "number",
2240
- input,
2242
+ input: input2,
2241
2243
  code: "too_small",
2242
2244
  minimum,
2243
2245
  inclusive: true,
@@ -2245,10 +2247,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2245
2247
  continue: !def.abort
2246
2248
  });
2247
2249
  }
2248
- if (input > maximum) {
2250
+ if (input2 > maximum) {
2249
2251
  payload.issues.push({
2250
2252
  origin: "number",
2251
- input,
2253
+ input: input2,
2252
2254
  code: "too_big",
2253
2255
  maximum,
2254
2256
  inclusive: true,
@@ -2268,11 +2270,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2268
2270
  bag.maximum = maximum;
2269
2271
  });
2270
2272
  inst._zod.check = (payload) => {
2271
- const input = payload.value;
2272
- if (input < minimum) {
2273
+ const input2 = payload.value;
2274
+ if (input2 < minimum) {
2273
2275
  payload.issues.push({
2274
2276
  origin: "bigint",
2275
- input,
2277
+ input: input2,
2276
2278
  code: "too_small",
2277
2279
  minimum,
2278
2280
  inclusive: true,
@@ -2280,10 +2282,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2280
2282
  continue: !def.abort
2281
2283
  });
2282
2284
  }
2283
- if (input > maximum) {
2285
+ if (input2 > maximum) {
2284
2286
  payload.issues.push({
2285
2287
  origin: "bigint",
2286
- input,
2288
+ input: input2,
2287
2289
  code: "too_big",
2288
2290
  maximum,
2289
2291
  inclusive: true,
@@ -2306,16 +2308,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2306
2308
  inst2._zod.bag.maximum = def.maximum;
2307
2309
  });
2308
2310
  inst._zod.check = (payload) => {
2309
- const input = payload.value;
2310
- const size = input.size;
2311
+ const input2 = payload.value;
2312
+ const size = input2.size;
2311
2313
  if (size <= def.maximum)
2312
2314
  return;
2313
2315
  payload.issues.push({
2314
- origin: getSizableOrigin(input),
2316
+ origin: getSizableOrigin(input2),
2315
2317
  code: "too_big",
2316
2318
  maximum: def.maximum,
2317
2319
  inclusive: true,
2318
- input,
2320
+ input: input2,
2319
2321
  inst,
2320
2322
  continue: !def.abort
2321
2323
  });
@@ -2334,16 +2336,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2334
2336
  inst2._zod.bag.minimum = def.minimum;
2335
2337
  });
2336
2338
  inst._zod.check = (payload) => {
2337
- const input = payload.value;
2338
- const size = input.size;
2339
+ const input2 = payload.value;
2340
+ const size = input2.size;
2339
2341
  if (size >= def.minimum)
2340
2342
  return;
2341
2343
  payload.issues.push({
2342
- origin: getSizableOrigin(input),
2344
+ origin: getSizableOrigin(input2),
2343
2345
  code: "too_small",
2344
2346
  minimum: def.minimum,
2345
2347
  inclusive: true,
2346
- input,
2348
+ input: input2,
2347
2349
  inst,
2348
2350
  continue: !def.abort
2349
2351
  });
@@ -2363,13 +2365,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2363
2365
  bag.size = def.size;
2364
2366
  });
2365
2367
  inst._zod.check = (payload) => {
2366
- const input = payload.value;
2367
- const size = input.size;
2368
+ const input2 = payload.value;
2369
+ const size = input2.size;
2368
2370
  if (size === def.size)
2369
2371
  return;
2370
2372
  const tooBig = size > def.size;
2371
2373
  payload.issues.push({
2372
- origin: getSizableOrigin(input),
2374
+ origin: getSizableOrigin(input2),
2373
2375
  ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
2374
2376
  inclusive: true,
2375
2377
  exact: true,
@@ -2392,17 +2394,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2392
2394
  inst2._zod.bag.maximum = def.maximum;
2393
2395
  });
2394
2396
  inst._zod.check = (payload) => {
2395
- const input = payload.value;
2396
- const length = input.length;
2397
+ const input2 = payload.value;
2398
+ const length = input2.length;
2397
2399
  if (length <= def.maximum)
2398
2400
  return;
2399
- const origin = getLengthableOrigin(input);
2401
+ const origin = getLengthableOrigin(input2);
2400
2402
  payload.issues.push({
2401
2403
  origin,
2402
2404
  code: "too_big",
2403
2405
  maximum: def.maximum,
2404
2406
  inclusive: true,
2405
- input,
2407
+ input: input2,
2406
2408
  inst,
2407
2409
  continue: !def.abort
2408
2410
  });
@@ -2421,17 +2423,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2421
2423
  inst2._zod.bag.minimum = def.minimum;
2422
2424
  });
2423
2425
  inst._zod.check = (payload) => {
2424
- const input = payload.value;
2425
- const length = input.length;
2426
+ const input2 = payload.value;
2427
+ const length = input2.length;
2426
2428
  if (length >= def.minimum)
2427
2429
  return;
2428
- const origin = getLengthableOrigin(input);
2430
+ const origin = getLengthableOrigin(input2);
2429
2431
  payload.issues.push({
2430
2432
  origin,
2431
2433
  code: "too_small",
2432
2434
  minimum: def.minimum,
2433
2435
  inclusive: true,
2434
- input,
2436
+ input: input2,
2435
2437
  inst,
2436
2438
  continue: !def.abort
2437
2439
  });
@@ -2451,11 +2453,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2451
2453
  bag.length = def.length;
2452
2454
  });
2453
2455
  inst._zod.check = (payload) => {
2454
- const input = payload.value;
2455
- const length = input.length;
2456
+ const input2 = payload.value;
2457
+ const length = input2.length;
2456
2458
  if (length === def.length)
2457
2459
  return;
2458
- const origin = getLengthableOrigin(input);
2460
+ const origin = getLengthableOrigin(input2);
2459
2461
  const tooBig = length > def.length;
2460
2462
  payload.issues.push({
2461
2463
  origin,
@@ -3126,15 +3128,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3126
3128
  payload.value = Number(payload.value);
3127
3129
  } catch (_) {
3128
3130
  }
3129
- const input = payload.value;
3130
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
3131
+ const input2 = payload.value;
3132
+ if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
3131
3133
  return payload;
3132
3134
  }
3133
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
3135
+ const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
3134
3136
  payload.issues.push({
3135
3137
  expected: "number",
3136
3138
  code: "invalid_type",
3137
- input,
3139
+ input: input2,
3138
3140
  inst,
3139
3141
  ...received ? { received } : {}
3140
3142
  });
@@ -3154,13 +3156,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
3154
3156
  payload.value = Boolean(payload.value);
3155
3157
  } catch (_) {
3156
3158
  }
3157
- const input = payload.value;
3158
- if (typeof input === "boolean")
3159
+ const input2 = payload.value;
3160
+ if (typeof input2 === "boolean")
3159
3161
  return payload;
3160
3162
  payload.issues.push({
3161
3163
  expected: "boolean",
3162
3164
  code: "invalid_type",
3163
- input,
3165
+ input: input2,
3164
3166
  inst
3165
3167
  });
3166
3168
  return payload;
@@ -3193,13 +3195,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
3193
3195
  var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
3194
3196
  $ZodType.init(inst, def);
3195
3197
  inst._zod.parse = (payload, _ctx) => {
3196
- const input = payload.value;
3197
- if (typeof input === "symbol")
3198
+ const input2 = payload.value;
3199
+ if (typeof input2 === "symbol")
3198
3200
  return payload;
3199
3201
  payload.issues.push({
3200
3202
  expected: "symbol",
3201
3203
  code: "invalid_type",
3202
- input,
3204
+ input: input2,
3203
3205
  inst
3204
3206
  });
3205
3207
  return payload;
@@ -3210,13 +3212,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
3210
3212
  inst._zod.pattern = _undefined;
3211
3213
  inst._zod.values = /* @__PURE__ */ new Set([void 0]);
3212
3214
  inst._zod.parse = (payload, _ctx) => {
3213
- const input = payload.value;
3214
- if (typeof input === "undefined")
3215
+ const input2 = payload.value;
3216
+ if (typeof input2 === "undefined")
3215
3217
  return payload;
3216
3218
  payload.issues.push({
3217
3219
  expected: "undefined",
3218
3220
  code: "invalid_type",
3219
- input,
3221
+ input: input2,
3220
3222
  inst
3221
3223
  });
3222
3224
  return payload;
@@ -3227,13 +3229,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
3227
3229
  inst._zod.pattern = _null;
3228
3230
  inst._zod.values = /* @__PURE__ */ new Set([null]);
3229
3231
  inst._zod.parse = (payload, _ctx) => {
3230
- const input = payload.value;
3231
- if (input === null)
3232
+ const input2 = payload.value;
3233
+ if (input2 === null)
3232
3234
  return payload;
3233
3235
  payload.issues.push({
3234
3236
  expected: "null",
3235
3237
  code: "invalid_type",
3236
- input,
3238
+ input: input2,
3237
3239
  inst
3238
3240
  });
3239
3241
  return payload;
@@ -3262,13 +3264,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
3262
3264
  var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
3263
3265
  $ZodType.init(inst, def);
3264
3266
  inst._zod.parse = (payload, _ctx) => {
3265
- const input = payload.value;
3266
- if (typeof input === "undefined")
3267
+ const input2 = payload.value;
3268
+ if (typeof input2 === "undefined")
3267
3269
  return payload;
3268
3270
  payload.issues.push({
3269
3271
  expected: "void",
3270
3272
  code: "invalid_type",
3271
- input,
3273
+ input: input2,
3272
3274
  inst
3273
3275
  });
3274
3276
  return payload;
@@ -3283,15 +3285,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3283
3285
  } catch (_err) {
3284
3286
  }
3285
3287
  }
3286
- const input = payload.value;
3287
- const isDate = input instanceof Date;
3288
- const isValidDate = isDate && !Number.isNaN(input.getTime());
3288
+ const input2 = payload.value;
3289
+ const isDate = input2 instanceof Date;
3290
+ const isValidDate = isDate && !Number.isNaN(input2.getTime());
3289
3291
  if (isValidDate)
3290
3292
  return payload;
3291
3293
  payload.issues.push({
3292
3294
  expected: "date",
3293
3295
  code: "invalid_type",
3294
- input,
3296
+ input: input2,
3295
3297
  ...isDate ? { received: "Invalid Date" } : {},
3296
3298
  inst
3297
3299
  });
@@ -3307,20 +3309,20 @@ function handleArrayResult(result, final, index) {
3307
3309
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3308
3310
  $ZodType.init(inst, def);
3309
3311
  inst._zod.parse = (payload, ctx) => {
3310
- const input = payload.value;
3311
- if (!Array.isArray(input)) {
3312
+ const input2 = payload.value;
3313
+ if (!Array.isArray(input2)) {
3312
3314
  payload.issues.push({
3313
3315
  expected: "array",
3314
3316
  code: "invalid_type",
3315
- input,
3317
+ input: input2,
3316
3318
  inst
3317
3319
  });
3318
3320
  return payload;
3319
3321
  }
3320
- payload.value = Array(input.length);
3322
+ payload.value = Array(input2.length);
3321
3323
  const proms = [];
3322
- for (let i = 0; i < input.length; i++) {
3323
- const item = input[i];
3324
+ for (let i = 0; i < input2.length; i++) {
3325
+ const item = input2[i];
3324
3326
  const result = def.element._zod.run({
3325
3327
  value: item,
3326
3328
  issues: []
@@ -3337,8 +3339,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3337
3339
  return payload;
3338
3340
  };
3339
3341
  });
3340
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
3341
- const isPresent = key in input;
3342
+ function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
3343
+ const isPresent = key in input2;
3342
3344
  if (result.issues.length) {
3343
3345
  if (isOptionalIn && isOptionalOut && !isPresent) {
3344
3346
  return;
@@ -3380,14 +3382,14 @@ function normalizeDef(def) {
3380
3382
  optionalKeys: new Set(okeys)
3381
3383
  };
3382
3384
  }
3383
- function handleCatchall(proms, input, payload, ctx, def, inst) {
3385
+ function handleCatchall(proms, input2, payload, ctx, def, inst) {
3384
3386
  const unrecognized = [];
3385
3387
  const keySet = def.keySet;
3386
3388
  const _catchall = def.catchall._zod;
3387
3389
  const t = _catchall.def.type;
3388
3390
  const isOptionalIn = _catchall.optin === "optional";
3389
3391
  const isOptionalOut = _catchall.optout === "optional";
3390
- for (const key in input) {
3392
+ for (const key in input2) {
3391
3393
  if (key === "__proto__")
3392
3394
  continue;
3393
3395
  if (keySet.has(key))
@@ -3396,18 +3398,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3396
3398
  unrecognized.push(key);
3397
3399
  continue;
3398
3400
  }
3399
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
3401
+ const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
3400
3402
  if (r instanceof Promise) {
3401
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3403
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3402
3404
  } else {
3403
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3405
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3404
3406
  }
3405
3407
  }
3406
3408
  if (unrecognized.length) {
3407
3409
  payload.issues.push({
3408
3410
  code: "unrecognized_keys",
3409
3411
  keys: unrecognized,
3410
- input,
3412
+ input: input2,
3411
3413
  inst
3412
3414
  });
3413
3415
  }
@@ -3451,12 +3453,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3451
3453
  let value;
3452
3454
  inst._zod.parse = (payload, ctx) => {
3453
3455
  value ?? (value = _normalized.value);
3454
- const input = payload.value;
3455
- if (!isObject2(input)) {
3456
+ const input2 = payload.value;
3457
+ if (!isObject2(input2)) {
3456
3458
  payload.issues.push({
3457
3459
  expected: "object",
3458
3460
  code: "invalid_type",
3459
- input,
3461
+ input: input2,
3460
3462
  inst
3461
3463
  });
3462
3464
  return payload;
@@ -3468,17 +3470,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3468
3470
  const el = shape[key];
3469
3471
  const isOptionalIn = el._zod.optin === "optional";
3470
3472
  const isOptionalOut = el._zod.optout === "optional";
3471
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
3473
+ const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
3472
3474
  if (r instanceof Promise) {
3473
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3475
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3474
3476
  } else {
3475
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3477
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3476
3478
  }
3477
3479
  }
3478
3480
  if (!catchall) {
3479
3481
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3480
3482
  }
3481
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
3483
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
3482
3484
  };
3483
3485
  });
3484
3486
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3587,12 +3589,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3587
3589
  let value;
3588
3590
  inst._zod.parse = (payload, ctx) => {
3589
3591
  value ?? (value = _normalized.value);
3590
- const input = payload.value;
3591
- if (!isObject2(input)) {
3592
+ const input2 = payload.value;
3593
+ if (!isObject2(input2)) {
3592
3594
  payload.issues.push({
3593
3595
  expected: "object",
3594
3596
  code: "invalid_type",
3595
- input,
3597
+ input: input2,
3596
3598
  inst
3597
3599
  });
3598
3600
  return payload;
@@ -3603,7 +3605,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3603
3605
  payload = fastpass(payload, ctx);
3604
3606
  if (!catchall)
3605
3607
  return payload;
3606
- return handleCatchall([], input, payload, ctx, value, inst);
3608
+ return handleCatchall([], input2, payload, ctx, value, inst);
3607
3609
  }
3608
3610
  return superParse(payload, ctx);
3609
3611
  };
@@ -3763,17 +3765,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3763
3765
  return map2;
3764
3766
  });
3765
3767
  inst._zod.parse = (payload, ctx) => {
3766
- const input = payload.value;
3767
- if (!isObject(input)) {
3768
+ const input2 = payload.value;
3769
+ if (!isObject(input2)) {
3768
3770
  payload.issues.push({
3769
3771
  code: "invalid_type",
3770
3772
  expected: "object",
3771
- input,
3773
+ input: input2,
3772
3774
  inst
3773
3775
  });
3774
3776
  return payload;
3775
3777
  }
3776
- const opt = disc.value.get(input?.[def.discriminator]);
3778
+ const opt = disc.value.get(input2?.[def.discriminator]);
3777
3779
  if (opt) {
3778
3780
  return opt._zod.run(payload, ctx);
3779
3781
  }
@@ -3786,7 +3788,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3786
3788
  note: "No matching discriminator",
3787
3789
  discriminator: def.discriminator,
3788
3790
  options: Array.from(disc.value.keys()),
3789
- input,
3791
+ input: input2,
3790
3792
  path: [def.discriminator],
3791
3793
  inst
3792
3794
  });
@@ -3796,9 +3798,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3796
3798
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
3797
3799
  $ZodType.init(inst, def);
3798
3800
  inst._zod.parse = (payload, ctx) => {
3799
- const input = payload.value;
3800
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
3801
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
3801
+ const input2 = payload.value;
3802
+ const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
3803
+ const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
3802
3804
  const async = left instanceof Promise || right instanceof Promise;
3803
3805
  if (async) {
3804
3806
  return Promise.all([left, right]).then(([left2, right2]) => {
@@ -3895,10 +3897,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3895
3897
  $ZodType.init(inst, def);
3896
3898
  const items = def.items;
3897
3899
  inst._zod.parse = (payload, ctx) => {
3898
- const input = payload.value;
3899
- if (!Array.isArray(input)) {
3900
+ const input2 = payload.value;
3901
+ if (!Array.isArray(input2)) {
3900
3902
  payload.issues.push({
3901
- input,
3903
+ input: input2,
3902
3904
  inst,
3903
3905
  expected: "tuple",
3904
3906
  code: "invalid_type"
@@ -3910,23 +3912,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3910
3912
  const optinStart = getTupleOptStart(items, "optin");
3911
3913
  const optoutStart = getTupleOptStart(items, "optout");
3912
3914
  if (!def.rest) {
3913
- if (input.length < optinStart) {
3915
+ if (input2.length < optinStart) {
3914
3916
  payload.issues.push({
3915
3917
  code: "too_small",
3916
3918
  minimum: optinStart,
3917
3919
  inclusive: true,
3918
- input,
3920
+ input: input2,
3919
3921
  inst,
3920
3922
  origin: "array"
3921
3923
  });
3922
3924
  return payload;
3923
3925
  }
3924
- if (input.length > items.length) {
3926
+ if (input2.length > items.length) {
3925
3927
  payload.issues.push({
3926
3928
  code: "too_big",
3927
3929
  maximum: items.length,
3928
3930
  inclusive: true,
3929
- input,
3931
+ input: input2,
3930
3932
  inst,
3931
3933
  origin: "array"
3932
3934
  });
@@ -3934,7 +3936,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3934
3936
  }
3935
3937
  const itemResults = new Array(items.length);
3936
3938
  for (let i = 0; i < items.length; i++) {
3937
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
3939
+ const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
3938
3940
  if (r instanceof Promise) {
3939
3941
  proms.push(r.then((rr) => {
3940
3942
  itemResults[i] = rr;
@@ -3945,7 +3947,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3945
3947
  }
3946
3948
  if (def.rest) {
3947
3949
  let i = items.length - 1;
3948
- const rest = input.slice(items.length);
3950
+ const rest = input2.slice(items.length);
3949
3951
  for (const el of rest) {
3950
3952
  i++;
3951
3953
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
@@ -3957,9 +3959,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3957
3959
  }
3958
3960
  }
3959
3961
  if (proms.length) {
3960
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
3962
+ return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
3961
3963
  }
3962
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
3964
+ return handleTupleResults(itemResults, payload, items, input2, optoutStart);
3963
3965
  };
3964
3966
  });
3965
3967
  function getTupleOptStart(items, key) {
@@ -3975,10 +3977,10 @@ function handleTupleResult(result, final, index) {
3975
3977
  }
3976
3978
  final.value[index] = result.value;
3977
3979
  }
3978
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
3980
+ function handleTupleResults(itemResults, final, items, input2, optoutStart) {
3979
3981
  for (let i = 0; i < items.length; i++) {
3980
3982
  const r = itemResults[i];
3981
- const isPresent = i < input.length;
3983
+ const isPresent = i < input2.length;
3982
3984
  if (r.issues.length) {
3983
3985
  if (!isPresent && i >= optoutStart) {
3984
3986
  final.value.length = i;
@@ -3988,7 +3990,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
3988
3990
  }
3989
3991
  final.value[i] = r.value;
3990
3992
  }
3991
- for (let i = final.value.length - 1; i >= input.length; i--) {
3993
+ for (let i = final.value.length - 1; i >= input2.length; i--) {
3992
3994
  if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
3993
3995
  final.value.length = i;
3994
3996
  } else {
@@ -4000,12 +4002,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
4000
4002
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4001
4003
  $ZodType.init(inst, def);
4002
4004
  inst._zod.parse = (payload, ctx) => {
4003
- const input = payload.value;
4004
- if (!isPlainObject(input)) {
4005
+ const input2 = payload.value;
4006
+ if (!isPlainObject(input2)) {
4005
4007
  payload.issues.push({
4006
4008
  expected: "record",
4007
4009
  code: "invalid_type",
4008
- input,
4010
+ input: input2,
4009
4011
  inst
4010
4012
  });
4011
4013
  return payload;
@@ -4034,7 +4036,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4034
4036
  continue;
4035
4037
  }
4036
4038
  const outKey = keyResult.value;
4037
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
4039
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
4038
4040
  if (result instanceof Promise) {
4039
4041
  proms.push(result.then((result2) => {
4040
4042
  if (result2.issues.length) {
@@ -4051,7 +4053,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4051
4053
  }
4052
4054
  }
4053
4055
  let unrecognized;
4054
- for (const key in input) {
4056
+ for (const key in input2) {
4055
4057
  if (!recordKeys.has(key)) {
4056
4058
  unrecognized = unrecognized ?? [];
4057
4059
  unrecognized.push(key);
@@ -4060,17 +4062,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4060
4062
  if (unrecognized && unrecognized.length > 0) {
4061
4063
  payload.issues.push({
4062
4064
  code: "unrecognized_keys",
4063
- input,
4065
+ input: input2,
4064
4066
  inst,
4065
4067
  keys: unrecognized
4066
4068
  });
4067
4069
  }
4068
4070
  } else {
4069
4071
  payload.value = {};
4070
- for (const key of Reflect.ownKeys(input)) {
4072
+ for (const key of Reflect.ownKeys(input2)) {
4071
4073
  if (key === "__proto__")
4072
4074
  continue;
4073
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
4075
+ if (!Object.prototype.propertyIsEnumerable.call(input2, key))
4074
4076
  continue;
4075
4077
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4076
4078
  if (keyResult instanceof Promise) {
@@ -4088,7 +4090,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4088
4090
  }
4089
4091
  if (keyResult.issues.length) {
4090
4092
  if (def.mode === "loose") {
4091
- payload.value[key] = input[key];
4093
+ payload.value[key] = input2[key];
4092
4094
  } else {
4093
4095
  payload.issues.push({
4094
4096
  code: "invalid_key",
@@ -4101,7 +4103,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4101
4103
  }
4102
4104
  continue;
4103
4105
  }
4104
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
4106
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
4105
4107
  if (result instanceof Promise) {
4106
4108
  proms.push(result.then((result2) => {
4107
4109
  if (result2.issues.length) {
@@ -4126,27 +4128,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4126
4128
  var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4127
4129
  $ZodType.init(inst, def);
4128
4130
  inst._zod.parse = (payload, ctx) => {
4129
- const input = payload.value;
4130
- if (!(input instanceof Map)) {
4131
+ const input2 = payload.value;
4132
+ if (!(input2 instanceof Map)) {
4131
4133
  payload.issues.push({
4132
4134
  expected: "map",
4133
4135
  code: "invalid_type",
4134
- input,
4136
+ input: input2,
4135
4137
  inst
4136
4138
  });
4137
4139
  return payload;
4138
4140
  }
4139
4141
  const proms = [];
4140
4142
  payload.value = /* @__PURE__ */ new Map();
4141
- for (const [key, value] of input) {
4143
+ for (const [key, value] of input2) {
4142
4144
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4143
4145
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4144
4146
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
4145
4147
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
4146
- handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
4148
+ handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
4147
4149
  }));
4148
4150
  } else {
4149
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
4151
+ handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
4150
4152
  }
4151
4153
  }
4152
4154
  if (proms.length)
@@ -4154,7 +4156,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4154
4156
  return payload;
4155
4157
  };
4156
4158
  });
4157
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4159
+ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
4158
4160
  if (keyResult.issues.length) {
4159
4161
  if (propertyKeyTypes.has(typeof key)) {
4160
4162
  final.issues.push(...prefixIssues(key, keyResult.issues));
@@ -4162,7 +4164,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4162
4164
  final.issues.push({
4163
4165
  code: "invalid_key",
4164
4166
  origin: "map",
4165
- input,
4167
+ input: input2,
4166
4168
  inst,
4167
4169
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
4168
4170
  });
@@ -4175,7 +4177,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4175
4177
  final.issues.push({
4176
4178
  origin: "map",
4177
4179
  code: "invalid_element",
4178
- input,
4180
+ input: input2,
4179
4181
  inst,
4180
4182
  key,
4181
4183
  issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
@@ -4187,10 +4189,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4187
4189
  var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4188
4190
  $ZodType.init(inst, def);
4189
4191
  inst._zod.parse = (payload, ctx) => {
4190
- const input = payload.value;
4191
- if (!(input instanceof Set)) {
4192
+ const input2 = payload.value;
4193
+ if (!(input2 instanceof Set)) {
4192
4194
  payload.issues.push({
4193
- input,
4195
+ input: input2,
4194
4196
  inst,
4195
4197
  expected: "set",
4196
4198
  code: "invalid_type"
@@ -4199,7 +4201,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4199
4201
  }
4200
4202
  const proms = [];
4201
4203
  payload.value = /* @__PURE__ */ new Set();
4202
- for (const item of input) {
4204
+ for (const item of input2) {
4203
4205
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4204
4206
  if (result instanceof Promise) {
4205
4207
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4224,14 +4226,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4224
4226
  inst._zod.values = valuesSet;
4225
4227
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
4226
4228
  inst._zod.parse = (payload, _ctx) => {
4227
- const input = payload.value;
4228
- if (valuesSet.has(input)) {
4229
+ const input2 = payload.value;
4230
+ if (valuesSet.has(input2)) {
4229
4231
  return payload;
4230
4232
  }
4231
4233
  payload.issues.push({
4232
4234
  code: "invalid_value",
4233
4235
  values,
4234
- input,
4236
+ input: input2,
4235
4237
  inst
4236
4238
  });
4237
4239
  return payload;
@@ -4246,14 +4248,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4246
4248
  inst._zod.values = values;
4247
4249
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
4248
4250
  inst._zod.parse = (payload, _ctx) => {
4249
- const input = payload.value;
4250
- if (values.has(input)) {
4251
+ const input2 = payload.value;
4252
+ if (values.has(input2)) {
4251
4253
  return payload;
4252
4254
  }
4253
4255
  payload.issues.push({
4254
4256
  code: "invalid_value",
4255
4257
  values: def.values,
4256
- input,
4258
+ input: input2,
4257
4259
  inst
4258
4260
  });
4259
4261
  return payload;
@@ -4262,13 +4264,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4262
4264
  var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
4263
4265
  $ZodType.init(inst, def);
4264
4266
  inst._zod.parse = (payload, _ctx) => {
4265
- const input = payload.value;
4266
- if (input instanceof File)
4267
+ const input2 = payload.value;
4268
+ if (input2 instanceof File)
4267
4269
  return payload;
4268
4270
  payload.issues.push({
4269
4271
  expected: "file",
4270
4272
  code: "invalid_type",
4271
- input,
4273
+ input: input2,
4272
4274
  inst
4273
4275
  });
4274
4276
  return payload;
@@ -4298,8 +4300,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
4298
4300
  return payload;
4299
4301
  };
4300
4302
  });
4301
- function handleOptionalResult(result, input) {
4302
- if (input === void 0 && (result.issues.length || result.fallback)) {
4303
+ function handleOptionalResult(result, input2) {
4304
+ if (input2 === void 0 && (result.issues.length || result.fallback)) {
4303
4305
  return { issues: [], value: void 0 };
4304
4306
  }
4305
4307
  return result;
@@ -4317,11 +4319,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
4317
4319
  });
4318
4320
  inst._zod.parse = (payload, ctx) => {
4319
4321
  if (def.innerType._zod.optin === "optional") {
4320
- const input = payload.value;
4322
+ const input2 = payload.value;
4321
4323
  const result = def.innerType._zod.run(payload, ctx);
4322
4324
  if (result instanceof Promise)
4323
- return result.then((r) => handleOptionalResult(r, input));
4324
- return handleOptionalResult(result, input);
4325
+ return result.then((r) => handleOptionalResult(r, input2));
4326
+ return handleOptionalResult(result, input2);
4325
4327
  }
4326
4328
  if (payload.value === void 0) {
4327
4329
  return payload;
@@ -4746,20 +4748,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
4746
4748
  return payload;
4747
4749
  };
4748
4750
  inst._zod.check = (payload) => {
4749
- const input = payload.value;
4750
- const r = def.fn(input);
4751
+ const input2 = payload.value;
4752
+ const r = def.fn(input2);
4751
4753
  if (r instanceof Promise) {
4752
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
4754
+ return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
4753
4755
  }
4754
- handleRefineResult(r, payload, input, inst);
4756
+ handleRefineResult(r, payload, input2, inst);
4755
4757
  return;
4756
4758
  };
4757
4759
  });
4758
- function handleRefineResult(result, payload, input, inst) {
4760
+ function handleRefineResult(result, payload, input2, inst) {
4759
4761
  if (!result) {
4760
4762
  const _iss = {
4761
4763
  code: "custom",
4762
- input,
4764
+ input: input2,
4763
4765
  inst,
4764
4766
  // incorporates params.error into issue reporting
4765
4767
  path: [...inst._zod.def.path ?? []],
@@ -8046,8 +8048,8 @@ function ko_default() {
8046
8048
  }
8047
8049
 
8048
8050
  // ../../../node_modules/zod/v4/locales/lt.js
8049
- var capitalizeFirstCharacter = (text4) => {
8050
- return text4.charAt(0).toUpperCase() + text4.slice(1);
8051
+ var capitalizeFirstCharacter = (text5) => {
8052
+ return text5.charAt(0).toUpperCase() + text5.slice(1);
8051
8053
  };
8052
8054
  function getUnitTypeFromNumber(number4) {
8053
8055
  const abs = Math.abs(number4);
@@ -11447,23 +11449,23 @@ function _overwrite(tx) {
11447
11449
  }
11448
11450
  // @__NO_SIDE_EFFECTS__
11449
11451
  function _normalize(form) {
11450
- return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
11452
+ return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
11451
11453
  }
11452
11454
  // @__NO_SIDE_EFFECTS__
11453
11455
  function _trim() {
11454
- return /* @__PURE__ */ _overwrite((input) => input.trim());
11456
+ return /* @__PURE__ */ _overwrite((input2) => input2.trim());
11455
11457
  }
11456
11458
  // @__NO_SIDE_EFFECTS__
11457
11459
  function _toLowerCase() {
11458
- return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
11460
+ return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
11459
11461
  }
11460
11462
  // @__NO_SIDE_EFFECTS__
11461
11463
  function _toUpperCase() {
11462
- return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
11464
+ return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
11463
11465
  }
11464
11466
  // @__NO_SIDE_EFFECTS__
11465
11467
  function _slugify() {
11466
- return /* @__PURE__ */ _overwrite((input) => slugify(input));
11468
+ return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
11467
11469
  }
11468
11470
  // @__NO_SIDE_EFFECTS__
11469
11471
  function _array(Class2, element, params) {
@@ -11768,8 +11770,8 @@ function _stringbool(Classes, _params) {
11768
11770
  type: "pipe",
11769
11771
  in: stringSchema,
11770
11772
  out: booleanSchema,
11771
- transform: ((input, payload) => {
11772
- let data = input;
11773
+ transform: ((input2, payload) => {
11774
+ let data = input2;
11773
11775
  if (params.case !== "sensitive")
11774
11776
  data = data.toLowerCase();
11775
11777
  if (truthySet.has(data)) {
@@ -11788,8 +11790,8 @@ function _stringbool(Classes, _params) {
11788
11790
  return {};
11789
11791
  }
11790
11792
  }),
11791
- reverseTransform: ((input, _payload) => {
11792
- if (input === true) {
11793
+ reverseTransform: ((input2, _payload) => {
11794
+ if (input2 === true) {
11793
11795
  return truthyArray[0] || "true";
11794
11796
  } else {
11795
11797
  return falsyArray[0] || "false";
@@ -12685,9 +12687,9 @@ var allProcessors = {
12685
12687
  optional: optionalProcessor,
12686
12688
  lazy: lazyProcessor
12687
12689
  };
12688
- function toJSONSchema(input, params) {
12689
- if ("_idmap" in input) {
12690
- const registry2 = input;
12690
+ function toJSONSchema(input2, params) {
12691
+ if ("_idmap" in input2) {
12692
+ const registry2 = input2;
12691
12693
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
12692
12694
  const defs = {};
12693
12695
  for (const entry of registry2._idmap.entries()) {
@@ -12715,9 +12717,9 @@ function toJSONSchema(input, params) {
12715
12717
  return { schemas };
12716
12718
  }
12717
12719
  const ctx = initializeContext({ ...params, processors: allProcessors });
12718
- process2(input, ctx);
12719
- extractDefs(ctx, input);
12720
- return finalize(ctx, input);
12720
+ process2(input2, ctx);
12721
+ extractDefs(ctx, input2);
12722
+ return finalize(ctx, input2);
12721
12723
  }
12722
12724
 
12723
12725
  // ../../../node_modules/zod/v4/core/json-schema-generator.js
@@ -14994,7 +14996,7 @@ var codexhostErrorSchema = external_exports.strictObject({
14994
14996
 
14995
14997
  // ../../shared-contracts/dist/harness-presentation.js
14996
14998
  var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14997
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text4) => text4.trim().length > 0);
14999
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text5) => text5.trim().length > 0);
14998
15000
  var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14999
15001
  label: displayText(256).optional(),
15000
15002
  description: displayText(1024).optional()
@@ -15083,7 +15085,7 @@ var usageMeasurementsSchema = external_exports.object({
15083
15085
  outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15084
15086
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15085
15087
  }).strict();
15086
- var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text4) => text4.length <= maximum));
15088
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text5) => text5.length <= maximum));
15087
15089
  var composerIndicatorsSchema = external_exports.array(external_exports.object({
15088
15090
  kind: external_exports.literal("countdown"),
15089
15091
  id: external_exports.string().min(1).max(64),
@@ -15466,6 +15468,8 @@ var externalThreadInspectionSchema = external_exports.object({
15466
15468
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15467
15469
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15468
15470
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15471
+ /** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
15472
+ catalog: harnessModelCatalogSchema.optional(),
15469
15473
  history: harnessHistoryCapabilitiesSchema,
15470
15474
  usage: threadUsageSnapshotSchema.optional(),
15471
15475
  locked: external_exports.literal(true)
@@ -15524,9 +15528,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
15524
15528
  }).strict();
15525
15529
  var threadSteeringContextSchema = external_exports.object({
15526
15530
  kind: external_exports.literal("application"),
15527
- value: external_exports.string().transform((text4, context) => {
15531
+ value: external_exports.string().transform((text5, context) => {
15528
15532
  try {
15529
- return JSON.parse(text4);
15533
+ return JSON.parse(text5);
15530
15534
  } catch {
15531
15535
  context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15532
15536
  return external_exports.NEVER;
@@ -15661,8 +15665,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
15661
15665
  const { username, password } = new URL(value);
15662
15666
  return !username && !password && !/[\\\s]/u.test(value);
15663
15667
  }, "URL must not contain credentials, backslashes, or whitespace");
15664
- function localizedText(text4) {
15665
- return external_exports.strictObject({ en: text4, "zh-CN": text4 });
15668
+ function localizedText(text5) {
15669
+ return external_exports.strictObject({ en: text5, "zh-CN": text5 });
15666
15670
  }
15667
15671
  var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15668
15672
  var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
@@ -15779,8 +15783,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
15779
15783
  function isGitHubDesktopExtensionZipballUrl(url2) {
15780
15784
  return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15781
15785
  }
15782
- var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15783
- const url2 = new URL(input);
15786
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
15787
+ const url2 = new URL(input2);
15784
15788
  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);
15785
15789
  }, "Expected a .zip download URL or a GitHub zipball URL");
15786
15790
  var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
@@ -16131,6 +16135,8 @@ var CLIENT_CHANNEL_METHODS = [
16131
16135
  "codexhost/workspace/read",
16132
16136
  "codexhost/thread/tree/read",
16133
16137
  "codexhost/thread/pins/list",
16138
+ "codexhost/thread/sections/list",
16139
+ "codexhost/thread/sections/move",
16134
16140
  "codexhost/thread/pins/set",
16135
16141
  "codexhost/harness/plugins/list",
16136
16142
  "codexhost/harness/inspect",
@@ -16169,8 +16175,21 @@ var CLIENT_CHANNEL_METHODS = [
16169
16175
  "codexhost/update/check",
16170
16176
  "codexhost/update/start",
16171
16177
  "codexhost/update/status",
16178
+ "codexhost/announcement/get",
16179
+ "codexhost/announcement/acknowledge",
16172
16180
  "codexhost/sessions/loaded/list"
16173
16181
  ];
16182
+ var clientThreadSectionsSchema = external_exports.object({
16183
+ sections: external_exports.array(external_exports.object({
16184
+ id: external_exports.string().min(1),
16185
+ name: external_exports.string().min(1),
16186
+ threads: external_exports.array(jsonObjectSchema)
16187
+ }).strict())
16188
+ }).strict();
16189
+ var clientThreadSectionMoveSchema = external_exports.object({
16190
+ threadId: external_exports.string().min(1).max(1024),
16191
+ sectionId: external_exports.string().min(1).max(1024).nullable()
16192
+ }).strict();
16174
16193
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
16175
16194
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
16176
16195
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -16712,8 +16731,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
16712
16731
  operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
16713
16732
  initializeOnly: external_exports.boolean().optional(),
16714
16733
  expectedRevision: external_exports.number().int().nonnegative().optional()
16715
- }).superRefine((input, ctx) => {
16716
- for (const operation of input.operations) {
16734
+ }).superRefine((input2, ctx) => {
16735
+ for (const operation of input2.operations) {
16717
16736
  if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
16718
16737
  ctx.addIssue({
16719
16738
  code: "custom",
@@ -17115,13 +17134,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
17115
17134
  // ../../shared-contracts/dist/harness-installation.js
17116
17135
  var harnessInstallationParamsSchema = external_exports.object({
17117
17136
  harnessId: harnessIdSchema,
17118
- action: external_exports.enum(["check", "update", "install"])
17119
- }).strict();
17137
+ action: external_exports.enum(["check", "update", "install"]),
17138
+ confirmedVersion: external_exports.string().min(1).max(128).optional()
17139
+ }).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
17120
17140
  var harnessInstallationStateSchema = external_exports.object({
17121
17141
  currentVersion: external_exports.string().min(1).max(128),
17122
17142
  latestVersion: external_exports.string().min(1).max(128),
17123
17143
  updateAvailable: external_exports.boolean(),
17124
17144
  canUpdate: external_exports.boolean(),
17145
+ /** Present when the Adapter has a verified list and the available target is outside it. */
17146
+ latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
17147
+ /** Update preflight stopped before running the installer; latestVersion needs confirmation. */
17148
+ confirmationRequired: external_exports.literal(true).optional(),
17125
17149
  /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
17126
17150
  versionKind: external_exports.enum(["cli", "application"]).optional(),
17127
17151
  /** Official download opened by the user; does not imply an automatic installation. */
@@ -17451,6 +17475,38 @@ var updateStatusResultSchema = external_exports.strictObject({
17451
17475
  status: updateStatusSchema.nullable()
17452
17476
  });
17453
17477
 
17478
+ // ../../shared-contracts/dist/release-announcement.js
17479
+ var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
17480
+ var releaseAnnouncementThemeSchema = external_exports.strictObject({
17481
+ icon: external_exports.string().min(1).max(16).optional(),
17482
+ title: external_exports.string().min(1).max(120),
17483
+ body: external_exports.string().min(1).max(1200),
17484
+ contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
17485
+ });
17486
+ var releaseAnnouncementContentSchema = external_exports.strictObject({
17487
+ summary: external_exports.string().min(1).max(600).optional(),
17488
+ themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
17489
+ });
17490
+ var releaseAnnouncementSchema = external_exports.strictObject({
17491
+ version: updateSemanticVersionSchema,
17492
+ publishedAt: external_exports.iso.datetime(),
17493
+ url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
17494
+ zh: releaseAnnouncementContentSchema.nullable(),
17495
+ en: releaseAnnouncementContentSchema.nullable()
17496
+ }).refine((value) => value.zh !== null || value.en !== null, {
17497
+ message: "an announcement needs at least one language"
17498
+ });
17499
+ var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
17500
+ manual: external_exports.boolean().optional()
17501
+ });
17502
+ var releaseAnnouncementGetResultSchema = external_exports.strictObject({
17503
+ announcement: releaseAnnouncementSchema.nullable(),
17504
+ unread: external_exports.boolean()
17505
+ });
17506
+ var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
17507
+ version: updateSemanticVersionSchema
17508
+ });
17509
+
17454
17510
  // ../../shared-contracts/dist/thread-watch-notice.js
17455
17511
  var THREAD_WATCH_NOTICE_OUTCOMES = [
17456
17512
  "completed",
@@ -17498,17 +17554,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
17498
17554
 
17499
17555
  // ../../shared-contracts/dist/remote-sessions.js
17500
17556
  var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
17501
- var identity = external_exports.string().min(1).max(1024);
17557
+ var REMOTE_IDENTITY_MAX_LENGTH = 1024;
17558
+ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
17502
17559
  var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17503
17560
  var thread = { ...target, threadId: identity };
17561
+ var text = external_exports.string().min(1).max(8e3);
17562
+ var input = { text, requestId: identity };
17563
+ var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
17564
+ external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
17565
+ external_exports.object({
17566
+ accepted: external_exports.literal(false),
17567
+ code: external_exports.enum([
17568
+ "remote/queue-unavailable",
17569
+ "remote/steer-unavailable",
17570
+ "remote/turn-changed",
17571
+ "remote/send-rejected",
17572
+ "session/queue-item-not-found",
17573
+ "session/queue-item-starting"
17574
+ ]),
17575
+ message: external_exports.string()
17576
+ })
17577
+ ]);
17578
+ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
17579
+ external_exports.object({ available: external_exports.literal(false) }),
17580
+ external_exports.object({
17581
+ available: external_exports.literal(true),
17582
+ items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
17583
+ })
17584
+ ]);
17504
17585
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17505
17586
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17587
+ external_exports.strictObject({
17588
+ kind: external_exports.literal("create"),
17589
+ ...target,
17590
+ cwd: external_exports.string().min(1).max(8192),
17591
+ epoch: identity
17592
+ }),
17593
+ external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
17594
+ external_exports.strictObject({
17595
+ kind: external_exports.literal("inspectHarness"),
17596
+ ...target,
17597
+ epoch: identity,
17598
+ cwd: external_exports.string().min(1).max(8192),
17599
+ harnessId: identity
17600
+ }),
17601
+ external_exports.strictObject({
17602
+ kind: external_exports.literal("startSelected"),
17603
+ ...target,
17604
+ epoch: identity,
17605
+ cwd: external_exports.string().min(1).max(8192),
17606
+ harnessId: identity,
17607
+ model: external_exports.string().min(1).max(4096),
17608
+ serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
17609
+ reasoningEffort: identity.optional()
17610
+ }),
17506
17611
  external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17507
17612
  external_exports.strictObject({
17508
17613
  kind: external_exports.literal("list"),
17509
17614
  ...target,
17510
17615
  cursor: external_exports.string().nullable(),
17511
- archived: external_exports.boolean()
17616
+ archived: external_exports.boolean(),
17617
+ includeLoaded: external_exports.literal(true).optional()
17512
17618
  }),
17513
17619
  external_exports.strictObject({
17514
17620
  kind: external_exports.literal("read"),
@@ -17538,9 +17644,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17538
17644
  kind: external_exports.literal("prompt"),
17539
17645
  ...thread,
17540
17646
  epoch: identity,
17541
- text: external_exports.string().min(1).max(8e3),
17647
+ text,
17542
17648
  requestId: identity.optional()
17543
17649
  }),
17650
+ external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
17651
+ external_exports.strictObject({
17652
+ kind: external_exports.literal("delivery"),
17653
+ ...thread,
17654
+ epoch: identity,
17655
+ action: external_exports.discriminatedUnion("kind", [
17656
+ external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
17657
+ external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
17658
+ external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
17659
+ external_exports.strictObject({
17660
+ kind: external_exports.literal("start"),
17661
+ itemId: identity,
17662
+ onlyIfHead: external_exports.literal(true).optional()
17663
+ })
17664
+ ])
17665
+ }),
17544
17666
  external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
17545
17667
  external_exports.strictObject({
17546
17668
  kind: external_exports.literal("rename"),
@@ -18046,8 +18168,8 @@ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
18046
18168
  const descriptor = catalog.commands.find(({ id: id2 }) => id2 === commandId);
18047
18169
  if (!descriptor)
18048
18170
  return null;
18049
- const text4 = typeof argumentText === "string" ? argumentText.trim() : "";
18050
- return text4 ? `${descriptor.invocation} ${text4}` : descriptor.invocation;
18171
+ const text5 = typeof argumentText === "string" ? argumentText.trim() : "";
18172
+ return text5 ? `${descriptor.invocation} ${text5}` : descriptor.invocation;
18051
18173
  }
18052
18174
  function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
18053
18175
  if (!live)
@@ -18087,9 +18209,9 @@ function subagentConfiguration(value) {
18087
18209
  if (typeof value !== "object" || value === null || Array.isArray(value))
18088
18210
  return {};
18089
18211
  const row = value;
18090
- const text4 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
18091
- const model2 = row.model === "inherit" ? void 0 : text4(row.model);
18092
- const reasoningEffort = text4(row.reasoningEffort) ?? text4(row.reasoning_effort) ?? text4(row.thinking);
18212
+ const text5 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
18213
+ const model2 = row.model === "inherit" ? void 0 : text5(row.model);
18214
+ const reasoningEffort = text5(row.reasoningEffort) ?? text5(row.reasoning_effort) ?? text5(row.thinking);
18093
18215
  return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
18094
18216
  }
18095
18217
  function inheritSubagentConfiguration(child, parent) {
@@ -18305,15 +18427,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
18305
18427
  return normalized;
18306
18428
  return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
18307
18429
  }
18308
- function sessionImportCandidate(input) {
18309
- const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
18430
+ function sessionImportCandidate(input2) {
18431
+ const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
18310
18432
  const parsed = harnessSessionImportCandidateSchema.safeParse({
18311
- nativeSessionId: input.nativeSessionId,
18312
- cwd: input.cwd,
18313
- title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
18433
+ nativeSessionId: input2.nativeSessionId,
18434
+ cwd: input2.cwd,
18435
+ title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
18314
18436
  updatedAt: Math.floor(time3),
18315
18437
  // Unknown must stay unknown; only an explicit boolean is a native statement.
18316
- running: typeof input.running === "boolean" ? input.running : null
18438
+ running: typeof input2.running === "boolean" ? input2.running : null
18317
18439
  });
18318
18440
  return parsed.success ? parsed.data : null;
18319
18441
  }
@@ -18450,8 +18572,8 @@ async function readCandidate(file2, signal) {
18450
18572
  const message3 = isRecord2(entry.message) ? entry.message : null;
18451
18573
  if (!firstMessage && entry.type === "message" && message3?.role === "user") {
18452
18574
  const content = message3.content;
18453
- const text4 = typeof content === "string" ? content : Array.isArray(content) ? content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(" ") : "";
18454
- firstMessage = sessionImportTitle(text4);
18575
+ const text5 = typeof content === "string" ? content : Array.isArray(content) ? content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(" ") : "";
18576
+ firstMessage = sessionImportTitle(text5);
18455
18577
  }
18456
18578
  hasUser = entry.type === "message" && message3?.role === "user" || typeof entry.parentId === "string" && entries.get(entry.parentId) === true;
18457
18579
  entries.set(entry.id, hasUser);
@@ -19096,9 +19218,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
19096
19218
  } }));
19097
19219
  }
19098
19220
  }
19099
- function splitLines(text4) {
19100
- const hasTrailingNl = text4.endsWith("\n");
19101
- const result = text4.split("\n").map((line) => line + "\n");
19221
+ function splitLines(text5) {
19222
+ const hasTrailingNl = text5.endsWith("\n");
19223
+ const result = text5.split("\n").map((line) => line + "\n");
19102
19224
  if (hasTrailingNl) {
19103
19225
  result.pop();
19104
19226
  } else {
@@ -19480,7 +19602,7 @@ var STATUSES = {
19480
19602
  function isRecord4(value) {
19481
19603
  return typeof value === "object" && value !== null && !Array.isArray(value);
19482
19604
  }
19483
- function text(value, limit = 2048) {
19605
+ function text2(value, limit = 2048) {
19484
19606
  return typeof value === "string" && value.length > 0 && value.length <= limit;
19485
19607
  }
19486
19608
  function gotgenesId(id2) {
@@ -19490,12 +19612,12 @@ function parseGotgenesId(value) {
19490
19612
  if (!value.startsWith(PREFIX))
19491
19613
  return null;
19492
19614
  const id2 = Buffer.from(value.slice(PREFIX.length), "base64url").toString("utf8");
19493
- if (!text(id2, 256) || /[\s/\\]/u.test(id2) || gotgenesId(id2) !== value)
19615
+ if (!text2(id2, 256) || /[\s/\\]/u.test(id2) || gotgenesId(id2) !== value)
19494
19616
  throw new Error("Invalid gotgenes subagent identity");
19495
19617
  return id2;
19496
19618
  }
19497
19619
  function gotgenesRecord(value) {
19498
- if (!isRecord4(value) || !text(value.id, 256) || /[\s/\\]/u.test(value.id) || !text(value.type) || !text(value.description) || typeof value.status !== "string" || !Object.hasOwn(STATUSES, value.status))
19620
+ if (!isRecord4(value) || !text2(value.id, 256) || /[\s/\\]/u.test(value.id) || !text2(value.type) || !text2(value.description) || typeof value.status !== "string" || !Object.hasOwn(STATUSES, value.status))
19499
19621
  return null;
19500
19622
  const status = STATUSES[value.status];
19501
19623
  if (!status)
@@ -19515,10 +19637,10 @@ function gotgenesRecord(value) {
19515
19637
  status,
19516
19638
  background: value.isBackground === true,
19517
19639
  ...subagentConfiguration(value),
19518
- ...text(value.modelName) ? { model: value.modelName } : {},
19640
+ ...text2(value.modelName) ? { model: value.modelName } : {},
19519
19641
  ...result ? { resultSummary: result.slice(0, 2048) } : {}
19520
19642
  },
19521
- ...text(value.outputFile, 8192) ? { outputFile: value.outputFile } : {},
19643
+ ...text2(value.outputFile, 8192) ? { outputFile: value.outputFile } : {},
19522
19644
  revision: JSON.stringify([
19523
19645
  value.toolUses,
19524
19646
  value.turnBudget,
@@ -19531,13 +19653,13 @@ function gotgenesToolRecord(toolName, result) {
19531
19653
  if (!["subagent", "get_subagent_result"].includes(toolName) || !isRecord4(result) || !isRecord4(result.details))
19532
19654
  return null;
19533
19655
  const d = result.details;
19534
- if (!text(d.agentId, 256) || !text(d.displayName) || !text(d.description))
19656
+ if (!text2(d.agentId, 256) || !text2(d.displayName) || !text2(d.description))
19535
19657
  return null;
19536
19658
  return gotgenesRecord({
19537
19659
  ...d,
19538
19660
  id: d.agentId,
19539
19661
  type: d.subagentType ?? d.displayName,
19540
- roleKnown: text(d.subagentType),
19662
+ roleKnown: text2(d.subagentType),
19541
19663
  isBackground: toolName === "subagent" ? d.status === "background" || Array.isArray(d.tags) && d.tags.includes("background") : void 0,
19542
19664
  outputFile: d.transcriptPath,
19543
19665
  result: d.preview
@@ -19684,7 +19806,7 @@ var STATES = {
19684
19806
  function record3(value) {
19685
19807
  return typeof value === "object" && value !== null && !Array.isArray(value);
19686
19808
  }
19687
- function text2(value, limit = 256) {
19809
+ function text3(value, limit = 256) {
19688
19810
  return typeof value === "string" && value.length > 0 && value.length <= limit;
19689
19811
  }
19690
19812
  function piWorkflowSummary(result) {
@@ -19692,15 +19814,15 @@ function piWorkflowSummary(result) {
19692
19814
  return null;
19693
19815
  const details = result.details;
19694
19816
  const summary = details.workflowChildren;
19695
- if (!record3(summary) || summary.version !== 1 || !text2(summary.workflowRunId) || summary.workflowRunId !== details.runId || !text2(summary.parentToolCallId) || typeof summary.inventoryComplete !== "boolean" || !Array.isArray(summary.children) || summary.children.length > 256)
19817
+ if (!record3(summary) || summary.version !== 1 || !text3(summary.workflowRunId) || summary.workflowRunId !== details.runId || !text3(summary.parentToolCallId) || typeof summary.inventoryComplete !== "boolean" || !Array.isArray(summary.children) || summary.children.length > 256)
19696
19818
  return null;
19697
19819
  const children = [];
19698
19820
  const seen = /* @__PURE__ */ new Set();
19699
19821
  for (const child of summary.children) {
19700
- if (!record3(child) || !text2(child.childId) || seen.has(child.childId) || typeof child.state !== "string" || !Object.hasOwn(STATES, child.state))
19822
+ if (!record3(child) || !text3(child.childId) || seen.has(child.childId) || typeof child.state !== "string" || !Object.hasOwn(STATES, child.state))
19701
19823
  return null;
19702
19824
  for (const key of ["agent", "sessionName", "model", "thinking"]) {
19703
- if (child[key] !== void 0 && !text2(child[key], 2048))
19825
+ if (child[key] !== void 0 && !text3(child[key], 2048))
19704
19826
  return null;
19705
19827
  }
19706
19828
  const mappedState = STATES[child.state];
@@ -19732,7 +19854,7 @@ function parsePiWorkflowSubagentId(id2) {
19732
19854
  if (id2.length > 3e3)
19733
19855
  throw new Error("Invalid Pi workflow child identity");
19734
19856
  const value = JSON.parse(Buffer.from(id2.slice(PREFIX2.length), "base64url").toString("utf8"));
19735
- if (!Array.isArray(value) || value.length !== 2 || !text2(value[0]) || !text2(value[1]))
19857
+ if (!Array.isArray(value) || value.length !== 2 || !text3(value[0]) || !text3(value[1]))
19736
19858
  throw new Error("Invalid Pi workflow child identity");
19737
19859
  const address = { workflowRunId: value[0], childId: value[1] };
19738
19860
  if (piWorkflowSubagentId(address) !== id2)
@@ -20064,11 +20186,11 @@ ${entry.text}`);
20064
20186
  formatVersion: 1
20065
20187
  }),
20066
20188
  input: reply.task ? [{ type: "text", text: reply.task }] : [],
20067
- items: texts.map((text4, index) => ({
20189
+ items: texts.map((text5, index) => ({
20068
20190
  item: {
20069
20191
  type: "agentMessage",
20070
- text: text4,
20071
- itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id2}:${index}:${text4}`).digest("hex")}`)
20192
+ text: text5,
20193
+ itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id2}:${index}:${text5}`).digest("hex")}`)
20072
20194
  },
20073
20195
  outcome: { status: "succeeded" }
20074
20196
  })),
@@ -20338,13 +20460,13 @@ function textContent(content) {
20338
20460
  return "";
20339
20461
  return content.filter((part) => record5(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
20340
20462
  }
20341
- function boundedPiProgress(text4) {
20463
+ function boundedPiProgress(text5) {
20342
20464
  const limit = 64e3;
20343
- return text4.length <= limit ? text4 : `${text4.slice(0, limit)}
20465
+ return text5.length <= limit ? text5 : `${text5.slice(0, limit)}
20344
20466
  [Pi notification truncated]`;
20345
20467
  }
20346
- function visibleText(text4) {
20347
- return text4.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
20468
+ function visibleText(text5) {
20469
+ return text5.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
20348
20470
  }
20349
20471
  function noticeDisplay(value, fallback) {
20350
20472
  if (!record5(value) || !record5(value.details) || typeof value.details.summary !== "string")
@@ -20365,10 +20487,10 @@ function noticeDisplay(value, fallback) {
20365
20487
  function piCustomNoticeKey(value) {
20366
20488
  if (!record5(value) || value.type !== "custom_message" && value.role !== "custom" || value.display !== true || typeof value.customType !== "string")
20367
20489
  return null;
20368
- const text4 = textContent(value.content);
20369
- if (text4.trim().length === 0)
20490
+ const text5 = textContent(value.content);
20491
+ if (text5.trim().length === 0)
20370
20492
  return null;
20371
- return JSON.stringify([value.customType, text4]);
20493
+ return JSON.stringify([value.customType, text5]);
20372
20494
  }
20373
20495
  function piCustomNotice(value, sessionId, occurrences) {
20374
20496
  const key = piCustomNoticeKey(value);
@@ -20377,13 +20499,13 @@ function piCustomNotice(value, sessionId, occurrences) {
20377
20499
  const occurrence = occurrences.get(key) ?? 0;
20378
20500
  occurrences.set(key, occurrence + 1);
20379
20501
  const digest = createHash5("sha256").update(JSON.stringify([sessionId, key, occurrence])).digest("hex");
20380
- const [customType, text4] = JSON.parse(key);
20502
+ const [customType, text5] = JSON.parse(key);
20381
20503
  return {
20382
20504
  type: "progress.message",
20383
20505
  itemId: hostItemIdSchema.parse(`pi-notice-v1-${digest}`),
20384
20506
  text: boundedPiProgress(`Pi notification (${visibleText(customType)})
20385
20507
 
20386
- ${noticeDisplay(value, text4)}`)
20508
+ ${noticeDisplay(value, text5)}`)
20387
20509
  };
20388
20510
  }
20389
20511
  function piHistoryNotices(sessionId, entries) {
@@ -20544,8 +20666,8 @@ function itemOutcome(outcome) {
20544
20666
  return { status: "succeeded" };
20545
20667
  }
20546
20668
  function toolOutput(value) {
20547
- const text4 = textContent2(value);
20548
- return text4.length > 0 ? { content: [{ type: "text", text: text4 }] } : void 0;
20669
+ const text5 = textContent2(value);
20670
+ return text5.length > 0 ? { content: [{ type: "text", text: text5 }] } : void 0;
20549
20671
  }
20550
20672
  function historicalFileChanges(call, nativeMessage, toolItemId, cwd) {
20551
20673
  const items = [];
@@ -20598,7 +20720,7 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
20598
20720
  continue;
20599
20721
  const content = Array.isArray(nativeMessage.content) ? nativeMessage.content : [];
20600
20722
  if (nativeMessage.role === "assistant") {
20601
- const text4 = textContent2(content);
20723
+ const text5 = textContent2(content);
20602
20724
  const reasoning = thinkingContent(content);
20603
20725
  let projectedText = false;
20604
20726
  let projectedReasoning = false;
@@ -20615,12 +20737,12 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
20615
20737
  projectedReasoning = true;
20616
20738
  continue;
20617
20739
  }
20618
- if (part.type === "text" && !projectedText && text4.length > 0) {
20740
+ if (part.type === "text" && !projectedText && text5.length > 0) {
20619
20741
  const phase = piAssistantPhase(nativeMessage);
20620
20742
  const item2 = {
20621
20743
  type: "agentMessage",
20622
20744
  itemId: piMessageItemId(messageIdentities.get(entry.id), "assistant") ?? itemId(entry.id, "assistant", 0),
20623
- text: text4,
20745
+ text: text5,
20624
20746
  ...phase ? { phase } : {}
20625
20747
  };
20626
20748
  snapshots.push({ item: item2, outcome: itemOutcome(outcome) });
@@ -20815,12 +20937,12 @@ function nonNegativeSafeInteger(value) {
20815
20937
  function optionalPiCacheHitRatePercent(value) {
20816
20938
  if (!isRecord6(value) || value.role !== "assistant" || !isRecord6(value.usage))
20817
20939
  return null;
20818
- const input = nonNegativeSafeInteger(value.usage.input);
20940
+ const input2 = nonNegativeSafeInteger(value.usage.input);
20819
20941
  const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
20820
20942
  const cacheWrite = nonNegativeSafeInteger(value.usage.cacheWrite);
20821
- if (input === null || cacheRead === null || cacheWrite === null)
20943
+ if (input2 === null || cacheRead === null || cacheWrite === null)
20822
20944
  return null;
20823
- const promptTokens = input + cacheRead + cacheWrite;
20945
+ const promptTokens = input2 + cacheRead + cacheWrite;
20824
20946
  return promptTokens > 0 ? cacheRead / promptTokens * 100 : null;
20825
20947
  }
20826
20948
  function latestPiCacheHitRatePercent(history) {
@@ -20852,12 +20974,12 @@ function parsePiSessionUsage(response) {
20852
20974
  if (tokens !== void 0 && !isRecord6(tokens)) {
20853
20975
  throw new Error("Pi RPC Session stats tokens are invalid");
20854
20976
  }
20855
- const input = isRecord6(tokens) ? nonNegativeSafeInteger(tokens.input) : null;
20977
+ const input2 = isRecord6(tokens) ? nonNegativeSafeInteger(tokens.input) : null;
20856
20978
  const cacheRead = isRecord6(tokens) ? nonNegativeSafeInteger(tokens.cacheRead) : null;
20857
20979
  const cacheWrite = isRecord6(tokens) ? nonNegativeSafeInteger(tokens.cacheWrite) : null;
20858
20980
  return parseHostUsage({
20859
20981
  ...isRecord6(tokens) && tokens.input !== void 0 ? {
20860
- inputTokens: input === null ? tokens.input : input + (cacheRead ?? 0) + (cacheWrite ?? 0)
20982
+ inputTokens: input2 === null ? tokens.input : input2 + (cacheRead ?? 0) + (cacheWrite ?? 0)
20861
20983
  } : {},
20862
20984
  ...isRecord6(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
20863
20985
  ...isRecord6(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
@@ -20884,10 +21006,10 @@ function piUsageRecord(message3, extra = {}) {
20884
21006
  if (!isRecord6(message3) || message3.role !== "assistant")
20885
21007
  return null;
20886
21008
  const usage = isRecord6(message3.usage) ? message3.usage : null;
20887
- const input = nonNegativeSafeInteger(usage?.input);
21009
+ const input2 = nonNegativeSafeInteger(usage?.input);
20888
21010
  const output = nonNegativeSafeInteger(usage?.output);
20889
21011
  const requestId = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
20890
- if (!usage || input === null || output === null || requestId === null) {
21012
+ if (!usage || input2 === null || output === null || requestId === null) {
20891
21013
  return { kind: "missing" };
20892
21014
  }
20893
21015
  const cacheRead = nonNegativeSafeInteger(usage.cacheRead);
@@ -20902,7 +21024,7 @@ function piUsageRecord(message3, extra = {}) {
20902
21024
  ...extra.historical ? { historical: true } : {},
20903
21025
  // Pi's provider is a user-configurable name, not a standard provider ID.
20904
21026
  ...typeof message3.model === "string" && message3.model.length > 0 ? { model: message3.model } : {},
20905
- inputTokens: input + (cacheRead ?? 0) + (cacheWrite ?? 0),
21027
+ inputTokens: input2 + (cacheRead ?? 0) + (cacheWrite ?? 0),
20906
21028
  ...cacheRead !== null ? { cachedInputTokens: cacheRead } : {},
20907
21029
  ...cacheWrite !== null ? { cacheWriteInputTokens: cacheWrite } : {},
20908
21030
  outputTokens: output,
@@ -21097,14 +21219,14 @@ async function fetchSub2ApiBalance(provider, fetchImpl, signal) {
21097
21219
  return null;
21098
21220
  return projectSub2ApiUsage(await response.json(), provider.id);
21099
21221
  }
21100
- async function fetchPiAccounts(input = {}) {
21222
+ async function fetchPiAccounts(input2 = {}) {
21101
21223
  try {
21102
- const environment = input.environment ?? process.env;
21103
- const fetchImpl = input.fetch ?? fetch;
21104
- const signal = input.signal ? AbortSignal.any([input.signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)]) : AbortSignal.timeout(REQUEST_TIMEOUT_MS);
21224
+ const environment = input2.environment ?? process.env;
21225
+ const fetchImpl = input2.fetch ?? fetch;
21226
+ const signal = input2.signal ? AbortSignal.any([input2.signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)]) : AbortSignal.timeout(REQUEST_TIMEOUT_MS);
21105
21227
  const [providers, deepseek] = await Promise.all([
21106
- input.readProviders ? input.readProviders() : configuredSub2ApiProviders(environment),
21107
- fetchPiAccountBalance({ ...input, environment, fetch: fetchImpl, signal })
21228
+ input2.readProviders ? input2.readProviders() : configuredSub2ApiProviders(environment),
21229
+ fetchPiAccountBalance({ ...input2, environment, fetch: fetchImpl, signal })
21108
21230
  ]);
21109
21231
  const wallets = await Promise.all(providers.filter((provider) => provider.apiKey.trim() && usageEndpoint(provider.baseUrl)).map((provider) => fetchSub2ApiBalance(provider, fetchImpl, signal).catch(() => null)));
21110
21232
  return [...wallets, deepseek].filter((account) => account !== null).slice(0, MAX_PI_ACCOUNTS);
@@ -21112,14 +21234,14 @@ async function fetchPiAccounts(input = {}) {
21112
21234
  return [];
21113
21235
  }
21114
21236
  }
21115
- async function fetchPiAccountBalance(input) {
21237
+ async function fetchPiAccountBalance(input2) {
21116
21238
  try {
21117
- const key = await (input.readApiKey ? input.readApiKey() : deepSeekApiKey(input.environment));
21239
+ const key = await (input2.readApiKey ? input2.readApiKey() : deepSeekApiKey(input2.environment));
21118
21240
  if (!key)
21119
21241
  return null;
21120
- const response = await input.fetch(DEEPSEEK_BALANCE_ENDPOINT, {
21242
+ const response = await input2.fetch(DEEPSEEK_BALANCE_ENDPOINT, {
21121
21243
  headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
21122
- signal: input.signal
21244
+ signal: input2.signal
21123
21245
  });
21124
21246
  if (!response.ok)
21125
21247
  return null;
@@ -21160,14 +21282,14 @@ var piDiscoverySpec = {
21160
21282
  windows: ["${APPDATA}/npm", "~/.local/bin", VERSION_MANAGER_ROOTS]
21161
21283
  }
21162
21284
  };
21163
- function resolvePiExecutable(input, dependencies = {}) {
21285
+ function resolvePiExecutable(input2, dependencies = {}) {
21164
21286
  const resolution = resolveHarnessExecutable(piDiscoverySpec, {
21165
- ...input.command ? { command: input.command } : {},
21166
- environment: input.environment,
21287
+ ...input2.command ? { command: input2.command } : {},
21288
+ environment: input2.environment,
21167
21289
  ...dependencies.platform ? { platform: dependencies.platform } : {},
21168
21290
  ...dependencies.homeDirectory ? { homeDirectory: dependencies.homeDirectory } : {}
21169
21291
  }, { ...dependencies.isExecutable ? { isExecutable: dependencies.isExecutable } : {} });
21170
- return resolution?.executable ?? input.command ?? input.environment.PI_COMMAND ?? "pi";
21292
+ return resolution?.executable ?? input2.command ?? input2.environment.PI_COMMAND ?? "pi";
21171
21293
  }
21172
21294
  function findPiPackageDirectory(executable) {
21173
21295
  let directory = path10.dirname(executable);
@@ -21564,16 +21686,16 @@ async function readPiSessionHeader(sessionFile) {
21564
21686
  await handle.close();
21565
21687
  }
21566
21688
  }
21567
- async function verifyPiSessionCwd(input) {
21568
- if (!input.sessionFile)
21689
+ async function verifyPiSessionCwd(input2) {
21690
+ if (!input2.sessionFile)
21569
21691
  throw new Error("Pi Fork Session has no persisted Session file");
21570
- const header = await readPiSessionHeader(input.sessionFile);
21571
- if (header.id !== input.sessionId) {
21692
+ const header = await readPiSessionHeader(input2.sessionFile);
21693
+ if (header.id !== input2.sessionId) {
21572
21694
  throw new Error("Pi Fork Session header identity does not match RPC state");
21573
21695
  }
21574
21696
  const [actualCwd, expectedCwd] = await Promise.all([
21575
21697
  realpath3(header.cwd),
21576
- realpath3(input.expectedCwd)
21698
+ realpath3(input2.expectedCwd)
21577
21699
  ]);
21578
21700
  if (actualCwd !== expectedCwd) {
21579
21701
  throw new Error("Pi Fork Session did not bind the requested cwd");
@@ -21581,8 +21703,8 @@ async function verifyPiSessionCwd(input) {
21581
21703
  }
21582
21704
 
21583
21705
  // dist/pi-empty-session.js
21584
- async function persistEmptyPiSession(input) {
21585
- const { state: state2, history, sourceSessionFile, sourceSessionId, cwd } = input;
21706
+ async function persistEmptyPiSession(input2) {
21707
+ const { state: state2, history, sourceSessionFile, sourceSessionId, cwd } = input2;
21586
21708
  const destination = state2.sessionFile;
21587
21709
  if (!destination || !path12.isAbsolute(destination) || path12.resolve(destination) === path12.resolve(sourceSessionFile) || state2.sessionId === sourceSessionId || mapPiSnapshot(history, { sessionId: state2.sessionId, model: null }).turns.length !== 0)
21588
21710
  throw new Error("Pi empty Session is not an independent empty native fork");
@@ -22042,7 +22164,7 @@ import path15 from "node:path";
22042
22164
  function isWindowsUncDirectory(directory) {
22043
22165
  return /^\\\\(?:\?\\UNC\\)?(?![?.]\\)[^\\]+\\[^\\]+(?:\\|$)/iu.test(path15.win32.normalize(directory));
22044
22166
  }
22045
- function text3(file2) {
22167
+ function text4(file2) {
22046
22168
  try {
22047
22169
  return fs3.readFileSync(file2, "utf8").replace(/^\uFEFF/u, "").replaceAll("\r\n", "\n").trim();
22048
22170
  } catch {
@@ -22110,11 +22232,11 @@ EXIT /B %pi_exit_code%`;
22110
22232
  }
22111
22233
  function piUncNodeInvocation(command, arguments_, environment) {
22112
22234
  const directory = path15.dirname(command);
22113
- const source = text3(command);
22235
+ const source = text4(command);
22114
22236
  if (path15.isAbsolute(command) && path15.win32.basename(command).toLowerCase() === "pi.cmd" && source !== void 0) {
22115
22237
  const packageDirectory = path15.join(directory, "node_modules", "@earendil-works", "pi-coding-agent");
22116
22238
  try {
22117
- const manifest = JSON.parse(text3(path15.join(packageDirectory, "package.json")) ?? "");
22239
+ const manifest = JSON.parse(text4(path15.join(packageDirectory, "package.json")) ?? "");
22118
22240
  if (typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === "@earendil-works/pi-coding-agent") {
22119
22241
  const entry = findPiCliEntry(packageDirectory);
22120
22242
  const target2 = entry && path15.relative(directory, entry).replaceAll("/", "\\");
@@ -22131,7 +22253,7 @@ function piUncNodeInvocation(command, arguments_, environment) {
22131
22253
  }
22132
22254
  const launcher = path15.join(directory, "pi-launcher.js");
22133
22255
  try {
22134
- const marker = JSON.parse(text3(path15.join(path15.dirname(directory), "install", "managed-install.json")) ?? "");
22256
+ const marker = JSON.parse(text4(path15.join(path15.dirname(directory), "install", "managed-install.json")) ?? "");
22135
22257
  if (typeof marker === "object" && marker !== null && "kind" in marker && marker.kind === "pi-managed-install" && "schemaVersion" in marker && marker.schemaVersion === 1 && "layout" in marker && marker.layout === "releases-v1" && "entrypoint" in marker && typeof marker.entrypoint === "object" && marker.entrypoint !== null && "type" in marker.entrypoint && marker.entrypoint.type === "script" && "path" in marker.entrypoint && typeof marker.entrypoint.path === "string" && path15.isAbsolute(marker.entrypoint.path) && path15.resolve(marker.entrypoint.path).toLowerCase() === path15.resolve(command).toLowerCase() && isFile(launcher) && (source === managedShim(false) || source === managedShim(true))) {
22136
22258
  const localAppData = environmentValue(environment, "LOCALAPPDATA");
22137
22259
  const standaloneNode = localAppData ? path15.join(localAppData, "pi-node", "current", "node.exe") : void 0;
@@ -22175,7 +22297,7 @@ var PiContentStream = class {
22175
22297
  }
22176
22298
  finalize(blocks) {
22177
22299
  if (this.#indexed !== true) {
22178
- blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text4 }, index) => ({ index, text: text4 })) : [{ index: 0, text: blocks.map(({ text: text4 }) => text4).join("") }];
22300
+ blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text5 }, index) => ({ index, text: text5 })) : [{ index: 0, text: blocks.map(({ text: text5 }) => text5).join("") }];
22179
22301
  }
22180
22302
  const indices = new Set(blocks.map(({ index }) => index));
22181
22303
  for (const [index, block] of this.#blocks) {
@@ -22185,8 +22307,8 @@ var PiContentStream = class {
22185
22307
  this.#conflict();
22186
22308
  this.#blocks.delete(index);
22187
22309
  }
22188
- for (const { index, text: text4 } of blocks)
22189
- this.#finish(index, text4);
22310
+ for (const { index, text: text5 } of blocks)
22311
+ this.#finish(index, text5);
22190
22312
  return this.#flush();
22191
22313
  }
22192
22314
  #key(index) {
@@ -22477,15 +22599,15 @@ function extractReasoningText(content) {
22477
22599
  return null;
22478
22600
  const type = String(content.type ?? "");
22479
22601
  if (type === "thinking" || type === "reasoning" || type === "thought") {
22480
- const text4 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
22481
- return typeof text4 === "string" ? text4 : null;
22602
+ const text5 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
22603
+ return typeof text5 === "string" ? text5 : null;
22482
22604
  }
22483
22605
  return null;
22484
22606
  }
22485
22607
  function assistantReasoning(value) {
22486
22608
  if (!isRecord9(value) || value.role !== "assistant" || !Array.isArray(value.content))
22487
22609
  return null;
22488
- return value.content.map(extractReasoningText).filter((text4) => typeof text4 === "string").join("");
22610
+ return value.content.map(extractReasoningText).filter((text5) => typeof text5 === "string").join("");
22489
22611
  }
22490
22612
  function assistantFailure(value) {
22491
22613
  if (!isRecord9(value) || value.role !== "assistant")
@@ -22967,13 +23089,13 @@ var PiRpcSession = class {
22967
23089
  throw new PiRpcSteerTargetEndedError(history);
22968
23090
  }
22969
23091
  }
22970
- async runTurn(text4, onEvent) {
23092
+ async runTurn(text5, onEvent) {
22971
23093
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
22972
23094
  throw new Error("Pi RPC Session is unavailable");
22973
23095
  }
22974
23096
  if (this.isBusy)
22975
23097
  throw new PiRpcBusyError();
22976
- if (text4.length === 0)
23098
+ if (text5.length === 0)
22977
23099
  throw new Error("Pi text Turn must not be empty");
22978
23100
  const settled = new Promise((resolve, reject) => {
22979
23101
  this.#activeTurn = {
@@ -23008,7 +23130,7 @@ var PiRpcSession = class {
23008
23130
  });
23009
23131
  try {
23010
23132
  this.#drainProgress(onEvent);
23011
- await this.#send("prompt", { message: text4 });
23133
+ await this.#send("prompt", { message: text5 });
23012
23134
  } catch (error51) {
23013
23135
  this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
23014
23136
  }
@@ -23362,15 +23484,15 @@ var PiRpcSession = class {
23362
23484
  }
23363
23485
  return true;
23364
23486
  }
23365
- const text4 = piStatusText(value);
23366
- if (!text4)
23487
+ const text5 = piStatusText(value);
23488
+ if (!text5)
23367
23489
  return false;
23368
23490
  if (value.type === "extension_ui_request" && typeof value.id === "string" && !this.#acceptNoticeFrame(JSON.stringify([value.type, value.id])))
23369
23491
  return true;
23370
23492
  this.#publishProgress({
23371
23493
  type: "progress.message",
23372
23494
  itemId: hostItemIdSchema.parse(`pi-progress-${randomUUID6()}`),
23373
- text: text4
23495
+ text: text5
23374
23496
  }, value.method === "setStatus" && typeof value.statusKey === "string" ? value.statusKey : void 0);
23375
23497
  return true;
23376
23498
  }
@@ -23775,8 +23897,8 @@ var PiRpcSession = class {
23775
23897
  const content = value.content;
23776
23898
  if (failure === null || !active2.sawStreamedMessageReasoning) {
23777
23899
  this.#emitContent(active2, true, active2.reasoningStream.finalize(content.flatMap((part, index) => {
23778
- const text4 = extractReasoningText(part);
23779
- return text4 === null ? [] : [{ index, text: text4 }];
23900
+ const text5 = extractReasoningText(part);
23901
+ return text5 === null ? [] : [{ index, text: text5 }];
23780
23902
  })));
23781
23903
  }
23782
23904
  if (active2.reasoningMessageOpen && active2.failure === null) {
@@ -24050,20 +24172,20 @@ function nativeText(value) {
24050
24172
  return value;
24051
24173
  if (!isRecord10(value) || !Array.isArray(value.content))
24052
24174
  return "";
24053
- return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text4 }) => text4).join("");
24175
+ return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text5 }) => text5).join("");
24054
24176
  }
24055
24177
  function boundedOutput(value, limit) {
24056
- const text4 = nativeText(value);
24057
- if (text4.length === 0)
24178
+ const text5 = nativeText(value);
24179
+ if (text5.length === 0)
24058
24180
  return void 0;
24059
- const truncated = text4.length > limit;
24181
+ const truncated = text5.length > limit;
24060
24182
  return {
24061
- content: [{ type: "text", text: truncated ? text4.slice(0, limit) : text4 }],
24183
+ content: [{ type: "text", text: truncated ? text5.slice(0, limit) : text5 }],
24062
24184
  ...truncated ? { truncated: true } : {}
24063
24185
  };
24064
24186
  }
24065
24187
  function outputText(output) {
24066
- return output?.content.filter((content) => content.type === "text").map(({ text: text4 }) => text4).join("") ?? "";
24188
+ return output?.content.filter((content) => content.type === "text").map(({ text: text5 }) => text5).join("") ?? "";
24067
24189
  }
24068
24190
  function numberField(value, key) {
24069
24191
  if (!isRecord10(value))
@@ -24257,8 +24379,8 @@ var PiHarnessSession = class {
24257
24379
  }
24258
24380
  };
24259
24381
  }
24260
- const text4 = command.input.map((input) => input.text).join("\n");
24261
- if (text4.length === 0) {
24382
+ const text5 = command.input.map((input2) => input2.text).join("\n");
24383
+ if (text5.length === 0) {
24262
24384
  return {
24263
24385
  ok: false,
24264
24386
  error: {
@@ -24323,7 +24445,7 @@ var PiHarnessSession = class {
24323
24445
  this.#active = active2;
24324
24446
  this.#event({ type: "turn.started", turnId: command.turnId });
24325
24447
  this.#event({ type: "item.started", turnId: command.turnId, item });
24326
- void transport.runTurn(text4, (event) => this.#handleTurnEvent(active2, event)).then(async (result) => {
24448
+ void transport.runTurn(text5, (event) => this.#handleTurnEvent(active2, event)).then(async (result) => {
24327
24449
  active2.settling = true;
24328
24450
  try {
24329
24451
  const identity2 = await this.#completedTurnIdentity(active2, transport);
@@ -24577,8 +24699,8 @@ var PiHarnessSession = class {
24577
24699
  return Boolean(this.#phase === "open" && active2 && !active2.cancellationRequested && active2.acceptingSteers && active2.tools.size > 0 && this.#transport);
24578
24700
  }
24579
24701
  async #steer(command) {
24580
- const text4 = command.input.map((input) => input.text).join("\n");
24581
- if (text4.length === 0) {
24702
+ const text5 = command.input.map((input2) => input2.text).join("\n");
24703
+ if (text5.length === 0) {
24582
24704
  return {
24583
24705
  ok: false,
24584
24706
  error: {
@@ -24595,7 +24717,7 @@ var PiHarnessSession = class {
24595
24717
  }
24596
24718
  let accepted;
24597
24719
  try {
24598
- accepted = transport.steer(text4).then(() => {
24720
+ accepted = transport.steer(text5).then(() => {
24599
24721
  active2.acceptedSteerCount += 1;
24600
24722
  });
24601
24723
  active2.pendingSteers.add(accepted);
@@ -25280,16 +25402,16 @@ var PiHarnessSession = class {
25280
25402
  }
25281
25403
  active2.agentMessageId = messageId;
25282
25404
  }
25283
- #appendText(active2, text4) {
25405
+ #appendText(active2, text5) {
25284
25406
  if (active2.agentMessageId === null || !active2.agentItem) {
25285
25407
  throw new Error("Pi Assistant text arrived outside an active message");
25286
25408
  }
25287
- active2.agentItem = { ...active2.agentItem, text: active2.agentItem.text + text4 };
25409
+ active2.agentItem = { ...active2.agentItem, text: active2.agentItem.text + text5 };
25288
25410
  this.#event({
25289
25411
  type: "item.updated",
25290
25412
  turnId: active2.command.turnId,
25291
25413
  itemId: active2.agentItem.itemId,
25292
- update: { type: "text.append", text: text4 }
25414
+ update: { type: "text.append", text: text5 }
25293
25415
  });
25294
25416
  }
25295
25417
  #completeAgentItem(active2, outcome, completeEmpty) {
@@ -25300,8 +25422,8 @@ var PiHarnessSession = class {
25300
25422
  active2.agentItem = null;
25301
25423
  this.#completeItem(active2, item, outcome);
25302
25424
  }
25303
- #appendReasoning(active2, text4, nativeMessageIdentity2) {
25304
- if (text4.length === 0)
25425
+ #appendReasoning(active2, text5, nativeMessageIdentity2) {
25426
+ if (text5.length === 0)
25305
25427
  return;
25306
25428
  if (!active2.reasoningItem) {
25307
25429
  active2.reasoningItem = {
@@ -25317,13 +25439,13 @@ var PiHarnessSession = class {
25317
25439
  }
25318
25440
  active2.reasoningItem = {
25319
25441
  ...active2.reasoningItem,
25320
- text: active2.reasoningItem.text + text4
25442
+ text: active2.reasoningItem.text + text5
25321
25443
  };
25322
25444
  this.#event({
25323
25445
  type: "item.updated",
25324
25446
  turnId: active2.command.turnId,
25325
25447
  itemId: active2.reasoningItem.itemId,
25326
- update: { type: "text.append", text: text4 }
25448
+ update: { type: "text.append", text: text5 }
25327
25449
  });
25328
25450
  }
25329
25451
  #completeReasoning(active2, outcome) {
@@ -25688,7 +25810,7 @@ var PiAdapter = class {
25688
25810
  const accounts = await this.inspectAccounts();
25689
25811
  return accounts[0] ?? null;
25690
25812
  }
25691
- async inspect(input = {}) {
25813
+ async inspect(input2 = {}) {
25692
25814
  if (this.#closePromise) {
25693
25815
  return {
25694
25816
  status: "unavailable",
@@ -25699,9 +25821,9 @@ var PiAdapter = class {
25699
25821
  }
25700
25822
  };
25701
25823
  }
25702
- const cwd = resolvePiInspectCwd(input.cwd);
25824
+ const cwd = resolvePiInspectCwd(input2.cwd);
25703
25825
  const inFlight = this.#inspectionInFlight.get(cwd);
25704
- if (input.refresh) {
25826
+ if (input2.refresh) {
25705
25827
  this.#inspectionCache.clear();
25706
25828
  this.#inspectionInFlight.clear();
25707
25829
  if (inFlight)
@@ -25771,11 +25893,11 @@ var PiAdapter = class {
25771
25893
  this.#inspections.delete(transport);
25772
25894
  }
25773
25895
  }
25774
- async open(input) {
25896
+ async open(input2) {
25775
25897
  if (this.#closePromise) {
25776
25898
  return { ok: false, error: invalidState("Pi Adapter is closed") };
25777
25899
  }
25778
- if (input.cwd.length === 0) {
25900
+ if (input2.cwd.length === 0) {
25779
25901
  return {
25780
25902
  ok: false,
25781
25903
  error: {
@@ -25785,8 +25907,8 @@ var PiAdapter = class {
25785
25907
  }
25786
25908
  };
25787
25909
  }
25788
- if (input.kind === "create") {
25789
- if (input.permissionModeId) {
25910
+ if (input2.kind === "create") {
25911
+ if (input2.permissionModeId) {
25790
25912
  return {
25791
25913
  ok: false,
25792
25914
  error: {
@@ -25796,8 +25918,8 @@ var PiAdapter = class {
25796
25918
  }
25797
25919
  };
25798
25920
  }
25799
- if (input.model) {
25800
- const parsed = harnessModelRefSchema.safeParse(input.model);
25921
+ if (input2.model) {
25922
+ const parsed = harnessModelRefSchema.safeParse(input2.model);
25801
25923
  if (!parsed.success || parsed.data.serviceTier === "ultrafast") {
25802
25924
  return {
25803
25925
  ok: false,
@@ -25805,7 +25927,7 @@ var PiAdapter = class {
25805
25927
  };
25806
25928
  }
25807
25929
  if (parsed.data.serviceTier === "priority") {
25808
- const inspection = await this.inspect({ cwd: input.cwd });
25930
+ const inspection = await this.inspect({ cwd: input2.cwd });
25809
25931
  if (inspection.status !== "ready" || !inspection.catalog.models.some(({ fastModel }) => sameHarnessModelRef(fastModel, parsed.data))) {
25810
25932
  return {
25811
25933
  ok: false,
@@ -25818,7 +25940,7 @@ var PiAdapter = class {
25818
25940
  }
25819
25941
  }
25820
25942
  }
25821
- const thinkingOptionId = input.thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(input.thinkingOptionId) : null;
25943
+ const thinkingOptionId = input2.thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(input2.thinkingOptionId) : null;
25822
25944
  if (thinkingOptionId && !thinkingOptionId.success) {
25823
25945
  return {
25824
25946
  ok: false,
@@ -25831,15 +25953,15 @@ var PiAdapter = class {
25831
25953
  }
25832
25954
  return {
25833
25955
  ok: true,
25834
- value: this.#trackSession(input.cwd, {
25835
- ...input.environment ? { environment: input.environment } : {},
25836
- ...input.model ? { model: input.model } : {},
25956
+ value: this.#trackSession(input2.cwd, {
25957
+ ...input2.environment ? { environment: input2.environment } : {},
25958
+ ...input2.model ? { model: input2.model } : {},
25837
25959
  ...thinkingOptionId?.success ? { thinkingOptionId: thinkingOptionId.data } : {},
25838
25960
  supportsThinkingSelection: this.#thinkingSelectionSupported === true
25839
25961
  })
25840
25962
  };
25841
25963
  }
25842
- const sourceRef = nativeSessionRefSchema.parse(input.kind === "resume" ? input.nativeRef : input.sourceRef);
25964
+ const sourceRef = nativeSessionRefSchema.parse(input2.kind === "resume" ? input2.nativeRef : input2.sourceRef);
25843
25965
  let session;
25844
25966
  let transport;
25845
25967
  try {
@@ -25854,8 +25976,8 @@ var PiAdapter = class {
25854
25976
  };
25855
25977
  }
25856
25978
  const sourceSessionFile = sessionFileFromRef(sourceRef);
25857
- if (input.kind === "fork") {
25858
- const checkpoint = nativeCheckpointRefSchema.parse(input.checkpoint);
25979
+ if (input2.kind === "fork") {
25980
+ const checkpoint = nativeCheckpointRefSchema.parse(input2.checkpoint);
25859
25981
  if (checkpoint.harnessId !== this.harnessId || checkpoint.nativeSessionId !== sourceRef.nativeSessionId) {
25860
25982
  throw new PiAdapterFaultError({
25861
25983
  code: "checkpointNotFound",
@@ -25864,16 +25986,16 @@ var PiAdapter = class {
25864
25986
  });
25865
25987
  }
25866
25988
  }
25867
- const emptySessionConfiguration = input.kind === "resume" ? await readPiEmptySessionConfiguration(sourceSessionFile) : void 0;
25989
+ const emptySessionConfiguration = input2.kind === "resume" ? await readPiEmptySessionConfiguration(sourceSessionFile) : void 0;
25868
25990
  transport = this.#createTransport({
25869
- cwd: input.cwd,
25870
- ...input.environment ? { environment: input.environment } : {},
25991
+ cwd: input2.cwd,
25992
+ ...input2.environment ? { environment: input2.environment } : {},
25871
25993
  ...emptySessionConfiguration ? { emptySessionConfiguration } : {},
25872
- ...input.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile },
25994
+ ...input2.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile },
25873
25995
  onFault: (error51) => session?.handleTransportFault(error51)
25874
25996
  });
25875
25997
  await transport.start();
25876
- if (input.kind === "resume") {
25998
+ if (input2.kind === "resume") {
25877
25999
  if (transport.state.sessionId !== sourceRef.nativeSessionId) {
25878
26000
  throw new PiAdapterFaultError({
25879
26001
  code: "sessionNotFound",
@@ -25881,8 +26003,8 @@ var PiAdapter = class {
25881
26003
  retryable: false
25882
26004
  });
25883
26005
  }
25884
- } else if (input.kind === "fork") {
25885
- const checkpoint = nativeCheckpointRefSchema.parse(input.checkpoint);
26006
+ } else if (input2.kind === "fork") {
26007
+ const checkpoint = nativeCheckpointRefSchema.parse(input2.checkpoint);
25886
26008
  const startupSessionId = transport.state.sessionId;
25887
26009
  if (startupSessionId === sourceRef.nativeSessionId) {
25888
26010
  throw new Error("Pi Fork startup did not create a distinct Native Session identity");
@@ -25910,9 +26032,9 @@ var PiAdapter = class {
25910
26032
  if (derivedSnapshot.turns.length !== boundary.targetTurnIndex + 1 || terminal?.nativeTurnRef.nativeTurnKey !== checkpoint.checkpointId) {
25911
26033
  throw new Error("Pi Fork derived history does not match the requested Checkpoint");
25912
26034
  }
25913
- await transport.verifySessionCwd(input.cwd);
26035
+ await transport.verifySessionCwd(input2.cwd);
25914
26036
  } else {
25915
- const rolledBack = await rollbackPiLastTurn(transport, sourceRef.nativeSessionId, input.cwd);
26037
+ const rolledBack = await rollbackPiLastTurn(transport, sourceRef.nativeSessionId, input2.cwd);
25916
26038
  if (!rolledBack.ok) {
25917
26039
  throw new PiAdapterFaultError({
25918
26040
  code: rolledBack.reason === "unsupported" ? "unsupported" : "invalidState",
@@ -25929,7 +26051,7 @@ var PiAdapter = class {
25929
26051
  history,
25930
26052
  sourceSessionFile,
25931
26053
  sourceSessionId: sourceRef.nativeSessionId,
25932
- cwd: input.cwd
26054
+ cwd: input2.cwd
25933
26055
  });
25934
26056
  if (!state2.sessionFile)
25935
26057
  throw new Error("Pi empty fork has no Session file");
@@ -25937,8 +26059,8 @@ var PiAdapter = class {
25937
26059
  if (!configuration)
25938
26060
  throw new Error("Pi empty fork has no restorable configuration");
25939
26061
  transport = this.#createTransport({
25940
- cwd: input.cwd,
25941
- ...input.environment ? { environment: input.environment } : {},
26062
+ cwd: input2.cwd,
26063
+ ...input2.environment ? { environment: input2.environment } : {},
25942
26064
  sessionFile: state2.sessionFile,
25943
26065
  emptySessionConfiguration: configuration,
25944
26066
  onFault: (error51) => session?.handleTransportFault(error51)
@@ -25957,12 +26079,12 @@ var PiAdapter = class {
25957
26079
  if (!samePiModel(nativeModelFromState(transport.state), model2) || transport.state.thinkingLevel !== state2.thinkingLevel) {
25958
26080
  throw new Error("Pi empty fork could not restore its configuration");
25959
26081
  }
25960
- await transport.verifySessionCwd(input.cwd);
26082
+ await transport.verifySessionCwd(input2.cwd);
25961
26083
  }
25962
26084
  }
25963
26085
  const startedModels = await transport.getAvailableModels();
25964
26086
  const current = nativeModelFromState(transport.state);
25965
- if (input.kind === "resume" && input.model && current && sameHarnessModelRef(input.model, livePiModelIndex(startedModels, transport.state).ref({ ...current, fast: true })) && await isFastSupported(current, startedModels, transport)) {
26087
+ if (input2.kind === "resume" && input2.model && current && sameHarnessModelRef(input2.model, livePiModelIndex(startedModels, transport.state).ref({ ...current, fast: true })) && await isFastSupported(current, startedModels, transport)) {
25966
26088
  if (!transport.selectFastMode)
25967
26089
  throw new Error("Pi Fast extension is unavailable");
25968
26090
  await transport.selectFastMode(true);
@@ -25971,9 +26093,9 @@ var PiAdapter = class {
25971
26093
  this.#thinkingSelectionSupported = startedThinkingLevels !== null;
25972
26094
  const initialUsage = await transport.getSessionUsage().catch(() => null);
25973
26095
  const usageHistory = await transport.getEntries().then(piUsageHistory).catch(() => ({ requests: [], complete: false }));
25974
- session = this.#trackSession(input.cwd, {
26096
+ session = this.#trackSession(input2.cwd, {
25975
26097
  usageHistory,
25976
- ...input.environment ? { environment: input.environment } : {},
26098
+ ...input2.environment ? { environment: input2.environment } : {},
25977
26099
  startedTransport: transport,
25978
26100
  startedModels,
25979
26101
  startedThinkingLevels,
@@ -25988,7 +26110,7 @@ var PiAdapter = class {
25988
26110
  }
25989
26111
  #trackSession(cwd, options) {
25990
26112
  const environment = options.environment;
25991
- const createTransport = environment ? (input) => this.#createTransport({ ...input, environment }) : this.#createTransport;
26113
+ const createTransport = environment ? (input2) => this.#createTransport({ ...input2, environment }) : this.#createTransport;
25992
26114
  const session = new PiHarnessSession(cwd, createTransport, () => {
25993
26115
  this.#sessions.delete(session);
25994
26116
  }, {