@codexhost/cli-darwin-x64 0.22.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 (59) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +3117 -274
  4. package/app/console-web.js +15645 -4413
  5. package/app/desktop-controller.mjs +14057 -969
  6. package/app/host-runtime.mjs +11518 -8277
  7. package/app/plugins/antigravity/plugin.mjs +2030 -678
  8. package/app/plugins/claude-code/plugin.mjs +2116 -929
  9. package/app/plugins/codebuddy/plugin.mjs +1247 -353
  10. package/app/plugins/codex-usage/plugin.mjs +786 -163
  11. package/app/plugins/copilot/plugin.mjs +938 -296
  12. package/app/plugins/cursor-cli/plugin.mjs +1021 -232
  13. package/app/plugins/deepseek-harness/plugin.mjs +1552 -664
  14. package/app/plugins/devin/plugin.mjs +826 -185
  15. package/app/plugins/grok/plugin.mjs +1083 -424
  16. package/app/plugins/hermes/plugin.mjs +961 -338
  17. package/app/plugins/kimi-code/plugin.mjs +854 -237
  18. package/app/plugins/kiro-cli/plugin.mjs +821 -184
  19. package/app/plugins/omp/plugin.mjs +1316 -633
  20. package/app/plugins/opencode/plugin.mjs +1293 -606
  21. package/app/plugins/pi/plugin.mjs +1540 -867
  22. package/app/plugins/qoder/plugin.mjs +961 -332
  23. package/app/plugins/qoder-cn/plugin.mjs +961 -332
  24. package/app/plugins/qwen-code/plugin.mjs +937 -321
  25. package/app/plugins/workbuddy/plugin.mjs +1311 -370
  26. package/app/plugins/zcode/plugin.mjs +1516 -423
  27. package/app/renderer-extension.js +21297 -9060
  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 +6753 -31616
  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 +14 -14
  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 +94 -91
  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-browser/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
  50. package/app/web/sw.js +8 -1
  51. package/app/web-modules/licenses/werift-NOTICES.txt +123 -0
  52. package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
  53. package/app/web-modules/server.mjs +40416 -11283
  54. package/bin/codexhost +0 -0
  55. package/libexec/codexhost-shim +0 -0
  56. package/libexec/codexhost-updater +0 -0
  57. package/package.json +1 -1
  58. package/app/web/assets/index-CN4a4sj0.js +0 -201
  59. package/app/web/assets/index-DJW4bmyx.css +0 -1
@@ -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,
@@ -14652,6 +14652,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
14652
14652
  permissionModeId: harnessPermissionModeIdSchema
14653
14653
  }).strict();
14654
14654
 
14655
+ // ../../shared-contracts/dist/harness-route-limit.js
14656
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
14657
+
14655
14658
  // ../../shared-contracts/dist/thread-usage.js
14656
14659
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14657
14660
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14684,7 +14687,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
14684
14687
  expiresAtUnix: nonNegativeSafeIntegerSchema,
14685
14688
  label: indicatorTextSchema(256).optional(),
14686
14689
  tooltip: indicatorTextSchema(1024).optional()
14687
- }).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, {
14688
14691
  message: "Composer indicator IDs must be unique"
14689
14692
  });
