@codexhost/cli-linux-arm64 0.23.0 → 0.24.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 (56) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +1565 -1805
  4. package/app/console-web.js +5786 -1600
  5. package/app/desktop-controller.mjs +13104 -2842
  6. package/app/host-runtime.mjs +50518 -51753
  7. package/app/plugins/antigravity/plugin.mjs +1932 -1148
  8. package/app/plugins/claude-code/plugin.mjs +1676 -1218
  9. package/app/plugins/codebuddy/plugin.mjs +1266 -850
  10. package/app/plugins/codex-usage/plugin.mjs +916 -737
  11. package/app/plugins/copilot/plugin.mjs +838 -640
  12. package/app/plugins/cursor-cli/plugin.mjs +1058 -747
  13. package/app/plugins/deepseek-harness/plugin.mjs +1302 -1070
  14. package/app/plugins/devin/plugin.mjs +949 -752
  15. package/app/plugins/grok/plugin.mjs +1132 -964
  16. package/app/plugins/hermes/plugin.mjs +1084 -905
  17. package/app/plugins/kimi-code/plugin.mjs +977 -804
  18. package/app/plugins/kiro-cli/plugin.mjs +951 -758
  19. package/app/plugins/omp/plugin.mjs +1408 -1169
  20. package/app/plugins/opencode/plugin.mjs +1385 -1142
  21. package/app/plugins/pi/plugin.mjs +1515 -1287
  22. package/app/plugins/qoder/plugin.mjs +861 -676
  23. package/app/plugins/qoder-cn/plugin.mjs +861 -676
  24. package/app/plugins/qwen-code/plugin.mjs +1060 -888
  25. package/app/plugins/workbuddy/plugin.mjs +1272 -856
  26. package/app/plugins/zcode/plugin.mjs +1529 -880
  27. package/app/renderer-extension.js +11568 -7827
  28. package/app/web/assets/index-CTCFIQbU.css +1 -0
  29. package/app/web/assets/index-IvFk9KT-.js +203 -0
  30. package/app/web/codexhost-settings.js +4472 -36194
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  34. package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -16
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
  49. package/app/web/sw.js +8 -1
  50. package/app/web-modules/server.mjs +2682 -5540
  51. package/bin/codexhost +0 -0
  52. package/libexec/codexhost-shim +0 -0
  53. package/libexec/codexhost-updater +0 -0
  54. package/package.json +1 -1
  55. package/app/web/assets/index-DJW4bmyx.css +0 -1
  56. package/app/web/assets/index-Dyh1KzAB.js +0 -201
@@ -1258,8 +1258,8 @@ function cleanEnum(obj) {
1258
1258
  return Number.isNaN(Number.parseInt(k, 10));
1259
1259
  }).map((el) => el[1]);
1260
1260
  }
