@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
@@ -1262,8 +1262,8 @@ function cleanEnum(obj) {
1262
1262
  return Number.isNaN(Number.parseInt(k, 10));
1263
1263
  }).map((el) => el[1]);
1264
1264
  }
1265
- function base64ToUint8Array(base643) {
1266
- const binaryString = atob(base643);
1265
+ function base64ToUint8Array(base644) {
1266
+ const binaryString = atob(base644);
1267
1267
  const bytes = new Uint8Array(binaryString.length);
1268
1268
  for (let i = 0; i < binaryString.length; i++) {
1269
1269
  bytes[i] = binaryString.charCodeAt(i);
@@ -1278,9 +1278,9 @@ function uint8ArrayToBase64(bytes) {
1278
1278
  return btoa(binaryString);
1279
1279
  }
1280
1280
  function base64urlToUint8Array(base64url3) {
1281
- const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1282
- const padding = "=".repeat((4 - base643.length % 4) % 4);
1283
- return base64ToUint8Array(base643 + padding);
1281
+ const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1282
+ const padding = "=".repeat((4 - base644.length % 4) % 4);
1283
+ return base64ToUint8Array(base644 + padding);
1284
1284
  }
1285
1285
  function uint8ArrayToBase64url(bytes) {
1286
1286
  return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -2646,8 +2646,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2646
2646
  function isValidBase64URL(data) {
2647
2647
  if (!base64url.test(data))
2648
2648
  return false;
2649
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2650
- const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2649
+ const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2650
+ const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
2651
2651
  return isValidBase64(padded);
2652
2652
  }
2653
2653
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
@@ -3101,42 +3101,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3101
3101
  }
3102
3102
  doc.write(`const newResult = {};`);
3103
3103
  for (const key of normalized.keys) {
3104
- const id = ids[key];
3104
+ const id2 = ids[key];
3105
3105
  const k = esc(key);
3106
3106
  const schema = shape[key];
3107
3107
  const isOptionalIn = schema?._zod?.optin === "optional";
3108
3108
  const isOptionalOut = schema?._zod?.optout === "optional";
3109
- doc.write(`const ${id} = ${parseStr(key)};`);
3109
+ doc.write(`const ${id2} = ${parseStr(key)};`);
3110
3110
  if (isOptionalIn && isOptionalOut) {
3111
3111
  doc.write(`
3112
- if (${id}.issues.length) {
3112
+ if (${id2}.issues.length) {
3113
3113
  if (${k} in input) {
3114
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3114
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3115
3115
  ...iss,
3116
3116
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3117
3117
  })));
3118
3118
  }
3119
3119
  }
3120
3120
 
3121
- if (${id}.value === undefined) {
3121
+ if (${id2}.value === undefined) {
3122
3122
  if (${k} in input) {
3123
3123
  newResult[${k}] = undefined;
3124
3124
  }
3125
3125
  } else {
3126
- newResult[${k}] = ${id}.value;
3126
+ newResult[${k}] = ${id2}.value;
3127
3127
  }
3128
3128
 
3129
3129
  `);
3130
3130
  } else if (!isOptionalIn) {
3131
3131
  doc.write(`
3132
- const ${id}_present = ${k} in input;
3133
- if (${id}.issues.length) {
3134
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3132
+ const ${id2}_present = ${k} in input;
3133
+ if (${id2}.issues.length) {
3134
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3135
3135
  ...iss,
3136
3136
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3137
3137
  })));
3138
3138
  }
3139
- if (!${id}_present && !${id}.issues.length) {
3139
+ if (!${id2}_present && !${id2}.issues.length) {
3140
3140
  payload.issues.push({
3141
3141
  code: "invalid_type",
3142
3142
  expected: "nonoptional",
@@ -3145,30 +3145,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3145
3145
  });
3146
3146
  }
3147
3147
 
3148
- if (${id}_present) {
3149
- if (${id}.value === undefined) {
3148
+ if (${id2}_present) {
3149
+ if (${id2}.value === undefined) {
3150
3150
  newResult[${k}] = undefined;
3151
3151
  } else {
3152
- newResult[${k}] = ${id}.value;
3152
+ newResult[${k}] = ${id2}.value;
3153
3153
  }
3154
3154
  }
3155
3155
 
3156
3156
  `);
3157
3157
  } else {
3158
3158
  doc.write(`
3159
- if (${id}.issues.length) {
3160
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3159
+ if (${id2}.issues.length) {
3160
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3161
3161
  ...iss,
3162
3162
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3163
3163
  })));
3164
3164
  }
3165
3165
 
3166
- if (${id}.value === undefined) {
3166
+ if (${id2}.value === undefined) {
3167
3167
  if (${k} in input) {
3168
3168
  newResult[${k}] = undefined;
3169
3169
  }
3170
3170
  } else {
3171
- newResult[${k}] = ${id}.value;
3171
+ newResult[${k}] = ${id2}.value;
3172
3172
  }
3173
3173
 
3174
3174
  `);
@@ -11500,26 +11500,26 @@ function extractDefs(ctx, schema) {
11500
11500
  throw new Error("Unprocessed schema. This is a bug in Zod.");
11501
11501
  const idToSchema = /* @__PURE__ */ new Map();
11502
11502
  for (const entry of ctx.seen.entries()) {
11503
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11504
- if (id) {
11505
- const existing = idToSchema.get(id);
11503
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11504
+ if (id2) {
11505
+ const existing = idToSchema.get(id2);
11506
11506
  if (existing && existing !== entry[0]) {
11507
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11507
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11508
11508
  }
11509
- idToSchema.set(id, entry[0]);
11509
+ idToSchema.set(id2, entry[0]);
11510
11510
  }
11511
11511
  }
11512
11512
  const makeURI = (entry) => {
11513
11513
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
11514
11514
  if (ctx.external) {
11515
11515
  const externalId = ctx.external.registry.get(entry[0])?.id;
11516
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
11516
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
11517
11517
  if (externalId) {
11518
11518
  return { ref: uriGenerator(externalId) };
11519
11519
  }
11520
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11521
- entry[1].defId = id;
11522
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
11520
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11521
+ entry[1].defId = id2;
11522
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
11523
11523
  }
11524
11524
  if (entry[1] === root) {
11525
11525
  return { ref: "#" };
@@ -11567,8 +11567,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11567
11567
  continue;
11568
11568
  }
11569
11569
  }
11570
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11571
- if (id) {
11570
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11571
+ if (id2) {
11572
11572
  extractToDef(entry);
11573
11573
  continue;
11574
11574
  }
@@ -11664,10 +11664,10 @@ function finalize(ctx, schema) {
11664
11664
  } else {
11665
11665
  }
11666
11666
  if (ctx.external?.uri) {
11667
- const id = ctx.external.registry.get(schema)?.id;
11668
- if (!id)
11667
+ const id2 = ctx.external.registry.get(schema)?.id;
11668
+ if (!id2)
11669
11669
  throw new Error("Schema is missing an `id` property");
11670
- result.$id = ctx.external.uri(id);
11670
+ result.$id = ctx.external.uri(id2);
11671
11671
  }
11672
11672
  Object.assign(result, root.def ?? root.schema);
11673
11673
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -11827,9 +11827,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
11827
11827
  json2.type = "number";
11828
11828
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
11829
11829
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
11830
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
11830
+ const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
11831
11831
  if (exMin) {
11832
- if (legacy) {
11832
+ if (legacy2) {
11833
11833
  json2.minimum = exclusiveMinimum;
11834
11834
  json2.exclusiveMinimum = true;
11835
11835
  } else {
@@ -11839,7 +11839,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
11839
11839
  json2.minimum = minimum;
11840
11840
  }
11841
11841
  if (exMax) {
11842
- if (legacy) {
11842
+ if (legacy2) {
11843
11843
  json2.maximum = exclusiveMaximum;
11844
11844
  json2.exclusiveMaximum = true;
11845
11845
  } else {
@@ -12701,7 +12701,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
12701
12701
 
12702
12702
  // ../../../node_modules/zod/v4/classic/schemas.js
12703
12703
  var _installedGroups = /* @__PURE__ */ new WeakMap();
12704
- function _installLazyMethods(inst, group, methods2) {
12704
+ function _installLazyMethods(inst, group, methods3) {
12705
12705
  const proto = Object.getPrototypeOf(inst);
12706
12706
  let installed = _installedGroups.get(proto);
12707
12707
  if (!installed) {
@@ -12711,8 +12711,8 @@ function _installLazyMethods(inst, group, methods2) {
12711
12711
  if (installed.has(group))
12712
12712
  return;
12713
12713
  installed.add(group);
12714
- for (const key in methods2) {
12715
- const fn = methods2[key];
12714
+ for (const key in methods3) {
12715
+ const fn = methods3[key];
12716
12716
  Object.defineProperty(proto, key, {
12717
12717
  configurable: true,
12718
12718
  enumerable: false,
@@ -14656,6 +14656,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
14656
14656
  permissionModeId: harnessPermissionModeIdSchema
14657
14657
  }).strict();
14658
14658
 
14659
+ // ../../shared-contracts/dist/harness-route-limit.js
14660
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
14661
+
14659
14662
  // ../../shared-contracts/dist/thread-usage.js
14660
14663
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14661
14664
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14688,7 +14691,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
14688
14691
  expiresAtUnix: nonNegativeSafeIntegerSchema,
14689
14692
  label: indicatorTextSchema(256).optional(),
14690
14693
  tooltip: indicatorTextSchema(1024).optional()
14691
- }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
14694
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
14692
14695
  message: "Composer indicator IDs must be unique"
14693
14696
  });
14694
14697
  var threadUsageSnapshotSchema = external_exports.object({
@@ -14714,6 +14717,7 @@ var threadUsageSnapshotSchema = external_exports.object({
14714
14717
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
14715
14718
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
14716
14719
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
14720
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
14717
14721
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
14718
14722
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
14719
14723
  }).strict().superRefine((usage, context) => {
@@ -14811,6 +14815,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
14811
14815
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14812
14816
  resetCredits: accountResetCreditsSchema.optional()
14813
14817
  }).strict();
14818
+ var accountBalanceSnapshotSchema = external_exports.object({
14819
+ amount: external_exports.number().finite().nonnegative(),
14820
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14821
+ currency: external_exports.string().trim().min(1).max(8),
14822
+ /** Native label when the Harness exposes several Billing Sources. */
14823
+ label: external_exports.string().trim().min(1).max(128).optional()
14824
+ }).strict();
14814
14825
  var threadUsageInspectionParamsSchema = external_exports.object({
14815
14826
  threadId: hostThreadIdSchema,
14816
14827
  refresh: external_exports.literal("exact").optional()
@@ -14819,7 +14830,10 @@ var threadUsageInspectionSchema = external_exports.object({
14819
14830
  threadId: hostThreadIdSchema,
14820
14831
  usage: threadUsageSnapshotSchema.nullable(),
14821
14832
  accountCredits: accountCreditsSnapshotSchema.optional(),
14822
- /** Whether this source can provide cached account quota independently of usage. */
14833
+ /** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
14834
+ accountBalance: accountBalanceSnapshotSchema.optional(),
14835
+ /** Whether this source can provide cached account quota (credits or a prepaid balance)
14836
+ * independently of usage. */
14823
14837
  accountCreditsSupported: external_exports.boolean().optional()
14824
14838
  }).strict();
14825
14839
 
@@ -14831,10 +14845,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
14831
14845
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
14832
14846
  message: "Value must not be empty or whitespace"
14833
14847
  });
14834
- var harnessModelRefIdSchema = nonBlankTextSchema2.max(HARNESS_MODEL_REF_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Model Ref must use transport-safe opaque characters").brand();
14848
+ 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();
14849
+ var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
14835
14850
  var harnessModelRefSchema = external_exports.object({
14836
- id: harnessModelRefIdSchema
14851
+ id: harnessModelRefIdSchema,
14852
+ serviceTier: harnessModelServiceTierSchema.optional()
14837
14853
  }).strict();
14854
+ function sameHarnessModelRef(left, right) {
14855
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
14856
+ }
14838
14857
  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();
14839
14858
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
14840
14859
  var harnessThinkingOptionSchema = external_exports.object({
@@ -14848,7 +14867,15 @@ var harnessModelSchema = external_exports.object({
14848
14867
  /** Optional opaque selection for this same Model with priority processing enabled. */
14849
14868
  fastModel: harnessModelRefSchema.optional(),
14850
14869
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14851
- }).strict();
14870
+ }).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
14871
+ path: ["fastModel", "id"],
14872
+ message: "A tiered Fast Model must share the base Model ID"
14873
+ });
14874
+ function catalogModelForRef(catalog, ref) {
14875
+ if (!ref)
14876
+ return void 0;
14877
+ return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
14878
+ }
14852
14879
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
14853
14880
  const ids = /* @__PURE__ */ new Set();
14854
14881
  for (const [index, option] of options.entries()) {
@@ -14868,26 +14895,26 @@ var harnessModelCatalogSchema = external_exports.object({
14868
14895
  thinkingOptions: harnessThinkingOptionsSchema,
14869
14896
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
14870
14897
  }).strict().superRefine((catalog, context) => {
14871
- const refs = /* @__PURE__ */ new Set();
14872
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
14898
+ const refs = [];
14899
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
14873
14900
  for (const [index, model2] of catalog.models.entries()) {
14874
- if (refs.has(model2.ref.id)) {
14901
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
14875
14902
  context.addIssue({
14876
14903
  code: "custom",
14877
14904
  message: "Model Catalog refs must be unique",
14878
14905
  path: ["models", index, "ref", "id"]
14879
14906
  });
14880
14907
  }
14881
- refs.add(model2.ref.id);
14908
+ refs.push(model2.ref);
14882
14909
  if (model2.fastModel) {
14883
- if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
14910
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
14884
14911
  context.addIssue({
14885
14912
  code: "custom",
14886
14913
  message: "Fast Model refs must be distinct and unique",
14887
14914
  path: ["models", index, "fastModel"]
14888
14915
  });
14889
14916
  }
14890
- refs.add(model2.fastModel.id);
14917
+ refs.push(model2.fastModel);
14891
14918
  }
14892
14919
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14893
14920
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -14908,7 +14935,7 @@ var harnessModelCatalogSchema = external_exports.object({
14908
14935
  }
14909
14936
  }
14910
14937
  }
14911
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
14938
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
14912
14939
  context.addIssue({
14913
14940
  code: "custom",
14914
14941
  message: "Default Model must exist in the Model Catalog",
@@ -14948,7 +14975,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
14948
14975
  observe: external_exports.boolean()
14949
14976
  }).strict().optional(),
14950
14977
  /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
14951
- steer: external_exports.boolean().optional()
14978
+ steer: external_exports.boolean().optional(),
14979
+ /**
14980
+ * True when the native plan (task list) outlives the Turn that changed it, so a reopened
14981
+ * Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
14982
+ */
14983
+ persistentPlan: external_exports.boolean().optional()
14952
14984
  }).strict();
14953
14985
  var harnessConfigurationStateSchema = external_exports.object({
14954
14986
  effectiveModel: harnessModelRefSchema.optional(),
@@ -14957,7 +14989,7 @@ var harnessConfigurationStateSchema = external_exports.object({
14957
14989
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
14958
14990
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
14959
14991
  }).strict().superRefine((state, context) => {
14960
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
14992
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
14961
14993
  context.addIssue({
14962
14994
  code: "custom",
14963
14995
  message: "Effective Thinking option must be currently available",
@@ -14997,7 +15029,8 @@ var harnessInspectParamsSchema = external_exports.object({
14997
15029
  cwd: nonBlankTextSchema2.max(16384).optional(),
14998
15030
  refresh: external_exports.boolean().optional(),
14999
15031
  /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15000
- purpose: external_exports.literal("availability").optional()
15032
+ purpose: external_exports.literal("availability").optional(),
15033
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
15001
15034
  }).strict();
15002
15035
  var harnessWebUiOpenParamsSchema = external_exports.object({
15003
15036
  harnessId: harnessIdSchema
@@ -15028,7 +15061,7 @@ var codexThreadInspectionSchema = external_exports.object({
15028
15061
  var externalThreadInspectionSchema = external_exports.object({
15029
15062
  owner: external_exports.literal("external"),
15030
15063
  harnessId: nonBlankTextSchema2.max(256),
15031
- transportModelId: nonBlankTextSchema2.max(1024),
15064
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
15032
15065
  effectiveModel: harnessModelRefSchema.optional(),
15033
15066
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15034
15067
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15110,13 +15143,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
15110
15143
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15111
15144
  }).strict();
15112
15145
 
15146
+ // ../../shared-contracts/dist/harness-plugins.js
15147
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15148
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15149
+ var HARNESS_PLUGIN_LIMIT = 128;
15150
+ var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
15151
+ var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
15152
+ var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
15153
+ 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");
15154
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15155
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15156
+ var harnessInstallationGuideSchema = external_exports.object({
15157
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15158
+ before: localizedTextSchema.optional(),
15159
+ after: localizedTextSchema.optional(),
15160
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15161
+ }).strict();
15162
+ var pluginPresentationShape = {
15163
+ id: installedHarnessPluginIdSchema,
15164
+ name: external_exports.string().trim().min(1).max(128),
15165
+ version: external_exports.string().min(1).max(128),
15166
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15167
+ kind: external_exports.literal("usage").optional(),
15168
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15169
+ iconStyle: external_exports.object({
15170
+ vector: external_exports.object({
15171
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15172
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15173
+ paths: external_exports.array(external_exports.object({
15174
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15175
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15176
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15177
+ }).strict()).min(1).max(32)
15178
+ }).strict().optional(),
15179
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15180
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15181
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15182
+ }).strict().optional(),
15183
+ installation: harnessInstallationGuideSchema.optional(),
15184
+ notice: localizedTextSchema.optional(),
15185
+ /** The factory accepts a persisted local entrypoint through its construction context. */
15186
+ launchCommand: external_exports.literal(true).optional(),
15187
+ links: external_exports.object({
15188
+ website: documentationUrlSchema.optional(),
15189
+ documentation: documentationUrlSchema.optional(),
15190
+ installation: documentationUrlSchema.optional()
15191
+ }).strict().optional()
15192
+ };
15193
+ var harnessPluginManifestSchema = external_exports.object({
15194
+ manifestVersion: external_exports.literal(1),
15195
+ ...pluginPresentationShape,
15196
+ adapterApiVersion: external_exports.number().int().positive(),
15197
+ entry: pluginRelativeResourceSchema,
15198
+ icon: pluginRelativeResourceSchema.optional()
15199
+ }).strict();
15200
+ 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);
15201
+ var harnessPluginDescriptorSchema = external_exports.object({
15202
+ ...pluginPresentationShape,
15203
+ icon: harnessPluginIconSchema.optional()
15204
+ }).strict();
15205
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
15206
+ var harnessPluginListResultSchema = external_exports.object({
15207
+ plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
15208
+ }).strict();
15209
+ var harnessPluginConfigurationSchema = external_exports.object({
15210
+ version: external_exports.literal(1),
15211
+ enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15212
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15213
+ message: "Enabled plugin IDs must be unique",
15214
+ path: ["enabled"]
15215
+ });
15216
+
15217
+ // ../../shared-contracts/dist/desktop-extensions.js
15218
+ var DESKTOP_EXTENSION_API_VERSION = 1;
15219
+ var DESKTOP_EXTENSION_LIMIT = 64;
15220
+ var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
15221
+ var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
15222
+ var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
15223
+ var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
15224
+ var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
15225
+ var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
15226
+ var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
15227
+ var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
15228
+ var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
15229
+ var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
15230
+ var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
15231
+ var desktopExtensionIdSchema = installedPluginIdSchema;
15232
+ var desktopExtensionSlotSchema = external_exports.enum([
15233
+ "sidebar.thread-layout",
15234
+ "sidebar.thread-badge",
15235
+ "appearance.theme"
15236
+ ]);
15237
+ var desktopExtensionCategorySchema = external_exports.enum([
15238
+ "appearance",
15239
+ "interface",
15240
+ "workflow",
15241
+ "analytics",
15242
+ "integrations",
15243
+ "tools"
15244
+ ]);
15245
+ var extensionName = external_exports.string().trim().min(1).max(128);
15246
+ function desktopExtensionScreenshotMimeType(resource) {
15247
+ switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15248
+ case "png":
15249
+ return "image/png";
15250
+ case "jpg":
15251
+ case "jpeg":
15252
+ return "image/jpeg";
15253
+ case "webp":
15254
+ return "image/webp";
15255
+ default:
15256
+ return void 0;
15257
+ }
15258
+ }
15259
+ var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
15260
+ 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");
15261
+ 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) => {
15262
+ const { username, password } = new URL(value);
15263
+ return !username && !password && !/[\\\s]/u.test(value);
15264
+ }, "URL must not contain credentials, backslashes, or whitespace");
15265
+ function localizedText(text) {
15266
+ return external_exports.strictObject({ en: text, "zh-CN": text });
15267
+ }
15268
+ var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15269
+ var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
15270
+ var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
15271
+ var settingField = {
15272
+ key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
15273
+ label: desktopExtensionLocalizedTextSchema,
15274
+ description: desktopExtensionLocalizedTextSchema.optional()
15275
+ };
15276
+ var numericSetting = {
15277
+ ...settingField,
15278
+ step: external_exports.number().positive().optional(),
15279
+ default: external_exports.number().optional()
15280
+ };
15281
+ var settingOption = external_exports.strictObject({
15282
+ value: external_exports.string(),
15283
+ label: desktopExtensionLocalizedTextSchema
15284
+ });
15285
+ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
15286
+ external_exports.strictObject({
15287
+ ...settingField,
15288
+ type: external_exports.literal("boolean"),
15289
+ default: external_exports.boolean().optional()
15290
+ }),
15291
+ external_exports.strictObject({
15292
+ ...settingField,
15293
+ type: external_exports.literal("string"),
15294
+ placeholder: desktopExtensionLocalizedTextSchema.optional(),
15295
+ default: external_exports.string().optional()
15296
+ }),
15297
+ external_exports.strictObject({
15298
+ ...numericSetting,
15299
+ type: external_exports.literal("number"),
15300
+ min: external_exports.number().optional(),
15301
+ max: external_exports.number().optional()
15302
+ }),
15303
+ external_exports.strictObject({
15304
+ ...numericSetting,
15305
+ type: external_exports.literal("range"),
15306
+ min: external_exports.number(),
15307
+ max: external_exports.number()
15308
+ }),
15309
+ external_exports.strictObject({
15310
+ ...settingField,
15311
+ type: external_exports.literal("select"),
15312
+ options: external_exports.array(settingOption).min(1),
15313
+ default: external_exports.string().optional()
15314
+ })
15315
+ ]).superRefine((field2, ctx) => {
15316
+ const issue2 = (path6, message) => ctx.addIssue({ code: "custom", path: [path6], message });
15317
+ if (field2.type === "number" || field2.type === "range") {
15318
+ const { min = -Infinity, max = Infinity, default: value } = field2;
15319
+ if (min > max)
15320
+ issue2("max", "Must be at least min");
15321
+ if (value !== void 0 && (value < min || value > max))
15322
+ issue2("default", "Must be within min and max");
15323
+ } else if (field2.type === "select") {
15324
+ const values = new Set(field2.options.map(({ value }) => value));
15325
+ if (values.size !== field2.options.length)
15326
+ issue2("options", "Duplicate option values");
15327
+ if (field2.default !== void 0 && !values.has(field2.default))
15328
+ issue2("default", "Must match an option value");
15329
+ }
15330
+ });
15331
+ var manifestHeader = external_exports.object({
15332
+ manifestVersion: external_exports.int().positive(),
15333
+ id: desktopExtensionIdSchema,
15334
+ name: external_exports.union([extensionName, localizedText(extensionName)]),
15335
+ version: external_exports.string().min(1).max(128),
15336
+ desktopApi: external_exports.int().positive()
15337
+ }).passthrough();
15338
+ var desktopExtensionManifestSchema = manifestHeader.extend({
15339
+ manifestVersion: external_exports.literal(1),
15340
+ desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
15341
+ description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
15342
+ author: external_exports.string().trim().min(1).max(128).optional(),
15343
+ repository: desktopExtensionHttpUrlSchema.optional(),
15344
+ details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
15345
+ icon: imagePathSchema.optional(),
15346
+ screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
15347
+ desktop: external_exports.strictObject({
15348
+ script: pluginRelativeResourceSchema,
15349
+ style: pluginRelativeResourceSchema.optional()
15350
+ }).optional(),
15351
+ backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
15352
+ slots: slotsSchema.default(() => []),
15353
+ settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
15354
+ categories: categoriesSchema.optional()
15355
+ }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
15356
+ var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
15357
+ var desktopExtensionStatusSchema = external_exports.strictObject({
15358
+ state: external_exports.enum([
15359
+ "running",
15360
+ "disabled",
15361
+ "invalid",
15362
+ "incompatible",
15363
+ "conflict",
15364
+ "failed",
15365
+ "waiting"
15366
+ ]),
15367
+ hash: desktopExtensionHashSchema.optional(),
15368
+ error: external_exports.string().optional(),
15369
+ conflictWith: desktopExtensionIdSchema.optional()
15370
+ });
15371
+ var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
15372
+ controllerPid: external_exports.int().positive(),
15373
+ targetId: external_exports.string().nullable(),
15374
+ updatedAt: external_exports.iso.datetime(),
15375
+ handledReloadToken: external_exports.uuid().optional(),
15376
+ extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
15377
+ surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
15378
+ });
15379
+ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
15380
+ function isGitHubDesktopExtensionZipballUrl(url2) {
15381
+ return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15382
+ }
15383
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15384
+ const url2 = new URL(input);
15385
+ 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);
15386
+ }, "Expected a .zip download URL or a GitHub zipball URL");
15387
+ var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
15388
+ id: desktopExtensionIdSchema,
15389
+ version: external_exports.string().trim().min(1).max(128),
15390
+ name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
15391
+ description: localizedText(external_exports.string().trim().min(1).max(4096)),
15392
+ details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
15393
+ author: external_exports.string().trim().min(1).max(128),
15394
+ repository: desktopExtensionHttpUrlSchema,
15395
+ stars: external_exports.number().int().min(0).optional(),
15396
+ downloads: external_exports.number().int().min(0).optional(),
15397
+ categories: categoriesSchema.optional(),
15398
+ trustTier: desktopExtensionTrustTierSchema.default("community"),
15399
+ icon: desktopExtensionHttpUrlSchema.optional(),
15400
+ screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15401
+ downloadUrl: desktopExtensionZipUrlSchema,
15402
+ sha256: desktopExtensionHashSchema,
15403
+ slots: slotsSchema.optional(),
15404
+ publishedAt: external_exports.string().optional(),
15405
+ updatedAt: external_exports.string().optional(),
15406
+ minCodexHostVersion: external_exports.string().optional()
15407
+ });
15408
+ var desktopExtensionCatalogSchema = external_exports.strictObject({
15409
+ schemaVersion: external_exports.literal(1),
15410
+ generatedAt: external_exports.string(),
15411
+ extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15412
+ });
15413
+ var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
15414
+
15415
+ // ../../shared-contracts/dist/host-extensions.js
15416
+ var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
15417
+ var HOST_EXTENSION_PAGE_API_VERSION = 1;
15418
+ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
15419
+ var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
15420
+ var hostExtensionDigestSchema = desktopExtensionHashSchema;
15421
+ var hostExtensionActivationIdSchema = external_exports.uuid();
15422
+ 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((path6) => path6.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
15423
+ var legacy = desktopExtensionManifestSchema.shape;
15424
+ var localized = (max, min = 0) => external_exports.strictObject({
15425
+ en: external_exports.string().trim().min(min).max(max),
15426
+ "zh-CN": external_exports.string().trim().min(min).max(max)
15427
+ });
15428
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path6) => path6.endsWith(suffix), `Expected a ${suffix} file`);
15429
+ var moduleEntry = resourceWithSuffix(".mjs");
15430
+ var style = resourceWithSuffix(".css").optional();
15431
+ var hostExtensionCanonicalPath = (path6) => path6.normalize("NFC").toLowerCase();
15432
+ var hostExtensionManifestV2Schema = external_exports.strictObject({
15433
+ manifestVersion: external_exports.literal(2),
15434
+ id: hostExtensionIdSchema,
15435
+ name: localized(128, 1),
15436
+ version: external_exports.string().trim().min(1).max(128),
15437
+ description: localized(4096),
15438
+ details: localized(16384).optional(),
15439
+ author: legacy.author,
15440
+ repository: legacy.repository,
15441
+ icon: legacy.icon.refine((path6) => path6 === void 0 || hostExtensionResourcePathSchema.safeParse(path6).success),
15442
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path6) => hostExtensionResourcePathSchema.safeParse(path6).success)),
15443
+ categories: legacy.categories,
15444
+ settingsSchema: legacy.settingsSchema,
15445
+ slots: legacy.slots.removeDefault().optional(),
15446
+ page: external_exports.strictObject({
15447
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15448
+ entry: moduleEntry,
15449
+ style,
15450
+ title: localized(128, 1).optional()
15451
+ }).optional(),
15452
+ widget: external_exports.strictObject({
15453
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15454
+ entry: moduleEntry,
15455
+ style
15456
+ }).optional(),
15457
+ desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
15458
+ 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(),
15459
+ backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
15460
+ }).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" });
15461
+ function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
15462
+ if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
15463
+ return ["desktop", "web"];
15464
+ const targets = [];
15465
+ if (hasDesktop)
15466
+ targets.push("desktop");
15467
+ if (hasWeb)
15468
+ targets.push("web");
15469
+ return targets;
15470
+ }
15471
+ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
15472
+
15473
+ // ../../shared-contracts/dist/host-extension-management.js
15474
+ var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
15475
+ var hostExtensionRevisionSchema = external_exports.int().nonnegative();
15476
+ var hostExtensionConfigurationSchema = external_exports.strictObject({
15477
+ revision: hostExtensionRevisionSchema,
15478
+ enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
15479
+ });
15480
+ var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
15481
+ var hostExtensionCatalogEntrySchema = external_exports.object({
15482
+ ...catalogMetadata,
15483
+ id: hostExtensionIdSchema,
15484
+ format: external_exports.literal("codexhost"),
15485
+ targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
15486
+ apis: external_exports.strictObject({
15487
+ page: external_exports.int().positive().optional(),
15488
+ widget: external_exports.int().positive().optional(),
15489
+ desktop: external_exports.int().positive().optional(),
15490
+ web: external_exports.int().positive().optional(),
15491
+ backend: external_exports.int().positive().optional()
15492
+ }),
15493
+ downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
15494
+ }).refine(({ targets, apis }) => {
15495
+ const derived = targetsForCapabilities({
15496
+ hasPage: Boolean(apis.page),
15497
+ hasWidget: Boolean(apis.widget),
15498
+ hasDesktop: Boolean(apis.desktop),
15499
+ hasWeb: Boolean(apis.web),
15500
+ hasBackend: Boolean(apis.backend)
15501
+ });
15502
+ return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
15503
+ }, "Catalog targets must match the declared APIs");
15504
+ var hostExtensionCatalogSchema = external_exports.object({
15505
+ schemaVersion: external_exports.literal(2),
15506
+ generatedAt: external_exports.string().min(1),
15507
+ extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15508
+ });
15509
+ var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
15510
+ catalogUrl: desktopExtensionHttpUrlSchema,
15511
+ fetchedAt: external_exports.iso.datetime(),
15512
+ cached: external_exports.boolean()
15513
+ });
15514
+ var id = { id: hostExtensionIdSchema };
15515
+ var active = {
15516
+ ...id,
15517
+ activationId: hostExtensionActivationIdSchema,
15518
+ digest: hostExtensionDigestSchema
15519
+ };
15520
+ var optionalActivation = { ...id, activationId: active.activationId.optional() };
15521
+ var filePath = external_exports.string().min(1).max(4096).refine((path6) => /^(?:\/|[a-z]:[/\\])/iu.test(path6) && !path6.includes("\0") && !path6.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
15522
+ 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");
15523
+ function base643(maxBytes) {
15524
+ return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
15525
+ const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
15526
+ return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
15527
+ }, "Expected bounded standard padded base64");
15528
+ }
15529
+ var hostExtensionGitHubSourceSchema = external_exports.strictObject({
15530
+ type: external_exports.literal("github"),
15531
+ repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
15532
+ ref: gitRef.optional(),
15533
+ tag: gitRef.optional(),
15534
+ asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
15535
+ subpath: hostExtensionResourcePathSchema.optional()
15536
+ }).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
15537
+ var hostExtensionInstallSourceSchema = external_exports.union([
15538
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15539
+ hostExtensionGitHubSourceSchema,
15540
+ external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
15541
+ external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
15542
+ external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
15543
+ ]);
15544
+ var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
15545
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15546
+ hostExtensionGitHubSourceSchema,
15547
+ external_exports.strictObject({ type: external_exports.literal("zip") }),
15548
+ external_exports.strictObject({ type: external_exports.literal("localDir") })
15549
+ ]);
15550
+ var hostExtensionInstallationSchema = external_exports.strictObject({
15551
+ ...active,
15552
+ manifest: hostExtensionManifestV2Schema,
15553
+ installedAt: external_exports.iso.datetime(),
15554
+ source: hostExtensionProvenanceSchema.optional()
15555
+ });
15556
+ 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);
15557
+ var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
15558
+ var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
15559
+ var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
15560
+ hostExtensionInstallationSchema.extend({
15561
+ state: external_exports.literal("valid"),
15562
+ enabled: external_exports.boolean(),
15563
+ ...desktopConflict,
15564
+ iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
15565
+ screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15566
+ backendState: backendState.optional(),
15567
+ backendError: external_exports.string().optional()
15568
+ }),
15569
+ external_exports.strictObject({
15570
+ state: external_exports.enum(["invalid", "incompatible"]),
15571
+ id: external_exports.string().min(1),
15572
+ enabled: external_exports.boolean(),
15573
+ error: external_exports.string()
15574
+ })
15575
+ ]);
15576
+ var hostExtensionsListResultSchema = external_exports.strictObject({
15577
+ revision: hostExtensionRevisionSchema,
15578
+ configuration: hostExtensionConfigurationSchema,
15579
+ diagnostics: external_exports.array(external_exports.string()),
15580
+ extensions: external_exports.array(hostExtensionListItemSchema)
15581
+ });
15582
+ var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
15583
+ ...desktopConflict,
15584
+ settingsRevision: hostExtensionRevisionSchema
15585
+ });
15586
+ var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
15587
+ /** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
15588
+ revision: hostExtensionRevisionSchema,
15589
+ // Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
15590
+ extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
15591
+ });
15592
+ var HOST_EXTENSIONS_RPC = {
15593
+ list: "codexhost/extensions/list",
15594
+ snapshot: "codexhost/extensions/snapshot",
15595
+ catalog: "codexhost/extensions/catalog",
15596
+ install: "codexhost/extensions/install",
15597
+ update: "codexhost/extensions/update",
15598
+ enable: "codexhost/extensions/enable",
15599
+ disable: "codexhost/extensions/disable",
15600
+ uninstall: "codexhost/extensions/uninstall",
15601
+ recover: "codexhost/extensions/recover",
15602
+ asset: "codexhost/extensions/asset",
15603
+ settingsGet: "codexhost/extensions/settings/get",
15604
+ settingsSet: "codexhost/extensions/settings/set",
15605
+ backendInvoke: "codexhost/extensions/backend/invoke"
15606
+ };
15607
+ var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
15608
+ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
15609
+ var noParams = external_exports.strictObject({});
15610
+ var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
15611
+ var selection = external_exports.strictObject({ ...id, ...expectedRevision });
15612
+ var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
15613
+ var mutationResult = external_exports.discriminatedUnion("state", [
15614
+ external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
15615
+ external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
15616
+ ]);
15617
+ var hostExtensionsAssetParamsSchema = external_exports.strictObject({
15618
+ ...optionalActivation,
15619
+ digest: active.digest.optional(),
15620
+ path: hostExtensionResourcePathSchema
15621
+ });
15622
+ var hostExtensionsAssetResultSchema = external_exports.strictObject({
15623
+ mimeType: external_exports.string().min(1),
15624
+ base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
15625
+ digest: active.digest
15626
+ });
15627
+ var hostExtensionSettingsSchema = external_exports.strictObject({
15628
+ settingsRevision: hostExtensionRevisionSchema,
15629
+ values: jsonObjectSchema
15630
+ });
15631
+ var hostExtensionsRpcSchemas = {
15632
+ [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
15633
+ [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
15634
+ [HOST_EXTENSIONS_RPC.catalog]: {
15635
+ params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
15636
+ result: hostExtensionsCatalogResultSchema
15637
+ },
15638
+ [HOST_EXTENSIONS_RPC.install]: {
15639
+ params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
15640
+ result: installationResult
15641
+ },
15642
+ [HOST_EXTENSIONS_RPC.update]: {
15643
+ params: external_exports.strictObject({
15644
+ ...id,
15645
+ expectedDigest: active.digest,
15646
+ expectedActivationId: active.activationId.optional(),
15647
+ source: hostExtensionInstallSourceSchema.optional()
15648
+ }),
15649
+ result: installationResult
15650
+ },
15651
+ [HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
15652
+ [HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
15653
+ [HOST_EXTENSIONS_RPC.uninstall]: {
15654
+ params: external_exports.strictObject({
15655
+ ...id,
15656
+ removeData: external_exports.boolean().optional(),
15657
+ expectedDigest: active.digest.optional()
15658
+ }),
15659
+ result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
15660
+ },
15661
+ [HOST_EXTENSIONS_RPC.recover]: {
15662
+ params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
15663
+ result: mutationResult
15664
+ },
15665
+ [HOST_EXTENSIONS_RPC.asset]: {
15666
+ params: hostExtensionsAssetParamsSchema,
15667
+ result: hostExtensionsAssetResultSchema
15668
+ },
15669
+ [HOST_EXTENSIONS_RPC.settingsGet]: {
15670
+ params: external_exports.strictObject(optionalActivation),
15671
+ result: hostExtensionSettingsSchema
15672
+ },
15673
+ [HOST_EXTENSIONS_RPC.settingsSet]: {
15674
+ params: external_exports.strictObject({
15675
+ ...optionalActivation,
15676
+ expectedSettingsRevision: hostExtensionRevisionSchema,
15677
+ values: jsonObjectSchema
15678
+ }),
15679
+ result: hostExtensionSettingsSchema
15680
+ },
15681
+ [HOST_EXTENSIONS_RPC.backendInvoke]: {
15682
+ params: external_exports.strictObject({
15683
+ ...optionalActivation,
15684
+ method: hostExtensionBackendMethodSchema,
15685
+ params: jsonValueSchema.optional()
15686
+ }),
15687
+ result: external_exports.strictObject({ result: jsonValueSchema })
15688
+ }
15689
+ };
15690
+
15113
15691
  // ../../shared-contracts/dist/thread-archive-confirm.js
15692
+ var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
15114
15693
  var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15115
15694
  var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15116
15695
 
15117
15696
  // ../../shared-contracts/dist/client-channel.js
15118
15697
  var CLIENT_CHANNEL_VERSION = 1;
15119
15698
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15699
+ var CLIENT_CHANNEL_METHODS = [
15700
+ "codexhost/skills/list",
15701
+ "codexhost/voice/status",
15702
+ "codexhost/voice/transcribe",
15703
+ "codexhost/harness/display-settings/get",
15704
+ "codexhost/harness/display-settings/set",
15705
+ "codexhost/harness/display-settings/capabilities",
15706
+ "codexhost/harness/preferences/get",
15707
+ "codexhost/harness/preferences/patch",
15708
+ "thread/list",
15709
+ "codexhost/thread/catalog/read",
15710
+ "thread/read",
15711
+ "thread/resume",
15712
+ "thread/fork",
15713
+ "thread/turns/list",
15714
+ "thread/revert",
15715
+ "thread/items/list",
15716
+ "thread/start",
15717
+ "thread/name/set",
15718
+ "codexhost/thread/title/generate",
15719
+ "thread/archive",
15720
+ THREAD_ARCHIVE_CONFIRM_METHOD,
15721
+ "thread/unarchive",
15722
+ "turn/start",
15723
+ "turn/interrupt",
15724
+ "turn/steer",
15725
+ "thread/queue/list",
15726
+ "thread/queue/add",
15727
+ "thread/queue/update",
15728
+ "thread/queue/delete",
15729
+ "thread/queue/reorder",
15730
+ "thread/queue/start",
15731
+ "codexhost/thread/queue/send-now",
15732
+ "codexhost/workspace/read",
15733
+ "codexhost/thread/tree/read",
15734
+ "codexhost/thread/pins/list",
15735
+ "codexhost/thread/pins/set",
15736
+ "codexhost/harness/plugins/list",
15737
+ "codexhost/harness/inspect",
15738
+ "codexhost/thread/inspect",
15739
+ "codexhost/thread/usage/inspect",
15740
+ "codexhost/thread/ownership/list",
15741
+ "codexhost/thread/model/select",
15742
+ "codexhost/thread/thinking/select",
15743
+ "codexhost/thread/permission-mode/select",
15744
+ "codexhost/thread/commands/inspect",
15745
+ "codexhost/harness/commands/inspect",
15746
+ "codexhost/thread/command/execute",
15747
+ "codexhost/thread/fork",
15748
+ "codexhost/harness/session-import/sources",
15749
+ "codexhost/harness/session-import/list",
15750
+ "codexhost/harness/session-import/import",
15751
+ // Host settings shared across Desktop and Web.
15752
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
15753
+ "codexhost/harness/installation",
15754
+ "codexhost/harness/installation/start",
15755
+ "codexhost/harness/installation/status",
15756
+ "codexhost/harness/launch-settings/get",
15757
+ "codexhost/harness/launch-settings/set",
15758
+ "codexhost/harness/web-ui/open",
15759
+ "codexhost/harness/accounts/sources",
15760
+ "codexhost/harness/accounts/list",
15761
+ "codexhost/harness/accounts/inspect",
15762
+ "codexhost/harness/credential-imports",
15763
+ "codexhost/account/list",
15764
+ "codexhost/account/refresh",
15765
+ "codexhost/account/usage/inspect",
15766
+ "codexhost/usage/model-prices/get",
15767
+ "codexhost/usage/model-prices/set",
15768
+ "codexhost/usage/model-prices/default",
15769
+ "codexhost/usage/statistics/get",
15770
+ "codexhost/update/check",
15771
+ "codexhost/update/start",
15772
+ "codexhost/update/status",
15773
+ "codexhost/sessions/loaded/list"
15774
+ ];
15120
15775
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15121
15776
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15122
15777
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -15155,6 +15810,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15155
15810
  cursor: clientChannelCursorSchema,
15156
15811
  revision: external_exports.number().int().nonnegative()
15157
15812
  }),
15813
+ external_exports.object({
15814
+ type: external_exports.literal("extensions-changed"),
15815
+ cursor: clientChannelCursorSchema,
15816
+ revision: hostExtensionRevisionSchema
15817
+ }),
15158
15818
  external_exports.object({
15159
15819
  type: external_exports.literal("hello"),
15160
15820
  version: external_exports.literal(1),
@@ -15330,6 +15990,29 @@ var threadCatalogReadResultSchema = external_exports.object({
15330
15990
  officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
15331
15991
  }).strict();
15332
15992
 
15993
+ // ../../shared-contracts/dist/thread-tree-watch.js
15994
+ var THREAD_TREE_MAX_NODES = 5e3;
15995
+ var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
15996
+ var threadTreeNodeSchema = external_exports.strictObject({
15997
+ harnessId: harnessIdSchema,
15998
+ title: external_exports.string().optional(),
15999
+ status: threadTreeStatusSchema,
16000
+ archived: external_exports.boolean()
16001
+ });
16002
+ var threadTreeSnapshotSchema = external_exports.strictObject({
16003
+ revision: external_exports.int().nonnegative(),
16004
+ parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
16005
+ nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
16006
+ truncated: external_exports.boolean()
16007
+ }).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");
16008
+ var subscriptionId = external_exports.string().min(1).max(128);
16009
+ var threadTreeWatchParamsSchema = external_exports.strictObject({});
16010
+ var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
16011
+ var threadTreeUnwatchResultSchema = external_exports.strictObject({});
16012
+ var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
16013
+ snapshot: threadTreeSnapshotSchema
16014
+ });
16015
+
15333
16016
  // ../../shared-contracts/dist/voice.js
15334
16017
  var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
15335
16018
  var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
@@ -15568,7 +16251,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
15568
16251
 
15569
16252
  // ../../shared-contracts/dist/harness-preferences.js
15570
16253
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
15571
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
16254
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
15572
16255
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
15573
16256
  model: harnessModelRefSchema.optional(),
15574
16257
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15578,11 +16261,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
15578
16261
  lastHarness: harnessIdSchema.optional(),
15579
16262
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
15580
16263
  });
16264
+ var harnessDelegationDefaultSchema = external_exports.strictObject({
16265
+ model: harnessModelRefSchema.optional(),
16266
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional()
16267
+ }).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
16268
+ var delegationDefaultsSchema = external_exports.strictObject({
16269
+ byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
16270
+ });
15581
16271
  var modelId = external_exports.string().min(1).max(1024);
15582
16272
  var harnessPreferenceValuesSchema = external_exports.strictObject({
15583
16273
  idleRelease: idleReleaseSettingsSchema.optional(),
15584
16274
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
15585
- newThread: newThreadDefaultsSchema.optional()
16275
+ newThread: newThreadDefaultsSchema.optional(),
16276
+ delegation: delegationDefaultsSchema.optional()
15586
16277
  });
15587
16278
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
15588
16279
  scope: harnessPreferenceScopeSchema,
@@ -15610,6 +16301,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
15610
16301
  lastHarness: harnessIdSchema.optional(),
15611
16302
  harnessId: harnessIdSchema.optional(),
15612
16303
  configuration: harnessDefaultConfigurationSchema.optional()
16304
+ }),
16305
+ external_exports.strictObject({
16306
+ kind: external_exports.literal("delegation"),
16307
+ harnessId: harnessIdSchema,
16308
+ configuration: harnessDelegationDefaultSchema.nullable()
15613
16309
  })
15614
16310
  ]);
15615
16311
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -15960,13 +16656,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15960
16656
  });
15961
16657
 
15962
16658
  // ../../shared-contracts/dist/harness-accounts.js
15963
- var accountBalanceSnapshotSchema = external_exports.object({
15964
- amount: external_exports.number().finite().nonnegative(),
15965
- /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15966
- currency: external_exports.string().trim().min(1).max(8),
15967
- /** Native label when the Harness exposes several Billing Sources. */
15968
- label: external_exports.string().trim().min(1).max(128).optional()
15969
- }).strict();
15970
16659
  var harnessAccountSnapshotObject = external_exports.object({
15971
16660
  email: external_exports.string().trim().min(1).max(320).optional(),
15972
16661
  label: external_exports.string().trim().min(1).max(256).optional(),
@@ -16000,76 +16689,6 @@ var harnessAccountListResultSchema = external_exports.object({
16000
16689
  accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
16001
16690
  }).strict();
16002
16691
 
16003
- // ../../shared-contracts/dist/harness-plugins.js
16004
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
16005
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
16006
- var HARNESS_PLUGIN_LIMIT = 128;
16007
- var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
16008
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
16009
- 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");
16010
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
16011
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
16012
- var harnessInstallationGuideSchema = external_exports.object({
16013
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
16014
- before: localizedTextSchema.optional(),
16015
- after: localizedTextSchema.optional(),
16016
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
16017
- }).strict();
16018
- var pluginPresentationShape = {
16019
- id: installedHarnessPluginIdSchema,
16020
- name: external_exports.string().trim().min(1).max(128),
16021
- version: external_exports.string().min(1).max(128),
16022
- /** Capability-only plugin; omitted for existing session-capable plugins. */
16023
- kind: external_exports.literal("usage").optional(),
16024
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
16025
- iconStyle: external_exports.object({
16026
- vector: external_exports.object({
16027
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
16028
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
16029
- paths: external_exports.array(external_exports.object({
16030
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
16031
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
16032
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
16033
- }).strict()).min(1).max(32)
16034
- }).strict().optional(),
16035
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
16036
- borderRadius: external_exports.number().min(0).max(50).optional(),
16037
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
16038
- }).strict().optional(),
16039
- installation: harnessInstallationGuideSchema.optional(),
16040
- notice: localizedTextSchema.optional(),
16041
- /** The factory accepts a persisted local entrypoint through its construction context. */
16042
- launchCommand: external_exports.literal(true).optional(),
16043
- links: external_exports.object({
16044
- website: documentationUrlSchema.optional(),
16045
- documentation: documentationUrlSchema.optional(),
16046
- installation: documentationUrlSchema.optional()
16047
- }).strict().optional()
16048
- };
16049
- var harnessPluginManifestSchema = external_exports.object({
16050
- manifestVersion: external_exports.literal(1),
16051
- ...pluginPresentationShape,
16052
- adapterApiVersion: external_exports.number().int().positive(),
16053
- entry: relativeResourceSchema,
16054
- icon: relativeResourceSchema.optional()
16055
- }).strict();
16056
- 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);
16057
- var harnessPluginDescriptorSchema = external_exports.object({
16058
- ...pluginPresentationShape,
16059
- icon: harnessPluginIconSchema.optional()
16060
- }).strict();
16061
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
16062
- var harnessPluginListResultSchema = external_exports.object({
16063
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
16064
- }).strict();
16065
- var harnessPluginConfigurationSchema = external_exports.object({
16066
- version: external_exports.literal(1),
16067
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
16068
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
16069
- message: "Enabled plugin IDs must be unique",
16070
- path: ["enabled"]
16071
- });
16072
-
16073
16692
  // ../../shared-contracts/dist/harness-route.js
16074
16693
  var harnessPluginRouteSchema = external_exports.object({
16075
16694
  harnessId: harnessPluginIdSchema,
@@ -16510,9 +17129,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16510
17129
  ...thread,
16511
17130
  epoch: identity,
16512
17131
  modelId: identity.optional(),
17132
+ serviceTier: harnessModelServiceTierSchema.optional(),
16513
17133
  thinkingOptionId: identity.optional(),
16514
17134
  permissionModeId: identity.optional()
16515
- }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
17135
+ }).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, {
17136
+ message: "A service tier requires a Model ID"
17137
+ }),
16516
17138
  external_exports.strictObject({
16517
17139
  kind: external_exports.literal("prompt"),
16518
17140
  ...thread,
@@ -16562,7 +17184,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16562
17184
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
16563
17185
  external_exports.strictObject({
16564
17186
  action: external_exports.literal("read-thread"),
16565
- hostId: hostId.refine((id) => id !== "local"),
17187
+ hostId: hostId.refine((id2) => id2 !== "local"),
16566
17188
  input: delegationReadParamsSchema
16567
17189
  }),
16568
17190
  external_exports.strictObject({
@@ -16576,7 +17198,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16576
17198
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
16577
17199
  external_exports.strictObject({
16578
17200
  action: external_exports.literal("update"),
16579
- hostId: hostId.refine((id) => id !== "local"),
17201
+ hostId: hostId.refine((id2) => id2 !== "local"),
16580
17202
  version: remoteUpdateParamsSchema.shape.version
16581
17203
  })
16582
17204
  ]);
@@ -16640,7 +17262,7 @@ function invalidRequest(message) {
16640
17262
  return { code: "invalidRequest", message, retryable: false };
16641
17263
  }
16642
17264
  function validateHostApprovalResponse(interaction, response) {
16643
- return interaction.actions.some(({ id }) => id === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
17265
+ return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
16644
17266
  }
16645
17267
 
16646
17268
  // ../../harness-adapter/dist/question.js
@@ -16648,7 +17270,7 @@ function invalidRequest2(message) {
16648
17270
  return { code: "invalidRequest", message, retryable: false };
16649
17271
  }
16650
17272
  function validateHostQuestionResponse(interaction, response) {
16651
- const questionIds = new Set(interaction.questions.map(({ id }) => id));
17273
+ const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
16652
17274
  if (response.cancelled) {
16653
17275
  return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
16654
17276
  }
@@ -16696,6 +17318,18 @@ function validateHostInteractionResponse(interaction, response) {
16696
17318
  return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
16697
17319
  }
16698
17320
 
17321
+ // ../../harness-adapter/dist/legacy-model-ref.js
17322
+ import { Buffer as Buffer2 } from "node:buffer";
17323
+ function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
17324
+ if (ref.serviceTier || !ref.id.startsWith(prefix))
17325
+ return void 0;
17326
+ const encoded = ref.id.slice(prefix.length);
17327
+ const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
17328
+ if (Buffer2.from(id2).toString("base64url") !== encoded)
17329
+ return void 0;
17330
+ return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
17331
+ }
17332
+
16699
17333
  // ../../harness-adapter/dist/output-channel.js
16700
17334
  var HarnessOutputChannel = class {
16701
17335
  outputs;
@@ -16768,7 +17402,8 @@ var tokenFields = [
16768
17402
  var safeIntegerFields = [
16769
17403
  "planFiveHourResetsAtUnix",
16770
17404
  "planSevenDayResetsAtUnix",
16771
- "timeToFirstOutputMs"
17405
+ "timeToFirstOutputMs",
17406
+ "latestRequestTimeToFirstOutputMs"
16772
17407
  ];
16773
17408
  var percentFields = [
16774
17409
  "cacheHitRatePercent",
@@ -16847,7 +17482,10 @@ function devinModes(info) {
16847
17482
  throw new Error("Devin returned no usable permission mode catalog");
16848
17483
  return harnessPermissionModeCatalogSchema.parse({ modes, defaultModeId: current });
16849
17484
  }
16850
- var devinModelRef = (nativeId) => harnessModelRefSchema.parse({ id: `devin.${Buffer.from(nativeId).toString("base64url")}` });
17485
+ var devinModelRef = (nativeId) => harnessModelRefSchema.parse({ id: nativeId });
17486
+ function normalizeStoredDevinModelRef(ref, catalog) {
17487
+ return normalizeLegacyBase64ModelRef(ref, catalog, "devin.");
17488
+ }
16851
17489
  function devinModels(info) {
16852
17490
  const option = info.configOptions?.find((option2) => option2.category === "model") ?? info.configOptions?.find((option2) => option2.id === "model");
16853
17491
  if (!option || option.type !== "select")
@@ -16892,23 +17530,22 @@ function devinCatalog(info) {
16892
17530
  ref: devinModelRef(model2.value),
16893
17531
  label: model2.name,
16894
17532
  // ACP describes the active Model's options, not all other Models' capabilities.
16895
- ...model2.value === native.current ? { supportedThinkingOptionIds: thinking.options.map(({ id }) => id) } : {}
17533
+ ...model2.value === native.current ? { supportedThinkingOptionIds: thinking.options.map(({ id: id2 }) => id2) } : {}
16896
17534
  }));
16897
17535
  if (!models.length)
16898
17536
  throw new Error("Devin returned no model catalog");
16899
17537
  const current = native.current;
16900
17538
  return {
16901
17539
  models,
16902
- ...current && models.some((model2) => model2.ref.id === devinModelRef(current).id) ? { defaultModel: devinModelRef(current) } : {},
17540
+ defaultModel: devinModelRef(current),
16903
17541
  thinkingOptions: thinking.options,
16904
17542
  ...thinking.current ? { defaultThinkingOptionId: thinking.current } : {}
16905
17543
  };
16906
17544
  }
16907
17545
  function devinNativeModel(info, ref) {
16908
- const native = devinModels(info).models.find((model2) => devinModelRef(model2.value).id === ref);
16909
- if (!native)
17546
+ if (!devinModels(info).models.some((model2) => model2.value === ref))
16910
17547
  throw new Error("Model is not in this Devin session's native catalog");
16911
- return native.value;
17548
+ return ref;
16912
17549
  }
16913
17550
 
16914
17551
  // dist/transport.js
@@ -18767,8 +19404,8 @@ var RequestResponder = class {
18767
19404
  signal;
18768
19405
  finishRequest;
18769
19406
  didRespond = false;
18770
- constructor(id, sendResult, signal = new AbortController().signal, finishRequest) {
18771
- this.id = id;
19407
+ constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
19408
+ this.id = id2;
18772
19409
  this.sendResult = sendResult;
18773
19410
  this.signal = signal;
18774
19411
  this.finishRequest = finishRequest;
@@ -19059,7 +19696,7 @@ var Connection = class {
19059
19696
  return this.sendWireMessage({ jsonrpc: "2.0", method, params });
19060
19697
  }
19061
19698
  prepareRequest(method, params, mapResponse, options = {}) {
19062
- const id = this.nextRequestId++;
19699
+ const id2 = this.nextRequestId++;
19063
19700
  let cancel = () => {
19064
19701
  };
19065
19702
  const response = new Promise((resolve, reject) => {
@@ -19079,7 +19716,7 @@ var Connection = class {
19079
19716
  }
19080
19717
  pendingResponse.cancellationSent = true;
19081
19718
  pendingResponse.cleanup?.();
19082
- void this.sendCancelRequest(id).catch(() => {
19719
+ void this.sendCancelRequest(id2).catch(() => {
19083
19720
  });
19084
19721
  };
19085
19722
  options.cancellationSignal?.addEventListener("abort", cancel, {
@@ -19088,12 +19725,12 @@ var Connection = class {
19088
19725
  pendingResponse.cleanup = () => {
19089
19726
  options.cancellationSignal?.removeEventListener("abort", cancel);
19090
19727
  };
19091
- this.pendingResponses.set(id, pendingResponse);
19728
+ this.pendingResponses.set(id2, pendingResponse);
19092
19729
  });
19093
19730
  response.catch(() => {
19094
19731
  });
19095
19732
  return {
19096
- message: { jsonrpc: "2.0", id, method, params },
19733
+ message: { jsonrpc: "2.0", id: id2, method, params },
19097
19734
  response,
19098
19735
  cancel: () => cancel()
19099
19736
  };
@@ -19730,7 +20367,7 @@ function memoryStreamPair() {
19730
20367
  }
19731
20368
  ];
19732
20369
  }
19733
- var methods = {
20370
+ var methods2 = {
19734
20371
  agent: {
19735
20372
  initialize: AGENT_METHODS.initialize,
19736
20373
  authenticate: AGENT_METHODS.authenticate,
@@ -21102,10 +21739,10 @@ function executableExtensions(command, platform, environment) {
21102
21739
  return [""];
21103
21740
  return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
21104
21741
  }
21105
- function isExecutableFile(filePath, platform) {
21742
+ function isExecutableFile(filePath2, platform) {
21106
21743
  try {
21107
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
21108
- return fs.statSync(filePath).isFile();
21744
+ fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
21745
+ return fs.statSync(filePath2).isFile();
21109
21746
  } catch {
21110
21747
  return false;
21111
21748
  }
@@ -23393,10 +24030,10 @@ async function deriveDevinHistory(input, source, options) {
23393
24030
  const response = await source.historyRequest("forkFromStep", {
23394
24031
  stepId: checkpoint.checkpointId
23395
24032
  });
23396
- const id = response?.forkedSessionId;
23397
- if (typeof id !== "string" || !id.trim() || id === source.sessionId)
24033
+ const id2 = response?.forkedSessionId;
24034
+ if (typeof id2 !== "string" || !id2.trim() || id2 === source.sessionId)
23398
24035
  throw new Error("Devin fork did not return an independent native Session ID");
23399
- childId = id;
24036
+ childId = id2;
23400
24037
  }
23401
24038
  const info = await child.open(childId);
23402
24039
  childId = child.sessionId;
@@ -23441,6 +24078,7 @@ function rejected(code, message) {
23441
24078
  }
23442
24079
  var DevinAdapter = class {
23443
24080
  options;
24081
+ normalizeStoredModelRef = normalizeStoredDevinModelRef;
23444
24082
  harnessId = harnessIdSchema.parse("devin");
23445
24083
  sessionImport = {
23446
24084
  listCandidates: () => this.#listImportCandidates(),
@@ -23449,6 +24087,7 @@ var DevinAdapter = class {
23449
24087
  #sessions = /* @__PURE__ */ new Set();
23450
24088
  #probes = /* @__PURE__ */ new Set();
23451
24089
  #inspections = /* @__PURE__ */ new Map();
24090
+ #inspectionTasks = /* @__PURE__ */ new Set();
23452
24091
  #closed = false;
23453
24092
  #closePromise;
23454
24093
  constructor(options = {}) {
@@ -23470,11 +24109,15 @@ var DevinAdapter = class {
23470
24109
  };
23471
24110
  const cwd = path5.resolve(input.cwd ?? process.cwd());
23472
24111
  const key = input.purpose === "availability" ? JSON.stringify([cwd, input.purpose]) : cwd;
23473
- if (input.purpose === "availability" && input.refresh && !this.#inspections.get(cwd)?.pending)
23474
- this.#inspections.delete(cwd);
23475
24112
  const cached2 = this.#inspections.get(key);
23476
- if (cached2 && (cached2.pending || !input.refresh))
23477
- return cached2.result;
24113
+ if (input.refresh) {
24114
+ this.#inspections.clear();
24115
+ if (cached2 && this.#inspectionTasks.has(cached2))
24116
+ this.#inspections.set(key, cached2);
24117
+ }
24118
+ const current = this.#inspections.get(key);
24119
+ if (current)
24120
+ return current;
23478
24121
  const result = (async () => {
23479
24122
  if (input.purpose === "availability") {
23480
24123
  try {
@@ -23521,11 +24164,9 @@ var DevinAdapter = class {
23521
24164
  await transport.close();
23522
24165
  }
23523
24166
  })();
23524
- const entry = { pending: true, result };
23525
- this.#inspections.set(key, entry);
23526
- void result.finally(() => {
23527
- entry.pending = false;
23528
- });
24167
+ this.#inspections.set(key, result);
24168
+ this.#inspectionTasks.add(result);
24169
+ void result.finally(() => this.#inspectionTasks.delete(result));
23529
24170
  return result;
23530
24171
  }
23531
24172
  async open(input) {
@@ -23701,7 +24342,7 @@ var DevinAdapter = class {
23701
24342
  ...[...this.#sessions].map((session) => session.close()),
23702
24343
  ...[...this.#probes].map((transport) => transport.close())
23703
24344
  ]);
23704
- await Promise.allSettled([...this.#inspections.values()].map((inspection) => inspection.result));
24345
+ await Promise.allSettled(this.#inspectionTasks);
23705
24346
  this.#inspections.clear();
23706
24347
  })();
23707
24348
  return this.#closePromise;
@@ -23814,8 +24455,8 @@ var DevinSession = class {
23814
24455
  if (command.type === "turn.cancel") {
23815
24456
  if (!this.#active || this.#active.command.turnId !== command.turnId)
23816
24457
  return rejected("invalidState", "Devin turn is not active");
23817
- const active = this.#active;
23818
- active.cancelled = true;
24458
+ const active2 = this.#active;
24459
+ active2.cancelled = true;
23819
24460
  this.#interactions.cancel();
23820
24461
  try {
23821
24462
  await this.transport.cancel();
@@ -23823,10 +24464,10 @@ var DevinSession = class {
23823
24464
  await this.transport.close();
23824
24465
  }
23825
24466
  const timer = setTimeout(() => {
23826
- if (this.#active === active)
24467
+ if (this.#active === active2)
23827
24468
  void this.transport.close();
23828
24469
  }, 5e3);
23829
- void active.task.finally(() => clearTimeout(timer));
24470
+ void active2.task.finally(() => clearTimeout(timer));
23830
24471
  return { ok: true, value: { cancellationRequested: true } };
23831
24472
  }
23832
24473
  if (this.#configuring || this.#active && command.type !== "model.select" && command.type !== "thinking.select")
@@ -23837,9 +24478,9 @@ var DevinSession = class {
23837
24478
  if (!command.input.length || command.input.some((part) => part.type !== "text") || !command.input.some((part) => part.text.trim()))
23838
24479
  return rejected("invalidRequest", "Devin requires nonempty text input");
23839
24480
  this.#submitted.add(command.turnId);
23840
- const active = { command, cancelled: false, task: Promise.resolve() };
23841
- this.#active = active;
23842
- active.task = this.#run(command);
24481
+ const active2 = { command, cancelled: false, task: Promise.resolve() };
24482
+ this.#active = active2;
24483
+ active2.task = this.#run(command);
23843
24484
  return { ok: true, value: { turnId: command.turnId } };
23844
24485
  }
23845
24486
  const thinking = devinThinking(this.info);
@@ -23970,14 +24611,14 @@ var DevinSession = class {
23970
24611
  if (this.#closed)
23971
24612
  return;
23972
24613
  this.#closed = true;
23973
- const active = this.#active;
23974
- if (active)
23975
- active.cancelled = true;
24614
+ const active2 = this.#active;
24615
+ if (active2)
24616
+ active2.cancelled = true;
23976
24617
  this.#interactions.cancel();
23977
24618
  this.transport.onConfigOptions = void 0;
23978
24619
  try {
23979
24620
  await this.transport.close();
23980
- await active?.task;
24621
+ await active2?.task;
23981
24622
  } finally {
23982
24623
  this.#channel.end();
23983
24624
  this.onClose();