@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
@@ -979,16 +979,16 @@ var require_sharedArrayCancellation = __commonJS({
979
979
  this.buffers.set(request.id, buffer);
980
980
  request.$cancellationData = buffer;
981
981
  }
982
- async sendCancellation(_conn, id) {
983
- const buffer = this.buffers.get(id);
982
+ async sendCancellation(_conn, id2) {
983
+ const buffer = this.buffers.get(id2);
984
984
  if (buffer === void 0) {
985
985
  return;
986
986
  }
987
987
  const data = new Int32Array(buffer, 0, 1);
988
988
  Atomics.store(data, 0, CancellationState.Cancelled);
989
989
  }
990
- cleanup(id) {
991
- this.buffers.delete(id);
990
+ cleanup(id2) {
991
+ this.buffers.delete(id2);
992
992
  }
993
993
  dispose() {
994
994
  this.buffers.clear();
@@ -1727,8 +1727,8 @@ var require_connection = __commonJS({
1727
1727
  var CancellationSenderStrategy;
1728
1728
  (function(CancellationSenderStrategy2) {
1729
1729
  CancellationSenderStrategy2.Message = Object.freeze({
1730
- sendCancellation(conn, id) {
1731
- return conn.sendNotification(CancelNotification.type, { id });
1730
+ sendCancellation(conn, id2) {
1731
+ return conn.sendNotification(CancelNotification.type, { id: id2 });
1732
1732
  },
1733
1733
  cleanup(_) {
1734
1734
  }
@@ -1800,17 +1800,17 @@ var require_connection = __commonJS({
1800
1800
  const unhandledProgressEmitter = new events_1.Emitter();
1801
1801
  const disposeEmitter = new events_1.Emitter();
1802
1802
  const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message;
1803
- function createRequestQueueKey(id) {
1804
- if (id === null) {
1803
+ function createRequestQueueKey(id2) {
1804
+ if (id2 === null) {
1805
1805
  throw new Error(`Can't send requests with id null since the response can't be correlated.`);
1806
1806
  }
1807
- return "req-" + id.toString();
1807
+ return "req-" + id2.toString();
1808
1808
  }
1809
- function createResponseQueueKey(id) {
1810
- if (id === null) {
1809
+ function createResponseQueueKey(id2) {
1810
+ if (id2 === null) {
1811
1811
  return "res-unknown-" + (++unknownResponseSequenceNumber).toString();
1812
1812
  } else {
1813
- return "res-" + id.toString();
1813
+ return "res-" + id2.toString();
1814
1814
  }
1815
1815
  }
1816
1816
  function createNotificationQueueKey() {
@@ -2514,24 +2514,24 @@ ${JSON.stringify(message, null, 4)}`);
2514
2514
  const numberOfParams = type.numberOfParams;
2515
2515
  token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0;
2516
2516
  }
2517
- const id = sequenceNumber++;
2517
+ const id2 = sequenceNumber++;
2518
2518
  let disposable;
2519
2519
  if (token) {
2520
2520
  disposable = token.onCancellationRequested(() => {
2521
- const p = cancellationStrategy.sender.sendCancellation(connection, id);
2521
+ const p = cancellationStrategy.sender.sendCancellation(connection, id2);
2522
2522
  if (p === void 0) {
2523
- logger.log(`Received no promise from cancellation strategy when cancelling id ${id}`);
2523
+ logger.log(`Received no promise from cancellation strategy when cancelling id ${id2}`);
2524
2524
  return Promise.resolve();
2525
2525
  } else {
2526
2526
  return p.catch(() => {
2527
- logger.log(`Sending cancellation messages for id ${id} failed`);
2527
+ logger.log(`Sending cancellation messages for id ${id2} failed`);
2528
2528
  });
2529
2529
  }
2530
2530
  });
2531
2531
  }
2532
2532
  const requestMessage = {
2533
2533
  jsonrpc: version3,
2534
- id,
2534
+ id: id2,
2535
2535
  method,
2536
2536
  params: messageParams
2537
2537
  };
@@ -2542,20 +2542,20 @@ ${JSON.stringify(message, null, 4)}`);
2542
2542
  return new Promise(async (resolve3, reject) => {
2543
2543
  const resolveWithCleanup = (r) => {
2544
2544
  resolve3(r);
2545
- cancellationStrategy.sender.cleanup(id);
2545
+ cancellationStrategy.sender.cleanup(id2);
2546
2546
  disposable?.dispose();
2547
2547
  };
2548
2548
  const rejectWithCleanup = (r) => {
2549
2549
  reject(r);
2550
- cancellationStrategy.sender.cleanup(id);
2550
+ cancellationStrategy.sender.cleanup(id2);
2551
2551
  disposable?.dispose();
2552
2552
  };
2553
2553
  const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
2554
2554
  try {
2555
- responsePromises.set(id, responsePromise);
2555
+ responsePromises.set(id2, responsePromise);
2556
2556
  await messageWriter.write(requestMessage);
2557
2557
  } catch (error51) {
2558
- responsePromises.delete(id);
2558
+ responsePromises.delete(id2);
2559
2559
  responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error51.message ? error51.message : "Unknown reason"));
2560
2560
  logger.error(`Sending request failed.`);
2561
2561
  throw error51;
@@ -3280,11 +3280,11 @@ var require_main = __commonJS({
3280
3280
  const candidate = value;
3281
3281
  return candidate.write !== void 0 && candidate.addListener !== void 0;
3282
3282
  }
3283
- function createMessageConnection2(input, output, logger, options2) {
3283
+ function createMessageConnection2(input2, output, logger, options2) {
3284
3284
  if (!logger) {
3285
3285
  logger = api_1.NullLogger;
3286
3286
  }
3287
- const reader = isReadableStream(input) ? new StreamMessageReader2(input) : input;
3287
+ const reader = isReadableStream(input2) ? new StreamMessageReader2(input2) : input2;
3288
3288
  const writer = isWritableStream(output) ? new StreamMessageWriter2(output) : output;
3289
3289
  if (api_1.ConnectionStrategy.is(options2)) {
3290
3290
  options2 = { connectionStrategy: options2 };
@@ -4767,8 +4767,8 @@ function cached(getter) {
4767
4767
  }
4768
4768
  };
4769
4769
  }
4770
- function nullish(input) {
4771
- return input === null || input === void 0;
4770
+ function nullish(input2) {
4771
+ return input2 === null || input2 === void 0;
4772
4772
  }
4773
4773
  function cleanRegex(source) {
4774
4774
  const start = source.startsWith("^") ? 1 : 0;
@@ -4855,8 +4855,8 @@ function randomString(length = 10) {
4855
4855
  function esc(str) {
4856
4856
  return JSON.stringify(str);
4857
4857
  }
4858
- function slugify(input) {
4859
- return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
4858
+ function slugify(input2) {
4859
+ return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
4860
4860
  }
4861
4861
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
4862
4862
  };
@@ -5261,19 +5261,19 @@ function finalizeIssue(iss, ctx, config2) {
5261
5261
  }
5262
5262
  return rest;
5263
5263
  }
5264
- function getSizableOrigin(input) {
5265
- if (input instanceof Set)
5264
+ function getSizableOrigin(input2) {
5265
+ if (input2 instanceof Set)
5266
5266
  return "set";
5267
- if (input instanceof Map)
5267
+ if (input2 instanceof Map)
5268
5268
  return "map";
5269
- if (input instanceof File)
5269
+ if (input2 instanceof File)
5270
5270
  return "file";
5271
5271
  return "unknown";
5272
5272
  }
5273
- function getLengthableOrigin(input) {
5274
- if (Array.isArray(input))
5273
+ function getLengthableOrigin(input2) {
5274
+ if (Array.isArray(input2))
5275
5275
  return "array";
5276
- if (typeof input === "string")
5276
+ if (typeof input2 === "string")
5277
5277
  return "string";
5278
5278
  return "unknown";
5279
5279
  }
@@ -5299,12 +5299,12 @@ function parsedType(data) {
5299
5299
  return t;
5300
5300
  }
5301
5301
  function issue(...args) {
5302
- const [iss, input, inst] = args;
5302
+ const [iss, input2, inst] = args;
5303
5303
  if (typeof iss === "string") {
5304
5304
  return {
5305
5305
  message: iss,
5306
5306
  code: "custom",
5307
- input,
5307
+ input: input2,
5308
5308
  inst
5309
5309
  };
5310
5310
  }
@@ -5315,8 +5315,8 @@ function cleanEnum(obj) {
5315
5315
  return Number.isNaN(Number.parseInt(k, 10));
5316
5316
  }).map((el) => el[1]);
5317
5317
  }
5318
- function base64ToUint8Array(base643) {
5319
- const binaryString = atob(base643);
5318
+ function base64ToUint8Array(base644) {
5319
+ const binaryString = atob(base644);
5320
5320
  const bytes = new Uint8Array(binaryString.length);
5321
5321
  for (let i = 0; i < binaryString.length; i++) {
5322
5322
  bytes[i] = binaryString.charCodeAt(i);
@@ -5331,9 +5331,9 @@ function uint8ArrayToBase64(bytes) {
5331
5331
  return btoa(binaryString);
5332
5332
  }
5333
5333
  function base64urlToUint8Array(base64url3) {
5334
- const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
5335
- const padding = "=".repeat((4 - base643.length % 4) % 4);
5336
- return base64ToUint8Array(base643 + padding);
5334
+ const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
5335
+ const padding = "=".repeat((4 - base644.length % 4) % 4);
5336
+ return base64ToUint8Array(base644 + padding);
5337
5337
  }
5338
5338
  function uint8ArrayToBase64url(bytes) {
5339
5339
  return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -5848,23 +5848,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
5848
5848
  bag.pattern = integer;
5849
5849
  });
5850
5850
  inst._zod.check = (payload) => {
5851
- const input = payload.value;
5851
+ const input2 = payload.value;
5852
5852
  if (isInt) {
5853
- if (!Number.isInteger(input)) {
5853
+ if (!Number.isInteger(input2)) {
5854
5854
  payload.issues.push({
5855
5855
  expected: origin,
5856
5856
  format: def.format,
5857
5857
  code: "invalid_type",
5858
5858
  continue: false,
5859
- input,
5859
+ input: input2,
5860
5860
  inst
5861
5861
  });
5862
5862
  return;
5863
5863
  }
5864
- if (!Number.isSafeInteger(input)) {
5865
- if (input > 0) {
5864
+ if (!Number.isSafeInteger(input2)) {
5865
+ if (input2 > 0) {
5866
5866
  payload.issues.push({
5867
- input,
5867
+ input: input2,
5868
5868
  code: "too_big",
5869
5869
  maximum: Number.MAX_SAFE_INTEGER,
5870
5870
  note: "Integers must be within the safe integer range.",
@@ -5875,7 +5875,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
5875
5875
  });
5876
5876
  } else {
5877
5877
  payload.issues.push({
5878
- input,
5878
+ input: input2,
5879
5879
  code: "too_small",
5880
5880
  minimum: Number.MIN_SAFE_INTEGER,
5881
5881
  note: "Integers must be within the safe integer range.",
@@ -5888,10 +5888,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
5888
5888
  return;
5889
5889
  }
5890
5890
  }
5891
- if (input < minimum) {
5891
+ if (input2 < minimum) {
5892
5892
  payload.issues.push({
5893
5893
  origin: "number",
5894
- input,
5894
+ input: input2,
5895
5895
  code: "too_small",
5896
5896
  minimum,
5897
5897
  inclusive: true,
@@ -5899,10 +5899,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
5899
5899
  continue: !def.abort
5900
5900
  });
5901
5901
  }
5902
- if (input > maximum) {
5902
+ if (input2 > maximum) {
5903
5903
  payload.issues.push({
5904
5904
  origin: "number",
5905
- input,
5905
+ input: input2,
5906
5906
  code: "too_big",
5907
5907
  maximum,
5908
5908
  inclusive: true,
@@ -5922,11 +5922,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
5922
5922
  bag.maximum = maximum;
5923
5923
  });
5924
5924
  inst._zod.check = (payload) => {
5925
- const input = payload.value;
5926
- if (input < minimum) {
5925
+ const input2 = payload.value;
5926
+ if (input2 < minimum) {
5927
5927
  payload.issues.push({
5928
5928
  origin: "bigint",
5929
- input,
5929
+ input: input2,
5930
5930
  code: "too_small",
5931
5931
  minimum,
5932
5932
  inclusive: true,
@@ -5934,10 +5934,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
5934
5934
  continue: !def.abort
5935
5935
  });
5936
5936
  }
5937
- if (input > maximum) {
5937
+ if (input2 > maximum) {
5938
5938
  payload.issues.push({
5939
5939
  origin: "bigint",
5940
- input,
5940
+ input: input2,
5941
5941
  code: "too_big",
5942
5942
  maximum,
5943
5943
  inclusive: true,
@@ -5960,16 +5960,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
5960
5960
  inst2._zod.bag.maximum = def.maximum;
5961
5961
  });
5962
5962
  inst._zod.check = (payload) => {
5963
- const input = payload.value;
5964
- const size = input.size;
5963
+ const input2 = payload.value;
5964
+ const size = input2.size;
5965
5965
  if (size <= def.maximum)
5966
5966
  return;
5967
5967
  payload.issues.push({
5968
- origin: getSizableOrigin(input),
5968
+ origin: getSizableOrigin(input2),
5969
5969
  code: "too_big",
5970
5970
  maximum: def.maximum,
5971
5971
  inclusive: true,
5972
- input,
5972
+ input: input2,
5973
5973
  inst,
5974
5974
  continue: !def.abort
5975
5975
  });
@@ -5988,16 +5988,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
5988
5988
  inst2._zod.bag.minimum = def.minimum;
5989
5989
  });
5990
5990
  inst._zod.check = (payload) => {
5991
- const input = payload.value;
5992
- const size = input.size;
5991
+ const input2 = payload.value;
5992
+ const size = input2.size;
5993
5993
  if (size >= def.minimum)
5994
5994
  return;
5995
5995
  payload.issues.push({
5996
- origin: getSizableOrigin(input),
5996
+ origin: getSizableOrigin(input2),
5997
5997
  code: "too_small",
5998
5998
  minimum: def.minimum,
5999
5999
  inclusive: true,
6000
- input,
6000
+ input: input2,
6001
6001
  inst,
6002
6002
  continue: !def.abort
6003
6003
  });
@@ -6017,13 +6017,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
6017
6017
  bag.size = def.size;
6018
6018
  });
6019
6019
  inst._zod.check = (payload) => {
6020
- const input = payload.value;
6021
- const size = input.size;
6020
+ const input2 = payload.value;
6021
+ const size = input2.size;
6022
6022
  if (size === def.size)
6023
6023
  return;
6024
6024
  const tooBig = size > def.size;
6025
6025
  payload.issues.push({
6026
- origin: getSizableOrigin(input),
6026
+ origin: getSizableOrigin(input2),
6027
6027
  ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
6028
6028
  inclusive: true,
6029
6029
  exact: true,
@@ -6046,17 +6046,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
6046
6046
  inst2._zod.bag.maximum = def.maximum;
6047
6047
  });
6048
6048
  inst._zod.check = (payload) => {
6049
- const input = payload.value;
6050
- const length = input.length;
6049
+ const input2 = payload.value;
6050
+ const length = input2.length;
6051
6051
  if (length <= def.maximum)
6052
6052
  return;
6053
- const origin = getLengthableOrigin(input);
6053
+ const origin = getLengthableOrigin(input2);
6054
6054
  payload.issues.push({
6055
6055
  origin,
6056
6056
  code: "too_big",
6057
6057
  maximum: def.maximum,
6058
6058
  inclusive: true,
6059
- input,
6059
+ input: input2,
6060
6060
  inst,
6061
6061
  continue: !def.abort
6062
6062
  });
@@ -6075,17 +6075,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
6075
6075
  inst2._zod.bag.minimum = def.minimum;
6076
6076
  });
6077
6077
  inst._zod.check = (payload) => {
6078
- const input = payload.value;
6079
- const length = input.length;
6078
+ const input2 = payload.value;
6079
+ const length = input2.length;
6080
6080
  if (length >= def.minimum)
6081
6081
  return;
6082
- const origin = getLengthableOrigin(input);
6082
+ const origin = getLengthableOrigin(input2);
6083
6083
  payload.issues.push({
6084
6084
  origin,
6085
6085
  code: "too_small",
6086
6086
  minimum: def.minimum,
6087
6087
  inclusive: true,
6088
- input,
6088
+ input: input2,
6089
6089
  inst,
6090
6090
  continue: !def.abort
6091
6091
  });
@@ -6105,11 +6105,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
6105
6105
  bag.length = def.length;
6106
6106
  });
6107
6107
  inst._zod.check = (payload) => {
6108
- const input = payload.value;
6109
- const length = input.length;
6108
+ const input2 = payload.value;
6109
+ const length = input2.length;
6110
6110
  if (length === def.length)
6111
6111
  return;
6112
- const origin = getLengthableOrigin(input);
6112
+ const origin = getLengthableOrigin(input2);
6113
6113
  const tooBig = length > def.length;
6114
6114
  payload.issues.push({
6115
6115
  origin,
@@ -6699,8 +6699,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
6699
6699
  function isValidBase64URL(data) {
6700
6700
  if (!base64url.test(data))
6701
6701
  return false;
6702
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
6703
- const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
6702
+ const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
6703
+ const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
6704
6704
  return isValidBase64(padded);
6705
6705
  }
6706
6706
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
@@ -6780,15 +6780,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
6780
6780
  payload.value = Number(payload.value);
6781
6781
  } catch (_) {
6782
6782
  }
6783
- const input = payload.value;
6784
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
6783
+ const input2 = payload.value;
6784
+ if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
6785
6785
  return payload;
6786
6786
  }
6787
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
6787
+ const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
6788
6788
  payload.issues.push({
6789
6789
  expected: "number",
6790
6790
  code: "invalid_type",
6791
- input,
6791
+ input: input2,
6792
6792
  inst,
6793
6793
  ...received ? { received } : {}
6794
6794
  });
@@ -6808,13 +6808,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
6808
6808
  payload.value = Boolean(payload.value);
6809
6809
  } catch (_) {
6810
6810
  }
6811
- const input = payload.value;
6812
- if (typeof input === "boolean")
6811
+ const input2 = payload.value;
6812
+ if (typeof input2 === "boolean")
6813
6813
  return payload;
6814
6814
  payload.issues.push({
6815
6815
  expected: "boolean",
6816
6816
  code: "invalid_type",
6817
- input,
6817
+ input: input2,
6818
6818
  inst
6819
6819
  });
6820
6820
  return payload;
@@ -6847,13 +6847,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
6847
6847
  var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
6848
6848
  $ZodType.init(inst, def);
6849
6849
  inst._zod.parse = (payload, _ctx) => {
6850
- const input = payload.value;
6851
- if (typeof input === "symbol")
6850
+ const input2 = payload.value;
6851
+ if (typeof input2 === "symbol")
6852
6852
  return payload;
6853
6853
  payload.issues.push({
6854
6854
  expected: "symbol",
6855
6855
  code: "invalid_type",
6856
- input,
6856
+ input: input2,
6857
6857
  inst
6858
6858
  });
6859
6859
  return payload;
@@ -6864,13 +6864,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
6864
6864
  inst._zod.pattern = _undefined;
6865
6865
  inst._zod.values = /* @__PURE__ */ new Set([void 0]);
6866
6866
  inst._zod.parse = (payload, _ctx) => {
6867
- const input = payload.value;
6868
- if (typeof input === "undefined")
6867
+ const input2 = payload.value;
6868
+ if (typeof input2 === "undefined")
6869
6869
  return payload;
6870
6870
  payload.issues.push({
6871
6871
  expected: "undefined",
6872
6872
  code: "invalid_type",
6873
- input,
6873
+ input: input2,
6874
6874
  inst
6875
6875
  });
6876
6876
  return payload;
@@ -6881,13 +6881,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
6881
6881
  inst._zod.pattern = _null;
6882
6882
  inst._zod.values = /* @__PURE__ */ new Set([null]);
6883
6883
  inst._zod.parse = (payload, _ctx) => {
6884
- const input = payload.value;
6885
- if (input === null)
6884
+ const input2 = payload.value;
6885
+ if (input2 === null)
6886
6886
  return payload;
6887
6887
  payload.issues.push({
6888
6888
  expected: "null",
6889
6889
  code: "invalid_type",
6890
- input,
6890
+ input: input2,
6891
6891
  inst
6892
6892
  });
6893
6893
  return payload;
@@ -6916,13 +6916,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
6916
6916
  var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
6917
6917
  $ZodType.init(inst, def);
6918
6918
  inst._zod.parse = (payload, _ctx) => {
6919
- const input = payload.value;
6920
- if (typeof input === "undefined")
6919
+ const input2 = payload.value;
6920
+ if (typeof input2 === "undefined")
6921
6921
  return payload;
6922
6922
  payload.issues.push({
6923
6923
  expected: "void",
6924
6924
  code: "invalid_type",
6925
- input,
6925
+ input: input2,
6926
6926
  inst
6927
6927
  });
6928
6928
  return payload;
@@ -6937,15 +6937,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
6937
6937
  } catch (_err) {
6938
6938
  }
6939
6939
  }
6940
- const input = payload.value;
6941
- const isDate = input instanceof Date;
6942
- const isValidDate = isDate && !Number.isNaN(input.getTime());
6940
+ const input2 = payload.value;
6941
+ const isDate = input2 instanceof Date;
6942
+ const isValidDate = isDate && !Number.isNaN(input2.getTime());
6943
6943
  if (isValidDate)
6944
6944
  return payload;
6945
6945
  payload.issues.push({
6946
6946
  expected: "date",
6947
6947
  code: "invalid_type",
6948
- input,
6948
+ input: input2,
6949
6949
  ...isDate ? { received: "Invalid Date" } : {},
6950
6950
  inst
6951
6951
  });
@@ -6961,20 +6961,20 @@ function handleArrayResult(result, final, index) {
6961
6961
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
6962
6962
  $ZodType.init(inst, def);
6963
6963
  inst._zod.parse = (payload, ctx) => {
6964
- const input = payload.value;
6965
- if (!Array.isArray(input)) {
6964
+ const input2 = payload.value;
6965
+ if (!Array.isArray(input2)) {
6966
6966
  payload.issues.push({
6967
6967
  expected: "array",
6968
6968
  code: "invalid_type",
6969
- input,
6969
+ input: input2,
6970
6970
  inst
6971
6971
  });
6972
6972
  return payload;
6973
6973
  }
6974
- payload.value = Array(input.length);
6974
+ payload.value = Array(input2.length);
6975
6975
  const proms = [];
6976
- for (let i = 0; i < input.length; i++) {
6977
- const item = input[i];
6976
+ for (let i = 0; i < input2.length; i++) {
6977
+ const item = input2[i];
6978
6978
  const result = def.element._zod.run({
6979
6979
  value: item,
6980
6980
  issues: []
@@ -6991,8 +6991,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
6991
6991
  return payload;
6992
6992
  };
6993
6993
  });
6994
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
6995
- const isPresent = key in input;
6994
+ function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
6995
+ const isPresent = key in input2;
6996
6996
  if (result.issues.length) {
6997
6997
  if (isOptionalIn && isOptionalOut && !isPresent) {
6998
6998
  return;
@@ -7034,14 +7034,14 @@ function normalizeDef(def) {
7034
7034
  optionalKeys: new Set(okeys)
7035
7035
  };
7036
7036
  }
7037
- function handleCatchall(proms, input, payload, ctx, def, inst) {
7037
+ function handleCatchall(proms, input2, payload, ctx, def, inst) {
7038
7038
  const unrecognized = [];
7039
7039
  const keySet = def.keySet;
7040
7040
  const _catchall = def.catchall._zod;
7041
7041
  const t = _catchall.def.type;
7042
7042
  const isOptionalIn = _catchall.optin === "optional";
7043
7043
  const isOptionalOut = _catchall.optout === "optional";
7044
- for (const key in input) {
7044
+ for (const key in input2) {
7045
7045
  if (key === "__proto__")
7046
7046
  continue;
7047
7047
  if (keySet.has(key))
@@ -7050,18 +7050,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
7050
7050
  unrecognized.push(key);
7051
7051
  continue;
7052
7052
  }
7053
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
7053
+ const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
7054
7054
  if (r instanceof Promise) {
7055
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
7055
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
7056
7056
  } else {
7057
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
7057
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
7058
7058
  }
7059
7059
  }
7060
7060
  if (unrecognized.length) {
7061
7061
  payload.issues.push({
7062
7062
  code: "unrecognized_keys",
7063
7063
  keys: unrecognized,
7064
- input,
7064
+ input: input2,
7065
7065
  inst
7066
7066
  });
7067
7067
  }
@@ -7105,12 +7105,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
7105
7105
  let value;
7106
7106
  inst._zod.parse = (payload, ctx) => {
7107
7107
  value ?? (value = _normalized.value);
7108
- const input = payload.value;
7109
- if (!isObject2(input)) {
7108
+ const input2 = payload.value;
7109
+ if (!isObject2(input2)) {
7110
7110
  payload.issues.push({
7111
7111
  expected: "object",
7112
7112
  code: "invalid_type",
7113
- input,
7113
+ input: input2,
7114
7114
  inst
7115
7115
  });
7116
7116
  return payload;
@@ -7122,17 +7122,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
7122
7122
  const el = shape[key];
7123
7123
  const isOptionalIn = el._zod.optin === "optional";
7124
7124
  const isOptionalOut = el._zod.optout === "optional";
7125
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
7125
+ const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
7126
7126
  if (r instanceof Promise) {
7127
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
7127
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
7128
7128
  } else {
7129
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
7129
+ handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
7130
7130
  }
7131
7131
  }
7132
7132
  if (!catchall) {
7133
7133
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
7134
7134
  }
7135
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
7135
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
7136
7136
  };
7137
7137
  });
7138
7138
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -7154,42 +7154,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
7154
7154
  }
7155
7155
  doc.write(`const newResult = {};`);
7156
7156
  for (const key of normalized.keys) {
7157
- const id = ids[key];
7157
+ const id2 = ids[key];
7158
7158
  const k = esc(key);
7159
7159
  const schema = shape[key];
7160
7160
  const isOptionalIn = schema?._zod?.optin === "optional";
7161
7161
  const isOptionalOut = schema?._zod?.optout === "optional";
7162
- doc.write(`const ${id} = ${parseStr(key)};`);
7162
+ doc.write(`const ${id2} = ${parseStr(key)};`);
7163
7163
  if (isOptionalIn && isOptionalOut) {
7164
7164
  doc.write(`
7165
- if (${id}.issues.length) {
7165
+ if (${id2}.issues.length) {
7166
7166
  if (${k} in input) {
7167
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
7167
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
7168
7168
  ...iss,
7169
7169
  path: iss.path ? [${k}, ...iss.path] : [${k}]
7170
7170
  })));
7171
7171
  }
7172
7172
  }
7173
7173
 
7174
- if (${id}.value === undefined) {
7174
+ if (${id2}.value === undefined) {
7175
7175
  if (${k} in input) {
7176
7176
  newResult[${k}] = undefined;
7177
7177
  }
7178
7178
  } else {
7179
- newResult[${k}] = ${id}.value;
7179
+ newResult[${k}] = ${id2}.value;
7180
7180
  }
7181
7181
 
7182
7182
  `);
7183
7183
  } else if (!isOptionalIn) {
7184
7184
  doc.write(`
7185
- const ${id}_present = ${k} in input;
7186
- if (${id}.issues.length) {
7187
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
7185
+ const ${id2}_present = ${k} in input;
7186
+ if (${id2}.issues.length) {
7187
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
7188
7188
  ...iss,
7189
7189
  path: iss.path ? [${k}, ...iss.path] : [${k}]
7190
7190
  })));
7191
7191
  }
7192
- if (!${id}_present && !${id}.issues.length) {
7192
+ if (!${id2}_present && !${id2}.issues.length) {
7193
7193
  payload.issues.push({
7194
7194
  code: "invalid_type",
7195
7195
  expected: "nonoptional",
@@ -7198,30 +7198,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
7198
7198
  });
7199
7199
  }
7200
7200
 
7201
- if (${id}_present) {
7202
- if (${id}.value === undefined) {
7201
+ if (${id2}_present) {
7202
+ if (${id2}.value === undefined) {
7203
7203
  newResult[${k}] = undefined;
7204
7204
  } else {
7205
- newResult[${k}] = ${id}.value;
7205
+ newResult[${k}] = ${id2}.value;
7206
7206
  }
7207
7207
  }
7208
7208
 
7209
7209
  `);
7210
7210
  } else {
7211
7211
  doc.write(`
7212
- if (${id}.issues.length) {
7213
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
7212
+ if (${id2}.issues.length) {
7213
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
7214
7214
  ...iss,
7215
7215
  path: iss.path ? [${k}, ...iss.path] : [${k}]
7216
7216
  })));
7217
7217
  }
7218
7218
 
7219
- if (${id}.value === undefined) {
7219
+ if (${id2}.value === undefined) {
7220
7220
  if (${k} in input) {
7221
7221
  newResult[${k}] = undefined;
7222
7222
  }
7223
7223
  } else {
7224
- newResult[${k}] = ${id}.value;
7224
+ newResult[${k}] = ${id2}.value;
7225
7225
  }
7226
7226
 
7227
7227
  `);
@@ -7241,12 +7241,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
7241
7241
  let value;
7242
7242
  inst._zod.parse = (payload, ctx) => {
7243
7243
  value ?? (value = _normalized.value);
7244
- const input = payload.value;
7245
- if (!isObject2(input)) {
7244
+ const input2 = payload.value;
7245
+ if (!isObject2(input2)) {
7246
7246
  payload.issues.push({
7247
7247
  expected: "object",
7248
7248
  code: "invalid_type",
7249
- input,
7249
+ input: input2,
7250
7250
  inst
7251
7251
  });
7252
7252
  return payload;
@@ -7257,7 +7257,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
7257
7257
  payload = fastpass(payload, ctx);
7258
7258
  if (!catchall)
7259
7259
  return payload;
7260
- return handleCatchall([], input, payload, ctx, value, inst);
7260
+ return handleCatchall([], input2, payload, ctx, value, inst);
7261
7261
  }
7262
7262
  return superParse(payload, ctx);
7263
7263
  };
@@ -7417,17 +7417,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
7417
7417
  return map2;
7418
7418
  });
7419
7419
  inst._zod.parse = (payload, ctx) => {
7420
- const input = payload.value;
7421
- if (!isObject(input)) {
7420
+ const input2 = payload.value;
7421
+ if (!isObject(input2)) {
7422
7422
  payload.issues.push({
7423
7423
  code: "invalid_type",
7424
7424
  expected: "object",
7425
- input,
7425
+ input: input2,
7426
7426
  inst
7427
7427
  });
7428
7428
  return payload;
7429
7429
  }
7430
- const opt = disc.value.get(input?.[def.discriminator]);
7430
+ const opt = disc.value.get(input2?.[def.discriminator]);
7431
7431
  if (opt) {
7432
7432
  return opt._zod.run(payload, ctx);
7433
7433
  }
@@ -7440,7 +7440,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
7440
7440
  note: "No matching discriminator",
7441
7441
  discriminator: def.discriminator,
7442
7442
  options: Array.from(disc.value.keys()),
7443
- input,
7443
+ input: input2,
7444
7444
  path: [def.discriminator],
7445
7445
  inst
7446
7446
  });
@@ -7450,9 +7450,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
7450
7450
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
7451
7451
  $ZodType.init(inst, def);
7452
7452
  inst._zod.parse = (payload, ctx) => {
7453
- const input = payload.value;
7454
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
7455
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
7453
+ const input2 = payload.value;
7454
+ const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
7455
+ const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
7456
7456
  const async = left instanceof Promise || right instanceof Promise;
7457
7457
  if (async) {
7458
7458
  return Promise.all([left, right]).then(([left2, right2]) => {
@@ -7549,10 +7549,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7549
7549
  $ZodType.init(inst, def);
7550
7550
  const items = def.items;
7551
7551
  inst._zod.parse = (payload, ctx) => {
7552
- const input = payload.value;
7553
- if (!Array.isArray(input)) {
7552
+ const input2 = payload.value;
7553
+ if (!Array.isArray(input2)) {
7554
7554
  payload.issues.push({
7555
- input,
7555
+ input: input2,
7556
7556
  inst,
7557
7557
  expected: "tuple",
7558
7558
  code: "invalid_type"
@@ -7564,23 +7564,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7564
7564
  const optinStart = getTupleOptStart(items, "optin");
7565
7565
  const optoutStart = getTupleOptStart(items, "optout");
7566
7566
  if (!def.rest) {
7567
- if (input.length < optinStart) {
7567
+ if (input2.length < optinStart) {
7568
7568
  payload.issues.push({
7569
7569
  code: "too_small",
7570
7570
  minimum: optinStart,
7571
7571
  inclusive: true,
7572
- input,
7572
+ input: input2,
7573
7573
  inst,
7574
7574
  origin: "array"
7575
7575
  });
7576
7576
  return payload;
7577
7577
  }
7578
- if (input.length > items.length) {
7578
+ if (input2.length > items.length) {
7579
7579
  payload.issues.push({
7580
7580
  code: "too_big",
7581
7581
  maximum: items.length,
7582
7582
  inclusive: true,
7583
- input,
7583
+ input: input2,
7584
7584
  inst,
7585
7585
  origin: "array"
7586
7586
  });
@@ -7588,7 +7588,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7588
7588
  }
7589
7589
  const itemResults = new Array(items.length);
7590
7590
  for (let i = 0; i < items.length; i++) {
7591
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
7591
+ const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
7592
7592
  if (r instanceof Promise) {
7593
7593
  proms.push(r.then((rr) => {
7594
7594
  itemResults[i] = rr;
@@ -7599,7 +7599,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7599
7599
  }
7600
7600
  if (def.rest) {
7601
7601
  let i = items.length - 1;
7602
- const rest = input.slice(items.length);
7602
+ const rest = input2.slice(items.length);
7603
7603
  for (const el of rest) {
7604
7604
  i++;
7605
7605
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
@@ -7611,9 +7611,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7611
7611
  }
7612
7612
  }
7613
7613
  if (proms.length) {
7614
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
7614
+ return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
7615
7615
  }
7616
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
7616
+ return handleTupleResults(itemResults, payload, items, input2, optoutStart);
7617
7617
  };
7618
7618
  });
7619
7619
  function getTupleOptStart(items, key) {
@@ -7629,10 +7629,10 @@ function handleTupleResult(result, final, index) {
7629
7629
  }
7630
7630
  final.value[index] = result.value;
7631
7631
  }
7632
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
7632
+ function handleTupleResults(itemResults, final, items, input2, optoutStart) {
7633
7633
  for (let i = 0; i < items.length; i++) {
7634
7634
  const r = itemResults[i];
7635
- const isPresent = i < input.length;
7635
+ const isPresent = i < input2.length;
7636
7636
  if (r.issues.length) {
7637
7637
  if (!isPresent && i >= optoutStart) {
7638
7638
  final.value.length = i;
@@ -7642,7 +7642,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
7642
7642
  }
7643
7643
  final.value[i] = r.value;
7644
7644
  }
7645
- for (let i = final.value.length - 1; i >= input.length; i--) {
7645
+ for (let i = final.value.length - 1; i >= input2.length; i--) {
7646
7646
  if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
7647
7647
  final.value.length = i;
7648
7648
  } else {
@@ -7654,12 +7654,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
7654
7654
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7655
7655
  $ZodType.init(inst, def);
7656
7656
  inst._zod.parse = (payload, ctx) => {
7657
- const input = payload.value;
7658
- if (!isPlainObject(input)) {
7657
+ const input2 = payload.value;
7658
+ if (!isPlainObject(input2)) {
7659
7659
  payload.issues.push({
7660
7660
  expected: "record",
7661
7661
  code: "invalid_type",
7662
- input,
7662
+ input: input2,
7663
7663
  inst
7664
7664
  });
7665
7665
  return payload;
@@ -7688,7 +7688,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7688
7688
  continue;
7689
7689
  }
7690
7690
  const outKey = keyResult.value;
7691
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
7691
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
7692
7692
  if (result instanceof Promise) {
7693
7693
  proms.push(result.then((result2) => {
7694
7694
  if (result2.issues.length) {
@@ -7705,7 +7705,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7705
7705
  }
7706
7706
  }
7707
7707
  let unrecognized;
7708
- for (const key in input) {
7708
+ for (const key in input2) {
7709
7709
  if (!recordKeys.has(key)) {
7710
7710
  unrecognized = unrecognized ?? [];
7711
7711
  unrecognized.push(key);
@@ -7714,17 +7714,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7714
7714
  if (unrecognized && unrecognized.length > 0) {
7715
7715
  payload.issues.push({
7716
7716
  code: "unrecognized_keys",
7717
- input,
7717
+ input: input2,
7718
7718
  inst,
7719
7719
  keys: unrecognized
7720
7720
  });
7721
7721
  }
7722
7722
  } else {
7723
7723
  payload.value = {};
7724
- for (const key of Reflect.ownKeys(input)) {
7724
+ for (const key of Reflect.ownKeys(input2)) {
7725
7725
  if (key === "__proto__")
7726
7726
  continue;
7727
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
7727
+ if (!Object.prototype.propertyIsEnumerable.call(input2, key))
7728
7728
  continue;
7729
7729
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
7730
7730
  if (keyResult instanceof Promise) {
@@ -7742,7 +7742,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7742
7742
  }
7743
7743
  if (keyResult.issues.length) {
7744
7744
  if (def.mode === "loose") {
7745
- payload.value[key] = input[key];
7745
+ payload.value[key] = input2[key];
7746
7746
  } else {
7747
7747
  payload.issues.push({
7748
7748
  code: "invalid_key",
@@ -7755,7 +7755,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7755
7755
  }
7756
7756
  continue;
7757
7757
  }
7758
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
7758
+ const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
7759
7759
  if (result instanceof Promise) {
7760
7760
  proms.push(result.then((result2) => {
7761
7761
  if (result2.issues.length) {
@@ -7780,27 +7780,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7780
7780
  var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
7781
7781
  $ZodType.init(inst, def);
7782
7782
  inst._zod.parse = (payload, ctx) => {
7783
- const input = payload.value;
7784
- if (!(input instanceof Map)) {
7783
+ const input2 = payload.value;
7784
+ if (!(input2 instanceof Map)) {
7785
7785
  payload.issues.push({
7786
7786
  expected: "map",
7787
7787
  code: "invalid_type",
7788
- input,
7788
+ input: input2,
7789
7789
  inst
7790
7790
  });
7791
7791
  return payload;
7792
7792
  }
7793
7793
  const proms = [];
7794
7794
  payload.value = /* @__PURE__ */ new Map();
7795
- for (const [key, value] of input) {
7795
+ for (const [key, value] of input2) {
7796
7796
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
7797
7797
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
7798
7798
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
7799
7799
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
7800
- handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
7800
+ handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
7801
7801
  }));
7802
7802
  } else {
7803
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
7803
+ handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
7804
7804
  }
7805
7805
  }
7806
7806
  if (proms.length)
@@ -7808,7 +7808,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
7808
7808
  return payload;
7809
7809
  };
7810
7810
  });
7811
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
7811
+ function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
7812
7812
  if (keyResult.issues.length) {
7813
7813
  if (propertyKeyTypes.has(typeof key)) {
7814
7814
  final.issues.push(...prefixIssues(key, keyResult.issues));
@@ -7816,7 +7816,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
7816
7816
  final.issues.push({
7817
7817
  code: "invalid_key",
7818
7818
  origin: "map",
7819
- input,
7819
+ input: input2,
7820
7820
  inst,
7821
7821
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
7822
7822
  });
@@ -7829,7 +7829,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
7829
7829
  final.issues.push({
7830
7830
  origin: "map",
7831
7831
  code: "invalid_element",
7832
- input,
7832
+ input: input2,
7833
7833
  inst,
7834
7834
  key,
7835
7835
  issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
@@ -7841,10 +7841,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
7841
7841
  var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
7842
7842
  $ZodType.init(inst, def);
7843
7843
  inst._zod.parse = (payload, ctx) => {
7844
- const input = payload.value;
7845
- if (!(input instanceof Set)) {
7844
+ const input2 = payload.value;
7845
+ if (!(input2 instanceof Set)) {
7846
7846
  payload.issues.push({
7847
- input,
7847
+ input: input2,
7848
7848
  inst,
7849
7849
  expected: "set",
7850
7850
  code: "invalid_type"
@@ -7853,7 +7853,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
7853
7853
  }
7854
7854
  const proms = [];
7855
7855
  payload.value = /* @__PURE__ */ new Set();
7856
- for (const item of input) {
7856
+ for (const item of input2) {
7857
7857
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
7858
7858
  if (result instanceof Promise) {
7859
7859
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -7878,14 +7878,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
7878
7878
  inst._zod.values = valuesSet;
7879
7879
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
7880
7880
  inst._zod.parse = (payload, _ctx) => {
7881
- const input = payload.value;
7882
- if (valuesSet.has(input)) {
7881
+ const input2 = payload.value;
7882
+ if (valuesSet.has(input2)) {
7883
7883
  return payload;
7884
7884
  }
7885
7885
  payload.issues.push({
7886
7886
  code: "invalid_value",
7887
7887
  values,
7888
- input,
7888
+ input: input2,
7889
7889
  inst
7890
7890
  });
7891
7891
  return payload;
@@ -7900,14 +7900,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
7900
7900
  inst._zod.values = values;
7901
7901
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
7902
7902
  inst._zod.parse = (payload, _ctx) => {
7903
- const input = payload.value;
7904
- if (values.has(input)) {
7903
+ const input2 = payload.value;
7904
+ if (values.has(input2)) {
7905
7905
  return payload;
7906
7906
  }
7907
7907
  payload.issues.push({
7908
7908
  code: "invalid_value",
7909
7909
  values: def.values,
7910
- input,
7910
+ input: input2,
7911
7911
  inst
7912
7912
  });
7913
7913
  return payload;
@@ -7916,13 +7916,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
7916
7916
  var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
7917
7917
  $ZodType.init(inst, def);
7918
7918
  inst._zod.parse = (payload, _ctx) => {
7919
- const input = payload.value;
7920
- if (input instanceof File)
7919
+ const input2 = payload.value;
7920
+ if (input2 instanceof File)
7921
7921
  return payload;
7922
7922
  payload.issues.push({
7923
7923
  expected: "file",
7924
7924
  code: "invalid_type",
7925
- input,
7925
+ input: input2,
7926
7926
  inst
7927
7927
  });
7928
7928
  return payload;
@@ -7952,8 +7952,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
7952
7952
  return payload;
7953
7953
  };
7954
7954
  });
7955
- function handleOptionalResult(result, input) {
7956
- if (input === void 0 && (result.issues.length || result.fallback)) {
7955
+ function handleOptionalResult(result, input2) {
7956
+ if (input2 === void 0 && (result.issues.length || result.fallback)) {
7957
7957
  return { issues: [], value: void 0 };
7958
7958
  }
7959
7959
  return result;
@@ -7971,11 +7971,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
7971
7971
  });
7972
7972
  inst._zod.parse = (payload, ctx) => {
7973
7973
  if (def.innerType._zod.optin === "optional") {
7974
- const input = payload.value;
7974
+ const input2 = payload.value;
7975
7975
  const result = def.innerType._zod.run(payload, ctx);
7976
7976
  if (result instanceof Promise)
7977
- return result.then((r) => handleOptionalResult(r, input));
7978
- return handleOptionalResult(result, input);
7977
+ return result.then((r) => handleOptionalResult(r, input2));
7978
+ return handleOptionalResult(result, input2);
7979
7979
  }
7980
7980
  if (payload.value === void 0) {
7981
7981
  return payload;
@@ -8400,20 +8400,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
8400
8400
  return payload;
8401
8401
  };
8402
8402
  inst._zod.check = (payload) => {
8403
- const input = payload.value;
8404
- const r = def.fn(input);
8403
+ const input2 = payload.value;
8404
+ const r = def.fn(input2);
8405
8405
  if (r instanceof Promise) {
8406
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
8406
+ return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
8407
8407
  }
8408
- handleRefineResult(r, payload, input, inst);
8408
+ handleRefineResult(r, payload, input2, inst);
8409
8409
  return;
8410
8410
  };
8411
8411
  });
8412
- function handleRefineResult(result, payload, input, inst) {
8412
+ function handleRefineResult(result, payload, input2, inst) {
8413
8413
  if (!result) {
8414
8414
  const _iss = {
8415
8415
  code: "custom",
8416
- input,
8416
+ input: input2,
8417
8417
  inst,
8418
8418
  // incorporates params.error into issue reporting
8419
8419
  path: [...inst._zod.def.path ?? []],
@@ -11700,8 +11700,8 @@ function ko_default() {
11700
11700
  }
11701
11701
 
11702
11702
  // ../../../node_modules/zod/v4/locales/lt.js
11703
- var capitalizeFirstCharacter = (text) => {
11704
- return text.charAt(0).toUpperCase() + text.slice(1);
11703
+ var capitalizeFirstCharacter = (text2) => {
11704
+ return text2.charAt(0).toUpperCase() + text2.slice(1);
11705
11705
  };
11706
11706
  function getUnitTypeFromNumber(number4) {
11707
11707
  const abs = Math.abs(number4);
@@ -15101,23 +15101,23 @@ function _overwrite(tx) {
15101
15101
  }
15102
15102
  // @__NO_SIDE_EFFECTS__
15103
15103
  function _normalize(form) {
15104
- return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
15104
+ return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
15105
15105
  }
15106
15106
  // @__NO_SIDE_EFFECTS__
15107
15107
  function _trim() {
15108
- return /* @__PURE__ */ _overwrite((input) => input.trim());
15108
+ return /* @__PURE__ */ _overwrite((input2) => input2.trim());
15109
15109
  }
15110
15110
  // @__NO_SIDE_EFFECTS__
15111
15111
  function _toLowerCase() {
15112
- return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
15112
+ return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
15113
15113
  }
15114
15114
  // @__NO_SIDE_EFFECTS__
15115
15115
  function _toUpperCase() {
15116
- return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
15116
+ return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
15117
15117
  }
15118
15118
  // @__NO_SIDE_EFFECTS__
15119
15119
  function _slugify() {
15120
- return /* @__PURE__ */ _overwrite((input) => slugify(input));
15120
+ return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
15121
15121
  }
15122
15122
  // @__NO_SIDE_EFFECTS__
15123
15123
  function _array(Class2, element, params) {
@@ -15422,8 +15422,8 @@ function _stringbool(Classes, _params) {
15422
15422
  type: "pipe",
15423
15423
  in: stringSchema,
15424
15424
  out: booleanSchema,
15425
- transform: ((input, payload) => {
15426
- let data = input;
15425
+ transform: ((input2, payload) => {
15426
+ let data = input2;
15427
15427
  if (params.case !== "sensitive")
15428
15428
  data = data.toLowerCase();
15429
15429
  if (truthySet.has(data)) {
@@ -15442,8 +15442,8 @@ function _stringbool(Classes, _params) {
15442
15442
  return {};
15443
15443
  }
15444
15444
  }),
15445
- reverseTransform: ((input, _payload) => {
15446
- if (input === true) {
15445
+ reverseTransform: ((input2, _payload) => {
15446
+ if (input2 === true) {
15447
15447
  return truthyArray[0] || "true";
15448
15448
  } else {
15449
15449
  return falsyArray[0] || "false";
@@ -15553,26 +15553,26 @@ function extractDefs(ctx, schema) {
15553
15553
  throw new Error("Unprocessed schema. This is a bug in Zod.");
15554
15554
  const idToSchema = /* @__PURE__ */ new Map();
15555
15555
  for (const entry of ctx.seen.entries()) {
15556
- const id = ctx.metadataRegistry.get(entry[0])?.id;
15557
- if (id) {
15558
- const existing = idToSchema.get(id);
15556
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
15557
+ if (id2) {
15558
+ const existing = idToSchema.get(id2);
15559
15559
  if (existing && existing !== entry[0]) {
15560
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
15560
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
15561
15561
  }
15562
- idToSchema.set(id, entry[0]);
15562
+ idToSchema.set(id2, entry[0]);
15563
15563
  }
15564
15564
  }
15565
15565
  const makeURI = (entry) => {
15566
15566
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
15567
15567
  if (ctx.external) {
15568
15568
  const externalId = ctx.external.registry.get(entry[0])?.id;
15569
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
15569
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
15570
15570
  if (externalId) {
15571
15571
  return { ref: uriGenerator(externalId) };
15572
15572
  }
15573
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
15574
- entry[1].defId = id;
15575
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
15573
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
15574
+ entry[1].defId = id2;
15575
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
15576
15576
  }
15577
15577
  if (entry[1] === root) {
15578
15578
  return { ref: "#" };
@@ -15620,8 +15620,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15620
15620
  continue;
15621
15621
  }
15622
15622
  }
15623
- const id = ctx.metadataRegistry.get(entry[0])?.id;
15624
- if (id) {
15623
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
15624
+ if (id2) {
15625
15625
  extractToDef(entry);
15626
15626
  continue;
15627
15627
  }
@@ -15717,10 +15717,10 @@ function finalize(ctx, schema) {
15717
15717
  } else {
15718
15718
  }
15719
15719
  if (ctx.external?.uri) {
15720
- const id = ctx.external.registry.get(schema)?.id;
15721
- if (!id)
15720
+ const id2 = ctx.external.registry.get(schema)?.id;
15721
+ if (!id2)
15722
15722
  throw new Error("Schema is missing an `id` property");
15723
- result.$id = ctx.external.uri(id);
15723
+ result.$id = ctx.external.uri(id2);
15724
15724
  }
15725
15725
  Object.assign(result, root.def ?? root.schema);
15726
15726
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -15880,9 +15880,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
15880
15880
  json2.type = "number";
15881
15881
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
15882
15882
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
15883
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
15883
+ const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
15884
15884
  if (exMin) {
15885
- if (legacy) {
15885
+ if (legacy2) {
15886
15886
  json2.minimum = exclusiveMinimum;
15887
15887
  json2.exclusiveMinimum = true;
15888
15888
  } else {
@@ -15892,7 +15892,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
15892
15892
  json2.minimum = minimum;
15893
15893
  }
15894
15894
  if (exMax) {
15895
- if (legacy) {
15895
+ if (legacy2) {
15896
15896
  json2.maximum = exclusiveMaximum;
15897
15897
  json2.exclusiveMaximum = true;
15898
15898
  } else {
@@ -16339,9 +16339,9 @@ var allProcessors = {
16339
16339
  optional: optionalProcessor,
16340
16340
  lazy: lazyProcessor
16341
16341
  };
16342
- function toJSONSchema(input, params) {
16343
- if ("_idmap" in input) {
16344
- const registry2 = input;
16342
+ function toJSONSchema(input2, params) {
16343
+ if ("_idmap" in input2) {
16344
+ const registry2 = input2;
16345
16345
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
16346
16346
  const defs = {};
16347
16347
  for (const entry of registry2._idmap.entries()) {
@@ -16369,9 +16369,9 @@ function toJSONSchema(input, params) {
16369
16369
  return { schemas };
16370
16370
  }
16371
16371
  const ctx = initializeContext({ ...params, processors: allProcessors });
16372
- process2(input, ctx);
16373
- extractDefs(ctx, input);
16374
- return finalize(ctx, input);
16372
+ process2(input2, ctx);
16373
+ extractDefs(ctx, input2);
16374
+ return finalize(ctx, input2);
16375
16375
  }
16376
16376
 
16377
16377
  // ../../../node_modules/zod/v4/core/json-schema-generator.js
@@ -16754,7 +16754,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
16754
16754
 
16755
16755
  // ../../../node_modules/zod/v4/classic/schemas.js
16756
16756
  var _installedGroups = /* @__PURE__ */ new WeakMap();
16757
- function _installLazyMethods(inst, group, methods) {
16757
+ function _installLazyMethods(inst, group, methods2) {
16758
16758
  const proto = Object.getPrototypeOf(inst);
16759
16759
  let installed = _installedGroups.get(proto);
16760
16760
  if (!installed) {
@@ -16764,8 +16764,8 @@ function _installLazyMethods(inst, group, methods) {
16764
16764
  if (installed.has(group))
16765
16765
  return;
16766
16766
  installed.add(group);
16767
- for (const key in methods) {
16768
- const fn = methods[key];
16767
+ for (const key in methods2) {
16768
+ const fn = methods2[key];
16769
16769
  Object.defineProperty(proto, key, {
16770
16770
  configurable: true,
16771
16771
  enumerable: false,
@@ -18576,87 +18576,6 @@ function date4(params) {
18576
18576
  // ../../../node_modules/zod/v4/classic/external.js
18577
18577
  config(en_default());
18578
18578
 
18579
- // ../../shared-contracts/dist/ids.js
18580
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
18581
- message: "Identifier must not be empty or whitespace"
18582
- });
18583
- var harnessIdSchema = opaqueIdSchema.brand();
18584
- var hostThreadIdSchema = opaqueIdSchema.brand();
18585
- var hostTurnIdSchema = opaqueIdSchema.brand();
18586
- var hostItemIdSchema = opaqueIdSchema.brand();
18587
- var hostInteractionIdSchema = opaqueIdSchema.brand();
18588
-
18589
- // ../../shared-contracts/dist/harness-plugins.js
18590
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
18591
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
18592
- var HARNESS_PLUGIN_LIMIT = 128;
18593
- var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
18594
- var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
18595
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
18596
- 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");
18597
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
18598
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
18599
- var harnessInstallationGuideSchema = external_exports.object({
18600
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
18601
- before: localizedTextSchema.optional(),
18602
- after: localizedTextSchema.optional(),
18603
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
18604
- }).strict();
18605
- var pluginPresentationShape = {
18606
- id: installedHarnessPluginIdSchema,
18607
- name: external_exports.string().trim().min(1).max(128),
18608
- version: external_exports.string().min(1).max(128),
18609
- /** Capability-only plugin; omitted for existing session-capable plugins. */
18610
- kind: external_exports.literal("usage").optional(),
18611
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
18612
- iconStyle: external_exports.object({
18613
- vector: external_exports.object({
18614
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
18615
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
18616
- paths: external_exports.array(external_exports.object({
18617
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
18618
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
18619
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
18620
- }).strict()).min(1).max(32)
18621
- }).strict().optional(),
18622
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
18623
- borderRadius: external_exports.number().min(0).max(50).optional(),
18624
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
18625
- }).strict().optional(),
18626
- installation: harnessInstallationGuideSchema.optional(),
18627
- notice: localizedTextSchema.optional(),
18628
- /** The factory accepts a persisted local entrypoint through its construction context. */
18629
- launchCommand: external_exports.literal(true).optional(),
18630
- links: external_exports.object({
18631
- website: documentationUrlSchema.optional(),
18632
- documentation: documentationUrlSchema.optional(),
18633
- installation: documentationUrlSchema.optional()
18634
- }).strict().optional()
18635
- };
18636
- var harnessPluginManifestSchema = external_exports.object({
18637
- manifestVersion: external_exports.literal(1),
18638
- ...pluginPresentationShape,
18639
- adapterApiVersion: external_exports.number().int().positive(),
18640
- entry: pluginRelativeResourceSchema,
18641
- icon: pluginRelativeResourceSchema.optional()
18642
- }).strict();
18643
- 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);
18644
- var harnessPluginDescriptorSchema = external_exports.object({
18645
- ...pluginPresentationShape,
18646
- icon: harnessPluginIconSchema.optional()
18647
- }).strict();
18648
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
18649
- var harnessPluginListResultSchema = external_exports.object({
18650
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
18651
- }).strict();
18652
- var harnessPluginConfigurationSchema = external_exports.object({
18653
- version: external_exports.literal(1),
18654
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
18655
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
18656
- message: "Enabled plugin IDs must be unique",
18657
- path: ["enabled"]
18658
- });
18659
-
18660
18579
  // ../../shared-contracts/dist/json-value.js
18661
18580
  function rejectExplicitUndefined(keys) {
18662
18581
  return (value, context) => {
@@ -18716,346 +18635,6 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
18716
18635
  var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
18717
18636
  var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
18718
18637
 
18719
- // ../../shared-contracts/dist/desktop-extensions.js
18720
- var DESKTOP_EXTENSION_API_VERSION = 1;
18721
- var DESKTOP_EXTENSION_LIMIT = 64;
18722
- var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
18723
- var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
18724
- var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
18725
- var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
18726
- var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
18727
- var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
18728
- var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
18729
- var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
18730
- var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
18731
- var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
18732
- var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
18733
- var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
18734
- var desktopExtensionIdSchema = installedPluginIdSchema;
18735
- var desktopExtensionSlotSchema = external_exports.enum([
18736
- "sidebar.thread-layout",
18737
- "sidebar.thread-badge",
18738
- "appearance.theme"
18739
- ]);
18740
- var desktopExtensionCategorySchema = external_exports.enum([
18741
- "appearance",
18742
- "interface",
18743
- "workflow",
18744
- "analytics",
18745
- "integrations",
18746
- "tools"
18747
- ]);
18748
- var extensionName = external_exports.string().trim().min(1).max(128);
18749
- function desktopExtensionScreenshotMimeType(resource) {
18750
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
18751
- case "png":
18752
- return "image/png";
18753
- case "jpg":
18754
- case "jpeg":
18755
- return "image/jpeg";
18756
- case "webp":
18757
- return "image/webp";
18758
- default:
18759
- return void 0;
18760
- }
18761
- }
18762
- function desktopExtensionAssetMimeType(resource) {
18763
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
18764
- case "gif":
18765
- return "image/gif";
18766
- case "svg":
18767
- return "image/svg+xml";
18768
- case "woff2":
18769
- return "font/woff2";
18770
- case "json":
18771
- return "application/json";
18772
- case "css":
18773
- return "text/css";
18774
- default:
18775
- return desktopExtensionScreenshotMimeType(resource);
18776
- }
18777
- }
18778
- var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
18779
- var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
18780
- 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");
18781
- 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) => {
18782
- const { username, password } = new URL(value);
18783
- return !username && !password && !/[\\\s]/u.test(value);
18784
- }, "URL must not contain credentials, backslashes, or whitespace");
18785
- function localizedText(text) {
18786
- return external_exports.strictObject({ en: text, "zh-CN": text });
18787
- }
18788
- var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
18789
- var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
18790
- var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
18791
- var settingField = {
18792
- key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
18793
- label: desktopExtensionLocalizedTextSchema,
18794
- description: desktopExtensionLocalizedTextSchema.optional()
18795
- };
18796
- var numericSetting = {
18797
- ...settingField,
18798
- step: external_exports.number().positive().optional(),
18799
- default: external_exports.number().optional()
18800
- };
18801
- var settingOption = external_exports.strictObject({
18802
- value: external_exports.string(),
18803
- label: desktopExtensionLocalizedTextSchema
18804
- });
18805
- var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
18806
- external_exports.strictObject({
18807
- ...settingField,
18808
- type: external_exports.literal("boolean"),
18809
- default: external_exports.boolean().optional()
18810
- }),
18811
- external_exports.strictObject({
18812
- ...settingField,
18813
- type: external_exports.literal("string"),
18814
- placeholder: desktopExtensionLocalizedTextSchema.optional(),
18815
- default: external_exports.string().optional()
18816
- }),
18817
- external_exports.strictObject({
18818
- ...numericSetting,
18819
- type: external_exports.literal("number"),
18820
- min: external_exports.number().optional(),
18821
- max: external_exports.number().optional()
18822
- }),
18823
- external_exports.strictObject({
18824
- ...numericSetting,
18825
- type: external_exports.literal("range"),
18826
- min: external_exports.number(),
18827
- max: external_exports.number()
18828
- }),
18829
- external_exports.strictObject({
18830
- ...settingField,
18831
- type: external_exports.literal("select"),
18832
- options: external_exports.array(settingOption).min(1),
18833
- default: external_exports.string().optional()
18834
- })
18835
- ]).superRefine((field2, ctx) => {
18836
- const issue2 = (path7, message) => ctx.addIssue({ code: "custom", path: [path7], message });
18837
- if (field2.type === "number" || field2.type === "range") {
18838
- const { min = -Infinity, max = Infinity, default: value } = field2;
18839
- if (min > max)
18840
- issue2("max", "Must be at least min");
18841
- if (value !== void 0 && (value < min || value > max))
18842
- issue2("default", "Must be within min and max");
18843
- } else if (field2.type === "select") {
18844
- const values = new Set(field2.options.map(({ value }) => value));
18845
- if (values.size !== field2.options.length)
18846
- issue2("options", "Duplicate option values");
18847
- if (field2.default !== void 0 && !values.has(field2.default))
18848
- issue2("default", "Must match an option value");
18849
- }
18850
- });
18851
- var manifestHeader = external_exports.object({
18852
- manifestVersion: external_exports.int().positive(),
18853
- id: desktopExtensionIdSchema,
18854
- name: external_exports.union([extensionName, localizedText(extensionName)]),
18855
- version: external_exports.string().min(1).max(128),
18856
- desktopApi: external_exports.int().positive()
18857
- }).passthrough();
18858
- var desktopExtensionManifestSchema = manifestHeader.extend({
18859
- manifestVersion: external_exports.literal(1),
18860
- desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
18861
- description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
18862
- author: external_exports.string().trim().min(1).max(128).optional(),
18863
- repository: desktopExtensionHttpUrlSchema.optional(),
18864
- details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
18865
- icon: imagePathSchema.optional(),
18866
- screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
18867
- desktop: external_exports.strictObject({
18868
- script: pluginRelativeResourceSchema,
18869
- style: pluginRelativeResourceSchema.optional()
18870
- }).optional(),
18871
- backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
18872
- slots: slotsSchema.default(() => []),
18873
- settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
18874
- categories: categoriesSchema.optional()
18875
- }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
18876
- var desktopExtensionConfigurationSchema = external_exports.strictObject({
18877
- version: external_exports.literal(1),
18878
- revision: external_exports.int().nonnegative(),
18879
- enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
18880
- reloadToken: external_exports.uuid().optional()
18881
- });
18882
- var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
18883
- var desktopExtensionStatusSchema = external_exports.strictObject({
18884
- state: external_exports.enum([
18885
- "running",
18886
- "disabled",
18887
- "invalid",
18888
- "incompatible",
18889
- "conflict",
18890
- "failed",
18891
- "waiting"
18892
- ]),
18893
- hash: desktopExtensionHashSchema.optional(),
18894
- error: external_exports.string().optional(),
18895
- conflictWith: desktopExtensionIdSchema.optional()
18896
- });
18897
- var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
18898
- controllerPid: external_exports.int().positive(),
18899
- targetId: external_exports.string().nullable(),
18900
- updatedAt: external_exports.iso.datetime(),
18901
- handledReloadToken: external_exports.uuid().optional(),
18902
- extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
18903
- });
18904
- var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
18905
- function isGitHubDesktopExtensionZipballUrl(url2) {
18906
- return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
18907
- }
18908
- var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
18909
- const url2 = new URL(input);
18910
- 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);
18911
- }, "Expected a .zip download URL or a GitHub zipball URL");
18912
- var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
18913
- id: desktopExtensionIdSchema,
18914
- version: external_exports.string().trim().min(1).max(128),
18915
- name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
18916
- description: localizedText(external_exports.string().trim().min(1).max(4096)),
18917
- details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
18918
- author: external_exports.string().trim().min(1).max(128),
18919
- repository: desktopExtensionHttpUrlSchema,
18920
- stars: external_exports.number().int().min(0).optional(),
18921
- downloads: external_exports.number().int().min(0).optional(),
18922
- categories: categoriesSchema.optional(),
18923
- trustTier: desktopExtensionTrustTierSchema.default("community"),
18924
- icon: desktopExtensionHttpUrlSchema.optional(),
18925
- screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
18926
- downloadUrl: desktopExtensionZipUrlSchema,
18927
- sha256: desktopExtensionHashSchema,
18928
- slots: slotsSchema.optional(),
18929
- publishedAt: external_exports.string().optional(),
18930
- updatedAt: external_exports.string().optional(),
18931
- minCodexHostVersion: external_exports.string().optional()
18932
- });
18933
- var desktopExtensionCatalogSchema = external_exports.strictObject({
18934
- schemaVersion: external_exports.literal(1),
18935
- generatedAt: external_exports.string(),
18936
- extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
18937
- });
18938
- var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
18939
- var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
18940
- var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
18941
- var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
18942
- var extensionIdParams = { id: desktopExtensionIdSchema };
18943
- var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
18944
- ...extensionIdParams,
18945
- path: desktopExtensionAssetPathSchema
18946
- });
18947
- var desktopExtensionsAssetResultSchema = external_exports.strictObject({
18948
- mimeType: external_exports.string(),
18949
- dataUrl: external_exports.string()
18950
- });
18951
- var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
18952
- var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
18953
- ...extensionIdParams,
18954
- values: jsonObjectSchema
18955
- });
18956
- var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
18957
- var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
18958
- var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
18959
- ...extensionIdParams,
18960
- method: desktopExtensionBackendMethodSchema,
18961
- params: jsonValueSchema.optional()
18962
- });
18963
- var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
18964
- result: jsonValueSchema
18965
- });
18966
-
18967
- // ../../shared-contracts/dist/desktop-extension-management.js
18968
- var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
18969
- var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
18970
- var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
18971
- var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
18972
- var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
18973
- var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
18974
- var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
18975
- var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
18976
- DESKTOP_EXTENSIONS_LIST_METHOD,
18977
- DESKTOP_EXTENSIONS_ENABLE_METHOD,
18978
- DESKTOP_EXTENSIONS_DISABLE_METHOD,
18979
- DESKTOP_EXTENSIONS_RECOVER_METHOD,
18980
- DESKTOP_EXTENSIONS_CATALOG_METHOD,
18981
- DESKTOP_EXTENSIONS_INSTALL_METHOD,
18982
- DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
18983
- DESKTOP_EXTENSIONS_ASSET_METHOD,
18984
- DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
18985
- DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
18986
- DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
18987
- ];
18988
- var revisionSchema = external_exports.int().nonnegative();
18989
- var desktopExtensionsListParamsSchema = external_exports.strictObject({});
18990
- var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
18991
- id: desktopExtensionIdSchema,
18992
- expectedRevision: revisionSchema
18993
- });
18994
- var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
18995
- expectedRevision: revisionSchema.optional()
18996
- });
18997
- 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);
18998
- var desktopExtensionListItemSchema = external_exports.strictObject({
18999
- // An invalid discovery can have a directory name that isn't a valid extension ID.
19000
- id: external_exports.string().min(1),
19001
- manifest: desktopExtensionManifestSchema.optional(),
19002
- iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
19003
- screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
19004
- enabled: external_exports.boolean(),
19005
- status: desktopExtensionStatusSchema
19006
- });
19007
- var desktopExtensionsListResultSchema = external_exports.strictObject({
19008
- configuration: desktopExtensionConfigurationSchema,
19009
- desktopConnected: external_exports.boolean(),
19010
- diagnostics: external_exports.array(external_exports.string()),
19011
- extensions: external_exports.array(desktopExtensionListItemSchema)
19012
- });
19013
- var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
19014
- forceRefresh: external_exports.boolean().optional()
19015
- });
19016
- var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
19017
- catalogUrl: external_exports.string(),
19018
- source: external_exports.enum(["remote", "fallback"]),
19019
- fetchedAt: external_exports.string(),
19020
- cached: external_exports.boolean(),
19021
- extensions: desktopExtensionCatalogSchema.shape.extensions,
19022
- error: external_exports.string().optional()
19023
- });
19024
- var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
19025
- source: external_exports.discriminatedUnion("type", [
19026
- external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
19027
- external_exports.strictObject({
19028
- type: external_exports.literal("url"),
19029
- url: desktopExtensionHttpUrlSchema,
19030
- expectedSha256: desktopExtensionHashSchema.optional()
19031
- }),
19032
- external_exports.strictObject({
19033
- type: external_exports.literal("zip-base64"),
19034
- fileName: external_exports.string().trim().min(1).max(255),
19035
- 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")
19036
- })
19037
- ])
19038
- });
19039
- var desktopExtensionsInstallResultSchema = external_exports.strictObject({
19040
- extensionId: desktopExtensionIdSchema,
19041
- version: external_exports.string().min(1),
19042
- replaced: external_exports.boolean(),
19043
- installedPath: external_exports.string(),
19044
- list: desktopExtensionsListResultSchema
19045
- });
19046
- var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
19047
- id: desktopExtensionIdSchema
19048
- });
19049
- var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
19050
- removedId: desktopExtensionIdSchema,
19051
- list: desktopExtensionsListResultSchema
19052
- });
19053
- var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
19054
- external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
19055
- external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
19056
- external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
19057
- ]);
19058
-
19059
18638
  // ../../shared-contracts/dist/errors.js
19060
18639
  var codexhostErrorSchema = external_exports.strictObject({
19061
18640
  code: external_exports.string().min(1),
@@ -19069,13 +18648,23 @@ var codexhostErrorSchema = external_exports.strictObject({
19069
18648
 
19070
18649
  // ../../shared-contracts/dist/harness-presentation.js
19071
18650
  var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
19072
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
18651
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
19073
18652
  var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
19074
18653
  label: displayText(256).optional(),
19075
18654
  description: displayText(1024).optional()
19076
18655
  }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
19077
18656
  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");
19078
18657
 
18658
+ // ../../shared-contracts/dist/ids.js
18659
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
18660
+ message: "Identifier must not be empty or whitespace"
18661
+ });
18662
+ var harnessIdSchema = opaqueIdSchema.brand();
18663
+ var hostThreadIdSchema = opaqueIdSchema.brand();
18664
+ var hostTurnIdSchema = opaqueIdSchema.brand();
18665
+ var hostItemIdSchema = opaqueIdSchema.brand();
18666
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
18667
+
19079
18668
  // ../../shared-contracts/dist/harness-permission-modes.js
19080
18669
  var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
19081
18670
  var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
@@ -19120,6 +18709,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
19120
18709
  permissionModeId: harnessPermissionModeIdSchema
19121
18710
  }).strict();
19122
18711
 
18712
+ // ../../shared-contracts/dist/harness-route-limit.js
18713
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
18714
+
19123
18715
  // ../../shared-contracts/dist/thread-usage.js
19124
18716
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
19125
18717
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -19145,14 +18737,14 @@ var usageMeasurementsSchema = external_exports.object({
19145
18737
  outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
19146
18738
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
19147
18739
  }).strict();
19148
- var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
18740
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
19149
18741
  var composerIndicatorsSchema = external_exports.array(external_exports.object({
19150
18742
  kind: external_exports.literal("countdown"),
19151
18743
  id: external_exports.string().min(1).max(64),
19152
18744
  expiresAtUnix: nonNegativeSafeIntegerSchema,
19153
18745
  label: indicatorTextSchema(256).optional(),
19154
18746
  tooltip: indicatorTextSchema(1024).optional()
19155
- }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
18747
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
19156
18748
  message: "Composer indicator IDs must be unique"
19157
18749
  });
19158
18750
  var threadUsageSnapshotSchema = external_exports.object({
@@ -19178,6 +18770,7 @@ var threadUsageSnapshotSchema = external_exports.object({
19178
18770
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
19179
18771
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
19180
18772
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
18773
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
19181
18774
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
19182
18775
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
19183
18776
  }).strict().superRefine((usage, context) => {
@@ -19305,10 +18898,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
19305
18898
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
19306
18899
  message: "Value must not be empty or whitespace"
19307
18900
  });
19308
- var harnessModelRefIdSchema = nonBlankTextSchema2.max(HARNESS_MODEL_REF_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Model Ref must use transport-safe opaque characters").brand();
18901
+ 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();
18902
+ var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
19309
18903
  var harnessModelRefSchema = external_exports.object({
19310
- id: harnessModelRefIdSchema
18904
+ id: harnessModelRefIdSchema,
18905
+ serviceTier: harnessModelServiceTierSchema.optional()
19311
18906
  }).strict();
18907
+ function sameHarnessModelRef(left, right) {
18908
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
18909
+ }
19312
18910
  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();
19313
18911
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
19314
18912
  var harnessThinkingOptionSchema = external_exports.object({
@@ -19322,7 +18920,15 @@ var harnessModelSchema = external_exports.object({
19322
18920
  /** Optional opaque selection for this same Model with priority processing enabled. */
19323
18921
  fastModel: harnessModelRefSchema.optional(),
19324
18922
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
19325
- }).strict();
18923
+ }).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
18924
+ path: ["fastModel", "id"],
18925
+ message: "A tiered Fast Model must share the base Model ID"
18926
+ });
18927
+ function catalogModelForRef(catalog, ref) {
18928
+ if (!ref)
18929
+ return void 0;
18930
+ return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
18931
+ }
19326
18932
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options2, context) => {
19327
18933
  const ids = /* @__PURE__ */ new Set();
19328
18934
  for (const [index, option] of options2.entries()) {
@@ -19342,26 +18948,26 @@ var harnessModelCatalogSchema = external_exports.object({
19342
18948
  thinkingOptions: harnessThinkingOptionsSchema,
19343
18949
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
19344
18950
  }).strict().superRefine((catalog, context) => {
19345
- const refs = /* @__PURE__ */ new Set();
19346
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
18951
+ const refs = [];
18952
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
19347
18953
  for (const [index, model2] of catalog.models.entries()) {
19348
- if (refs.has(model2.ref.id)) {
18954
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
19349
18955
  context.addIssue({
19350
18956
  code: "custom",
19351
18957
  message: "Model Catalog refs must be unique",
19352
18958
  path: ["models", index, "ref", "id"]
19353
18959
  });
19354
18960
  }
19355
- refs.add(model2.ref.id);
18961
+ refs.push(model2.ref);
19356
18962
  if (model2.fastModel) {
19357
- if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
18963
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
19358
18964
  context.addIssue({
19359
18965
  code: "custom",
19360
18966
  message: "Fast Model refs must be distinct and unique",
19361
18967
  path: ["models", index, "fastModel"]
19362
18968
  });
19363
18969
  }
19364
- refs.add(model2.fastModel.id);
18970
+ refs.push(model2.fastModel);
19365
18971
  }
19366
18972
  const supportedThinkingIds = /* @__PURE__ */ new Set();
19367
18973
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -19382,7 +18988,7 @@ var harnessModelCatalogSchema = external_exports.object({
19382
18988
  }
19383
18989
  }
19384
18990
  }
19385
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
18991
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
19386
18992
  context.addIssue({
19387
18993
  code: "custom",
19388
18994
  message: "Default Model must exist in the Model Catalog",
@@ -19422,7 +19028,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
19422
19028
  observe: external_exports.boolean()
19423
19029
  }).strict().optional(),
19424
19030
  /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
19425
- steer: external_exports.boolean().optional()
19031
+ steer: external_exports.boolean().optional(),
19032
+ /**
19033
+ * True when the native plan (task list) outlives the Turn that changed it, so a reopened
19034
+ * Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
19035
+ */
19036
+ persistentPlan: external_exports.boolean().optional()
19426
19037
  }).strict();
19427
19038
  var harnessConfigurationStateSchema = external_exports.object({
19428
19039
  effectiveModel: harnessModelRefSchema.optional(),
@@ -19431,7 +19042,7 @@ var harnessConfigurationStateSchema = external_exports.object({
19431
19042
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
19432
19043
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
19433
19044
  }).strict().superRefine((state, context) => {
19434
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
19045
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
19435
19046
  context.addIssue({
19436
19047
  code: "custom",
19437
19048
  message: "Effective Thinking option must be currently available",
@@ -19471,7 +19082,8 @@ var harnessInspectParamsSchema = external_exports.object({
19471
19082
  cwd: nonBlankTextSchema2.max(16384).optional(),
19472
19083
  refresh: external_exports.boolean().optional(),
19473
19084
  /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
19474
- purpose: external_exports.literal("availability").optional()
19085
+ purpose: external_exports.literal("availability").optional(),
19086
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
19475
19087
  }).strict();
19476
19088
  var harnessWebUiOpenParamsSchema = external_exports.object({
19477
19089
  harnessId: harnessIdSchema
@@ -19502,12 +19114,14 @@ var codexThreadInspectionSchema = external_exports.object({
19502
19114
  var externalThreadInspectionSchema = external_exports.object({
19503
19115
  owner: external_exports.literal("external"),
19504
19116
  harnessId: nonBlankTextSchema2.max(256),
19505
- transportModelId: nonBlankTextSchema2.max(1024),
19117
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
19506
19118
  effectiveModel: harnessModelRefSchema.optional(),
19507
19119
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
19508
19120
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
19509
19121
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
19510
19122
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
19123
+ /** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
19124
+ catalog: harnessModelCatalogSchema.optional(),
19511
19125
  history: harnessHistoryCapabilitiesSchema,
19512
19126
  usage: threadUsageSnapshotSchema.optional(),
19513
19127
  locked: external_exports.literal(true)
@@ -19566,9 +19180,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
19566
19180
  }).strict();
19567
19181
  var threadSteeringContextSchema = external_exports.object({
19568
19182
  kind: external_exports.literal("application"),
19569
- value: external_exports.string().transform((text, context) => {
19183
+ value: external_exports.string().transform((text2, context) => {
19570
19184
  try {
19571
- return JSON.parse(text);
19185
+ return JSON.parse(text2);
19572
19186
  } catch {
19573
19187
  context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
19574
19188
  return external_exports.NEVER;
@@ -19584,6 +19198,551 @@ var threadSteeringInspectResultSchema = external_exports.object({
19584
19198
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
19585
19199
  }).strict();
19586
19200
 
19201
+ // ../../shared-contracts/dist/harness-plugins.js
19202
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
19203
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
19204
+ var HARNESS_PLUGIN_LIMIT = 128;
19205
+ var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
19206
+ var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
19207
+ var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
19208
+ 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");
19209
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
19210
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
19211
+ var harnessInstallationGuideSchema = external_exports.object({
19212
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
19213
+ before: localizedTextSchema.optional(),
19214
+ after: localizedTextSchema.optional(),
19215
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
19216
+ }).strict();
19217
+ var pluginPresentationShape = {
19218
+ id: installedHarnessPluginIdSchema,
19219
+ name: external_exports.string().trim().min(1).max(128),
19220
+ version: external_exports.string().min(1).max(128),
19221
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
19222
+ kind: external_exports.literal("usage").optional(),
19223
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
19224
+ iconStyle: external_exports.object({
19225
+ vector: external_exports.object({
19226
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
19227
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
19228
+ paths: external_exports.array(external_exports.object({
19229
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
19230
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
19231
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
19232
+ }).strict()).min(1).max(32)
19233
+ }).strict().optional(),
19234
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
19235
+ borderRadius: external_exports.number().min(0).max(50).optional(),
19236
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
19237
+ }).strict().optional(),
19238
+ installation: harnessInstallationGuideSchema.optional(),
19239
+ notice: localizedTextSchema.optional(),
19240
+ /** The factory accepts a persisted local entrypoint through its construction context. */
19241
+ launchCommand: external_exports.literal(true).optional(),
19242
+ links: external_exports.object({
19243
+ website: documentationUrlSchema.optional(),
19244
+ documentation: documentationUrlSchema.optional(),
19245
+ installation: documentationUrlSchema.optional()
19246
+ }).strict().optional()
19247
+ };
19248
+ var harnessPluginManifestSchema = external_exports.object({
19249
+ manifestVersion: external_exports.literal(1),
19250
+ ...pluginPresentationShape,
19251
+ adapterApiVersion: external_exports.number().int().positive(),
19252
+ entry: pluginRelativeResourceSchema,
19253
+ icon: pluginRelativeResourceSchema.optional()
19254
+ }).strict();
19255
+ 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);
19256
+ var harnessPluginDescriptorSchema = external_exports.object({
19257
+ ...pluginPresentationShape,
19258
+ icon: harnessPluginIconSchema.optional()
19259
+ }).strict();
19260
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
19261
+ var harnessPluginListResultSchema = external_exports.object({
19262
+ plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
19263
+ }).strict();
19264
+ var harnessPluginConfigurationSchema = external_exports.object({
19265
+ version: external_exports.literal(1),
19266
+ enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
19267
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
19268
+ message: "Enabled plugin IDs must be unique",
19269
+ path: ["enabled"]
19270
+ });
19271
+
19272
+ // ../../shared-contracts/dist/desktop-extensions.js
19273
+ var DESKTOP_EXTENSION_API_VERSION = 1;
19274
+ var DESKTOP_EXTENSION_LIMIT = 64;
19275
+ var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
19276
+ var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
19277
+ var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
19278
+ var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
19279
+ var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
19280
+ var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
19281
+ var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
19282
+ var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
19283
+ var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
19284
+ var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
19285
+ var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
19286
+ var desktopExtensionIdSchema = installedPluginIdSchema;
19287
+ var desktopExtensionSlotSchema = external_exports.enum([
19288
+ "sidebar.thread-layout",
19289
+ "sidebar.thread-badge",
19290
+ "appearance.theme"
19291
+ ]);
19292
+ var desktopExtensionCategorySchema = external_exports.enum([
19293
+ "appearance",
19294
+ "interface",
19295
+ "workflow",
19296
+ "analytics",
19297
+ "integrations",
19298
+ "tools"
19299
+ ]);
19300
+ var extensionName = external_exports.string().trim().min(1).max(128);
19301
+ function desktopExtensionScreenshotMimeType(resource) {
19302
+ switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
19303
+ case "png":
19304
+ return "image/png";
19305
+ case "jpg":
19306
+ case "jpeg":
19307
+ return "image/jpeg";
19308
+ case "webp":
19309
+ return "image/webp";
19310
+ default:
19311
+ return void 0;
19312
+ }
19313
+ }
19314
+ var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
19315
+ 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");
19316
+ 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) => {
19317
+ const { username, password } = new URL(value);
19318
+ return !username && !password && !/[\\\s]/u.test(value);
19319
+ }, "URL must not contain credentials, backslashes, or whitespace");
19320
+ function localizedText(text2) {
19321
+ return external_exports.strictObject({ en: text2, "zh-CN": text2 });
19322
+ }
19323
+ var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
19324
+ var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
19325
+ var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
19326
+ var settingField = {
19327
+ key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
19328
+ label: desktopExtensionLocalizedTextSchema,
19329
+ description: desktopExtensionLocalizedTextSchema.optional()
19330
+ };
19331
+ var numericSetting = {
19332
+ ...settingField,
19333
+ step: external_exports.number().positive().optional(),
19334
+ default: external_exports.number().optional()
19335
+ };
19336
+ var settingOption = external_exports.strictObject({
19337
+ value: external_exports.string(),
19338
+ label: desktopExtensionLocalizedTextSchema
19339
+ });
19340
+ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
19341
+ external_exports.strictObject({
19342
+ ...settingField,
19343
+ type: external_exports.literal("boolean"),
19344
+ default: external_exports.boolean().optional()
19345
+ }),
19346
+ external_exports.strictObject({
19347
+ ...settingField,
19348
+ type: external_exports.literal("string"),
19349
+ placeholder: desktopExtensionLocalizedTextSchema.optional(),
19350
+ default: external_exports.string().optional()
19351
+ }),
19352
+ external_exports.strictObject({
19353
+ ...numericSetting,
19354
+ type: external_exports.literal("number"),
19355
+ min: external_exports.number().optional(),
19356
+ max: external_exports.number().optional()
19357
+ }),
19358
+ external_exports.strictObject({
19359
+ ...numericSetting,
19360
+ type: external_exports.literal("range"),
19361
+ min: external_exports.number(),
19362
+ max: external_exports.number()
19363
+ }),
19364
+ external_exports.strictObject({
19365
+ ...settingField,
19366
+ type: external_exports.literal("select"),
19367
+ options: external_exports.array(settingOption).min(1),
19368
+ default: external_exports.string().optional()
19369
+ })
19370
+ ]).superRefine((field2, ctx) => {
19371
+ const issue2 = (path7, message) => ctx.addIssue({ code: "custom", path: [path7], message });
19372
+ if (field2.type === "number" || field2.type === "range") {
19373
+ const { min = -Infinity, max = Infinity, default: value } = field2;
19374
+ if (min > max)
19375
+ issue2("max", "Must be at least min");
19376
+ if (value !== void 0 && (value < min || value > max))
19377
+ issue2("default", "Must be within min and max");
19378
+ } else if (field2.type === "select") {
19379
+ const values = new Set(field2.options.map(({ value }) => value));
19380
+ if (values.size !== field2.options.length)
19381
+ issue2("options", "Duplicate option values");
19382
+ if (field2.default !== void 0 && !values.has(field2.default))
19383
+ issue2("default", "Must match an option value");
19384
+ }
19385
+ });
19386
+ var manifestHeader = external_exports.object({
19387
+ manifestVersion: external_exports.int().positive(),
19388
+ id: desktopExtensionIdSchema,
19389
+ name: external_exports.union([extensionName, localizedText(extensionName)]),
19390
+ version: external_exports.string().min(1).max(128),
19391
+ desktopApi: external_exports.int().positive()
19392
+ }).passthrough();
19393
+ var desktopExtensionManifestSchema = manifestHeader.extend({
19394
+ manifestVersion: external_exports.literal(1),
19395
+ desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
19396
+ description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
19397
+ author: external_exports.string().trim().min(1).max(128).optional(),
19398
+ repository: desktopExtensionHttpUrlSchema.optional(),
19399
+ details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
19400
+ icon: imagePathSchema.optional(),
19401
+ screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
19402
+ desktop: external_exports.strictObject({
19403
+ script: pluginRelativeResourceSchema,
19404
+ style: pluginRelativeResourceSchema.optional()
19405
+ }).optional(),
19406
+ backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
19407
+ slots: slotsSchema.default(() => []),
19408
+ settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
19409
+ categories: categoriesSchema.optional()
19410
+ }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
19411
+ var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
19412
+ var desktopExtensionStatusSchema = external_exports.strictObject({
19413
+ state: external_exports.enum([
19414
+ "running",
19415
+ "disabled",
19416
+ "invalid",
19417
+ "incompatible",
19418
+ "conflict",
19419
+ "failed",
19420
+ "waiting"
19421
+ ]),
19422
+ hash: desktopExtensionHashSchema.optional(),
19423
+ error: external_exports.string().optional(),
19424
+ conflictWith: desktopExtensionIdSchema.optional()
19425
+ });
19426
+ var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
19427
+ controllerPid: external_exports.int().positive(),
19428
+ targetId: external_exports.string().nullable(),
19429
+ updatedAt: external_exports.iso.datetime(),
19430
+ handledReloadToken: external_exports.uuid().optional(),
19431
+ extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
19432
+ surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
19433
+ });
19434
+ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
19435
+ function isGitHubDesktopExtensionZipballUrl(url2) {
19436
+ return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
19437
+ }
19438
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
19439
+ const url2 = new URL(input2);
19440
+ 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);
19441
+ }, "Expected a .zip download URL or a GitHub zipball URL");
19442
+ var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
19443
+ id: desktopExtensionIdSchema,
19444
+ version: external_exports.string().trim().min(1).max(128),
19445
+ name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
19446
+ description: localizedText(external_exports.string().trim().min(1).max(4096)),
19447
+ details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
19448
+ author: external_exports.string().trim().min(1).max(128),
19449
+ repository: desktopExtensionHttpUrlSchema,
19450
+ stars: external_exports.number().int().min(0).optional(),
19451
+ downloads: external_exports.number().int().min(0).optional(),
19452
+ categories: categoriesSchema.optional(),
19453
+ trustTier: desktopExtensionTrustTierSchema.default("community"),
19454
+ icon: desktopExtensionHttpUrlSchema.optional(),
19455
+ screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
19456
+ downloadUrl: desktopExtensionZipUrlSchema,
19457
+ sha256: desktopExtensionHashSchema,
19458
+ slots: slotsSchema.optional(),
19459
+ publishedAt: external_exports.string().optional(),
19460
+ updatedAt: external_exports.string().optional(),
19461
+ minCodexHostVersion: external_exports.string().optional()
19462
+ });
19463
+ var desktopExtensionCatalogSchema = external_exports.strictObject({
19464
+ schemaVersion: external_exports.literal(1),
19465
+ generatedAt: external_exports.string(),
19466
+ extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
19467
+ });
19468
+ var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
19469
+
19470
+ // ../../shared-contracts/dist/host-extensions.js
19471
+ var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
19472
+ var HOST_EXTENSION_PAGE_API_VERSION = 1;
19473
+ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
19474
+ var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
19475
+ var hostExtensionDigestSchema = desktopExtensionHashSchema;
19476
+ var hostExtensionActivationIdSchema = external_exports.uuid();
19477
+ 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((path7) => path7.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
19478
+ var legacy = desktopExtensionManifestSchema.shape;
19479
+ var localized = (max, min = 0) => external_exports.strictObject({
19480
+ en: external_exports.string().trim().min(min).max(max),
19481
+ "zh-CN": external_exports.string().trim().min(min).max(max)
19482
+ });
19483
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path7) => path7.endsWith(suffix), `Expected a ${suffix} file`);
19484
+ var moduleEntry = resourceWithSuffix(".mjs");
19485
+ var style = resourceWithSuffix(".css").optional();
19486
+ var hostExtensionCanonicalPath = (path7) => path7.normalize("NFC").toLowerCase();
19487
+ var hostExtensionManifestV2Schema = external_exports.strictObject({
19488
+ manifestVersion: external_exports.literal(2),
19489
+ id: hostExtensionIdSchema,
19490
+ name: localized(128, 1),
19491
+ version: external_exports.string().trim().min(1).max(128),
19492
+ description: localized(4096),
19493
+ details: localized(16384).optional(),
19494
+ author: legacy.author,
19495
+ repository: legacy.repository,
19496
+ icon: legacy.icon.refine((path7) => path7 === void 0 || hostExtensionResourcePathSchema.safeParse(path7).success),
19497
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path7) => hostExtensionResourcePathSchema.safeParse(path7).success)),
19498
+ categories: legacy.categories,
19499
+ settingsSchema: legacy.settingsSchema,
19500
+ slots: legacy.slots.removeDefault().optional(),
19501
+ page: external_exports.strictObject({
19502
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
19503
+ entry: moduleEntry,
19504
+ style,
19505
+ title: localized(128, 1).optional()
19506
+ }).optional(),
19507
+ widget: external_exports.strictObject({
19508
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
19509
+ entry: moduleEntry,
19510
+ style
19511
+ }).optional(),
19512
+ desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
19513
+ 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(),
19514
+ backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
19515
+ }).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" });
19516
+ function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
19517
+ if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
19518
+ return ["desktop", "web"];
19519
+ const targets = [];
19520
+ if (hasDesktop)
19521
+ targets.push("desktop");
19522
+ if (hasWeb)
19523
+ targets.push("web");
19524
+ return targets;
19525
+ }
19526
+ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
19527
+
19528
+ // ../../shared-contracts/dist/host-extension-management.js
19529
+ var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
19530
+ var hostExtensionRevisionSchema = external_exports.int().nonnegative();
19531
+ var hostExtensionConfigurationSchema = external_exports.strictObject({
19532
+ revision: hostExtensionRevisionSchema,
19533
+ enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
19534
+ });
19535
+ var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
19536
+ var hostExtensionCatalogEntrySchema = external_exports.object({
19537
+ ...catalogMetadata,
19538
+ id: hostExtensionIdSchema,
19539
+ format: external_exports.literal("codexhost"),
19540
+ targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
19541
+ apis: external_exports.strictObject({
19542
+ page: external_exports.int().positive().optional(),
19543
+ widget: external_exports.int().positive().optional(),
19544
+ desktop: external_exports.int().positive().optional(),
19545
+ web: external_exports.int().positive().optional(),
19546
+ backend: external_exports.int().positive().optional()
19547
+ }),
19548
+ downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
19549
+ }).refine(({ targets, apis }) => {
19550
+ const derived = targetsForCapabilities({
19551
+ hasPage: Boolean(apis.page),
19552
+ hasWidget: Boolean(apis.widget),
19553
+ hasDesktop: Boolean(apis.desktop),
19554
+ hasWeb: Boolean(apis.web),
19555
+ hasBackend: Boolean(apis.backend)
19556
+ });
19557
+ return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
19558
+ }, "Catalog targets must match the declared APIs");
19559
+ var hostExtensionCatalogSchema = external_exports.object({
19560
+ schemaVersion: external_exports.literal(2),
19561
+ generatedAt: external_exports.string().min(1),
19562
+ extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
19563
+ });
19564
+ var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
19565
+ catalogUrl: desktopExtensionHttpUrlSchema,
19566
+ fetchedAt: external_exports.iso.datetime(),
19567
+ cached: external_exports.boolean()
19568
+ });
19569
+ var id = { id: hostExtensionIdSchema };
19570
+ var active = {
19571
+ ...id,
19572
+ activationId: hostExtensionActivationIdSchema,
19573
+ digest: hostExtensionDigestSchema
19574
+ };
19575
+ var optionalActivation = { ...id, activationId: active.activationId.optional() };
19576
+ var filePath = external_exports.string().min(1).max(4096).refine((path7) => /^(?:\/|[a-z]:[/\\])/iu.test(path7) && !path7.includes("\0") && !path7.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
19577
+ 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");
19578
+ function base643(maxBytes) {
19579
+ return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
19580
+ const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
19581
+ return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
19582
+ }, "Expected bounded standard padded base64");
19583
+ }
19584
+ var hostExtensionGitHubSourceSchema = external_exports.strictObject({
19585
+ type: external_exports.literal("github"),
19586
+ repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
19587
+ ref: gitRef.optional(),
19588
+ tag: gitRef.optional(),
19589
+ asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
19590
+ subpath: hostExtensionResourcePathSchema.optional()
19591
+ }).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
19592
+ var hostExtensionInstallSourceSchema = external_exports.union([
19593
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
19594
+ hostExtensionGitHubSourceSchema,
19595
+ external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
19596
+ external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
19597
+ external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
19598
+ ]);
19599
+ var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
19600
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
19601
+ hostExtensionGitHubSourceSchema,
19602
+ external_exports.strictObject({ type: external_exports.literal("zip") }),
19603
+ external_exports.strictObject({ type: external_exports.literal("localDir") })
19604
+ ]);
19605
+ var hostExtensionInstallationSchema = external_exports.strictObject({
19606
+ ...active,
19607
+ manifest: hostExtensionManifestV2Schema,
19608
+ installedAt: external_exports.iso.datetime(),
19609
+ source: hostExtensionProvenanceSchema.optional()
19610
+ });
19611
+ 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);
19612
+ var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
19613
+ var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
19614
+ var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
19615
+ hostExtensionInstallationSchema.extend({
19616
+ state: external_exports.literal("valid"),
19617
+ enabled: external_exports.boolean(),
19618
+ ...desktopConflict,
19619
+ iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
19620
+ screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
19621
+ backendState: backendState.optional(),
19622
+ backendError: external_exports.string().optional()
19623
+ }),
19624
+ external_exports.strictObject({
19625
+ state: external_exports.enum(["invalid", "incompatible"]),
19626
+ id: external_exports.string().min(1),
19627
+ enabled: external_exports.boolean(),
19628
+ error: external_exports.string()
19629
+ })
19630
+ ]);
19631
+ var hostExtensionsListResultSchema = external_exports.strictObject({
19632
+ revision: hostExtensionRevisionSchema,
19633
+ configuration: hostExtensionConfigurationSchema,
19634
+ diagnostics: external_exports.array(external_exports.string()),
19635
+ extensions: external_exports.array(hostExtensionListItemSchema)
19636
+ });
19637
+ var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
19638
+ ...desktopConflict,
19639
+ settingsRevision: hostExtensionRevisionSchema
19640
+ });
19641
+ var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
19642
+ /** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
19643
+ revision: hostExtensionRevisionSchema,
19644
+ // Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
19645
+ extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
19646
+ });
19647
+ var HOST_EXTENSIONS_RPC = {
19648
+ list: "codexhost/extensions/list",
19649
+ snapshot: "codexhost/extensions/snapshot",
19650
+ catalog: "codexhost/extensions/catalog",
19651
+ install: "codexhost/extensions/install",
19652
+ update: "codexhost/extensions/update",
19653
+ enable: "codexhost/extensions/enable",
19654
+ disable: "codexhost/extensions/disable",
19655
+ uninstall: "codexhost/extensions/uninstall",
19656
+ recover: "codexhost/extensions/recover",
19657
+ asset: "codexhost/extensions/asset",
19658
+ settingsGet: "codexhost/extensions/settings/get",
19659
+ settingsSet: "codexhost/extensions/settings/set",
19660
+ backendInvoke: "codexhost/extensions/backend/invoke"
19661
+ };
19662
+ var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
19663
+ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
19664
+ var noParams = external_exports.strictObject({});
19665
+ var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
19666
+ var selection = external_exports.strictObject({ ...id, ...expectedRevision });
19667
+ var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
19668
+ var mutationResult = external_exports.discriminatedUnion("state", [
19669
+ external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
19670
+ external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
19671
+ ]);
19672
+ var hostExtensionsAssetParamsSchema = external_exports.strictObject({
19673
+ ...optionalActivation,
19674
+ digest: active.digest.optional(),
19675
+ path: hostExtensionResourcePathSchema
19676
+ });
19677
+ var hostExtensionsAssetResultSchema = external_exports.strictObject({
19678
+ mimeType: external_exports.string().min(1),
19679
+ base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
19680
+ digest: active.digest
19681
+ });
19682
+ var hostExtensionSettingsSchema = external_exports.strictObject({
19683
+ settingsRevision: hostExtensionRevisionSchema,
19684
+ values: jsonObjectSchema
19685
+ });
19686
+ var hostExtensionsRpcSchemas = {
19687
+ [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
19688
+ [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
19689
+ [HOST_EXTENSIONS_RPC.catalog]: {
19690
+ params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
19691
+ result: hostExtensionsCatalogResultSchema
19692
+ },
19693
+ [HOST_EXTENSIONS_RPC.install]: {
19694
+ params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
19695
+ result: installationResult
19696
+ },
19697
+ [HOST_EXTENSIONS_RPC.update]: {
19698
+ params: external_exports.strictObject({
19699
+ ...id,
19700
+ expectedDigest: active.digest,
19701
+ expectedActivationId: active.activationId.optional(),
19702
+ source: hostExtensionInstallSourceSchema.optional()
19703
+ }),
19704
+ result: installationResult
19705
+ },
19706
+ [HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
19707
+ [HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
19708
+ [HOST_EXTENSIONS_RPC.uninstall]: {
19709
+ params: external_exports.strictObject({
19710
+ ...id,
19711
+ removeData: external_exports.boolean().optional(),
19712
+ expectedDigest: active.digest.optional()
19713
+ }),
19714
+ result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
19715
+ },
19716
+ [HOST_EXTENSIONS_RPC.recover]: {
19717
+ params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
19718
+ result: mutationResult
19719
+ },
19720
+ [HOST_EXTENSIONS_RPC.asset]: {
19721
+ params: hostExtensionsAssetParamsSchema,
19722
+ result: hostExtensionsAssetResultSchema
19723
+ },
19724
+ [HOST_EXTENSIONS_RPC.settingsGet]: {
19725
+ params: external_exports.strictObject(optionalActivation),
19726
+ result: hostExtensionSettingsSchema
19727
+ },
19728
+ [HOST_EXTENSIONS_RPC.settingsSet]: {
19729
+ params: external_exports.strictObject({
19730
+ ...optionalActivation,
19731
+ expectedSettingsRevision: hostExtensionRevisionSchema,
19732
+ values: jsonObjectSchema
19733
+ }),
19734
+ result: hostExtensionSettingsSchema
19735
+ },
19736
+ [HOST_EXTENSIONS_RPC.backendInvoke]: {
19737
+ params: external_exports.strictObject({
19738
+ ...optionalActivation,
19739
+ method: hostExtensionBackendMethodSchema,
19740
+ params: jsonValueSchema.optional()
19741
+ }),
19742
+ result: external_exports.strictObject({ result: jsonValueSchema })
19743
+ }
19744
+ };
19745
+
19587
19746
  // ../../shared-contracts/dist/thread-archive-confirm.js
19588
19747
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
19589
19748
  var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
@@ -19628,6 +19787,8 @@ var CLIENT_CHANNEL_METHODS = [
19628
19787
  "codexhost/workspace/read",
19629
19788
  "codexhost/thread/tree/read",
19630
19789
  "codexhost/thread/pins/list",
19790
+ "codexhost/thread/sections/list",
19791
+ "codexhost/thread/sections/move",
19631
19792
  "codexhost/thread/pins/set",
19632
19793
  "codexhost/harness/plugins/list",
19633
19794
  "codexhost/harness/inspect",
@@ -19645,7 +19806,7 @@ var CLIENT_CHANNEL_METHODS = [
19645
19806
  "codexhost/harness/session-import/list",
19646
19807
  "codexhost/harness/session-import/import",
19647
19808
  // Host settings shared across Desktop and Web.
19648
- ...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
19809
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
19649
19810
  "codexhost/harness/installation",
19650
19811
  "codexhost/harness/installation/start",
19651
19812
  "codexhost/harness/installation/status",
@@ -19666,8 +19827,21 @@ var CLIENT_CHANNEL_METHODS = [
19666
19827
  "codexhost/update/check",
19667
19828
  "codexhost/update/start",
19668
19829
  "codexhost/update/status",
19830
+ "codexhost/announcement/get",
19831
+ "codexhost/announcement/acknowledge",
19669
19832
  "codexhost/sessions/loaded/list"
19670
19833
  ];
19834
+ var clientThreadSectionsSchema = external_exports.object({
19835
+ sections: external_exports.array(external_exports.object({
19836
+ id: external_exports.string().min(1),
19837
+ name: external_exports.string().min(1),
19838
+ threads: external_exports.array(jsonObjectSchema)
19839
+ }).strict())
19840
+ }).strict();
19841
+ var clientThreadSectionMoveSchema = external_exports.object({
19842
+ threadId: external_exports.string().min(1).max(1024),
19843
+ sectionId: external_exports.string().min(1).max(1024).nullable()
19844
+ }).strict();
19671
19845
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
19672
19846
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
19673
19847
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -19706,6 +19880,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
19706
19880
  cursor: clientChannelCursorSchema,
19707
19881
  revision: external_exports.number().int().nonnegative()
19708
19882
  }),
19883
+ external_exports.object({
19884
+ type: external_exports.literal("extensions-changed"),
19885
+ cursor: clientChannelCursorSchema,
19886
+ revision: hostExtensionRevisionSchema
19887
+ }),
19709
19888
  external_exports.object({
19710
19889
  type: external_exports.literal("hello"),
19711
19890
  version: external_exports.literal(1),
@@ -20142,7 +20321,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
20142
20321
 
20143
20322
  // ../../shared-contracts/dist/harness-preferences.js
20144
20323
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
20145
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
20324
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
20146
20325
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
20147
20326
  model: harnessModelRefSchema.optional(),
20148
20327
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -20152,11 +20331,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
20152
20331
  lastHarness: harnessIdSchema.optional(),
20153
20332
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
20154
20333
  });
20334
+ var harnessDelegationDefaultSchema = external_exports.strictObject({
20335
+ model: harnessModelRefSchema.optional(),
20336
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional()
20337
+ }).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
20338
+ var delegationDefaultsSchema = external_exports.strictObject({
20339
+ byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
20340
+ });
20155
20341
  var modelId = external_exports.string().min(1).max(1024);
20156
20342
  var harnessPreferenceValuesSchema = external_exports.strictObject({
20157
20343
  idleRelease: idleReleaseSettingsSchema.optional(),
20158
20344
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
20159
- newThread: newThreadDefaultsSchema.optional()
20345
+ newThread: newThreadDefaultsSchema.optional(),
20346
+ delegation: delegationDefaultsSchema.optional()
20160
20347
  });
20161
20348
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
20162
20349
  scope: harnessPreferenceScopeSchema,
@@ -20184,6 +20371,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
20184
20371
  lastHarness: harnessIdSchema.optional(),
20185
20372
  harnessId: harnessIdSchema.optional(),
20186
20373
  configuration: harnessDefaultConfigurationSchema.optional()
20374
+ }),
20375
+ external_exports.strictObject({
20376
+ kind: external_exports.literal("delegation"),
20377
+ harnessId: harnessIdSchema,
20378
+ configuration: harnessDelegationDefaultSchema.nullable()
20187
20379
  })
20188
20380
  ]);
20189
20381
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -20191,8 +20383,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
20191
20383
  operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
20192
20384
  initializeOnly: external_exports.boolean().optional(),
20193
20385
  expectedRevision: external_exports.number().int().nonnegative().optional()
20194
- }).superRefine((input, ctx) => {
20195
- for (const operation of input.operations) {
20386
+ }).superRefine((input2, ctx) => {
20387
+ for (const operation of input2.operations) {
20196
20388
  if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
20197
20389
  ctx.addIssue({
20198
20390
  code: "custom",
@@ -20594,13 +20786,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
20594
20786
  // ../../shared-contracts/dist/harness-installation.js
20595
20787
  var harnessInstallationParamsSchema = external_exports.object({
20596
20788
  harnessId: harnessIdSchema,
20597
- action: external_exports.enum(["check", "update", "install"])
20598
- }).strict();
20789
+ action: external_exports.enum(["check", "update", "install"]),
20790
+ confirmedVersion: external_exports.string().min(1).max(128).optional()
20791
+ }).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
20599
20792
  var harnessInstallationStateSchema = external_exports.object({
20600
20793
  currentVersion: external_exports.string().min(1).max(128),
20601
20794
  latestVersion: external_exports.string().min(1).max(128),
20602
20795
  updateAvailable: external_exports.boolean(),
20603
20796
  canUpdate: external_exports.boolean(),
20797
+ /** Present when the Adapter has a verified list and the available target is outside it. */
20798
+ latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
20799
+ /** Update preflight stopped before running the installer; latestVersion needs confirmation. */
20800
+ confirmationRequired: external_exports.literal(true).optional(),
20604
20801
  /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
20605
20802
  versionKind: external_exports.enum(["cli", "application"]).optional(),
20606
20803
  /** Official download opened by the user; does not imply an automatic installation. */
@@ -20930,6 +21127,38 @@ var updateStatusResultSchema = external_exports.strictObject({
20930
21127
  status: updateStatusSchema.nullable()
20931
21128
  });
20932
21129
 
21130
+ // ../../shared-contracts/dist/release-announcement.js
21131
+ var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
21132
+ var releaseAnnouncementThemeSchema = external_exports.strictObject({
21133
+ icon: external_exports.string().min(1).max(16).optional(),
21134
+ title: external_exports.string().min(1).max(120),
21135
+ body: external_exports.string().min(1).max(1200),
21136
+ contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
21137
+ });
21138
+ var releaseAnnouncementContentSchema = external_exports.strictObject({
21139
+ summary: external_exports.string().min(1).max(600).optional(),
21140
+ themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
21141
+ });
21142
+ var releaseAnnouncementSchema = external_exports.strictObject({
21143
+ version: updateSemanticVersionSchema,
21144
+ publishedAt: external_exports.iso.datetime(),
21145
+ url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
21146
+ zh: releaseAnnouncementContentSchema.nullable(),
21147
+ en: releaseAnnouncementContentSchema.nullable()
21148
+ }).refine((value) => value.zh !== null || value.en !== null, {
21149
+ message: "an announcement needs at least one language"
21150
+ });
21151
+ var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
21152
+ manual: external_exports.boolean().optional()
21153
+ });
21154
+ var releaseAnnouncementGetResultSchema = external_exports.strictObject({
21155
+ announcement: releaseAnnouncementSchema.nullable(),
21156
+ unread: external_exports.boolean()
21157
+ });
21158
+ var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
21159
+ version: updateSemanticVersionSchema
21160
+ });
21161
+
20933
21162
  // ../../shared-contracts/dist/thread-watch-notice.js
20934
21163
  var THREAD_WATCH_NOTICE_OUTCOMES = [
20935
21164
  "completed",
@@ -20977,17 +21206,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
20977
21206
 
20978
21207
  // ../../shared-contracts/dist/remote-sessions.js
20979
21208
  var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
20980
- var identity = external_exports.string().min(1).max(1024);
21209
+ var REMOTE_IDENTITY_MAX_LENGTH = 1024;
21210
+ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
20981
21211
  var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
20982
21212
  var thread = { ...target, threadId: identity };
21213
+ var text = external_exports.string().min(1).max(8e3);
21214
+ var input = { text, requestId: identity };
21215
+ var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
21216
+ external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
21217
+ external_exports.object({
21218
+ accepted: external_exports.literal(false),
21219
+ code: external_exports.enum([
21220
+ "remote/queue-unavailable",
21221
+ "remote/steer-unavailable",
21222
+ "remote/turn-changed",
21223
+ "remote/send-rejected",
21224
+ "session/queue-item-not-found",
21225
+ "session/queue-item-starting"
21226
+ ]),
21227
+ message: external_exports.string()
21228
+ })
21229
+ ]);
21230
+ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
21231
+ external_exports.object({ available: external_exports.literal(false) }),
21232
+ external_exports.object({
21233
+ available: external_exports.literal(true),
21234
+ items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
21235
+ })
21236
+ ]);
20983
21237
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
20984
21238
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
21239
+ external_exports.strictObject({
21240
+ kind: external_exports.literal("create"),
21241
+ ...target,
21242
+ cwd: external_exports.string().min(1).max(8192),
21243
+ epoch: identity
21244
+ }),
21245
+ external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
21246
+ external_exports.strictObject({
21247
+ kind: external_exports.literal("inspectHarness"),
21248
+ ...target,
21249
+ epoch: identity,
21250
+ cwd: external_exports.string().min(1).max(8192),
21251
+ harnessId: identity
21252
+ }),
21253
+ external_exports.strictObject({
21254
+ kind: external_exports.literal("startSelected"),
21255
+ ...target,
21256
+ epoch: identity,
21257
+ cwd: external_exports.string().min(1).max(8192),
21258
+ harnessId: identity,
21259
+ model: external_exports.string().min(1).max(4096),
21260
+ serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
21261
+ reasoningEffort: identity.optional()
21262
+ }),
20985
21263
  external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
20986
21264
  external_exports.strictObject({
20987
21265
  kind: external_exports.literal("list"),
20988
21266
  ...target,
20989
21267
  cursor: external_exports.string().nullable(),
20990
- archived: external_exports.boolean()
21268
+ archived: external_exports.boolean(),
21269
+ includeLoaded: external_exports.literal(true).optional()
20991
21270
  }),
20992
21271
  external_exports.strictObject({
20993
21272
  kind: external_exports.literal("read"),
@@ -21007,16 +21286,35 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
21007
21286
  ...thread,
21008
21287
  epoch: identity,
21009
21288
  modelId: identity.optional(),
21289
+ serviceTier: harnessModelServiceTierSchema.optional(),
21010
21290
  thinkingOptionId: identity.optional(),
21011
21291
  permissionModeId: identity.optional()
21012
- }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
21292
+ }).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, {
21293
+ message: "A service tier requires a Model ID"
21294
+ }),
21013
21295
  external_exports.strictObject({
21014
21296
  kind: external_exports.literal("prompt"),
21015
21297
  ...thread,
21016
21298
  epoch: identity,
21017
- text: external_exports.string().min(1).max(8e3),
21299
+ text,
21018
21300
  requestId: identity.optional()
21019
21301
  }),
21302
+ external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
21303
+ external_exports.strictObject({
21304
+ kind: external_exports.literal("delivery"),
21305
+ ...thread,
21306
+ epoch: identity,
21307
+ action: external_exports.discriminatedUnion("kind", [
21308
+ external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
21309
+ external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
21310
+ external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
21311
+ external_exports.strictObject({
21312
+ kind: external_exports.literal("start"),
21313
+ itemId: identity,
21314
+ onlyIfHead: external_exports.literal(true).optional()
21315
+ })
21316
+ ])
21317
+ }),
21020
21318
  external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
21021
21319
  external_exports.strictObject({
21022
21320
  kind: external_exports.literal("rename"),
@@ -21059,7 +21357,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
21059
21357
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
21060
21358
  external_exports.strictObject({
21061
21359
  action: external_exports.literal("read-thread"),
21062
- hostId: hostId.refine((id) => id !== "local"),
21360
+ hostId: hostId.refine((id2) => id2 !== "local"),
21063
21361
  input: delegationReadParamsSchema
21064
21362
  }),
21065
21363
  external_exports.strictObject({
@@ -21073,7 +21371,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
21073
21371
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
21074
21372
  external_exports.strictObject({
21075
21373
  action: external_exports.literal("update"),
21076
- hostId: hostId.refine((id) => id !== "local"),
21374
+ hostId: hostId.refine((id2) => id2 !== "local"),
21077
21375
  version: remoteUpdateParamsSchema.shape.version
21078
21376
  })
21079
21377
  ]);
@@ -27095,19 +27393,19 @@ function deserializeHookInput(raw) {
27095
27393
  ...stop_hook_active === void 0 ? {} : { stopHookActive: stop_hook_active }
27096
27394
  };
27097
27395
  }
27098
- function normalizeHookError(hookType, input) {
27396
+ function normalizeHookError(hookType, input2) {
27099
27397
  if (hookType !== "errorOccurred" && hookType !== "sessionEnd") {
27100
- return input;
27398
+ return input2;
27101
27399
  }
27102
- if (!input || typeof input !== "object" || !("error" in input)) {
27103
- return input;
27400
+ if (!input2 || typeof input2 !== "object" || !("error" in input2)) {
27401
+ return input2;
27104
27402
  }
27105
- const { error: error51 } = input;
27403
+ const { error: error51 } = input2;
27106
27404
  if (!error51 || typeof error51 !== "object" || Array.isArray(error51)) {
27107
- return input;
27405
+ return input2;
27108
27406
  }
27109
27407
  const { message } = error51;
27110
- return { ...input, error: typeof message === "string" ? message : JSON.stringify(error51) };
27408
+ return { ...input2, error: typeof message === "string" ? message : JSON.stringify(error51) };
27111
27409
  }
27112
27410
  function isOpenCanvasInstance(value) {
27113
27411
  if (!value || typeof value !== "object") {
@@ -27185,11 +27483,11 @@ var WorkflowProgressBuffer = class {
27185
27483
  flushError;
27186
27484
  flushFailed = false;
27187
27485
  closed = false;
27188
- enqueue(kind, text) {
27486
+ enqueue(kind, text2) {
27189
27487
  if (this.closed) {
27190
27488
  throw new Error("Cannot log after the workflow run has settled");
27191
27489
  }
27192
- this.pending.push({ seq: this.nextSeq++, kind, text });
27490
+ this.pending.push({ seq: this.nextSeq++, kind, text: text2 });
27193
27491
  this.scheduleFlush();
27194
27492
  }
27195
27493
  async flush() {
@@ -27733,13 +28031,13 @@ var CopilotSession = class {
27733
28031
  );
27734
28032
  try {
27735
28033
  const sendOutcome = this.send(options2).then(
27736
- (id) => {
27737
- if (!id) {
28034
+ (id2) => {
28035
+ if (!id2) {
27738
28036
  throw new Error(
27739
28037
  "The runtime did not return a message ID for the structured send."
27740
28038
  );
27741
28039
  }
27742
- messageId = id;
28040
+ messageId = id2;
27743
28041
  for (const event of buffered) observe(event);
27744
28042
  buffered.length = 0;
27745
28043
  return outcomePromise;
@@ -28871,12 +29169,12 @@ var CopilotSession = class {
28871
29169
  * @returns A promise that resolves with the hook output, or undefined
28872
29170
  * @internal This method is for internal use by the SDK.
28873
29171
  */
28874
- async _handleHooksInvoke(hookType, input) {
29172
+ async _handleHooksInvoke(hookType, input2) {
28875
29173
  this.assertConnected();
28876
29174
  if (!this.hooks) {
28877
29175
  return void 0;
28878
29176
  }
28879
- const normalized = normalizeHookError(hookType, deserializeHookInput(input));
29177
+ const normalized = normalizeHookError(hookType, deserializeHookInput(input2));
28880
29178
  const handlerMap = {
28881
29179
  preToolUse: this.hooks.onPreToolUse,
28882
29180
  preMcpToolCall: this.hooks.onPreMcpToolCall,
@@ -32614,10 +32912,10 @@ function executableExtensions(command, platform, environment) {
32614
32912
  return [""];
32615
32913
  return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
32616
32914
  }
32617
- function isExecutableFile(filePath, platform) {
32915
+ function isExecutableFile(filePath2, platform) {
32618
32916
  try {
32619
- fs3.accessSync(filePath, platform === "win32" ? fs3.constants.F_OK : fs3.constants.X_OK);
32620
- return fs3.statSync(filePath).isFile();
32917
+ fs3.accessSync(filePath2, platform === "win32" ? fs3.constants.F_OK : fs3.constants.X_OK);
32918
+ return fs3.statSync(filePath2).isFile();
32621
32919
  } catch {
32622
32920
  return false;
32623
32921
  }
@@ -32729,8 +33027,8 @@ var VERSION_MANAGER_ROOTS = "<version-managers>";
32729
33027
  function installRootExtensions(platform) {
32730
33028
  return platform === "win32" ? [".exe", ".cmd"] : [""];
32731
33029
  }
32732
- function resolveHomeDirectory(input) {
32733
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
33030
+ function resolveHomeDirectory(input2) {
33031
+ return input2.homeDirectory ?? environmentValue(input2.environment, "HOME") ?? environmentValue(input2.environment, "USERPROFILE") ?? os.homedir();
32734
33032
  }
32735
33033
  function templateVariables(environment, platform, home) {
32736
33034
  const pathFlavor = targetPath(platform);
@@ -32763,36 +33061,36 @@ function expandInstallRoot(template, environment, platform, home) {
32763
33061
  });
32764
33062
  return unresolved ? void 0 : joinTemplate(platform, substituted);
32765
33063
  }
32766
- function installRootDirectories(spec, input, dependencies, platform, home) {
33064
+ function installRootDirectories(spec, input2, dependencies, platform, home) {
32767
33065
  const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
32768
33066
  const directories = [];
32769
33067
  for (const template of templates) {
32770
33068
  if (template === VERSION_MANAGER_ROOTS) {
32771
33069
  directories.push(...versionManagerBinaryDirectories({
32772
33070
  platform,
32773
- environment: input.environment,
33071
+ environment: input2.environment,
32774
33072
  home,
32775
33073
  ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
32776
33074
  }));
32777
33075
  continue;
32778
33076
  }
32779
- const directory = expandInstallRoot(template, input.environment, platform, home);
33077
+ const directory = expandInstallRoot(template, input2.environment, platform, home);
32780
33078
  if (directory !== void 0)
32781
33079
  directories.push(directory);
32782
33080
  }
32783
33081
  return directories;
32784
33082
  }
32785
- function harnessCandidates(spec, input, dependencies = {}) {
32786
- const platform = input.platform ?? process.platform;
33083
+ function harnessCandidates(spec, input2, dependencies = {}) {
33084
+ const platform = input2.platform ?? process.platform;
32787
33085
  const pathFlavor = targetPath(platform);
32788
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
33086
+ const configured = input2.command ?? (spec.commandEnvironmentVariable ? environmentValue(input2.environment, spec.commandEnvironmentVariable) : void 0);
32789
33087
  const command = configured ?? spec.command;
32790
33088
  if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
32791
33089
  return [{ candidate: command, source: "configured" }];
32792
33090
  }
32793
33091
  const candidates = [];
32794
- const extensions = executableExtensions(command, platform, input.environment);
32795
- for (const directory of pathDirectories(input.environment, platform)) {
33092
+ const extensions = executableExtensions(command, platform, input2.environment);
33093
+ for (const directory of pathDirectories(input2.environment, platform)) {
32796
33094
  for (const extension of extensions) {
32797
33095
  candidates.push({
32798
33096
  candidate: pathFlavor.join(directory, command + extension),
@@ -32802,8 +33100,8 @@ function harnessCandidates(spec, input, dependencies = {}) {
32802
33100
  }
32803
33101
  if (configured !== void 0)
32804
33102
  return candidates;
32805
- const home = resolveHomeDirectory(input);
32806
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
33103
+ const home = resolveHomeDirectory(input2);
33104
+ for (const directory of installRootDirectories(spec, input2, dependencies, platform, home)) {
32807
33105
  for (const extension of installRootExtensions(platform)) {
32808
33106
  candidates.push({
32809
33107
  candidate: pathFlavor.join(directory, spec.command + extension),
@@ -32813,12 +33111,12 @@ function harnessCandidates(spec, input, dependencies = {}) {
32813
33111
  }
32814
33112
  return candidates;
32815
33113
  }
32816
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
32817
- const platform = input.platform ?? process.platform;
33114
+ function resolveHarnessExecutable(spec, input2, dependencies = {}) {
33115
+ const platform = input2.platform ?? process.platform;
32818
33116
  const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
32819
33117
  const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
32820
33118
  const context = { platform, isExecutable };
32821
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
33119
+ for (const { candidate, source } of harnessCandidates(spec, input2, dependencies)) {
32822
33120
  const executable = runnable(candidate, context);
32823
33121
  if (executable !== void 0 && isExecutable(executable))
32824
33122
  return { executable, source };
@@ -32829,13 +33127,13 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
32829
33127
  // ../../harness-discovery/dist/installation.js
32830
33128
  import { execFile } from "node:child_process";
32831
33129
  import { homedir as homedir2 } from "node:os";
32832
- function runInstallationCommand(command, args, environment, timeout = 3e4) {
33130
+ function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
32833
33131
  const env = withNodeRuntimeOnPath(environment);
32834
33132
  const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
32835
33133
  return new Promise((resolve3, reject) => {
32836
33134
  const child = execFile(invocation.command, invocation.arguments, {
32837
33135
  env,
32838
- cwd: env.HOME ?? env.USERPROFILE ?? homedir2(),
33136
+ cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir2(),
32839
33137
  encoding: "utf8",
32840
33138
  timeout,
32841
33139
  killSignal: "SIGKILL",
@@ -32898,7 +33196,7 @@ function createInstallationManager(options2) {
32898
33196
  const check2 = () => checking ??= options2.check().finally(() => {
32899
33197
  checking = void 0;
32900
33198
  });
32901
- return (action) => {
33199
+ return (action, confirmedVersion) => {
32902
33200
  if (updating)
32903
33201
  return updating;
32904
33202
  if (action === "check")
@@ -32909,6 +33207,8 @@ function createInstallationManager(options2) {
32909
33207
  return before;
32910
33208
  if (!before.canUpdate)
32911
33209
  throw new Error(before.message ?? "This installation cannot be updated automatically");
33210
+ if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
33211
+ return { ...before, confirmationRequired: true };
32912
33212
  await options2.update(before);
32913
33213
  const after = await check2();
32914
33214
  if (after.currentVersion === before.currentVersion)
@@ -32943,8 +33243,8 @@ function referencesNpmBin(shim, name, bin) {
32943
33243
  if (bin.includes(".."))
32944
33244
  return false;
32945
33245
  const target2 = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
32946
- const text = shim.replaceAll("\\", "/").toLowerCase();
32947
- return text.includes(`%dp0%/${target2}"`) || text.includes(`%~dp0/${target2}"`);
33246
+ const text2 = shim.replaceAll("\\", "/").toLowerCase();
33247
+ return text2.includes(`%dp0%/${target2}"`) || text2.includes(`%~dp0/${target2}"`);
32948
33248
  }
32949
33249
  async function npmInstallation(command, packages, environment) {
32950
33250
  let selected = await realpath(command);
@@ -32953,7 +33253,7 @@ async function npmInstallation(command, packages, environment) {
32953
33253
  const root = path4.dirname(selected);
32954
33254
  for (const name of packages) {
32955
33255
  const directory2 = path4.join(root, "node_modules", ...name.split("/"));
32956
- const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text) => JSON.parse(text)).catch(() => null);
33256
+ const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
32957
33257
  const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
32958
33258
  const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
32959
33259
  if (bin) {
@@ -32964,7 +33264,7 @@ async function npmInstallation(command, packages, environment) {
32964
33264
  }
32965
33265
  let directory = path4.dirname(selected);
32966
33266
  for (let depth = 0; depth < 8; depth++) {
32967
- const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text) => JSON.parse(text)).catch(() => null);
33267
+ const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
32968
33268
  if (metadata?.name && packages.includes(metadata.name)) {
32969
33269
  const name = metadata.name;
32970
33270
  const currentVersion = installationVersion(metadata.version);
@@ -33034,12 +33334,12 @@ var CopilotLaunchError = class extends Error {
33034
33334
  this.code = code;
33035
33335
  }
33036
33336
  };
33037
- function resolveCopilotExecutable(input, dependencies = {}) {
33038
- const resolution = resolveHarnessExecutable(copilotDiscoverySpec, input, dependencies);
33337
+ function resolveCopilotExecutable(input2, dependencies = {}) {
33338
+ const resolution = resolveHarnessExecutable(copilotDiscoverySpec, input2, dependencies);
33039
33339
  if (!resolution) {
33040
33340
  throw new CopilotLaunchError("notInstalled", "Copilot CLI was not found. Install the official CLI or set CODEXHOST_COPILOT_COMMAND.");
33041
33341
  }
33042
- const platform = input.platform ?? process.platform;
33342
+ const platform = input2.platform ?? process.platform;
33043
33343
  const executable = resolution.executable;
33044
33344
  if (platform === "win32" && /\.(cmd|bat)$/iu.test(executable)) {
33045
33345
  const paths = targetPath(platform);
@@ -33078,16 +33378,16 @@ function copilotEnvironment(base, override = {}, platform = process.platform) {
33078
33378
  }
33079
33379
  return merged;
33080
33380
  }
33081
- function createCopilotClient(input) {
33082
- const merged = copilotEnvironment(input.environment, input.sessionEnvironment);
33381
+ function createCopilotClient(input2) {
33382
+ const merged = copilotEnvironment(input2.environment, input2.sessionEnvironment);
33083
33383
  const environment = Object.fromEntries(Object.entries(withNodeRuntimeOnPath(merged)).filter((entry) => entry[1] !== void 0));
33084
33384
  const executable = resolveCopilotExecutable({
33085
33385
  environment,
33086
- ...input.command === void 0 ? {} : { command: input.command }
33386
+ ...input2.command === void 0 ? {} : { command: input2.command }
33087
33387
  });
33088
33388
  return new CopilotClient({
33089
33389
  connection: RuntimeConnection.forStdio({ path: executable, env: environment }),
33090
- workingDirectory: input.cwd,
33390
+ workingDirectory: input2.cwd,
33091
33391
  mode: "copilot-cli",
33092
33392
  useLoggedInUser: true,
33093
33393
  logLevel: "none"
@@ -33109,7 +33409,7 @@ function invalidRequest(message) {
33109
33409
  return { code: "invalidRequest", message, retryable: false };
33110
33410
  }
33111
33411
  function validateHostApprovalResponse(interaction, response) {
33112
- return interaction.actions.some(({ id }) => id === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
33412
+ return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
33113
33413
  }
33114
33414
 
33115
33415
  // ../../harness-adapter/dist/question.js
@@ -33117,7 +33417,7 @@ function invalidRequest2(message) {
33117
33417
  return { code: "invalidRequest", message, retryable: false };
33118
33418
  }
33119
33419
  function validateHostQuestionResponse(interaction, response) {
33120
- const questionIds = new Set(interaction.questions.map(({ id }) => id));
33420
+ const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
33121
33421
  if (response.cancelled) {
33122
33422
  return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
33123
33423
  }
@@ -33165,6 +33465,18 @@ function validateHostInteractionResponse(interaction, response) {
33165
33465
  return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
33166
33466
  }
33167
33467
 
33468
+ // ../../harness-adapter/dist/legacy-model-ref.js
33469
+ import { Buffer as Buffer2 } from "node:buffer";
33470
+ function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
33471
+ if (ref.serviceTier || !ref.id.startsWith(prefix))
33472
+ return void 0;
33473
+ const encoded = ref.id.slice(prefix.length);
33474
+ const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
33475
+ if (Buffer2.from(id2).toString("base64url") !== encoded)
33476
+ return void 0;
33477
+ return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
33478
+ }
33479
+
33168
33480
  // ../../harness-adapter/dist/output-channel.js
33169
33481
  var HarnessOutputChannel = class {
33170
33482
  outputs;
@@ -33249,7 +33561,8 @@ var tokenFields = [
33249
33561
  var safeIntegerFields = [
33250
33562
  "planFiveHourResetsAtUnix",
33251
33563
  "planSevenDayResetsAtUnix",
33252
- "timeToFirstOutputMs"
33564
+ "timeToFirstOutputMs",
33565
+ "latestRequestTimeToFirstOutputMs"
33253
33566
  ];
33254
33567
  var percentFields = [
33255
33568
  "cacheHitRatePercent",
@@ -33523,15 +33836,11 @@ async function bounded(promise2, milliseconds = 3e4) {
33523
33836
  }
33524
33837
 
33525
33838
  // dist/configuration.js
33526
- function modelRef(id) {
33527
- return harnessModelRefSchema.parse({ id: Buffer.from(id).toString("base64url") });
33839
+ function modelRef(id2) {
33840
+ return harnessModelRefSchema.parse({ id: id2 });
33528
33841
  }
33529
- function modelId2(ref) {
33530
- const parsed = harnessModelRefSchema.parse(ref);
33531
- const id = Buffer.from(parsed.id, "base64url").toString("utf8");
33532
- if (!id || modelRef(id).id !== parsed.id)
33533
- throw new CopilotOperationError("invalidRequest", "Invalid Copilot Model reference.");
33534
- return id;
33842
+ function normalizeStoredCopilotModelRef(ref, catalog) {
33843
+ return normalizeLegacyBase64ModelRef(ref, catalog, "");
33535
33844
  }
33536
33845
  var modelSchema = external_exports.object({
33537
33846
  id: external_exports.string().min(1),
@@ -33557,8 +33866,8 @@ async function readModels(client, session, auth, refresh = true) {
33557
33866
  models.unshift({ id: "auto", name: "Auto" });
33558
33867
  return models.filter((model2) => model2.policy?.state !== "disabled");
33559
33868
  }
33560
- function requireModel(models, id) {
33561
- const model2 = models.find((entry) => entry.id === id);
33869
+ function requireModel(models, id2) {
33870
+ const model2 = models.find((entry) => entry.id === id2);
33562
33871
  if (!model2)
33563
33872
  throw new CopilotOperationError("invalidRequest", "Copilot does not offer this Model in the current native catalog.");
33564
33873
  return model2;
@@ -33579,7 +33888,7 @@ function modelCatalog(models) {
33579
33888
  label: model2.name,
33580
33889
  supportedThinkingOptionIds: model2.supportedReasoningEfforts ?? []
33581
33890
  })),
33582
- thinkingOptions: efforts.map((id) => ({ id, label: id })),
33891
+ thinkingOptions: efforts.map((id2) => ({ id: id2, label: id2 })),
33583
33892
  ...initial ? { defaultModel: modelRef(initial.id) } : {}
33584
33893
  });
33585
33894
  }
@@ -33595,9 +33904,9 @@ async function confirmedConfiguration(session, client) {
33595
33904
  ...entry ? { resolvedModelLabel: entry.name } : {},
33596
33905
  ...model2.reasoningEffort && entry?.supportedReasoningEfforts?.includes(model2.reasoningEffort) ? { effectiveThinkingOptionId: harnessThinkingOptionIdSchema.parse(model2.reasoningEffort) } : {},
33597
33906
  ...entry ? {
33598
- availableThinkingOptions: (entry.supportedReasoningEfforts ?? []).map((id) => ({
33599
- id: harnessThinkingOptionIdSchema.parse(id),
33600
- label: id
33907
+ availableThinkingOptions: (entry.supportedReasoningEfforts ?? []).map((id2) => ({
33908
+ id: harnessThinkingOptionIdSchema.parse(id2),
33909
+ label: id2
33601
33910
  }))
33602
33911
  } : {},
33603
33912
  effectivePermissionModeId: harnessPermissionModeIdSchema.parse(permission.mode)
@@ -33678,9 +33987,9 @@ function elicitationForm(context) {
33678
33987
  const schema = context.requestedSchema;
33679
33988
  if (context.mode === "url" || !schema || schema.type !== "object" || !Object.keys(schema.properties).length)
33680
33989
  throw new CopilotOperationError("unsupported", "Copilot elicitation requires a supported primitive form; browser URL flows are unavailable.");
33681
- if (schema.required?.some((id) => !Object.hasOwn(schema.properties, id)))
33990
+ if (schema.required?.some((id2) => !Object.hasOwn(schema.properties, id2)))
33682
33991
  throw new Error("Copilot form refers to an unknown required field");
33683
- const questions = Object.entries(schema.properties).map(([id, field2]) => {
33992
+ const questions = Object.entries(schema.properties).map(([id2, field2]) => {
33684
33993
  const allowed = /* @__PURE__ */ new Set([
33685
33994
  "type",
33686
33995
  "title",
@@ -33694,12 +34003,12 @@ function elicitationForm(context) {
33694
34003
  throw new CopilotOperationError("unsupported", "Copilot form contains an unsupported text format.");
33695
34004
  if (!["string", "number", "integer", "boolean", "array"].includes(field2.type))
33696
34005
  throw new CopilotOperationError("unsupported", "Copilot form field cannot be represented");
33697
- const prompt = [field2.title ?? id, field2.description].filter(Boolean).join("\n");
34006
+ const prompt = [field2.title ?? id2, field2.description].filter(Boolean).join("\n");
33698
34007
  const choices = options(field2);
33699
- const optional2 = !schema.required?.includes(id);
34008
+ const optional2 = !schema.required?.includes(id2);
33700
34009
  if (choices)
33701
34010
  return {
33702
- id,
34011
+ id: id2,
33703
34012
  type: "choice",
33704
34013
  prompt,
33705
34014
  options: choices,
@@ -33708,7 +34017,7 @@ function elicitationForm(context) {
33708
34017
  optional: optional2
33709
34018
  };
33710
34019
  return {
33711
- id,
34020
+ id: id2,
33712
34021
  type: "text",
33713
34022
  prompt,
33714
34023
  multiline: field2.type === "string",
@@ -33721,26 +34030,26 @@ function elicitationForm(context) {
33721
34030
  if (response.cancelled)
33722
34031
  return { action: "cancel" };
33723
34032
  const content = /* @__PURE__ */ Object.create(null);
33724
- for (const [id, field2] of Object.entries(schema.properties)) {
33725
- const values = Object.hasOwn(response.answers, id) ? response.answers[id] ?? [] : [];
34033
+ for (const [id2, field2] of Object.entries(schema.properties)) {
34034
+ const values = Object.hasOwn(response.answers, id2) ? response.answers[id2] ?? [] : [];
33726
34035
  if (!values.length)
33727
34036
  continue;
33728
34037
  const value = values[0] ?? "";
33729
34038
  if (field2.type === "array") {
33730
34039
  if (field2.minItems !== void 0 && values.length < field2.minItems || field2.maxItems !== void 0 && values.length > field2.maxItems)
33731
34040
  throw new Error("The number of choices is outside the native form's limits.");
33732
- content[id] = values;
34041
+ content[id2] = values;
33733
34042
  continue;
33734
34043
  }
33735
34044
  if (field2.type === "boolean") {
33736
- content[id] = value === "true";
34045
+ content[id2] = value === "true";
33737
34046
  continue;
33738
34047
  }
33739
34048
  if (field2.type === "number" || field2.type === "integer") {
33740
34049
  const number4 = Number(value);
33741
34050
  if (!value.trim() || !Number.isFinite(number4) || field2.type === "integer" && !Number.isSafeInteger(number4) || field2.minimum !== void 0 && number4 < field2.minimum || field2.maximum !== void 0 && number4 > field2.maximum)
33742
34051
  throw new Error("The number is outside the native form's limits.");
33743
- content[id] = number4;
34052
+ content[id2] = number4;
33744
34053
  continue;
33745
34054
  }
33746
34055
  if (field2.type === "string") {
@@ -33751,7 +34060,7 @@ function elicitationForm(context) {
33751
34060
  if (!valid)
33752
34061
  throw new Error("The text does not match the native form's format.");
33753
34062
  }
33754
- content[id] = value;
34063
+ content[id2] = value;
33755
34064
  }
33756
34065
  }
33757
34066
  return { action: "accept", content };
@@ -33897,10 +34206,10 @@ var CopilotInteractions = class {
33897
34206
  });
33898
34207
  }
33899
34208
  cancel(turnId) {
33900
- for (const [id, pending] of this.pending) {
34209
+ for (const [id2, pending] of this.pending) {
33901
34210
  if (turnId !== void 0 && pending.interaction.turnId !== turnId)
33902
34211
  continue;
33903
- this.pending.delete(id);
34212
+ this.pending.delete(id2);
33904
34213
  pending.reject(new Error("Copilot interaction cancelled"));
33905
34214
  this.emit({
33906
34215
  kind: "event",
@@ -33947,8 +34256,8 @@ function nativeFileChanges(data) {
33947
34256
 
33948
34257
  // dist/projection.js
33949
34258
  var OUTPUT_LIMIT = 256 * 1024;
33950
- var clip = (text) => text.slice(0, OUTPUT_LIMIT);
33951
- var itemId = (id) => hostItemIdSchema.parse(id);
34259
+ var clip = (text2) => text2.slice(0, OUTPUT_LIMIT);
34260
+ var itemId = (id2) => hostItemIdSchema.parse(id2);
33952
34261
  var nativeFailure = {
33953
34262
  code: "nativeFailure",
33954
34263
  message: "Copilot reported a native failure.",
@@ -33980,8 +34289,8 @@ var CopilotItems = class {
33980
34289
  this.emit = emit;
33981
34290
  }
33982
34291
  get items() {
33983
- return this.order.flatMap((id) => {
33984
- const item = this.snapshots.get(id);
34292
+ return this.order.flatMap((id2) => {
34293
+ const item = this.snapshots.get(id2);
33985
34294
  return item ? [item] : [];
33986
34295
  });
33987
34296
  }
@@ -33992,33 +34301,33 @@ var CopilotItems = class {
33992
34301
  this.order.push(item.itemId);
33993
34302
  this.emit({ type: "item.started", turnId: this.turnId, item: structuredClone(item) });
33994
34303
  }
33995
- finish(id, outcome) {
33996
- const item = this.active.get(id);
34304
+ finish(id2, outcome) {
34305
+ const item = this.active.get(id2);
33997
34306
  if (!item)
33998
34307
  return;
33999
- this.active.delete(id);
34308
+ this.active.delete(id2);
34000
34309
  const snapshot = { item: structuredClone(item), outcome };
34001
- this.snapshots.set(id, snapshot);
34310
+ this.snapshots.set(id2, snapshot);
34002
34311
  this.emit({ type: "item.completed", turnId: this.turnId, snapshot });
34003
34312
  }
34004
34313
  finishAll(outcome) {
34005
- for (const id of this.active.keys())
34006
- this.finish(id, outcome);
34314
+ for (const id2 of this.active.keys())
34315
+ this.finish(id2, outcome);
34007
34316
  }
34008
- text(id, text, type, full, phase) {
34009
- if (this.snapshots.has(id))
34317
+ text(id2, text2, type, full, phase) {
34318
+ if (this.snapshots.has(id2))
34010
34319
  return;
34011
- this.start({ type, itemId: itemId(id), text: "" });
34012
- const item = this.active.get(id);
34320
+ this.start({ type, itemId: itemId(id2), text: "" });
34321
+ const item = this.active.get(id2);
34013
34322
  if (!item || item.type !== "agentMessage" && item.type !== "reasoning")
34014
34323
  return;
34015
34324
  if (item.type === "agentMessage" && (phase === "commentary" || phase === "final_answer"))
34016
34325
  item.phase = phase;
34017
- if (full && !text.startsWith(item.text))
34326
+ if (full && !text2.startsWith(item.text))
34018
34327
  throw new Error("Copilot text delta mismatch");
34019
- if ((full ? text.length : item.text.length + text.length) > OUTPUT_LIMIT)
34328
+ if ((full ? text2.length : item.text.length + text2.length) > OUTPUT_LIMIT)
34020
34329
  throw new Error("Copilot message exceeds the output limit");
34021
- const append = clip(full ? text.slice(item.text.length) : text).slice(0, OUTPUT_LIMIT - item.text.length);
34330
+ const append = clip(full ? text2.slice(item.text.length) : text2).slice(0, OUTPUT_LIMIT - item.text.length);
34022
34331
  item.text += append;
34023
34332
  if (append)
34024
34333
  this.emit({
@@ -34028,7 +34337,7 @@ var CopilotItems = class {
34028
34337
  update: { type: "text.append", text: append }
34029
34338
  });
34030
34339
  if (full)
34031
- this.finish(id, { status: "succeeded" });
34340
+ this.finish(id2, { status: "succeeded" });
34032
34341
  }
34033
34342
  accept(event) {
34034
34343
  if (event.agentId)
@@ -34140,14 +34449,14 @@ var CopilotItems = class {
34140
34449
  this.finish(data.toolCallId, succeeded ? { status: "succeeded" } : { status: "failed", error: nativeFailure });
34141
34450
  const changes = nativeFileChanges(data);
34142
34451
  if (changes.length) {
34143
- const id = itemId(`files-${data.toolCallId}`);
34452
+ const id2 = itemId(`files-${data.toolCallId}`);
34144
34453
  this.start({
34145
34454
  type: "fileChange",
34146
- itemId: id,
34455
+ itemId: id2,
34147
34456
  changes,
34148
34457
  sourceItemIds: [itemId(data.toolCallId)]
34149
34458
  });
34150
- this.finish(id, { status: "succeeded" });
34459
+ this.finish(id2, { status: "succeeded" });
34151
34460
  }
34152
34461
  break;
34153
34462
  }
@@ -34257,7 +34566,7 @@ function projectHistory(sessionId, events) {
34257
34566
  // dist/usage.js
34258
34567
  function usageFromMetrics(metrics, context, live = {}) {
34259
34568
  const details = metrics.tokenDetails;
34260
- const input = details?.input?.tokenCount;
34569
+ const input2 = details?.input?.tokenCount;
34261
34570
  const read = details?.cache_read?.tokenCount;
34262
34571
  const write = details?.cache_write?.tokenCount;
34263
34572
  const output = details?.output?.tokenCount;
@@ -34271,7 +34580,7 @@ function usageFromMetrics(metrics, context, live = {}) {
34271
34580
  ...read === void 0 ? {} : { cachedInputTokens: read },
34272
34581
  ...write === void 0 ? {} : { cacheWriteInputTokens: write },
34273
34582
  ...output === void 0 ? {} : { outputTokens: output },
34274
- ...input === void 0 || read === void 0 || write === void 0 ? {} : { inputTokens: input + read + write }
34583
+ ...input2 === void 0 || read === void 0 || write === void 0 ? {} : { inputTokens: input2 + read + write }
34275
34584
  };
34276
34585
  if (usage.inputTokens !== void 0 && read !== void 0 && read <= usage.inputTokens)
34277
34586
  usage.sessionCacheUsage = { inputTokens: usage.inputTokens, cachedInputTokens: read };
@@ -34322,11 +34631,11 @@ var CopilotUsageTelemetry = class {
34322
34631
  call.receipt = receipt;
34323
34632
  return this.consume(call);
34324
34633
  }
34325
- entry(id) {
34326
- let call = this.calls.get(id);
34634
+ entry(id2) {
34635
+ let call = this.calls.get(id2);
34327
34636
  if (!call) {
34328
34637
  call = {};
34329
- this.calls.set(id, call);
34638
+ this.calls.set(id2, call);
34330
34639
  }
34331
34640
  if (this.calls.size > 2048) {
34332
34641
  const oldest = this.calls.entries().next().value;
@@ -34453,15 +34762,15 @@ var CopilotHarnessSession = class {
34453
34762
  configurationRevision = 0;
34454
34763
  retiredItems = /* @__PURE__ */ new Set();
34455
34764
  retiredMessages = /* @__PURE__ */ new Set();
34456
- constructor(input, environment, onClosed = () => {
34765
+ constructor(input2, environment, onClosed = () => {
34457
34766
  }) {
34458
- this.input = input;
34767
+ this.input = input2;
34459
34768
  this.environment = environment;
34460
34769
  this.onClosed = onClosed;
34461
- this.nativeId = input.kind === "resume" ? sessionIdFromRef(input.nativeRef) : randomUUID3();
34462
- this.unattended = input.kind === "create" ? input.executionPolicy === "unattended-full-access" : sessionIsUnattended(input.nativeRef);
34770
+ this.nativeId = input2.kind === "resume" ? sessionIdFromRef(input2.nativeRef) : randomUUID3();
34771
+ this.unattended = input2.kind === "create" ? input2.executionPolicy === "unattended-full-access" : sessionIsUnattended(input2.nativeRef);
34463
34772
  this.nativeWriterRef = sessionRef(this.nativeId, this.unattended);
34464
- this.durable = input.kind === "resume";
34773
+ this.durable = input2.kind === "resume";
34465
34774
  this.state = this.durable ? { nativeRef: this.nativeWriterRef } : {};
34466
34775
  this.initialState = this.state;
34467
34776
  }
@@ -34491,7 +34800,7 @@ var CopilotHarnessSession = class {
34491
34800
  try {
34492
34801
  await bounded(client.start());
34493
34802
  if (this.input.kind === "create" && this.input.model)
34494
- requireModel(await readModels(client), modelId2(this.input.model));
34803
+ requireModel(await readModels(client), this.input.model.id);
34495
34804
  if (this.input.kind === "resume") {
34496
34805
  if ((await bounded(client.rpc.sessions.checkInUse({ sessionIds: [this.nativeId] }))).inUse.includes(this.nativeId))
34497
34806
  throw new CopilotOperationError("sessionBusy", "Copilot session is owned by another native process.");
@@ -34504,32 +34813,32 @@ var CopilotHarnessSession = class {
34504
34813
  onPermissionRequest: (request) => {
34505
34814
  if (!this.active || this.closed || this.active.cancelling)
34506
34815
  return Promise.resolve({ kind: "user-not-available" });
34507
- const active = this.active;
34508
- return active.identity.promise.then(() => {
34509
- if (this.active !== active || this.closed || active.cancelling)
34816
+ const active2 = this.active;
34817
+ return active2.identity.promise.then(() => {
34818
+ if (this.active !== active2 || this.closed || active2.cancelling)
34510
34819
  return { kind: "user-not-available" };
34511
- return this.interactions.permission(active.id, request);
34820
+ return this.interactions.permission(active2.id, request);
34512
34821
  });
34513
34822
  },
34514
34823
  onUserInputRequest: (request) => {
34515
34824
  if (!this.active || this.closed || this.active.cancelling)
34516
34825
  return Promise.reject(new Error("Copilot has no active question context"));
34517
- const active = this.active;
34518
- return active.identity.promise.then(() => {
34519
- if (this.active !== active || this.closed || active.cancelling)
34826
+ const active2 = this.active;
34827
+ return active2.identity.promise.then(() => {
34828
+ if (this.active !== active2 || this.closed || active2.cancelling)
34520
34829
  throw new Error("Copilot question context ended");
34521
- return this.interactions.question(active.id, request);
34830
+ return this.interactions.question(active2.id, request);
34522
34831
  });
34523
34832
  },
34524
34833
  onElicitationRequest: async (request) => {
34525
- const active = this.active;
34526
- if (!active || this.closed || active.cancelling)
34834
+ const active2 = this.active;
34835
+ if (!active2 || this.closed || active2.cancelling)
34527
34836
  return { action: "cancel" };
34528
- await active.identity.promise;
34529
- if (this.active !== active || this.closed || active.cancelling)
34837
+ await active2.identity.promise;
34838
+ if (this.active !== active2 || this.closed || active2.cancelling)
34530
34839
  return { action: "cancel" };
34531
34840
  try {
34532
- return await this.interactions.elicitation(active.id, request);
34841
+ return await this.interactions.elicitation(active2.id, request);
34533
34842
  } catch (error51) {
34534
34843
  this.fault(error51, "interaction");
34535
34844
  return { action: "cancel" };
@@ -34544,7 +34853,7 @@ var CopilotHarnessSession = class {
34544
34853
  const session = this.input.kind === "resume" ? await bounded(client.resumeSession(this.nativeId, { ...handlers, allowTranscriptRecovery: false })) : await bounded(client.createSession({
34545
34854
  ...handlers,
34546
34855
  sessionId: this.nativeId,
34547
- ...this.input.model ? { model: modelId2(this.input.model) } : {}
34856
+ ...this.input.model ? { model: this.input.model.id } : {}
34548
34857
  }));
34549
34858
  this.session = session;
34550
34859
  if (this.input.kind === "resume" && session.transcriptRecovery)
@@ -34570,7 +34879,7 @@ var CopilotHarnessSession = class {
34570
34879
  }
34571
34880
  if (this.input.kind === "create" && (this.input.model || this.input.thinkingOptionId)) {
34572
34881
  const current = await bounded(session.rpc.model.getCurrent());
34573
- const requestedModel = this.input.model ? modelId2(this.input.model) : current.modelId;
34882
+ const requestedModel = this.input.model?.id ?? current.modelId;
34574
34883
  if (!requestedModel)
34575
34884
  throw new CopilotOperationError("invalidState", "Copilot has not confirmed a Model.");
34576
34885
  const models = await readModels(client, session);
@@ -34620,14 +34929,14 @@ var CopilotHarnessSession = class {
34620
34929
  throw error51;
34621
34930
  }
34622
34931
  }
34623
- startTurn(id) {
34624
- this.usageTelemetry.begin(id);
34932
+ startTurn(id2) {
34933
+ this.usageTelemetry.begin(id2);
34625
34934
  const identity3 = Promise.withResolvers();
34626
34935
  void identity3.promise.catch(() => {
34627
34936
  });
34628
34937
  return {
34629
- id,
34630
- items: new CopilotItems(id, (event) => this.emit(event)),
34938
+ id: id2,
34939
+ items: new CopilotItems(id2, (event) => this.emit(event)),
34631
34940
  cancelling: false,
34632
34941
  accepted: false,
34633
34942
  identity: identity3,
@@ -34687,13 +34996,13 @@ var CopilotHarnessSession = class {
34687
34996
  if (this.retiredMessages.has(event.data.messageId))
34688
34997
  return;
34689
34998
  if (!this.active) {
34690
- const id = hostTurnIdSchema.parse(randomUUID3());
34691
- this.active = this.startTurn(id);
34999
+ const id2 = hostTurnIdSchema.parse(randomUUID3());
35000
+ this.active = this.startTurn(id2);
34692
35001
  this.active.accepted = true;
34693
35002
  this.active.identity.resolve(void 0);
34694
35003
  this.emit({
34695
35004
  type: "turn.autonomous.started",
34696
- turnId: id,
35005
+ turnId: id2,
34697
35006
  input: visibleInput(event)
34698
35007
  });
34699
35008
  }
@@ -34758,15 +35067,15 @@ var CopilotHarnessSession = class {
34758
35067
  this.background.invalidate();
34759
35068
  void this.background.refresh(this.session).catch((error51) => this.fault(error51));
34760
35069
  }
34761
- const active = this.active;
34762
- if (!active.accepted) {
35070
+ const active2 = this.active;
35071
+ if (!active2.accepted) {
34763
35072
  this.active = void 0;
34764
- active.identity.reject(new Error("Copilot stopped before accepting the user message"));
35073
+ active2.identity.reject(new Error("Copilot stopped before accepting the user message"));
34765
35074
  return;
34766
35075
  }
34767
- if (active.cancelling && !event.data.aborted)
35076
+ if (active2.cancelling && !event.data.aborted)
34768
35077
  throw new Error("Copilot did not confirm cancellation");
34769
- const outcome = event.data.aborted ? { status: "cancelled" } : active.error ? { status: "failed", error: active.error } : active.messageId ? { status: "succeeded", checkpoint: checkpoint(this.nativeId, active.messageId) } : { status: "failed", error: nativeError(new Error("Missing logical identity")) };
35078
+ const outcome = event.data.aborted ? { status: "cancelled" } : active2.error ? { status: "failed", error: active2.error } : active2.messageId ? { status: "succeeded", checkpoint: checkpoint(this.nativeId, active2.messageId) } : { status: "failed", error: nativeError(new Error("Missing logical identity")) };
34770
35079
  this.finish(outcome);
34771
35080
  void this.refreshUsage().catch(() => {
34772
35081
  });
@@ -34777,23 +35086,23 @@ var CopilotHarnessSession = class {
34777
35086
  }
34778
35087
  }
34779
35088
  finish(outcome) {
34780
- const active = this.active;
34781
- if (!active)
35089
+ const active2 = this.active;
35090
+ if (!active2)
34782
35091
  return;
34783
- clearTimeout(active.timer);
34784
- this.interactions.cancel(active.id);
34785
- if (!active.accepted) {
34786
- active.identity.reject(new Error("Copilot did not accept the user message"));
35092
+ clearTimeout(active2.timer);
35093
+ this.interactions.cancel(active2.id);
35094
+ if (!active2.accepted) {
35095
+ active2.identity.reject(new Error("Copilot did not accept the user message"));
34787
35096
  this.active = void 0;
34788
35097
  return;
34789
35098
  }
34790
- active.items.finishAll(outcome);
34791
- for (const id of active.items.completedIds())
34792
- this.retiredItems.add(id);
34793
- if (active.messageId)
34794
- this.retiredMessages.add(active.messageId);
34795
- for (const id of active.aliases)
34796
- this.retiredMessages.add(id);
35099
+ active2.items.finishAll(outcome);
35100
+ for (const id2 of active2.items.completedIds())
35101
+ this.retiredItems.add(id2);
35102
+ if (active2.messageId)
35103
+ this.retiredMessages.add(active2.messageId);
35104
+ for (const id2 of active2.aliases)
35105
+ this.retiredMessages.add(id2);
34797
35106
  while (this.retiredItems.size > 4096)
34798
35107
  this.retiredItems.delete(this.retiredItems.values().next().value ?? "");
34799
35108
  while (this.retiredMessages.size > 128)
@@ -34801,8 +35110,8 @@ var CopilotHarnessSession = class {
34801
35110
  this.active = void 0;
34802
35111
  this.emit({
34803
35112
  type: "turn.completed",
34804
- turnId: active.id,
34805
- ...active.messageId ? { nativeTurnRef: turnRef(this.nativeId, active.messageId) } : {},
35113
+ turnId: active2.id,
35114
+ ...active2.messageId ? { nativeTurnRef: turnRef(this.nativeId, active2.messageId) } : {},
34806
35115
  outcome
34807
35116
  });
34808
35117
  }
@@ -34859,21 +35168,21 @@ var CopilotHarnessSession = class {
34859
35168
  return failure("invalidState", "Copilot has not accepted this Turn yet.");
34860
35169
  if (this.active.cancelling)
34861
35170
  return { ok: true, value: { cancellationRequested: true } };
34862
- const active = this.active;
34863
- active.cancelling = true;
34864
- active.timer = setTimeout(() => {
34865
- if (this.active === active)
35171
+ const active2 = this.active;
35172
+ active2.cancelling = true;
35173
+ active2.timer = setTimeout(() => {
35174
+ if (this.active === active2)
34866
35175
  this.fault(new Error("Copilot cancellation timed out"), "turn.cancel");
34867
35176
  }, 3e4);
34868
35177
  try {
34869
35178
  if (!this.session)
34870
35179
  throw new Error("Copilot session is not initialized");
34871
35180
  await bounded(this.session.abort());
34872
- if (this.active === active)
34873
- this.interactions.cancel(active.id);
35181
+ if (this.active === active2)
35182
+ this.interactions.cancel(active2.id);
34874
35183
  return { ok: true, value: { cancellationRequested: true } };
34875
35184
  } catch (error51) {
34876
- if (this.active === active)
35185
+ if (this.active === active2)
34877
35186
  this.fault(error51, "turn.cancel");
34878
35187
  return { ok: false, error: nativeError(error51, "turn.cancel") };
34879
35188
  }
@@ -34892,34 +35201,34 @@ var CopilotHarnessSession = class {
34892
35201
  if (!session || !client)
34893
35202
  throw new Error("Copilot session is not initialized");
34894
35203
  if (command.type === "turn.start") {
34895
- const id = hostTurnIdSchema.parse(command.turnId);
34896
- const active = this.startTurn(id);
34897
- this.active = active;
35204
+ const id2 = hostTurnIdSchema.parse(command.turnId);
35205
+ const active2 = this.startTurn(id2);
35206
+ this.active = active2;
34898
35207
  try {
34899
35208
  this.sending = [];
34900
35209
  this.sendingBytes = 0;
34901
35210
  this.draftCleanupNeeded = false;
34902
35211
  const messageId = await bounded(session.send({ prompt: command.input.map((part) => part.text).join("\n\n") }));
34903
- active.expectedMessageId = messageId;
35212
+ active2.expectedMessageId = messageId;
34904
35213
  const buffered = this.sending;
34905
35214
  this.sending = void 0;
34906
35215
  for (const event of buffered)
34907
35216
  this.receive(event);
34908
- await bounded(active.identity.promise);
35217
+ await bounded(active2.identity.promise);
34909
35218
  } catch (error51) {
34910
35219
  this.sending = void 0;
34911
- if (this.active === active)
35220
+ if (this.active === active2)
34912
35221
  this.fault(error51, "turn.start");
34913
- if (!active.accepted)
35222
+ if (!active2.accepted)
34914
35223
  return { ok: false, error: nativeError(error51, "turn.start") };
34915
35224
  }
34916
- return { ok: true, value: { turnId: id } };
35225
+ return { ok: true, value: { turnId: id2 } };
34917
35226
  }
34918
35227
  this.configurationRevision++;
34919
35228
  if (command.type === "model.select") {
34920
- const id = modelId2(command.model);
34921
- requireModel(await readModels(client, session), id);
34922
- await bounded(session.setModel(id));
35229
+ const id2 = command.model.id;
35230
+ requireModel(await readModels(client, session), id2);
35231
+ await bounded(session.setModel(id2));
34923
35232
  }
34924
35233
  if (command.type === "thinking.select") {
34925
35234
  const current = await session.rpc.model.getCurrent();
@@ -35136,9 +35445,9 @@ function projectCopilotAccount(quota) {
35136
35445
  // dist/account.js
35137
35446
  var CACHE_MS = 15e3;
35138
35447
  var identity2 = (auth) => JSON.stringify([auth.authType, auth.host, auth.login]);
35139
- async function deleteDraft(client, id) {
35448
+ async function deleteDraft(client, id2) {
35140
35449
  try {
35141
- await bounded(client.deleteSession(id), 5e3);
35450
+ await bounded(client.deleteSession(id2), 5e3);
35142
35451
  } catch (error51) {
35143
35452
  if (nativeError(error51).code !== "sessionNotFound")
35144
35453
  throw error51;
@@ -35230,9 +35539,9 @@ var CopilotAccount = class {
35230
35539
  });
35231
35540
  if (client) {
35232
35541
  if (ownedId) {
35233
- const id = ownedId;
35234
- await deleteDraft(client, id).then(() => {
35235
- this.pendingDrafts.delete(id);
35542
+ const id2 = ownedId;
35543
+ await deleteDraft(client, id2).then(() => {
35544
+ this.pendingDrafts.delete(id2);
35236
35545
  }).catch(() => {
35237
35546
  result = null;
35238
35547
  });
@@ -35277,9 +35586,9 @@ var CopilotAccount = class {
35277
35586
  this.client = client;
35278
35587
  try {
35279
35588
  await bounded(client.start(), 8e3);
35280
- for (const id of this.pendingDrafts) {
35281
- await deleteDraft(client, id);
35282
- this.pendingDrafts.delete(id);
35589
+ for (const id2 of this.pendingDrafts) {
35590
+ await deleteDraft(client, id2);
35591
+ this.pendingDrafts.delete(id2);
35283
35592
  }
35284
35593
  } finally {
35285
35594
  await bounded(client.forceStop(), 5e3);
@@ -35319,11 +35628,13 @@ var permissionModes = harnessPermissionModeCatalogSchema.parse({
35319
35628
  });
35320
35629
  var CopilotAdapter = class {
35321
35630
  environment;
35631
+ normalizeStoredModelRef = normalizeStoredCopilotModelRef;
35322
35632
  harnessId = copilotId;
35323
35633
  sessions = /* @__PURE__ */ new Map();
35324
35634
  clients = /* @__PURE__ */ new Set();
35325
35635
  inspections = /* @__PURE__ */ new Map();
35326
35636
  inspectionsInFlight = /* @__PURE__ */ new Map();
35637
+ inspectionTasks = /* @__PURE__ */ new Set();
35327
35638
  closed = false;
35328
35639
  account;
35329
35640
  constructor(environment) {
@@ -35339,23 +35650,34 @@ var CopilotAdapter = class {
35339
35650
  async refreshCredits() {
35340
35651
  return (await this.account.refresh())?.credits ?? null;
35341
35652
  }
35342
- async inspect(input = {}) {
35653
+ async inspect(input2 = {}) {
35343
35654
  if (this.closed)
35344
35655
  return {
35345
35656
  status: "unavailable",
35346
35657
  error: { code: "invalidState", message: "Copilot Adapter is closed.", retryable: false }
35347
35658
  };
35348
- const cwd = path6.resolve(input.cwd ?? this.environment.HOME ?? process.cwd());
35659
+ const cwd = path6.resolve(input2.cwd ?? this.environment.HOME ?? process.cwd());
35349
35660
  const pending = this.inspectionsInFlight.get(cwd);
35661
+ if (input2.refresh) {
35662
+ this.inspections.clear();
35663
+ this.inspectionsInFlight.clear();
35664
+ if (pending)
35665
+ this.inspectionsInFlight.set(cwd, pending);
35666
+ }
35350
35667
  if (pending)
35351
35668
  return pending;
35352
35669
  const cached2 = this.inspections.get(cwd);
35353
- if (!input.refresh && cached2)
35670
+ if (cached2)
35354
35671
  return cached2;
35355
- this.inspections.delete(cwd);
35356
- const inspection = this.inspectCwd(cwd);
35672
+ const inspection = this.inspectCwd(cwd).then((result) => {
35673
+ if (!this.closed && result.status === "ready" && this.inspectionsInFlight.get(cwd) === inspection)
35674
+ this.inspections.set(cwd, result);
35675
+ return result;
35676
+ });
35357
35677
  this.inspectionsInFlight.set(cwd, inspection);
35678
+ this.inspectionTasks.add(inspection);
35358
35679
  return inspection.finally(() => {
35680
+ this.inspectionTasks.delete(inspection);
35359
35681
  if (this.inspectionsInFlight.get(cwd) === inspection)
35360
35682
  this.inspectionsInFlight.delete(cwd);
35361
35683
  });
@@ -35422,35 +35744,33 @@ var CopilotAdapter = class {
35422
35744
  status: "unavailable",
35423
35745
  error: { code: "invalidState", message: "Copilot Adapter is closed.", retryable: false }
35424
35746
  };
35425
- if (result.status === "ready")
35426
- this.inspections.set(cwd, result);
35427
35747
  return result;
35428
35748
  }
35429
- async open(input) {
35749
+ async open(input2) {
35430
35750
  if (this.closed)
35431
35751
  return failure("invalidState", "Copilot Adapter is closed.");
35432
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access" && input.permissionModeId && input.permissionModeId !== "allow-all")
35752
+ if (input2.kind === "create" && input2.executionPolicy === "unattended-full-access" && input2.permissionModeId && input2.permissionModeId !== "allow-all")
35433
35753
  return failure("invalidRequest", "Copilot permission conflicts with unattended execution.");
35434
35754
  try {
35435
- if (!path6.isAbsolute(input.cwd))
35755
+ if (!path6.isAbsolute(input2.cwd))
35436
35756
  return failure("invalidRequest", "Copilot cwd must be absolute.");
35437
- if (!(await stat(input.cwd)).isDirectory())
35757
+ if (!(await stat(input2.cwd)).isDirectory())
35438
35758
  return failure("invalidRequest", "Copilot cwd must be a directory.");
35439
35759
  resolveCopilotExecutable({
35440
- environment: copilotEnvironment(this.environment, input.environment)
35760
+ environment: copilotEnvironment(this.environment, input2.environment)
35441
35761
  });
35442
- if (input.kind === "fork" || input.kind === "rollbackLastTurn")
35443
- return await this.derive(input);
35444
- if (input.kind === "resume" && this.sessions.has(sessionIdFromRef(input.nativeRef)))
35762
+ if (input2.kind === "fork" || input2.kind === "rollbackLastTurn")
35763
+ return await this.derive(input2);
35764
+ if (input2.kind === "resume" && this.sessions.has(sessionIdFromRef(input2.nativeRef)))
35445
35765
  return failure("sessionBusy", "Copilot session already has a writer.");
35446
- const session = new CopilotHarnessSession(input, this.environment, () => this.sessions.delete(session.nativeId));
35766
+ const session = new CopilotHarnessSession(input2, this.environment, () => this.sessions.delete(session.nativeId));
35447
35767
  this.sessions.set(session.nativeId, session);
35448
35768
  try {
35449
- if (input.kind === "resume" || input.executionPolicy === "unattended-full-access")
35769
+ if (input2.kind === "resume" || input2.executionPolicy === "unattended-full-access")
35450
35770
  await session.initialize();
35451
35771
  return { ok: true, value: session };
35452
35772
  } catch (error51) {
35453
- const problem = nativeError(error51, `session.${input.kind}`);
35773
+ const problem = nativeError(error51, `session.${input2.kind}`);
35454
35774
  try {
35455
35775
  await session.close();
35456
35776
  } catch {
@@ -35462,19 +35782,19 @@ var CopilotAdapter = class {
35462
35782
  return { ok: false, error: problem };
35463
35783
  }
35464
35784
  } catch (error51) {
35465
- return { ok: false, error: nativeError(error51, `session.${input.kind}`) };
35785
+ return { ok: false, error: nativeError(error51, `session.${input2.kind}`) };
35466
35786
  }
35467
35787
  }
35468
- async derive(input) {
35469
- const sourceId = sessionIdFromRef(input.sourceRef);
35788
+ async derive(input2) {
35789
+ const sourceId = sessionIdFromRef(input2.sourceRef);
35470
35790
  const source = this.sessions.get(sourceId);
35471
- return source ? source.withIdleSource(() => this.deriveIdle(input, sourceId, source)) : this.deriveIdle(input, sourceId);
35791
+ return source ? source.withIdleSource(() => this.deriveIdle(input2, sourceId, source)) : this.deriveIdle(input2, sourceId);
35472
35792
  }
35473
- async deriveIdle(input, sourceId, source) {
35793
+ async deriveIdle(input2, sourceId, source) {
35474
35794
  const client = createCopilotClient({
35475
- cwd: input.cwd,
35795
+ cwd: input2.cwd,
35476
35796
  environment: this.environment,
35477
- ...input.environment ? { sessionEnvironment: input.environment } : {}
35797
+ ...input2.environment ? { sessionEnvironment: input2.environment } : {}
35478
35798
  });
35479
35799
  this.clients.add(client);
35480
35800
  let created;
@@ -35492,14 +35812,14 @@ var CopilotAdapter = class {
35492
35812
  const events = await bounded(readPersistedEvents(client, sourceId));
35493
35813
  const start = events.find((event) => event.type === "session.start");
35494
35814
  const sourceCwd = start?.data.context?.cwd;
35495
- if (!sourceCwd || await realpath2(sourceCwd) !== await realpath2(input.cwd))
35815
+ if (!sourceCwd || await realpath2(sourceCwd) !== await realpath2(input2.cwd))
35496
35816
  return reject("unsupported", "Copilot Fork must retain the source working directory.");
35497
35817
  let toEventId;
35498
- if (input.kind === "fork") {
35499
- if (input.checkpoint.harnessId !== copilotId || input.checkpoint.nativeSessionId !== sourceId || input.checkpoint.formatVersion !== 1)
35818
+ if (input2.kind === "fork") {
35819
+ if (input2.checkpoint.harnessId !== copilotId || input2.checkpoint.nativeSessionId !== sourceId || input2.checkpoint.formatVersion !== 1)
35500
35820
  return reject("checkpointNotFound", "Copilot checkpoint does not belong to this source.");
35501
35821
  try {
35502
- toEventId = forkBoundary(events, input.checkpoint.checkpointId);
35822
+ toEventId = forkBoundary(events, input2.checkpoint.checkpointId);
35503
35823
  } catch {
35504
35824
  return reject("checkpointNotFound", "Copilot checkpoint was not found.");
35505
35825
  }
@@ -35517,8 +35837,8 @@ var CopilotAdapter = class {
35517
35837
  const ids = (values) => rootMessages(values).map((event) => event.data.messageId);
35518
35838
  if (JSON.stringify(ids(actual)) !== JSON.stringify(ids(expected)))
35519
35839
  throw new Error("Copilot Fork returned the wrong history prefix");
35520
- const content = (id, values) => projectHistory(id, values).turns.map(({ input: input2, items, outcome }) => ({
35521
- input: input2,
35840
+ const content = (id2, values) => projectHistory(id2, values).turns.map(({ input: input3, items, outcome }) => ({
35841
+ input: input3,
35522
35842
  items,
35523
35843
  outcome
35524
35844
  }));
@@ -35526,18 +35846,18 @@ var CopilotAdapter = class {
35526
35846
  throw new Error("Copilot Fork changed the visible history prefix");
35527
35847
  const result = await this.open({
35528
35848
  kind: "resume",
35529
- nativeRef: sessionRef(created, sessionIsUnattended(input.sourceRef)),
35530
- cwd: input.cwd,
35531
- ...input.environment ? { environment: input.environment } : {}
35849
+ nativeRef: sessionRef(created, sessionIsUnattended(input2.sourceRef)),
35850
+ cwd: input2.cwd,
35851
+ ...input2.environment ? { environment: input2.environment } : {}
35532
35852
  });
35533
35853
  if (!result.ok) {
35534
35854
  primary = result.error;
35535
35855
  return result;
35536
35856
  }
35537
- const state = input.kind === "rollbackLastTurn" ? {
35538
- effectiveModel: input.model,
35539
- effectiveThinkingOptionId: input.thinkingOptionId,
35540
- effectivePermissionModeId: input.permissionModeId
35857
+ const state = input2.kind === "rollbackLastTurn" ? {
35858
+ effectiveModel: input2.model,
35859
+ effectiveThinkingOptionId: input2.thinkingOptionId,
35860
+ effectivePermissionModeId: input2.permissionModeId
35541
35861
  } : source?.currentState();
35542
35862
  try {
35543
35863
  const derived = this.sessions.get(created);
@@ -35568,7 +35888,7 @@ var CopilotAdapter = class {
35568
35888
  throw new CopilotOperationError(selected.error.code, selected.error.message, selected.error.diagnostic, selected.error.retryable, selected.error.stage);
35569
35889
  }
35570
35890
  } catch (error51) {
35571
- primary = nativeError(error51, `session.${input.kind}`);
35891
+ primary = nativeError(error51, `session.${input2.kind}`);
35572
35892
  try {
35573
35893
  await result.value.close();
35574
35894
  } catch {
@@ -35580,7 +35900,7 @@ var CopilotAdapter = class {
35580
35900
  completed = result.value;
35581
35901
  return result;
35582
35902
  } catch (error51) {
35583
- primary = nativeError(error51, `session.${input.kind}`);
35903
+ primary = nativeError(error51, `session.${input2.kind}`);
35584
35904
  return { ok: false, error: primary };
35585
35905
  } finally {
35586
35906
  let cleanupFailed = !copyClosed;
@@ -35621,7 +35941,7 @@ var CopilotAdapter = class {
35621
35941
  this.account.close(),
35622
35942
  ...[...this.clients].map((client) => client.forceStop())
35623
35943
  ]);
35624
- await Promise.allSettled([...this.inspectionsInFlight.values()]);
35944
+ await Promise.allSettled(this.inspectionTasks);
35625
35945
  this.inspectionsInFlight.clear();
35626
35946
  if (results.some((result) => result.status === "rejected"))
35627
35947
  throw new Error("Copilot sessions could not all be closed; retry close.");