1261
- function base64ToUint8Array(base643) {
1262
- const binaryString = atob(base643);
1261
+ function base64ToUint8Array(base644) {
1262
+ const binaryString = atob(base644);
1263
1263
  const bytes = new Uint8Array(binaryString.length);
1264
1264
  for (let i = 0; i < binaryString.length; i++) {
1265
1265
  bytes[i] = binaryString.charCodeAt(i);
@@ -1274,9 +1274,9 @@ function uint8ArrayToBase64(bytes) {
1274
1274
  return btoa(binaryString);
1275
1275
  }
1276
1276
  function base64urlToUint8Array(base64url3) {
1277
- const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1278
- const padding = "=".repeat((4 - base643.length % 4) % 4);
1279
- return base64ToUint8Array(base643 + padding);
1277
+ const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1278
+ const padding = "=".repeat((4 - base644.length % 4) % 4);
1279
+ return base64ToUint8Array(base644 + padding);
1280
1280
  }
1281
1281
  function uint8ArrayToBase64url(bytes) {
1282
1282
  return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -2642,8 +2642,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2642
2642
  function isValidBase64URL(data) {
2643
2643
  if (!base64url.test(data))
2644
2644
  return false;
2645
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2646
- const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2645
+ const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2646
+ const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
2647
2647
  return isValidBase64(padded);
2648
2648
  }
2649
2649
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
@@ -3097,42 +3097,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3097
3097
  }
3098
3098
  doc.write(`const newResult = {};`);
3099
3099
  for (const key2 of normalized.keys) {
3100
- const id = ids[key2];
3100
+ const id2 = ids[key2];
3101
3101
  const k = esc(key2);
3102
3102
  const schema = shape[key2];
3103
3103
  const isOptionalIn = schema?._zod?.optin === "optional";
3104
3104
  const isOptionalOut = schema?._zod?.optout === "optional";
3105
- doc.write(`const ${id} = ${parseStr(key2)};`);
3105
+ doc.write(`const ${id2} = ${parseStr(key2)};`);
3106
3106
  if (isOptionalIn && isOptionalOut) {
3107
3107
  doc.write(`
3108
- if (${id}.issues.length) {
3108
+ if (${id2}.issues.length) {
3109
3109
  if (${k} in input) {
3110
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3110
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3111
3111
  ...iss,
3112
3112
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3113
3113
  })));
3114
3114
  }
3115
3115
  }
3116
3116
 
3117
- if (${id}.value === undefined) {
3117
+ if (${id2}.value === undefined) {
3118
3118
  if (${k} in input) {
3119
3119
  newResult[${k}] = undefined;
3120
3120
  }
3121
3121
  } else {
3122
- newResult[${k}] = ${id}.value;
3122
+ newResult[${k}] = ${id2}.value;
3123
3123
  }
3124
3124
 
3125
3125
  `);
3126
3126
  } else if (!isOptionalIn) {
3127
3127
  doc.write(`
3128
- const ${id}_present = ${k} in input;
3129
- if (${id}.issues.length) {
3130
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3128
+ const ${id2}_present = ${k} in input;
3129
+ if (${id2}.issues.length) {
3130
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3131
3131
  ...iss,
3132
3132
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3133
3133
  })));
3134
3134
  }
3135
- if (!${id}_present && !${id}.issues.length) {
3135
+ if (!${id2}_present && !${id2}.issues.length) {
3136
3136
  payload.issues.push({
3137
3137
  code: "invalid_type",
3138
3138
  expected: "nonoptional",
@@ -3141,30 +3141,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3141
3141
  });
3142
3142
  }
3143
3143
 
3144
- if (${id}_present) {
3145
- if (${id}.value === undefined) {
3144
+ if (${id2}_present) {
3145
+ if (${id2}.value === undefined) {
3146
3146
  newResult[${k}] = undefined;
3147
3147
  } else {
3148
- newResult[${k}] = ${id}.value;
3148
+ newResult[${k}] = ${id2}.value;
3149
3149
  }
3150
3150
  }
3151
3151
 
3152
3152
  `);
3153
3153
  } else {
3154
3154
  doc.write(`
3155
- if (${id}.issues.length) {
3156
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3155
+ if (${id2}.issues.length) {
3156
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3157
3157
  ...iss,
3158
3158
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3159
3159
  })));
3160
3160
  }
3161
3161
 
3162
- if (${id}.value === undefined) {
3162
+ if (${id2}.value === undefined) {
3163
3163
  if (${k} in input) {
3164
3164
  newResult[${k}] = undefined;
3165
3165
  }
3166
3166
  } else {
3167
- newResult[${k}] = ${id}.value;
3167
+ newResult[${k}] = ${id2}.value;
3168
3168
  }
3169
3169
 
3170
3170
  `);
@@ -11496,26 +11496,26 @@ function extractDefs(ctx, schema) {
11496
11496
  throw new Error("Unprocessed schema. This is a bug in Zod.");
11497
11497
  const idToSchema = /* @__PURE__ */ new Map();
11498
11498
  for (const entry of ctx.seen.entries()) {
11499
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11500
- if (id) {
11501
- const existing = idToSchema.get(id);
11499
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11500
+ if (id2) {
11501
+ const existing = idToSchema.get(id2);
11502
11502
  if (existing && existing !== entry[0]) {
11503
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11503
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11504
11504
  }
11505
- idToSchema.set(id, entry[0]);
11505
+ idToSchema.set(id2, entry[0]);
11506
11506
  }
11507
11507
  }
11508
11508
  const makeURI = (entry) => {
11509
11509
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
11510
11510
  if (ctx.external) {
11511
11511
  const externalId = ctx.external.registry.get(entry[0])?.id;
11512
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
11512
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
11513
11513
  if (externalId) {
11514
11514
  return { ref: uriGenerator(externalId) };
11515
11515
  }
11516
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11517
- entry[1].defId = id;
11518
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
11516
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11517
+ entry[1].defId = id2;
11518
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
11519
11519
  }
11520
11520
  if (entry[1] === root) {
11521
11521
  return { ref: "#" };
@@ -11563,8 +11563,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11563
11563
  continue;
11564
11564
  }
11565
11565
  }
11566
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11567
- if (id) {
11566
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11567
+ if (id2) {
11568
11568
  extractToDef(entry);
11569
11569
  continue;
11570
11570
  }
@@ -11660,10 +11660,10 @@ function finalize(ctx, schema) {
11660
11660
  } else {
11661
11661
  }
11662
11662
  if (ctx.external?.uri) {
11663
- const id = ctx.external.registry.get(schema)?.id;
11664
- if (!id)
11663
+ const id2 = ctx.external.registry.get(schema)?.id;
11664
+ if (!id2)
11665
11665
  throw new Error("Schema is missing an `id` property");
11666
- result.$id = ctx.external.uri(id);
11666
+ result.$id = ctx.external.uri(id2);
11667
11667
  }
11668
11668
  Object.assign(result, root.def ?? root.schema);
11669
11669
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -11823,9 +11823,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
11823
11823
  json2.type = "number";
11824
11824
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
11825
11825
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
11826
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
11826
+ const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
11827
11827
  if (exMin) {
11828
- if (legacy) {
11828
+ if (legacy2) {
11829
11829
  json2.minimum = exclusiveMinimum;
11830
11830
  json2.exclusiveMinimum = true;
11831
11831
  } else {
@@ -11835,7 +11835,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
11835
11835
  json2.minimum = minimum;
11836
11836
  }
11837
11837
  if (exMax) {
11838
- if (legacy) {
11838
+ if (legacy2) {
11839
11839
  json2.maximum = exclusiveMaximum;
11840
11840
  json2.exclusiveMaximum = true;
11841
11841
  } else {
@@ -12697,7 +12697,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
12697
12697
 
12698
12698
  // ../../../node_modules/zod/v4/classic/schemas.js
12699
12699
  var _installedGroups = /* @__PURE__ */ new WeakMap();
12700
- function _installLazyMethods(inst, group, methods) {
12700
+ function _installLazyMethods(inst, group, methods2) {
12701
12701
  const proto = Object.getPrototypeOf(inst);
12702
12702
  let installed = _installedGroups.get(proto);
12703
12703
  if (!installed) {
@@ -12707,8 +12707,8 @@ function _installLazyMethods(inst, group, methods) {
12707
12707
  if (installed.has(group))
12708
12708
  return;
12709
12709
  installed.add(group);
12710
- for (const key2 in methods) {
12711
- const fn = methods[key2];
12710
+ for (const key2 in methods2) {
12711
+ const fn = methods2[key2];
12712
12712
  Object.defineProperty(proto, key2, {
12713
12713
  configurable: true,
12714
12714
  enumerable: false,
@@ -14519,87 +14519,6 @@ function date4(params) {
14519
14519
  // ../../../node_modules/zod/v4/classic/external.js
14520
14520
  config(en_default());
14521
14521
 
14522
- // ../../shared-contracts/dist/ids.js
14523
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14524
- message: "Identifier must not be empty or whitespace"
14525
- });
14526
- var harnessIdSchema = opaqueIdSchema.brand();
14527
- var hostThreadIdSchema = opaqueIdSchema.brand();
14528
- var hostTurnIdSchema = opaqueIdSchema.brand();
14529
- var hostItemIdSchema = opaqueIdSchema.brand();
14530
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14531
-
14532
- // ../../shared-contracts/dist/harness-plugins.js
14533
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14534
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
14535
- var HARNESS_PLUGIN_LIMIT = 128;
14536
- var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
14537
- var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
14538
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
14539
- 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");
14540
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
14541
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
14542
- var harnessInstallationGuideSchema = external_exports.object({
14543
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
14544
- before: localizedTextSchema.optional(),
14545
- after: localizedTextSchema.optional(),
14546
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
14547
- }).strict();
14548
- var pluginPresentationShape = {
14549
- id: installedHarnessPluginIdSchema,
14550
- name: external_exports.string().trim().min(1).max(128),
14551
- version: external_exports.string().min(1).max(128),
14552
- /** Capability-only plugin; omitted for existing session-capable plugins. */
14553
- kind: external_exports.literal("usage").optional(),
14554
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
14555
- iconStyle: external_exports.object({
14556
- vector: external_exports.object({
14557
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
14558
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
14559
- paths: external_exports.array(external_exports.object({
14560
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
14561
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
14562
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
14563
- }).strict()).min(1).max(32)
14564
- }).strict().optional(),
14565
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
14566
- borderRadius: external_exports.number().min(0).max(50).optional(),
14567
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
14568
- }).strict().optional(),
14569
- installation: harnessInstallationGuideSchema.optional(),
14570
- notice: localizedTextSchema.optional(),
14571
- /** The factory accepts a persisted local entrypoint through its construction context. */
14572
- launchCommand: external_exports.literal(true).optional(),
14573
- links: external_exports.object({
14574
- website: documentationUrlSchema.optional(),
14575
- documentation: documentationUrlSchema.optional(),
14576
- installation: documentationUrlSchema.optional()
14577
- }).strict().optional()
14578
- };
14579
- var harnessPluginManifestSchema = external_exports.object({
14580
- manifestVersion: external_exports.literal(1),
14581
- ...pluginPresentationShape,
14582
- adapterApiVersion: external_exports.number().int().positive(),
14583
- entry: pluginRelativeResourceSchema,
14584
- icon: pluginRelativeResourceSchema.optional()
14585
- }).strict();
14586
- 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);
14587
- var harnessPluginDescriptorSchema = external_exports.object({
14588
- ...pluginPresentationShape,
14589
- icon: harnessPluginIconSchema.optional()
14590
- }).strict();
14591
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
14592
- var harnessPluginListResultSchema = external_exports.object({
14593
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
14594
- }).strict();
14595
- var harnessPluginConfigurationSchema = external_exports.object({
14596
- version: external_exports.literal(1),
14597
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
14598
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
14599
- message: "Enabled plugin IDs must be unique",
14600
- path: ["enabled"]
14601
- });
14602
-
14603
14522
  // ../../shared-contracts/dist/json-value.js
14604
14523
  function rejectExplicitUndefined(keys) {
14605
14524
  return (value, context) => {
@@ -14659,403 +14578,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
14659
14578
  var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
14660
14579
  var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
14661
14580
 
14662
- // ../../shared-contracts/dist/desktop-extensions.js
14663
- var DESKTOP_EXTENSION_API_VERSION = 1;
14664
- var DESKTOP_EXTENSION_LIMIT = 64;
14665
- var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
14666
- var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
14667
- var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
14668
- var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
14669
- var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
14670
- var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
14671
- var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
14672
- var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
14673
- var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
14674
- var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
14675
- var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
14676
- var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
14677
- var desktopExtensionIdSchema = installedPluginIdSchema;
14678
- var desktopExtensionSlotSchema = external_exports.enum([
14679
- "sidebar.thread-layout",
14680
- "sidebar.thread-badge",
14681
- "appearance.theme"
14682
- ]);
14683
- var desktopExtensionCategorySchema = external_exports.enum([
14684
- "appearance",
14685
- "interface",
14686
- "workflow",
14687
- "analytics",
14688
- "integrations",
14689
- "tools"
14690
- ]);
14691
- var extensionName = external_exports.string().trim().min(1).max(128);
14692
- function desktopExtensionScreenshotMimeType(resource) {
14693
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
14694
- case "png":
14695
- return "image/png";
14696
- case "jpg":
14697
- case "jpeg":
14698
- return "image/jpeg";
14699
- case "webp":
14700
- return "image/webp";
14701
- default:
14702
- return void 0;
14581
+ // ../../shared-contracts/dist/errors.js
14582
+ var codexhostErrorSchema = external_exports.strictObject({
14583
+ code: external_exports.string().min(1),
14584
+ message: external_exports.string().min(1),
14585
+ retryable: external_exports.boolean(),
14586
+ diagnostic: external_exports.string().min(1).optional(),
14587
+ stage: external_exports.string().min(1).optional(),
14588
+ durationMs: external_exports.number().int().nonnegative().optional(),
14589
+ stderrTail: external_exports.string().min(1).optional()
14590
+ }).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
14591
+
14592
+ // ../../shared-contracts/dist/harness-presentation.js
14593
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14594
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14595
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14596
+ label: displayText(256).optional(),
14597
+ description: displayText(1024).optional()
14598
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14599
+ 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");
14600
+
14601
+ // ../../shared-contracts/dist/ids.js
14602
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14603
+ message: "Identifier must not be empty or whitespace"
14604
+ });
14605
+ var harnessIdSchema = opaqueIdSchema.brand();
14606
+ var hostThreadIdSchema = opaqueIdSchema.brand();
14607
+ var hostTurnIdSchema = opaqueIdSchema.brand();
14608
+ var hostItemIdSchema = opaqueIdSchema.brand();
14609
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
14610
+
14611
+ // ../../shared-contracts/dist/harness-permission-modes.js
14612
+ var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
14613
+ var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
14614
+ var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
14615
+ var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
14616
+ var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14617
+ message: "Value must not be empty or whitespace"
14618
+ });
14619
+ var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
14620
+ var harnessPermissionModeSchema = external_exports.object({
14621
+ id: harnessPermissionModeIdSchema,
14622
+ label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
14623
+ description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
14624
+ dangerous: external_exports.boolean().optional(),
14625
+ localizations: harnessLocalizationsSchema.optional()
14626
+ }).strict();
14627
+ var harnessPermissionModeCatalogSchema = external_exports.object({
14628
+ modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
14629
+ defaultModeId: harnessPermissionModeIdSchema
14630
+ }).strict().superRefine((catalog, context) => {
14631
+ const ids = /* @__PURE__ */ new Set();
14632
+ for (const [index, mode] of catalog.modes.entries()) {
14633
+ if (ids.has(mode.id)) {
14634
+ context.addIssue({
14635
+ code: "custom",
14636
+ message: "Permission Mode IDs must be unique",
14637
+ path: ["modes", index, "id"]
14638
+ });
14639
+ }
14640
+ ids.add(mode.id);
14703
14641
  }
14704
- }
14705
- function desktopExtensionAssetMimeType(resource) {
14706
- switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
14707
- case "gif":
14708
- return "image/gif";
14709
- case "svg":
14710
- return "image/svg+xml";
14711
- case "woff2":
14712
- return "font/woff2";
14713
- case "json":
14714
- return "application/json";
14715
- case "css":
14716
- return "text/css";
14717
- default:
14718
- return desktopExtensionScreenshotMimeType(resource);
14719
- }
14720
- }
14721
- var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
14722
- var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
14723
- 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");
14724
- 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) => {
14725
- const { username, password } = new URL(value);
14726
- return !username && !password && !/[\\\s]/u.test(value);
14727
- }, "URL must not contain credentials, backslashes, or whitespace");
14728
- function localizedText(text2) {
14729
- return external_exports.strictObject({ en: text2, "zh-CN": text2 });
14730
- }
14731
- var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
14732
- var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
14733
- var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
14734
- var settingField = {
14735
- key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
14736
- label: desktopExtensionLocalizedTextSchema,
14737
- description: desktopExtensionLocalizedTextSchema.optional()
14738
- };
14739
- var numericSetting = {
14740
- ...settingField,
14741
- step: external_exports.number().positive().optional(),
14742
- default: external_exports.number().optional()
14743
- };
14744
- var settingOption = external_exports.strictObject({
14745
- value: external_exports.string(),
14746
- label: desktopExtensionLocalizedTextSchema
14747
- });
14748
- var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
14749
- external_exports.strictObject({
14750
- ...settingField,
14751
- type: external_exports.literal("boolean"),
14752
- default: external_exports.boolean().optional()
14753
- }),
14754
- external_exports.strictObject({
14755
- ...settingField,
14756
- type: external_exports.literal("string"),
14757
- placeholder: desktopExtensionLocalizedTextSchema.optional(),
14758
- default: external_exports.string().optional()
14759
- }),
14760
- external_exports.strictObject({
14761
- ...numericSetting,
14762
- type: external_exports.literal("number"),
14763
- min: external_exports.number().optional(),
14764
- max: external_exports.number().optional()
14765
- }),
14766
- external_exports.strictObject({
14767
- ...numericSetting,
14768
- type: external_exports.literal("range"),
14769
- min: external_exports.number(),
14770
- max: external_exports.number()
14771
- }),
14772
- external_exports.strictObject({
14773
- ...settingField,
14774
- type: external_exports.literal("select"),
14775
- options: external_exports.array(settingOption).min(1),
14776
- default: external_exports.string().optional()
14777
- })
14778
- ]).superRefine((field2, ctx) => {
14779
- const issue2 = (path2, message) => ctx.addIssue({ code: "custom", path: [path2], message });
14780
- if (field2.type === "number" || field2.type === "range") {
14781
- const { min = -Infinity, max = Infinity, default: value } = field2;
14782
- if (min > max)
14783
- issue2("max", "Must be at least min");
14784
- if (value !== void 0 && (value < min || value > max))
14785
- issue2("default", "Must be within min and max");
14786
- } else if (field2.type === "select") {
14787
- const values = new Set(field2.options.map(({ value }) => value));
14788
- if (values.size !== field2.options.length)
14789
- issue2("options", "Duplicate option values");
14790
- if (field2.default !== void 0 && !values.has(field2.default))
14791
- issue2("default", "Must match an option value");
14792
- }
14793
- });
14794
- var manifestHeader = external_exports.object({
14795
- manifestVersion: external_exports.int().positive(),
14796
- id: desktopExtensionIdSchema,
14797
- name: external_exports.union([extensionName, localizedText(extensionName)]),
14798
- version: external_exports.string().min(1).max(128),
14799
- desktopApi: external_exports.int().positive()
14800
- }).passthrough();
14801
- var desktopExtensionManifestSchema = manifestHeader.extend({
14802
- manifestVersion: external_exports.literal(1),
14803
- desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
14804
- description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
14805
- author: external_exports.string().trim().min(1).max(128).optional(),
14806
- repository: desktopExtensionHttpUrlSchema.optional(),
14807
- details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
14808
- icon: imagePathSchema.optional(),
14809
- screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
14810
- desktop: external_exports.strictObject({
14811
- script: pluginRelativeResourceSchema,
14812
- style: pluginRelativeResourceSchema.optional()
14813
- }).optional(),
14814
- backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
14815
- slots: slotsSchema.default(() => []),
14816
- settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields2) => new Set(fields2.map(({ key: key2 }) => key2)).size === fields2.length, "Duplicate setting keys").optional(),
14817
- categories: categoriesSchema.optional()
14818
- }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
14819
- var desktopExtensionConfigurationSchema = external_exports.strictObject({
14820
- version: external_exports.literal(1),
14821
- revision: external_exports.int().nonnegative(),
14822
- enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
14823
- reloadToken: external_exports.uuid().optional()
14824
- });
14825
- var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
14826
- var desktopExtensionStatusSchema = external_exports.strictObject({
14827
- state: external_exports.enum([
14828
- "running",
14829
- "disabled",
14830
- "invalid",
14831
- "incompatible",
14832
- "conflict",
14833
- "failed",
14834
- "waiting"
14835
- ]),
14836
- hash: desktopExtensionHashSchema.optional(),
14837
- error: external_exports.string().optional(),
14838
- conflictWith: desktopExtensionIdSchema.optional()
14839
- });
14840
- var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
14841
- controllerPid: external_exports.int().positive(),
14842
- targetId: external_exports.string().nullable(),
14843
- updatedAt: external_exports.iso.datetime(),
14844
- handledReloadToken: external_exports.uuid().optional(),
14845
- extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
14846
- });
14847
- var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
14848
- function isGitHubDesktopExtensionZipballUrl(url2) {
14849
- return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
14850
- }
14851
- var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
14852
- const url2 = new URL(input);
14853
- 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);
14854
- }, "Expected a .zip download URL or a GitHub zipball URL");
14855
- var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
14856
- id: desktopExtensionIdSchema,
14857
- version: external_exports.string().trim().min(1).max(128),
14858
- name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
14859
- description: localizedText(external_exports.string().trim().min(1).max(4096)),
14860
- details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
14861
- author: external_exports.string().trim().min(1).max(128),
14862
- repository: desktopExtensionHttpUrlSchema,
14863
- stars: external_exports.number().int().min(0).optional(),
14864
- downloads: external_exports.number().int().min(0).optional(),
14865
- categories: categoriesSchema.optional(),
14866
- trustTier: desktopExtensionTrustTierSchema.default("community"),
14867
- icon: desktopExtensionHttpUrlSchema.optional(),
14868
- screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
14869
- downloadUrl: desktopExtensionZipUrlSchema,
14870
- sha256: desktopExtensionHashSchema,
14871
- slots: slotsSchema.optional(),
14872
- publishedAt: external_exports.string().optional(),
14873
- updatedAt: external_exports.string().optional(),
14874
- minCodexHostVersion: external_exports.string().optional()
14875
- });
14876
- var desktopExtensionCatalogSchema = external_exports.strictObject({
14877
- schemaVersion: external_exports.literal(1),
14878
- generatedAt: external_exports.string(),
14879
- extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
14880
- });
14881
- var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
14882
- var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
14883
- var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
14884
- var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
14885
- var extensionIdParams = { id: desktopExtensionIdSchema };
14886
- var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
14887
- ...extensionIdParams,
14888
- path: desktopExtensionAssetPathSchema
14889
- });
14890
- var desktopExtensionsAssetResultSchema = external_exports.strictObject({
14891
- mimeType: external_exports.string(),
14892
- dataUrl: external_exports.string()
14893
- });
14894
- var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
14895
- var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
14896
- ...extensionIdParams,
14897
- values: jsonObjectSchema
14898
- });
14899
- var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
14900
- var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
14901
- var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
14902
- ...extensionIdParams,
14903
- method: desktopExtensionBackendMethodSchema,
14904
- params: jsonValueSchema.optional()
14905
- });
14906
- var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
14907
- result: jsonValueSchema
14908
- });
14909
-
14910
- // ../../shared-contracts/dist/desktop-extension-management.js
14911
- var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
14912
- var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
14913
- var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
14914
- var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
14915
- var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
14916
- var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
14917
- var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
14918
- var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
14919
- DESKTOP_EXTENSIONS_LIST_METHOD,
14920
- DESKTOP_EXTENSIONS_ENABLE_METHOD,
14921
- DESKTOP_EXTENSIONS_DISABLE_METHOD,
14922
- DESKTOP_EXTENSIONS_RECOVER_METHOD,
14923
- DESKTOP_EXTENSIONS_CATALOG_METHOD,
14924
- DESKTOP_EXTENSIONS_INSTALL_METHOD,
14925
- DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
14926
- DESKTOP_EXTENSIONS_ASSET_METHOD,
14927
- DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
14928
- DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
14929
- DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
14930
- ];
14931
- var revisionSchema = external_exports.int().nonnegative();
14932
- var desktopExtensionsListParamsSchema = external_exports.strictObject({});
14933
- var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
14934
- id: desktopExtensionIdSchema,
14935
- expectedRevision: revisionSchema
14936
- });
14937
- var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
14938
- expectedRevision: revisionSchema.optional()
14939
- });
14940
- 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);
14941
- var desktopExtensionListItemSchema = external_exports.strictObject({
14942
- // An invalid discovery can have a directory name that isn't a valid extension ID.
14943
- id: external_exports.string().min(1),
14944
- manifest: desktopExtensionManifestSchema.optional(),
14945
- iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
14946
- screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
14947
- enabled: external_exports.boolean(),
14948
- status: desktopExtensionStatusSchema
14949
- });
14950
- var desktopExtensionsListResultSchema = external_exports.strictObject({
14951
- configuration: desktopExtensionConfigurationSchema,
14952
- desktopConnected: external_exports.boolean(),
14953
- diagnostics: external_exports.array(external_exports.string()),
14954
- extensions: external_exports.array(desktopExtensionListItemSchema)
14955
- });
14956
- var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
14957
- forceRefresh: external_exports.boolean().optional()
14958
- });
14959
- var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
14960
- catalogUrl: external_exports.string(),
14961
- source: external_exports.enum(["remote", "fallback"]),
14962
- fetchedAt: external_exports.string(),
14963
- cached: external_exports.boolean(),
14964
- extensions: desktopExtensionCatalogSchema.shape.extensions,
14965
- error: external_exports.string().optional()
14966
- });
14967
- var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
14968
- source: external_exports.discriminatedUnion("type", [
14969
- external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
14970
- external_exports.strictObject({
14971
- type: external_exports.literal("url"),
14972
- url: desktopExtensionHttpUrlSchema,
14973
- expectedSha256: desktopExtensionHashSchema.optional()
14974
- }),
14975
- external_exports.strictObject({
14976
- type: external_exports.literal("zip-base64"),
14977
- fileName: external_exports.string().trim().min(1).max(255),
14978
- 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")
14979
- })
14980
- ])
14981
- });
14982
- var desktopExtensionsInstallResultSchema = external_exports.strictObject({
14983
- extensionId: desktopExtensionIdSchema,
14984
- version: external_exports.string().min(1),
14985
- replaced: external_exports.boolean(),
14986
- installedPath: external_exports.string(),
14987
- list: desktopExtensionsListResultSchema
14988
- });
14989
- var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
14990
- id: desktopExtensionIdSchema
14991
- });
14992
- var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
14993
- removedId: desktopExtensionIdSchema,
14994
- list: desktopExtensionsListResultSchema
14995
- });
14996
- var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
14997
- external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
14998
- external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
14999
- external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
15000
- ]);
15001
-
15002
- // ../../shared-contracts/dist/errors.js
15003
- var codexhostErrorSchema = external_exports.strictObject({
15004
- code: external_exports.string().min(1),
15005
- message: external_exports.string().min(1),
15006
- retryable: external_exports.boolean(),
15007
- diagnostic: external_exports.string().min(1).optional(),
15008
- stage: external_exports.string().min(1).optional(),
15009
- durationMs: external_exports.number().int().nonnegative().optional(),
15010
- stderrTail: external_exports.string().min(1).optional()
15011
- }).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
15012
-
15013
- // ../../shared-contracts/dist/harness-presentation.js
15014
- var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15015
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
15016
- var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15017
- label: displayText(256).optional(),
15018
- description: displayText(1024).optional()
15019
- }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15020
- 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");
15021
-
15022
- // ../../shared-contracts/dist/harness-permission-modes.js
15023
- var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
15024
- var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
15025
- var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
15026
- var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
15027
- var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15028
- message: "Value must not be empty or whitespace"
15029
- });
15030
- var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
15031
- var harnessPermissionModeSchema = external_exports.object({
15032
- id: harnessPermissionModeIdSchema,
15033
- label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15034
- description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15035
- dangerous: external_exports.boolean().optional(),
15036
- localizations: harnessLocalizationsSchema.optional()
15037
- }).strict();
15038
- var harnessPermissionModeCatalogSchema = external_exports.object({
15039
- modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
15040
- defaultModeId: harnessPermissionModeIdSchema
15041
- }).strict().superRefine((catalog, context) => {
15042
- const ids = /* @__PURE__ */ new Set();
15043
- for (const [index, mode] of catalog.modes.entries()) {
15044
- if (ids.has(mode.id)) {
15045
- context.addIssue({
15046
- code: "custom",
15047
- message: "Permission Mode IDs must be unique",
15048
- path: ["modes", index, "id"]
15049
- });
15050
- }
15051
- ids.add(mode.id);
15052
- }
15053
- if (!ids.has(catalog.defaultModeId)) {
15054
- context.addIssue({
15055
- code: "custom",
15056
- message: "Default Permission Mode must exist in the catalog",
15057
- path: ["defaultModeId"]
15058
- });
14642
+ if (!ids.has(catalog.defaultModeId)) {
14643
+ context.addIssue({
14644
+ code: "custom",
14645
+ message: "Default Permission Mode must exist in the catalog",
14646
+ path: ["defaultModeId"]
14647
+ });
15059
14648
  }
15060
14649
  });
15061
14650
  var threadPermissionModeSelectParamsSchema = external_exports.object({
@@ -15063,6 +14652,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
15063
14652
  permissionModeId: harnessPermissionModeIdSchema
15064
14653
  }).strict();
15065
14654
 
14655
+ // ../../shared-contracts/dist/harness-route-limit.js
14656
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
14657
+
15066
14658
  // ../../shared-contracts/dist/thread-usage.js
15067
14659
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15068
14660
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -15095,7 +14687,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
15095
14687
  expiresAtUnix: nonNegativeSafeIntegerSchema,
15096
14688
  label: indicatorTextSchema(256).optional(),
15097
14689
  tooltip: indicatorTextSchema(1024).optional()
15098
- }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
14690
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
15099
14691
  message: "Composer indicator IDs must be unique"
