@codexhost/cli-linux-arm64 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +3968 -4082
  4. package/app/console-web.js +6822 -2065
  5. package/app/desktop-controller.mjs +13620 -2977
  6. package/app/host-runtime.mjs +12025 -12636
  7. package/app/plugins/antigravity/plugin.mjs +2382 -1452
  8. package/app/plugins/claude-code/plugin.mjs +2248 -1645
  9. package/app/plugins/codebuddy/plugin.mjs +1753 -1215
  10. package/app/plugins/codex-usage/plugin.mjs +1214 -915
  11. package/app/plugins/copilot/plugin.mjs +1239 -919
  12. package/app/plugins/cursor-cli/plugin.mjs +1549 -1099
  13. package/app/plugins/deepseek-harness/plugin.mjs +1955 -1484
  14. package/app/plugins/devin/plugin.mjs +1295 -978
  15. package/app/plugins/grok/plugin.mjs +1772 -1482
  16. package/app/plugins/hermes/plugin.mjs +1485 -1184
  17. package/app/plugins/kimi-code/plugin.mjs +1388 -1093
  18. package/app/plugins/kiro-cli/plugin.mjs +1349 -1036
  19. package/app/plugins/omp/plugin.mjs +2027 -1420
  20. package/app/plugins/opencode/plugin.mjs +2219 -1844
  21. package/app/plugins/pi/plugin.mjs +1956 -1606
  22. package/app/plugins/qoder/plugin.mjs +1536 -1229
  23. package/app/plugins/qoder-cn/plugin.mjs +1536 -1229
  24. package/app/plugins/qwen-code/plugin.mjs +1490 -1198
  25. package/app/plugins/workbuddy/plugin.mjs +1757 -1221
  26. package/app/plugins/zcode/plugin.mjs +1841 -1072
  27. package/app/renderer-extension.js +12894 -8392
  28. package/app/web/assets/index-CTCFIQbU.css +1 -0
  29. package/app/web/assets/index-DUOvhHbV.js +203 -0
  30. package/app/web/codexhost-settings.js +4811 -36168
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  34. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +98 -95
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -9
  53. package/app/web/sw.js +8 -1
  54. package/app/web-modules/server.mjs +4752 -6790
  55. package/bin/codexhost +0 -0
  56. package/libexec/codexhost-shim +0 -0
  57. package/libexec/codexhost-updater +0 -0
  58. package/package.json +1 -1
  59. package/app/web/assets/index-DJW4bmyx.css +0 -1
  60. package/app/web/assets/index-Dyh1KzAB.js +0 -201
@@ -32,10 +32,10 @@ function executableExtensions(command, platform, environment) {
32
32
  return [""];
33
33
  return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
34
34
  }
35
- function isExecutableFile(filePath, platform) {
35
+ function isExecutableFile(filePath2, platform) {
36
36
  try {
37
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
- return fs.statSync(filePath).isFile();
37
+ fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
+ return fs.statSync(filePath2).isFile();
39
39
  } catch {
40
40
  return false;
41
41
  }
@@ -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",
@@ -1052,8 +1052,8 @@ function cached(getter) {
1052
1052
  }
1053
1053
  };
1054
1054
  }