14690
14693
  var threadUsageSnapshotSchema = external_exports.object({
@@ -14710,6 +14713,7 @@ var threadUsageSnapshotSchema = external_exports.object({
14710
14713
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
14711
14714
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
14712
14715
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
14716
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
14713
14717
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
14714
14718
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
14715
14719
  }).strict().superRefine((usage2, context) => {
@@ -14807,6 +14811,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
14807
14811
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14808
14812
  resetCredits: accountResetCreditsSchema.optional()
14809
14813
  }).strict();
14814
+ var accountBalanceSnapshotSchema = external_exports.object({
14815
+ amount: external_exports.number().finite().nonnegative(),
14816
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14817
+ currency: external_exports.string().trim().min(1).max(8),
14818
+ /** Native label when the Harness exposes several Billing Sources. */
14819
+ label: external_exports.string().trim().min(1).max(128).optional()
14820
+ }).strict();
14810
14821
  var threadUsageInspectionParamsSchema = external_exports.object({
14811
14822
  threadId: hostThreadIdSchema,
14812
14823
  refresh: external_exports.literal("exact").optional()
@@ -14815,7 +14826,10 @@ var threadUsageInspectionSchema = external_exports.object({
14815
14826
  threadId: hostThreadIdSchema,
14816
14827
  usage: threadUsageSnapshotSchema.nullable(),
14817
14828
  accountCredits: accountCreditsSnapshotSchema.optional(),
14818
- /** Whether this source can provide cached account quota independently of usage. */
14829
+ /** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
14830
+ accountBalance: accountBalanceSnapshotSchema.optional(),
14831
+ /** Whether this source can provide cached account quota (credits or a prepaid balance)
14832
+ * independently of usage. */
14819
14833
  accountCreditsSupported: external_exports.boolean().optional()
14820
14834
  }).strict();
14821
14835
 
@@ -14827,10 +14841,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
14827
14841
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
14828
14842
  message: "Value must not be empty or whitespace"
14829
14843
  });
14830
- 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"]);
14831
14846
  var harnessModelRefSchema = external_exports.object({
14832
- id: harnessModelRefIdSchema
14847
+ id: harnessModelRefIdSchema,
14848
+ serviceTier: harnessModelServiceTierSchema.optional()
14833
14849
  }).strict();
14850
+ function sameHarnessModelRef(left, right) {
14851
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
14852
+ }
14834
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();
14835
14854
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
14836
14855
  var harnessThinkingOptionSchema = external_exports.object({
@@ -14844,7 +14863,15 @@ var harnessModelSchema = external_exports.object({
14844
14863
  /** Optional opaque selection for this same Model with priority processing enabled. */
14845
14864
  fastModel: harnessModelRefSchema.optional(),
14846
14865
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14847
- }).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
+ }
14848
14875
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
14849
14876
  const ids = /* @__PURE__ */ new Set();
14850
14877
  for (const [index, option] of options.entries()) {
@@ -14864,26 +14891,26 @@ var harnessModelCatalogSchema = external_exports.object({
14864
14891
  thinkingOptions: harnessThinkingOptionsSchema,
14865
14892
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
14866
14893
  }).strict().superRefine((catalog, context) => {
14867
- const refs = /* @__PURE__ */ new Set();
14868
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
14894
+ const refs = [];
14895
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
14869
14896
  for (const [index, model2] of catalog.models.entries()) {
14870
- if (refs.has(model2.ref.id)) {
14897
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
14871
14898
  context.addIssue({
14872
14899
  code: "custom",
14873
14900
  message: "Model Catalog refs must be unique",
14874
14901
  path: ["models", index, "ref", "id"]
14875
14902
  });
14876
14903
  }
14877
- refs.add(model2.ref.id);
14904
+ refs.push(model2.ref);
14878
14905
  if (model2.fastModel) {
14879
- 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))) {
14880
14907
  context.addIssue({
14881
14908
  code: "custom",
14882
14909
  message: "Fast Model refs must be distinct and unique",
14883
14910
  path: ["models", index, "fastModel"]
14884
14911
  });
14885
14912
  }
14886
- refs.add(model2.fastModel.id);
14913
+ refs.push(model2.fastModel);
14887
14914
  }
14888
14915
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14889
14916
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -14904,7 +14931,7 @@ var harnessModelCatalogSchema = external_exports.object({
14904
14931
  }
14905
14932
  }
14906
14933
  }
14907
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
14934
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
14908
14935
  context.addIssue({
14909
14936
  code: "custom",
14910
14937
  message: "Default Model must exist in the Model Catalog",
@@ -14944,7 +14971,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
14944
14971
  observe: external_exports.boolean()
14945
14972
  }).strict().optional(),
14946
14973
  /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
14947
- steer: external_exports.boolean().optional()
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()
14948
14980
  }).strict();
14949
14981
  var harnessConfigurationStateSchema = external_exports.object({
14950
14982
  effectiveModel: harnessModelRefSchema.optional(),
@@ -14953,7 +14985,7 @@ var harnessConfigurationStateSchema = external_exports.object({
14953
14985
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
14954
14986
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
14955
14987
  }).strict().superRefine((state, context) => {
14956
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
14988
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
14957
14989
  context.addIssue({
14958
14990
  code: "custom",
14959
14991
  message: "Effective Thinking option must be currently available",
@@ -14993,7 +15025,8 @@ var harnessInspectParamsSchema = external_exports.object({
14993
15025
  cwd: nonBlankTextSchema2.max(16384).optional(),
14994
15026
  refresh: external_exports.boolean().optional(),
14995
15027
  /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
14996
- purpose: external_exports.literal("availability").optional()
15028
+ purpose: external_exports.literal("availability").optional(),
15029
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
14997
15030
  }).strict();
14998
15031
  var harnessWebUiOpenParamsSchema = external_exports.object({
14999
15032
  harnessId: harnessIdSchema
@@ -15024,7 +15057,7 @@ var codexThreadInspectionSchema = external_exports.object({
15024
15057
  var externalThreadInspectionSchema = external_exports.object({
15025
15058
  owner: external_exports.literal("external"),
15026
15059
  harnessId: nonBlankTextSchema2.max(256),
15027
- transportModelId: nonBlankTextSchema2.max(1024),
15060
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
15028
15061
  effectiveModel: harnessModelRefSchema.optional(),
15029
15062
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15030
15063
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15106,13 +15139,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
15106
15139
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15107
15140
  }).strict();
15108
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()
15374
+ });
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()
15403
+ });
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")
15408
+ });
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 })
15539
+ ]);
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") })
15545
+ ]);
15546
+ var hostExtensionInstallationSchema = external_exports.strictObject({
15547
+ ...active,
15548
+ manifest: hostExtensionManifestV2Schema,
15549
+ installedAt: external_exports.iso.datetime(),
15550
+ source: hostExtensionProvenanceSchema.optional()
15551
+ });
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
+ })
15571
+ ]);
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
15626
+ });
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
+ };
15686
+
15109
15687
  // ../../shared-contracts/dist/thread-archive-confirm.js