15100
14692
  });
15101
14693
  var threadUsageSnapshotSchema = external_exports.object({
@@ -15121,6 +14713,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15121
14713
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15122
14714
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15123
14715
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
14716
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15124
14717
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15125
14718
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15126
14719
  }).strict().superRefine((usage2, context) => {
@@ -15248,10 +14841,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
15248
14841
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
15249
14842
  message: "Value must not be empty or whitespace"
15250
14843
  });
15251
- var harnessModelRefIdSchema = nonBlankTextSchema2.max(HARNESS_MODEL_REF_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Model Ref must use transport-safe opaque characters").brand();
14844
+ 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();
14845
+ var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
15252
14846
  var harnessModelRefSchema = external_exports.object({
15253
- id: harnessModelRefIdSchema
14847
+ id: harnessModelRefIdSchema,
14848
+ serviceTier: harnessModelServiceTierSchema.optional()
15254
14849
  }).strict();
14850
+ function sameHarnessModelRef(left, right) {
14851
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
14852
+ }
15255
14853
  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();
15256
14854
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
15257
14855
  var harnessThinkingOptionSchema = external_exports.object({
@@ -15265,7 +14863,15 @@ var harnessModelSchema = external_exports.object({
15265
14863
  /** Optional opaque selection for this same Model with priority processing enabled. */
15266
14864
  fastModel: harnessModelRefSchema.optional(),
15267
14865
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15268
- }).strict();
14866
+ }).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
14867
+ path: ["fastModel", "id"],
14868
+ message: "A tiered Fast Model must share the base Model ID"
14869
+ });
14870
+ function catalogModelForRef(catalog, ref) {
14871
+ if (!ref)
14872
+ return void 0;
14873
+ return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
14874
+ }
15269
14875
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
15270
14876
  const ids = /* @__PURE__ */ new Set();
