@codexhost/cli-darwin-x64 0.12.2 → 0.13.1

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 +9 -1
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +319 -64
  5. package/app/console-web.js +5089 -1367
  6. package/app/desktop-controller.mjs +259 -41
  7. package/app/host-runtime.mjs +5735 -1564
  8. package/app/plugins/antigravity/manifest.json +18 -1
  9. package/app/plugins/antigravity/plugin.mjs +282 -41
  10. package/app/plugins/claude-code/manifest.json +28 -0
  11. package/app/plugins/claude-code/plugin.mjs +35300 -23918
  12. package/app/plugins/codebuddy/manifest.json +17 -0
  13. package/app/plugins/codebuddy/plugin.mjs +5971 -5355
  14. package/app/plugins/codex-usage/manifest.json +9 -0
  15. package/app/plugins/codex-usage/plugin.mjs +17324 -0
  16. package/app/plugins/cursor-cli/manifest.json +17 -0
  17. package/app/plugins/cursor-cli/plugin.mjs +357 -76
  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 +822 -241
  21. package/app/plugins/enabled.json +2 -1
  22. package/app/plugins/grok/manifest.json +21 -1
  23. package/app/plugins/grok/plugin.mjs +918 -258
  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 +284 -32
  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 +561 -35
  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 +290 -21
  33. package/app/plugins/omp/manifest.json +21 -1
  34. package/app/plugins/omp/plugin.mjs +2765 -1960
  35. package/app/plugins/opencode/manifest.json +18 -1
  36. package/app/plugins/opencode/plugin.mjs +723 -146
  37. package/app/plugins/pi/manifest.json +32 -0
  38. package/app/plugins/pi/plugin.mjs +2908 -2312
  39. package/app/plugins/qoder/manifest.json +18 -1
  40. package/app/plugins/qoder/plugin.mjs +634 -80
  41. package/app/plugins/qoder-cn/manifest.json +18 -1
  42. package/app/plugins/qoder-cn/plugin.mjs +634 -80
  43. package/app/plugins/workbuddy/manifest.json +18 -0
  44. package/app/plugins/workbuddy/plugin.mjs +6361 -5747
  45. package/app/plugins/zcode/manifest.json +19 -1
  46. package/app/plugins/zcode/plugin.mjs +1098 -259
  47. package/app/renderer-extension.js +13080 -8884
  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,160 @@ 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
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
27741
+ title: external_exports.string().min(1).max(200).optional(),
27742
+ /** Models the session used, most requests first. */
27743
+ models: external_exports.array(model).max(16),
27744
+ firstAtMs: count,
27745
+ lastAtMs: count,
27746
+ ...totals
27747
+ });
27748
+ var usageStatisticsResultSchema = external_exports.strictObject({
27749
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
27750
+ /** First local date of the range; null for all time. */
27751
+ from: localDate.nullable(),
27752
+ to: localDate,
27753
+ /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
27754
+ filters: external_exports.strictObject({
27755
+ harness: harness.nullable(),
27756
+ model: model.nullable(),
27757
+ unknownModel: external_exports.boolean(),
27758
+ project: project.nullable(),
27759
+ unknownProject: external_exports.boolean(),
27760
+ date: localDate.nullable()
27761
+ }),
27762
+ /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
27763
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
27764
+ /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
27765
+ failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
27766
+ /** Every value seen in the range, ignoring the filters, to choose filters from. */
27767
+ options: external_exports.strictObject({
27768
+ harnesses: external_exports.array(harness).max(256),
27769
+ models: external_exports.array(model.nullable()).max(4096),
27770
+ projects: external_exports.array(project.nullable()).max(4096)
27771
+ }),
27772
+ /** Current display metadata, scoped by Harness. Never a pricing or filter identity.
27773
+ * Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
27774
+ */
27775
+ modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
27776
+ /** Native credits, all filters applied, never combined across Harnesses or treated as USD.
27777
+ * Only groups with at least one reported value appear; reportedRequests exposes partial data.
27778
+ */
27779
+ credits: external_exports.array(external_exports.strictObject({
27780
+ harness,
27781
+ model: model.nullable(),
27782
+ credits: external_exports.number().finite().min(0),
27783
+ reportedRequests: count,
27784
+ requests: count
27785
+ })).max(4096).optional(),
27786
+ /** All filters applied. */
27787
+ totals: usageStatisticsTotalsSchema,
27788
+ /** Each date and Harness of the range: every filter except the day. */
27789
+ daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
27790
+ /** Local weekday (0 = Sunday) and hour, all filters applied. */
27791
+ hourly: external_exports.array(external_exports.strictObject({
27792
+ weekday: external_exports.number().int().min(0).max(6),
27793
+ hour: external_exports.number().int().min(0).max(23),
27794
+ ...totals
27795
+ })).max(168),
27796
+ byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
27797
+ byModel: external_exports.array(external_exports.strictObject({
27798
+ model: model.nullable(),
27799
+ ...totals,
27800
+ /** Requests priced by what the Harness recorded they cost, not by a price list. */
27801
+ harnessPricedRequests: count
27802
+ })).max(4096),
27803
+ byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
27804
+ /**
27805
+ * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
27806
+ * requests without a native session are not listed here but count everywhere else.
27807
+ */
27808
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
27809
+ /**
27810
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
27811
+ * Hosts; missing is treated as no list rather than no sessions.
27812
+ */
27813
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
27814
+ });
27815
+
27648
27816
  // ../../shared-contracts/dist/ids.js