15688
+ var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
15110
15689
  var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15111
15690
  var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15112
15691
 
15113
15692
  // ../../shared-contracts/dist/client-channel.js
15114
15693
  var CLIENT_CHANNEL_VERSION = 1;
15115
15694
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15695
+ var CLIENT_CHANNEL_METHODS = [
15696
+ "codexhost/skills/list",
15697
+ "codexhost/voice/status",
15698
+ "codexhost/voice/transcribe",
15699
+ "codexhost/harness/display-settings/get",
15700
+ "codexhost/harness/display-settings/set",
15701
+ "codexhost/harness/display-settings/capabilities",
15702
+ "codexhost/harness/preferences/get",
15703
+ "codexhost/harness/preferences/patch",
15704
+ "thread/list",
15705
+ "codexhost/thread/catalog/read",
15706
+ "thread/read",
15707
+ "thread/resume",
15708
+ "thread/fork",
15709
+ "thread/turns/list",
15710
+ "thread/revert",
15711
+ "thread/items/list",
15712
+ "thread/start",
15713
+ "thread/name/set",
15714
+ "codexhost/thread/title/generate",
15715
+ "thread/archive",
15716
+ THREAD_ARCHIVE_CONFIRM_METHOD,
15717
+ "thread/unarchive",
15718
+ "turn/start",
15719
+ "turn/interrupt",
15720
+ "turn/steer",
15721
+ "thread/queue/list",
15722
+ "thread/queue/add",
15723
+ "thread/queue/update",
15724
+ "thread/queue/delete",
15725
+ "thread/queue/reorder",
15726
+ "thread/queue/start",
15727
+ "codexhost/thread/queue/send-now",
15728
+ "codexhost/workspace/read",
15729
+ "codexhost/thread/tree/read",
15730
+ "codexhost/thread/pins/list",
15731
+ "codexhost/thread/pins/set",
15732
+ "codexhost/harness/plugins/list",
15733
+ "codexhost/harness/inspect",
15734
+ "codexhost/thread/inspect",
15735
+ "codexhost/thread/usage/inspect",
15736
+ "codexhost/thread/ownership/list",
15737
+ "codexhost/thread/model/select",
15738
+ "codexhost/thread/thinking/select",
15739
+ "codexhost/thread/permission-mode/select",
15740
+ "codexhost/thread/commands/inspect",
15741
+ "codexhost/harness/commands/inspect",
15742
+ "codexhost/thread/command/execute",
15743
+ "codexhost/thread/fork",
15744
+ "codexhost/harness/session-import/sources",
15745
+ "codexhost/harness/session-import/list",
15746
+ "codexhost/harness/session-import/import",
15747
+ // Host settings shared across Desktop and Web.
15748
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
15749
+ "codexhost/harness/installation",
15750
+ "codexhost/harness/installation/start",
15751
+ "codexhost/harness/installation/status",
15752
+ "codexhost/harness/launch-settings/get",
15753
+ "codexhost/harness/launch-settings/set",
15754
+ "codexhost/harness/web-ui/open",
15755
+ "codexhost/harness/accounts/sources",
15756
+ "codexhost/harness/accounts/list",
15757
+ "codexhost/harness/accounts/inspect",
15758
+ "codexhost/harness/credential-imports",
15759
+ "codexhost/account/list",
15760
+ "codexhost/account/refresh",
15761
+ "codexhost/account/usage/inspect",
15762
+ "codexhost/usage/model-prices/get",
15763
+ "codexhost/usage/model-prices/set",
15764
+ "codexhost/usage/model-prices/default",
15765
+ "codexhost/usage/statistics/get",
15766
+ "codexhost/update/check",
15767
+ "codexhost/update/start",
15768
+ "codexhost/update/status",
15769
+ "codexhost/sessions/loaded/list"
15770
+ ];
15116
15771
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15117
15772
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15118
15773
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -15151,6 +15806,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15151
15806
  cursor: clientChannelCursorSchema,