15271
14877
  for (const [index, option] of options.entries()) {
@@ -15285,26 +14891,26 @@ var harnessModelCatalogSchema = external_exports.object({
15285
14891
  thinkingOptions: harnessThinkingOptionsSchema,
15286
14892
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
15287
14893
  }).strict().superRefine((catalog, context) => {
15288
- const refs = /* @__PURE__ */ new Set();
15289
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
14894
+ const refs = [];
14895
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
15290
14896
  for (const [index, model2] of catalog.models.entries()) {
15291
- if (refs.has(model2.ref.id)) {
14897
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
15292
14898
  context.addIssue({
15293
14899
  code: "custom",
15294
14900
  message: "Model Catalog refs must be unique",
15295
14901
  path: ["models", index, "ref", "id"]
15296
14902
  });
15297
14903
  }
15298
- refs.add(model2.ref.id);
14904
+ refs.push(model2.ref);
15299
14905
  if (model2.fastModel) {
15300
- if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
14906
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
15301
14907
  context.addIssue({
15302
14908
  code: "custom",
15303
14909
  message: "Fast Model refs must be distinct and unique",
15304
14910
  path: ["models", index, "fastModel"]
15305
14911
  });
15306
14912
  }
15307
- refs.add(model2.fastModel.id);
14913
+ refs.push(model2.fastModel);
15308
14914
  }
15309
14915
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15310
14916
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -15325,7 +14931,7 @@ var harnessModelCatalogSchema = external_exports.object({
15325
14931
  }
15326
14932
  }
15327
14933
  }
15328
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
14934
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
15329
14935
  context.addIssue({
15330
14936
  code: "custom",
15331
14937
  message: "Default Model must exist in the Model Catalog",
@@ -15340,192 +14946,743 @@ var harnessModelCatalogSchema = external_exports.object({
15340
14946
  });
15341
14947
  }
15342
14948
  });
15343
- var harnessHistoryCapabilitiesSchema = external_exports.object({
15344
- fork: external_exports.boolean(),
15345
- forkAcrossCwd: external_exports.boolean(),
15346
- rollbackLastTurn: external_exports.boolean()
15347
- }).strict().refine((history) => history.fork || !history.forkAcrossCwd, {
15348
- path: ["forkAcrossCwd"],
15349
- message: "Cross-cwd Fork requires exact history Fork support"
14949
+ var harnessHistoryCapabilitiesSchema = external_exports.object({
14950
+ fork: external_exports.boolean(),
14951
+ forkAcrossCwd: external_exports.boolean(),
14952
+ rollbackLastTurn: external_exports.boolean()
14953
+ }).strict().refine((history) => history.fork || !history.forkAcrossCwd, {
14954
+ path: ["forkAcrossCwd"],
14955
+ message: "Cross-cwd Fork requires exact history Fork support"
14956
+ });
14957
+ var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
14958
+ var harnessSessionCapabilitiesSchema = external_exports.object({
14959
+ configuration: external_exports.object({
14960
+ selectModel: external_exports.boolean(),
14961
+ selectThinkingOption: external_exports.boolean(),
14962
+ selectPermissionMode: external_exports.boolean(),
14963
+ permissionModeScope: harnessPermissionModeScopeSchema.default("live")
14964
+ }).strict(),
14965
+ history: harnessHistoryCapabilitiesSchema,
14966
+ subagents: external_exports.object({
14967
+ observe: external_exports.boolean(),
14968
+ readTranscript: external_exports.boolean()
14969
+ }).strict().optional(),
14970
+ autonomousTurns: external_exports.object({
14971
+ observe: external_exports.boolean()
14972
+ }).strict().optional(),
14973
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
14974
+ steer: external_exports.boolean().optional(),
14975
+ /**
14976
+ * True when the native plan (task list) outlives the Turn that changed it, so a reopened
14977
+ * Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
14978
+ */
14979
+ persistentPlan: external_exports.boolean().optional()
14980
+ }).strict();
14981
+ var harnessConfigurationStateSchema = external_exports.object({
14982
+ effectiveModel: harnessModelRefSchema.optional(),
14983
+ resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14984
+ effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
14985
+ availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
14986
+ effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
14987
+ }).strict().superRefine((state, context) => {
14988
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
14989
+ context.addIssue({
14990
+ code: "custom",
14991
+ message: "Effective Thinking option must be currently available",
14992
+ path: ["effectiveThinkingOptionId"]
14993
+ });
14994
+ }
14995
+ });
14996
+ var harnessWebUiCapabilitySchema = external_exports.object({
14997
+ open: external_exports.literal(true)
14998
+ }).strict();
14999
+ var readyHarnessInspectionSchema = external_exports.object({
15000
+ status: external_exports.literal("ready"),
15001
+ catalog: harnessModelCatalogSchema,
15002
+ permissionModes: harnessPermissionModeCatalogSchema.optional(),
15003
+ capabilities: harnessSessionCapabilitiesSchema,
15004
+ webUi: harnessWebUiCapabilitySchema.optional()
15005
+ }).strict().superRefine((inspection, context) => {
15006
+ const selectable = inspection.capabilities.configuration.selectPermissionMode;
15007
+ if (selectable !== Boolean(inspection.permissionModes)) {
15008
+ context.addIssue({
15009
+ code: "custom",
15010
+ message: "Permission Mode catalog and capability must agree",
15011
+ path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
15012
+ });
15013
+ }
15014
+ });
15015
+ var failedHarnessInspectionSchema = external_exports.object({
15016
+ status: external_exports.enum(["notInstalled", "unavailable", "error"]),
15017
+ error: codexhostErrorSchema
15018
+ }).strict();
15019
+ var harnessInspectionSchema = external_exports.union([
15020
+ readyHarnessInspectionSchema,
15021
+ failedHarnessInspectionSchema
15022
+ ]);
15023
+ var harnessInspectParamsSchema = external_exports.object({
15024
+ harnessId: harnessIdSchema,
15025
+ cwd: nonBlankTextSchema2.max(16384).optional(),
15026
+ refresh: external_exports.boolean().optional(),
15027
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15028
+ purpose: external_exports.literal("availability").optional(),
15029
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
15030
+ }).strict();
15031
+ var harnessWebUiOpenParamsSchema = external_exports.object({
15032
+ harnessId: harnessIdSchema
15033
+ }).strict();
15034
+ var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
15035
+ var threadModelSelectParamsSchema = external_exports.object({
15036
+ threadId: hostThreadIdSchema,
15037
+ model: harnessModelRefSchema
15038
+ }).strict();
15039
+ var threadThinkingSelectParamsSchema = external_exports.object({
15040
+ threadId: hostThreadIdSchema,
15041
+ thinkingOptionId: harnessThinkingOptionIdSchema
15042
+ }).strict();
15043
+ var threadInspectionParamsSchema = external_exports.object({
15044
+ threadId: hostThreadIdSchema,
15045
+ includeReferenceCapability: external_exports.boolean().optional()
15046
+ }).strict();
15047
+ var codexThreadInspectionSchema = external_exports.object({
15048
+ owner: external_exports.literal("codex"),
15049
+ locked: external_exports.boolean(),
15050
+ effectiveModel: harnessModelRefSchema.optional(),
15051
+ resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15052
+ effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15053
+ effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15054
+ history: harnessHistoryCapabilitiesSchema.optional(),
15055
+ supportsThreadReferences: external_exports.literal(true).optional()
15056
+ }).strict();
15057
+ var externalThreadInspectionSchema = external_exports.object({
15058
+ owner: external_exports.literal("external"),
15059
+ harnessId: nonBlankTextSchema2.max(256),
15060
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
15061
+ effectiveModel: harnessModelRefSchema.optional(),
15062
+ resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15063
+ effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15064
+ availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15065
+ effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15066
+ history: harnessHistoryCapabilitiesSchema,
15067
+ usage: threadUsageSnapshotSchema.optional(),
15068
+ locked: external_exports.literal(true)
15069
+ }).strict();
15070
+ var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
15071
+ codexThreadInspectionSchema,
15072
+ externalThreadInspectionSchema
15073
+ ]);
15074
+ var threadOwnershipListParamsSchema = external_exports.object({
15075
+ threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15076
+ }).strict().superRefine(({ threadIds }, context) => {
15077
+ const seen = /* @__PURE__ */ new Set();
15078
+ for (const [index, threadId] of threadIds.entries()) {
15079
+ if (seen.has(threadId)) {
15080
+ context.addIssue({
15081
+ code: "custom",
15082
+ message: "Thread ownership-list IDs must be unique",
15083
+ path: ["threadIds", index]
15084
+ });
15085
+ }
15086
+ seen.add(threadId);
15087
+ }
15088
+ });
15089
+ var codexThreadOwnershipSchema = external_exports.object({
15090
+ threadId: hostThreadIdSchema,
15091
+ owner: external_exports.literal("codex")
15092
+ }).strict();
15093
+ var externalThreadOwnershipSchema = external_exports.object({
15094
+ threadId: hostThreadIdSchema,
15095
+ owner: external_exports.literal("external"),
15096
+ harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
15097
+ }).strict();
15098
+ var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
15099
+ codexThreadOwnershipSchema,
15100
+ externalThreadOwnershipSchema
15101
+ ]);
15102
+ var threadOwnershipListResultSchema = external_exports.object({
15103
+ threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15104
+ }).strict().superRefine(({ threads }, context) => {
15105
+ const seen = /* @__PURE__ */ new Set();
15106
+ for (const [index, thread2] of threads.entries()) {
15107
+ if (seen.has(thread2.threadId)) {
15108
+ context.addIssue({
15109
+ code: "custom",
15110
+ message: "Thread ownership-list results must be unique",
15111
+ path: ["threads", index, "threadId"]
15112
+ });
15113
+ }
15114
+ seen.add(thread2.threadId);
15115
+ }
15116
+ });
15117
+ var threadSteeringInspectParamsSchema = external_exports.object({
15118
+ threadId: hostThreadIdSchema,
15119
+ /** The text about to be steered; a Harness command always stops and restarts. */
15120
+ text: external_exports.string().optional()
15121
+ }).strict();
15122
+ var threadSteeringContextSchema = external_exports.object({
15123
+ kind: external_exports.literal("application"),
15124
+ value: external_exports.string().transform((text2, context) => {
15125
+ try {
15126
+ return JSON.parse(text2);
15127
+ } catch {
15128
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15129
+ return external_exports.NEVER;
15130
+ }
15131
+ }).pipe(external_exports.object({
15132
+ expectedTurnId: hostTurnIdSchema,
15133
+ clientUserMessageId: external_exports.string().min(1),
15134
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15135
+ }).strict())
15136
+ }).strict().transform((context) => context.value);
15137
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15138
+ var threadSteeringInspectResultSchema = external_exports.object({
15139
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15140
+ }).strict();
15141
+
15142
+ // ../../shared-contracts/dist/harness-plugins.js
15143
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15144
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15145
+ var HARNESS_PLUGIN_LIMIT = 128;
15146
+ var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
15147
+ var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
15148
+ var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
15149
+ 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");
15150
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15151
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15152
+ var harnessInstallationGuideSchema = external_exports.object({
15153
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15154
+ before: localizedTextSchema.optional(),
15155
+ after: localizedTextSchema.optional(),
15156
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15157
+ }).strict();
15158
+ var pluginPresentationShape = {
15159
+ id: installedHarnessPluginIdSchema,
15160
+ name: external_exports.string().trim().min(1).max(128),
15161
+ version: external_exports.string().min(1).max(128),
15162
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15163
+ kind: external_exports.literal("usage").optional(),
15164
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15165
+ iconStyle: external_exports.object({
15166
+ vector: external_exports.object({
15167
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15168
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15169
+ paths: external_exports.array(external_exports.object({
15170
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15171
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15172
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15173
+ }).strict()).min(1).max(32)
15174
+ }).strict().optional(),
15175
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15176
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15177
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15178
+ }).strict().optional(),
15179
+ installation: harnessInstallationGuideSchema.optional(),
15180
+ notice: localizedTextSchema.optional(),
15181
+ /** The factory accepts a persisted local entrypoint through its construction context. */
15182
+ launchCommand: external_exports.literal(true).optional(),
15183
+ links: external_exports.object({
15184
+ website: documentationUrlSchema.optional(),
15185
+ documentation: documentationUrlSchema.optional(),
15186
+ installation: documentationUrlSchema.optional()
15187
+ }).strict().optional()
15188
+ };
15189
+ var harnessPluginManifestSchema = external_exports.object({
15190
+ manifestVersion: external_exports.literal(1),
15191
+ ...pluginPresentationShape,
15192
+ adapterApiVersion: external_exports.number().int().positive(),
15193
+ entry: pluginRelativeResourceSchema,
15194
+ icon: pluginRelativeResourceSchema.optional()
15195
+ }).strict();
15196
+ 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);
15197
+ var harnessPluginDescriptorSchema = external_exports.object({
15198
+ ...pluginPresentationShape,
15199
+ icon: harnessPluginIconSchema.optional()
15200
+ }).strict();
15201
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
15202
+ var harnessPluginListResultSchema = external_exports.object({
15203
+ plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
15204
+ }).strict();
15205
+ var harnessPluginConfigurationSchema = external_exports.object({
15206
+ version: external_exports.literal(1),
15207
+ enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15208
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15209
+ message: "Enabled plugin IDs must be unique",
15210
+ path: ["enabled"]
15211
+ });
15212
+
15213
+ // ../../shared-contracts/dist/desktop-extensions.js
15214
+ var DESKTOP_EXTENSION_API_VERSION = 1;
15215
+ var DESKTOP_EXTENSION_LIMIT = 64;
15216
+ var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
15217
+ var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
15218
+ var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
15219
+ var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
15220
+ var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
15221
+ var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
15222
+ var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
15223
+ var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
15224
+ var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
15225
+ var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
15226
+ var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
15227
+ var desktopExtensionIdSchema = installedPluginIdSchema;
15228
+ var desktopExtensionSlotSchema = external_exports.enum([
15229
+ "sidebar.thread-layout",
15230
+ "sidebar.thread-badge",
15231
+ "appearance.theme"
15232
+ ]);
15233
+ var desktopExtensionCategorySchema = external_exports.enum([
15234
+ "appearance",
15235
+ "interface",
15236
+ "workflow",
15237
+ "analytics",
15238
+ "integrations",
15239
+ "tools"
15240
+ ]);
15241
+ var extensionName = external_exports.string().trim().min(1).max(128);
15242
+ function desktopExtensionScreenshotMimeType(resource) {
15243
+ switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15244
+ case "png":
15245
+ return "image/png";
15246
+ case "jpg":
15247
+ case "jpeg":
15248
+ return "image/jpeg";
15249
+ case "webp":
15250
+ return "image/webp";
15251
+ default:
15252
+ return void 0;
15253
+ }
15254
+ }
15255
+ var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
15256
+ 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");
15257
+ 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) => {
15258
+ const { username, password } = new URL(value);
15259
+ return !username && !password && !/[\\\s]/u.test(value);
15260
+ }, "URL must not contain credentials, backslashes, or whitespace");
15261
+ function localizedText(text2) {
15262
+ return external_exports.strictObject({ en: text2, "zh-CN": text2 });
15263
+ }
15264
+ var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15265
+ var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
15266
+ var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
15267
+ var settingField = {
15268
+ key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
15269
+ label: desktopExtensionLocalizedTextSchema,
15270
+ description: desktopExtensionLocalizedTextSchema.optional()
15271
+ };
15272
+ var numericSetting = {
15273
+ ...settingField,
15274
+ step: external_exports.number().positive().optional(),
15275
+ default: external_exports.number().optional()
15276
+ };
15277
+ var settingOption = external_exports.strictObject({
15278
+ value: external_exports.string(),
15279
+ label: desktopExtensionLocalizedTextSchema
15280
+ });
15281
+ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
15282
+ external_exports.strictObject({
15283
+ ...settingField,
15284
+ type: external_exports.literal("boolean"),
15285
+ default: external_exports.boolean().optional()
15286
+ }),
15287
+ external_exports.strictObject({
15288
+ ...settingField,
15289
+ type: external_exports.literal("string"),
15290
+ placeholder: desktopExtensionLocalizedTextSchema.optional(),
15291
+ default: external_exports.string().optional()
15292
+ }),
15293
+ external_exports.strictObject({
15294
+ ...numericSetting,
15295
+ type: external_exports.literal("number"),
15296
+ min: external_exports.number().optional(),
15297
+ max: external_exports.number().optional()
15298
+ }),
15299
+ external_exports.strictObject({
15300
+ ...numericSetting,
15301
+ type: external_exports.literal("range"),
15302
+ min: external_exports.number(),
15303
+ max: external_exports.number()
15304
+ }),
15305
+ external_exports.strictObject({
15306
+ ...settingField,
15307
+ type: external_exports.literal("select"),
15308
+ options: external_exports.array(settingOption).min(1),
15309
+ default: external_exports.string().optional()
15310
+ })
15311
+ ]).superRefine((field2, ctx) => {
15312
+ const issue2 = (path2, message) => ctx.addIssue({ code: "custom", path: [path2], message });
15313
+ if (field2.type === "number" || field2.type === "range") {
15314
+ const { min = -Infinity, max = Infinity, default: value } = field2;
15315
+ if (min > max)
15316
+ issue2("max", "Must be at least min");
15317
+ if (value !== void 0 && (value < min || value > max))
15318
+ issue2("default", "Must be within min and max");
15319
+ } else if (field2.type === "select") {
15320
+ const values = new Set(field2.options.map(({ value }) => value));
15321
+ if (values.size !== field2.options.length)
15322
+ issue2("options", "Duplicate option values");
15323
+ if (field2.default !== void 0 && !values.has(field2.default))
15324
+ issue2("default", "Must match an option value");
15325
+ }
15326
+ });
15327
+ var manifestHeader = external_exports.object({
15328
+ manifestVersion: external_exports.int().positive(),
15329
+ id: desktopExtensionIdSchema,
15330
+ name: external_exports.union([extensionName, localizedText(extensionName)]),
15331
+ version: external_exports.string().min(1).max(128),
15332
+ desktopApi: external_exports.int().positive()
15333
+ }).passthrough();
15334
+ var desktopExtensionManifestSchema = manifestHeader.extend({
15335
+ manifestVersion: external_exports.literal(1),
15336
+ desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
15337
+ description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
15338
+ author: external_exports.string().trim().min(1).max(128).optional(),
15339
+ repository: desktopExtensionHttpUrlSchema.optional(),
15340
+ details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
15341
+ icon: imagePathSchema.optional(),
15342
+ screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
15343
+ desktop: external_exports.strictObject({
15344
+ script: pluginRelativeResourceSchema,
15345
+ style: pluginRelativeResourceSchema.optional()
15346
+ }).optional(),
15347
+ backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
15348
+ slots: slotsSchema.default(() => []),
15349
+ settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields2) => new Set(fields2.map(({ key: key2 }) => key2)).size === fields2.length, "Duplicate setting keys").optional(),
15350
+ categories: categoriesSchema.optional()
15351
+ }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
15352
+ var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
15353
+ var desktopExtensionStatusSchema = external_exports.strictObject({
15354
+ state: external_exports.enum([
15355
+ "running",
15356
+ "disabled",
15357
+ "invalid",
15358
+ "incompatible",
15359
+ "conflict",
15360
+ "failed",
15361
+ "waiting"
15362
+ ]),
15363
+ hash: desktopExtensionHashSchema.optional(),
15364
+ error: external_exports.string().optional(),
15365
+ conflictWith: desktopExtensionIdSchema.optional()
15366
+ });
15367
+ var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
15368
+ controllerPid: external_exports.int().positive(),
15369
+ targetId: external_exports.string().nullable(),
15370
+ updatedAt: external_exports.iso.datetime(),
15371
+ handledReloadToken: external_exports.uuid().optional(),
15372
+ extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
15373
+ surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
15350
15374
  });