27649
27817
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
27650
27818
  message: "Identifier must not be empty or whitespace"
@@ -27692,6 +27860,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
27692
27860
  "codexhost/account/list",
27693
27861
  "codexhost/account/refresh",
27694
27862
  "codexhost/account/usage/inspect",
27863
+ "codexhost/usage/model-prices/get",
27864
+ "codexhost/usage/model-prices/set",
27865
+ "codexhost/usage/model-prices/default",
27866
+ "codexhost/usage/statistics/get",
27695
27867
  "codexhost/update/check",
27696
27868
  "codexhost/update/start",
27697
27869
  "codexhost/update/status"
@@ -27756,6 +27928,7 @@ var threadUsageSnapshotSchema = external_exports.object({
27756
27928
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
27757
27929
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
27758
27930
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
27931
+ apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
27759
27932
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
27760
27933
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
27761
27934
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
@@ -27767,7 +27940,11 @@ var threadUsageSnapshotSchema = external_exports.object({
27767
27940
  planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
27768
27941
  planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
27769
27942
  planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
27770
- planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
27943
+ planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
27944
+ sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
27945
+ timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
27946
+ costSource: external_exports.enum(["publicPrice", "native"]).optional(),
27947
+ unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
27771
27948
  }).strict().superRefine((usage, context) => {
27772
27949
  if (Object.keys(usage).length === 0) {
27773
27950
  context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
@@ -27788,6 +27965,20 @@ var threadUsageSnapshotSchema = external_exports.object({
27788
27965
  path: ["contextWindowTokens"]
27789
27966
  });
27790
27967
  }
27968
+ if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
27969
+ context.addIssue({
27970
+ code: "custom",
27971
+ message: "Thread Usage costSource must be provided with totalCostUsd",
27972
+ path: ["costSource"]
27973
+ });
27974
+ }
27975
+ if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
27976
+ context.addIssue({
27977
+ code: "custom",
27978
+ message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
27979
+ path: ["unpricedModels"]
27980
+ });
27981
+ }
27791
27982
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
27792
27983
  context.addIssue({
27793
27984
  code: "custom",
@@ -28042,27 +28233,27 @@ var harnessModelCatalogSchema = external_exports.object({
28042
28233
  }).strict().superRefine((catalog, context) => {
28043
28234
  const refs = /* @__PURE__ */ new Set();
28044
28235
  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)) {
28236
+ for (const [index, model2] of catalog.models.entries()) {
28237
+ if (refs.has(model2.ref.id)) {
28047
28238
  context.addIssue({
28048
28239
  code: "custom",
28049
28240
  message: "Model Catalog refs must be unique",
28050
28241
  path: ["models", index, "ref", "id"]
28051
28242
  });
28052
28243
  }
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)) {
28244
+ refs.add(model2.ref.id);
28245
+ if (model2.fastModel) {
28246
+ if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
28056
28247
  context.addIssue({
28057
28248
  code: "custom",
28058
28249
  message: "Fast Model refs must be distinct and unique",
28059
28250
  path: ["models", index, "fastModel"]
28060
28251
  });
28061
28252
  }
28062
- refs.add(model.fastModel.id);
28253
+ refs.add(model2.fastModel.id);
28063
28254
  }
28064
28255
  const supportedThinkingIds = /* @__PURE__ */ new Set();
28065
- for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
28256
+ for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
28066
28257
  if (supportedThinkingIds.has(optionId)) {
28067
28258
  context.addIssue({
28068
28259
  code: "custom",
@@ -28256,13 +28447,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
28256
28447
  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
28448
  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
28449
  var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
28450
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
28451
+ var harnessInstallationGuideSchema = external_exports.object({
28452
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
28453
+ before: localizedTextSchema.optional(),
28454
+ after: localizedTextSchema.optional(),
28455
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
28456
+ }).strict();
28259
28457
  var pluginPresentationShape = {
28260
28458
  id: harnessPluginIdSchema,
28261
28459
  name: external_exports.string().trim().min(1).max(128),
28262
28460
  version: external_exports.string().min(1).max(128),
28461
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
28462
+ kind: external_exports.literal("usage").optional(),
28463
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
28464
+ iconStyle: external_exports.object({
28465
+ vector: external_exports.object({
28466
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
28467
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
28468
+ paths: external_exports.array(external_exports.object({
28469
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
28470
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
28471
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
28472
+ }).strict()).min(1).max(32)
28473
+ }).strict().optional(),
28474
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
28475
+ borderRadius: external_exports.number().min(0).max(50).optional(),
28476
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
28477
+ }).strict().optional(),
28478
+ installation: harnessInstallationGuideSchema.optional(),
28479
+ notice: localizedTextSchema.optional(),
28263
28480
  /** The factory accepts a persisted local entrypoint through its construction context. */
28264
28481
  launchCommand: external_exports.literal(true).optional(),
28265
28482
  links: external_exports.object({
28483
+ website: documentationUrlSchema.optional(),
28266
28484
  documentation: documentationUrlSchema.optional(),
28267
28485
  installation: documentationUrlSchema.optional()
28268
28486
  }).strict().optional()
@@ -28681,6 +28899,11 @@ var codexSshDraftSchema = external_exports.strictObject({
28681
28899
  });
28682
28900
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
28683
28901
  external_exports.strictObject({ action: external_exports.literal("list") }),
28902
+ external_exports.strictObject({
28903
+ action: external_exports.literal("read-thread"),
28904
+ hostId: hostId.refine((id) => id !== "local"),
28905
+ input: delegationReadParamsSchema
28906
+ }),
28684
28907
  external_exports.strictObject({
28685
28908
  action: external_exports.literal("save"),
28686
28909
  draft: codexSshDraftSchema,
@@ -28836,10 +29059,12 @@ var tokenFields = [
28836
29059
  ];
28837
29060
  var safeIntegerFields = [
28838
29061
  "planFiveHourResetsAtUnix",
28839
- "planSevenDayResetsAtUnix"
29062
+ "planSevenDayResetsAtUnix",
29063
+ "timeToFirstOutputMs"
28840
29064
  ];
28841
29065
  var percentFields = [
28842
29066
  "cacheHitRatePercent",
29067
+ "sessionCacheHitRatePercent",
28843
29068
  "planFiveHourUsedPercent",
28844
29069
  "planSevenDayUsedPercent"
28845
29070
  ];
@@ -28847,10 +29072,14 @@ var usageFields = /* @__PURE__ */ new Set([
28847
29072
  ...tokenFields,
28848
29073
  ...safeIntegerFields,
28849
29074
  ...percentFields,
29075
+ "sessionCacheUsage",
28850
29076
  "totalCostUsd",
28851
29077
  "totalCredits",
28852
29078
  "contextUsagePercent",
28853
- "outputTokensPerSecond"
29079
+ "outputTokensPerSecond",
29080
+ "apiOutputTokensPerSecond",
29081
+ "costSource",
29082
+ "unpricedModels"
28854
29083
  ]);
28855
29084
  function isRecord(value) {
28856
29085
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -28866,7 +29095,11 @@ function parseHostUsage(value) {
28866
29095
  throw new Error(`Harness Usage contains unknown field '${key}'`);
28867
29096
  }
28868
29097
  }
28869
- for (const field of ["totalCredits", "contextUsagePercent"]) {
29098
+ for (const field of [
29099
+ "totalCredits",
29100
+ "contextUsagePercent",
29101
+ "apiOutputTokensPerSecond"
29102
+ ]) {
28870
29103
  const candidate = value[field];
28871
29104
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
28872
29105
  throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
@@ -28896,6 +29129,12 @@ function parseHostUsage(value) {
28896
29129
  throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
28897
29130
  }
28898
29131
  }
29132
+ if (value.sessionCacheUsage !== void 0) {
29133
+ const totals2 = value.sessionCacheUsage;
29134
+ 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) {
29135
+ throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
29136
+ }
29137
+ }
28899
29138
  const hasContextUsed = value.contextUsedTokens !== void 0;
28900
29139
  const hasContextWindow = value.contextWindowTokens !== void 0;
28901
29140
  if (hasContextUsed !== hasContextWindow) {
@@ -28910,8 +29149,43 @@ function parseHostUsage(value) {
28910
29149
  if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
28911
29150
  throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
28912
29151
  }
29152
+ if (value.costSource !== void 0) {
29153
+ if (value.costSource !== "publicPrice" && value.costSource !== "native") {
29154
+ throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
29155
+ }
29156
+ if (value.totalCostUsd === void 0) {
29157
+ throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
29158
+ }
29159
+ }
29160
+ if (value.unpricedModels !== void 0) {
29161
+ const models = value.unpricedModels;
29162
+ if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
29163
+ throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
29164
+ }
29165
+ if (value.costSource !== "publicPrice") {
29166
+ throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
29167
+ }
29168
+ return { ...value, unpricedModels: [...models] };
29169
+ }
28913
29170
  return { ...value };
28914
29171
  }
29172
+ var requestTokenFields = [
29173
+ "inputTokens",
29174
+ "cachedInputTokens",
29175
+ "cacheWriteInputTokens",
29176
+ "cacheWrite1hInputTokens",
29177
+ "outputTokens",
29178
+ "reasoningOutputTokens",
29179
+ "startedAtMs",
29180
+ "completedAtMs"
29181
+ ];
29182
+ var requestFields = /* @__PURE__ */ new Set([
29183
+ ...requestTokenFields,
29184
+ "requestId",
29185
+ "historical",
29186
+ "model",
29187
+ "provider"
29188
+ ]);
28915
29189
 
28916
29190
  // ../../harness-adapter/dist/live-command-catalog.js
28917
29191
  var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
@@ -29653,14 +29927,14 @@ function cursorModels(info) {
29653
29927
  function cursorCatalog(info) {
29654
29928
  const native = cursorModels(info);
29655
29929
  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;
29930
+ const models = native.models.map((model2) => {
29931
+ const config2 = model2.value === native.current ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
29658
29932
  const options = cursorThinking(config2);
29659
29933
  for (const { id, label } of options)
29660
29934
  thinking.set(id, { id, label });
29661
29935
  return {
29662
- ref: cursorConfiguredModelRef(model.value, config2),
29663
- label: model.name,
29936
+ ref: cursorConfiguredModelRef(model2.value, config2),
29937
+ label: model2.name,
29664
29938
  supportedThinkingOptionIds: options.map(({ id }) => id)
29665
29939
  };
29666
29940
  });
@@ -29677,13 +29951,13 @@ function cursorCatalog(info) {
29677
29951
  function parseCursorNativeModels(input) {
29678
29952
  if (!Array.isArray(input.models))
29679
29953
  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))
29954
+ return input.models.map((model2) => {
29955
+ 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
29956
  throw new Error("Invalid Cursor model metadata");
29683
29957
  return {
29684
- value: model.value,
29685
- name: model.name,
29686
- configOptions: model.configOptions.map((option) => {
29958
+ value: model2.value,
29959
+ name: model2.name,
29960
+ configOptions: model2.configOptions.map((option) => {
29687
29961
  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
29962
  throw new Error("Invalid Cursor parameter metadata");
29689
29963
  const entries = option.options.map((entry) => {
@@ -29704,7 +29978,7 @@ function parseCursorNativeModels(input) {
29704
29978
  });
29705
29979
  }
29706
29980
  function cursorModelSelection(info, ref) {
29707
- const exact = cursorModels(info).models.find((model2) => cursorModelRef(model2.value).id === ref);
29981
+ const exact = cursorModels(info).models.find((model3) => cursorModelRef(model3.value).id === ref);
29708
29982
  if (exact)
29709
29983
  return [["model", exact.value]];
29710
29984
  if (!ref.startsWith("cursor."))
@@ -29713,8 +29987,8 @@ function cursorModelSelection(info, ref) {
29713
29987
  if (cursorModelRef(decoded).id !== ref)
29714
29988
  throw new Error("Invalid Cursor model reference");
29715
29989
  const match = /^([^\[\]]+)\[([^\[\]]*)\]$/u.exec(decoded);
29716
- const model = match && info.nativeModels?.find((entry) => entry.value === match[1]);
29717
- if (!match || !model)
29990
+ const model2 = match && info.nativeModels?.find((entry) => entry.value === match[1]);
29991
+ if (!match || !model2)
29718
29992
  throw new Error("Model is not in this Cursor session's native catalog");
29719
29993
  const parameters = [];
29720
29994
  for (const parameter of match[2] ? match[2].split(",") : []) {
@@ -29722,12 +29996,12 @@ function cursorModelSelection(info, ref) {
29722
29996
  const [id, value] = pair;
29723
29997
  if (pair.length !== 2 || !id || value === void 0 || parameters.some(([key]) => key === id))
29724
29998
  throw new Error("Invalid Cursor model parameters");
29725
- const option = model.configOptions.find((option2) => option2.id === id);
29999
+ const option = model2.configOptions.find((option2) => option2.id === id);
29726
30000
  if (!option || option.type !== "select" || !option.options.flatMap((entry) => "value" in entry ? [entry] : entry.options).some((entry) => entry.value === value))
29727
30001
  throw new Error("Legacy Cursor model parameter is not selectable in the native catalog");
29728
30002
  parameters.push([id, value]);
29729
30003
  }
29730
- return [["model", model.value], ...parameters];
30004
+ return [["model", model2.value], ...parameters];
29731
30005
  }
29732
30006
  function cursorCapabilities(info) {
29733
30007
  return {
@@ -29738,9 +30012,9 @@ function cursorCapabilities(info) {
29738
30012
  }
29739
30013
  };
29740
30014
  }
29741
- function cursorConfiguredModelRef(model, options) {
30015
+ function cursorConfiguredModelRef(model2, options) {
29742
30016
  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);
30017
+ return cursorModelRef(parameters.length ? `${model2}[${parameters.join(",")}]` : model2);
29744
30018
  }
29745
30019
 
29746
30020
  // dist/transport.js
@@ -32030,9 +32304,9 @@ var Connection = class {
32030
32304
  return;
32031
32305
  }
32032
32306
  const responseBatch = isResponseBatch(batch);
32033
- const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
32307
+ const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
32034
32308
  let remaining = responseCount;
32035
- let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
32309
+ let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
32036
32310
  let responseSent = false;
32037
32311
  const responses = [];
32038
32312
  const sendResponsesIfReady = async () => {
@@ -45337,7 +45611,7 @@ async function createCursorDelegationBridge(cwd, environment, commandTimeoutMs =
45337
45611
  server.registerTool("harness_inspect", {
45338
45612
  description: "Read a Harness's native Models and Thinking choices. Use opaque IDs only when explicitly selecting; omission retains native defaults.",
45339
45613
  inputSchema: { harness: text, cwd: text.optional() }
45340
- }, ({ harness, cwd: cwd2 }) => run(["harness", "inspect", harness, ...optional2("--cwd", cwd2)]));
45614
+ }, ({ harness: harness2, cwd: cwd2 }) => run(["harness", "inspect", harness2, ...optional2("--cwd", cwd2)]));
45341
45615
  server.registerTool("delegate_start", {
45342
45616
  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
45617
  inputSchema: {
@@ -45348,15 +45622,15 @@ async function createCursorDelegationBridge(cwd, environment, commandTimeoutMs =
45348
45622
  thinking: text.optional(),
45349
45623
  requestId: text.optional()
45350
45624
  }
45351
- }, ({ harness, task, cwd: cwd2, model, thinking, requestId }) => run([
45625
+ }, ({ harness: harness2, task, cwd: cwd2, model: model2, thinking, requestId }) => run([
45352
45626
  "delegate",
45353
45627
  "start",
45354
45628
  "--harness",
45355
- harness,
45629
+ harness2,
45356
45630
  "--task",
45357
45631
  task,
45358
45632
  ...optional2("--cwd", cwd2),
45359
- ...optional2("--model", model),
45633
+ ...optional2("--model", model2),
45360
45634
  ...optional2("--thinking", thinking),
45361
45635
  ...optional2("--request-id", requestId)
45362
45636
  ]));
@@ -45581,7 +45855,7 @@ var CursorTransport = class {
45581
45855
  return info;
45582
45856
  const modelOption = info.configOptions?.find((option) => option.id === "model");
45583
45857
  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)))
45858
+ 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
45859
  return { ...info, nativeModels: structuredClone(this.cachedModels) };
45586
45860
  try {
45587
45861
  const models = await this.#bounded(this.#connection.extMethod("cursor/list_available_models", {}));
@@ -46378,7 +46652,13 @@ var CursorTurnOutput = class {
46378
46652
  constructor(turnId, emit, nativeTurnIndex = 0) {
46379
46653
  this.turnId = turnId;
46380
46654
  this.emit = emit;
46381
- this.subagents = new CursorSubagents(turnId, emit, nativeTurnIndex);
46655
+ this.subagents = new CursorSubagents(turnId, (event) => {
46656
+ if (event.type === "item.started") {
46657
+ this.#flushHold();
46658
+ this.#finishText();
46659
+ }
46660
+ emit(event);
46661
+ }, nativeTurnIndex);
46382
46662
  }
46383
46663
  sawWritableIterableClosed() {
46384
46664
  return this.#writableIterableClosed || takeCursorWritableIterableClosed(this.#hold).closed;
@@ -46428,11 +46708,8 @@ var CursorTurnOutput = class {
46428
46708
  this.#text = void 0;
46429
46709
  }
46430
46710
  update(notification) {
46431
- if (this.subagents.update(notification)) {
46432
- this.#flushHold();
46433
- this.#finishText();
46711
+ if (this.subagents.update(notification))
46434
46712
  return;
46435
- }
46436
46713
  const { update } = notification;
46437
46714
  if (update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "agent_thought_chunk") {
46438
46715
  if (update.content.type !== "text")
@@ -46448,12 +46725,12 @@ var CursorTurnOutput = class {
46448
46725
  this.#hold = hold;
46449
46726
  this.#appendText(type, emit);
46450
46727
  } else if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
46451
- this.#flushHold();
46452
- this.#finishText();
46453
46728
  if (this.#finishedTools.has(update.toolCallId))
46454
46729
  return;
46455
46730
  let tool = this.#tools.get(update.toolCallId);
46456
46731
  if (!tool) {
46732
+ this.#flushHold();
46733
+ this.#finishText();
46457
46734
  const args = jsonValueSchema.safeParse(update.rawInput ?? {});
46458
46735
  const item2 = {
46459
46736
  type: "toolExecution",
@@ -47253,7 +47530,7 @@ var CursorAdapter = class {
47253
47530
  throw staged.reason;
47254
47531
  if (!derived)
47255
47532
  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;
47533
+ const model2 = input.kind === "rollbackLastTurn" ? input.model ?? source?.initialState.effectiveModel : source?.initialState.effectiveModel;
47257
47534
  const thinking = input.kind === "rollbackLastTurn" ? input.thinkingOptionId ?? source?.initialState.effectiveThinkingOptionId : source?.initialState.effectiveThinkingOptionId;
47258
47535
  const mode = input.kind === "rollbackLastTurn" ? input.permissionModeId ?? source?.initialState.effectivePermissionModeId : source?.initialState.effectivePermissionModeId;
47259
47536
  const opened = await this.#openSession({
@@ -47261,7 +47538,7 @@ var CursorAdapter = class {
47261
47538
  cwd: input.cwd,
47262
47539
  environment: options.environment,
47263
47540
  nativeRef: cursorNativeSessionRef(derived.sessionId, executionPolicy),
47264
- ...model ? { model } : {},
47541
+ ...model2 ? { model: model2 } : {},
47265
47542
  ...thinking ? { thinkingOptionId: thinking } : {},
47266
47543
  ...mode ? { permissionModeId: mode } : {}
47267
47544
  }, transport);
@@ -47477,9 +47754,9 @@ var CursorSession = class {
47477
47754
  if (!result.configOptions.some((option) => option.id === configId && option.currentValue === value))
47478
47755
  throw new Error("Cursor did not confirm configuration selection");
47479
47756
  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);
47757
+ const model2 = result.configOptions.find((option) => option.id === "model");
47758
+ if (model2?.type === "select")
47759
+ this.initialState.effectiveModel = cursorConfiguredModelRef(model2.currentValue, result.configOptions);
47483
47760
  const mode = result.configOptions.find((option) => option.id === "mode");
47484
47761
  if (mode)
47485
47762
  this.initialState.effectivePermissionModeId = harnessPermissionModeIdSchema.parse(mode.currentValue);
@@ -47902,6 +48179,8 @@ var harnessSessionStateSchema = external_exports.custom((value) => {
47902
48179
  var eventKeys = /* @__PURE__ */ new Map([
47903
48180
  ["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
47904
48181
  ["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
48182
+ ["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
48183
+ ["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
47905
48184
  ["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
47906
48185
  ["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
47907
48186
  ["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
@@ -47950,6 +48229,8 @@ var harnessOutputSchema = external_exports.custom((value) => {
47950
48229
  return harnessSessionStateSchema.safeParse(event.state).success;
47951
48230
  if (event.type === "session.faulted")
47952
48231
  return harnessErrorSchema.safeParse(event.error).success;
48232
+ if (event.type === "usage.history")
48233
+ return typeof event.complete === "boolean";
47953
48234
  return true;
47954
48235
  }
47955
48236
  if (output.kind === "interaction") {