@codexhost/cli-darwin-x64 0.12.1 → 0.13.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 (54) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +8 -0
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +232 -21
  5. package/app/console-web.js +5434 -1092
  6. package/app/desktop-controller.mjs +252 -41
  7. package/app/host-runtime.mjs +5318 -1448
  8. package/app/plugins/antigravity/manifest.json +18 -1
  9. package/app/plugins/antigravity/plugin.mjs +276 -42
  10. package/app/plugins/claude-code/manifest.json +28 -0
  11. package/app/plugins/claude-code/plugin.mjs +1049 -359
  12. package/app/plugins/codebuddy/manifest.json +17 -0
  13. package/app/plugins/codebuddy/plugin.mjs +5931 -5358
  14. package/app/plugins/codex-usage/manifest.json +9 -0
  15. package/app/plugins/codex-usage/plugin.mjs +16703 -0
  16. package/app/plugins/cursor-cli/manifest.json +17 -0
  17. package/app/plugins/cursor-cli/plugin.mjs +351 -77
  18. package/app/plugins/deepseek-harness/assets/icon.svg +1 -0
  19. package/app/plugins/deepseek-harness/manifest.json +35 -2
  20. package/app/plugins/deepseek-harness/plugin.mjs +798 -242
  21. package/app/plugins/enabled.json +2 -1
  22. package/app/plugins/grok/manifest.json +21 -1
  23. package/app/plugins/grok/plugin.mjs +884 -259
  24. package/app/plugins/hermes/assets/icon.png +0 -0
  25. package/app/plugins/hermes/manifest.json +30 -2
  26. package/app/plugins/hermes/plugin.mjs +278 -33
  27. package/app/plugins/kimi-code/assets/icon.svg +5 -0
  28. package/app/plugins/kimi-code/manifest.json +25 -2
  29. package/app/plugins/kimi-code/plugin.mjs +555 -36
  30. package/app/plugins/kiro-cli/assets/kiro-agent.svg +11 -0
  31. package/app/plugins/kiro-cli/manifest.json +18 -1
  32. package/app/plugins/kiro-cli/plugin.mjs +284 -22
  33. package/app/plugins/omp/manifest.json +21 -1
  34. package/app/plugins/omp/plugin.mjs +2737 -1956
  35. package/app/plugins/opencode/manifest.json +18 -1
  36. package/app/plugins/opencode/plugin.mjs +694 -147
  37. package/app/plugins/pi/manifest.json +32 -0
  38. package/app/plugins/pi/plugin.mjs +2809 -2254
  39. package/app/plugins/qoder/manifest.json +18 -1
  40. package/app/plugins/qoder/plugin.mjs +585 -81
  41. package/app/plugins/qoder-cn/manifest.json +18 -1
  42. package/app/plugins/qoder-cn/plugin.mjs +585 -81
  43. package/app/plugins/workbuddy/manifest.json +18 -0
  44. package/app/plugins/workbuddy/plugin.mjs +6317 -5746
  45. package/app/plugins/zcode/manifest.json +19 -1
  46. package/app/plugins/zcode/plugin.mjs +1066 -260
  47. package/app/renderer-extension.js +1999 -1686
  48. package/bin/codexhost +0 -0
  49. package/libexec/codexhost-shim +0 -0
  50. package/libexec/codexhost-updater +0 -0
  51. package/licenses/Cordis-LICENSE.txt +21 -0
  52. package/licenses/Cosmokit-LICENSE.txt +21 -0
  53. package/package.json +1 -1
  54. package/app/plugins/kiro-cli/assets/icon.svg +0 -5
@@ -2220,20 +2220,20 @@ var require_resolve = __commonJS({
2220
2220
  return false;
2221
2221
  }
2222
2222
  function countKeys(schema) {
2223
- let count = 0;
2223
+ let count2 = 0;
2224
2224
  for (const key in schema) {
2225
2225
  if (key === "$ref")
2226
2226
  return Infinity;
2227
- count++;
2227
+ count2++;
2228
2228
  if (SIMPLE_INLINED.has(key))
2229
2229
  continue;
2230
2230
  if (typeof schema[key] == "object") {
2231
- (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch));
2231
+ (0, util_1.eachItem)(schema[key], (sch) => count2 += countKeys(sch));
2232
2232
  }
2233
- if (count === Infinity)
2233
+ if (count2 === Infinity)
2234
2234
  return Infinity;
2235
2235
  }
2236
- return count;
2236
+ return count2;
2237
2237
  }
2238
2238
  function getFullPath(resolver, id = "", normalize) {
2239
2239
  if (normalize !== false)
@@ -5411,8 +5411,8 @@ var require_contains = __commonJS({
5411
5411
  cxt.result(valid, () => cxt.reset());
5412
5412
  function validateItemsWithCount() {
5413
5413
  const schValid = gen.name("_valid");
5414
- const count = gen.let("count", 0);
5415
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
5414
+ const count2 = gen.let("count", 0);
5415
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count2)));
5416
5416
  }
5417
5417
  function validateItems(_valid, block) {
5418
5418
  gen.forRange("i", 0, len, (i) => {
@@ -5425,16 +5425,16 @@ var require_contains = __commonJS({
5425
5425
  block();
5426
5426
  });
5427
5427
  }
5428
- function checkLimits(count) {
5429
- gen.code((0, codegen_1._)`${count}++`);
5428
+ function checkLimits(count2) {
5429
+ gen.code((0, codegen_1._)`${count2}++`);
5430
5430
  if (max === void 0) {
5431
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
5431
+ gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true).break());
5432
5432
  } else {
5433
- gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break());
5433
+ gen.if((0, codegen_1._)`${count2} > ${max}`, () => gen.assign(valid, false).break());
5434
5434
  if (min === 1)
5435
5435
  gen.assign(valid, true);
5436
5436
  else
5437
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
5437
+ gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true));
5438
5438
  }