15351
- var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
15352
- var harnessSessionCapabilitiesSchema = external_exports.object({
15353
- configuration: external_exports.object({
15354
- selectModel: external_exports.boolean(),
15355
- selectThinkingOption: external_exports.boolean(),
15356
- selectPermissionMode: external_exports.boolean(),
15357
- permissionModeScope: harnessPermissionModeScopeSchema.default("live")
15358
- }).strict(),
15359
- history: harnessHistoryCapabilitiesSchema,
15360
- subagents: external_exports.object({
15361
- observe: external_exports.boolean(),
15362
- readTranscript: external_exports.boolean()
15363
- }).strict().optional(),
15364
- autonomousTurns: external_exports.object({
15365
- observe: external_exports.boolean()
15366
- }).strict().optional(),
15367
- /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15368
- steer: external_exports.boolean().optional()
15369
- }).strict();
15370
- var harnessConfigurationStateSchema = external_exports.object({
15371
- effectiveModel: harnessModelRefSchema.optional(),
15372
- resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15373
- effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15374
- availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15375
- effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
15376
- }).strict().superRefine((state, context) => {
15377
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
15378
- context.addIssue({
15379
- code: "custom",
15380
- message: "Effective Thinking option must be currently available",
15381
- path: ["effectiveThinkingOptionId"]
15382
- });
15383
- }
15375
+ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
15376
+ function isGitHubDesktopExtensionZipballUrl(url2) {
15377
+ return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15378
+ }
15379
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15380
+ const url2 = new URL(input);
15381
+ 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);
15382
+ }, "Expected a .zip download URL or a GitHub zipball URL");
15383
+ var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
15384
+ id: desktopExtensionIdSchema,
15385
+ version: external_exports.string().trim().min(1).max(128),
15386
+ name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
15387
+ description: localizedText(external_exports.string().trim().min(1).max(4096)),
15388
+ details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
15389
+ author: external_exports.string().trim().min(1).max(128),
15390
+ repository: desktopExtensionHttpUrlSchema,
15391
+ stars: external_exports.number().int().min(0).optional(),
15392
+ downloads: external_exports.number().int().min(0).optional(),
15393
+ categories: categoriesSchema.optional(),
15394
+ trustTier: desktopExtensionTrustTierSchema.default("community"),
15395
+ icon: desktopExtensionHttpUrlSchema.optional(),
15396
+ screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15397
+ downloadUrl: desktopExtensionZipUrlSchema,
15398
+ sha256: desktopExtensionHashSchema,
15399
+ slots: slotsSchema.optional(),
15400
+ publishedAt: external_exports.string().optional(),
15401
+ updatedAt: external_exports.string().optional(),
15402
+ minCodexHostVersion: external_exports.string().optional()
15384
15403
  });