15152
15807
  revision: external_exports.number().int().nonnegative()
15153
15808
  }),
15809
+ external_exports.object({
15810
+ type: external_exports.literal("extensions-changed"),
15811
+ cursor: clientChannelCursorSchema,
15812
+ revision: hostExtensionRevisionSchema
15813
+ }),
15154
15814
  external_exports.object({
15155
15815
  type: external_exports.literal("hello"),
15156
15816
  version: external_exports.literal(1),
@@ -15326,6 +15986,29 @@ var threadCatalogReadResultSchema = external_exports.object({
15326
15986
  officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
15327
15987
  }).strict();
15328
15988
 
15989
+ // ../../shared-contracts/dist/thread-tree-watch.js
15990
+ var THREAD_TREE_MAX_NODES = 5e3;
15991
+ var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
15992
+ var threadTreeNodeSchema = external_exports.strictObject({
15993
+ harnessId: harnessIdSchema,
15994
+ title: external_exports.string().optional(),
15995
+ status: threadTreeStatusSchema,
15996
+ archived: external_exports.boolean()
15997
+ });
15998
+ var threadTreeSnapshotSchema = external_exports.strictObject({
15999
+ revision: external_exports.int().nonnegative(),
16000
+ parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
16001
+ nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
16002
+ truncated: external_exports.boolean()
16003
+ }).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)), "Missing Thread tree node");
16004
+ var subscriptionId = external_exports.string().min(1).max(128);
16005
+ var threadTreeWatchParamsSchema = external_exports.strictObject({});
16006
+ var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
16007
+ var threadTreeUnwatchResultSchema = external_exports.strictObject({});
16008
+ var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
16009
+ snapshot: threadTreeSnapshotSchema
16010
+ });
16011
+
15329
16012
  // ../../shared-contracts/dist/voice.js
15330
16013
  var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
15331
16014
  var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
@@ -15564,7 +16247,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
15564
16247
 
15565
16248
  // ../../shared-contracts/dist/harness-preferences.js
15566
16249
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
15567
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
16250
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
15568
16251
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
15569
16252
  model: harnessModelRefSchema.optional(),