5439
5439
  }
5440
5440
  }
@@ -8933,20 +8933,20 @@ var require_resolve2 = __commonJS({
8933
8933
  return false;
8934
8934
  }
8935
8935
  function countKeys(schema) {
8936
- let count = 0;
8936
+ let count2 = 0;
8937
8937
  for (const key in schema) {
8938
8938
  if (key === "$ref")
8939
8939
  return Infinity;
8940
- count++;
8940
+ count2++;
8941
8941
  if (SIMPLE_INLINED.has(key))
8942
8942
  continue;
8943
8943
  if (typeof schema[key] == "object") {
8944
- (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch));
8944
+ (0, util_1.eachItem)(schema[key], (sch) => count2 += countKeys(sch));
8945
8945
  }
8946
- if (count === Infinity)
8946
+ if (count2 === Infinity)
8947
8947
  return Infinity;
8948
8948
  }
8949
- return count;
8949
+ return count2;
8950
8950
  }
8951
8951
  function getFullPath(resolver, id = "", normalize) {
8952
8952
  if (normalize !== false)
@@ -11309,8 +11309,8 @@ var require_contains2 = __commonJS({
11309
11309
  cxt.result(valid, () => cxt.reset());
11310
11310
  function validateItemsWithCount() {
11311
11311
  const schValid = gen.name("_valid");
11312
- const count = gen.let("count", 0);
11313
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
11312
+ const count2 = gen.let("count", 0);
11313
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count2)));
11314
11314
  }
11315
11315
  function validateItems(_valid, block) {
11316
11316
  gen.forRange("i", 0, len, (i) => {
@@ -11323,16 +11323,16 @@ var require_contains2 = __commonJS({
11323
11323
  block();
11324
11324
  });
11325
11325
  }
11326
- function checkLimits(count) {
11327
- gen.code((0, codegen_1._)`${count}++`);
11326
+ function checkLimits(count2) {
11327
+ gen.code((0, codegen_1._)`${count2}++`);
11328
11328
  if (max === void 0) {
11329
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
11329
+ gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true).break());
11330
11330
  } else {
11331
- gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break());
11331
+ gen.if((0, codegen_1._)`${count2} > ${max}`, () => gen.assign(valid, false).break());
11332
11332
  if (min === 1)
11333
11333
  gen.assign(valid, true);
11334
11334
  else
11335
- gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
11335
+ gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true));
11336
11336
  }
11337
11337
  }
11338
11338
  }