15385
- var harnessWebUiCapabilitySchema = external_exports.object({
15386
- open: external_exports.literal(true)
15387
- }).strict();
15388
- var readyHarnessInspectionSchema = external_exports.object({
15389
- status: external_exports.literal("ready"),
15390
- catalog: harnessModelCatalogSchema,
15391
- permissionModes: harnessPermissionModeCatalogSchema.optional(),
15392
- capabilities: harnessSessionCapabilitiesSchema,
15393
- webUi: harnessWebUiCapabilitySchema.optional()
15394
- }).strict().superRefine((inspection, context) => {
15395
- const selectable = inspection.capabilities.configuration.selectPermissionMode;
15396
- if (selectable !== Boolean(inspection.permissionModes)) {
15397
- context.addIssue({
15398
- code: "custom",
15399
- message: "Permission Mode catalog and capability must agree",
15400
- path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
15401
- });
15402
- }
15404
+ var desktopExtensionCatalogSchema = external_exports.strictObject({
15405
+ schemaVersion: external_exports.literal(1),
15406
+ generatedAt: external_exports.string(),
15407
+ extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15403
15408
  });
15404
- var failedHarnessInspectionSchema = external_exports.object({
15405
- status: external_exports.enum(["notInstalled", "unavailable", "error"]),
15406
- error: codexhostErrorSchema
15407
- }).strict();
15408
- var harnessInspectionSchema = external_exports.union([
15409
- readyHarnessInspectionSchema,
15410
- failedHarnessInspectionSchema
15409
+ var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
15410
+
15411
+ // ../../shared-contracts/dist/host-extensions.js
15412
+ var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
15413
+ var HOST_EXTENSION_PAGE_API_VERSION = 1;
15414
+ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
15415
+ var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
15416
+ var hostExtensionDigestSchema = desktopExtensionHashSchema;
15417
+ var hostExtensionActivationIdSchema = external_exports.uuid();
15418
+ 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((path2) => path2.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
15419
+ var legacy = desktopExtensionManifestSchema.shape;
15420
+ var localized = (max, min = 0) => external_exports.strictObject({
15421
+ en: external_exports.string().trim().min(min).max(max),
15422
+ "zh-CN": external_exports.string().trim().min(min).max(max)
15423
+ });
15424
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path2) => path2.endsWith(suffix), `Expected a ${suffix} file`);
15425
+ var moduleEntry = resourceWithSuffix(".mjs");
15426
+ var style = resourceWithSuffix(".css").optional();
15427
+ var hostExtensionCanonicalPath = (path2) => path2.normalize("NFC").toLowerCase();
15428
+ var hostExtensionManifestV2Schema = external_exports.strictObject({
15429
+ manifestVersion: external_exports.literal(2),
15430
+ id: hostExtensionIdSchema,
15431
+ name: localized(128, 1),
15432
+ version: external_exports.string().trim().min(1).max(128),
15433
+ description: localized(4096),
15434
+ details: localized(16384).optional(),
15435
+ author: legacy.author,
15436
+ repository: legacy.repository,
15437
+ icon: legacy.icon.refine((path2) => path2 === void 0 || hostExtensionResourcePathSchema.safeParse(path2).success),
15438
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path2) => hostExtensionResourcePathSchema.safeParse(path2).success)),
15439
+ categories: legacy.categories,
15440
+ settingsSchema: legacy.settingsSchema,
15441
+ slots: legacy.slots.removeDefault().optional(),
15442
+ page: external_exports.strictObject({
15443
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15444
+ entry: moduleEntry,
15445
+ style,
15446
+ title: localized(128, 1).optional()
15447
+ }).optional(),
15448
+ widget: external_exports.strictObject({
15449
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15450
+ entry: moduleEntry,
15451
+ style
15452
+ }).optional(),
15453
+ desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
15454
+ 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(),
15455
+ backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
15456
+ }).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" });
15457
+ function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
15458
+ if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
15459
+ return ["desktop", "web"];
15460
+ const targets = [];
15461
+ if (hasDesktop)
15462
+ targets.push("desktop");
15463
+ if (hasWeb)
15464
+ targets.push("web");
15465
+ return targets;
15466
+ }
15467
+ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
15468
+
15469
+ // ../../shared-contracts/dist/host-extension-management.js
15470
+ var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
15471
+ var hostExtensionRevisionSchema = external_exports.int().nonnegative();
15472
+ var hostExtensionConfigurationSchema = external_exports.strictObject({
15473
+ revision: hostExtensionRevisionSchema,
15474
+ enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
15475
+ });
15476
+ var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
15477
+ var hostExtensionCatalogEntrySchema = external_exports.object({
15478
+ ...catalogMetadata,
15479
+ id: hostExtensionIdSchema,
15480
+ format: external_exports.literal("codexhost"),
15481
+ targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
15482
+ apis: external_exports.strictObject({
15483
+ page: external_exports.int().positive().optional(),
15484
+ widget: external_exports.int().positive().optional(),
15485
+ desktop: external_exports.int().positive().optional(),
15486
+ web: external_exports.int().positive().optional(),
15487
+ backend: external_exports.int().positive().optional()
15488
+ }),
15489
+ downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
15490
+ }).refine(({ targets, apis }) => {
15491
+ const derived = targetsForCapabilities({
15492
+ hasPage: Boolean(apis.page),
15493
+ hasWidget: Boolean(apis.widget),
15494
+ hasDesktop: Boolean(apis.desktop),
15495
+ hasWeb: Boolean(apis.web),
15496
+ hasBackend: Boolean(apis.backend)
15497
+ });
15498
+ return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
15499
+ }, "Catalog targets must match the declared APIs");
15500
+ var hostExtensionCatalogSchema = external_exports.object({
15501
+ schemaVersion: external_exports.literal(2),
15502
+ generatedAt: external_exports.string().min(1),
15503
+ extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15504
+ });
15505
+ var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
15506
+ catalogUrl: desktopExtensionHttpUrlSchema,
15507
+ fetchedAt: external_exports.iso.datetime(),
15508
+ cached: external_exports.boolean()
15509
+ });
15510
+ var id = { id: hostExtensionIdSchema };
15511
+ var active = {
15512
+ ...id,
15513
+ activationId: hostExtensionActivationIdSchema,
15514
+ digest: hostExtensionDigestSchema
15515
+ };
15516
+ var optionalActivation = { ...id, activationId: active.activationId.optional() };
15517
+ var filePath = external_exports.string().min(1).max(4096).refine((path2) => /^(?:\/|[a-z]:[/\\])/iu.test(path2) && !path2.includes("\0") && !path2.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
15518
+ 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");
15519
+ function base643(maxBytes) {
15520
+ return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
15521
+ const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
15522
+ return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
15523
+ }, "Expected bounded standard padded base64");
15524
+ }
15525
+ var hostExtensionGitHubSourceSchema = external_exports.strictObject({
15526
+ type: external_exports.literal("github"),
15527
+ repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
15528
+ ref: gitRef.optional(),
15529
+ tag: gitRef.optional(),
15530
+ asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
15531
+ subpath: hostExtensionResourcePathSchema.optional()
15532
+ }).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
15533
+ var hostExtensionInstallSourceSchema = external_exports.union([
15534
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15535
+ hostExtensionGitHubSourceSchema,
15536
+ external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
15537
+ external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
15538
+ external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
15411
15539
  ]);