15570
16253
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15574,11 +16257,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
15574
16257
  lastHarness: harnessIdSchema.optional(),
15575
16258
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
15576
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
+ });
15577
16267
  var modelId = external_exports.string().min(1).max(1024);
15578
16268
  var harnessPreferenceValuesSchema = external_exports.strictObject({
15579
16269
  idleRelease: idleReleaseSettingsSchema.optional(),
15580
16270
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
15581
- newThread: newThreadDefaultsSchema.optional()
16271
+ newThread: newThreadDefaultsSchema.optional(),
16272
+ delegation: delegationDefaultsSchema.optional()
15582
16273
  });
15583
16274
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
15584
16275
  scope: harnessPreferenceScopeSchema,
@@ -15606,6 +16297,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
15606
16297
  lastHarness: harnessIdSchema.optional(),
15607
16298
  harnessId: harnessIdSchema.optional(),
15608
16299
  configuration: harnessDefaultConfigurationSchema.optional()
16300
+ }),
16301
+ external_exports.strictObject({
16302
+ kind: external_exports.literal("delegation"),
16303
+ harnessId: harnessIdSchema,
16304
+ configuration: harnessDelegationDefaultSchema.nullable()
15609
16305
  })
15610
16306
  ]);
15611
16307
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -15956,13 +16652,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15956
16652
  });
15957
16653
 
15958
16654
  // ../../shared-contracts/dist/harness-accounts.js