1055
- function nullish(input) {
1056
- return input === null || input === void 0;
1055
+ function nullish(input2) {
1056
+ return input2 === null || input2 === void 0;
1057
1057
  }
1058
1058
  function cleanRegex(source) {
1059
1059
  const start = source.startsWith("^") ? 1 : 0;
@@ -1140,8 +1140,8 @@ function randomString(length = 10) {
1140
1140
  function esc(str) {
1141
1141
  return JSON.stringify(str);
1142
1142
  }
1143
- function slugify(input) {
1144
- return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1143
+ function slugify(input2) {
1144
+ return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1145
1145
  }
1146
1146
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1147
1147
  };
@@ -1546,19 +1546,19 @@ function finalizeIssue(iss, ctx, config2) {
1546
1546
  }
1547
1547
  return rest;
1548
1548
  }
1549
- function getSizableOrigin(input) {
1550
- if (input instanceof Set)
1549
+ function getSizableOrigin(input2) {
1550
+ if (input2 instanceof Set)
1551
1551
  return "set";
1552
- if (input instanceof Map)
1552
+ if (input2 instanceof Map)
1553
1553
  return "map";
1554
- if (input instanceof File)
1554
+ if (input2 instanceof File)
1555
1555
  return "file";
1556
1556
  return "unknown";
1557
1557
  }
1558
- function getLengthableOrigin(input) {
1559
- if (Array.isArray(input))
1558
+ function getLengthableOrigin(input2) {
1559
+ if (Array.isArray(input2))
1560
1560
  return "array";
1561
- if (typeof input === "string")
1561
+ if (typeof input2 === "string")
1562
1562
  return "string";
1563
1563
  return "unknown";
1564
1564
  }
@@ -1584,12 +1584,12 @@ function parsedType(data) {
1584
1584
  return t;
1585
1585
  }
1586
1586
  function issue(...args) {
1587
- const [iss, input, inst] = args;
1587
+ const [iss, input2, inst] = args;
1588
1588
  if (typeof iss === "string") {
1589
1589
  return {
1590
1590
  message: iss,
1591
1591
  code: "custom",
1592
- input,
1592
+ input: input2,
1593
1593
  inst
1594
1594
  };
1595
1595
  }
@@ -1600,8 +1600,8 @@ function cleanEnum(obj) {
1600
1600
  return Number.isNaN(Number.parseInt(k, 10));
1601
1601
  }).map((el) => el[1]);
1602
1602
  }
1603
- function base64ToUint8Array(base643) {
1604
- const binaryString = atob(base643);
1603
+ function base64ToUint8Array(base644) {
1604
+ const binaryString = atob(base644);
1605
1605
  const bytes = new Uint8Array(binaryString.length);
1606
1606
  for (let i = 0; i < binaryString.length; i++) {
1607
1607
  bytes[i] = binaryString.charCodeAt(i);
@@ -1616,9 +1616,9 @@ function uint8ArrayToBase64(bytes) {
1616
1616
  return btoa(binaryString);
1617
1617
  }
1618
1618
  function base64urlToUint8Array(base64url3) {
1619
- const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1620
- const padding = "=".repeat((4 - base643.length % 4) % 4);
1621
- return base64ToUint8Array(base643 + padding);
1619
+ const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1620
+ const padding = "=".repeat((4 - base644.length % 4) % 4);
1621
+ return base64ToUint8Array(base644 + padding);
1622
1622
  }
1623
1623
  function uint8ArrayToBase64url(bytes) {
1624
1624
  return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -2133,23 +2133,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2133
2133
  bag.pattern = integer;
2134
2134
  });
2135
2135
  inst._zod.check = (payload) => {
2136
- const input = payload.value;
2136
+ const input2 = payload.value;
2137
2137
  if (isInt) {
2138
- if (!Number.isInteger(input)) {
2138
+ if (!Number.isInteger(input2)) {
2139
2139
  payload.issues.push({
2140
2140
  expected: origin,
2141
2141
  format: def.format,
2142
2142
  code: "invalid_type",
2143
2143
  continue: false,
2144
- input,
2144
+ input: input2,
2145
2145
  inst
2146
2146
  });
2147
2147
  return;
2148
2148
  }
2149
- if (!Number.isSafeInteger(input)) {
2150
- if (input > 0) {
2149
+ if (!Number.isSafeInteger(input2)) {
2150
+ if (input2 > 0) {
2151
2151
  payload.issues.push({
2152
- input,
2152
+ input: input2,
2153
2153
  code: "too_big",
2154
2154
  maximum: Number.MAX_SAFE_INTEGER,
2155
2155
  note: "Integers must be within the safe integer range.",
@@ -2160,7 +2160,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2160
2160
  });
2161
2161
  } else {
2162
2162
  payload.issues.push({
2163
- input,
2163
+ input: input2,
2164
2164
  code: "too_small",
2165
2165
  minimum: Number.MIN_SAFE_INTEGER,
2166
2166
  note: "Integers must be within the safe integer range.",
@@ -2173,10 +2173,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2173
2173
  return;
2174
2174
  }
2175
2175
  }
2176
- if (input < minimum) {
2176
+ if (input2 < minimum) {
2177
2177
  payload.issues.push({
2178
2178
  origin: "number",
2179
- input,
2179
+ input: input2,
2180
2180
  code: "too_small",
2181
2181
  minimum,
2182
2182
  inclusive: true,
@@ -2184,10 +2184,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2184
2184
  continue: !def.abort
2185
2185
  });
2186
2186
  }
2187
- if (input > maximum) {
2187
+ if (input2 > maximum) {
2188
2188
  payload.issues.push({
2189
2189
  origin: "number",
2190
- input,
2190
+ input: input2,
2191
2191
  code: "too_big",
2192
2192
  maximum,
2193
2193
  inclusive: true,
@@ -2207,11 +2207,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2207
2207
  bag.maximum = maximum;
2208
2208
  });
2209
2209
  inst._zod.check = (payload) => {
2210
- const input = payload.value;
2211
- if (input < minimum) {
2210
+ const input2 = payload.value;
2211
+ if (input2 < minimum) {
2212
2212
  payload.issues.push({
2213
2213
  origin: "bigint",
2214
- input,
2214
+ input: input2,
2215
2215
  code: "too_small",
2216
2216
  minimum,
2217
2217
  inclusive: true,
@@ -2219,10 +2219,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
2219
2219
  continue: !def.abort
2220
2220
  });
2221
2221
  }
2222
- if (input > maximum) {
2222
+ if (input2 > maximum) {
2223
2223
  payload.issues.push({
2224
2224
  origin: "bigint",
2225
- input,
2225
+ input: input2,
2226
2226
  code: "too_big",
2227
2227
  maximum,
2228
2228
  inclusive: true,
@@ -2245,16 +2245,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2245
2245
  inst2._zod.bag.maximum = def.maximum;
2246
2246
  });
2247
2247
  inst._zod.check = (payload) => {
2248
- const input = payload.value;
2249
- const size = input.size;
2248
+ const input2 = payload.value;
2249
+ const size = input2.size;
2250
2250
  if (size <= def.maximum)
2251
2251
  return;
2252
2252
  payload.issues.push({
2253
- origin: getSizableOrigin(input),
2253
+ origin: getSizableOrigin(input2),
2254
2254
  code: "too_big",
2255
2255
  maximum: def.maximum,
2256
2256
  inclusive: true,
2257
- input,
2257
+ input: input2,
2258
2258
  inst,
2259
2259
  continue: !def.abort
2260
2260
  });
@@ -2273,16 +2273,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2273
2273
  inst2._zod.bag.minimum = def.minimum;
2274
2274
  });
2275
2275
  inst._zod.check = (payload) => {
2276
- const input = payload.value;
2277
- const size = input.size;
2276
+ const input2 = payload.value;
2277
+ const size = input2.size;
2278
2278
  if (size >= def.minimum)
2279
2279
  return;
2280
2280
  payload.issues.push({
2281
- origin: getSizableOrigin(input),
2281
+ origin: getSizableOrigin(input2),
2282
2282
  code: "too_small",
2283
2283
  minimum: def.minimum,
2284
2284
  inclusive: true,
2285
- input,
2285
+ input: input2,
2286
2286
  inst,
2287
2287
  continue: !def.abort
2288
2288
  });
@@ -2302,13 +2302,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2302
2302
  bag.size = def.size;
2303
2303
  });
2304
2304
  inst._zod.check = (payload) => {
2305
- const input = payload.value;
2306
- const size = input.size;
2305
+ const input2 = payload.value;
2306
+ const size = input2.size;
2307
2307
  if (size === def.size)
2308
2308
  return;
2309
2309
  const tooBig = size > def.size;
2310
2310
  payload.issues.push({
2311
- origin: getSizableOrigin(input),
2311
+ origin: getSizableOrigin(input2),
2312
2312
  ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
2313
2313
  inclusive: true,
2314
2314
  exact: true,
@@ -2331,17 +2331,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2331
2331
  inst2._zod.bag.maximum = def.maximum;
2332
2332
  });
2333
2333
  inst._zod.check = (payload) => {
2334
- const input = payload.value;
2335
- const length = input.length;
2334
+ const input2 = payload.value;
2335
+ const length = input2.length;
2336
2336
  if (length <= def.maximum)
2337
2337
  return;
2338
- const origin = getLengthableOrigin(input);
2338
+ const origin = getLengthableOrigin(input2);
2339
2339
  payload.issues.push({
2340
2340
  origin,
2341
2341
  code: "too_big",
2342
2342
  maximum: def.maximum,
2343
2343
  inclusive: true,
2344
- input,
2344
+ input: input2,
2345
2345
  inst,
2346
2346
  continue: !def.abort
2347
2347
  });
@@ -2360,17 +2360,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2360
2360
  inst2._zod.bag.minimum = def.minimum;
2361
2361
  });
2362
2362
  inst._zod.check = (payload) => {
2363
- const input = payload.value;
2364
- const length = input.length;
2363
+ const input2 = payload.value;
2364
+ const length = input2.length;
2365
2365
  if (length >= def.minimum)
2366
2366
  return;
2367
- const origin = getLengthableOrigin(input);
2367
+ const origin = getLengthableOrigin(input2);
2368
2368
  payload.issues.push({
2369
2369
  origin,
2370
2370
  code: "too_small",
2371
2371
  minimum: def.minimum,
2372
2372
  inclusive: true,
2373
- input,
2373
+ input: input2,
2374
2374
  inst,
2375
2375
  continue: !def.abort
2376
2376
  });
@@ -2390,11 +2390,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2390
2390
  bag.length = def.length;
2391
2391
  });
2392
2392
  inst._zod.check = (payload) => {
2393
- const input = payload.value;
2394
- const length = input.length;
2393
+ const input2 = payload.value;
2394
+ const length = input2.length;
2395
2395
  if (length === def.length)
2396
2396
  return;
2397
- const origin = getLengthableOrigin(input);
2397
+ const origin = getLengthableOrigin(input2);
2398
2398
  const tooBig = length > def.length;
2399
2399
  payload.issues.push({
2400
2400
  origin,
@@ -2984,8 +2984,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2984
2984
  function isValidBase64URL(data) {
2985
2985
  if (!base64url.test(data))
2986
2986
  return false;
2987
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2988
- const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2987
+ const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2988
+ const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
2989
2989
  return isValidBase64(padded);
2990
2990
  }
2991
2991
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
@@ -3065,15 +3065,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3065
3065
  payload.value = Number(payload.value);
3066
3066
  } catch (_) {
3067
3067
  }
3068
- const input = payload.value;
3069
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
3068
+ const input2 = payload.value;
3069
+ if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
3070
3070
  return payload;
3071
3071
  }
3072
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
3072
+ const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
3073
3073
  payload.issues.push({
3074
3074
  expected: "number",
3075
3075
  code: "invalid_type",
3076
- input,
3076
+ input: input2,
3077
3077
  inst,
3078
3078
  ...received ? { received } : {}
3079
3079
  });
@@ -3093,13 +3093,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
3093
3093
  payload.value = Boolean(payload.value);
3094
3094
  } catch (_) {
3095
3095
  }
3096
- const input = payload.value;
3097
- if (typeof input === "boolean")
3096
+ const input2 = payload.value;
3097
+ if (typeof input2 === "boolean")
3098
3098
  return payload;
3099
3099
  payload.issues.push({
3100
3100
  expected: "boolean",
3101
3101
  code: "invalid_type",
3102
- input,
3102
+ input: input2,
3103
3103
  inst
3104
3104
  });
3105
3105
  return payload;
@@ -3132,13 +3132,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
3132
3132
  var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
3133
3133
  $ZodType.init(inst, def);
3134
3134
  inst._zod.parse = (payload, _ctx) => {
3135
- const input = payload.value;
3136
- if (typeof input === "symbol")
3135
+ const input2 = payload.value;
3136
+ if (typeof input2 === "symbol")
3137
3137
  return payload;
3138
3138
  payload.issues.push({
3139
3139
  expected: "symbol",
3140
3140
  code: "invalid_type",
3141
- input,
3141
+ input: input2,
3142
3142
  inst
3143
3143
  });
3144
3144
  return payload;
@@ -3149,13 +3149,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
3149
3149
  inst._zod.pattern = _undefined;
3150
3150
  inst._zod.values = /* @__PURE__ */ new Set([void 0]);
3151
3151
  inst._zod.parse = (payload, _ctx) => {
3152
- const input = payload.value;
3153
- if (typeof input === "undefined")
3152
+ const input2 = payload.value;
3153
+ if (typeof input2 === "undefined")
3154
3154
  return payload;
3155
3155
  payload.issues.push({
3156
3156
  expected: "undefined",
3157
3157
  code: "invalid_type",
3158
- input,
3158
+ input: input2,
3159
3159
  inst
3160
3160
  });
3161
3161
  return payload;
@@ -3166,13 +3166,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
3166
3166
  inst._zod.pattern = _null;
3167
3167
  inst._zod.values = /* @__PURE__ */ new Set([null]);
3168
3168
  inst._zod.parse = (payload, _ctx) => {
3169
- const input = payload.value;
3170
- if (input === null)
3169
+ const input2 = payload.value;
3170
+ if (input2 === null)
3171
3171
  return payload;
3172
3172
  payload.issues.push({
3173
3173
  expected: "null",
3174
3174
  code: "invalid_type",
3175
- input,
3175
+ input: input2,
3176
3176
  inst
3177
3177
  });
3178
3178
  return payload;
@@ -3201,13 +3201,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
3201
3201
  var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
3202
3202
  $ZodType.init(inst, def);
3203
3203
  inst._zod.parse = (payload, _ctx) => {
3204
- const input = payload.value;
3205
- if (typeof input === "undefined")
3204
+ const input2 = payload.value;
3205
+ if (typeof input2 === "undefined")
3206
3206
  return payload;
3207
3207
  payload.issues.push({
3208
3208
  expected: "void",
3209
3209
  code: "invalid_type",
3210
- input,
3210
+ input: input2,
3211
3211
  inst
3212
3212
  });
3213
3213
  return payload;
@@ -3222,15 +3222,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3222
3222
  } catch (_err) {
3223
3223
  }
3224
3224
  }
3225
- const input = payload.value;
3226
- const isDate = input instanceof Date;
3227
- const isValidDate = isDate && !Number.isNaN(input.getTime());
3225
+ const input2 = payload.value;
3226
+ const isDate = input2 instanceof Date;
3227
+ const isValidDate = isDate && !Number.isNaN(input2.getTime());
3228
3228
  if (isValidDate)
3229
3229
  return payload;
3230
3230
  payload.issues.push({
3231
3231
  expected: "date",
3232
3232
  code: "invalid_type",
3233
- input,
3233
+ input: input2,
3234
3234
  ...isDate ? { received: "Invalid Date" } : {},
3235
3235
  inst
3236
3236
  });
@@ -3246,20 +3246,20 @@ function handleArrayResult(result, final, index) {
3246
3246
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3247
3247
  $ZodType.init(inst, def);
3248
3248
  inst._zod.parse = (payload, ctx) => {
3249
- const input = payload.value;
3250
- if (!Array.isArray(input)) {
3249
+ const input2 = payload.value;
3250
+ if (!Array.isArray(input2)) {
3251
3251
  payload.issues.push({
3252
3252
  expected: "array",
3253
3253
  code: "invalid_type",
3254
- input,
3254
+ input: input2,
3255
3255
  inst
3256
3256
  });
3257
3257
  return payload;
3258
3258
  }
3259
- payload.value = Array(input.length);
3259
+ payload.value = Array(input2.length);
3260
3260
  const proms = [];
3261
- for (let i = 0; i < input.length; i++) {
3262
- const item = input[i];
3261
+ for (let i = 0; i < input2.length; i++) {
3262
+ const item = input2[i];
3263
3263
  const result = def.element._zod.run({
3264
3264
  value: item,
3265
3265
  issues: []
@@ -3276,8 +3276,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3276
3276
  return payload;
3277
3277
  };
3278
3278
  });
3279
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
3280
- const isPresent = key in input;
3279
+ function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
3280
+ const isPresent = key in input2;
3281
3281
  if (result.issues.length) {
3282
3282
  if (isOptionalIn && isOptionalOut && !isPresent) {
3283
3283
  return;
@@ -3319,14 +3319,14 @@ function normalizeDef(def) {
3319
3319
  optionalKeys: new Set(okeys)
3320
3320
  };
3321
3321
  }
3322
- function handleCatchall(proms, input, payload, ctx, def, inst) {
3322
+ function handleCatchall(proms, input2, payload, ctx, def, inst) {
3323
3323
  const unrecognized = [];
3324
3324
  const keySet = def.keySet;
3325
3325
  const _catchall = def.catchall._zod;
3326
3326
  const t = _catchall.def.type;
3327
3327
  const isOptionalIn = _catchall.optin === "optional";
3328
3328
  const isOptionalOut = _catchall.optout === "optional";
3329
- for (const key in input) {
3329
+ for (const key in input2) {
3330
3330
  if (key === "__proto__")
3331
3331
  continue;
3332
3332
  if (keySet.has(key))
@@ -3335,18 +3335,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3335
3335
  unrecognized.push(key);
3336
3336
  continue;
3337
3337
  }
3338
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
3338
+ const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
3339
3339
  if (r instanceof Promise) {
3340
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3340
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3341
3341
  } else {
3342
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3342
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3343
3343
  }
3344
3344
  }
3345
3345
  if (unrecognized.length) {
3346
3346
  payload.issues.push({
3347
3347
  code: "unrecognized_keys",
3348
3348
  keys: unrecognized,
3349
- input,
3349
+ input: input2,
3350
3350
  inst
3351
3351
  });
3352
3352
  }
@@ -3390,12 +3390,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3390
3390
  let value;
3391
3391
  inst._zod.parse = (payload, ctx) => {
3392
3392
  value ?? (value = _normalized.value);
3393
- const input = payload.value;
3394
- if (!isObject2(input)) {
3393
+ const input2 = payload.value;
3394
+ if (!isObject2(input2)) {
3395
3395
  payload.issues.push({
3396
3396
  expected: "object",
3397
3397
  code: "invalid_type",
3398
- input,
3398
+ input: input2,
3399
3399
  inst
3400
3400
  });
3401
3401
  return payload;
@@ -3407,17 +3407,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3407
3407
  const el = shape[key];
3408
3408
  const isOptionalIn = el._zod.optin === "optional";
3409
3409
  const isOptionalOut = el._zod.optout === "optional";
3410
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
3410
+ const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
3411
3411
  if (r instanceof Promise) {
3412
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
3412
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
3413
3413
  } else {
3414
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
3414
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
3415
3415
  }
3416
3416
  }
3417
3417
  if (!catchall) {
3418
3418
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3419
3419
  }
3420
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
3420
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
3421
3421
  };
3422
3422
  });
3423
3423
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3439,42 +3439,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3439
3439
  }
3440
3440
  doc.write(`const newResult = {};`);
3441
3441
  for (const key of normalized.keys) {
3442
- const id = ids[key];
3442
+ const id2 = ids[key];
3443
3443
  const k = esc(key);
3444
3444
  const schema = shape[key];
3445
3445
  const isOptionalIn = schema?._zod?.optin === "optional";
3446
3446
  const isOptionalOut = schema?._zod?.optout === "optional";
3447
- doc.write(`const ${id} = ${parseStr(key)};`);
3447
+ doc.write(`const ${id2} = ${parseStr(key)};`);
3448
3448
  if (isOptionalIn && isOptionalOut) {
3449
3449
  doc.write(`
3450
- if (${id}.issues.length) {
3450
+ if (${id2}.issues.length) {
3451
3451
  if (${k} in input) {
3452
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3452
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3453
3453
  ...iss,
3454
3454
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3455
3455
  })));
3456
3456
  }
3457
3457
  }
3458
3458
 
3459
- if (${id}.value === undefined) {
3459
+ if (${id2}.value === undefined) {
3460
3460
  if (${k} in input) {
3461
3461
  newResult[${k}] = undefined;
3462
3462
  }
3463
3463
  } else {
3464
- newResult[${k}] = ${id}.value;
3464
+ newResult[${k}] = ${id2}.value;
3465
3465
  }
3466
3466
 
3467
3467
  `);
3468
3468
  } else if (!isOptionalIn) {
3469
3469
  doc.write(`
3470
- const ${id}_present = ${k} in input;
3471
- if (${id}.issues.length) {
3472
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3470
+ const ${id2}_present = ${k} in input;
3471
+ if (${id2}.issues.length) {
3472
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3473
3473
  ...iss,
3474
3474
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3475
3475
  })));
3476
3476
  }
3477
- if (!${id}_present && !${id}.issues.length) {
3477
+ if (!${id2}_present && !${id2}.issues.length) {
3478
3478
  payload.issues.push({
3479
3479
  code: "invalid_type",
3480
3480
  expected: "nonoptional",
@@ -3483,30 +3483,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3483
3483
  });
3484
3484
  }
3485
3485
 
3486
- if (${id}_present) {
3487
- if (${id}.value === undefined) {
3486
+ if (${id2}_present) {
3487
+ if (${id2}.value === undefined) {
3488
3488
  newResult[${k}] = undefined;
3489
3489
  } else {
3490
- newResult[${k}] = ${id}.value;
3490
+ newResult[${k}] = ${id2}.value;
3491
3491
  }
3492
3492
  }
3493
3493
 
3494
3494
  `);
3495
3495
  } else {
3496
3496
  doc.write(`
3497
- if (${id}.issues.length) {
3498
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3497
+ if (${id2}.issues.length) {
3498
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3499
3499
  ...iss,
3500
3500
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3501
3501
  })));
3502
3502
  }
3503
3503
 
3504
- if (${id}.value === undefined) {
3504
+ if (${id2}.value === undefined) {
3505
3505
  if (${k} in input) {
3506
3506
  newResult[${k}] = undefined;
3507
3507
  }
3508
3508
  } else {
3509
- newResult[${k}] = ${id}.value;
3509
+ newResult[${k}] = ${id2}.value;
3510
3510
  }
3511
3511
 
3512
3512
  `);
@@ -3526,12 +3526,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3526
3526
  let value;
3527
3527
  inst._zod.parse = (payload, ctx) => {
3528
3528
  value ?? (value = _normalized.value);
3529
- const input = payload.value;
3530
- if (!isObject2(input)) {
3529
+ const input2 = payload.value;
3530
+ if (!isObject2(input2)) {
3531
3531
  payload.issues.push({
3532
3532
  expected: "object",
3533
3533
  code: "invalid_type",
3534
- input,
3534
+ input: input2,
3535
3535
  inst
3536
3536
  });
3537
3537
  return payload;
@@ -3542,7 +3542,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3542
3542
  payload = fastpass(payload, ctx);
3543
3543
  if (!catchall)
3544
3544
  return payload;
3545
- return handleCatchall([], input, payload, ctx, value, inst);
3545
+ return handleCatchall([], input2, payload, ctx, value, inst);
3546
3546
  }
3547
3547
  return superParse(payload, ctx);
3548
3548
  };
@@ -3702,17 +3702,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3702
3702
  return map2;
3703
3703
  });
3704
3704
  inst._zod.parse = (payload, ctx) => {
3705
- const input = payload.value;
3706
- if (!isObject(input)) {
3705
+ const input2 = payload.value;
3706
+ if (!isObject(input2)) {
3707
3707
  payload.issues.push({
3708
3708
  code: "invalid_type",
3709
3709
  expected: "object",
3710
- input,
3710
+ input: input2,
3711
3711
  inst
3712
3712
  });
3713
3713
  return payload;
3714
3714
  }
3715
- const opt = disc.value.get(input?.[def.discriminator]);
3715
+ const opt = disc.value.get(input2?.[def.discriminator]);
3716
3716
  if (opt) {
3717
3717
  return opt._zod.run(payload, ctx);
3718
3718
  }
@@ -3725,7 +3725,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3725
3725
  note: "No matching discriminator",
3726
3726
  discriminator: def.discriminator,
3727
3727
  options: Array.from(disc.value.keys()),
3728
- input,
3728
+ input: input2,
3729
3729
  path: [def.discriminator],
3730
3730
  inst
3731
3731
  });
@@ -3735,9 +3735,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3735
3735
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
3736
3736
  $ZodType.init(inst, def);
3737
3737
  inst._zod.parse = (payload, ctx) => {
3738
- const input = payload.value;
3739
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
3740
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
3738
+ const input2 = payload.value;
3739
+ const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
3740
+ const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
3741
3741
  const async = left instanceof Promise || right instanceof Promise;
3742
3742
  if (async) {
3743
3743
  return Promise.all([left, right]).then(([left2, right2]) => {
@@ -3834,10 +3834,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3834
3834
  $ZodType.init(inst, def);
3835
3835
  const items = def.items;
3836
3836
  inst._zod.parse = (payload, ctx) => {
3837
- const input = payload.value;
3838
- if (!Array.isArray(input)) {
3837
+ const input2 = payload.value;
3838
+ if (!Array.isArray(input2)) {
3839
3839
  payload.issues.push({
3840
- input,
3840
+ input: input2,
3841
3841
  inst,
3842
3842
  expected: "tuple",
3843
3843
  code: "invalid_type"
@@ -3849,23 +3849,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3849
3849
  const optinStart = getTupleOptStart(items, "optin");
3850
3850
  const optoutStart = getTupleOptStart(items, "optout");
3851
3851
  if (!def.rest) {
3852
- if (input.length < optinStart) {
3852
+ if (input2.length < optinStart) {
3853
3853
  payload.issues.push({
3854
3854
  code: "too_small",
3855
3855
  minimum: optinStart,
3856
3856
  inclusive: true,
3857
- input,
3857
+ input: input2,
3858
3858
  inst,
3859
3859
  origin: "array"
3860
3860
  });
3861
3861
  return payload;
3862
3862
  }
3863
- if (input.length > items.length) {
3863
+ if (input2.length > items.length) {
3864
3864
  payload.issues.push({
3865
3865
  code: "too_big",
3866
3866
  maximum: items.length,
3867
3867
  inclusive: true,
3868
- input,
3868
+ input: input2,
3869
3869
  inst,
3870
3870
  origin: "array"
3871
3871
  });
@@ -3873,7 +3873,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3873
3873
  }
3874
3874
  const itemResults = new Array(items.length);
3875
3875
  for (let i = 0; i < items.length; i++) {
3876
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
3876
+ const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
3877
3877
  if (r instanceof Promise) {
3878
3878
  proms.push(r.then((rr) => {
3879
3879
  itemResults[i] = rr;
@@ -3884,7 +3884,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3884
3884
  }
3885
3885
  if (def.rest) {
3886
3886
  let i = items.length - 1;
3887
- const rest = input.slice(items.length);
3887
+ const rest = input2.slice(items.length);
3888
3888
  for (const el of rest) {
3889
3889
  i++;
3890
3890
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
@@ -3896,9 +3896,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3896
3896
  }
3897
3897
  }
3898
3898
  if (proms.length) {
3899
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
3899
+ return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
3900
3900
  }
3901
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
3901
+ return handleTupleResults(itemResults, payload, items, input2, optoutStart);
3902
3902
  };
3903
3903
  });
3904
3904
  function getTupleOptStart(items, key) {
@@ -3914,10 +3914,10 @@ function handleTupleResult(result, final, index) {
3914
3914
  }
3915
3915
  final.value[index] = result.value;
3916
3916
  }
3917
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
3917
+ function handleTupleResults(itemResults, final, items, input2, optoutStart) {
3918
3918
  for (let i = 0; i < items.length; i++) {
3919
3919
  const r = itemResults[i];
3920
- const isPresent = i < input.length;
3920
+ const isPresent = i < input2.length;
3921
3921
  if (r.issues.length) {
3922
3922
  if (!isPresent && i >= optoutStart) {
3923
3923
  final.value.length = i;
@@ -3927,7 +3927,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
3927
3927
  }
3928
3928
  final.value[i] = r.value;
3929
3929
  }
3930
- for (let i = final.value.length - 1; i >= input.length; i--) {
3930
+ for (let i = final.value.length - 1; i >= input2.length; i--) {
3931
3931
  if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
3932
3932
  final.value.length = i;
3933
3933
  } else {
@@ -3939,12 +3939,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
3939
3939
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3940
3940
  $ZodType.init(inst, def);
3941
3941
  inst._zod.parse = (payload, ctx) => {
3942
- const input = payload.value;
3943
- if (!isPlainObject(input)) {
3942
+ const input2 = payload.value;
3943
+ if (!isPlainObject(input2)) {
3944
3944
  payload.issues.push({
3945
3945
  expected: "record",
3946
3946
  code: "invalid_type",
3947
- input,
3947
+ input: input2,
3948
3948
  inst
3949
3949
  });
3950
3950
  return payload;
@@ -3973,7 +3973,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3973
3973
  continue;
3974
3974
  }
3975
3975
  const outKey = keyResult.value;
3976
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
3976
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
3977
3977
  if (result instanceof Promise) {
3978
3978
  proms.push(result.then((result2) => {
3979
3979
  if (result2.issues.length) {
@@ -3990,7 +3990,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3990
3990
  }
3991
3991
  }
3992
3992
  let unrecognized;
3993
- for (const key in input) {
3993
+ for (const key in input2) {
3994
3994
  if (!recordKeys.has(key)) {
3995
3995
  unrecognized = unrecognized ?? [];
3996
3996
  unrecognized.push(key);
@@ -3999,17 +3999,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3999
3999
  if (unrecognized && unrecognized.length > 0) {
4000
4000
  payload.issues.push({
4001
4001
  code: "unrecognized_keys",
4002
- input,
4002
+ input: input2,
4003
4003
  inst,
4004
4004
  keys: unrecognized
4005
4005
  });
4006
4006
  }
4007
4007
  } else {
4008
4008
  payload.value = {};
4009
- for (const key of Reflect.ownKeys(input)) {
4009
+ for (const key of Reflect.ownKeys(input2)) {
4010
4010
  if (key === "__proto__")
4011
4011
  continue;
4012
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
4012
+ if (!Object.prototype.propertyIsEnumerable.call(input2, key))
4013
4013
  continue;
4014
4014
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4015
4015
  if (keyResult instanceof Promise) {
@@ -4027,7 +4027,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4027
4027
  }
4028
4028
  if (keyResult.issues.length) {
4029
4029
  if (def.mode === "loose") {
4030
- payload.value[key] = input[key];
4030
+ payload.value[key] = input2[key];
4031
4031
  } else {
4032
4032
  payload.issues.push({
4033
4033
  code: "invalid_key",
@@ -4040,7 +4040,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4040
4040
  }
4041
4041
  continue;
4042
4042
  }
4043
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
4043
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
4044
4044
  if (result instanceof Promise) {
4045
4045
  proms.push(result.then((result2) => {
4046
4046
  if (result2.issues.length) {
@@ -4065,27 +4065,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
4065
4065
  var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4066
4066
  $ZodType.init(inst, def);
4067
4067
  inst._zod.parse = (payload, ctx) => {
4068
- const input = payload.value;
4069
- if (!(input instanceof Map)) {
4068
+ const input2 = payload.value;
4069
+ if (!(input2 instanceof Map)) {
4070
4070
  payload.issues.push({
4071
4071
  expected: "map",
4072
4072
  code: "invalid_type",
4073
- input,
4073
+ input: input2,
4074
4074
  inst
4075
4075
  });
4076
4076
  return payload;
4077
4077
  }
4078
4078
  const proms = [];
4079
4079
  payload.value = /* @__PURE__ */ new Map();
4080
- for (const [key, value] of input) {
4080
+ for (const [key, value] of input2) {
4081
4081
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4082
4082
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4083
4083
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
4084
4084
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
4085
- handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
4085
+ handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
4086
4086
  }));
4087
4087
  } else {
4088
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
4088
+ handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
4089
4089
  }
4090
4090
  }
4091
4091
  if (proms.length)
@@ -4093,7 +4093,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4093
4093
  return payload;
4094
4094
  };
4095
4095
  });
4096
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4096
+ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
4097
4097
  if (keyResult.issues.length) {
4098
4098
  if (propertyKeyTypes.has(typeof key)) {
4099
4099
  final.issues.push(...prefixIssues(key, keyResult.issues));
@@ -4101,7 +4101,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4101
4101
  final.issues.push({
4102
4102
  code: "invalid_key",
4103
4103
  origin: "map",
4104
- input,
4104
+ input: input2,
4105
4105
  inst,
4106
4106
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
4107
4107
  });
@@ -4114,7 +4114,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4114
4114
  final.issues.push({
4115
4115
  origin: "map",
4116
4116
  code: "invalid_element",
4117
- input,
4117
+ input: input2,
4118
4118
  inst,
4119
4119
  key,
4120
4120
  issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
@@ -4126,10 +4126,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
4126
4126
  var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4127
4127
  $ZodType.init(inst, def);
4128
4128
  inst._zod.parse = (payload, ctx) => {
4129
- const input = payload.value;
4130
- if (!(input instanceof Set)) {
4129
+ const input2 = payload.value;
4130
+ if (!(input2 instanceof Set)) {
4131
4131
  payload.issues.push({
4132
- input,
4132
+ input: input2,
4133
4133
  inst,
4134
4134
  expected: "set",
4135
4135
  code: "invalid_type"
@@ -4138,7 +4138,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4138
4138
  }
4139
4139
  const proms = [];
4140
4140
  payload.value = /* @__PURE__ */ new Set();
4141
- for (const item of input) {
4141
+ for (const item of input2) {
4142
4142
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4143
4143
  if (result instanceof Promise) {
4144
4144
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4163,14 +4163,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4163
4163
  inst._zod.values = valuesSet;
4164
4164
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
4165
4165
  inst._zod.parse = (payload, _ctx) => {
4166
- const input = payload.value;
4167
- if (valuesSet.has(input)) {
4166
+ const input2 = payload.value;
4167
+ if (valuesSet.has(input2)) {
4168
4168
  return payload;
4169
4169
  }
4170
4170
  payload.issues.push({
4171
4171
  code: "invalid_value",
4172
4172
  values,
4173
- input,
4173
+ input: input2,
4174
4174
  inst
4175
4175
  });
4176
4176
  return payload;
@@ -4185,14 +4185,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4185
4185
  inst._zod.values = values;
4186
4186
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
4187
4187
  inst._zod.parse = (payload, _ctx) => {
4188
- const input = payload.value;
4189
- if (values.has(input)) {
4188
+ const input2 = payload.value;
4189
+ if (values.has(input2)) {
4190
4190
  return payload;
4191
4191
  }
4192
4192
  payload.issues.push({
4193
4193
  code: "invalid_value",
4194
4194
  values: def.values,
4195
- input,
4195
+ input: input2,
4196
4196
  inst
4197
4197
  });
4198
4198
  return payload;
@@ -4201,13 +4201,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4201
4201
  var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
4202
4202
  $ZodType.init(inst, def);
4203
4203
  inst._zod.parse = (payload, _ctx) => {
4204
- const input = payload.value;
4205
- if (input instanceof File)
4204
+ const input2 = payload.value;
4205
+ if (input2 instanceof File)
4206
4206
  return payload;
4207
4207
  payload.issues.push({
4208
4208
  expected: "file",
4209
4209
  code: "invalid_type",
4210
- input,
4210
+ input: input2,
4211
4211
  inst
4212
4212
  });
4213
4213
  return payload;
@@ -4237,8 +4237,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
4237
4237
  return payload;
4238
4238
  };
4239
4239
  });
4240
- function handleOptionalResult(result, input) {
4241
- if (input === void 0 && (result.issues.length || result.fallback)) {
4240
+ function handleOptionalResult(result, input2) {
4241
+ if (input2 === void 0 && (result.issues.length || result.fallback)) {
4242
4242
  return { issues: [], value: void 0 };
4243
4243
  }
4244
4244
  return result;
@@ -4256,11 +4256,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
4256
4256
  });
4257
4257
  inst._zod.parse = (payload, ctx) => {
4258
4258
  if (def.innerType._zod.optin === "optional") {
4259
- const input = payload.value;
4259
+ const input2 = payload.value;
4260
4260
  const result = def.innerType._zod.run(payload, ctx);
4261
4261
  if (result instanceof Promise)
4262
- return result.then((r) => handleOptionalResult(r, input));
4263
- return handleOptionalResult(result, input);
4262
+ return result.then((r) => handleOptionalResult(r, input2));
4263
+ return handleOptionalResult(result, input2);
4264
4264
  }
4265
4265
  if (payload.value === void 0) {
4266
4266
  return payload;
@@ -4685,20 +4685,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
4685
4685
  return payload;
4686
4686
  };
4687
4687
  inst._zod.check = (payload) => {
4688
- const input = payload.value;
4689
- const r = def.fn(input);
4688
+ const input2 = payload.value;
4689
+ const r = def.fn(input2);
4690
4690
  if (r instanceof Promise) {
4691
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
4691
+ return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
4692
4692
  }
4693
- handleRefineResult(r, payload, input, inst);
4693
+ handleRefineResult(r, payload, input2, inst);
4694
4694
  return;
4695
4695
  };
4696
4696
  });
4697
- function handleRefineResult(result, payload, input, inst) {
4697
+ function handleRefineResult(result, payload, input2, inst) {
4698
4698
  if (!result) {
4699
4699
  const _iss = {
4700
4700
  code: "custom",
4701
- input,
4701
+ input: input2,
4702
4702
  inst,
4703
4703
  // incorporates params.error into issue reporting
4704
4704
  path: [...inst._zod.def.path ?? []],
@@ -7985,8 +7985,8 @@ function ko_default() {
7985
7985
  }
7986
7986
 
7987
7987
  // ../../../node_modules/zod/v4/locales/lt.js
7988
- var capitalizeFirstCharacter = (text) => {
7989
- return text.charAt(0).toUpperCase() + text.slice(1);
7988
+ var capitalizeFirstCharacter = (text2) => {
7989
+ return text2.charAt(0).toUpperCase() + text2.slice(1);
7990
7990
  };
7991
7991
  function getUnitTypeFromNumber(number4) {
7992
7992
  const abs = Math.abs(number4);
@@ -11386,23 +11386,23 @@ function _overwrite(tx) {
11386
11386
  }
11387
11387
  // @__NO_SIDE_EFFECTS__
11388
11388
  function _normalize(form) {
11389
- return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
11389
+ return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
11390
11390
  }
11391
11391
  // @__NO_SIDE_EFFECTS__
11392
11392
  function _trim() {
11393
- return /* @__PURE__ */ _overwrite((input) => input.trim());
11393
+ return /* @__PURE__ */ _overwrite((input2) => input2.trim());
11394
11394
  }
11395
11395
  // @__NO_SIDE_EFFECTS__
11396
11396
  function _toLowerCase() {
11397
- return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
11397
+ return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
11398
11398
  }
11399
11399
  // @__NO_SIDE_EFFECTS__
11400
11400
  function _toUpperCase() {
11401
- return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
11401
+ return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
11402
11402
  }
11403
11403
  // @__NO_SIDE_EFFECTS__
11404
11404
  function _slugify() {
11405
- return /* @__PURE__ */ _overwrite((input) => slugify(input));
11405
+ return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
11406
11406
  }
11407
11407
  // @__NO_SIDE_EFFECTS__
11408
11408
  function _array(Class2, element, params) {
@@ -11707,8 +11707,8 @@ function _stringbool(Classes, _params) {
11707
11707
  type: "pipe",
11708
11708
  in: stringSchema,
11709
11709
  out: booleanSchema,
11710
- transform: ((input, payload) => {
11711
- let data = input;
11710
+ transform: ((input2, payload) => {
11711
+ let data = input2;
11712
11712
  if (params.case !== "sensitive")
11713
11713
  data = data.toLowerCase();
11714
11714
  if (truthySet.has(data)) {
@@ -11727,8 +11727,8 @@ function _stringbool(Classes, _params) {
11727
11727
  return {};
11728
11728
  }
11729
11729
  }),
11730
- reverseTransform: ((input, _payload) => {
11731
- if (input === true) {
11730
+ reverseTransform: ((input2, _payload) => {
11731
+ if (input2 === true) {
11732
11732
  return truthyArray[0] || "true";
11733
11733
  } else {
11734
11734
  return falsyArray[0] || "false";
@@ -11838,26 +11838,26 @@ function extractDefs(ctx, schema) {
11838
11838
  throw new Error("Unprocessed schema. This is a bug in Zod.");
11839
11839
  const idToSchema = /* @__PURE__ */ new Map();
11840
11840
  for (const entry of ctx.seen.entries()) {
11841
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11842
- if (id) {
11843
- const existing = idToSchema.get(id);
11841
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11842
+ if (id2) {
11843
+ const existing = idToSchema.get(id2);
11844
11844
  if (existing && existing !== entry[0]) {
11845
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11845
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11846
11846
  }
11847
- idToSchema.set(id, entry[0]);
11847
+ idToSchema.set(id2, entry[0]);
11848
11848
  }
11849
11849
  }
11850
11850
  const makeURI = (entry) => {
11851
11851
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
11852
11852
  if (ctx.external) {
11853
11853
  const externalId = ctx.external.registry.get(entry[0])?.id;
11854
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
11854
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
11855
11855
  if (externalId) {
11856
11856
  return { ref: uriGenerator(externalId) };
11857
11857
  }
11858
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11859
- entry[1].defId = id;
11860
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
11858
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11859
+ entry[1].defId = id2;
11860
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
11861
11861
  }
11862
11862
  if (entry[1] === root) {
11863
11863
  return { ref: "#" };
@@ -11905,8 +11905,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11905
11905
  continue;
11906
11906
  }
11907
11907
  }
11908
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11909
- if (id) {
11908
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11909
+ if (id2) {
11910
11910
  extractToDef(entry);
11911
11911
  continue;
11912
11912
  }
@@ -12002,10 +12002,10 @@ function finalize(ctx, schema) {
12002
12002
  } else {
12003
12003
  }
12004
12004
  if (ctx.external?.uri) {
12005
- const id = ctx.external.registry.get(schema)?.id;
12006
- if (!id)
12005
+ const id2 = ctx.external.registry.get(schema)?.id;
12006
+ if (!id2)
12007
12007
  throw new Error("Schema is missing an `id` property");
12008
- result.$id = ctx.external.uri(id);
12008
+ result.$id = ctx.external.uri(id2);
12009
12009
  }
12010
12010
  Object.assign(result, root.def ?? root.schema);
12011
12011
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -12165,9 +12165,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
12165
12165
  json2.type = "number";
12166
12166
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
12167
12167
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
12168
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
12168
+ const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
12169
12169
  if (exMin) {
12170
- if (legacy) {
12170
+ if (legacy2) {
12171
12171
  json2.minimum = exclusiveMinimum;
12172
12172
  json2.exclusiveMinimum = true;
12173
12173
  } else {
@@ -12177,7 +12177,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
12177
12177
  json2.minimum = minimum;
12178
12178
  }
12179
12179
  if (exMax) {
12180
- if (legacy) {
12180
+ if (legacy2) {
12181
12181
  json2.maximum = exclusiveMaximum;
12182
12182
  json2.exclusiveMaximum = true;
12183
12183
  } else {
@@ -12624,9 +12624,9 @@ var allProcessors = {
12624
12624
  optional: optionalProcessor,
12625
12625
  lazy: lazyProcessor
12626
12626
  };
12627
- function toJSONSchema(input, params) {
12628
- if ("_idmap" in input) {
12629
- const registry2 = input;
12627
+ function toJSONSchema(input2, params) {
12628
+ if ("_idmap" in input2) {
12629
+ const registry2 = input2;
12630
12630
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
12631
12631
  const defs = {};
12632
12632
  for (const entry of registry2._idmap.entries()) {
@@ -12654,9 +12654,9 @@ function toJSONSchema(input, params) {
12654
12654
  return { schemas };
12655
12655
  }
12656
12656
  const ctx = initializeContext({ ...params, processors: allProcessors });
12657
- process2(input, ctx);
12658
- extractDefs(ctx, input);
12659
- return finalize(ctx, input);
12657
+ process2(input2, ctx);
12658
+ extractDefs(ctx, input2);
12659
+ return finalize(ctx, input2);
12660
12660
  }
12661
12661
 
12662
12662
  // ../../../node_modules/zod/v4/core/json-schema-generator.js
@@ -13039,7 +13039,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
13039
13039
 
13040
13040
  // ../../../node_modules/zod/v4/classic/schemas.js
13041
13041
  var _installedGroups = /* @__PURE__ */ new WeakMap();
13042
- function _installLazyMethods(inst, group, methods2) {
13042
+ function _installLazyMethods(inst, group, methods3) {
13043
13043
  const proto = Object.getPrototypeOf(inst);
13044
13044
  let installed = _installedGroups.get(proto);
13045
13045
  if (!installed) {
@@ -13049,8 +13049,8 @@ function _installLazyMethods(inst, group, methods2) {
13049
13049
  if (installed.has(group))
13050
13050
  return;
13051
13051
  installed.add(group);
13052
- for (const key in methods2) {
13053
- const fn = methods2[key];
13052
+ for (const key in methods3) {
13053
+ const fn = methods3[key];
13054
13054
  Object.defineProperty(proto, key, {
13055
13055
  configurable: true,
13056
13056
  enumerable: false,
@@ -14861,87 +14861,6 @@ function date4(params) {
14861
14861
  // ../../../node_modules/zod/v4/classic/external.js
14862
14862
  config(en_default());
14863
14863
 
14864
- // ../../shared-contracts/dist/ids.js
14865
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14866
- message: "Identifier must not be empty or whitespace"
14867
- });
14868
- var harnessIdSchema = opaqueIdSchema.brand();
14869
- var hostThreadIdSchema = opaqueIdSchema.brand();
14870
- var hostTurnIdSchema = opaqueIdSchema.brand();
14871
- var hostItemIdSchema = opaqueIdSchema.brand();
14872
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14873
-
14874
- // ../../shared-contracts/dist/harness-plugins.js
14875
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14876
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
14877
- var HARNESS_PLUGIN_LIMIT = 128;
14878
- var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
14879
- var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
14880
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
14881
- var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
14882
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
14883
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
14884
- var harnessInstallationGuideSchema = external_exports.object({
14885
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
14886
- before: localizedTextSchema.optional(),
14887
- after: localizedTextSchema.optional(),
14888
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
14889
- }).strict();
14890
- var pluginPresentationShape = {
14891
- id: installedHarnessPluginIdSchema,
14892
- name: external_exports.string().trim().min(1).max(128),
14893
- version: external_exports.string().min(1).max(128),
14894
- /** Capability-only plugin; omitted for existing session-capable plugins. */
14895
- kind: external_exports.literal("usage").optional(),
14896
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
14897
- iconStyle: external_exports.object({
14898
- vector: external_exports.object({
14899
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
14900
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
14901
- paths: external_exports.array(external_exports.object({
14902
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
14903
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
14904
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
14905
- }).strict()).min(1).max(32)
14906
- }).strict().optional(),
14907
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
14908
- borderRadius: external_exports.number().min(0).max(50).optional(),
14909
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
14910
- }).strict().optional(),
14911
- installation: harnessInstallationGuideSchema.optional(),
14912
- notice: localizedTextSchema.optional(),
14913
- /** The factory accepts a persisted local entrypoint through its construction context. */
14914
- launchCommand: external_exports.literal(true).optional(),
14915
- links: external_exports.object({
14916
- website: documentationUrlSchema.optional(),
14917
- documentation: documentationUrlSchema.optional(),
14918
- installation: documentationUrlSchema.optional()
14919
- }).strict().optional()
14920
- };
14921
- var harnessPluginManifestSchema = external_exports.object({
14922
- manifestVersion: external_exports.literal(1),
14923
- ...pluginPresentationShape,
14924
- adapterApiVersion: external_exports.number().int().positive(),
14925
- entry: pluginRelativeResourceSchema,
14926
- icon: pluginRelativeResourceSchema.optional()
14927
- }).strict();
14928
- var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
14929
- var harnessPluginDescriptorSchema = external_exports.object({
14930
- ...pluginPresentationShape,
14931
- icon: harnessPluginIconSchema.optional()
14932
- }).strict();
14933
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
14934
- var harnessPluginListResultSchema = external_exports.object({
14935
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
14936
- }).strict();
14937
- var harnessPluginConfigurationSchema = external_exports.object({
14938
- version: external_exports.literal(1),
14939
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
14940
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
14941
- message: "Enabled plugin IDs must be unique",
14942
- path: ["enabled"]
14943
- });
14944
-
14945
14864
  // ../../shared-contracts/dist/json-value.js
14946
14865
  function rejectExplicitUndefined(keys) {
14947
14866
  return (value, context) => {
@@ -15001,403 +14920,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
15001
14920
  var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
15002
14921
  var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
15003
14922
 
15004
- // ../../shared-contracts/dist/desktop-extensions.js
15005
- var DESKTOP_EXTENSION_API_VERSION = 1;
15006
- var DESKTOP_EXTENSION_LIMIT = 64;
15007
- var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
15008
- var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
15009
- var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
15010
- var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
15011
- var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
15012
- var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
15013
- var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
15014
- var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
15015
- var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
15016
- var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
15017
- var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
15018
- var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
15019
- var desktopExtensionIdSchema = installedPluginIdSchema;
15020
- var desktopExtensionSlotSchema = external_exports.enum([
15021
- "sidebar.thread-layout",
15022
- "sidebar.thread-badge",
15023
- "appearance.theme"
15024
- ]);
15025
- var desktopExtensionCategorySchema = external_exports.enum([
15026
- "appearance",
15027
- "interface",
15028
- "workflow",
15029
- "analytics",
15030
- "integrations",
15031
- "tools"
15032
- ]);
15033
- var extensionName = external_exports.string().trim().min(1).max(128);
15034
- function desktopExtensionScreenshotMimeType(resource) {
15035
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15036
- case "png":
15037
- return "image/png";
15038
- case "jpg":
15039
- case "jpeg":
15040
- return "image/jpeg";
15041
- case "webp":
15042
- return "image/webp";
15043
- default:
15044
- return void 0;
14923
+ // ../../shared-contracts/dist/errors.js
14924
+ var codexhostErrorSchema = external_exports.strictObject({
14925
+ code: external_exports.string().min(1),
14926
+ message: external_exports.string().min(1),
14927
+ retryable: external_exports.boolean(),
14928
+ diagnostic: external_exports.string().min(1).optional(),
14929
+ stage: external_exports.string().min(1).optional(),
14930
+ durationMs: external_exports.number().int().nonnegative().optional(),
14931
+ stderrTail: external_exports.string().min(1).optional()
14932
+ }).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
14933
+
14934
+ // ../../shared-contracts/dist/harness-presentation.js
14935
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14936
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14937
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14938
+ label: displayText(256).optional(),
14939
+ description: displayText(1024).optional()
14940
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14941
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14942
+
14943
+ // ../../shared-contracts/dist/ids.js
14944
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14945
+ message: "Identifier must not be empty or whitespace"
14946
+ });
14947
+ var harnessIdSchema = opaqueIdSchema.brand();
14948
+ var hostThreadIdSchema = opaqueIdSchema.brand();
14949
+ var hostTurnIdSchema = opaqueIdSchema.brand();
14950
+ var hostItemIdSchema = opaqueIdSchema.brand();
14951
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
14952
+
14953
+ // ../../shared-contracts/dist/harness-permission-modes.js
14954
+ var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
14955
+ var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
14956
+ var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
14957
+ var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
14958
+ var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14959
+ message: "Value must not be empty or whitespace"
14960
+ });
14961
+ var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
14962
+ var harnessPermissionModeSchema = external_exports.object({
14963
+ id: harnessPermissionModeIdSchema,
14964
+ label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
14965
+ description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
14966
+ dangerous: external_exports.boolean().optional(),
14967
+ localizations: harnessLocalizationsSchema.optional()
14968
+ }).strict();
14969
+ var harnessPermissionModeCatalogSchema = external_exports.object({
14970
+ modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
14971
+ defaultModeId: harnessPermissionModeIdSchema
14972
+ }).strict().superRefine((catalog, context) => {
14973
+ const ids = /* @__PURE__ */ new Set();
14974
+ for (const [index, mode] of catalog.modes.entries()) {
14975
+ if (ids.has(mode.id)) {
14976
+ context.addIssue({
14977
+ code: "custom",
14978
+ message: "Permission Mode IDs must be unique",
14979
+ path: ["modes", index, "id"]
14980
+ });
14981
+ }
14982
+ ids.add(mode.id);
15045
14983
  }
15046
- }
15047
- function desktopExtensionAssetMimeType(resource) {
15048
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15049
- case "gif":
15050
- return "image/gif";
15051
- case "svg":
15052
- return "image/svg+xml";
15053
- case "woff2":
15054
- return "font/woff2";
15055
- case "json":
15056
- return "application/json";
15057
- case "css":
15058
- return "text/css";
15059
- default:
15060
- return desktopExtensionScreenshotMimeType(resource);
15061
- }
15062
- }
15063
- var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
15064
- var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
15065
- var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
15066
- var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
15067
- const { username, password } = new URL(value);
15068
- return !username && !password && !/[\\\s]/u.test(value);
15069
- }, "URL must not contain credentials, backslashes, or whitespace");
15070
- function localizedText(text) {
15071
- return external_exports.strictObject({ en: text, "zh-CN": text });
15072
- }
15073
- var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15074
- var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
15075
- var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
15076
- var settingField = {
15077
- key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
15078
- label: desktopExtensionLocalizedTextSchema,
15079
- description: desktopExtensionLocalizedTextSchema.optional()
15080
- };
15081
- var numericSetting = {
15082
- ...settingField,
15083
- step: external_exports.number().positive().optional(),
15084
- default: external_exports.number().optional()
15085
- };
15086
- var settingOption = external_exports.strictObject({
15087
- value: external_exports.string(),
15088
- label: desktopExtensionLocalizedTextSchema
15089
- });
15090
- var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
15091
- external_exports.strictObject({
15092
- ...settingField,
15093
- type: external_exports.literal("boolean"),
15094
- default: external_exports.boolean().optional()
15095
- }),
15096
- external_exports.strictObject({
15097
- ...settingField,
15098
- type: external_exports.literal("string"),
15099
- placeholder: desktopExtensionLocalizedTextSchema.optional(),
15100
- default: external_exports.string().optional()
15101
- }),
15102
- external_exports.strictObject({
15103
- ...numericSetting,
15104
- type: external_exports.literal("number"),
15105
- min: external_exports.number().optional(),
15106
- max: external_exports.number().optional()
15107
- }),
15108
- external_exports.strictObject({
15109
- ...numericSetting,
15110
- type: external_exports.literal("range"),
15111
- min: external_exports.number(),
15112
- max: external_exports.number()
15113
- }),
15114
- external_exports.strictObject({
15115
- ...settingField,
15116
- type: external_exports.literal("select"),
15117
- options: external_exports.array(settingOption).min(1),
15118
- default: external_exports.string().optional()
15119
- })
15120
- ]).superRefine((field2, ctx) => {
15121
- const issue2 = (path9, message) => ctx.addIssue({ code: "custom", path: [path9], message });
15122
- if (field2.type === "number" || field2.type === "range") {
15123
- const { min = -Infinity, max = Infinity, default: value } = field2;
15124
- if (min > max)
15125
- issue2("max", "Must be at least min");
15126
- if (value !== void 0 && (value < min || value > max))
15127
- issue2("default", "Must be within min and max");
15128
- } else if (field2.type === "select") {
15129
- const values = new Set(field2.options.map(({ value }) => value));
15130
- if (values.size !== field2.options.length)
15131
- issue2("options", "Duplicate option values");
15132
- if (field2.default !== void 0 && !values.has(field2.default))
15133
- issue2("default", "Must match an option value");
15134
- }
15135
- });
15136
- var manifestHeader = external_exports.object({
15137
- manifestVersion: external_exports.int().positive(),
15138
- id: desktopExtensionIdSchema,
15139
- name: external_exports.union([extensionName, localizedText(extensionName)]),
15140
- version: external_exports.string().min(1).max(128),
15141
- desktopApi: external_exports.int().positive()
15142
- }).passthrough();
15143
- var desktopExtensionManifestSchema = manifestHeader.extend({
15144
- manifestVersion: external_exports.literal(1),
15145
- desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
15146
- description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
15147
- author: external_exports.string().trim().min(1).max(128).optional(),
15148
- repository: desktopExtensionHttpUrlSchema.optional(),
15149
- details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
15150
- icon: imagePathSchema.optional(),
15151
- screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
15152
- desktop: external_exports.strictObject({
15153
- script: pluginRelativeResourceSchema,
15154
- style: pluginRelativeResourceSchema.optional()
15155
- }).optional(),
15156
- backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
15157
- slots: slotsSchema.default(() => []),
15158
- settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
15159
- categories: categoriesSchema.optional()
15160
- }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
15161
- var desktopExtensionConfigurationSchema = external_exports.strictObject({
15162
- version: external_exports.literal(1),
15163
- revision: external_exports.int().nonnegative(),
15164
- enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
15165
- reloadToken: external_exports.uuid().optional()
15166
- });
15167
- var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
15168
- var desktopExtensionStatusSchema = external_exports.strictObject({
15169
- state: external_exports.enum([
15170
- "running",
15171
- "disabled",
15172
- "invalid",
15173
- "incompatible",
15174
- "conflict",
15175
- "failed",
15176
- "waiting"
15177
- ]),
15178
- hash: desktopExtensionHashSchema.optional(),
15179
- error: external_exports.string().optional(),
15180
- conflictWith: desktopExtensionIdSchema.optional()
15181
- });
15182
- var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
15183
- controllerPid: external_exports.int().positive(),
15184
- targetId: external_exports.string().nullable(),
15185
- updatedAt: external_exports.iso.datetime(),
15186
- handledReloadToken: external_exports.uuid().optional(),
15187
- extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
15188
- });
15189
- var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
15190
- function isGitHubDesktopExtensionZipballUrl(url2) {
15191
- return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15192
- }
15193
- var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15194
- const url2 = new URL(input);
15195
- 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);
15196
- }, "Expected a .zip download URL or a GitHub zipball URL");
15197
- var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
15198
- id: desktopExtensionIdSchema,
15199
- version: external_exports.string().trim().min(1).max(128),
15200
- name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
15201
- description: localizedText(external_exports.string().trim().min(1).max(4096)),
15202
- details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
15203
- author: external_exports.string().trim().min(1).max(128),
15204
- repository: desktopExtensionHttpUrlSchema,
15205
- stars: external_exports.number().int().min(0).optional(),
15206
- downloads: external_exports.number().int().min(0).optional(),
15207
- categories: categoriesSchema.optional(),
15208
- trustTier: desktopExtensionTrustTierSchema.default("community"),
15209
- icon: desktopExtensionHttpUrlSchema.optional(),
15210
- screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15211
- downloadUrl: desktopExtensionZipUrlSchema,
15212
- sha256: desktopExtensionHashSchema,
15213
- slots: slotsSchema.optional(),
15214
- publishedAt: external_exports.string().optional(),
15215
- updatedAt: external_exports.string().optional(),
15216
- minCodexHostVersion: external_exports.string().optional()
15217
- });
15218
- var desktopExtensionCatalogSchema = external_exports.strictObject({
15219
- schemaVersion: external_exports.literal(1),
15220
- generatedAt: external_exports.string(),
15221
- extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
15222
- });
15223
- var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
15224
- var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
15225
- var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
15226
- var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
15227
- var extensionIdParams = { id: desktopExtensionIdSchema };
15228
- var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
15229
- ...extensionIdParams,
15230
- path: desktopExtensionAssetPathSchema
15231
- });
15232
- var desktopExtensionsAssetResultSchema = external_exports.strictObject({
15233
- mimeType: external_exports.string(),
15234
- dataUrl: external_exports.string()
15235
- });
15236
- var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
15237
- var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
15238
- ...extensionIdParams,
15239
- values: jsonObjectSchema
15240
- });
15241
- var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
15242
- var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
15243
- var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
15244
- ...extensionIdParams,
15245
- method: desktopExtensionBackendMethodSchema,
15246
- params: jsonValueSchema.optional()
15247
- });
15248
- var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
15249
- result: jsonValueSchema
15250
- });
15251
-
15252
- // ../../shared-contracts/dist/desktop-extension-management.js
15253
- var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
15254
- var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
15255
- var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
15256
- var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
15257
- var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
15258
- var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
15259
- var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
15260
- var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
15261
- DESKTOP_EXTENSIONS_LIST_METHOD,
15262
- DESKTOP_EXTENSIONS_ENABLE_METHOD,
15263
- DESKTOP_EXTENSIONS_DISABLE_METHOD,
15264
- DESKTOP_EXTENSIONS_RECOVER_METHOD,
15265
- DESKTOP_EXTENSIONS_CATALOG_METHOD,
15266
- DESKTOP_EXTENSIONS_INSTALL_METHOD,
15267
- DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
15268
- DESKTOP_EXTENSIONS_ASSET_METHOD,
15269
- DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
15270
- DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
15271
- DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
15272
- ];
15273
- var revisionSchema = external_exports.int().nonnegative();
15274
- var desktopExtensionsListParamsSchema = external_exports.strictObject({});
15275
- var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
15276
- id: desktopExtensionIdSchema,
15277
- expectedRevision: revisionSchema
15278
- });
15279
- var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
15280
- expectedRevision: revisionSchema.optional()
15281
- });
15282
- var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
15283
- var desktopExtensionListItemSchema = external_exports.strictObject({
15284
- // An invalid discovery can have a directory name that isn't a valid extension ID.
15285
- id: external_exports.string().min(1),
15286
- manifest: desktopExtensionManifestSchema.optional(),
15287
- iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
15288
- screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15289
- enabled: external_exports.boolean(),
15290
- status: desktopExtensionStatusSchema
15291
- });
15292
- var desktopExtensionsListResultSchema = external_exports.strictObject({
15293
- configuration: desktopExtensionConfigurationSchema,
15294
- desktopConnected: external_exports.boolean(),
15295
- diagnostics: external_exports.array(external_exports.string()),
15296
- extensions: external_exports.array(desktopExtensionListItemSchema)
15297
- });
15298
- var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
15299
- forceRefresh: external_exports.boolean().optional()
15300
- });
15301
- var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
15302
- catalogUrl: external_exports.string(),
15303
- source: external_exports.enum(["remote", "fallback"]),
15304
- fetchedAt: external_exports.string(),
15305
- cached: external_exports.boolean(),
15306
- extensions: desktopExtensionCatalogSchema.shape.extensions,
15307
- error: external_exports.string().optional()
15308
- });
15309
- var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
15310
- source: external_exports.discriminatedUnion("type", [
15311
- external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
15312
- external_exports.strictObject({
15313
- type: external_exports.literal("url"),
15314
- url: desktopExtensionHttpUrlSchema,
15315
- expectedSha256: desktopExtensionHashSchema.optional()
15316
- }),
15317
- external_exports.strictObject({
15318
- type: external_exports.literal("zip-base64"),
15319
- fileName: external_exports.string().trim().min(1).max(255),
15320
- contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
15321
- })
15322
- ])
15323
- });
15324
- var desktopExtensionsInstallResultSchema = external_exports.strictObject({
15325
- extensionId: desktopExtensionIdSchema,
15326
- version: external_exports.string().min(1),
15327
- replaced: external_exports.boolean(),
15328
- installedPath: external_exports.string(),
15329
- list: desktopExtensionsListResultSchema
15330
- });
15331
- var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
15332
- id: desktopExtensionIdSchema
15333
- });
15334
- var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
15335
- removedId: desktopExtensionIdSchema,
15336
- list: desktopExtensionsListResultSchema
15337
- });
15338
- var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
15339
- external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
15340
- external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
15341
- external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
15342
- ]);
15343
-
15344
- // ../../shared-contracts/dist/errors.js
15345
- var codexhostErrorSchema = external_exports.strictObject({
15346
- code: external_exports.string().min(1),
15347
- message: external_exports.string().min(1),
15348
- retryable: external_exports.boolean(),
15349
- diagnostic: external_exports.string().min(1).optional(),
15350
- stage: external_exports.string().min(1).optional(),
15351
- durationMs: external_exports.number().int().nonnegative().optional(),
15352
- stderrTail: external_exports.string().min(1).optional()
15353
- }).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
15354
-
15355
- // ../../shared-contracts/dist/harness-presentation.js
15356
- var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15357
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
15358
- var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15359
- label: displayText(256).optional(),
15360
- description: displayText(1024).optional()
15361
- }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15362
- var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15363
-
15364
- // ../../shared-contracts/dist/harness-permission-modes.js
15365
- var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
15366
- var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
15367
- var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
15368
- var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
15369
- var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15370
- message: "Value must not be empty or whitespace"
15371
- });
15372
- var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
15373
- var harnessPermissionModeSchema = external_exports.object({
15374
- id: harnessPermissionModeIdSchema,
15375
- label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15376
- description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15377
- dangerous: external_exports.boolean().optional(),
15378
- localizations: harnessLocalizationsSchema.optional()
15379
- }).strict();
15380
- var harnessPermissionModeCatalogSchema = external_exports.object({
15381
- modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
15382
- defaultModeId: harnessPermissionModeIdSchema
15383
- }).strict().superRefine((catalog, context) => {
15384
- const ids = /* @__PURE__ */ new Set();
15385
- for (const [index, mode] of catalog.modes.entries()) {
15386
- if (ids.has(mode.id)) {
15387
- context.addIssue({
15388
- code: "custom",
15389
- message: "Permission Mode IDs must be unique",
15390
- path: ["modes", index, "id"]
15391
- });
15392
- }
15393
- ids.add(mode.id);
15394
- }
15395
- if (!ids.has(catalog.defaultModeId)) {
15396
- context.addIssue({
15397
- code: "custom",
15398
- message: "Default Permission Mode must exist in the catalog",
15399
- path: ["defaultModeId"]
15400
- });
14984
+ if (!ids.has(catalog.defaultModeId)) {
14985
+ context.addIssue({
14986
+ code: "custom",
14987
+ message: "Default Permission Mode must exist in the catalog",
14988
+ path: ["defaultModeId"]
14989
+ });
15401
14990
  }
15402
14991
  });
15403
14992
  var threadPermissionModeSelectParamsSchema = external_exports.object({
@@ -15405,6 +14994,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
15405
14994
  permissionModeId: harnessPermissionModeIdSchema
15406
14995
  }).strict();
15407
14996
 
14997
+ // ../../shared-contracts/dist/harness-route-limit.js
14998
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
14999
+
15408
15000
  // ../../shared-contracts/dist/thread-usage.js
15409
15001
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15410
15002
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -15430,14 +15022,14 @@ var usageMeasurementsSchema = external_exports.object({
15430
15022
  outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15431
15023
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15432
15024
  }).strict();
15433
- var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
15025
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
15434
15026
  var composerIndicatorsSchema = external_exports.array(external_exports.object({
15435
15027
  kind: external_exports.literal("countdown"),
15436
15028
  id: external_exports.string().min(1).max(64),
15437
15029
  expiresAtUnix: nonNegativeSafeIntegerSchema,
15438
15030
  label: indicatorTextSchema(256).optional(),
15439
15031
  tooltip: indicatorTextSchema(1024).optional()
15440
- }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
15032
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
15441
15033
  message: "Composer indicator IDs must be unique"
15442
15034
  });
15443
15035
  var threadUsageSnapshotSchema = external_exports.object({
@@ -15463,6 +15055,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15463
15055
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15464
15056
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15465
15057
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15058
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15466
15059
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15467
15060
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15468
15061
  }).strict().superRefine((usage, context) => {
@@ -15590,10 +15183,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
15590
15183
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
15591
15184
  message: "Value must not be empty or whitespace"
15592
15185
  });
15593
- var harnessModelRefIdSchema = nonBlankTextSchema2.max(HARNESS_MODEL_REF_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Model Ref must use transport-safe opaque characters").brand();
15186
+ var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !new RegExp("\\p{Cc}", "u").test(id2), "Model Ref must not contain control characters").brand();
15187
+ var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
15594
15188
  var harnessModelRefSchema = external_exports.object({
15595
- id: harnessModelRefIdSchema
15189
+ id: harnessModelRefIdSchema,
15190
+ serviceTier: harnessModelServiceTierSchema.optional()
15596
15191
  }).strict();
15192
+ function sameHarnessModelRef(left, right) {
15193
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
15194
+ }
15597
15195
  var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
15598
15196
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
15599
15197
  var harnessThinkingOptionSchema = external_exports.object({
@@ -15607,7 +15205,15 @@ var harnessModelSchema = external_exports.object({
15607
15205
  /** Optional opaque selection for this same Model with priority processing enabled. */
15608
15206
  fastModel: harnessModelRefSchema.optional(),
15609
15207
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15610
- }).strict();
15208
+ }).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
15209
+ path: ["fastModel", "id"],
15210
+ message: "A tiered Fast Model must share the base Model ID"
15211
+ });
15212
+ function catalogModelForRef(catalog, ref) {
15213
+ if (!ref)
15214
+ return void 0;
15215
+ return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
15216
+ }
15611
15217
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
15612
15218
  const ids = /* @__PURE__ */ new Set();
15613
15219
  for (const [index, option] of options.entries()) {
@@ -15627,26 +15233,26 @@ var harnessModelCatalogSchema = external_exports.object({
15627
15233
  thinkingOptions: harnessThinkingOptionsSchema,
15628
15234
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
15629
15235
  }).strict().superRefine((catalog, context) => {
15630
- const refs = /* @__PURE__ */ new Set();
15631
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
15236
+ const refs = [];
15237
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
15632
15238
  for (const [index, model2] of catalog.models.entries()) {
15633
- if (refs.has(model2.ref.id)) {
15239
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
15634
15240
  context.addIssue({
15635
15241
  code: "custom",
15636
15242
  message: "Model Catalog refs must be unique",
15637
15243
  path: ["models", index, "ref", "id"]
15638
15244
  });
15639
15245
  }
15640
- refs.add(model2.ref.id);
15246
+ refs.push(model2.ref);
15641
15247
  if (model2.fastModel) {
15642
- if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15248
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
15643
15249
  context.addIssue({
15644
15250
  code: "custom",
15645
15251
  message: "Fast Model refs must be distinct and unique",
15646
15252
  path: ["models", index, "fastModel"]
15647
15253
  });
15648
15254
  }
15649
- refs.add(model2.fastModel.id);
15255
+ refs.push(model2.fastModel);
15650
15256
  }
15651
15257
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15652
15258
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -15667,7 +15273,7 @@ var harnessModelCatalogSchema = external_exports.object({
15667
15273
  }
15668
15274
  }
15669
15275
  }
15670
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
15276
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
15671
15277
  context.addIssue({
15672
15278
  code: "custom",
15673
15279
  message: "Default Model must exist in the Model Catalog",
@@ -15707,7 +15313,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15707
15313
  observe: external_exports.boolean()
15708
15314
  }).strict().optional(),
15709
15315
  /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15710
- steer: external_exports.boolean().optional()
15316
+ steer: external_exports.boolean().optional(),
15317
+ /**
15318
+ * True when the native plan (task list) outlives the Turn that changed it, so a reopened
15319
+ * Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
15320
+ */
15321
+ persistentPlan: external_exports.boolean().optional()
15711
15322
  }).strict();
15712
15323
  var harnessConfigurationStateSchema = external_exports.object({
15713
15324
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15716,7 +15327,7 @@ var harnessConfigurationStateSchema = external_exports.object({
15716
15327
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15717
15328
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
15718
15329
  }).strict().superRefine((state, context) => {
15719
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
15330
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
15720
15331
  context.addIssue({
15721
15332
  code: "custom",
15722
15333
  message: "Effective Thinking option must be currently available",
@@ -15724,150 +15335,698 @@ var harnessConfigurationStateSchema = external_exports.object({
15724
15335
  });
15725
15336
  }
15726
15337
  });
15727
- var harnessWebUiCapabilitySchema = external_exports.object({
15728
- open: external_exports.literal(true)
15729
- }).strict();
15730
- var readyHarnessInspectionSchema = external_exports.object({
15731
- status: external_exports.literal("ready"),
15732
- catalog: harnessModelCatalogSchema,
15733
- permissionModes: harnessPermissionModeCatalogSchema.optional(),
15734
- capabilities: harnessSessionCapabilitiesSchema,
15735
- webUi: harnessWebUiCapabilitySchema.optional()
15736
- }).strict().superRefine((inspection, context) => {
15737
- const selectable = inspection.capabilities.configuration.selectPermissionMode;
15738
- if (selectable !== Boolean(inspection.permissionModes)) {
15739
- context.addIssue({
15740
- code: "custom",
15741
- message: "Permission Mode catalog and capability must agree",
15742
- path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
15743
- });
15744
- }
15338
+ var harnessWebUiCapabilitySchema = external_exports.object({
15339
+ open: external_exports.literal(true)
15340
+ }).strict();
15341
+ var readyHarnessInspectionSchema = external_exports.object({
15342
+ status: external_exports.literal("ready"),
15343
+ catalog: harnessModelCatalogSchema,
15344
+ permissionModes: harnessPermissionModeCatalogSchema.optional(),
15345
+ capabilities: harnessSessionCapabilitiesSchema,
15346
+ webUi: harnessWebUiCapabilitySchema.optional()
15347
+ }).strict().superRefine((inspection, context) => {
15348
+ const selectable = inspection.capabilities.configuration.selectPermissionMode;
15349
+ if (selectable !== Boolean(inspection.permissionModes)) {
15350
+ context.addIssue({
15351
+ code: "custom",
15352
+ message: "Permission Mode catalog and capability must agree",
15353
+ path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
15354
+ });
15355
+ }
15356
+ });
15357
+ var failedHarnessInspectionSchema = external_exports.object({
15358
+ status: external_exports.enum(["notInstalled", "unavailable", "error"]),
15359
+ error: codexhostErrorSchema
15360
+ }).strict();
15361
+ var harnessInspectionSchema = external_exports.union([
15362
+ readyHarnessInspectionSchema,
15363
+ failedHarnessInspectionSchema
15364
+ ]);
15365
+ var harnessInspectParamsSchema = external_exports.object({
15366
+ harnessId: harnessIdSchema,
15367
+ cwd: nonBlankTextSchema2.max(16384).optional(),
15368
+ refresh: external_exports.boolean().optional(),
15369
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15370
+ purpose: external_exports.literal("availability").optional(),
15371
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
15372
+ }).strict();
15373
+ var harnessWebUiOpenParamsSchema = external_exports.object({
15374
+ harnessId: harnessIdSchema
15375
+ }).strict();
15376
+ var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
15377
+ var threadModelSelectParamsSchema = external_exports.object({
15378
+ threadId: hostThreadIdSchema,
15379
+ model: harnessModelRefSchema
15380
+ }).strict();
15381
+ var threadThinkingSelectParamsSchema = external_exports.object({
15382
+ threadId: hostThreadIdSchema,
15383
+ thinkingOptionId: harnessThinkingOptionIdSchema
15384
+ }).strict();
15385
+ var threadInspectionParamsSchema = external_exports.object({
15386
+ threadId: hostThreadIdSchema,
15387
+ includeReferenceCapability: external_exports.boolean().optional()
15388
+ }).strict();
15389
+ var codexThreadInspectionSchema = external_exports.object({
15390
+ owner: external_exports.literal("codex"),
15391
+ locked: external_exports.boolean(),
15392
+ effectiveModel: harnessModelRefSchema.optional(),
15393
+ resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15394
+ effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15395
+ effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15396
+ history: harnessHistoryCapabilitiesSchema.optional(),
15397
+ supportsThreadReferences: external_exports.literal(true).optional()
15398
+ }).strict();
15399
+ var externalThreadInspectionSchema = external_exports.object({
15400
+ owner: external_exports.literal("external"),
15401
+ harnessId: nonBlankTextSchema2.max(256),
15402
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
15403
+ effectiveModel: harnessModelRefSchema.optional(),
15404
+ resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15405
+ effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15406
+ availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15407
+ effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15408
+ /** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
15409
+ catalog: harnessModelCatalogSchema.optional(),
15410
+ history: harnessHistoryCapabilitiesSchema,
15411
+ usage: threadUsageSnapshotSchema.optional(),
15412
+ locked: external_exports.literal(true)
15413
+ }).strict();
15414
+ var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
15415
+ codexThreadInspectionSchema,
15416
+ externalThreadInspectionSchema
15417
+ ]);
15418
+ var threadOwnershipListParamsSchema = external_exports.object({
15419
+ threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15420
+ }).strict().superRefine(({ threadIds }, context) => {
15421
+ const seen = /* @__PURE__ */ new Set();
15422
+ for (const [index, threadId] of threadIds.entries()) {
15423
+ if (seen.has(threadId)) {
15424
+ context.addIssue({
15425
+ code: "custom",
15426
+ message: "Thread ownership-list IDs must be unique",
15427
+ path: ["threadIds", index]
15428
+ });
15429
+ }
15430
+ seen.add(threadId);
15431
+ }
15432
+ });
15433
+ var codexThreadOwnershipSchema = external_exports.object({
15434
+ threadId: hostThreadIdSchema,
15435
+ owner: external_exports.literal("codex")
15436
+ }).strict();
15437
+ var externalThreadOwnershipSchema = external_exports.object({
15438
+ threadId: hostThreadIdSchema,
15439
+ owner: external_exports.literal("external"),
15440
+ harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
15441
+ }).strict();
15442
+ var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
15443
+ codexThreadOwnershipSchema,
15444
+ externalThreadOwnershipSchema
15445
+ ]);
15446
+ var threadOwnershipListResultSchema = external_exports.object({
15447
+ threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15448
+ }).strict().superRefine(({ threads }, context) => {
15449
+ const seen = /* @__PURE__ */ new Set();
15450
+ for (const [index, thread2] of threads.entries()) {
15451
+ if (seen.has(thread2.threadId)) {
15452
+ context.addIssue({
15453
+ code: "custom",
15454
+ message: "Thread ownership-list results must be unique",
15455
+ path: ["threads", index, "threadId"]
15456
+ });
15457
+ }
15458
+ seen.add(thread2.threadId);
15459
+ }
15460
+ });
15461
+ var threadSteeringInspectParamsSchema = external_exports.object({
15462
+ threadId: hostThreadIdSchema,
15463
+ /** The text about to be steered; a Harness command always stops and restarts. */
15464
+ text: external_exports.string().optional()
15465
+ }).strict();
15466
+ var threadSteeringContextSchema = external_exports.object({
15467
+ kind: external_exports.literal("application"),
15468
+ value: external_exports.string().transform((text2, context) => {
15469
+ try {
15470
+ return JSON.parse(text2);
15471
+ } catch {
15472
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15473
+ return external_exports.NEVER;
15474
+ }
15475
+ }).pipe(external_exports.object({
15476
+ expectedTurnId: hostTurnIdSchema,
15477
+ clientUserMessageId: external_exports.string().min(1),
15478
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15479
+ }).strict())
15480
+ }).strict().transform((context) => context.value);
15481
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15482
+ var threadSteeringInspectResultSchema = external_exports.object({
15483
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15484
+ }).strict();
15485
+
15486
+ // ../../shared-contracts/dist/harness-plugins.js
15487
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15488
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15489
+ var HARNESS_PLUGIN_LIMIT = 128;
15490
+ var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
15491
+ var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
15492
+ var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
15493
+ var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
15494
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15495
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15496
+ var harnessInstallationGuideSchema = external_exports.object({
15497
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15498
+ before: localizedTextSchema.optional(),
15499
+ after: localizedTextSchema.optional(),
15500
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15501
+ }).strict();
15502
+ var pluginPresentationShape = {
15503
+ id: installedHarnessPluginIdSchema,
15504
+ name: external_exports.string().trim().min(1).max(128),
15505
+ version: external_exports.string().min(1).max(128),
15506
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15507
+ kind: external_exports.literal("usage").optional(),
15508
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15509
+ iconStyle: external_exports.object({
15510
+ vector: external_exports.object({
15511
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15512
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15513
+ paths: external_exports.array(external_exports.object({
15514
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15515
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15516
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15517
+ }).strict()).min(1).max(32)
15518
+ }).strict().optional(),
15519
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15520
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15521
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15522
+ }).strict().optional(),
15523
+ installation: harnessInstallationGuideSchema.optional(),
15524
+ notice: localizedTextSchema.optional(),
15525
+ /** The factory accepts a persisted local entrypoint through its construction context. */
15526
+ launchCommand: external_exports.literal(true).optional(),
15527
+ links: external_exports.object({
15528
+ website: documentationUrlSchema.optional(),
15529
+ documentation: documentationUrlSchema.optional(),
15530
+ installation: documentationUrlSchema.optional()
15531
+ }).strict().optional()
15532
+ };
15533
+ var harnessPluginManifestSchema = external_exports.object({
15534
+ manifestVersion: external_exports.literal(1),
15535
+ ...pluginPresentationShape,
15536
+ adapterApiVersion: external_exports.number().int().positive(),
15537
+ entry: pluginRelativeResourceSchema,
15538
+ icon: pluginRelativeResourceSchema.optional()
15539
+ }).strict();
15540
+ var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
15541
+ var harnessPluginDescriptorSchema = external_exports.object({
15542
+ ...pluginPresentationShape,
15543
+ icon: harnessPluginIconSchema.optional()
15544
+ }).strict();
15545
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
15546
+ var harnessPluginListResultSchema = external_exports.object({
15547
+ plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
15548
+ }).strict();
15549
+ var harnessPluginConfigurationSchema = external_exports.object({
15550
+ version: external_exports.literal(1),
15551
+ enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15552
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15553
+ message: "Enabled plugin IDs must be unique",
15554
+ path: ["enabled"]
15555
+ });
15556
+
15557
+ // ../../shared-contracts/dist/desktop-extensions.js
15558
+ var DESKTOP_EXTENSION_API_VERSION = 1;
15559
+ var DESKTOP_EXTENSION_LIMIT = 64;
15560
+ var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
15561
+ var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
15562
+ var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
15563
+ var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
15564
+ var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
15565
+ var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
15566
+ var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
15567
+ var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
15568
+ var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
15569
+ var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
15570
+ var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
15571
+ var desktopExtensionIdSchema = installedPluginIdSchema;
15572
+ var desktopExtensionSlotSchema = external_exports.enum([
15573
+ "sidebar.thread-layout",
15574
+ "sidebar.thread-badge",
15575
+ "appearance.theme"
15576
+ ]);
15577
+ var desktopExtensionCategorySchema = external_exports.enum([
15578
+ "appearance",
15579
+ "interface",
15580
+ "workflow",
15581
+ "analytics",
15582
+ "integrations",
15583
+ "tools"
15584
+ ]);
15585
+ var extensionName = external_exports.string().trim().min(1).max(128);
15586
+ function desktopExtensionScreenshotMimeType(resource) {
15587
+ switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15588
+ case "png":
15589
+ return "image/png";
15590
+ case "jpg":
15591
+ case "jpeg":
15592
+ return "image/jpeg";
15593
+ case "webp":
15594
+ return "image/webp";
15595
+ default:
15596
+ return void 0;
15597
+ }
15598
+ }
15599
+ var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
15600
+ var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
15601
+ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
15602
+ const { username, password } = new URL(value);
15603
+ return !username && !password && !/[\\\s]/u.test(value);
15604
+ }, "URL must not contain credentials, backslashes, or whitespace");
15605
+ function localizedText(text2) {
15606
+ return external_exports.strictObject({ en: text2, "zh-CN": text2 });
15607
+ }
15608
+ var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15609
+ var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
15610
+ var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
15611
+ var settingField = {
15612
+ key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
15613
+ label: desktopExtensionLocalizedTextSchema,
15614
+ description: desktopExtensionLocalizedTextSchema.optional()
15615
+ };
15616
+ var numericSetting = {
15617
+ ...settingField,
15618
+ step: external_exports.number().positive().optional(),
15619
+ default: external_exports.number().optional()
15620
+ };
15621
+ var settingOption = external_exports.strictObject({
15622
+ value: external_exports.string(),
15623
+ label: desktopExtensionLocalizedTextSchema
15624
+ });
15625
+ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
15626
+ external_exports.strictObject({
15627
+ ...settingField,
15628
+ type: external_exports.literal("boolean"),
15629
+ default: external_exports.boolean().optional()
15630
+ }),
15631
+ external_exports.strictObject({
15632
+ ...settingField,
15633
+ type: external_exports.literal("string"),
15634
+ placeholder: desktopExtensionLocalizedTextSchema.optional(),
15635
+ default: external_exports.string().optional()
15636
+ }),
15637
+ external_exports.strictObject({
15638
+ ...numericSetting,
15639
+ type: external_exports.literal("number"),
15640
+ min: external_exports.number().optional(),
15641
+ max: external_exports.number().optional()
15642
+ }),
15643
+ external_exports.strictObject({
15644
+ ...numericSetting,
15645
+ type: external_exports.literal("range"),
15646
+ min: external_exports.number(),
15647
+ max: external_exports.number()
15648
+ }),
15649
+ external_exports.strictObject({
15650
+ ...settingField,
15651
+ type: external_exports.literal("select"),
15652
+ options: external_exports.array(settingOption).min(1),
15653
+ default: external_exports.string().optional()
15654
+ })
15655
+ ]).superRefine((field2, ctx) => {
15656
+ const issue2 = (path9, message) => ctx.addIssue({ code: "custom", path: [path9], message });
15657
+ if (field2.type === "number" || field2.type === "range") {
15658
+ const { min = -Infinity, max = Infinity, default: value } = field2;
15659
+ if (min > max)
15660
+ issue2("max", "Must be at least min");
15661
+ if (value !== void 0 && (value < min || value > max))
15662
+ issue2("default", "Must be within min and max");
15663
+ } else if (field2.type === "select") {
15664
+ const values = new Set(field2.options.map(({ value }) => value));
15665
+ if (values.size !== field2.options.length)
15666
+ issue2("options", "Duplicate option values");
15667
+ if (field2.default !== void 0 && !values.has(field2.default))
15668
+ issue2("default", "Must match an option value");
15669
+ }
15670
+ });
15671
+ var manifestHeader = external_exports.object({
15672
+ manifestVersion: external_exports.int().positive(),
15673
+ id: desktopExtensionIdSchema,
15674
+ name: external_exports.union([extensionName, localizedText(extensionName)]),
15675
+ version: external_exports.string().min(1).max(128),
15676
+ desktopApi: external_exports.int().positive()
15677
+ }).passthrough();
15678
+ var desktopExtensionManifestSchema = manifestHeader.extend({
15679
+ manifestVersion: external_exports.literal(1),
15680
+ desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
15681
+ description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
15682
+ author: external_exports.string().trim().min(1).max(128).optional(),
15683
+ repository: desktopExtensionHttpUrlSchema.optional(),
15684
+ details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
15685
+ icon: imagePathSchema.optional(),
15686
+ screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
15687
+ desktop: external_exports.strictObject({
15688
+ script: pluginRelativeResourceSchema,
15689
+ style: pluginRelativeResourceSchema.optional()
15690
+ }).optional(),
15691
+ backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
15692
+ slots: slotsSchema.default(() => []),
15693
+ settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
15694
+ categories: categoriesSchema.optional()
15695
+ }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
15696
+ var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
15697
+ var desktopExtensionStatusSchema = external_exports.strictObject({
15698
+ state: external_exports.enum([
15699
+ "running",
15700
+ "disabled",
15701
+ "invalid",
15702
+ "incompatible",
15703
+ "conflict",
15704
+ "failed",
15705
+ "waiting"
15706
+ ]),
15707
+ hash: desktopExtensionHashSchema.optional(),
15708
+ error: external_exports.string().optional(),
15709
+ conflictWith: desktopExtensionIdSchema.optional()
15710
+ });
15711
+ var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
15712
+ controllerPid: external_exports.int().positive(),
15713
+ targetId: external_exports.string().nullable(),
15714
+ updatedAt: external_exports.iso.datetime(),
15715
+ handledReloadToken: external_exports.uuid().optional(),
15716
+ extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
15717
+ surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
15745
15718
  });
15746
- var failedHarnessInspectionSchema = external_exports.object({
15747
- status: external_exports.enum(["notInstalled", "unavailable", "error"]),
15748
- error: codexhostErrorSchema
15749
- }).strict();
15750
- var harnessInspectionSchema = external_exports.union([
15751
- readyHarnessInspectionSchema,
15752
- failedHarnessInspectionSchema
15719
+ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
15720
+ function isGitHubDesktopExtensionZipballUrl(url2) {
15721
+ return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15722
+ }
15723
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
15724
+ const url2 = new URL(input2);
15725
+ 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);
15726
+ }, "Expected a .zip download URL or a GitHub zipball URL");
15727
+ var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
15728
+ id: desktopExtensionIdSchema,
15729
+ version: external_exports.string().trim().min(1).max(128),
15730
+ name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
15731
+ description: localizedText(external_exports.string().trim().min(1).max(4096)),
15732
+ details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
15733
+ author: external_exports.string().trim().min(1).max(128),
15734
+ repository: desktopExtensionHttpUrlSchema,
15735
+ stars: external_exports.number().int().min(0).optional(),
15736
+ downloads: external_exports.number().int().min(0).optional(),
15737
+ categories: categoriesSchema.optional(),
15738
+ trustTier: desktopExtensionTrustTierSchema.default("community"),
15739
+ icon: desktopExtensionHttpUrlSchema.optional(),
15740
+ screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15741
+ downloadUrl: desktopExtensionZipUrlSchema,
15742
+ sha256: desktopExtensionHashSchema,
15743
+ slots: slotsSchema.optional(),
15744
+ publishedAt: external_exports.string().optional(),
15745
+ updatedAt: external_exports.string().optional(),
15746
+ minCodexHostVersion: external_exports.string().optional()
15747
+ });
15748
+ var desktopExtensionCatalogSchema = external_exports.strictObject({
15749
+ schemaVersion: external_exports.literal(1),
15750
+ generatedAt: external_exports.string(),
15751
+ extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15752
+ });
15753
+ var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
15754
+
15755
+ // ../../shared-contracts/dist/host-extensions.js
15756
+ var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
15757
+ var HOST_EXTENSION_PAGE_API_VERSION = 1;
15758
+ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
15759
+ var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
15760
+ var hostExtensionDigestSchema = desktopExtensionHashSchema;
15761
+ var hostExtensionActivationIdSchema = external_exports.uuid();
15762
+ var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path9) => path9.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
15763
+ var legacy = desktopExtensionManifestSchema.shape;
15764
+ var localized = (max, min = 0) => external_exports.strictObject({
15765
+ en: external_exports.string().trim().min(min).max(max),
15766
+ "zh-CN": external_exports.string().trim().min(min).max(max)
15767
+ });
15768
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path9) => path9.endsWith(suffix), `Expected a ${suffix} file`);
15769
+ var moduleEntry = resourceWithSuffix(".mjs");
15770
+ var style = resourceWithSuffix(".css").optional();
15771
+ var hostExtensionCanonicalPath = (path9) => path9.normalize("NFC").toLowerCase();
15772
+ var hostExtensionManifestV2Schema = external_exports.strictObject({
15773
+ manifestVersion: external_exports.literal(2),
15774
+ id: hostExtensionIdSchema,
15775
+ name: localized(128, 1),
15776
+ version: external_exports.string().trim().min(1).max(128),
15777
+ description: localized(4096),
15778
+ details: localized(16384).optional(),
15779
+ author: legacy.author,
15780
+ repository: legacy.repository,
15781
+ icon: legacy.icon.refine((path9) => path9 === void 0 || hostExtensionResourcePathSchema.safeParse(path9).success),
15782
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path9) => hostExtensionResourcePathSchema.safeParse(path9).success)),
15783
+ categories: legacy.categories,
15784
+ settingsSchema: legacy.settingsSchema,
15785
+ slots: legacy.slots.removeDefault().optional(),
15786
+ page: external_exports.strictObject({
15787
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15788
+ entry: moduleEntry,
15789
+ style,
15790
+ title: localized(128, 1).optional()
15791
+ }).optional(),
15792
+ widget: external_exports.strictObject({
15793
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15794
+ entry: moduleEntry,
15795
+ style
15796
+ }).optional(),
15797
+ desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
15798
+ web: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry.optional(), style }).refine(({ entry, style: style2 }) => entry !== void 0 || style2 !== void 0, "Expected a Web entry or style").optional(),
15799
+ backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
15800
+ }).refine(({ page, widget, desktop, web, backend }) => Boolean(page || widget || desktop || web || backend), "Expected at least one page, widget, desktop, web, or backend entry").refine(({ page, widget, web, backend }) => !backend || [page?.entry, widget?.entry, web?.entry].every((entry) => entry === void 0 || hostExtensionCanonicalPath(entry) !== hostExtensionCanonicalPath(backend.entry)), { path: ["backend", "entry"], message: "A backend entry cannot also be a frontend entry" });
15801
+ function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
15802
+ if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
15803
+ return ["desktop", "web"];
15804
+ const targets = [];
15805
+ if (hasDesktop)
15806
+ targets.push("desktop");
15807
+ if (hasWeb)
15808
+ targets.push("web");
15809
+ return targets;
15810
+ }
15811
+ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
15812
+
15813
+ // ../../shared-contracts/dist/host-extension-management.js
15814
+ var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
15815
+ var hostExtensionRevisionSchema = external_exports.int().nonnegative();
15816
+ var hostExtensionConfigurationSchema = external_exports.strictObject({
15817
+ revision: hostExtensionRevisionSchema,
15818
+ enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
15819
+ });
15820
+ var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
15821
+ var hostExtensionCatalogEntrySchema = external_exports.object({
15822
+ ...catalogMetadata,
15823
+ id: hostExtensionIdSchema,
15824
+ format: external_exports.literal("codexhost"),
15825
+ targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
15826
+ apis: external_exports.strictObject({
15827
+ page: external_exports.int().positive().optional(),
15828
+ widget: external_exports.int().positive().optional(),
15829
+ desktop: external_exports.int().positive().optional(),
15830
+ web: external_exports.int().positive().optional(),
15831
+ backend: external_exports.int().positive().optional()
15832
+ }),
15833
+ downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
15834
+ }).refine(({ targets, apis }) => {
15835
+ const derived = targetsForCapabilities({
15836
+ hasPage: Boolean(apis.page),
15837
+ hasWidget: Boolean(apis.widget),
15838
+ hasDesktop: Boolean(apis.desktop),
15839
+ hasWeb: Boolean(apis.web),
15840
+ hasBackend: Boolean(apis.backend)
15841
+ });
15842
+ return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
15843
+ }, "Catalog targets must match the declared APIs");
15844
+ var hostExtensionCatalogSchema = external_exports.object({
15845
+ schemaVersion: external_exports.literal(2),
15846
+ generatedAt: external_exports.string().min(1),
15847
+ extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15848
+ });
15849
+ var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
15850
+ catalogUrl: desktopExtensionHttpUrlSchema,
15851
+ fetchedAt: external_exports.iso.datetime(),
15852
+ cached: external_exports.boolean()
15853
+ });
15854
+ var id = { id: hostExtensionIdSchema };
15855
+ var active = {
15856
+ ...id,
15857
+ activationId: hostExtensionActivationIdSchema,
15858
+ digest: hostExtensionDigestSchema
15859
+ };
15860
+ var optionalActivation = { ...id, activationId: active.activationId.optional() };
15861
+ var filePath = external_exports.string().min(1).max(4096).refine((path9) => /^(?:\/|[a-z]:[/\\])/iu.test(path9) && !path9.includes("\0") && !path9.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
15862
+ var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
15863
+ function base643(maxBytes) {
15864
+ return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
15865
+ const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
15866
+ return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
15867
+ }, "Expected bounded standard padded base64");
15868
+ }
15869
+ var hostExtensionGitHubSourceSchema = external_exports.strictObject({
15870
+ type: external_exports.literal("github"),
15871
+ repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
15872
+ ref: gitRef.optional(),
15873
+ tag: gitRef.optional(),
15874
+ asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
15875
+ subpath: hostExtensionResourcePathSchema.optional()
15876
+ }).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
15877
+ var hostExtensionInstallSourceSchema = external_exports.union([
15878
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15879
+ hostExtensionGitHubSourceSchema,
15880
+ external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
15881
+ external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
15882
+ external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
15753
15883
  ]);
15754
- var harnessInspectParamsSchema = external_exports.object({
15755
- harnessId: harnessIdSchema,
15756
- cwd: nonBlankTextSchema2.max(16384).optional(),
15757
- refresh: external_exports.boolean().optional(),
15758
- /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15759
- purpose: external_exports.literal("availability").optional()
15760
- }).strict();
15761
- var harnessWebUiOpenParamsSchema = external_exports.object({
15762
- harnessId: harnessIdSchema
15763
- }).strict();
15764
- var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
15765
- var threadModelSelectParamsSchema = external_exports.object({
15766
- threadId: hostThreadIdSchema,
15767
- model: harnessModelRefSchema
15768
- }).strict();
15769
- var threadThinkingSelectParamsSchema = external_exports.object({
15770
- threadId: hostThreadIdSchema,
15771
- thinkingOptionId: harnessThinkingOptionIdSchema
15772
- }).strict();
15773
- var threadInspectionParamsSchema = external_exports.object({
15774
- threadId: hostThreadIdSchema,
15775
- includeReferenceCapability: external_exports.boolean().optional()
15776
- }).strict();
15777
- var codexThreadInspectionSchema = external_exports.object({
15778
- owner: external_exports.literal("codex"),
15779
- locked: external_exports.boolean(),
15780
- effectiveModel: harnessModelRefSchema.optional(),
15781
- resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15782
- effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15783
- effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15784
- history: harnessHistoryCapabilitiesSchema.optional(),
15785
- supportsThreadReferences: external_exports.literal(true).optional()
15786
- }).strict();
15787
- var externalThreadInspectionSchema = external_exports.object({
15788
- owner: external_exports.literal("external"),
15789
- harnessId: nonBlankTextSchema2.max(256),
15790
- transportModelId: nonBlankTextSchema2.max(1024),
15791
- effectiveModel: harnessModelRefSchema.optional(),
15792
- resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15793
- effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15794
- availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15795
- effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15796
- history: harnessHistoryCapabilitiesSchema,
15797
- usage: threadUsageSnapshotSchema.optional(),
15798
- locked: external_exports.literal(true)
15799
- }).strict();
15800
- var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
15801
- codexThreadInspectionSchema,
15802
- externalThreadInspectionSchema
15884
+ var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
15885
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15886
+ hostExtensionGitHubSourceSchema,
15887
+ external_exports.strictObject({ type: external_exports.literal("zip") }),
15888
+ external_exports.strictObject({ type: external_exports.literal("localDir") })
15803
15889
  ]);
15804
- var threadOwnershipListParamsSchema = external_exports.object({
15805
- threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15806
- }).strict().superRefine(({ threadIds }, context) => {
15807
- const seen = /* @__PURE__ */ new Set();
15808
- for (const [index, threadId] of threadIds.entries()) {
15809
- if (seen.has(threadId)) {
15810
- context.addIssue({
15811
- code: "custom",
15812
- message: "Thread ownership-list IDs must be unique",
15813
- path: ["threadIds", index]
15814
- });
15815
- }
15816
- seen.add(threadId);
15817
- }
15890
+ var hostExtensionInstallationSchema = external_exports.strictObject({
15891
+ ...active,
15892
+ manifest: hostExtensionManifestV2Schema,
15893
+ installedAt: external_exports.iso.datetime(),
15894
+ source: hostExtensionProvenanceSchema.optional()
15818
15895
  });
15819
- var codexThreadOwnershipSchema = external_exports.object({
15820
- threadId: hostThreadIdSchema,
15821
- owner: external_exports.literal("codex")
15822
- }).strict();
15823
- var externalThreadOwnershipSchema = external_exports.object({
15824
- threadId: hostThreadIdSchema,
15825
- owner: external_exports.literal("external"),
15826
- harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
15827
- }).strict();
15828
- var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
15829
- codexThreadOwnershipSchema,
15830
- externalThreadOwnershipSchema
15896
+ var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
15897
+ var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
15898
+ var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
15899
+ var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
15900
+ hostExtensionInstallationSchema.extend({
15901
+ state: external_exports.literal("valid"),
15902
+ enabled: external_exports.boolean(),
15903
+ ...desktopConflict,
15904
+ iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
15905
+ screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15906
+ backendState: backendState.optional(),
15907
+ backendError: external_exports.string().optional()
15908
+ }),
15909
+ external_exports.strictObject({
15910
+ state: external_exports.enum(["invalid", "incompatible"]),
15911
+ id: external_exports.string().min(1),
15912
+ enabled: external_exports.boolean(),
15913
+ error: external_exports.string()
15914
+ })
15831
15915
  ]);
15832
- var threadOwnershipListResultSchema = external_exports.object({
15833
- threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15834
- }).strict().superRefine(({ threads }, context) => {
15835
- const seen = /* @__PURE__ */ new Set();
15836
- for (const [index, thread2] of threads.entries()) {
15837
- if (seen.has(thread2.threadId)) {
15838
- context.addIssue({
15839
- code: "custom",
15840
- message: "Thread ownership-list results must be unique",
15841
- path: ["threads", index, "threadId"]
15842
- });
15843
- }
15844
- seen.add(thread2.threadId);
15845
- }
15916
+ var hostExtensionsListResultSchema = external_exports.strictObject({
15917
+ revision: hostExtensionRevisionSchema,
15918
+ configuration: hostExtensionConfigurationSchema,
15919
+ diagnostics: external_exports.array(external_exports.string()),
15920
+ extensions: external_exports.array(hostExtensionListItemSchema)
15921
+ });
15922
+ var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
15923
+ ...desktopConflict,
15924
+ settingsRevision: hostExtensionRevisionSchema
15925
+ });
15926
+ var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
15927
+ /** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
15928
+ revision: hostExtensionRevisionSchema,
15929
+ // Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
15930
+ extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
15931
+ });
15932
+ var HOST_EXTENSIONS_RPC = {
15933
+ list: "codexhost/extensions/list",
15934
+ snapshot: "codexhost/extensions/snapshot",
15935
+ catalog: "codexhost/extensions/catalog",
15936
+ install: "codexhost/extensions/install",
15937
+ update: "codexhost/extensions/update",
15938
+ enable: "codexhost/extensions/enable",
15939
+ disable: "codexhost/extensions/disable",
15940
+ uninstall: "codexhost/extensions/uninstall",
15941
+ recover: "codexhost/extensions/recover",
15942
+ asset: "codexhost/extensions/asset",
15943
+ settingsGet: "codexhost/extensions/settings/get",
15944
+ settingsSet: "codexhost/extensions/settings/set",
15945
+ backendInvoke: "codexhost/extensions/backend/invoke"
15946
+ };
15947
+ var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
15948
+ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
15949
+ var noParams = external_exports.strictObject({});
15950
+ var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
15951
+ var selection = external_exports.strictObject({ ...id, ...expectedRevision });
15952
+ var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
15953
+ var mutationResult = external_exports.discriminatedUnion("state", [
15954
+ external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
15955
+ external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
15956
+ ]);
15957
+ var hostExtensionsAssetParamsSchema = external_exports.strictObject({
15958
+ ...optionalActivation,
15959
+ digest: active.digest.optional(),
15960
+ path: hostExtensionResourcePathSchema
15961
+ });
15962
+ var hostExtensionsAssetResultSchema = external_exports.strictObject({
15963
+ mimeType: external_exports.string().min(1),
15964
+ base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
15965
+ digest: active.digest
15966
+ });
15967
+ var hostExtensionSettingsSchema = external_exports.strictObject({
15968
+ settingsRevision: hostExtensionRevisionSchema,
15969
+ values: jsonObjectSchema
15846
15970
  });
15847
- var threadSteeringInspectParamsSchema = external_exports.object({
15848
- threadId: hostThreadIdSchema,
15849
- /** The text about to be steered; a Harness command always stops and restarts. */
15850
- text: external_exports.string().optional()
15851
- }).strict();
15852
- var threadSteeringContextSchema = external_exports.object({
15853
- kind: external_exports.literal("application"),
15854
- value: external_exports.string().transform((text, context) => {
15855
- try {
15856
- return JSON.parse(text);
15857
- } catch {
15858
- context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15859
- return external_exports.NEVER;
15860
- }
15861
- }).pipe(external_exports.object({
15862
- expectedTurnId: hostTurnIdSchema,
15863
- clientUserMessageId: external_exports.string().min(1),
15864
- delivery: external_exports.enum(["newTurn", "activeTurn"])
15865
- }).strict())
15866
- }).strict().transform((context) => context.value);
15867
- var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15868
- var threadSteeringInspectResultSchema = external_exports.object({
15869
- delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15870
- }).strict();
15971
+ var hostExtensionsRpcSchemas = {
15972
+ [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
15973
+ [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
15974
+ [HOST_EXTENSIONS_RPC.catalog]: {
15975
+ params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
15976
+ result: hostExtensionsCatalogResultSchema
15977
+ },
15978
+ [HOST_EXTENSIONS_RPC.install]: {
15979
+ params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
15980
+ result: installationResult
15981
+ },
15982
+ [HOST_EXTENSIONS_RPC.update]: {
15983
+ params: external_exports.strictObject({
15984
+ ...id,
15985
+ expectedDigest: active.digest,
15986
+ expectedActivationId: active.activationId.optional(),
15987
+ source: hostExtensionInstallSourceSchema.optional()
15988
+ }),
15989
+ result: installationResult
15990
+ },
15991
+ [HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
15992
+ [HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
15993
+ [HOST_EXTENSIONS_RPC.uninstall]: {
15994
+ params: external_exports.strictObject({
15995
+ ...id,
15996
+ removeData: external_exports.boolean().optional(),
15997
+ expectedDigest: active.digest.optional()
15998
+ }),
15999
+ result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
16000
+ },
16001
+ [HOST_EXTENSIONS_RPC.recover]: {
16002
+ params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
16003
+ result: mutationResult
16004
+ },
16005
+ [HOST_EXTENSIONS_RPC.asset]: {
16006
+ params: hostExtensionsAssetParamsSchema,
16007
+ result: hostExtensionsAssetResultSchema
16008
+ },
16009
+ [HOST_EXTENSIONS_RPC.settingsGet]: {
16010
+ params: external_exports.strictObject(optionalActivation),
16011
+ result: hostExtensionSettingsSchema
16012
+ },
16013
+ [HOST_EXTENSIONS_RPC.settingsSet]: {
16014
+ params: external_exports.strictObject({
16015
+ ...optionalActivation,
16016
+ expectedSettingsRevision: hostExtensionRevisionSchema,
16017
+ values: jsonObjectSchema
16018
+ }),
16019
+ result: hostExtensionSettingsSchema
16020
+ },
16021
+ [HOST_EXTENSIONS_RPC.backendInvoke]: {
16022
+ params: external_exports.strictObject({
16023
+ ...optionalActivation,
16024
+ method: hostExtensionBackendMethodSchema,
16025
+ params: jsonValueSchema.optional()
16026
+ }),
16027
+ result: external_exports.strictObject({ result: jsonValueSchema })
16028
+ }
16029
+ };
15871
16030
 
15872
16031
  // ../../shared-contracts/dist/thread-archive-confirm.js
15873
16032
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
@@ -15913,6 +16072,8 @@ var CLIENT_CHANNEL_METHODS = [
15913
16072
  "codexhost/workspace/read",
15914
16073
  "codexhost/thread/tree/read",
15915
16074
  "codexhost/thread/pins/list",
16075
+ "codexhost/thread/sections/list",
16076
+ "codexhost/thread/sections/move",
15916
16077
  "codexhost/thread/pins/set",
15917
16078
  "codexhost/harness/plugins/list",
15918
16079
  "codexhost/harness/inspect",
@@ -15930,7 +16091,7 @@ var CLIENT_CHANNEL_METHODS = [
15930
16091
  "codexhost/harness/session-import/list",
15931
16092
  "codexhost/harness/session-import/import",
15932
16093
  // Host settings shared across Desktop and Web.
15933
- ...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
16094
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
15934
16095
  "codexhost/harness/installation",
15935
16096
  "codexhost/harness/installation/start",
15936
16097
  "codexhost/harness/installation/status",
@@ -15951,8 +16112,21 @@ var CLIENT_CHANNEL_METHODS = [
15951
16112
  "codexhost/update/check",
15952
16113
  "codexhost/update/start",
15953
16114
  "codexhost/update/status",
16115
+ "codexhost/announcement/get",
16116
+ "codexhost/announcement/acknowledge",
15954
16117
  "codexhost/sessions/loaded/list"
15955
16118
  ];
16119
+ var clientThreadSectionsSchema = external_exports.object({
16120
+ sections: external_exports.array(external_exports.object({
16121
+ id: external_exports.string().min(1),
16122
+ name: external_exports.string().min(1),
16123
+ threads: external_exports.array(jsonObjectSchema)
16124
+ }).strict())
16125
+ }).strict();
16126
+ var clientThreadSectionMoveSchema = external_exports.object({
16127
+ threadId: external_exports.string().min(1).max(1024),
16128
+ sectionId: external_exports.string().min(1).max(1024).nullable()
16129
+ }).strict();
15956
16130
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15957
16131
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15958
16132
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -15991,6 +16165,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15991
16165
  cursor: clientChannelCursorSchema,
15992
16166
  revision: external_exports.number().int().nonnegative()
15993
16167
  }),
16168
+ external_exports.object({
16169
+ type: external_exports.literal("extensions-changed"),
16170
+ cursor: clientChannelCursorSchema,
16171
+ revision: hostExtensionRevisionSchema
16172
+ }),
15994
16173
  external_exports.object({
15995
16174
  type: external_exports.literal("hello"),
15996
16175
  version: external_exports.literal(1),
@@ -16427,7 +16606,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
16427
16606
 
16428
16607
  // ../../shared-contracts/dist/harness-preferences.js
16429
16608
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
16430
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
16609
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
16431
16610
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
16432
16611
  model: harnessModelRefSchema.optional(),
16433
16612
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -16437,11 +16616,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
16437
16616
  lastHarness: harnessIdSchema.optional(),
16438
16617
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
16439
16618
  });
16619
+ var harnessDelegationDefaultSchema = external_exports.strictObject({
16620
+ model: harnessModelRefSchema.optional(),
16621
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional()
16622
+ }).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
16623
+ var delegationDefaultsSchema = external_exports.strictObject({
16624
+ byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
16625
+ });
16440
16626
  var modelId = external_exports.string().min(1).max(1024);
16441
16627
  var harnessPreferenceValuesSchema = external_exports.strictObject({
16442
16628
  idleRelease: idleReleaseSettingsSchema.optional(),
16443
16629
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
16444
- newThread: newThreadDefaultsSchema.optional()
16630
+ newThread: newThreadDefaultsSchema.optional(),
16631
+ delegation: delegationDefaultsSchema.optional()
16445
16632
  });
16446
16633
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
16447
16634
  scope: harnessPreferenceScopeSchema,
@@ -16469,6 +16656,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
16469
16656
  lastHarness: harnessIdSchema.optional(),
16470
16657
  harnessId: harnessIdSchema.optional(),
16471
16658
  configuration: harnessDefaultConfigurationSchema.optional()
16659
+ }),
16660
+ external_exports.strictObject({
16661
+ kind: external_exports.literal("delegation"),
16662
+ harnessId: harnessIdSchema,
16663
+ configuration: harnessDelegationDefaultSchema.nullable()
16472
16664
  })
16473
16665
  ]);
16474
16666
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -16476,8 +16668,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
16476
16668
  operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
16477
16669
  initializeOnly: external_exports.boolean().optional(),
16478
16670
  expectedRevision: external_exports.number().int().nonnegative().optional()
16479
- }).superRefine((input, ctx) => {
16480
- for (const operation of input.operations) {
16671
+ }).superRefine((input2, ctx) => {
16672
+ for (const operation of input2.operations) {
16481
16673
  if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
16482
16674
  ctx.addIssue({
16483
16675
  code: "custom",
@@ -16879,13 +17071,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
16879
17071
  // ../../shared-contracts/dist/harness-installation.js
16880
17072
  var harnessInstallationParamsSchema = external_exports.object({
16881
17073
  harnessId: harnessIdSchema,
16882
- action: external_exports.enum(["check", "update", "install"])
16883
- }).strict();
17074
+ action: external_exports.enum(["check", "update", "install"]),
17075
+ confirmedVersion: external_exports.string().min(1).max(128).optional()
17076
+ }).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
16884
17077
  var harnessInstallationStateSchema = external_exports.object({
16885
17078
  currentVersion: external_exports.string().min(1).max(128),
16886
17079
  latestVersion: external_exports.string().min(1).max(128),
16887
17080
  updateAvailable: external_exports.boolean(),
16888
17081
  canUpdate: external_exports.boolean(),
17082
+ /** Present when the Adapter has a verified list and the available target is outside it. */
17083
+ latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
17084
+ /** Update preflight stopped before running the installer; latestVersion needs confirmation. */
17085
+ confirmationRequired: external_exports.literal(true).optional(),
16889
17086
  /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
16890
17087
  versionKind: external_exports.enum(["cli", "application"]).optional(),
16891
17088
  /** Official download opened by the user; does not imply an automatic installation. */
@@ -17215,6 +17412,38 @@ var updateStatusResultSchema = external_exports.strictObject({
17215
17412
  status: updateStatusSchema.nullable()
17216
17413
  });
17217
17414
 
17415
+ // ../../shared-contracts/dist/release-announcement.js
17416
+ var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
17417
+ var releaseAnnouncementThemeSchema = external_exports.strictObject({
17418
+ icon: external_exports.string().min(1).max(16).optional(),
17419
+ title: external_exports.string().min(1).max(120),
17420
+ body: external_exports.string().min(1).max(1200),
17421
+ contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
17422
+ });
17423
+ var releaseAnnouncementContentSchema = external_exports.strictObject({
17424
+ summary: external_exports.string().min(1).max(600).optional(),
17425
+ themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
17426
+ });
17427
+ var releaseAnnouncementSchema = external_exports.strictObject({
17428
+ version: updateSemanticVersionSchema,
17429
+ publishedAt: external_exports.iso.datetime(),
17430
+ url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
17431
+ zh: releaseAnnouncementContentSchema.nullable(),
17432
+ en: releaseAnnouncementContentSchema.nullable()
17433
+ }).refine((value) => value.zh !== null || value.en !== null, {
17434
+ message: "an announcement needs at least one language"
17435
+ });
17436
+ var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
17437
+ manual: external_exports.boolean().optional()
17438
+ });
17439
+ var releaseAnnouncementGetResultSchema = external_exports.strictObject({
17440
+ announcement: releaseAnnouncementSchema.nullable(),
17441
+ unread: external_exports.boolean()
17442
+ });
17443
+ var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
17444
+ version: updateSemanticVersionSchema
17445
+ });
17446
+
17218
17447
  // ../../shared-contracts/dist/thread-watch-notice.js
17219
17448
  var THREAD_WATCH_NOTICE_OUTCOMES = [
17220
17449
  "completed",
@@ -17262,17 +17491,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
17262
17491
 
17263
17492
  // ../../shared-contracts/dist/remote-sessions.js
17264
17493
  var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
17265
- var identity = external_exports.string().min(1).max(1024);
17494
+ var REMOTE_IDENTITY_MAX_LENGTH = 1024;
17495
+ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
17266
17496
  var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17267
17497
  var thread = { ...target, threadId: identity };
17498
+ var text = external_exports.string().min(1).max(8e3);
17499
+ var input = { text, requestId: identity };
17500
+ var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
17501
+ external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
17502
+ external_exports.object({
17503
+ accepted: external_exports.literal(false),
17504
+ code: external_exports.enum([
17505
+ "remote/queue-unavailable",
17506
+ "remote/steer-unavailable",
17507
+ "remote/turn-changed",
17508
+ "remote/send-rejected",
17509
+ "session/queue-item-not-found",
17510
+ "session/queue-item-starting"
17511
+ ]),
17512
+ message: external_exports.string()
17513
+ })
17514
+ ]);
17515
+ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
17516
+ external_exports.object({ available: external_exports.literal(false) }),
17517
+ external_exports.object({
17518
+ available: external_exports.literal(true),
17519
+ items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
17520
+ })
17521
+ ]);
17268
17522
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17269
17523
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17524
+ external_exports.strictObject({
17525
+ kind: external_exports.literal("create"),
17526
+ ...target,
17527
+ cwd: external_exports.string().min(1).max(8192),
17528
+ epoch: identity
17529
+ }),
17530
+ external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
17531
+ external_exports.strictObject({
17532
+ kind: external_exports.literal("inspectHarness"),
17533
+ ...target,
17534
+ epoch: identity,
17535
+ cwd: external_exports.string().min(1).max(8192),
17536
+ harnessId: identity
17537
+ }),
17538
+ external_exports.strictObject({
17539
+ kind: external_exports.literal("startSelected"),
17540
+ ...target,
17541
+ epoch: identity,
17542
+ cwd: external_exports.string().min(1).max(8192),
17543
+ harnessId: identity,
17544
+ model: external_exports.string().min(1).max(4096),
17545
+ serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
17546
+ reasoningEffort: identity.optional()
17547
+ }),
17270
17548
  external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17271
17549
  external_exports.strictObject({
17272
17550
  kind: external_exports.literal("list"),
17273
17551
  ...target,
17274
17552
  cursor: external_exports.string().nullable(),
17275
- archived: external_exports.boolean()
17553
+ archived: external_exports.boolean(),
17554
+ includeLoaded: external_exports.literal(true).optional()
17276
17555
  }),
17277
17556
  external_exports.strictObject({
17278
17557
  kind: external_exports.literal("read"),
@@ -17292,16 +17571,35 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17292
17571
  ...thread,
17293
17572
  epoch: identity,
17294
17573
  modelId: identity.optional(),
17574
+ serviceTier: harnessModelServiceTierSchema.optional(),
17295
17575
  thinkingOptionId: identity.optional(),
17296
17576
  permissionModeId: identity.optional()
17297
- }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
17577
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting").refine((value) => value.serviceTier === void 0 || value.modelId !== void 0, {
17578
+ message: "A service tier requires a Model ID"
17579
+ }),
17298
17580
  external_exports.strictObject({
17299
17581
  kind: external_exports.literal("prompt"),
17300
17582
  ...thread,
17301
17583
  epoch: identity,
17302
- text: external_exports.string().min(1).max(8e3),
17584
+ text,
17303
17585
  requestId: identity.optional()
17304
17586
  }),
17587
+ external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
17588
+ external_exports.strictObject({
17589
+ kind: external_exports.literal("delivery"),
17590
+ ...thread,
17591
+ epoch: identity,
17592
+ action: external_exports.discriminatedUnion("kind", [
17593
+ external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
17594
+ external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
17595
+ external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
17596
+ external_exports.strictObject({
17597
+ kind: external_exports.literal("start"),
17598
+ itemId: identity,
17599
+ onlyIfHead: external_exports.literal(true).optional()
17600
+ })
17601
+ ])
17602
+ }),
17305
17603
  external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
17306
17604
  external_exports.strictObject({
17307
17605
  kind: external_exports.literal("rename"),
@@ -17344,7 +17642,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
17344
17642
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
17345
17643
  external_exports.strictObject({
17346
17644
  action: external_exports.literal("read-thread"),
17347
- hostId: hostId.refine((id) => id !== "local"),
17645
+ hostId: hostId.refine((id2) => id2 !== "local"),
17348
17646
  input: delegationReadParamsSchema
17349
17647
  }),
17350
17648
  external_exports.strictObject({
@@ -17358,7 +17656,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
17358
17656
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
17359
17657
  external_exports.strictObject({
17360
17658
  action: external_exports.literal("update"),
17361
- hostId: hostId.refine((id) => id !== "local"),
17659
+ hostId: hostId.refine((id2) => id2 !== "local"),
17362
17660
  version: remoteUpdateParamsSchema.shape.version
17363
17661
  })
17364
17662
  ]);
@@ -17463,7 +17761,7 @@ function invalidRequest(message) {
17463
17761
  return { code: "invalidRequest", message, retryable: false };
17464
17762
  }
17465
17763
  function validateHostApprovalResponse(interaction, response) {
17466
- return interaction.actions.some(({ id }) => id === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
17764
+ return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
17467
17765
  }
17468
17766
 
17469
17767
  // ../../harness-adapter/dist/question.js
@@ -17471,7 +17769,7 @@ function invalidRequest2(message) {
17471
17769
  return { code: "invalidRequest", message, retryable: false };
17472
17770
  }
17473
17771
  function validateHostQuestionResponse(interaction, response) {
17474
- const questionIds = new Set(interaction.questions.map(({ id }) => id));
17772
+ const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
17475
17773
  if (response.cancelled) {
17476
17774
  return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
17477
17775
  }
@@ -17586,7 +17884,8 @@ var tokenFields = [
17586
17884
  var safeIntegerFields = [
17587
17885
  "planFiveHourResetsAtUnix",
17588
17886
  "planSevenDayResetsAtUnix",
17589
- "timeToFirstOutputMs"
17887
+ "timeToFirstOutputMs",
17888
+ "latestRequestTimeToFirstOutputMs"
17590
17889
  ];
17591
17890
  var percentFields = [
17592
17891
  "cacheHitRatePercent",
@@ -17794,17 +18093,17 @@ function isExcludedLiveCommand(name, extra = {}) {
17794
18093
  function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
17795
18094
  if (!commandId.startsWith(idPrefix))
17796
18095
  return null;
17797
- const descriptor = catalog.commands.find(({ id }) => id === commandId);
18096
+ const descriptor = catalog.commands.find(({ id: id2 }) => id2 === commandId);
17798
18097
  if (!descriptor)
17799
18098
  return null;
17800
- const text = typeof argumentText === "string" ? argumentText.trim() : "";
17801
- return text ? `${descriptor.invocation} ${text}` : descriptor.invocation;
18099
+ const text2 = typeof argumentText === "string" ? argumentText.trim() : "";
18100
+ return text2 ? `${descriptor.invocation} ${text2}` : descriptor.invocation;
17802
18101
  }
17803
18102
  function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17804
18103
  if (!live)
17805
18104
  return builtIns;
17806
18105
  const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
17807
- const ids = new Set(builtIns.commands.map(({ id }) => id));
18106
+ const ids = new Set(builtIns.commands.map(({ id: id2 }) => id2));
17808
18107
  const dynamic = [];
17809
18108
  for (const command of live) {
17810
18109
  const name = command.name.trim().replace(/^\//u, "");
@@ -17813,12 +18112,12 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17813
18112
  if (isExcludedLiveCommand(name, exclusions))
17814
18113
  continue;
17815
18114
  const invocation = `/${name}`;
17816
- const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
17817
- if (invocations.has(invocation) || ids.has(id))
18115
+ const id2 = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
18116
+ if (invocations.has(invocation) || ids.has(id2))
17818
18117
  continue;
17819
18118
  const description = command.description?.trim().slice(0, 512);
17820
18119
  const parsed = harnessCommandDescriptorSchema.safeParse({
17821
- id,
18120
+ id: id2,
17822
18121
  invocation,
17823
18122
  label: name.slice(0, 128),
17824
18123
  ...description ? { description } : {},
@@ -17827,7 +18126,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17827
18126
  if (!parsed.success)
17828
18127
  continue;
17829
18128
  invocations.add(invocation);
17830
- ids.add(id);
18129
+ ids.add(id2);
17831
18130
  dynamic.push(parsed.data);
17832
18131
  }
17833
18132
  return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
@@ -17838,9 +18137,9 @@ function subagentConfiguration(value) {
17838
18137
  if (typeof value !== "object" || value === null || Array.isArray(value))
17839
18138
  return {};
17840
18139
  const row = value;
17841
- const text = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
17842
- const model2 = row.model === "inherit" ? void 0 : text(row.model);
17843
- const reasoningEffort = text(row.reasoningEffort) ?? text(row.reasoning_effort) ?? text(row.thinking);
18140
+ const text2 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
18141
+ const model2 = row.model === "inherit" ? void 0 : text2(row.model);
18142
+ const reasoningEffort = text2(row.reasoningEffort) ?? text2(row.reasoning_effort) ?? text2(row.thinking);
17844
18143
  return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
17845
18144
  }
17846
18145
  function inheritSubagentConfiguration(child, parent) {
@@ -19751,8 +20050,8 @@ var RequestResponder = class {
19751
20050
  signal;
19752
20051
  finishRequest;
19753
20052
  didRespond = false;
19754
- constructor(id, sendResult, signal = new AbortController().signal, finishRequest) {
19755
- this.id = id;
20053
+ constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
20054
+ this.id = id2;
19756
20055
  this.sendResult = sendResult;
19757
20056
  this.signal = signal;
19758
20057
  this.finishRequest = finishRequest;
@@ -20043,7 +20342,7 @@ var Connection = class {
20043
20342
  return this.sendWireMessage({ jsonrpc: "2.0", method, params });
20044
20343
  }
20045
20344
  prepareRequest(method, params, mapResponse, options = {}) {
20046
- const id = this.nextRequestId++;
20345
+ const id2 = this.nextRequestId++;
20047
20346
  let cancel = () => {
20048
20347
  };
20049
20348
  const response = new Promise((resolve, reject) => {
@@ -20063,7 +20362,7 @@ var Connection = class {
20063
20362
  }
20064
20363
  pendingResponse.cancellationSent = true;
20065
20364
  pendingResponse.cleanup?.();
20066
- void this.sendCancelRequest(id).catch(() => {
20365
+ void this.sendCancelRequest(id2).catch(() => {
20067
20366
  });
20068
20367
  };
20069
20368
  options.cancellationSignal?.addEventListener("abort", cancel, {
@@ -20072,12 +20371,12 @@ var Connection = class {
20072
20371
  pendingResponse.cleanup = () => {
20073
20372
  options.cancellationSignal?.removeEventListener("abort", cancel);
20074
20373
  };
20075
- this.pendingResponses.set(id, pendingResponse);
20374
+ this.pendingResponses.set(id2, pendingResponse);
20076
20375
  });
20077
20376
  response.catch(() => {
20078
20377
  });
20079
20378
  return {
20080
- message: { jsonrpc: "2.0", id, method, params },
20379
+ message: { jsonrpc: "2.0", id: id2, method, params },
20081
20380
  response,
20082
20381
  cancel: () => cancel()
20083
20382
  };
@@ -20585,7 +20884,7 @@ var LineBuffer = class {
20585
20884
  };
20586
20885
 
20587
20886
  // ../../../node_modules/@agentclientprotocol/sdk/dist/stream.js
20588
- function ndJsonStream(output, input) {
20887
+ function ndJsonStream(output, input2) {
20589
20888
  const textEncoder = new TextEncoder();
20590
20889
  const textDecoder = new TextDecoder();
20591
20890
  let cancelled = false;
@@ -20608,7 +20907,7 @@ function ndJsonStream(output, input) {
20608
20907
  }
20609
20908
  }
20610
20909
  };
20611
- const reader = input.getReader();
20910
+ const reader = input2.getReader();
20612
20911
  inputReader = reader;
20613
20912
  try {
20614
20913
  while (true) {
@@ -20691,8 +20990,8 @@ var zGuardCreateElicitationResponseCancel = object({
20691
20990
  });
20692
20991
 
20693
20992
  // ../../../node_modules/@agentclientprotocol/sdk/dist/acp.js
20694
- function ndJsonStream2(output, input) {
20695
- return ndJsonStream(output, input);
20993
+ function ndJsonStream2(output, input2) {
20994
+ return ndJsonStream(output, input2);
20696
20995
  }
20697
20996
  function emptyObjectResponse(response) {
20698
20997
  return response ?? {};
@@ -20714,7 +21013,7 @@ function memoryStreamPair() {
20714
21013
  }
20715
21014
  ];
20716
21015
  }
20717
- var methods = {
21016
+ var methods2 = {
20718
21017
  agent: {
20719
21018
  initialize: AGENT_METHODS.initialize,
20720
21019
  authenticate: AGENT_METHODS.authenticate,
@@ -22110,12 +22409,12 @@ var kiroDiscoverySpec = {
22110
22409
  windows: ["${LOCALAPPDATA}/Kiro-Cli", "~/.kiro/bin", "${APPDATA}/npm", VERSION_MANAGER_ROOTS]
22111
22410
  }
22112
22411
  };
22113
- function resolveKiroExecutable(input = {}, dependencies = {}) {
22114
- const platform = input.platform ?? process.platform;
22412
+ function resolveKiroExecutable(input2 = {}, dependencies = {}) {
22413
+ const platform = input2.platform ?? process.platform;
22115
22414
  const resolution = resolveHarnessExecutable(kiroDiscoverySpec, {
22116
- ...input.command ? { command: input.command } : {},
22117
- environment: input.environment ?? process.env,
22118
- ...input.homeDirectory ? { homeDirectory: input.homeDirectory } : {},
22415
+ ...input2.command ? { command: input2.command } : {},
22416
+ environment: input2.environment ?? process.env,
22417
+ ...input2.homeDirectory ? { homeDirectory: input2.homeDirectory } : {},
22119
22418
  platform
22120
22419
  }, dependencies);
22121
22420
  if (!resolution)
@@ -22156,7 +22455,7 @@ function thinkingOptions(values) {
22156
22455
  function kiroThinkingState(configOptions) {
22157
22456
  const option = Array.isArray(configOptions) ? configOptions.find((entry) => isRecord4(entry) && entry.id === "effortLevel") : void 0;
22158
22457
  const availableThinkingOptions = kiroConfigValue(configOptions, "model") === "auto" || !isRecord4(option) ? [] : thinkingOptions(option.options);
22159
- const current = availableThinkingOptions.find(({ id }) => id === kiroConfigValue(configOptions, "effortLevel"));
22458
+ const current = availableThinkingOptions.find(({ id: id2 }) => id2 === kiroConfigValue(configOptions, "effortLevel"));
22160
22459
  return {
22161
22460
  availableThinkingOptions,
22162
22461
  ...current ? { effectiveThinkingOptionId: current.id } : {}
@@ -22192,13 +22491,13 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
22192
22491
  const supported = ref.data.id === "auto" ? [] : ref.data.id === modelConfig.currentValue && currentEffortConfig ? currentThinking.availableThinkingOptions ?? [] : meta3?.hasEffort === false ? [] : thinkingOptions(meta3?.effortLevels);
22193
22492
  for (const effort of supported)
22194
22493
  efforts.set(effort.id, effort);
22195
- if (ref.data.id === modelConfig.currentValue && defaultEffort === void 0 && supported.some(({ id }) => id === meta3?.defaultEffortLevel)) {
22494
+ if (ref.data.id === modelConfig.currentValue && defaultEffort === void 0 && supported.some(({ id: id2 }) => id2 === meta3?.defaultEffortLevel)) {
22196
22495
  defaultEffort = meta3?.defaultEffortLevel;
22197
22496
  }
22198
22497
  models.push({
22199
22498
  ref: ref.data,
22200
22499
  label: name,
22201
- supportedThinkingOptionIds: supported.map(({ id }) => id)
22500
+ supportedThinkingOptionIds: supported.map(({ id: id2 }) => id2)
22202
22501
  });
22203
22502
  }
22204
22503
  if (models.length === 0)
@@ -22221,16 +22520,16 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
22221
22520
  const parsed = harnessModelCatalogSchema.safeParse(catalogCandidate);
22222
22521
  return parsed.success ? parsed.data : fallback;
22223
22522
  }
22224
- function kiroConfigValue(configOptions, id) {
22523
+ function kiroConfigValue(configOptions, id2) {
22225
22524
  if (!Array.isArray(configOptions))
22226
22525
  return void 0;
22227
- const option = configOptions.find((value) => isRecord4(value) && value.id === id);
22526
+ const option = configOptions.find((value) => isRecord4(value) && value.id === id2);
22228
22527
  return isRecord4(option) && nonBlank(option.currentValue) ? option.currentValue : void 0;
22229
22528
  }
22230
- function confirmedKiroConfig(result, id, value) {
22529
+ function confirmedKiroConfig(result, id2, value) {
22231
22530
  const options = isRecord4(result) ? result.configOptions : void 0;
22232
- if (!Array.isArray(options) || kiroConfigValue(options, id) !== value) {
22233
- throw new Error(`Kiro did not confirm ${id}=${value}`);
22531
+ if (!Array.isArray(options) || kiroConfigValue(options, id2) !== value) {
22532
+ throw new Error(`Kiro did not confirm ${id2}=${value}`);
22234
22533
  }
22235
22534
  return options;
22236
22535
  }
@@ -22271,9 +22570,9 @@ function classifyStartupError(error51, stderr = "") {
22271
22570
  if (error51 instanceof KiroExecutableError) {
22272
22571
  return new KiroTransportError("notInstalled", error51.message, { cause: error51 });
22273
22572
  }
22274
- const text = `${errorText(error51)}
22573
+ const text2 = `${errorText(error51)}
22275
22574
  ${stderr}`.toLowerCase();
22276
- if (text.includes("auth_required") || text.includes("authentication") || text.includes("not logged in") || text.includes("not log in") || text.includes("sign in") || text.includes("unauthorized")) {
22575
+ if (text2.includes("auth_required") || text2.includes("authentication") || text2.includes("not logged in") || text2.includes("not log in") || text2.includes("sign in") || text2.includes("unauthorized")) {
22277
22576
  return new KiroTransportError("authenticationRequired", "Kiro CLI authentication is required (run `kiro-cli login`)", {
22278
22577
  cause: error51
22279
22578
  });
@@ -22393,7 +22692,7 @@ var KiroAcpTransport = class {
22393
22692
  throw classifyStartupError(error51, this.#stderrTail);
22394
22693
  }
22395
22694
  }
22396
- async open(input) {
22695
+ async open(input2) {
22397
22696
  if (this.#sessionId || this.#closed) {
22398
22697
  throw new Error("Kiro ACP Transport cannot be opened twice");
22399
22698
  }
@@ -22406,7 +22705,7 @@ var KiroAcpTransport = class {
22406
22705
  let session;
22407
22706
  let sessionId;
22408
22707
  let configOptions;
22409
- if (input.kind === "create") {
22708
+ if (input2.kind === "create") {
22410
22709
  const created = await withTimeout(connection.newSession({
22411
22710
  cwd: this.#options.cwd,
22412
22711
  mcpServers: []
@@ -22414,20 +22713,20 @@ var KiroAcpTransport = class {
22414
22713
  session = created;
22415
22714
  sessionId = created.sessionId;
22416
22715
  configOptions = created.configOptions;
22417
- if (input.modeId) {
22418
- await withTimeout(connection.setSessionMode({ sessionId, modeId: input.modeId }), this.#commandTimeoutMs, "Kiro initial mode");
22716
+ if (input2.modeId) {
22717
+ await withTimeout(connection.setSessionMode({ sessionId, modeId: input2.modeId }), this.#commandTimeoutMs, "Kiro initial mode");
22419
22718
  }
22420
- if (input.modelId) {
22421
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input.modelId);
22719
+ if (input2.modelId) {
22720
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input2.modelId);
22422
22721
  }
22423
- if (input.autopilot) {
22424
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input.autopilot);
22722
+ if (input2.autopilot) {
22723
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input2.autopilot);
22425
22724
  }
22426
- } else if (input.kind === "fork" || input.kind === "rollbackLastTurn") {
22725
+ } else if (input2.kind === "fork" || input2.kind === "rollbackLastTurn") {
22427
22726
  const forked = await this.#forkSession({
22428
- sourceSessionId: input.sourceSessionId,
22727
+ sourceSessionId: input2.sourceSessionId,
22429
22728
  targetCwd: this.#options.cwd,
22430
- checkpointMessageId: input.checkpointMessageId
22729
+ checkpointMessageId: input2.checkpointMessageId
22431
22730
  });
22432
22731
  sessionId = forked.sessionId;
22433
22732
  session = await withTimeout(connection.loadSession({
@@ -22436,36 +22735,36 @@ var KiroAcpTransport = class {
22436
22735
  sessionId
22437
22736
  }), this.#commandTimeoutMs, "Kiro Fork Session load");
22438
22737
  configOptions = session.configOptions;
22439
- if (input.modelId) {
22440
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input.modelId);
22738
+ if (input2.modelId) {
22739
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input2.modelId);
22441
22740
  }
22442
- if (input.autopilot) {
22443
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input.autopilot);
22741
+ if (input2.autopilot) {
22742
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input2.autopilot);
22444
22743
  }
22445
22744
  } else {
22446
22745
  session = await withTimeout(connection.loadSession({
22447
22746
  cwd: this.#options.cwd,
22448
22747
  mcpServers: [],
22449
- sessionId: input.sessionId
22748
+ sessionId: input2.sessionId
22450
22749
  }), this.#commandTimeoutMs, "Kiro Session load");
22451
- sessionId = input.sessionId;
22750
+ sessionId = input2.sessionId;
22452
22751
  configOptions = session.configOptions;
22453
- if (input.modelId) {
22454
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input.modelId);
22752
+ if (input2.modelId) {
22753
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "model", input2.modelId);
22455
22754
  }
22456
- if (input.autopilot) {
22457
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input.autopilot);
22755
+ if (input2.autopilot) {
22756
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "autopilot", input2.autopilot);
22458
22757
  }
22459
22758
  }
22460
22759
  if (typeof sessionId !== "string" || sessionId.length === 0) {
22461
22760
  throw new KiroTransportError("protocolError", "Kiro ACP returned no Session identity");
22462
22761
  }
22463
- if (input.effortLevel !== void 0) {
22762
+ if (input2.effortLevel !== void 0) {
22464
22763
  const available = kiroThinkingState(configOptions).availableThinkingOptions ?? [];
22465
- if (!available.some(({ id }) => id === input.effortLevel)) {
22764
+ if (!available.some(({ id: id2 }) => id2 === input2.effortLevel)) {
22466
22765
  throw new KiroTransportError(available.length === 0 ? "unsupported" : "invalidRequest", "The current Kiro model does not support the requested effort level");
22467
22766
  }
22468
- configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "effortLevel", input.effortLevel);
22767
+ configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "effortLevel", input2.effortLevel);
22469
22768
  }
22470
22769
  this.#sessionId = sessionId;
22471
22770
  const replay = this.#replay ?? [];
@@ -22564,22 +22863,22 @@ var KiroAcpTransport = class {
22564
22863
  throw new KiroTransportError("unavailable", "Kiro Native Fork failed", { cause: error51 });
22565
22864
  }
22566
22865
  }
22567
- async runTurn(text, onEvent, onPermission, onQuestion) {
22866
+ async runTurn(text2, onEvent, onPermission, onQuestion) {
22568
22867
  const connection = this.#connection;
22569
22868
  if (!connection || !this.#sessionId || this.#closed || this.#closing) {
22570
22869
  throw new KiroTransportError("unavailable", "Kiro ACP Session is unavailable");
22571
22870
  }
22572
22871
  if (this.#activePrompt)
22573
22872
  throw new Error("Kiro ACP Session already has an active Prompt");
22574
- const active = { onEvent, onPermission, onQuestion };
22575
- this.#activePrompt = active;
22873
+ const active2 = { onEvent, onPermission, onQuestion };
22874
+ this.#activePrompt = active2;
22576
22875
  try {
22577
22876
  return await connection.prompt({
22578
22877
  sessionId: this.#sessionId,
22579
- prompt: [{ type: "text", text }]
22878
+ prompt: [{ type: "text", text: text2 }]
22580
22879
  });
22581
22880
  } finally {
22582
- if (this.#activePrompt === active)
22881
+ if (this.#activePrompt === active2)
22583
22882
  this.#activePrompt = null;
22584
22883
  }
22585
22884
  }
@@ -22693,20 +22992,20 @@ var KiroAcpTransport = class {
22693
22992
  let event = null;
22694
22993
  if (update.sessionUpdate === "agent_message_chunk") {
22695
22994
  const isReplay = Boolean(kiroMeta?.replay);
22696
- const text = update.content?.type === "text" ? update.content.text : "";
22697
- if (text) {
22995
+ const text2 = update.content?.type === "text" ? update.content.text : "";
22996
+ if (text2) {
22698
22997
  event = {
22699
22998
  type: "agent.text",
22700
- text,
22999
+ text: text2,
22701
23000
  messageId: typeof kiroMeta?.replayId === "string" ? kiroMeta.replayId : typeof kiroMeta?.messageId === "string" ? kiroMeta.messageId : void 0,
22702
23001
  metadata: { isReplay }
22703
23002
  };
22704
23003
  }
22705
23004
  } else if (update.sessionUpdate === "user_message_chunk") {
22706
- const text = update.content?.type === "text" ? update.content.text : "";
23005
+ const text2 = update.content?.type === "text" ? update.content.text : "";
22707
23006
  event = {
22708
23007
  type: "user.text",
22709
- text,
23008
+ text: text2,
22710
23009
  messageId: typeof kiroMeta?.messageId === "string" ? kiroMeta.messageId : void 0
22711
23010
  };
22712
23011
  } else if (update.sessionUpdate === "tool_call") {
@@ -22956,11 +23255,11 @@ ${jsonBlock(json2)}`;
22956
23255
  }
22957
23256
  function jsonBlock(json2) {
22958
23257
  const limit = 64e3;
22959
- const text = json2.length > limit ? `${json2.slice(0, limit)}
23258
+ const text2 = json2.length > limit ? `${json2.slice(0, limit)}
22960
23259
  [Output truncated]` : json2;
22961
- const fence = "`".repeat(Math.max(3, ...(text.match(/`+/gu) ?? []).map((match) => match.length + 1)));
23260
+ const fence = "`".repeat(Math.max(3, ...(text2.match(/`+/gu) ?? []).map((match) => match.length + 1)));
22962
23261
  return `${fence}json
22963
- ${text}
23262
+ ${text2}
22964
23263
  ${fence}`;
22965
23264
  }
22966
23265
 
@@ -23373,9 +23672,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
23373
23672
  } }));
23374
23673
  }
23375
23674
  }
23376
- function splitLines(text) {
23377
- const hasTrailingNl = text.endsWith("\n");
23378
- const result = text.split("\n").map((line) => line + "\n");
23675
+ function splitLines(text2) {
23676
+ const hasTrailingNl = text2.endsWith("\n");
23677
+ const result = text2.split("\n").map((line) => line + "\n");
23379
23678
  if (hasTrailingNl) {
23380
23679
  result.pop();
23381
23680
  } else {
@@ -23649,14 +23948,14 @@ function projectKiroPermission(interactionId, turnId, request) {
23649
23948
  }
23650
23949
  const choices = scope === "session" ? resources.slice(0, 1) : resources;
23651
23950
  for (const [index, choice] of choices.entries()) {
23652
- const id = `kiro-consent:${JSON.stringify([option.optionId, scope, index])}`;
23951
+ const id2 = `kiro-consent:${JSON.stringify([option.optionId, scope, index])}`;
23653
23952
  const scopeLabel = scope === "session" ? "this session" : "save for workspace";
23654
23953
  scopedActions.push({
23655
- id,
23954
+ id: id2,
23656
23955
  label: `Allow (${scopeLabel}) - ${choice.label}`,
23657
23956
  effect: scope === "session" ? "allowForSession" : "allowAlways"
23658
23957
  });
23659
- responses.set(id, {
23958
+ responses.set(id2, {
23660
23959
  outcome: { outcome: "selected", optionId: option.optionId },
23661
23960
  _meta: {
23662
23961
  kiro: {
@@ -23701,23 +24000,23 @@ function projectKiroToolCall(itemId, toolCall) {
23701
24000
  const kiroMeta = meta3 && isRecord8(meta3.kiro) ? meta3.kiro : void 0;
23702
24001
  if (kiroMeta && kiroMeta.kind === "agent-subtask") {
23703
24002
  const subtaskId = typeof kiroMeta.agentSubtaskId === "string" ? kiroMeta.agentSubtaskId : toolCall.toolCallId;
23704
- const input = isRecord8(toolCall.rawInput) ? toolCall.rawInput : {};
24003
+ const input2 = isRecord8(toolCall.rawInput) ? toolCall.rawInput : {};
23705
24004
  const subagentState = {
23706
24005
  subagentId: subtaskId,
23707
24006
  nativeSubagentId: subtaskId,
23708
- description: typeof input.prompt === "string" ? input.prompt : "Subagent task",
23709
- ...subagentConfiguration(input),
24007
+ description: typeof input2.prompt === "string" ? input2.prompt : "Subagent task",
24008
+ ...subagentConfiguration(input2),
23710
24009
  ...subagentConfiguration(kiroMeta),
23711
24010
  background: false,
23712
24011
  status: toolCall.status === "pending" ? "pending" : toolCall.status === "completed" ? "completed" : toolCall.status === "failed" ? "failed" : "running",
23713
- ...typeof input.name === "string" ? { role: input.name } : {},
24012
+ ...typeof input2.name === "string" ? { role: input2.name } : {},
23714
24013
  ...typeof toolCall.rawOutput === "string" ? { resultSummary: toolCall.rawOutput } : {}
23715
24014
  };
23716
24015
  const subagentItem = {
23717
24016
  type: "subagentDelegation",
23718
24017
  itemId: hostItemId,
23719
24018
  operation: "spawn",
23720
- ...typeof input.prompt === "string" ? { prompt: input.prompt } : {},
24019
+ ...typeof input2.prompt === "string" ? { prompt: input2.prompt } : {},
23721
24020
  subagents: [subagentState]
23722
24021
  };
23723
24022
  return subagentItem;
@@ -23804,20 +24103,20 @@ var KiroVisibleText = class {
23804
24103
  return output;
23805
24104
  }
23806
24105
  #flushLine() {
23807
- const text = !this.#fence && this.#pending.trim() === TOOL_PREAMBLE ? "" : this.#pending;
24106
+ const text2 = !this.#fence && this.#pending.trim() === TOOL_PREAMBLE ? "" : this.#pending;
23808
24107
  this.#pending = "";
23809
24108
  this.#passthrough = false;
23810
- return text;
24109
+ return text2;
23811
24110
  }
23812
24111
  finish() {
23813
- const text = this.#flushLine();
24112
+ const text2 = this.#flushLine();
23814
24113
  this.#fence = void 0;
23815
- return text;
24114
+ return text2;
23816
24115
  }
23817
24116
  };
23818
- function kiroVisibleText(text) {
24117
+ function kiroVisibleText(text2) {
23819
24118
  const filter = new KiroVisibleText();
23820
- return filter.push(text) + filter.finish();
24119
+ return filter.push(text2) + filter.finish();
23821
24120
  }
23822
24121
 
23823
24122
  // dist/turn-output.js
@@ -23913,13 +24212,13 @@ var KiroTurnOutput = class {
23913
24212
  if (outcome && tool.file)
23914
24213
  this.#complete(tool.file, outcome.status === "succeeded" && !changes ? { status: "cancelled", reason: "Kiro did not confirm the previewed modification" } : outcome);
23915
24214
  }
23916
- #appendText(text) {
23917
- if (!text)
24215
+ #appendText(text2) {
24216
+ if (!text2)
23918
24217
  return;
23919
24218
  if (!this.#message) {
23920
- text = this.#leadingWhitespace + text;
23921
- if (!text.trim()) {
23922
- this.#leadingWhitespace = text;
24219
+ text2 = this.#leadingWhitespace + text2;
24220
+ if (!text2.trim()) {
24221
+ this.#leadingWhitespace = text2;
23923
24222
  return;
23924
24223
  }
23925
24224
  this.#leadingWhitespace = "";
@@ -23931,14 +24230,14 @@ var KiroTurnOutput = class {
23931
24230
  };
23932
24231
  this.#start(this.#message);
23933
24232
  }
23934
- this.#message = { ...this.#message, text: this.#message.text + text };
24233
+ this.#message = { ...this.#message, text: this.#message.text + text2 };
23935
24234
  this.emit({
23936
24235
  kind: "event",
23937
24236
  event: {
23938
24237
  type: "item.updated",
23939
24238
  turnId: this.turnId,
23940
24239
  itemId: this.#message.itemId,
23941
- update: { type: "text.append", text }
24240
+ update: { type: "text.append", text: text2 }
23942
24241
  }
23943
24242
  });
23944
24243
  }
@@ -24026,7 +24325,7 @@ var KiroUsage = class {
24026
24325
  this.context(value);
24027
24326
  if (value.kind === "turn_completion" || value.type === "usage_summary") {
24028
24327
  const ids = value.requestIds;
24029
- const key = Array.isArray(ids) && ids.length > 0 && ids.every((id) => typeof id === "string" && id.length > 0) ? `requests:${JSON.stringify([...new Set(ids)].sort())}` : typeof value.executionId === "string" && value.executionId.length > 0 ? `execution:${value.executionId}` : void 0;
24328
+ const key = Array.isArray(ids) && ids.length > 0 && ids.every((id2) => typeof id2 === "string" && id2.length > 0) ? `requests:${JSON.stringify([...new Set(ids)].sort())}` : typeof value.executionId === "string" && value.executionId.length > 0 ? `execution:${value.executionId}` : void 0;
24030
24329
  if (!key || !Array.isArray(value.promptTurnSummaries))
24031
24330
  return;
24032
24331
  const credits = value.promptTurnSummaries.filter((entry) => isRecord9(entry) && entry.unit === "credit");
@@ -24106,10 +24405,10 @@ function kiroHomeDir(environment = process.env) {
24106
24405
  const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
24107
24406
  return environment.KIRO_HOME ?? path6.join(home, ".kiro");
24108
24407
  }
24109
- async function locateKiroNativeSession(input, sessionId) {
24408
+ async function locateKiroNativeSession(input2, sessionId) {
24110
24409
  if (!sessionId || sessionId.trim().length === 0)
24111
24410
  return null;
24112
- const root = path6.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
24411
+ const root = path6.join(input2.homeDirectory ?? kiroHomeDir(input2.environment), "sessions");
24113
24412
  let entries;
24114
24413
  try {
24115
24414
  entries = await readdir(root, { withFileTypes: true });
@@ -24303,23 +24602,23 @@ async function readKiroSnapshot(location) {
24303
24602
  if (row.payload.operationType === "Summary")
24304
24603
  continue;
24305
24604
  if (row.payload.operationType === "Reasoning") {
24306
- const text2 = historyText(row.payload);
24307
- if (text2.trim() && !/^[.\s\u2026]+$/u.test(text2)) {
24605
+ const text3 = historyText(row.payload);
24606
+ if (text3.trim() && !/^[.\s\u2026]+$/u.test(text3)) {
24308
24607
  items.push({
24309
- item: { type: "reasoning", itemId, text: text2 },
24608
+ item: { type: "reasoning", itemId, text: text3 },
24310
24609
  outcome: { status: "succeeded" }
24311
24610
  });
24312
24611
  }
24313
24612
  continue;
24314
24613
  }
24315
- const text = kiroVisibleText(historyText(row.payload));
24316
- if (!text.trim())
24614
+ const text2 = kiroVisibleText(historyText(row.payload));
24615
+ if (!text2.trim())
24317
24616
  continue;
24318
24617
  items.push({
24319
24618
  item: {
24320
24619
  type: "agentMessage",
24321
24620
  itemId,
24322
- text,
24621
+ text: text2,
24323
24622
  phase: row === lastContent && outcome.status === "succeeded" ? "final_answer" : "commentary"
24324
24623
  },
24325
24624
  outcome: { status: "succeeded" }
@@ -24458,15 +24757,15 @@ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_
24458
24757
  return normalized;
24459
24758
  return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
24460
24759
  }
24461
- function sessionImportCandidate(input) {
24462
- const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
24760
+ function sessionImportCandidate(input2) {
24761
+ const time3 = typeof input2.updatedAt === "number" ? input2.updatedAt : typeof input2.updatedAt === "string" ? Date.parse(input2.updatedAt) : Number.NaN;
24463
24762
  const parsed = harnessSessionImportCandidateSchema.safeParse({
24464
- nativeSessionId: input.nativeSessionId,
24465
- cwd: input.cwd,
24466
- title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
24763
+ nativeSessionId: input2.nativeSessionId,
24764
+ cwd: input2.cwd,
24765
+ title: typeof input2.title === "string" && input2.title.trim().length > 0 ? input2.title : null,
24467
24766
  updatedAt: Math.floor(time3),
24468
24767
  // Unknown must stay unknown; only an explicit boolean is a native statement.
24469
- running: typeof input.running === "boolean" ? input.running : null
24768
+ running: typeof input2.running === "boolean" ? input2.running : null
24470
24769
  });
24471
24770
  return parsed.success ? parsed.data : null;
24472
24771
  }
@@ -24532,8 +24831,8 @@ function isRecord11(value) {
24532
24831
  return typeof value === "object" && value !== null && !Array.isArray(value);
24533
24832
  }
24534
24833
  function userText(row) {
24535
- const { content, text } = row.payload;
24536
- return kiroVisibleText(typeof content === "string" ? content : text ?? "");
24834
+ const { content, text: text2 } = row.payload;
24835
+ return kiroVisibleText(typeof content === "string" ? content : text2 ?? "");
24537
24836
  }
24538
24837
  var KiroSessionImport = class {
24539
24838
  #environment;
@@ -24731,15 +25030,24 @@ var KiroAdapter = class {
24731
25030
  #sessions = /* @__PURE__ */ new Set();
24732
25031
  #inspectionCache = /* @__PURE__ */ new Map();
24733
25032
  #inspectionInFlight = /* @__PURE__ */ new Map();
25033
+ #inspectionTasks = /* @__PURE__ */ new Set();
24734
25034
  constructor(options = {}, deps = {}) {
24735
25035
  this.#options = options;
24736
25036
  this.#deps = deps;
24737
25037
  this.sessionImport = new KiroSessionImport({ ...process.env, ...options.environment });
24738
25038
  }
24739
- async inspect(input = {}) {
24740
- const cwd = path8.resolve(input.cwd ?? process.cwd());
25039
+ async inspect(input2 = {}) {
25040
+ const cwd = path8.resolve(input2.cwd ?? process.cwd());
24741
25041
  const cached2 = this.#inspectionCache.get(cwd);
24742
- if (!input.refresh && cached2) {
25042
+ if (input2.refresh) {
25043
+ this.#inspectionCache.clear();
25044
+ if (cached2)
25045
+ this.#inspectionCache.set(cwd, cached2);
25046
+ const inFlight = this.#inspectionInFlight.get(cwd);
25047
+ this.#inspectionInFlight.clear();
25048
+ if (inFlight)
25049
+ this.#inspectionInFlight.set(cwd, inFlight);
25050
+ } else if (cached2) {
24743
25051
  if (cached2.refreshAfter <= Date.now()) {
24744
25052
  void this.#refreshInspection(cwd).catch(() => void 0);
24745
25053
  }
@@ -24755,6 +25063,8 @@ var KiroAdapter = class {
24755
25063
  if (cached2)
24756
25064
  cached2.refreshAfter = Date.now() + 5 * 6e4;
24757
25065
  const inspection = this.#inspectCwd(cwd).then((result) => {
25066
+ if (this.#inspectionInFlight.get(cwd) !== inspection)
25067
+ return result;
24758
25068
  if (result.status === "ready") {
24759
25069
  const now = Date.now();
24760
25070
  const date5 = new Date(now);
@@ -24768,9 +25078,12 @@ var KiroAdapter = class {
24768
25078
  }
24769
25079
  return result;
24770
25080
  }).finally(() => {
24771
- this.#inspectionInFlight.delete(cwd);
25081
+ this.#inspectionTasks.delete(inspection);
25082
+ if (this.#inspectionInFlight.get(cwd) === inspection)
25083
+ this.#inspectionInFlight.delete(cwd);
24772
25084
  });
24773
25085
  this.#inspectionInFlight.set(cwd, inspection);
25086
+ this.#inspectionTasks.add(inspection);
24774
25087
  return inspection;
24775
25088
  }
24776
25089
  async #inspectCwd(cwd) {
@@ -24842,8 +25155,8 @@ var KiroAdapter = class {
24842
25155
  await transport.close().catch(() => void 0);
24843
25156
  }
24844
25157
  }
24845
- async open(input) {
24846
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access") {
25158
+ async open(input2) {
25159
+ if (input2.kind === "create" && input2.executionPolicy === "unattended-full-access") {
24847
25160
  return {
24848
25161
  ok: false,
24849
25162
  error: {
@@ -24853,10 +25166,10 @@ var KiroAdapter = class {
24853
25166
  }
24854
25167
  };
24855
25168
  }
24856
- const environment = { ...this.#options.environment, ...input.environment };
25169
+ const environment = { ...this.#options.environment, ...input2.environment };
24857
25170
  let session;
24858
25171
  const usage = new KiroUsage();
24859
- const transport = this.#createTransport(input.cwd, environment, (error51) => session?.fault(error51), (event) => {
25172
+ const transport = this.#createTransport(input2.cwd, environment, (error51) => session?.fault(error51), (event) => {
24860
25173
  if (session)
24861
25174
  session.observeUsage(event);
24862
25175
  else
@@ -24865,29 +25178,29 @@ var KiroAdapter = class {
24865
25178
  const locateSessionFn = this.#deps.locateSession ?? locateKiroNativeSession;
24866
25179
  const readSnapshotFn = this.#deps.readSnapshot ?? readKiroSnapshot;
24867
25180
  let openResult;
24868
- let createdEmptySession = input.kind === "create";
25181
+ let createdEmptySession = input2.kind === "create";
24869
25182
  let initialModel;
24870
25183
  let initialPermissionModeId;
24871
25184
  try {
24872
- if (input.kind === "create") {
25185
+ if (input2.kind === "create") {
24873
25186
  openResult = await transport.open({
24874
25187
  kind: "create",
24875
- ...input.model ? { modelId: input.model.id } : {},
24876
- ...input.thinkingOptionId ? { effortLevel: input.thinkingOptionId } : {},
24877
- ...input.permissionModeId ? { autopilot: decodeKiroPermissionMode(input.permissionModeId) } : {}
25188
+ ...input2.model ? { modelId: input2.model.id } : {},
25189
+ ...input2.thinkingOptionId ? { effortLevel: input2.thinkingOptionId } : {},
25190
+ ...input2.permissionModeId ? { autopilot: decodeKiroPermissionMode(input2.permissionModeId) } : {}
24878
25191
  });
24879
- } else if (input.kind === "resume") {
24880
- const sessionId = input.nativeRef.nativeSessionId;
25192
+ } else if (input2.kind === "resume") {
25193
+ const sessionId = input2.nativeRef.nativeSessionId;
24881
25194
  openResult = await transport.open({
24882
25195
  kind: "resume",
24883
25196
  sessionId,
24884
- autopilot: input.permissionModeId ? decodeKiroPermissionMode(input.permissionModeId) : void 0
25197
+ autopilot: input2.permissionModeId ? decodeKiroPermissionMode(input2.permissionModeId) : void 0
24885
25198
  });
24886
- if (input.permissionModeId) {
24887
- initialPermissionModeId = input.permissionModeId;
25199
+ if (input2.permissionModeId) {
25200
+ initialPermissionModeId = input2.permissionModeId;
24888
25201
  }
24889
- } else if (input.kind === "fork") {
24890
- const sourceSessionId = input.sourceRef.nativeSessionId;
25202
+ } else if (input2.kind === "fork") {
25203
+ const sourceSessionId = input2.sourceRef.nativeSessionId;
24891
25204
  const location = await locateSessionFn({ environment }, sourceSessionId);
24892
25205
  if (!location) {
24893
25206
  await transport.close().catch(() => void 0);
@@ -24902,7 +25215,7 @@ var KiroAdapter = class {
24902
25215
  }
24903
25216
  const rows = await readKiroSessionMessages(location);
24904
25217
  const summary = parseKiroHistory(rows);
24905
- const checkpointId = findForkBoundary(summary, input.checkpoint.checkpointId);
25218
+ const checkpointId = findForkBoundary(summary, input2.checkpoint.checkpointId);
24906
25219
  if (!checkpointId) {
24907
25220
  await transport.close().catch(() => void 0);
24908
25221
  return {
@@ -24930,7 +25243,7 @@ var KiroAdapter = class {
24930
25243
  }
24931
25244
  initialPermissionModeId = sourceAutopilot;
24932
25245
  } else {
24933
- const sourceSessionId = input.sourceRef.nativeSessionId;
25246
+ const sourceSessionId = input2.sourceRef.nativeSessionId;
24934
25247
  const location = await locateSessionFn({ environment }, sourceSessionId);
24935
25248
  if (!location) {
24936
25249
  await transport.close().catch(() => void 0);
@@ -24985,13 +25298,13 @@ var KiroAdapter = class {
24985
25298
  const autopilot = kiroConfigValue(openResult.configOptions, "autopilot");
24986
25299
  initialModel = modelId2 ? harnessModelRefSchema.parse({ id: modelId2 }) : void 0;
24987
25300
  initialPermissionModeId = autopilot === "on" || autopilot === "off" ? encodeKiroPermissionMode(autopilot) : void 0;
24988
- if (input.kind === "create" && input.model && initialModel?.id !== input.model.id) {
25301
+ if (input2.kind === "create" && input2.model && initialModel?.id !== input2.model.id) {
24989
25302
  throw new Error("Kiro did not confirm the requested initial model");
24990
25303
  }
24991
- if (input.kind === "create" && input.thinkingOptionId && thinking.effectiveThinkingOptionId !== input.thinkingOptionId) {
25304
+ if (input2.kind === "create" && input2.thinkingOptionId && thinking.effectiveThinkingOptionId !== input2.thinkingOptionId) {
24992
25305
  throw new KiroTransportError("invalidRequest", "Kiro did not confirm the requested effort level");
24993
25306
  }
24994
- if ((input.kind === "create" || input.kind === "resume") && input.permissionModeId && initialPermissionModeId !== input.permissionModeId) {
25307
+ if ((input2.kind === "create" || input2.kind === "resume") && input2.permissionModeId && initialPermissionModeId !== input2.permissionModeId) {
24995
25308
  throw new Error("Kiro did not confirm the requested initial permission mode");
24996
25309
  }
24997
25310
  try {
@@ -25007,7 +25320,7 @@ var KiroAdapter = class {
25007
25320
  session = new KiroSession({
25008
25321
  harnessId: this.harnessId,
25009
25322
  transport,
25010
- cwd: input.cwd,
25323
+ cwd: input2.cwd,
25011
25324
  sessionId: openResult.sessionId,
25012
25325
  modelCatalog,
25013
25326
  thinking,
@@ -25053,7 +25366,7 @@ var KiroAdapter = class {
25053
25366
  try {
25054
25367
  await Promise.all([
25055
25368
  this.sessionImport.close(),
25056
- ...this.#inspectionInFlight.values(),
25369
+ ...this.#inspectionTasks,
25057
25370
  ...[...this.#sessions].map((session) => session.close())
25058
25371
  ]);
25059
25372
  } finally {
@@ -25190,9 +25503,9 @@ var KiroSession = class {
25190
25503
  return this.#usageRefresh;
25191
25504
  }
25192
25505
  #subagentItems = /* @__PURE__ */ new Map();
25193
- subagentSnapshot(id) {
25194
- const item = this.#subagentItems.get(id);
25195
- return item ? kiroChildSnapshot(this.#sessionId, item, id) : void 0;
25506
+ subagentSnapshot(id2) {
25507
+ const item = this.#subagentItems.get(id2);
25508
+ return item ? kiroChildSnapshot(this.#sessionId, item, id2) : void 0;
25196
25509
  }
25197
25510
  #subagentEvent(event) {
25198
25511
  const configured = configureSubagentEvent(event, this.#subagentConfiguration());
@@ -25625,7 +25938,7 @@ var KiroSession = class {
25625
25938
  }
25626
25939
  #thinkingSelectionError(value) {
25627
25940
  const available = this.#thinking.availableThinkingOptions ?? [];
25628
- if (available.some(({ id }) => id === value))
25941
+ if (available.some(({ id: id2 }) => id2 === value))
25629
25942
  return void 0;
25630
25943
  return {
25631
25944
  code: available.length === 0 ? "unsupported" : "invalidRequest",