@codexhost/cli-linux-arm64 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
@@ -32,10 +32,10 @@ function executableExtensions(command, platform, environment) {
32
32
  return [""];
33
33
  return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
34
34
  }
35
- function isExecutableFile(filePath, platform) {
35
+ function isExecutableFile(filePath2, platform) {
36
36
  try {
37
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
- return fs.statSync(filePath).isFile();
37
+ fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
+ return fs.statSync(filePath2).isFile();
39
39
  } catch {
40
40
  return false;
41
41
  }
@@ -1600,8 +1600,8 @@ function cleanEnum(obj) {
1600
1600
  return Number.isNaN(Number.parseInt(k, 10));
1601
1601
  }).map((el) => el[1]);
1602
1602
  }
1603
- function base64ToUint8Array(base643) {
1604
- const binaryString = atob(base643);
1603
+ function base64ToUint8Array(base644) {
1604
+ const binaryString = atob(base644);
1605
1605
  const bytes = new Uint8Array(binaryString.length);
1606
1606
  for (let i = 0; i < binaryString.length; i++) {
1607
1607
  bytes[i] = binaryString.charCodeAt(i);
@@ -1616,9 +1616,9 @@ function uint8ArrayToBase64(bytes) {
1616
1616
  return btoa(binaryString);
1617
1617
  }
1618
1618
  function base64urlToUint8Array(base64url3) {
1619
- const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1620
- const padding = "=".repeat((4 - base643.length % 4) % 4);
1621
- return base64ToUint8Array(base643 + padding);
1619
+ const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
1620
+ const padding = "=".repeat((4 - base644.length % 4) % 4);
1621
+ return base64ToUint8Array(base644 + padding);
1622
1622
  }
1623
1623
  function uint8ArrayToBase64url(bytes) {
1624
1624
  return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
@@ -2984,8 +2984,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2984
2984
  function isValidBase64URL(data) {
2985
2985
  if (!base64url.test(data))
2986
2986
  return false;
2987
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2988
- const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2987
+ const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2988
+ const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
2989
2989
  return isValidBase64(padded);
2990
2990
  }
2991
2991
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
@@ -3439,42 +3439,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3439
3439
  }
3440
3440
  doc.write(`const newResult = {};`);
3441
3441
  for (const key of normalized.keys) {
3442
- const id = ids[key];
3442
+ const id2 = ids[key];
3443
3443
  const k = esc(key);
3444
3444
  const schema = shape[key];
3445
3445
  const isOptionalIn = schema?._zod?.optin === "optional";
3446
3446
  const isOptionalOut = schema?._zod?.optout === "optional";
3447
- doc.write(`const ${id} = ${parseStr(key)};`);
3447
+ doc.write(`const ${id2} = ${parseStr(key)};`);
3448
3448
  if (isOptionalIn && isOptionalOut) {
3449
3449
  doc.write(`
3450
- if (${id}.issues.length) {
3450
+ if (${id2}.issues.length) {
3451
3451
  if (${k} in input) {
3452
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3452
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3453
3453
  ...iss,
3454
3454
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3455
3455
  })));
3456
3456
  }
3457
3457
  }
3458
3458
 
3459
- if (${id}.value === undefined) {
3459
+ if (${id2}.value === undefined) {
3460
3460
  if (${k} in input) {
3461
3461
  newResult[${k}] = undefined;
3462
3462
  }
3463
3463
  } else {
3464
- newResult[${k}] = ${id}.value;
3464
+ newResult[${k}] = ${id2}.value;
3465
3465
  }
3466
3466
 
3467
3467
  `);
3468
3468
  } else if (!isOptionalIn) {
3469
3469
  doc.write(`
3470
- const ${id}_present = ${k} in input;
3471
- if (${id}.issues.length) {
3472
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3470
+ const ${id2}_present = ${k} in input;
3471
+ if (${id2}.issues.length) {
3472
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3473
3473
  ...iss,
3474
3474
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3475
3475
  })));
3476
3476
  }
3477
- if (!${id}_present && !${id}.issues.length) {
3477
+ if (!${id2}_present && !${id2}.issues.length) {
3478
3478
  payload.issues.push({
3479
3479
  code: "invalid_type",
3480
3480
  expected: "nonoptional",
@@ -3483,30 +3483,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3483
3483
  });
3484
3484
  }
3485
3485
 
3486
- if (${id}_present) {
3487
- if (${id}.value === undefined) {
3486
+ if (${id2}_present) {
3487
+ if (${id2}.value === undefined) {
3488
3488
  newResult[${k}] = undefined;
3489
3489
  } else {
3490
- newResult[${k}] = ${id}.value;
3490
+ newResult[${k}] = ${id2}.value;
3491
3491
  }
3492
3492
  }
3493
3493
 
3494
3494
  `);
3495
3495
  } else {
3496
3496
  doc.write(`
3497
- if (${id}.issues.length) {
3498
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
3497
+ if (${id2}.issues.length) {
3498
+ payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
3499
3499
  ...iss,
3500
3500
  path: iss.path ? [${k}, ...iss.path] : [${k}]
3501
3501
  })));
3502
3502
  }
3503
3503
 
3504
- if (${id}.value === undefined) {
3504
+ if (${id2}.value === undefined) {
3505
3505
  if (${k} in input) {
3506
3506
  newResult[${k}] = undefined;
3507
3507
  }
3508
3508
  } else {
3509
- newResult[${k}] = ${id}.value;
3509
+ newResult[${k}] = ${id2}.value;
3510
3510
  }
3511
3511
 
3512
3512
  `);
@@ -11838,26 +11838,26 @@ function extractDefs(ctx, schema) {
11838
11838
  throw new Error("Unprocessed schema. This is a bug in Zod.");
11839
11839
  const idToSchema = /* @__PURE__ */ new Map();
11840
11840
  for (const entry of ctx.seen.entries()) {
11841
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11842
- if (id) {
11843
- const existing = idToSchema.get(id);
11841
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11842
+ if (id2) {
11843
+ const existing = idToSchema.get(id2);
11844
11844
  if (existing && existing !== entry[0]) {
11845
- throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11845
+ throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
11846
11846
  }
11847
- idToSchema.set(id, entry[0]);
11847
+ idToSchema.set(id2, entry[0]);
11848
11848
  }
11849
11849
  }
11850
11850
  const makeURI = (entry) => {
11851
11851
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
11852
11852
  if (ctx.external) {
11853
11853
  const externalId = ctx.external.registry.get(entry[0])?.id;
11854
- const uriGenerator = ctx.external.uri ?? ((id2) => id2);
11854
+ const uriGenerator = ctx.external.uri ?? ((id3) => id3);
11855
11855
  if (externalId) {
11856
11856
  return { ref: uriGenerator(externalId) };
11857
11857
  }
11858
- const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11859
- entry[1].defId = id;
11860
- return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
11858
+ const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
11859
+ entry[1].defId = id2;
11860
+ return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
11861
11861
  }
11862
11862
  if (entry[1] === root) {
11863
11863
  return { ref: "#" };
@@ -11905,8 +11905,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11905
11905
  continue;
11906
11906
  }
11907
11907
  }
11908
- const id = ctx.metadataRegistry.get(entry[0])?.id;
11909
- if (id) {
11908
+ const id2 = ctx.metadataRegistry.get(entry[0])?.id;
11909
+ if (id2) {
11910
11910
  extractToDef(entry);
11911
11911
  continue;
11912
11912
  }
@@ -12002,10 +12002,10 @@ function finalize(ctx, schema) {
12002
12002
  } else {
12003
12003
  }
12004
12004
  if (ctx.external?.uri) {
12005
- const id = ctx.external.registry.get(schema)?.id;
12006
- if (!id)
12005
+ const id2 = ctx.external.registry.get(schema)?.id;
12006
+ if (!id2)
12007
12007
  throw new Error("Schema is missing an `id` property");
12008
- result.$id = ctx.external.uri(id);
12008
+ result.$id = ctx.external.uri(id2);
12009
12009
  }
12010
12010
  Object.assign(result, root.def ?? root.schema);
12011
12011
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -12165,9 +12165,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
12165
12165
  json2.type = "number";
12166
12166
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
12167
12167
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
12168
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
12168
+ const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
12169
12169
  if (exMin) {
12170
- if (legacy) {
12170
+ if (legacy2) {
12171
12171
  json2.minimum = exclusiveMinimum;
12172
12172
  json2.exclusiveMinimum = true;
12173
12173
  } else {
@@ -12177,7 +12177,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
12177
12177
  json2.minimum = minimum;
12178
12178
  }
12179
12179
  if (exMax) {
12180
- if (legacy) {
12180
+ if (legacy2) {
12181
12181
  json2.maximum = exclusiveMaximum;
12182
12182
  json2.exclusiveMaximum = true;
12183
12183
  } else {
@@ -13039,7 +13039,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
13039
13039
 
13040
13040
  // ../../../node_modules/zod/v4/classic/schemas.js
13041
13041
  var _installedGroups = /* @__PURE__ */ new WeakMap();
13042
- function _installLazyMethods(inst, group, methods2) {
13042
+ function _installLazyMethods(inst, group, methods3) {
13043
13043
  const proto = Object.getPrototypeOf(inst);
13044
13044
  let installed = _installedGroups.get(proto);
13045
13045
  if (!installed) {
@@ -13049,8 +13049,8 @@ function _installLazyMethods(inst, group, methods2) {
13049
13049
  if (installed.has(group))
13050
13050
  return;
13051
13051
  installed.add(group);
13052
- for (const key in methods2) {
13053
- const fn = methods2[key];
13052
+ for (const key in methods3) {
13053
+ const fn = methods3[key];
13054
13054
  Object.defineProperty(proto, key, {
13055
13055
  configurable: true,
13056
13056
  enumerable: false,
@@ -14994,6 +14994,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
14994
14994
  permissionModeId: harnessPermissionModeIdSchema
14995
14995
  }).strict();
14996
14996
 
14997
+ // ../../shared-contracts/dist/harness-route-limit.js
14998
+ var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
14999
+
14997
15000
  // ../../shared-contracts/dist/thread-usage.js
14998
15001
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14999
15002
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -15026,7 +15029,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
15026
15029
  expiresAtUnix: nonNegativeSafeIntegerSchema,
15027
15030
  label: indicatorTextSchema(256).optional(),
15028
15031
  tooltip: indicatorTextSchema(1024).optional()
15029
- }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
15032
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
15030
15033
  message: "Composer indicator IDs must be unique"
15031
15034
  });
15032
15035
  var threadUsageSnapshotSchema = external_exports.object({
@@ -15052,6 +15055,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15052
15055
  planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15053
15056
  sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15054
15057
  timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15058
+ latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15055
15059
  costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15056
15060
  unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15057
15061
  }).strict().superRefine((usage, context) => {
@@ -15149,6 +15153,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
15149
15153
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15150
15154
  resetCredits: accountResetCreditsSchema.optional()
15151
15155
  }).strict();
15156
+ var accountBalanceSnapshotSchema = external_exports.object({
15157
+ amount: external_exports.number().finite().nonnegative(),
15158
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15159
+ currency: external_exports.string().trim().min(1).max(8),
15160
+ /** Native label when the Harness exposes several Billing Sources. */
15161
+ label: external_exports.string().trim().min(1).max(128).optional()
15162
+ }).strict();
15152
15163
  var threadUsageInspectionParamsSchema = external_exports.object({
15153
15164
  threadId: hostThreadIdSchema,
15154
15165
  refresh: external_exports.literal("exact").optional()
@@ -15157,7 +15168,10 @@ var threadUsageInspectionSchema = external_exports.object({
15157
15168
  threadId: hostThreadIdSchema,
15158
15169
  usage: threadUsageSnapshotSchema.nullable(),
15159
15170
  accountCredits: accountCreditsSnapshotSchema.optional(),
15160
- /** Whether this source can provide cached account quota independently of usage. */
15171
+ /** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
15172
+ accountBalance: accountBalanceSnapshotSchema.optional(),
15173
+ /** Whether this source can provide cached account quota (credits or a prepaid balance)
15174
+ * independently of usage. */
15161
15175
  accountCreditsSupported: external_exports.boolean().optional()
15162
15176
  }).strict();
15163
15177
 
@@ -15169,10 +15183,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
15169
15183
  var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
15170
15184
  message: "Value must not be empty or whitespace"
15171
15185
  });
15172
- var harnessModelRefIdSchema = nonBlankTextSchema2.max(HARNESS_MODEL_REF_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Model Ref must use transport-safe opaque characters").brand();
15186
+ var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !new RegExp("\\p{Cc}", "u").test(id2), "Model Ref must not contain control characters").brand();
15187
+ var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
15173
15188
  var harnessModelRefSchema = external_exports.object({
15174
- id: harnessModelRefIdSchema
15189
+ id: harnessModelRefIdSchema,
15190
+ serviceTier: harnessModelServiceTierSchema.optional()
15175
15191
  }).strict();
15192
+ function sameHarnessModelRef(left, right) {
15193
+ return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
15194
+ }
15176
15195
  var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
15177
15196
  var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
15178
15197
  var harnessThinkingOptionSchema = external_exports.object({
@@ -15186,7 +15205,15 @@ var harnessModelSchema = external_exports.object({
15186
15205
  /** Optional opaque selection for this same Model with priority processing enabled. */
15187
15206
  fastModel: harnessModelRefSchema.optional(),
15188
15207
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15189
- }).strict();
15208
+ }).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
15209
+ path: ["fastModel", "id"],
15210
+ message: "A tiered Fast Model must share the base Model ID"
15211
+ });
15212
+ function catalogModelForRef(catalog, ref) {
15213
+ if (!ref)
15214
+ return void 0;
15215
+ return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
15216
+ }
15190
15217
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
15191
15218
  const ids = /* @__PURE__ */ new Set();
15192
15219
  for (const [index, option] of options.entries()) {
@@ -15206,26 +15233,26 @@ var harnessModelCatalogSchema = external_exports.object({
15206
15233
  thinkingOptions: harnessThinkingOptionsSchema,
15207
15234
  defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
15208
15235
  }).strict().superRefine((catalog, context) => {
15209
- const refs = /* @__PURE__ */ new Set();
15210
- const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
15236
+ const refs = [];
15237
+ const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
15211
15238
  for (const [index, model2] of catalog.models.entries()) {
15212
- if (refs.has(model2.ref.id)) {
15239
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
15213
15240
  context.addIssue({
15214
15241
  code: "custom",
15215
15242
  message: "Model Catalog refs must be unique",
15216
15243
  path: ["models", index, "ref", "id"]
15217
15244
  });
15218
15245
  }
15219
- refs.add(model2.ref.id);
15246
+ refs.push(model2.ref);
15220
15247
  if (model2.fastModel) {
15221
- if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15248
+ if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
15222
15249
  context.addIssue({
15223
15250
  code: "custom",
15224
15251
  message: "Fast Model refs must be distinct and unique",
15225
15252
  path: ["models", index, "fastModel"]
15226
15253
  });
15227
15254
  }
15228
- refs.add(model2.fastModel.id);
15255
+ refs.push(model2.fastModel);
15229
15256
  }
15230
15257
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15231
15258
  for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
@@ -15246,7 +15273,7 @@ var harnessModelCatalogSchema = external_exports.object({
15246
15273
  }
15247
15274
  }
15248
15275
  }
15249
- if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
15276
+ if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
15250
15277
  context.addIssue({
15251
15278
  code: "custom",
15252
15279
  message: "Default Model must exist in the Model Catalog",
@@ -15286,7 +15313,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15286
15313
  observe: external_exports.boolean()
15287
15314
  }).strict().optional(),
15288
15315
  /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15289
- steer: external_exports.boolean().optional()
15316
+ steer: external_exports.boolean().optional(),
15317
+ /**
15318
+ * True when the native plan (task list) outlives the Turn that changed it, so a reopened
15319
+ * Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
15320
+ */
15321
+ persistentPlan: external_exports.boolean().optional()
15290
15322
  }).strict();
15291
15323
  var harnessConfigurationStateSchema = external_exports.object({
15292
15324
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15295,7 +15327,7 @@ var harnessConfigurationStateSchema = external_exports.object({
15295
15327
  availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
15296
15328
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
15297
15329
  }).strict().superRefine((state, context) => {
15298
- if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
15330
+ if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
15299
15331
  context.addIssue({
15300
15332
  code: "custom",
15301
15333
  message: "Effective Thinking option must be currently available",
@@ -15335,7 +15367,8 @@ var harnessInspectParamsSchema = external_exports.object({
15335
15367
  cwd: nonBlankTextSchema2.max(16384).optional(),
15336
15368
  refresh: external_exports.boolean().optional(),
15337
15369
  /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15338
- purpose: external_exports.literal("availability").optional()
15370
+ purpose: external_exports.literal("availability").optional(),
15371
+ credentialAccess: external_exports.enum(["allow", "retry"]).optional()
15339
15372
  }).strict();
15340
15373
  var harnessWebUiOpenParamsSchema = external_exports.object({
15341
15374
  harnessId: harnessIdSchema
@@ -15366,7 +15399,7 @@ var codexThreadInspectionSchema = external_exports.object({
15366
15399
  var externalThreadInspectionSchema = external_exports.object({
15367
15400
  owner: external_exports.literal("external"),
15368
15401
  harnessId: nonBlankTextSchema2.max(256),
15369
- transportModelId: nonBlankTextSchema2.max(1024),
15402
+ transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
15370
15403
  effectiveModel: harnessModelRefSchema.optional(),
15371
15404
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15372
15405
  effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15448,13 +15481,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
15448
15481
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15449
15482
  }).strict();
15450
15483
 
15484
+ // ../../shared-contracts/dist/harness-plugins.js
15485
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15486
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15487
+ var HARNESS_PLUGIN_LIMIT = 128;
15488
+ var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
15489
+ var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
15490
+ var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
15491
+ 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");
15492
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15493
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15494
+ var harnessInstallationGuideSchema = external_exports.object({
15495
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15496
+ before: localizedTextSchema.optional(),
15497
+ after: localizedTextSchema.optional(),
15498
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15499
+ }).strict();
15500
+ var pluginPresentationShape = {
15501
+ id: installedHarnessPluginIdSchema,
15502
+ name: external_exports.string().trim().min(1).max(128),
15503
+ version: external_exports.string().min(1).max(128),
15504
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15505
+ kind: external_exports.literal("usage").optional(),
15506
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15507
+ iconStyle: external_exports.object({
15508
+ vector: external_exports.object({
15509
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15510
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15511
+ paths: external_exports.array(external_exports.object({
15512
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15513
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15514
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15515
+ }).strict()).min(1).max(32)
15516
+ }).strict().optional(),
15517
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15518
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15519
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15520
+ }).strict().optional(),
15521
+ installation: harnessInstallationGuideSchema.optional(),
15522
+ notice: localizedTextSchema.optional(),
15523
+ /** The factory accepts a persisted local entrypoint through its construction context. */
15524
+ launchCommand: external_exports.literal(true).optional(),
15525
+ links: external_exports.object({
15526
+ website: documentationUrlSchema.optional(),
15527
+ documentation: documentationUrlSchema.optional(),
15528
+ installation: documentationUrlSchema.optional()
15529
+ }).strict().optional()
15530
+ };
15531
+ var harnessPluginManifestSchema = external_exports.object({
15532
+ manifestVersion: external_exports.literal(1),
15533
+ ...pluginPresentationShape,
15534
+ adapterApiVersion: external_exports.number().int().positive(),
15535
+ entry: pluginRelativeResourceSchema,
15536
+ icon: pluginRelativeResourceSchema.optional()
15537
+ }).strict();
15538
+ 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);
15539
+ var harnessPluginDescriptorSchema = external_exports.object({
15540
+ ...pluginPresentationShape,
15541
+ icon: harnessPluginIconSchema.optional()
15542
+ }).strict();
15543
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
15544
+ var harnessPluginListResultSchema = external_exports.object({
15545
+ plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
15546
+ }).strict();
15547
+ var harnessPluginConfigurationSchema = external_exports.object({
15548
+ version: external_exports.literal(1),
15549
+ enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15550
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15551
+ message: "Enabled plugin IDs must be unique",
15552
+ path: ["enabled"]
15553
+ });
15554
+
15555
+ // ../../shared-contracts/dist/desktop-extensions.js
15556
+ var DESKTOP_EXTENSION_API_VERSION = 1;
15557
+ var DESKTOP_EXTENSION_LIMIT = 64;
15558
+ var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
15559
+ var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
15560
+ var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
15561
+ var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
15562
+ var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
15563
+ var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
15564
+ var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
15565
+ var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
15566
+ var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
15567
+ var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
15568
+ var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
15569
+ var desktopExtensionIdSchema = installedPluginIdSchema;
15570
+ var desktopExtensionSlotSchema = external_exports.enum([
15571
+ "sidebar.thread-layout",
15572
+ "sidebar.thread-badge",
15573
+ "appearance.theme"
15574
+ ]);
15575
+ var desktopExtensionCategorySchema = external_exports.enum([
15576
+ "appearance",
15577
+ "interface",
15578
+ "workflow",
15579
+ "analytics",
15580
+ "integrations",
15581
+ "tools"
15582
+ ]);
15583
+ var extensionName = external_exports.string().trim().min(1).max(128);
15584
+ function desktopExtensionScreenshotMimeType(resource) {
15585
+ switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
15586
+ case "png":
15587
+ return "image/png";
15588
+ case "jpg":
15589
+ case "jpeg":
15590
+ return "image/jpeg";
15591
+ case "webp":
15592
+ return "image/webp";
15593
+ default:
15594
+ return void 0;
15595
+ }
15596
+ }
15597
+ var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
15598
+ 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");
15599
+ 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) => {
15600
+ const { username, password } = new URL(value);
15601
+ return !username && !password && !/[\\\s]/u.test(value);
15602
+ }, "URL must not contain credentials, backslashes, or whitespace");
15603
+ function localizedText(text) {
15604
+ return external_exports.strictObject({ en: text, "zh-CN": text });
15605
+ }
15606
+ var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
15607
+ var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
15608
+ var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
15609
+ var settingField = {
15610
+ key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
15611
+ label: desktopExtensionLocalizedTextSchema,
15612
+ description: desktopExtensionLocalizedTextSchema.optional()
15613
+ };
15614
+ var numericSetting = {
15615
+ ...settingField,
15616
+ step: external_exports.number().positive().optional(),
15617
+ default: external_exports.number().optional()
15618
+ };
15619
+ var settingOption = external_exports.strictObject({
15620
+ value: external_exports.string(),
15621
+ label: desktopExtensionLocalizedTextSchema
15622
+ });
15623
+ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
15624
+ external_exports.strictObject({
15625
+ ...settingField,
15626
+ type: external_exports.literal("boolean"),
15627
+ default: external_exports.boolean().optional()
15628
+ }),
15629
+ external_exports.strictObject({
15630
+ ...settingField,
15631
+ type: external_exports.literal("string"),
15632
+ placeholder: desktopExtensionLocalizedTextSchema.optional(),
15633
+ default: external_exports.string().optional()
15634
+ }),
15635
+ external_exports.strictObject({
15636
+ ...numericSetting,
15637
+ type: external_exports.literal("number"),
15638
+ min: external_exports.number().optional(),
15639
+ max: external_exports.number().optional()
15640
+ }),
15641
+ external_exports.strictObject({
15642
+ ...numericSetting,
15643
+ type: external_exports.literal("range"),
15644
+ min: external_exports.number(),
15645
+ max: external_exports.number()
15646
+ }),
15647
+ external_exports.strictObject({
15648
+ ...settingField,
15649
+ type: external_exports.literal("select"),
15650
+ options: external_exports.array(settingOption).min(1),
15651
+ default: external_exports.string().optional()
15652
+ })
15653
+ ]).superRefine((field2, ctx) => {
15654
+ const issue2 = (path9, message) => ctx.addIssue({ code: "custom", path: [path9], message });
15655
+ if (field2.type === "number" || field2.type === "range") {
15656
+ const { min = -Infinity, max = Infinity, default: value } = field2;
15657
+ if (min > max)
15658
+ issue2("max", "Must be at least min");
15659
+ if (value !== void 0 && (value < min || value > max))
15660
+ issue2("default", "Must be within min and max");
15661
+ } else if (field2.type === "select") {
15662
+ const values = new Set(field2.options.map(({ value }) => value));
15663
+ if (values.size !== field2.options.length)
15664
+ issue2("options", "Duplicate option values");
15665
+ if (field2.default !== void 0 && !values.has(field2.default))
15666
+ issue2("default", "Must match an option value");
15667
+ }
15668
+ });
15669
+ var manifestHeader = external_exports.object({
15670
+ manifestVersion: external_exports.int().positive(),
15671
+ id: desktopExtensionIdSchema,
15672
+ name: external_exports.union([extensionName, localizedText(extensionName)]),
15673
+ version: external_exports.string().min(1).max(128),
15674
+ desktopApi: external_exports.int().positive()
15675
+ }).passthrough();
15676
+ var desktopExtensionManifestSchema = manifestHeader.extend({
15677
+ manifestVersion: external_exports.literal(1),
15678
+ desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
15679
+ description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
15680
+ author: external_exports.string().trim().min(1).max(128).optional(),
15681
+ repository: desktopExtensionHttpUrlSchema.optional(),
15682
+ details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
15683
+ icon: imagePathSchema.optional(),
15684
+ screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
15685
+ desktop: external_exports.strictObject({
15686
+ script: pluginRelativeResourceSchema,
15687
+ style: pluginRelativeResourceSchema.optional()
15688
+ }).optional(),
15689
+ backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
15690
+ slots: slotsSchema.default(() => []),
15691
+ settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
15692
+ categories: categoriesSchema.optional()
15693
+ }).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
15694
+ var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
15695
+ var desktopExtensionStatusSchema = external_exports.strictObject({
15696
+ state: external_exports.enum([
15697
+ "running",
15698
+ "disabled",
15699
+ "invalid",
15700
+ "incompatible",
15701
+ "conflict",
15702
+ "failed",
15703
+ "waiting"
15704
+ ]),
15705
+ hash: desktopExtensionHashSchema.optional(),
15706
+ error: external_exports.string().optional(),
15707
+ conflictWith: desktopExtensionIdSchema.optional()
15708
+ });
15709
+ var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
15710
+ controllerPid: external_exports.int().positive(),
15711
+ targetId: external_exports.string().nullable(),
15712
+ updatedAt: external_exports.iso.datetime(),
15713
+ handledReloadToken: external_exports.uuid().optional(),
15714
+ extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
15715
+ surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
15716
+ });
15717
+ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
15718
+ function isGitHubDesktopExtensionZipballUrl(url2) {
15719
+ return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
15720
+ }
15721
+ var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
15722
+ const url2 = new URL(input);
15723
+ 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);
15724
+ }, "Expected a .zip download URL or a GitHub zipball URL");
15725
+ var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
15726
+ id: desktopExtensionIdSchema,
15727
+ version: external_exports.string().trim().min(1).max(128),
15728
+ name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
15729
+ description: localizedText(external_exports.string().trim().min(1).max(4096)),
15730
+ details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
15731
+ author: external_exports.string().trim().min(1).max(128),
15732
+ repository: desktopExtensionHttpUrlSchema,
15733
+ stars: external_exports.number().int().min(0).optional(),
15734
+ downloads: external_exports.number().int().min(0).optional(),
15735
+ categories: categoriesSchema.optional(),
15736
+ trustTier: desktopExtensionTrustTierSchema.default("community"),
15737
+ icon: desktopExtensionHttpUrlSchema.optional(),
15738
+ screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15739
+ downloadUrl: desktopExtensionZipUrlSchema,
15740
+ sha256: desktopExtensionHashSchema,
15741
+ slots: slotsSchema.optional(),
15742
+ publishedAt: external_exports.string().optional(),
15743
+ updatedAt: external_exports.string().optional(),
15744
+ minCodexHostVersion: external_exports.string().optional()
15745
+ });
15746
+ var desktopExtensionCatalogSchema = external_exports.strictObject({
15747
+ schemaVersion: external_exports.literal(1),
15748
+ generatedAt: external_exports.string(),
15749
+ extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15750
+ });
15751
+ var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
15752
+
15753
+ // ../../shared-contracts/dist/host-extensions.js
15754
+ var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
15755
+ var HOST_EXTENSION_PAGE_API_VERSION = 1;
15756
+ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
15757
+ var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
15758
+ var hostExtensionDigestSchema = desktopExtensionHashSchema;
15759
+ var hostExtensionActivationIdSchema = external_exports.uuid();
15760
+ var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path9) => path9.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
15761
+ var legacy = desktopExtensionManifestSchema.shape;
15762
+ var localized = (max, min = 0) => external_exports.strictObject({
15763
+ en: external_exports.string().trim().min(min).max(max),
15764
+ "zh-CN": external_exports.string().trim().min(min).max(max)
15765
+ });
15766
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path9) => path9.endsWith(suffix), `Expected a ${suffix} file`);
15767
+ var moduleEntry = resourceWithSuffix(".mjs");
15768
+ var style = resourceWithSuffix(".css").optional();
15769
+ var hostExtensionCanonicalPath = (path9) => path9.normalize("NFC").toLowerCase();
15770
+ var hostExtensionManifestV2Schema = external_exports.strictObject({
15771
+ manifestVersion: external_exports.literal(2),
15772
+ id: hostExtensionIdSchema,
15773
+ name: localized(128, 1),
15774
+ version: external_exports.string().trim().min(1).max(128),
15775
+ description: localized(4096),
15776
+ details: localized(16384).optional(),
15777
+ author: legacy.author,
15778
+ repository: legacy.repository,
15779
+ icon: legacy.icon.refine((path9) => path9 === void 0 || hostExtensionResourcePathSchema.safeParse(path9).success),
15780
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path9) => hostExtensionResourcePathSchema.safeParse(path9).success)),
15781
+ categories: legacy.categories,
15782
+ settingsSchema: legacy.settingsSchema,
15783
+ slots: legacy.slots.removeDefault().optional(),
15784
+ page: external_exports.strictObject({
15785
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15786
+ entry: moduleEntry,
15787
+ style,
15788
+ title: localized(128, 1).optional()
15789
+ }).optional(),
15790
+ widget: external_exports.strictObject({
15791
+ apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
15792
+ entry: moduleEntry,
15793
+ style
15794
+ }).optional(),
15795
+ desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
15796
+ 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(),
15797
+ backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
15798
+ }).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" });
15799
+ function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
15800
+ if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
15801
+ return ["desktop", "web"];
15802
+ const targets = [];
15803
+ if (hasDesktop)
15804
+ targets.push("desktop");
15805
+ if (hasWeb)
15806
+ targets.push("web");
15807
+ return targets;
15808
+ }
15809
+ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
15810
+
15811
+ // ../../shared-contracts/dist/host-extension-management.js
15812
+ var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
15813
+ var hostExtensionRevisionSchema = external_exports.int().nonnegative();
15814
+ var hostExtensionConfigurationSchema = external_exports.strictObject({
15815
+ revision: hostExtensionRevisionSchema,
15816
+ enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
15817
+ });
15818
+ var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
15819
+ var hostExtensionCatalogEntrySchema = external_exports.object({
15820
+ ...catalogMetadata,
15821
+ id: hostExtensionIdSchema,
15822
+ format: external_exports.literal("codexhost"),
15823
+ targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
15824
+ apis: external_exports.strictObject({
15825
+ page: external_exports.int().positive().optional(),
15826
+ widget: external_exports.int().positive().optional(),
15827
+ desktop: external_exports.int().positive().optional(),
15828
+ web: external_exports.int().positive().optional(),
15829
+ backend: external_exports.int().positive().optional()
15830
+ }),
15831
+ downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
15832
+ }).refine(({ targets, apis }) => {
15833
+ const derived = targetsForCapabilities({
15834
+ hasPage: Boolean(apis.page),
15835
+ hasWidget: Boolean(apis.widget),
15836
+ hasDesktop: Boolean(apis.desktop),
15837
+ hasWeb: Boolean(apis.web),
15838
+ hasBackend: Boolean(apis.backend)
15839
+ });
15840
+ return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
15841
+ }, "Catalog targets must match the declared APIs");
15842
+ var hostExtensionCatalogSchema = external_exports.object({
15843
+ schemaVersion: external_exports.literal(2),
15844
+ generatedAt: external_exports.string().min(1),
15845
+ extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
15846
+ });
15847
+ var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
15848
+ catalogUrl: desktopExtensionHttpUrlSchema,
15849
+ fetchedAt: external_exports.iso.datetime(),
15850
+ cached: external_exports.boolean()
15851
+ });
15852
+ var id = { id: hostExtensionIdSchema };
15853
+ var active = {
15854
+ ...id,
15855
+ activationId: hostExtensionActivationIdSchema,
15856
+ digest: hostExtensionDigestSchema
15857
+ };
15858
+ var optionalActivation = { ...id, activationId: active.activationId.optional() };
15859
+ var filePath = external_exports.string().min(1).max(4096).refine((path9) => /^(?:\/|[a-z]:[/\\])/iu.test(path9) && !path9.includes("\0") && !path9.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
15860
+ 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");
15861
+ function base643(maxBytes) {
15862
+ return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
15863
+ const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
15864
+ return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
15865
+ }, "Expected bounded standard padded base64");
15866
+ }
15867
+ var hostExtensionGitHubSourceSchema = external_exports.strictObject({
15868
+ type: external_exports.literal("github"),
15869
+ repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
15870
+ ref: gitRef.optional(),
15871
+ tag: gitRef.optional(),
15872
+ asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
15873
+ subpath: hostExtensionResourcePathSchema.optional()
15874
+ }).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
15875
+ var hostExtensionInstallSourceSchema = external_exports.union([
15876
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15877
+ hostExtensionGitHubSourceSchema,
15878
+ external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
15879
+ external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
15880
+ external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
15881
+ ]);
15882
+ var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
15883
+ external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
15884
+ hostExtensionGitHubSourceSchema,
15885
+ external_exports.strictObject({ type: external_exports.literal("zip") }),
15886
+ external_exports.strictObject({ type: external_exports.literal("localDir") })
15887
+ ]);
15888
+ var hostExtensionInstallationSchema = external_exports.strictObject({
15889
+ ...active,
15890
+ manifest: hostExtensionManifestV2Schema,
15891
+ installedAt: external_exports.iso.datetime(),
15892
+ source: hostExtensionProvenanceSchema.optional()
15893
+ });
15894
+ 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);
15895
+ var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
15896
+ var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
15897
+ var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
15898
+ hostExtensionInstallationSchema.extend({
15899
+ state: external_exports.literal("valid"),
15900
+ enabled: external_exports.boolean(),
15901
+ ...desktopConflict,
15902
+ iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
15903
+ screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
15904
+ backendState: backendState.optional(),
15905
+ backendError: external_exports.string().optional()
15906
+ }),
15907
+ external_exports.strictObject({
15908
+ state: external_exports.enum(["invalid", "incompatible"]),
15909
+ id: external_exports.string().min(1),
15910
+ enabled: external_exports.boolean(),
15911
+ error: external_exports.string()
15912
+ })
15913
+ ]);
15914
+ var hostExtensionsListResultSchema = external_exports.strictObject({
15915
+ revision: hostExtensionRevisionSchema,
15916
+ configuration: hostExtensionConfigurationSchema,
15917
+ diagnostics: external_exports.array(external_exports.string()),
15918
+ extensions: external_exports.array(hostExtensionListItemSchema)
15919
+ });
15920
+ var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
15921
+ ...desktopConflict,
15922
+ settingsRevision: hostExtensionRevisionSchema
15923
+ });
15924
+ var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
15925
+ /** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
15926
+ revision: hostExtensionRevisionSchema,
15927
+ // Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
15928
+ extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
15929
+ });
15930
+ var HOST_EXTENSIONS_RPC = {
15931
+ list: "codexhost/extensions/list",
15932
+ snapshot: "codexhost/extensions/snapshot",
15933
+ catalog: "codexhost/extensions/catalog",
15934
+ install: "codexhost/extensions/install",
15935
+ update: "codexhost/extensions/update",
15936
+ enable: "codexhost/extensions/enable",
15937
+ disable: "codexhost/extensions/disable",
15938
+ uninstall: "codexhost/extensions/uninstall",
15939
+ recover: "codexhost/extensions/recover",
15940
+ asset: "codexhost/extensions/asset",
15941
+ settingsGet: "codexhost/extensions/settings/get",
15942
+ settingsSet: "codexhost/extensions/settings/set",
15943
+ backendInvoke: "codexhost/extensions/backend/invoke"
15944
+ };
15945
+ var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
15946
+ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
15947
+ var noParams = external_exports.strictObject({});
15948
+ var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
15949
+ var selection = external_exports.strictObject({ ...id, ...expectedRevision });
15950
+ var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
15951
+ var mutationResult = external_exports.discriminatedUnion("state", [
15952
+ external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
15953
+ external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
15954
+ ]);
15955
+ var hostExtensionsAssetParamsSchema = external_exports.strictObject({
15956
+ ...optionalActivation,
15957
+ digest: active.digest.optional(),
15958
+ path: hostExtensionResourcePathSchema
15959
+ });
15960
+ var hostExtensionsAssetResultSchema = external_exports.strictObject({
15961
+ mimeType: external_exports.string().min(1),
15962
+ base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
15963
+ digest: active.digest
15964
+ });
15965
+ var hostExtensionSettingsSchema = external_exports.strictObject({
15966
+ settingsRevision: hostExtensionRevisionSchema,
15967
+ values: jsonObjectSchema
15968
+ });
15969
+ var hostExtensionsRpcSchemas = {
15970
+ [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
15971
+ [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
15972
+ [HOST_EXTENSIONS_RPC.catalog]: {
15973
+ params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
15974
+ result: hostExtensionsCatalogResultSchema
15975
+ },
15976
+ [HOST_EXTENSIONS_RPC.install]: {
15977
+ params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
15978
+ result: installationResult
15979
+ },
15980
+ [HOST_EXTENSIONS_RPC.update]: {
15981
+ params: external_exports.strictObject({
15982
+ ...id,
15983
+ expectedDigest: active.digest,
15984
+ expectedActivationId: active.activationId.optional(),
15985
+ source: hostExtensionInstallSourceSchema.optional()
15986
+ }),
15987
+ result: installationResult
15988
+ },
15989
+ [HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
15990
+ [HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
15991
+ [HOST_EXTENSIONS_RPC.uninstall]: {
15992
+ params: external_exports.strictObject({
15993
+ ...id,
15994
+ removeData: external_exports.boolean().optional(),
15995
+ expectedDigest: active.digest.optional()
15996
+ }),
15997
+ result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
15998
+ },
15999
+ [HOST_EXTENSIONS_RPC.recover]: {
16000
+ params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
16001
+ result: mutationResult
16002
+ },
16003
+ [HOST_EXTENSIONS_RPC.asset]: {
16004
+ params: hostExtensionsAssetParamsSchema,
16005
+ result: hostExtensionsAssetResultSchema
16006
+ },
16007
+ [HOST_EXTENSIONS_RPC.settingsGet]: {
16008
+ params: external_exports.strictObject(optionalActivation),
16009
+ result: hostExtensionSettingsSchema
16010
+ },
16011
+ [HOST_EXTENSIONS_RPC.settingsSet]: {
16012
+ params: external_exports.strictObject({
16013
+ ...optionalActivation,
16014
+ expectedSettingsRevision: hostExtensionRevisionSchema,
16015
+ values: jsonObjectSchema
16016
+ }),
16017
+ result: hostExtensionSettingsSchema
16018
+ },
16019
+ [HOST_EXTENSIONS_RPC.backendInvoke]: {
16020
+ params: external_exports.strictObject({
16021
+ ...optionalActivation,
16022
+ method: hostExtensionBackendMethodSchema,
16023
+ params: jsonValueSchema.optional()
16024
+ }),
16025
+ result: external_exports.strictObject({ result: jsonValueSchema })
16026
+ }
16027
+ };
16028
+
15451
16029
  // ../../shared-contracts/dist/thread-archive-confirm.js
16030
+ var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
15452
16031
  var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15453
16032
  var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15454
16033
 
15455
16034
  // ../../shared-contracts/dist/client-channel.js
15456
16035
  var CLIENT_CHANNEL_VERSION = 1;
15457
16036
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
16037
+ var CLIENT_CHANNEL_METHODS = [
16038
+ "codexhost/skills/list",
16039
+ "codexhost/voice/status",
16040
+ "codexhost/voice/transcribe",
16041
+ "codexhost/harness/display-settings/get",
16042
+ "codexhost/harness/display-settings/set",
16043
+ "codexhost/harness/display-settings/capabilities",
16044
+ "codexhost/harness/preferences/get",
16045
+ "codexhost/harness/preferences/patch",
16046
+ "thread/list",
16047
+ "codexhost/thread/catalog/read",
16048
+ "thread/read",
16049
+ "thread/resume",
16050
+ "thread/fork",
16051
+ "thread/turns/list",
16052
+ "thread/revert",
16053
+ "thread/items/list",
16054
+ "thread/start",
16055
+ "thread/name/set",
16056
+ "codexhost/thread/title/generate",
16057
+ "thread/archive",
16058
+ THREAD_ARCHIVE_CONFIRM_METHOD,
16059
+ "thread/unarchive",
16060
+ "turn/start",
16061
+ "turn/interrupt",
16062
+ "turn/steer",
16063
+ "thread/queue/list",
16064
+ "thread/queue/add",
16065
+ "thread/queue/update",
16066
+ "thread/queue/delete",
16067
+ "thread/queue/reorder",
16068
+ "thread/queue/start",
16069
+ "codexhost/thread/queue/send-now",
16070
+ "codexhost/workspace/read",
16071
+ "codexhost/thread/tree/read",
16072
+ "codexhost/thread/pins/list",
16073
+ "codexhost/thread/pins/set",
16074
+ "codexhost/harness/plugins/list",
16075
+ "codexhost/harness/inspect",
16076
+ "codexhost/thread/inspect",
16077
+ "codexhost/thread/usage/inspect",
16078
+ "codexhost/thread/ownership/list",
16079
+ "codexhost/thread/model/select",
16080
+ "codexhost/thread/thinking/select",
16081
+ "codexhost/thread/permission-mode/select",
16082
+ "codexhost/thread/commands/inspect",
16083
+ "codexhost/harness/commands/inspect",
16084
+ "codexhost/thread/command/execute",
16085
+ "codexhost/thread/fork",
16086
+ "codexhost/harness/session-import/sources",
16087
+ "codexhost/harness/session-import/list",
16088
+ "codexhost/harness/session-import/import",
16089
+ // Host settings shared across Desktop and Web.
16090
+ ...HOST_EXTENSION_MANAGEMENT_METHODS,
16091
+ "codexhost/harness/installation",
16092
+ "codexhost/harness/installation/start",
16093
+ "codexhost/harness/installation/status",
16094
+ "codexhost/harness/launch-settings/get",
16095
+ "codexhost/harness/launch-settings/set",
16096
+ "codexhost/harness/web-ui/open",
16097
+ "codexhost/harness/accounts/sources",
16098
+ "codexhost/harness/accounts/list",
16099
+ "codexhost/harness/accounts/inspect",
16100
+ "codexhost/harness/credential-imports",
16101
+ "codexhost/account/list",
16102
+ "codexhost/account/refresh",
16103
+ "codexhost/account/usage/inspect",
16104
+ "codexhost/usage/model-prices/get",
16105
+ "codexhost/usage/model-prices/set",
16106
+ "codexhost/usage/model-prices/default",
16107
+ "codexhost/usage/statistics/get",
16108
+ "codexhost/update/check",
16109
+ "codexhost/update/start",
16110
+ "codexhost/update/status",
16111
+ "codexhost/sessions/loaded/list"
16112
+ ];
15458
16113
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15459
16114
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15460
16115
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -15493,6 +16148,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15493
16148
  cursor: clientChannelCursorSchema,
15494
16149
  revision: external_exports.number().int().nonnegative()
15495
16150
  }),
16151
+ external_exports.object({
16152
+ type: external_exports.literal("extensions-changed"),
16153
+ cursor: clientChannelCursorSchema,
16154
+ revision: hostExtensionRevisionSchema
16155
+ }),
15496
16156
  external_exports.object({
15497
16157
  type: external_exports.literal("hello"),
15498
16158
  version: external_exports.literal(1),
@@ -15668,6 +16328,29 @@ var threadCatalogReadResultSchema = external_exports.object({
15668
16328
  officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
15669
16329
  }).strict();
15670
16330
 
16331
+ // ../../shared-contracts/dist/thread-tree-watch.js
16332
+ var THREAD_TREE_MAX_NODES = 5e3;
16333
+ var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
16334
+ var threadTreeNodeSchema = external_exports.strictObject({
16335
+ harnessId: harnessIdSchema,
16336
+ title: external_exports.string().optional(),
16337
+ status: threadTreeStatusSchema,
16338
+ archived: external_exports.boolean()
16339
+ });
16340
+ var threadTreeSnapshotSchema = external_exports.strictObject({
16341
+ revision: external_exports.int().nonnegative(),
16342
+ parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
16343
+ nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
16344
+ truncated: external_exports.boolean()
16345
+ }).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");
16346
+ var subscriptionId = external_exports.string().min(1).max(128);
16347
+ var threadTreeWatchParamsSchema = external_exports.strictObject({});
16348
+ var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
16349
+ var threadTreeUnwatchResultSchema = external_exports.strictObject({});
16350
+ var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
16351
+ snapshot: threadTreeSnapshotSchema
16352
+ });
16353
+
15671
16354
  // ../../shared-contracts/dist/voice.js
15672
16355
  var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
15673
16356
  var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
@@ -15906,7 +16589,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
15906
16589
 
15907
16590
  // ../../shared-contracts/dist/harness-preferences.js
15908
16591
  var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
15909
- var preferenceHarnessKey = harnessIdSchema.transform((id) => String(id));
16592
+ var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
15910
16593
  var harnessDefaultConfigurationSchema = external_exports.strictObject({
15911
16594
  model: harnessModelRefSchema.optional(),
15912
16595
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
@@ -15916,11 +16599,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
15916
16599
  lastHarness: harnessIdSchema.optional(),
15917
16600
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
15918
16601
  });
16602
+ var harnessDelegationDefaultSchema = external_exports.strictObject({
16603
+ model: harnessModelRefSchema.optional(),
16604
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional()
16605
+ }).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
16606
+ var delegationDefaultsSchema = external_exports.strictObject({
16607
+ byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
16608
+ });
15919
16609
  var modelId = external_exports.string().min(1).max(1024);
15920
16610
  var harnessPreferenceValuesSchema = external_exports.strictObject({
15921
16611
  idleRelease: idleReleaseSettingsSchema.optional(),
15922
16612
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
15923
- newThread: newThreadDefaultsSchema.optional()
16613
+ newThread: newThreadDefaultsSchema.optional(),
16614
+ delegation: delegationDefaultsSchema.optional()
15924
16615
  });
15925
16616
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
15926
16617
  scope: harnessPreferenceScopeSchema,
@@ -15948,6 +16639,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
15948
16639
  lastHarness: harnessIdSchema.optional(),
15949
16640
  harnessId: harnessIdSchema.optional(),
15950
16641
  configuration: harnessDefaultConfigurationSchema.optional()
16642
+ }),
16643
+ external_exports.strictObject({
16644
+ kind: external_exports.literal("delegation"),
16645
+ harnessId: harnessIdSchema,
16646
+ configuration: harnessDelegationDefaultSchema.nullable()
15951
16647
  })
15952
16648
  ]);
15953
16649
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -16298,13 +16994,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
16298
16994
  });
16299
16995
 
16300
16996
  // ../../shared-contracts/dist/harness-accounts.js
16301
- var accountBalanceSnapshotSchema = external_exports.object({
16302
- amount: external_exports.number().finite().nonnegative(),
16303
- /** ISO 4217 code as reported by the Provider, for example `CNY`. */
16304
- currency: external_exports.string().trim().min(1).max(8),
16305
- /** Native label when the Harness exposes several Billing Sources. */
16306
- label: external_exports.string().trim().min(1).max(128).optional()
16307
- }).strict();
16308
16997
  var harnessAccountSnapshotObject = external_exports.object({
16309
16998
  email: external_exports.string().trim().min(1).max(320).optional(),
16310
16999
  label: external_exports.string().trim().min(1).max(256).optional(),
@@ -16338,76 +17027,6 @@ var harnessAccountListResultSchema = external_exports.object({
16338
17027
  accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
16339
17028
  }).strict();
16340
17029
 
16341
- // ../../shared-contracts/dist/harness-plugins.js
16342
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
16343
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
16344
- var HARNESS_PLUGIN_LIMIT = 128;
16345
- var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
16346
- var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
16347
- 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");
16348
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
16349
- var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
16350
- var harnessInstallationGuideSchema = external_exports.object({
16351
- commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
16352
- before: localizedTextSchema.optional(),
16353
- after: localizedTextSchema.optional(),
16354
- downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
16355
- }).strict();
16356
- var pluginPresentationShape = {
16357
- id: installedHarnessPluginIdSchema,
16358
- name: external_exports.string().trim().min(1).max(128),
16359
- version: external_exports.string().min(1).max(128),
16360
- /** Capability-only plugin; omitted for existing session-capable plugins. */
16361
- kind: external_exports.literal("usage").optional(),
16362
- /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
16363
- iconStyle: external_exports.object({
16364
- vector: external_exports.object({
16365
- viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
16366
- color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
16367
- paths: external_exports.array(external_exports.object({
16368
- d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
16369
- fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
16370
- fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
16371
- }).strict()).min(1).max(32)
16372
- }).strict().optional(),
16373
- background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
16374
- borderRadius: external_exports.number().min(0).max(50).optional(),
16375
- paddingRatio: external_exports.number().min(0).max(0.25).optional()
16376
- }).strict().optional(),
16377
- installation: harnessInstallationGuideSchema.optional(),
16378
- notice: localizedTextSchema.optional(),
16379
- /** The factory accepts a persisted local entrypoint through its construction context. */
16380
- launchCommand: external_exports.literal(true).optional(),
16381
- links: external_exports.object({
16382
- website: documentationUrlSchema.optional(),
16383
- documentation: documentationUrlSchema.optional(),
16384
- installation: documentationUrlSchema.optional()
16385
- }).strict().optional()
16386
- };
16387
- var harnessPluginManifestSchema = external_exports.object({
16388
- manifestVersion: external_exports.literal(1),
16389
- ...pluginPresentationShape,
16390
- adapterApiVersion: external_exports.number().int().positive(),
16391
- entry: relativeResourceSchema,
16392
- icon: relativeResourceSchema.optional()
16393
- }).strict();
16394
- 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);
16395
- var harnessPluginDescriptorSchema = external_exports.object({
16396
- ...pluginPresentationShape,
16397
- icon: harnessPluginIconSchema.optional()
16398
- }).strict();
16399
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
16400
- var harnessPluginListResultSchema = external_exports.object({
16401
- plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
16402
- }).strict();
16403
- var harnessPluginConfigurationSchema = external_exports.object({
16404
- version: external_exports.literal(1),
16405
- enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
16406
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
16407
- message: "Enabled plugin IDs must be unique",
16408
- path: ["enabled"]
16409
- });
16410
-
16411
17030
  // ../../shared-contracts/dist/harness-route.js
16412
17031
  var harnessPluginRouteSchema = external_exports.object({
16413
17032
  harnessId: harnessPluginIdSchema,
@@ -16848,9 +17467,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16848
17467
  ...thread,
16849
17468
  epoch: identity,
16850
17469
  modelId: identity.optional(),
17470
+ serviceTier: harnessModelServiceTierSchema.optional(),
16851
17471
  thinkingOptionId: identity.optional(),
16852
17472
  permissionModeId: identity.optional()
16853
- }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
17473
+ }).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, {
17474
+ message: "A service tier requires a Model ID"
17475
+ }),
16854
17476
  external_exports.strictObject({
16855
17477
  kind: external_exports.literal("prompt"),
16856
17478
  ...thread,
@@ -16900,7 +17522,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16900
17522
  external_exports.strictObject({ action: external_exports.literal("catalog") }),
16901
17523
  external_exports.strictObject({
16902
17524
  action: external_exports.literal("read-thread"),
16903
- hostId: hostId.refine((id) => id !== "local"),
17525
+ hostId: hostId.refine((id2) => id2 !== "local"),
16904
17526
  input: delegationReadParamsSchema
16905
17527
  }),
16906
17528
  external_exports.strictObject({
@@ -16914,7 +17536,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
16914
17536
  external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
16915
17537
  external_exports.strictObject({
16916
17538
  action: external_exports.literal("update"),
16917
- hostId: hostId.refine((id) => id !== "local"),
17539
+ hostId: hostId.refine((id2) => id2 !== "local"),
16918
17540
  version: remoteUpdateParamsSchema.shape.version
16919
17541
  })
16920
17542
  ]);
@@ -17019,7 +17641,7 @@ function invalidRequest(message) {
17019
17641
  return { code: "invalidRequest", message, retryable: false };
17020
17642
  }
17021
17643
  function validateHostApprovalResponse(interaction, response) {
17022
- return interaction.actions.some(({ id }) => id === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
17644
+ return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
17023
17645
  }
17024
17646
 
17025
17647
  // ../../harness-adapter/dist/question.js
@@ -17027,7 +17649,7 @@ function invalidRequest2(message) {
17027
17649
  return { code: "invalidRequest", message, retryable: false };
17028
17650
  }
17029
17651
  function validateHostQuestionResponse(interaction, response) {
17030
- const questionIds = new Set(interaction.questions.map(({ id }) => id));
17652
+ const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
17031
17653
  if (response.cancelled) {
17032
17654
  return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
17033
17655
  }
@@ -17142,7 +17764,8 @@ var tokenFields = [
17142
17764
  var safeIntegerFields = [
17143
17765
  "planFiveHourResetsAtUnix",
17144
17766
  "planSevenDayResetsAtUnix",
17145
- "timeToFirstOutputMs"
17767
+ "timeToFirstOutputMs",
17768
+ "latestRequestTimeToFirstOutputMs"
17146
17769
  ];
17147
17770
  var percentFields = [
17148
17771
  "cacheHitRatePercent",
@@ -17350,7 +17973,7 @@ function isExcludedLiveCommand(name, extra = {}) {
17350
17973
  function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
17351
17974
  if (!commandId.startsWith(idPrefix))
17352
17975
  return null;
17353
- const descriptor = catalog.commands.find(({ id }) => id === commandId);
17976
+ const descriptor = catalog.commands.find(({ id: id2 }) => id2 === commandId);
17354
17977
  if (!descriptor)
17355
17978
  return null;
17356
17979
  const text = typeof argumentText === "string" ? argumentText.trim() : "";
@@ -17360,7 +17983,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17360
17983
  if (!live)
17361
17984
  return builtIns;
17362
17985
  const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
17363
- const ids = new Set(builtIns.commands.map(({ id }) => id));
17986
+ const ids = new Set(builtIns.commands.map(({ id: id2 }) => id2));
17364
17987
  const dynamic = [];
17365
17988
  for (const command of live) {
17366
17989
  const name = command.name.trim().replace(/^\//u, "");
@@ -17369,12 +17992,12 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17369
17992
  if (isExcludedLiveCommand(name, exclusions))
17370
17993
  continue;
17371
17994
  const invocation = `/${name}`;
17372
- const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
17373
- if (invocations.has(invocation) || ids.has(id))
17995
+ const id2 = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
17996
+ if (invocations.has(invocation) || ids.has(id2))
17374
17997
  continue;
17375
17998
  const description = command.description?.trim().slice(0, 512);
17376
17999
  const parsed = harnessCommandDescriptorSchema.safeParse({
17377
- id,
18000
+ id: id2,
17378
18001
  invocation,
17379
18002
  label: name.slice(0, 128),
17380
18003
  ...description ? { description } : {},
@@ -17383,7 +18006,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17383
18006
  if (!parsed.success)
17384
18007
  continue;
17385
18008
  invocations.add(invocation);
17386
- ids.add(id);
18009
+ ids.add(id2);
17387
18010
  dynamic.push(parsed.data);
17388
18011
  }
17389
18012
  return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
@@ -19307,8 +19930,8 @@ var RequestResponder = class {
19307
19930
  signal;
19308
19931
  finishRequest;
19309
19932
  didRespond = false;
19310
- constructor(id, sendResult, signal = new AbortController().signal, finishRequest) {
19311
- this.id = id;
19933
+ constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
19934
+ this.id = id2;
19312
19935
  this.sendResult = sendResult;
19313
19936
  this.signal = signal;
19314
19937
  this.finishRequest = finishRequest;
@@ -19599,7 +20222,7 @@ var Connection = class {
19599
20222
  return this.sendWireMessage({ jsonrpc: "2.0", method, params });
19600
20223
  }
19601
20224
  prepareRequest(method, params, mapResponse, options = {}) {
19602
- const id = this.nextRequestId++;
20225
+ const id2 = this.nextRequestId++;
19603
20226
  let cancel = () => {
19604
20227
  };
19605
20228
  const response = new Promise((resolve, reject) => {
@@ -19619,7 +20242,7 @@ var Connection = class {
19619
20242
  }
19620
20243
  pendingResponse.cancellationSent = true;
19621
20244
  pendingResponse.cleanup?.();
19622
- void this.sendCancelRequest(id).catch(() => {
20245
+ void this.sendCancelRequest(id2).catch(() => {
19623
20246
  });
19624
20247
  };
19625
20248
  options.cancellationSignal?.addEventListener("abort", cancel, {
@@ -19628,12 +20251,12 @@ var Connection = class {
19628
20251
  pendingResponse.cleanup = () => {
19629
20252
  options.cancellationSignal?.removeEventListener("abort", cancel);
19630
20253
  };
19631
- this.pendingResponses.set(id, pendingResponse);
20254
+ this.pendingResponses.set(id2, pendingResponse);
19632
20255
  });
19633
20256
  response.catch(() => {
19634
20257
  });
19635
20258
  return {
19636
- message: { jsonrpc: "2.0", id, method, params },
20259
+ message: { jsonrpc: "2.0", id: id2, method, params },
19637
20260
  response,
19638
20261
  cancel: () => cancel()
19639
20262
  };
@@ -20270,7 +20893,7 @@ function memoryStreamPair() {
20270
20893
  }
20271
20894
  ];
20272
20895
  }
20273
- var methods = {
20896
+ var methods2 = {
20274
20897
  agent: {
20275
20898
  initialize: AGENT_METHODS.initialize,
20276
20899
  authenticate: AGENT_METHODS.authenticate,
@@ -21712,7 +22335,7 @@ function thinkingOptions(values) {
21712
22335
  function kiroThinkingState(configOptions) {
21713
22336
  const option = Array.isArray(configOptions) ? configOptions.find((entry) => isRecord4(entry) && entry.id === "effortLevel") : void 0;
21714
22337
  const availableThinkingOptions = kiroConfigValue(configOptions, "model") === "auto" || !isRecord4(option) ? [] : thinkingOptions(option.options);
21715
- const current = availableThinkingOptions.find(({ id }) => id === kiroConfigValue(configOptions, "effortLevel"));
22338
+ const current = availableThinkingOptions.find(({ id: id2 }) => id2 === kiroConfigValue(configOptions, "effortLevel"));
21716
22339
  return {
21717
22340
  availableThinkingOptions,
21718
22341
  ...current ? { effectiveThinkingOptionId: current.id } : {}
@@ -21748,13 +22371,13 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
21748
22371
  const supported = ref.data.id === "auto" ? [] : ref.data.id === modelConfig.currentValue && currentEffortConfig ? currentThinking.availableThinkingOptions ?? [] : meta3?.hasEffort === false ? [] : thinkingOptions(meta3?.effortLevels);
21749
22372
  for (const effort of supported)
21750
22373
  efforts.set(effort.id, effort);
21751
- if (ref.data.id === modelConfig.currentValue && defaultEffort === void 0 && supported.some(({ id }) => id === meta3?.defaultEffortLevel)) {
22374
+ if (ref.data.id === modelConfig.currentValue && defaultEffort === void 0 && supported.some(({ id: id2 }) => id2 === meta3?.defaultEffortLevel)) {
21752
22375
  defaultEffort = meta3?.defaultEffortLevel;
21753
22376
  }
21754
22377
  models.push({
21755
22378
  ref: ref.data,
21756
22379
  label: name,
21757
- supportedThinkingOptionIds: supported.map(({ id }) => id)
22380
+ supportedThinkingOptionIds: supported.map(({ id: id2 }) => id2)
21758
22381
  });
21759
22382
  }
21760
22383
  if (models.length === 0)
@@ -21777,16 +22400,16 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
21777
22400
  const parsed = harnessModelCatalogSchema.safeParse(catalogCandidate);
21778
22401
  return parsed.success ? parsed.data : fallback;
21779
22402
  }
21780
- function kiroConfigValue(configOptions, id) {
22403
+ function kiroConfigValue(configOptions, id2) {
21781
22404
  if (!Array.isArray(configOptions))
21782
22405
  return void 0;
21783
- const option = configOptions.find((value) => isRecord4(value) && value.id === id);
22406
+ const option = configOptions.find((value) => isRecord4(value) && value.id === id2);
21784
22407
  return isRecord4(option) && nonBlank(option.currentValue) ? option.currentValue : void 0;
21785
22408
  }
21786
- function confirmedKiroConfig(result, id, value) {
22409
+ function confirmedKiroConfig(result, id2, value) {
21787
22410
  const options = isRecord4(result) ? result.configOptions : void 0;
21788
- if (!Array.isArray(options) || kiroConfigValue(options, id) !== value) {
21789
- throw new Error(`Kiro did not confirm ${id}=${value}`);
22411
+ if (!Array.isArray(options) || kiroConfigValue(options, id2) !== value) {
22412
+ throw new Error(`Kiro did not confirm ${id2}=${value}`);
21790
22413
  }
21791
22414
  return options;
21792
22415
  }
@@ -22018,7 +22641,7 @@ var KiroAcpTransport = class {
22018
22641
  }
22019
22642
  if (input.effortLevel !== void 0) {
22020
22643
  const available = kiroThinkingState(configOptions).availableThinkingOptions ?? [];
22021
- if (!available.some(({ id }) => id === input.effortLevel)) {
22644
+ if (!available.some(({ id: id2 }) => id2 === input.effortLevel)) {
22022
22645
  throw new KiroTransportError(available.length === 0 ? "unsupported" : "invalidRequest", "The current Kiro model does not support the requested effort level");
22023
22646
  }
22024
22647
  configOptions = await this.#setConfigOptionOnSession(connection, sessionId, "effortLevel", input.effortLevel);
@@ -22127,15 +22750,15 @@ var KiroAcpTransport = class {
22127
22750
  }
22128
22751
  if (this.#activePrompt)
22129
22752
  throw new Error("Kiro ACP Session already has an active Prompt");
22130
- const active = { onEvent, onPermission, onQuestion };
22131
- this.#activePrompt = active;
22753
+ const active2 = { onEvent, onPermission, onQuestion };
22754
+ this.#activePrompt = active2;
22132
22755
  try {
22133
22756
  return await connection.prompt({
22134
22757
  sessionId: this.#sessionId,
22135
22758
  prompt: [{ type: "text", text }]
22136
22759
  });
22137
22760
  } finally {
22138
- if (this.#activePrompt === active)
22761
+ if (this.#activePrompt === active2)
22139
22762
  this.#activePrompt = null;
22140
22763
  }
22141
22764
  }
@@ -23205,14 +23828,14 @@ function projectKiroPermission(interactionId, turnId, request) {
23205
23828
  }
23206
23829
  const choices = scope === "session" ? resources.slice(0, 1) : resources;
23207
23830
  for (const [index, choice] of choices.entries()) {
23208
- const id = `kiro-consent:${JSON.stringify([option.optionId, scope, index])}`;
23831
+ const id2 = `kiro-consent:${JSON.stringify([option.optionId, scope, index])}`;
23209
23832
  const scopeLabel = scope === "session" ? "this session" : "save for workspace";
23210
23833
  scopedActions.push({
23211
- id,
23834
+ id: id2,
23212
23835
  label: `Allow (${scopeLabel}) - ${choice.label}`,
23213
23836
  effect: scope === "session" ? "allowForSession" : "allowAlways"
23214
23837
  });
23215
- responses.set(id, {
23838
+ responses.set(id2, {
23216
23839
  outcome: { outcome: "selected", optionId: option.optionId },
23217
23840
  _meta: {
23218
23841
  kiro: {
@@ -23582,7 +24205,7 @@ var KiroUsage = class {
23582
24205
  this.context(value);
23583
24206
  if (value.kind === "turn_completion" || value.type === "usage_summary") {
23584
24207
  const ids = value.requestIds;
23585
- const key = Array.isArray(ids) && ids.length > 0 && ids.every((id) => typeof id === "string" && id.length > 0) ? `requests:${JSON.stringify([...new Set(ids)].sort())}` : typeof value.executionId === "string" && value.executionId.length > 0 ? `execution:${value.executionId}` : void 0;
24208
+ const key = Array.isArray(ids) && ids.length > 0 && ids.every((id2) => typeof id2 === "string" && id2.length > 0) ? `requests:${JSON.stringify([...new Set(ids)].sort())}` : typeof value.executionId === "string" && value.executionId.length > 0 ? `execution:${value.executionId}` : void 0;
23586
24209
  if (!key || !Array.isArray(value.promptTurnSummaries))
23587
24210
  return;
23588
24211
  const credits = value.promptTurnSummaries.filter((entry) => isRecord9(entry) && entry.unit === "credit");
@@ -24287,6 +24910,7 @@ var KiroAdapter = class {
24287
24910
  #sessions = /* @__PURE__ */ new Set();
24288
24911
  #inspectionCache = /* @__PURE__ */ new Map();
24289
24912
  #inspectionInFlight = /* @__PURE__ */ new Map();
24913
+ #inspectionTasks = /* @__PURE__ */ new Set();
24290
24914
  constructor(options = {}, deps = {}) {
24291
24915
  this.#options = options;
24292
24916
  this.#deps = deps;
@@ -24295,7 +24919,15 @@ var KiroAdapter = class {
24295
24919
  async inspect(input = {}) {
24296
24920
  const cwd = path8.resolve(input.cwd ?? process.cwd());
24297
24921
  const cached2 = this.#inspectionCache.get(cwd);
24298
- if (!input.refresh && cached2) {
24922
+ if (input.refresh) {
24923
+ this.#inspectionCache.clear();
24924
+ if (cached2)
24925
+ this.#inspectionCache.set(cwd, cached2);
24926
+ const inFlight = this.#inspectionInFlight.get(cwd);
24927
+ this.#inspectionInFlight.clear();
24928
+ if (inFlight)
24929
+ this.#inspectionInFlight.set(cwd, inFlight);
24930
+ } else if (cached2) {
24299
24931
  if (cached2.refreshAfter <= Date.now()) {
24300
24932
  void this.#refreshInspection(cwd).catch(() => void 0);
24301
24933
  }
@@ -24311,6 +24943,8 @@ var KiroAdapter = class {
24311
24943
  if (cached2)
24312
24944
  cached2.refreshAfter = Date.now() + 5 * 6e4;
24313
24945
  const inspection = this.#inspectCwd(cwd).then((result) => {
24946
+ if (this.#inspectionInFlight.get(cwd) !== inspection)
24947
+ return result;
24314
24948
  if (result.status === "ready") {
24315
24949
  const now = Date.now();
24316
24950
  const date5 = new Date(now);
@@ -24324,9 +24958,12 @@ var KiroAdapter = class {
24324
24958
  }
24325
24959
  return result;
24326
24960
  }).finally(() => {
24327
- this.#inspectionInFlight.delete(cwd);
24961
+ this.#inspectionTasks.delete(inspection);
24962
+ if (this.#inspectionInFlight.get(cwd) === inspection)
24963
+ this.#inspectionInFlight.delete(cwd);
24328
24964
  });
24329
24965
  this.#inspectionInFlight.set(cwd, inspection);
24966
+ this.#inspectionTasks.add(inspection);
24330
24967
  return inspection;
24331
24968
  }
24332
24969
  async #inspectCwd(cwd) {
@@ -24609,7 +25246,7 @@ var KiroAdapter = class {
24609
25246
  try {
24610
25247
  await Promise.all([
24611
25248
  this.sessionImport.close(),
24612
- ...this.#inspectionInFlight.values(),
25249
+ ...this.#inspectionTasks,
24613
25250
  ...[...this.#sessions].map((session) => session.close())
24614
25251
  ]);
24615
25252
  } finally {
@@ -24746,9 +25383,9 @@ var KiroSession = class {
24746
25383
  return this.#usageRefresh;
24747
25384
  }
24748
25385
  #subagentItems = /* @__PURE__ */ new Map();
24749
- subagentSnapshot(id) {
24750
- const item = this.#subagentItems.get(id);
24751
- return item ? kiroChildSnapshot(this.#sessionId, item, id) : void 0;
25386
+ subagentSnapshot(id2) {
25387
+ const item = this.#subagentItems.get(id2);
25388
+ return item ? kiroChildSnapshot(this.#sessionId, item, id2) : void 0;
24752
25389
  }
24753
25390
  #subagentEvent(event) {
24754
25391
  const configured = configureSubagentEvent(event, this.#subagentConfiguration());
@@ -25181,7 +25818,7 @@ var KiroSession = class {
25181
25818
  }
25182
25819
  #thinkingSelectionError(value) {
25183
25820
  const available = this.#thinking.availableThinkingOptions ?? [];
25184
- if (available.some(({ id }) => id === value))
25821
+ if (available.some(({ id: id2 }) => id2 === value))
25185
25822
  return void 0;
25186
25823
  return {
25187
25824
  code: available.length === 0 ? "unsupported" : "invalidRequest",