15959
- var accountBalanceSnapshotSchema = external_exports.object({
15960
- amount: external_exports.number().finite().nonnegative(),
15961
- /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15962
- currency: external_exports.string().trim().min(1).max(8),
15963
- /** Native label when the Harness exposes several Billing Sources. */
15964
- label: external_exports.string().trim().min(1).max(128).optional()
15965
- }).strict();
15966
16655
  var harnessAccountSnapshotObject = external_exports.object({
15967
16656
  email: external_exports.string().trim().min(1).max(320).optional(),
15968
16657
  label: external_exports.string().trim().min(1).max(256).optional(),
@@ -15996,76 +16685,6 @@ var harnessAccountListResultSchema = external_exports.object({
15996
16685
  accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
15997
16686
  }).strict();
15998
16687
 
15999
- // ../../shared-contracts/dist/harness-plugins.js
16000
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
16001
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
16002
- var HARNESS_PLUGIN_LIMIT = 128;
16003
- var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
16004
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
16005
- var relativeResourceSchema = 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");
16006
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
16007
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
16008
- var harnessInstallationGuideSchema = external_exports.object({
16009
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
16010
- before: localizedTextSchema.optional(),
16011
- after: localizedTextSchema.optional(),
16012
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
16013
- }).strict();
16014
- var pluginPresentationShape = {
16015
- id: installedHarnessPluginIdSchema,
16016
- name: external_exports.string().trim().min(1).max(128),
16017
- version: external_exports.string().min(1).max(128),
16018
- /** Capability-only plugin; omitted for existing session-capable plugins. */
16019
- kind: external_exports.literal("usage").optional(),
16020
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
16021
- iconStyle: external_exports.object({
16022
- vector: external_exports.object({
16023
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
16024
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
16025
- paths: external_exports.array(external_exports.object({
16026
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
16027
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
16028
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
16029
- }).strict()).min(1).max(32)
16030
- }).strict().optional(),
16031
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
16032
- borderRadius: external_exports.number().min(0).max(50).optional(),
16033
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
16034
- }).strict().optional(),
16035
- installation: harnessInstallationGuideSchema.optional(),
16036
- notice: localizedTextSchema.optional(),
16037
- /** The factory accepts a persisted local entrypoint through its construction context. */
16038
- launchCommand: external_exports.literal(true).optional(),
16039
- links: external_exports.object({
16040
- website: documentationUrlSchema.optional(),
16041
- documentation: documentationUrlSchema.optional(),
16042
- installation: documentationUrlSchema.optional()
16043
- }).strict().optional()
16044
- };
16045
- var harnessPluginManifestSchema = external_exports.object({
16046
- manifestVersion: external_exports.literal(1),
16047
- ...pluginPresentationShape,
16048
- adapterApiVersion: external_exports.number().int().positive(),
16049
- entry: relativeResourceSchema,
16050
- icon: relativeResourceSchema.optional()
16051
- }).strict();
16052
- 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);
16053
- var harnessPluginDescriptorSchema = external_exports.object({
16054
- ...pluginPresentationShape,
16055
- icon: harnessPluginIconSchema.optional()
16056
- }).strict();
16057
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
16058
- var harnessPluginListResultSchema = external_exports.object({
16059
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
16060
- }).strict();
16061
- var harnessPluginConfigurationSchema = external_exports.object({
16062
- version: external_exports.literal(1),
16063
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
16064
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
16065
- message: "Enabled plugin IDs must be unique",
16066
- path: ["enabled"]
16067
- });
16068
-
16069
16688
  // ../../shared-contracts/dist/harness-route.js
16070
16689
  var harnessPluginRouteSchema = external_exports.object({
16071
16690
  harnessId: harnessPluginIdSchema,
@@ -16501,9 +17120,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16501
17120
  ...thread,
16502
17121
  epoch: identity,
16503
17122
  modelId: identity.optional(),
17123
+ serviceTier: harnessModelServiceTierSchema.optional(),
16504
17124
  thinkingOptionId: identity.optional(),
16505
17125
  permissionModeId: identity.optional()
16506
- }).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
+ }),
16507
17129
  external_exports.strictObject({
16508
17130
  kind: external_exports.literal("prompt"),
16509
17131
  ...thread,
@@ -16553,7 +17175,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16553
17175
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
16554
17176
  external_exports.strictObject({
16555
17177
  action: external_exports.literal("read-thread"),
16556
- hostId: hostId.refine((id) => id !== "local"),
17178
+ hostId: hostId.refine((id2) => id2 !== "local"),
16557
17179
  input: delegationReadParamsSchema
16558
17180
  }),
16559
17181
  external_exports.strictObject({
@@ -16567,7 +17189,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16567
17189
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
16568
17190
  external_exports.strictObject({
16569
17191
  action: external_exports.literal("update"),
16570
- hostId: hostId.refine((id) => id !== "local"),
17192
+ hostId: hostId.refine((id2) => id2 !== "local"),
16571
17193
  version: remoteUpdateParamsSchema.shape.version
16572
17194
  })
16573
17195
  ]);
@@ -16878,9 +17500,9 @@ var CodexCounters = class {
16878
17500
  }
16879
17501
  }
16880
17502
  #align(at, total, last) {
16881
- const active = this.#snapshotThread;
17503
+ const active2 = this.#snapshotThread;
16882
17504
  this.#snapshotThread = "";
16883
- 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))
16884
17506
  return;