15412
- var harnessInspectParamsSchema = external_exports.object({
15413
- harnessId: harnessIdSchema,
15414
- cwd: nonBlankTextSchema2.max(16384).optional(),
15415
- refresh: external_exports.boolean().optional(),
15416
- /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15417
- purpose: external_exports.literal("availability").optional()
15418
- }).strict();
15419
- var harnessWebUiOpenParamsSchema = external_exports.object({
15420
- harnessId: harnessIdSchema
15421
- }).strict();
15422
- var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
15423
- var threadModelSelectParamsSchema = external_exports.object({
15424
- threadId: hostThreadIdSchema,
15425
- model: harnessModelRefSchema
15426
- }).strict();
15427
- var threadThinkingSelectParamsSchema = external_exports.object({
15428
- threadId: hostThreadIdSchema,
15429
- thinkingOptionId: harnessThinkingOptionIdSchema
15430
- }).strict();
15431
- var threadInspectionParamsSchema = external_exports.object({
15432
- threadId: hostThreadIdSchema,
15433
- includeReferenceCapability: external_exports.boolean().optional()
15434
- }).strict();
15435
- var codexThreadInspectionSchema = external_exports.object({
15436
- owner: external_exports.literal("codex"),
15437
- locked: external_exports.boolean(),
15438
- effectiveModel: harnessModelRefSchema.optional(),
15439
- resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15440
- effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15441
- effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15442
- history: harnessHistoryCapabilitiesSchema.optional(),
15443
- supportsThreadReferences: external_exports.literal(true).optional()
15444
- }).strict();
15445
- var externalThreadInspectionSchema = external_exports.object({
15446
- owner: external_exports.literal("external"),
15447
- harnessId: nonBlankTextSchema2.max(256),
15448
- transportModelId: nonBlankTextSchema2.max(1024),
15449
- effectiveModel: harnessModelRefSchema.optional(),
15450
- resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15451
- effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15452
- availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15453
- effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
15454
- history: harnessHistoryCapabilitiesSchema,
15455
- usage: threadUsageSnapshotSchema.optional(),
15456
- locked: external_exports.literal(true)
15457
- }).strict();
15458
- var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
15459
- codexThreadInspectionSchema,
15460
- externalThreadInspectionSchema
15540
+ var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
15541
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15542
+ hostExtensionGitHubSourceSchema,
15543
+ external_exports.strictObject({ type: external_exports.literal("zip") }),
15544
+ external_exports.strictObject({ type: external_exports.literal("localDir") })
15461
15545
  ]);
15462
- var threadOwnershipListParamsSchema = external_exports.object({
15463
- threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15464
- }).strict().superRefine(({ threadIds }, context) => {
15465
- const seen = /* @__PURE__ */ new Set();
15466
- for (const [index, threadId] of threadIds.entries()) {
15467
- if (seen.has(threadId)) {
15468
- context.addIssue({
15469
- code: "custom",
15470
- message: "Thread ownership-list IDs must be unique",
15471
- path: ["threadIds", index]
15472
- });
15473
- }
15474
- seen.add(threadId);
15475
- }
15546
+ var hostExtensionInstallationSchema = external_exports.strictObject({
15547
+ ...active,
15548
+ manifest: hostExtensionManifestV2Schema,
15549
+ installedAt: external_exports.iso.datetime(),
15550
+ source: hostExtensionProvenanceSchema.optional()
15476
15551
  });
15477
- var codexThreadOwnershipSchema = external_exports.object({
15478
- threadId: hostThreadIdSchema,
15479
- owner: external_exports.literal("codex")
15480
- }).strict();
15481
- var externalThreadOwnershipSchema = external_exports.object({
15482
- threadId: hostThreadIdSchema,
15483
- owner: external_exports.literal("external"),
15484
- harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
15485
- }).strict();
15486
- var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
15487
- codexThreadOwnershipSchema,
15488
- externalThreadOwnershipSchema
15552
+ 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);
15553
+ var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
15554
+ var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
15555
+ var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
15556
+ hostExtensionInstallationSchema.extend({
15557
+ state: external_exports.literal("valid"),
15558
+ enabled: external_exports.boolean(),
15559
+ ...desktopConflict,
15560
+ iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
15561
+ screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15562
+ backendState: backendState.optional(),
15563
+ backendError: external_exports.string().optional()
15564
+ }),
15565
+ external_exports.strictObject({
15566
+ state: external_exports.enum(["invalid", "incompatible"]),
15567
+ id: external_exports.string().min(1),
15568
+ enabled: external_exports.boolean(),
15569
+ error: external_exports.string()
15570
+ })
15489
15571
  ]);
15490
- var threadOwnershipListResultSchema = external_exports.object({
15491
- threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15492
- }).strict().superRefine(({ threads }, context) => {
15493
- const seen = /* @__PURE__ */ new Set();
15494
- for (const [index, thread2] of threads.entries()) {
15495
- if (seen.has(thread2.threadId)) {
15496
- context.addIssue({
15497
- code: "custom",
15498
- message: "Thread ownership-list results must be unique",
15499
- path: ["threads", index, "threadId"]
15500
- });
15501
- }
15502
- seen.add(thread2.threadId);
15503
- }
15572
+ var hostExtensionsListResultSchema = external_exports.strictObject({
15573
+ revision: hostExtensionRevisionSchema,
15574
+ configuration: hostExtensionConfigurationSchema,
15575
+ diagnostics: external_exports.array(external_exports.string()),
15576
+ extensions: external_exports.array(hostExtensionListItemSchema)
15577
+ });
15578
+ var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
15579
+ ...desktopConflict,
15580
+ settingsRevision: hostExtensionRevisionSchema
15581
+ });
15582
+ var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
15583
+ /** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
15584
+ revision: hostExtensionRevisionSchema,
15585
+ // Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
15586
+ extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
15587
+ });
15588
+ var HOST_EXTENSIONS_RPC = {
15589
+ list: "codexhost/extensions/list",
15590
+ snapshot: "codexhost/extensions/snapshot",
15591
+ catalog: "codexhost/extensions/catalog",
15592
+ install: "codexhost/extensions/install",
15593
+ update: "codexhost/extensions/update",
15594
+ enable: "codexhost/extensions/enable",
15595
+ disable: "codexhost/extensions/disable",
15596
+ uninstall: "codexhost/extensions/uninstall",
15597
+ recover: "codexhost/extensions/recover",
15598
+ asset: "codexhost/extensions/asset",
15599
+ settingsGet: "codexhost/extensions/settings/get",
15600
+ settingsSet: "codexhost/extensions/settings/set",
15601
+ backendInvoke: "codexhost/extensions/backend/invoke"
15602
+ };
15603
+ var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
15604
+ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
15605
+ var noParams = external_exports.strictObject({});
15606
+ var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
15607
+ var selection = external_exports.strictObject({ ...id, ...expectedRevision });
15608
+ var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
15609
+ var mutationResult = external_exports.discriminatedUnion("state", [
15610
+ external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
15611
+ external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
15612
+ ]);
15613
+ var hostExtensionsAssetParamsSchema = external_exports.strictObject({
15614
+ ...optionalActivation,
15615
+ digest: active.digest.optional(),
15616
+ path: hostExtensionResourcePathSchema
15617
+ });
15618
+ var hostExtensionsAssetResultSchema = external_exports.strictObject({
15619
+ mimeType: external_exports.string().min(1),
15620
+ base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
15621
+ digest: active.digest
15622
+ });
15623
+ var hostExtensionSettingsSchema = external_exports.strictObject({
15624
+ settingsRevision: hostExtensionRevisionSchema,
15625
+ values: jsonObjectSchema
15504
15626
  });
15505
- var threadSteeringInspectParamsSchema = external_exports.object({
15506
- threadId: hostThreadIdSchema,
15507
- /** The text about to be steered; a Harness command always stops and restarts. */
15508
- text: external_exports.string().optional()
15509
- }).strict();
15510
- var threadSteeringContextSchema = external_exports.object({
15511
- kind: external_exports.literal("application"),
15512
- value: external_exports.string().transform((text2, context) => {
15513
- try {
15514
- return JSON.parse(text2);
15515
- } catch {
15516
- context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15517
- return external_exports.NEVER;
15518
- }
15519
- }).pipe(external_exports.object({
15520
- expectedTurnId: hostTurnIdSchema,
15521
- clientUserMessageId: external_exports.string().min(1),
15522
- delivery: external_exports.enum(["newTurn", "activeTurn"])
15523
- }).strict())
15524
- }).strict().transform((context) => context.value);
15525
- var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15526
- var threadSteeringInspectResultSchema = external_exports.object({
15527
- delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15528
- }).strict();
15627
+ var hostExtensionsRpcSchemas = {
15628
+ [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
15629
+ [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
15630
+ [HOST_EXTENSIONS_RPC.catalog]: {
15631
+ params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
15632
+ result: hostExtensionsCatalogResultSchema
15633
+ },
15634
+ [HOST_EXTENSIONS_RPC.install]: {
15635
+ params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
15636
+ result: installationResult
15637
+ },
15638
+ [HOST_EXTENSIONS_RPC.update]: {
15639
+ params: external_exports.strictObject({
15640
+ ...id,
15641
+ expectedDigest: active.digest,
15642
+ expectedActivationId: active.activationId.optional(),
15643
+ source: hostExtensionInstallSourceSchema.optional()
15644
+ }),
15645
+ result: installationResult
15646
+ },
15647
+ [HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
15648
+ [HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
15649
+ [HOST_EXTENSIONS_RPC.uninstall]: {
15650
+ params: external_exports.strictObject({
15651
+ ...id,
15652
+ removeData: external_exports.boolean().optional(),
15653
+ expectedDigest: active.digest.optional()
15654
+ }),
15655
+ result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
15656
+ },
15657
+ [HOST_EXTENSIONS_RPC.recover]: {
15658
+ params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
15659
+ result: mutationResult
15660
+ },
15661
+ [HOST_EXTENSIONS_RPC.asset]: {
15662
+ params: hostExtensionsAssetParamsSchema,
15663
+ result: hostExtensionsAssetResultSchema
15664
+ },
15665
+ [HOST_EXTENSIONS_RPC.settingsGet]: {
15666
+ params: external_exports.strictObject(optionalActivation),
15667
+ result: hostExtensionSettingsSchema
15668
+ },
15669
+ [HOST_EXTENSIONS_RPC.settingsSet]: {
15670
+ params: external_exports.strictObject({
15671
+ ...optionalActivation,
15672
+ expectedSettingsRevision: hostExtensionRevisionSchema,
15673
+ values: jsonObjectSchema
15674
+ }),
15675
+ result: hostExtensionSettingsSchema
15676
+ },
15677
+ [HOST_EXTENSIONS_RPC.backendInvoke]: {
15678
+ params: external_exports.strictObject({
15679
+ ...optionalActivation,
15680
+ method: hostExtensionBackendMethodSchema,
15681
+ params: jsonValueSchema.optional()
15682
+ }),
15683
+ result: external_exports.strictObject({ result: jsonValueSchema })
15684
+ }
15685
+ };
15529
15686
 
15530
15687
  // ../../shared-contracts/dist/thread-archive-confirm.js
15531
15688
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
@@ -15588,7 +15745,7 @@ var CLIENT_CHANNEL_METHODS = [
15588
15745
  "codexhost/harness/session-import/list",
15589
15746
  "codexhost/harness/session-import/import",
15590
15747
  // Host settings shared across Desktop and Web.
15591
- ...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
15748
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
15592
15749
  "codexhost/harness/installation",
15593
15750
  "codexhost/harness/installation/start",
15594
15751
  "codexhost/harness/installation/status",
@@ -15649,6 +15806,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15649
15806
  cursor: clientChannelCursorSchema,
15650
15807
  revision: external_exports.number().int().nonnegative()
15651
15808
  }),
15809
+ external_exports.object({
15810
+ type: external_exports.literal("extensions-changed"),
15811
+ cursor: clientChannelCursorSchema,
15812
+ revision: hostExtensionRevisionSchema
15813
+ }),
15652
15814
  external_exports.object({
15653
15815
  type: external_exports.literal("hello"),
15654
15816
  version: external_exports.literal(1),
@@ -16085,7 +16247,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
16085
16247
 
16086
16248
  // ../../shared-contracts/dist/harness-preferences.js
16087
16249
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
16088
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
16250
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
16089
16251
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
16090
16252
  model: harnessModelRefSchema.optional(),
16091
16253
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -16095,11 +16257,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
16095
16257
  lastHarness: harnessIdSchema.optional(),
16096
16258
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
16097
16259
  });
16260
+ var harnessDelegationDefaultSchema = external_exports.strictObject({
16261
+ model: harnessModelRefSchema.optional(),
16262
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional()
16263
+ }).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
16264
+ var delegationDefaultsSchema = external_exports.strictObject({
16265
+ byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
16266
+ });
16098
16267
  var modelId = external_exports.string().min(1).max(1024);
16099
16268
  var harnessPreferenceValuesSchema = external_exports.strictObject({
16100
16269
  idleRelease: idleReleaseSettingsSchema.optional(),
16101
16270
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
16102
- newThread: newThreadDefaultsSchema.optional()
16271
+ newThread: newThreadDefaultsSchema.optional(),
16272
+ delegation: delegationDefaultsSchema.optional()
16103
16273
  });
16104
16274
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
16105
16275
  scope: harnessPreferenceScopeSchema,
@@ -16127,6 +16297,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
16127
16297
  lastHarness: harnessIdSchema.optional(),
16128
16298
  harnessId: harnessIdSchema.optional(),
16129
16299
  configuration: harnessDefaultConfigurationSchema.optional()
16300
+ }),
16301
+ external_exports.strictObject({
16302
+ kind: external_exports.literal("delegation"),
16303
+ harnessId: harnessIdSchema,
16304
+ configuration: harnessDelegationDefaultSchema.nullable()
16130
16305
  })
16131
16306
  ]);