@@ -12594,6 +12594,11 @@ var require_dist = __commonJS({
12594
12594
  var require_content_type = __commonJS({
12595
12595
  "../../../node_modules/content-type/index.js"(exports) {
12596
12596
  "use strict";
12597
+ /*!
12598
+ * content-type
12599
+ * Copyright(c) 2015 Douglas Christopher Wilson
12600
+ * MIT Licensed
12601
+ */
12597
12602
  var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
12598
12603
  var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
12599
12604
  var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
@@ -17697,8 +17702,8 @@ function az_default() {
17697
17702
  }
17698
17703
 
17699
17704
  // ../../../node_modules/zod/v4/locales/be.js
17700
- function getBelarusianPlural(count, one2, few, many) {
17701
- const absCount = Math.abs(count);
17705
+ function getBelarusianPlural(count2, one2, few, many) {
17706
+ const absCount = Math.abs(count2);
17702
17707
  const lastDigit = absCount % 10;
17703
17708
  const lastTwoDigits = absCount % 100;
17704
17709
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -19776,8 +19781,8 @@ function hu_default() {
19776
19781
  }
19777
19782
 
19778
19783
  // ../../../node_modules/zod/v4/locales/hy.js
19779
- function getArmenianPlural(count, one2, many) {
19780
- return Math.abs(count) === 1 ? one2 : many;
19784
+ function getArmenianPlural(count2, one2, many) {
19785
+ return Math.abs(count2) === 1 ? one2 : many;
19781
19786
  }
19782
19787
  function withDefiniteArticle(word) {
19783
19788
  if (!word)
@@ -21905,8 +21910,8 @@ function ro_default() {
21905
21910
  }
21906
21911
 
21907
21912
  // ../../../node_modules/zod/v4/locales/ru.js
21908
- function getRussianPlural(count, one2, few, many) {
21909
- const absCount = Math.abs(count);
21913
+ function getRussianPlural(count2, one2, few, many) {
21914
+ const absCount = Math.abs(count2);
21910
21915
  const lastDigit = absCount % 10;
21911
21916
  const lastTwoDigits = absCount % 100;
21912
21917
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -27575,6 +27580,15 @@ function date4(params) {
27575
27580
  // ../../../node_modules/zod/v4/classic/external.js
27576
27581
  config(en_default());
27577
27582
 
27583
+ // ../../shared-contracts/dist/delegation-read.js
27584
+ var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
27585
+ var delegationReadParamsSchema = external_exports.strictObject({
27586
+ threadId: external_exports.string().min(1).max(1024),
27587
+ view: external_exports.enum(["result", "messages"]),
27588
+ cursor: external_exports.string().min(1).max(8192).optional(),
27589
+ limit: external_exports.number().int().min(1).max(100).optional()
27590
+ });
27591
+
27578
27592
  // ../../shared-contracts/dist/credential-imports.js
27579
27593
  var credentialSourceSchema = external_exports.object({
27580
27594
  id: external_exports.string().min(1).max(256),
@@ -27645,6 +27659,153 @@ var harnessDisplaySetSchema = external_exports.strictObject({
27645
27659
  initializeOnly: external_exports.boolean().optional()
27646
27660
  });
27647
27661
 
27662
+ // ../../shared-contracts/dist/model-price-overrides.js
27663
+ var usdPerMillionTokens = external_exports.number().finite().nonnegative();
27664
+ var modelPriceOverrideSchema = external_exports.strictObject({
27665
+ input: usdPerMillionTokens,
27666
+ output: usdPerMillionTokens,
27667
+ cacheRead: usdPerMillionTokens.optional(),
27668
+ cacheWrite: usdPerMillionTokens.optional(),
27669
+ cacheWrite1h: usdPerMillionTokens.optional()
27670
+ });
27671
+ var modelPriceKeySchema = external_exports.string().max(512).refine((key) => key.trim() === key && key.length > 0, "Model ID is required");
27672
+ var modelPriceOverridesSchema = external_exports.strictObject({
27673
+ /** Absolute path of the Host's `pricing.json`. */
27674
+ path: external_exports.string(),
27675
+ entries: external_exports.array(external_exports.strictObject({ key: external_exports.string(), price: modelPriceOverrideSchema })),
27676
+ /** Why the existing file is unusable; the Host then ignores it and refuses to overwrite it. */
27677
+ error: external_exports.string().nullable()
27678
+ });
27679
+ var modelPriceOverridesGetSchema = external_exports.strictObject({});
27680
+ var modelPriceOverridesSetSchema = external_exports.strictObject({
27681
+ key: modelPriceKeySchema,
27682
+ price: modelPriceOverrideSchema.nullable(),
27683
+ previousKey: modelPriceKeySchema.optional()
27684
+ });
27685
+ var modelPriceDefaultParamsSchema = external_exports.strictObject({
27686
+ model: modelPriceKeySchema
27687
+ });
27688
+ var modelPriceSuggestionSchema = external_exports.strictObject({
27689
+ /** Verified from catalog canonical links, not inferred from names or equal prices. */
27690
+ official: external_exports.boolean().optional(),
27691
+ canonicalModelId: external_exports.string().min(1).optional(),
27692
+ provider: external_exports.string().min(1).max(512),
27693
+ model: external_exports.string().min(1).max(512),
27694
+ price: modelPriceOverrideSchema
27695
+ });
27696
+ var modelPriceDefaultResultSchema = external_exports.strictObject({
27697
+ price: modelPriceOverrideSchema.nullable(),
27698
+ /** Local catalog suggestions only; never used automatically for pricing. */
27699
+ suggestions: external_exports.array(modelPriceSuggestionSchema).max(6).optional()
27700
+ });
27701
+
27702
+ // ../../shared-contracts/dist/usage-statistics.js
27703
+ var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
27704
+ var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
27705
+ var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
27706
+ var harness = external_exports.string().min(1).max(128);
27707
+ var model = external_exports.string().min(1).max(512);
27708
+ var project = external_exports.string().min(1).max(4096);
27709
+ var usageStatisticsParamsSchema = external_exports.strictObject({
27710
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
27711
+ harness: harness.optional(),
27712
+ model: model.nullable().optional(),
27713
+ project: project.nullable().optional(),
27714
+ /** One local date inside the range. */
27715
+ date: localDate.optional()
27716
+ });
27717
+ var usageStatisticsTotalsSchema = external_exports.strictObject({
27718
+ requests: count,
27719
+ inputTokens: count,
27720
+ cachedInputTokens: count,
27721
+ cacheWriteInputTokens: count,
27722
+ cacheKnownInputTokens: count,
27723
+ outputTokens: count,
27724
+ reasoningOutputTokens: count,
27725
+ /** USD at the public price, summed over the priced requests only. */
27726
+ costUsd: external_exports.number().finite().min(0),
27727
+ /** Requests without a price (or the cache data the price needs); not in `costUsd`. */
27728
+ unpricedRequests: count,
27729
+ /**
27730
+ * Requests whose storage gave no token counts: counted as requests, with neither tokens nor
27731
+ * cost, and not as unpriced.
27732
+ */
27733
+ unmeteredRequests: count
27734
+ });
27735
+ var totals = usageStatisticsTotalsSchema.shape;
27736
+ var usageStatisticsSessionSchema = external_exports.strictObject({
27737
+ harness,
27738
+ sessionId: external_exports.string().min(1).max(512),
27739
+ project: project.nullable(),
27740
+ /** Models the session used, most requests first. */
27741
+ models: external_exports.array(model).max(16),
27742
+ firstAtMs: count,
27743
+ lastAtMs: count,
27744
+ ...totals
27745
+ });
27746
+ var usageStatisticsResultSchema = external_exports.strictObject({
27747
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
27748
+ /** First local date of the range; null for all time. */
27749
+ from: localDate.nullable(),
27750
+ to: localDate,
27751
+ /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
27752
+ filters: external_exports.strictObject({
27753
+ harness: harness.nullable(),
27754
+ model: model.nullable(),
27755
+ unknownModel: external_exports.boolean(),
27756
+ project: project.nullable(),
27757
+ unknownProject: external_exports.boolean(),
27758
+ date: localDate.nullable()
27759
+ }),
27760
+ /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
27761
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
27762
+ /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
27763
+ failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
27764
+ /** Every value seen in the range, ignoring the filters, to choose filters from. */
27765
+ options: external_exports.strictObject({
27766
+ harnesses: external_exports.array(harness).max(256),
27767
+ models: external_exports.array(model.nullable()).max(4096),
27768
+ projects: external_exports.array(project.nullable()).max(4096)
27769
+ }),
27770
+ /** Current display metadata, scoped by Harness. Never a pricing or filter identity.
27771
+ * Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
27772
+ */
27773
+ modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
27774
+ /** Native credits, all filters applied, never combined across Harnesses or treated as USD.
27775
+ * Only groups with at least one reported value appear; reportedRequests exposes partial data.
27776
+ */
27777
+ credits: external_exports.array(external_exports.strictObject({
27778
+ harness,
27779
+ model: model.nullable(),
27780
+ credits: external_exports.number().finite().min(0),
27781
+ reportedRequests: count,
27782
+ requests: count
27783
+ })).max(4096).optional(),
27784
+ /** All filters applied. */
27785
+ totals: usageStatisticsTotalsSchema,
27786
+ /** Each date and Harness of the range: every filter except the day. */
27787
+ daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
27788
+ /** Local weekday (0 = Sunday) and hour, all filters applied. */
27789
+ hourly: external_exports.array(external_exports.strictObject({
27790
+ weekday: external_exports.number().int().min(0).max(6),
27791
+ hour: external_exports.number().int().min(0).max(23),
27792
+ ...totals
27793
+ })).max(168),
27794
+ byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
27795
+ byModel: external_exports.array(external_exports.strictObject({
27796
+ model: model.nullable(),
27797
+ ...totals,
27798
+ /** Requests priced by what the Harness recorded they cost, not by a price list. */
27799
+ harnessPricedRequests: count
27800
+ })).max(4096),
27801
+ byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
27802
+ /**
27803
+ * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
27804
+ * requests without a native session are not listed here but count everywhere else.
27805
+ */
27806
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
27807
+ });
27808
+
27648
27809
  // ../../shared-contracts/dist/ids.js
27649
27810
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
27650
27811
  message: "Identifier must not be empty or whitespace"
@@ -27692,6 +27853,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
27692
27853
  "codexhost/account/list",
27693
27854
  "codexhost/account/refresh",
27694
27855
  "codexhost/account/usage/inspect",
27856
+ "codexhost/usage/model-prices/get",
27857
+ "codexhost/usage/model-prices/set",
27858
+ "codexhost/usage/model-prices/default",
27859
+ "codexhost/usage/statistics/get",
27695
27860
  "codexhost/update/check",
27696
27861
  "codexhost/update/start",
27697
27862
  "codexhost/update/status"
@@ -27756,6 +27921,7 @@ var threadUsageSnapshotSchema = external_exports.object({
27756
27921
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
27757
27922
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
27758
27923
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
27924
+ apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
27759
27925
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
27760
27926
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
27761
27927
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
@@ -27767,7 +27933,11 @@ var threadUsageSnapshotSchema = external_exports.object({
27767
27933
  planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
27768
27934
  planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
27769
27935
  planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
27770
- planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
27936
+ planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
27937
+ sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
27938
+ timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
27939
+ costSource: external_exports.enum(["publicPrice", "native"]).optional(),
27940
+ unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
27771
27941
  }).strict().superRefine((usage, context) => {
27772
27942
  if (Object.keys(usage).length === 0) {
27773
27943
  context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
@@ -27788,6 +27958,20 @@ var threadUsageSnapshotSchema = external_exports.object({
27788
27958
  path: ["contextWindowTokens"]
27789
27959
  });
27790
27960
  }
27961
+ if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
27962
+ context.addIssue({
27963
+ code: "custom",
27964
+ message: "Thread Usage costSource must be provided with totalCostUsd",
27965
+ path: ["costSource"]
27966
+ });
27967
+ }
27968
+ if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
27969
+ context.addIssue({
27970
+ code: "custom",
27971
+ message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
27972
+ path: ["unpricedModels"]
27973
+ });
27974
+ }
27791
27975
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
27792
27976
  context.addIssue({
27793
27977
  code: "custom",
@@ -28042,27 +28226,27 @@ var harnessModelCatalogSchema = external_exports.object({
28042
28226
  }).strict().superRefine((catalog, context) => {
28043
28227
  const refs = /* @__PURE__ */ new Set();
28044
28228
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
28045
- for (const [index, model] of catalog.models.entries()) {
28046
- if (refs.has(model.ref.id)) {
28229
+ for (const [index, model2] of catalog.models.entries()) {
28230
+ if (refs.has(model2.ref.id)) {
28047
28231
  context.addIssue({
28048
28232
  code: "custom",
28049
28233
  message: "Model Catalog refs must be unique",
28050
28234
  path: ["models", index, "ref", "id"]
28051
28235
  });
28052
28236
  }
28053
- refs.add(model.ref.id);
28054
- if (model.fastModel) {
28055
- if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
28237
+ refs.add(model2.ref.id);
28238
+ if (model2.fastModel) {
28239
+ if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
28056
28240
  context.addIssue({
28057
28241
  code: "custom",
28058
28242
  message: "Fast Model refs must be distinct and unique",
28059
28243
  path: ["models", index, "fastModel"]
28060
28244
  });
28061
28245
  }
28062
- refs.add(model.fastModel.id);
28246
+ refs.add(model2.fastModel.id);
28063
28247
  }
28064
28248
  const supportedThinkingIds = /* @__PURE__ */ new Set();
28065
- for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
28249
+ for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
28066
28250
  if (supportedThinkingIds.has(optionId)) {
28067
28251
  context.addIssue({
28068
28252
  code: "custom",
@@ -28256,13 +28440,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
28256
28440
  var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
28257
28441
  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");
28258
28442
  var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
28443
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
28444
+ var harnessInstallationGuideSchema = external_exports.object({
28445
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
28446
+ before: localizedTextSchema.optional(),
28447
+ after: localizedTextSchema.optional(),
28448
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
28449
+ }).strict();
28259
28450
  var pluginPresentationShape = {
28260
28451
  id: harnessPluginIdSchema,
28261
28452
  name: external_exports.string().trim().min(1).max(128),
28262
28453
  version: external_exports.string().min(1).max(128),
28454
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
28455
+ kind: external_exports.literal("usage").optional(),
28456
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
28457
+ iconStyle: external_exports.object({
28458
+ vector: external_exports.object({
28459
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
28460
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
28461
+ paths: external_exports.array(external_exports.object({
28462
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
28463
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
28464
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
28465
+ }).strict()).min(1).max(32)
28466
+ }).strict().optional(),
28467
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
28468
+ borderRadius: external_exports.number().min(0).max(50).optional(),
28469
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
28470
+ }).strict().optional(),
28471
+ installation: harnessInstallationGuideSchema.optional(),
28472
+ notice: localizedTextSchema.optional(),
28263
28473
  /** The factory accepts a persisted local entrypoint through its construction context. */
28264
28474
  launchCommand: external_exports.literal(true).optional(),
28265
28475
  links: external_exports.object({
28476
+ website: documentationUrlSchema.optional(),
28266
28477
  documentation: documentationUrlSchema.optional(),
28267
28478
  installation: documentationUrlSchema.optional()
28268
28479
  }).strict().optional()
@@ -28681,6 +28892,11 @@ var codexSshDraftSchema = external_exports.strictObject({
28681
28892
  });
28682
28893
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
28683
28894
  external_exports.strictObject({ action: external_exports.literal("list") }),
28895
+ external_exports.strictObject({
28896
+ action: external_exports.literal("read-thread"),
28897
+ hostId: hostId.refine((id) => id !== "local"),
28898
+ input: delegationReadParamsSchema
28899
+ }),
28684
28900
  external_exports.strictObject({
28685
28901
  action: external_exports.literal("save"),
28686
28902
  draft: codexSshDraftSchema,
@@ -28829,7 +29045,6 @@ var tokenFields = [
28829
29045
  "cachedInputTokens",
28830
29046
  "cacheWriteInputTokens",
28831
29047
  "outputTokens",
28832
- "outputTokensPerSecond",
28833
29048
  "reasoningOutputTokens",
28834
29049
  "totalTokens",
28835
29050
  "contextWindowTokens",
@@ -28837,10 +29052,12 @@ var tokenFields = [
28837
29052
  ];
28838
29053
  var safeIntegerFields = [
28839
29054
  "planFiveHourResetsAtUnix",
28840
- "planSevenDayResetsAtUnix"
29055
+ "planSevenDayResetsAtUnix",
29056
+ "timeToFirstOutputMs"
28841
29057
  ];
28842
29058
  var percentFields = [
28843
29059
  "cacheHitRatePercent",
29060
+ "sessionCacheHitRatePercent",
28844
29061
  "planFiveHourUsedPercent",
28845
29062
  "planSevenDayUsedPercent"
28846
29063
  ];
@@ -28848,9 +29065,14 @@ var usageFields = /* @__PURE__ */ new Set([
28848
29065
  ...tokenFields,
28849
29066
  ...safeIntegerFields,
28850
29067
  ...percentFields,
29068
+ "sessionCacheUsage",
28851
29069
  "totalCostUsd",
28852
29070
  "totalCredits",
28853
- "contextUsagePercent"
29071
+ "contextUsagePercent",
29072
+ "outputTokensPerSecond",
29073
+ "apiOutputTokensPerSecond",
29074
+ "costSource",
29075
+ "unpricedModels"
28854
29076
  ]);
28855
29077
  function isRecord(value) {
28856
29078
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -28866,7 +29088,11 @@ function parseHostUsage(value) {
28866
29088
  throw new Error(`Harness Usage contains unknown field '${key}'`);
28867
29089
  }
28868
29090
  }
28869
- for (const field of ["totalCredits", "contextUsagePercent"]) {
29091
+ for (const field of [
29092
+ "totalCredits",
29093
+ "contextUsagePercent",
29094
+ "apiOutputTokensPerSecond"
29095
+ ]) {
28870
29096
  const candidate = value[field];
28871
29097
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
28872
29098
  throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
@@ -28896,6 +29122,12 @@ function parseHostUsage(value) {
28896
29122
  throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
28897
29123
  }
28898
29124
  }
29125
+ if (value.sessionCacheUsage !== void 0) {
29126
+ const totals2 = value.sessionCacheUsage;
29127
+ if (!isRecord(totals2) || Object.keys(totals2).some((key) => key !== "inputTokens" && key !== "cachedInputTokens") || typeof totals2.inputTokens !== "number" || !Number.isSafeInteger(totals2.inputTokens) || totals2.inputTokens < 0 || typeof totals2.cachedInputTokens !== "number" || !Number.isSafeInteger(totals2.cachedInputTokens) || totals2.cachedInputTokens < 0 || totals2.cachedInputTokens > totals2.inputTokens) {
29128
+ throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
29129
+ }
29130
+ }
28899
29131
  const hasContextUsed = value.contextUsedTokens !== void 0;
28900
29132
  const hasContextWindow = value.contextWindowTokens !== void 0;
28901
29133
  if (hasContextUsed !== hasContextWindow) {
@@ -28910,8 +29142,43 @@ function parseHostUsage(value) {
28910
29142
  if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
28911
29143
  throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
28912
29144
  }
29145
+ if (value.costSource !== void 0) {
29146
+ if (value.costSource !== "publicPrice" && value.costSource !== "native") {
29147
+ throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
29148
+ }
29149
+ if (value.totalCostUsd === void 0) {
29150
+ throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
29151
+ }
29152
+ }
29153
+ if (value.unpricedModels !== void 0) {
29154
+ const models = value.unpricedModels;
29155
+ if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
29156
+ throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
29157
+ }
29158
+ if (value.costSource !== "publicPrice") {
29159
+ throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
29160
+ }
29161
+ return { ...value, unpricedModels: [...models] };
29162
+ }
28913
29163
  return { ...value };
28914
29164
  }
29165
+ var requestTokenFields = [
29166
+ "inputTokens",
29167
+ "cachedInputTokens",
29168
+ "cacheWriteInputTokens",
29169
+ "cacheWrite1hInputTokens",
29170
+ "outputTokens",
29171
+ "reasoningOutputTokens",
29172
+ "startedAtMs",
29173
+ "completedAtMs"
29174
+ ];
29175
+ var requestFields = /* @__PURE__ */ new Set([
29176
+ ...requestTokenFields,
29177
+ "requestId",
29178
+ "historical",
29179
+ "model",
29180
+ "provider"
29181
+ ]);
28915
29182
 
28916
29183
  // ../../harness-adapter/dist/live-command-catalog.js
28917
29184
  var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
@@ -29653,14 +29920,14 @@ function cursorModels(info) {
29653
29920
  function cursorCatalog(info) {
29654
29921
  const native = cursorModels(info);
29655
29922
  const thinking = /* @__PURE__ */ new Map();
29656
- const models = native.models.map((model) => {
29657
- const config2 = model.value === native.current ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model.value)?.configOptions;
29923
+ const models = native.models.map((model2) => {
29924
+ const config2 = model2.value === native.current ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
29658
29925
  const options = cursorThinking(config2);
29659
29926
  for (const { id, label } of options)
29660
29927
  thinking.set(id, { id, label });
29661
29928
  return {
29662
- ref: cursorConfiguredModelRef(model.value, config2),
29663
- label: model.name,
29929
+ ref: cursorConfiguredModelRef(model2.value, config2),
29930
+ label: model2.name,
29664
29931
  supportedThinkingOptionIds: options.map(({ id }) => id)
29665
29932
  };
29666
29933
  });
@@ -29677,13 +29944,13 @@ function cursorCatalog(info) {
29677
29944
  function parseCursorNativeModels(input) {
29678
29945
  if (!Array.isArray(input.models))
29679
29946
  throw new Error("Cursor returned no parameterized model catalog");
29680
- return input.models.map((model) => {
29681
- if (typeof model !== "object" || model === null || !("value" in model) || !("name" in model) || !("configOptions" in model) || typeof model.value !== "string" || typeof model.name !== "string" || !Array.isArray(model.configOptions))
29947
+ return input.models.map((model2) => {
29948
+ if (typeof model2 !== "object" || model2 === null || !("value" in model2) || !("name" in model2) || !("configOptions" in model2) || typeof model2.value !== "string" || typeof model2.name !== "string" || !Array.isArray(model2.configOptions))
29682
29949
  throw new Error("Invalid Cursor model metadata");
29683
29950
  return {
29684
- value: model.value,
29685
- name: model.name,
29686
- configOptions: model.configOptions.map((option) => {
29951
+ value: model2.value,
29952
+ name: model2.name,
29953
+ configOptions: model2.configOptions.map((option) => {
29687
29954
  if (typeof option !== "object" || option === null || !("id" in option) || !("name" in option) || !("type" in option) || !("currentValue" in option) || !("options" in option) || typeof option.id !== "string" || typeof option.name !== "string" || option.type !== "select" || typeof option.currentValue !== "string" || !Array.isArray(option.options))
29688
29955
  throw new Error("Invalid Cursor parameter metadata");
29689
29956
  const entries = option.options.map((entry) => {
@@ -29704,7 +29971,7 @@ function parseCursorNativeModels(input) {
29704
29971
  });
29705
29972
  }
29706
29973
  function cursorModelSelection(info, ref) {
29707
- const exact = cursorModels(info).models.find((model2) => cursorModelRef(model2.value).id === ref);
29974
+ const exact = cursorModels(info).models.find((model3) => cursorModelRef(model3.value).id === ref);
29708
29975
  if (exact)
29709
29976
  return [["model", exact.value]];
29710
29977
  if (!ref.startsWith("cursor."))
@@ -29713,8 +29980,8 @@ function cursorModelSelection(info, ref) {
29713
29980
  if (cursorModelRef(decoded).id !== ref)
29714
29981
  throw new Error("Invalid Cursor model reference");
29715
29982
  const match = /^([^\[\]]+)\[([^\[\]]*)\]$/u.exec(decoded);
29716
- const model = match && info.nativeModels?.find((entry) => entry.value === match[1]);
29717
- if (!match || !model)
29983
+ const model2 = match && info.nativeModels?.find((entry) => entry.value === match[1]);
29984
+ if (!match || !model2)
29718
29985
  throw new Error("Model is not in this Cursor session's native catalog");
29719
29986
  const parameters = [];
29720
29987
  for (const parameter of match[2] ? match[2].split(",") : []) {
@@ -29722,12 +29989,12 @@ function cursorModelSelection(info, ref) {
29722
29989
  const [id, value] = pair;
29723
29990
  if (pair.length !== 2 || !id || value === void 0 || parameters.some(([key]) => key === id))
29724
29991
  throw new Error("Invalid Cursor model parameters");
29725
- const option = model.configOptions.find((option2) => option2.id === id);
29992
+ const option = model2.configOptions.find((option2) => option2.id === id);
29726
29993
  if (!option || option.type !== "select" || !option.options.flatMap((entry) => "value" in entry ? [entry] : entry.options).some((entry) => entry.value === value))
29727
29994
  throw new Error("Legacy Cursor model parameter is not selectable in the native catalog");
29728
29995
  parameters.push([id, value]);
29729
29996
  }
29730
- return [["model", model.value], ...parameters];
29997
+ return [["model", model2.value], ...parameters];
29731
29998
  }
29732
29999
  function cursorCapabilities(info) {
29733
30000
  return {
@@ -29738,9 +30005,9 @@ function cursorCapabilities(info) {
29738
30005
  }
29739
30006
  };
29740
30007
  }
29741
- function cursorConfiguredModelRef(model, options) {
30008
+ function cursorConfiguredModelRef(model2, options) {
29742
30009
  const parameters = (options ?? []).flatMap((option) => option.category === "model_config" && option.type === "select" ? [`${option.id}=${option.currentValue}`] : []);
29743
- return cursorModelRef(parameters.length ? `${model}[${parameters.join(",")}]` : model);
30010
+ return cursorModelRef(parameters.length ? `${model2}[${parameters.join(",")}]` : model2);
29744
30011
  }
29745
30012
 
29746
30013
  // dist/transport.js
@@ -32030,9 +32297,9 @@ var Connection = class {
32030
32297
  return;
32031
32298
  }
32032
32299
  const responseBatch = isResponseBatch(batch);
32033
- const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
32300
+ const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
32034
32301
  let remaining = responseCount;
32035
- let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
32302
+ let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
32036
32303
  let responseSent = false;
32037
32304
  const responses = [];
32038
32305
  const sendResponsesIfReady = async () => {
@@ -45337,7 +45604,7 @@ async function createCursorDelegationBridge(cwd, environment, commandTimeoutMs =
45337
45604
  server.registerTool("harness_inspect", {
45338
45605
  description: "Read a Harness's native Models and Thinking choices. Use opaque IDs only when explicitly selecting; omission retains native defaults.",
45339
45606
  inputSchema: { harness: text, cwd: text.optional() }
45340
- }, ({ harness, cwd: cwd2 }) => run(["harness", "inspect", harness, ...optional2("--cwd", cwd2)]));
45607
+ }, ({ harness: harness2, cwd: cwd2 }) => run(["harness", "inspect", harness2, ...optional2("--cwd", cwd2)]));
45341
45608
  server.registerTool("delegate_start", {
45342
45609
  description: "Start an independent task in another Harness when the user requests delegation. Returns immediately with a task link; use thread_wait for completion. Parent attribution and credentials come from this Cursor session. Do not delegate to Cursor: unattended inbound Cursor tasks are unsupported.",
45343
45610
  inputSchema: {
@@ -45348,15 +45615,15 @@ async function createCursorDelegationBridge(cwd, environment, commandTimeoutMs =
45348
45615
  thinking: text.optional(),
45349
45616
  requestId: text.optional()
45350
45617
  }
45351
- }, ({ harness, task, cwd: cwd2, model, thinking, requestId }) => run([
45618
+ }, ({ harness: harness2, task, cwd: cwd2, model: model2, thinking, requestId }) => run([
45352
45619
  "delegate",
45353
45620
  "start",
45354
45621
  "--harness",
45355
- harness,
45622
+ harness2,
45356
45623
  "--task",
45357
45624
  task,
45358
45625
  ...optional2("--cwd", cwd2),
45359
- ...optional2("--model", model),
45626
+ ...optional2("--model", model2),
45360
45627
  ...optional2("--thinking", thinking),
45361
45628
  ...optional2("--request-id", requestId)
45362
45629
  ]));
@@ -45581,7 +45848,7 @@ var CursorTransport = class {
45581
45848
  return info;
45582
45849
  const modelOption = info.configOptions?.find((option) => option.id === "model");
45583
45850
  const available = modelOption?.type === "select" ? modelOption.options.flatMap((entry) => "value" in entry ? [entry] : entry.options) : void 0;
45584
- if (this.cachedModels?.length && available?.length === this.cachedModels.length && available.every((model) => this.cachedModels?.some((cached2) => cached2.value === model.value && cached2.name === model.name)))
45851
+ if (this.cachedModels?.length && available?.length === this.cachedModels.length && available.every((model2) => this.cachedModels?.some((cached2) => cached2.value === model2.value && cached2.name === model2.name)))
45585
45852
  return { ...info, nativeModels: structuredClone(this.cachedModels) };
45586
45853
  try {
45587
45854
  const models = await this.#bounded(this.#connection.extMethod("cursor/list_available_models", {}));
@@ -46378,7 +46645,13 @@ var CursorTurnOutput = class {
46378
46645
  constructor(turnId, emit, nativeTurnIndex = 0) {
46379
46646
  this.turnId = turnId;
46380
46647
  this.emit = emit;
46381
- this.subagents = new CursorSubagents(turnId, emit, nativeTurnIndex);
46648
+ this.subagents = new CursorSubagents(turnId, (event) => {
46649
+ if (event.type === "item.started") {
46650
+ this.#flushHold();
46651
+ this.#finishText();
46652
+ }
46653
+ emit(event);
46654
+ }, nativeTurnIndex);
46382
46655
  }
46383
46656
  sawWritableIterableClosed() {
46384
46657
  return this.#writableIterableClosed || takeCursorWritableIterableClosed(this.#hold).closed;
@@ -46428,11 +46701,8 @@ var CursorTurnOutput = class {
46428
46701
  this.#text = void 0;
46429
46702
  }
46430
46703
  update(notification) {
46431
- if (this.subagents.update(notification)) {
46432
- this.#flushHold();
46433
- this.#finishText();
46704
+ if (this.subagents.update(notification))
46434
46705
  return;
46435
- }
46436
46706
  const { update } = notification;
46437
46707
  if (update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "agent_thought_chunk") {
46438
46708
  if (update.content.type !== "text")
@@ -46448,12 +46718,12 @@ var CursorTurnOutput = class {
46448
46718
  this.#hold = hold;
46449
46719
  this.#appendText(type, emit);
46450
46720
  } else if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
46451
- this.#flushHold();
46452
- this.#finishText();
46453
46721
  if (this.#finishedTools.has(update.toolCallId))
46454
46722
  return;
46455
46723
  let tool = this.#tools.get(update.toolCallId);
46456
46724
  if (!tool) {
46725
+ this.#flushHold();
46726
+ this.#finishText();
46457
46727
  const args = jsonValueSchema.safeParse(update.rawInput ?? {});
46458
46728
  const item2 = {
46459
46729
  type: "toolExecution",
@@ -47253,7 +47523,7 @@ var CursorAdapter = class {
47253
47523
  throw staged.reason;
47254
47524
  if (!derived)
47255
47525
  throw new Error("Cursor native fork did not return a target");
47256
- const model = input.kind === "rollbackLastTurn" ? input.model ?? source?.initialState.effectiveModel : source?.initialState.effectiveModel;
47526
+ const model2 = input.kind === "rollbackLastTurn" ? input.model ?? source?.initialState.effectiveModel : source?.initialState.effectiveModel;
47257
47527
  const thinking = input.kind === "rollbackLastTurn" ? input.thinkingOptionId ?? source?.initialState.effectiveThinkingOptionId : source?.initialState.effectiveThinkingOptionId;
47258
47528
  const mode = input.kind === "rollbackLastTurn" ? input.permissionModeId ?? source?.initialState.effectivePermissionModeId : source?.initialState.effectivePermissionModeId;
47259
47529
  const opened = await this.#openSession({
@@ -47261,7 +47531,7 @@ var CursorAdapter = class {
47261
47531
  cwd: input.cwd,
47262
47532
  environment: options.environment,
47263
47533
  nativeRef: cursorNativeSessionRef(derived.sessionId, executionPolicy),
47264
- ...model ? { model } : {},
47534
+ ...model2 ? { model: model2 } : {},
47265
47535
  ...thinking ? { thinkingOptionId: thinking } : {},
47266
47536
  ...mode ? { permissionModeId: mode } : {}
47267
47537
  }, transport);
@@ -47477,9 +47747,9 @@ var CursorSession = class {
47477
47747
  if (!result.configOptions.some((option) => option.id === configId && option.currentValue === value))
47478
47748
  throw new Error("Cursor did not confirm configuration selection");
47479
47749
  this.info.configOptions = result.configOptions;
47480
- const model = result.configOptions.find((option) => option.id === "model");
47481
- if (model?.type === "select")
47482
- this.initialState.effectiveModel = cursorConfiguredModelRef(model.currentValue, result.configOptions);
47750
+ const model2 = result.configOptions.find((option) => option.id === "model");
47751
+ if (model2?.type === "select")
47752
+ this.initialState.effectiveModel = cursorConfiguredModelRef(model2.currentValue, result.configOptions);
47483
47753
  const mode = result.configOptions.find((option) => option.id === "mode");
47484
47754
  if (mode)
47485
47755
  this.initialState.effectivePermissionModeId = harnessPermissionModeIdSchema.parse(mode.currentValue);
@@ -47902,6 +48172,8 @@ var harnessSessionStateSchema = external_exports.custom((value) => {
47902
48172
  var eventKeys = /* @__PURE__ */ new Map([
47903
48173
  ["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
47904
48174
  ["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
48175
+ ["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
48176
+ ["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
47905
48177
  ["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
47906
48178
  ["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
47907
48179
  ["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
@@ -47950,6 +48222,8 @@ var harnessOutputSchema = external_exports.custom((value) => {
47950
48222
  return harnessSessionStateSchema.safeParse(event.state).success;
47951
48223
  if (event.type === "session.faulted")
47952
48224
  return harnessErrorSchema.safeParse(event.error).success;
48225
+ if (event.type === "usage.history")
48226
+ return typeof event.complete === "boolean";
47953
48227
  return true;
47954
48228
  }
47955
48229
  if (output.kind === "interaction") {