16885
17507
  let offset = minus(this.#snapshotTotal, total);
16886
17508
  for (const c of this.#compactions.values()) {
@@ -17408,10 +18030,10 @@ async function readThreadNames(home, signal) {
17408
18030
  const names = /* @__PURE__ */ new Map();
17409
18031
  try {
17410
18032
  for await (const line of jsonlRecords(path.join(home, "session_index.jsonl"), '"thread_name"', signal)) {
17411
- const id = text(line.id);
18033
+ const id2 = text(line.id);
17412
18034
  const name = usageSessionTitle(line.thread_name);
17413
- if (id && name)
17414
- names.set(id, name);
18035
+ if (id2 && name)
18036
+ names.set(id2, name);
17415
18037
  }
17416
18038
  } catch (error51) {
17417
18039
  if (error51.code !== "ENOENT")
@@ -17549,9 +18171,9 @@ async function readCodexRollouts(files, thread2, signal, options = {}) {
17549
18171
  if (v.thread && v.thread !== thread2 || !v.thread && forkAt && v.at < forkAt)
17550
18172
  return [];
17551
18173
  const [input, output, cached2, written, reasoning] = v.usage.values;
17552
- 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")}`;
17553
18175
  const entry = parseHarnessUsageEntry({
17554
- id,
18176
+ id: id2,
17555
18177
  occurredAtMs: v.at,
17556
18178
  ...v.model ? { model: v.model } : {},
17557
18179
  inputTokens: input,
@@ -17608,15 +18230,15 @@ function createCodexUsageStatistics(environment, options = {}) {
17608
18230
  groups.clear();
17609
18231
  for (const [thread2, files] of found) {
17610
18232
  files.sort((a, b) => path.basename(a.file).localeCompare(path.basename(b.file)) || a.file.localeCompare(b.file));
17611
- const id = path.join(home, `usage-thread-${thread2}`);
17612
- groups.set(id, { thread: thread2, files });
17613
- 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) });
17614
18236
  }
17615
18237
  return result;
17616
18238
  },
17617
- async readSource(id, signal) {
18239
+ async readSource(id2, signal) {
17618
18240
  signal.throwIfAborted();
17619
- const group = groups.get(id);
18241
+ const group = groups.get(id2);
17620
18242
  if (!group)
17621
18243
  throw new Error("Unknown Codex usage source; list sources before reading");
17622
18244
  const kept = [];
@@ -17675,7 +18297,8 @@ var tokenFields = [
17675
18297
  var safeIntegerFields = [
17676
18298
  "planFiveHourResetsAtUnix",
17677
18299
  "planSevenDayResetsAtUnix",
17678
- "timeToFirstOutputMs"
18300
+ "timeToFirstOutputMs",
18301
+ "latestRequestTimeToFirstOutputMs"
17679
18302
  ];
17680
18303
  var percentFields = [
17681
18304
  "cacheHitRatePercent",
@@ -17986,8 +18609,8 @@ function createCodexSessionHistoryReader(environment) {
17986
18609
  onTokenCount: (info) => {
17987
18610
  snapshot = rolloutTokenSnapshot(info) ?? snapshot;
17988
18611
  },
17989
- onTurnId: (id) => {
17990
- turns.add(id);
18612
+ onTurnId: (id2) => {
18613
+ turns.add(id2);
17991
18614
  },
17992
18615
  onTurnTiming: (turnId, timeToFirstOutputMs, at) => {
17993
18616
  if (!lastTurnTiming || at >= lastTurnTiming.at)
@@ -18111,12 +18734,12 @@ var CodexResponseTiming = class {
18111
18734
  if (frame?.method === "error")
18112
18735
  return unavailable();
18113
18736
  if (frame?.method === "rawResponse/completed") {
18114
- const id = params.responseId;
18115
- if (typeof id !== "string" || !id)
18737
+ const id2 = params.responseId;
18738
+ if (typeof id2 !== "string" || !id2)
18116
18739
  return unavailable();
18117
- if (state.seen.has(id))
18740
+ if (state.seen.has(id2))
18118
18741
  return null;
18119
- state.seen.add(id);
18742
+ state.seen.add(id2);
18120
18743
  const usage2 = object2(params.usage);
18121
18744
  const startedAtMs = state.firstOutputAtMs;
18122
18745
  state.firstOutputAtMs = void 0;
@@ -18127,7 +18750,7 @@ var CodexResponseTiming = class {
18127
18750
  return {
18128
18751
  sessionId,
18129
18752
  requestTiming: {
18130
- requestId: id,
18753
+ requestId: id2,
18131
18754
  turnId: state.id,
18132
18755
  outputTokens: usage2.outputTokens,
18133
18756
  startedAtMs,
@@ -18267,7 +18890,7 @@ function createUsageStatisticsAdapter(context) {
18267
18890
  sessionUsage: createCodexSessionUsage(context.environment, abort.signal),
18268
18891
  usageStatistics: {
18269
18892
  listSources: (signal) => reader.listSources(AbortSignal.any([signal, abort.signal])),
18270
- readSource: (id, signal) => reader.readSource(id, AbortSignal.any([signal, abort.signal]))
18893
+ readSource: (id2, signal) => reader.readSource(id2, AbortSignal.any([signal, abort.signal]))
18271
18894
  },
18272
18895
  close: async () => {
18273
18896
  abort.abort();