16132
16307
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -16945,9 +17120,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16945
17120
  ...thread,
16946
17121
  epoch: identity,
16947
17122
  modelId: identity.optional(),
17123
+ serviceTier: harnessModelServiceTierSchema.optional(),
16948
17124
  thinkingOptionId: identity.optional(),
16949
17125
  permissionModeId: identity.optional()
16950
- }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
17126
+ }).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, {
17127
+ message: "A service tier requires a Model ID"
17128
+ }),
16951
17129
  external_exports.strictObject({
16952
17130
  kind: external_exports.literal("prompt"),
16953
17131
  ...thread,
@@ -16997,7 +17175,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16997
17175
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
16998
17176
  external_exports.strictObject({
16999
17177
  action: external_exports.literal("read-thread"),
17000
- hostId: hostId.refine((id) => id !== "local"),
17178
+ hostId: hostId.refine((id2) => id2 !== "local"),
17001
17179
  input: delegationReadParamsSchema
17002
17180
  }),
17003
17181
  external_exports.strictObject({
@@ -17011,7 +17189,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
17011
17189
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
17012
17190
  external_exports.strictObject({
17013
17191
  action: external_exports.literal("update"),
17014
- hostId: hostId.refine((id) => id !== "local"),
17192
+ hostId: hostId.refine((id2) => id2 !== "local"),
17015
17193
  version: remoteUpdateParamsSchema.shape.version
17016
17194
  })
17017
17195
  ]);
@@ -17322,9 +17500,9 @@ var CodexCounters = class {
17322
17500
  }
17323
17501
  }
17324
17502
  #align(at, total, last) {
17325
- const active = this.#snapshotThread;
17503
+ const active2 = this.#snapshotThread;
17326
17504
  this.#snapshotThread = "";
17327
- if (!active || !this.#snapshotTotal || this.#high || at !== this.#snapshotAt || !last || last.known !== 31 || !isZero(last) || total.known !== 31 || this.#snapshotTotal.known !== 31 || !covers(this.#snapshotTotal, total) || this.entries.some((v) => !v.compaction || v.at !== at))
17505
+ if (!active2 || !this.#snapshotTotal || this.#high || at !== this.#snapshotAt || !last || last.known !== 31 || !isZero(last) || total.known !== 31 || this.#snapshotTotal.known !== 31 || !covers(this.#snapshotTotal, total) || this.entries.some((v) => !v.compaction || v.at !== at))
17328
17506
  return;
17329
17507
  let offset = minus(this.#snapshotTotal, total);
17330
17508
  for (const c of this.#compactions.values()) {
@@ -17852,10 +18030,10 @@ async function readThreadNames(home, signal) {
17852
18030
  const names = /* @__PURE__ */ new Map();
17853
18031
  try {
17854
18032
  for await (const line of jsonlRecords(path.join(home, "session_index.jsonl"), '"thread_name"', signal)) {
17855
- const id = text(line.id);
18033
+ const id2 = text(line.id);
17856
18034
  const name = usageSessionTitle(line.thread_name);
17857
- if (id && name)
17858
- names.set(id, name);
18035
+ if (id2 && name)
18036
+ names.set(id2, name);
17859
18037
  }
17860
18038
  } catch (error51) {
17861
18039
  if (error51.code !== "ENOENT")
@@ -17993,9 +18171,9 @@ async function readCodexRollouts(files, thread2, signal, options = {}) {
17993
18171
  if (v.thread && v.thread !== thread2 || !v.thread && forkAt && v.at < forkAt)
17994
18172
  return [];
17995
18173
  const [input, output, cached2, written, reasoning] = v.usage.values;
17996
- const id = v.response ? `${v.session}:${v.response}` : `legacy:${createHash("sha256").update(JSON.stringify([v.session, v.turn, v.epoch, v.at, v.total?.values, v.usage.values])).digest("hex")}`;
18174
+ const id2 = v.response ? `${v.session}:${v.response}` : `legacy:${createHash("sha256").update(JSON.stringify([v.session, v.turn, v.epoch, v.at, v.total?.values, v.usage.values])).digest("hex")}`;
17997
18175
  const entry = parseHarnessUsageEntry({
17998
- id,
18176
+ id: id2,
17999
18177
  occurredAtMs: v.at,
18000
18178
  ...v.model ? { model: v.model } : {},
18001
18179
  inputTokens: input,
@@ -18052,15 +18230,15 @@ function createCodexUsageStatistics(environment, options = {}) {
18052
18230
  groups.clear();
18053
18231
  for (const [thread2, files] of found) {
18054
18232
  files.sort((a, b) => path.basename(a.file).localeCompare(path.basename(b.file)) || a.file.localeCompare(b.file));
18055
- const id = path.join(home, `usage-thread-${thread2}`);
18056
- groups.set(id, { thread: thread2, files });
18057
- result.push({ id, fingerprint: fingerprint(files, indexStamp) });
18233
+ const id2 = path.join(home, `usage-thread-${thread2}`);
18234
+ groups.set(id2, { thread: thread2, files });
18235
+ result.push({ id: id2, fingerprint: fingerprint(files, indexStamp) });
18058
18236
  }
18059
18237
  return result;
18060
18238
  },
18061
- async readSource(id, signal) {
18239
+ async readSource(id2, signal) {
18062
18240
  signal.throwIfAborted();
18063
- const group = groups.get(id);
18241
+ const group = groups.get(id2);
18064
18242
  if (!group)
18065
18243
  throw new Error("Unknown Codex usage source; list sources before reading");
18066
18244
  const kept = [];
@@ -18119,7 +18297,8 @@ var tokenFields = [
18119
18297
  var safeIntegerFields = [
18120
18298
  "planFiveHourResetsAtUnix",
18121
18299
  "planSevenDayResetsAtUnix",
18122
- "timeToFirstOutputMs"
18300
+ "timeToFirstOutputMs",
18301
+ "latestRequestTimeToFirstOutputMs"
18123
18302
  ];
18124
18303
  var percentFields = [
18125
18304
  "cacheHitRatePercent",
@@ -18430,8 +18609,8 @@ function createCodexSessionHistoryReader(environment) {
18430
18609
  onTokenCount: (info) => {
18431
18610
  snapshot = rolloutTokenSnapshot(info) ?? snapshot;
18432
18611
  },
18433
- onTurnId: (id) => {
18434
- turns.add(id);
18612
+ onTurnId: (id2) => {
18613
+ turns.add(id2);
18435
18614
  },
18436
18615
  onTurnTiming: (turnId, timeToFirstOutputMs, at) => {
18437
18616
  if (!lastTurnTiming || at >= lastTurnTiming.at)
@@ -18555,12 +18734,12 @@ var CodexResponseTiming = class {
18555
18734
  if (frame?.method === "error")
18556
18735
  return unavailable();
18557
18736
  if (frame?.method === "rawResponse/completed") {
18558
- const id = params.responseId;
18559
- if (typeof id !== "string" || !id)
18737
+ const id2 = params.responseId;
18738
+ if (typeof id2 !== "string" || !id2)
18560
18739
  return unavailable();
18561
- if (state.seen.has(id))
18740
+ if (state.seen.has(id2))
18562
18741
  return null;
18563
- state.seen.add(id);
18742
+ state.seen.add(id2);
18564
18743
  const usage2 = object2(params.usage);
18565
18744
  const startedAtMs = state.firstOutputAtMs;
18566
18745
  state.firstOutputAtMs = void 0;
@@ -18571,7 +18750,7 @@ var CodexResponseTiming = class {
18571
18750
  return {
18572
18751
  sessionId,
18573
18752
  requestTiming: {
18574
- requestId: id,
18753
+ requestId: id2,
18575
18754
  turnId: state.id,
18576
18755
  outputTokens: usage2.outputTokens,
18577
18756
  startedAtMs,
@@ -18711,7 +18890,7 @@ function createUsageStatisticsAdapter(context) {
18711
18890
  sessionUsage: createCodexSessionUsage(context.environment, abort.signal),
18712
18891
  usageStatistics: {
18713
18892
  listSources: (signal) => reader.listSources(AbortSignal.any([signal, abort.signal])),
18714
- readSource: (id, signal) => reader.readSource(id, AbortSignal.any([signal, abort.signal]))
18893
+ readSource: (id2, signal) => reader.readSource(id2, AbortSignal.any([signal, abort.signal]))
18715
18894
  },
18716
18895
  close: async () => {
18717
18896
  abort.abort();