@karlorz/codexhost-cli-win32-x64 0.15.0-1 → 0.16.1-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.
@@ -5053,8 +5053,8 @@ function az_default() {
5053
5053
  }
5054
5054
 
5055
5055
  // ../../../node_modules/zod/v4/locales/be.js
5056
- function getBelarusianPlural(count3, one, few, many) {
5057
- const absCount = Math.abs(count3);
5056
+ function getBelarusianPlural(count4, one, few, many) {
5057
+ const absCount = Math.abs(count4);
5058
5058
  const lastDigit = absCount % 10;
5059
5059
  const lastTwoDigits = absCount % 100;
5060
5060
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -7132,8 +7132,8 @@ function hu_default() {
7132
7132
  }
7133
7133
 
7134
7134
  // ../../../node_modules/zod/v4/locales/hy.js
7135
- function getArmenianPlural(count3, one, many) {
7136
- return Math.abs(count3) === 1 ? one : many;
7135
+ function getArmenianPlural(count4, one, many) {
7136
+ return Math.abs(count4) === 1 ? one : many;
7137
7137
  }
7138
7138
  function withDefiniteArticle(word) {
7139
7139
  if (!word)
@@ -9261,8 +9261,8 @@ function ro_default() {
9261
9261
  }
9262
9262
 
9263
9263
  // ../../../node_modules/zod/v4/locales/ru.js
9264
- function getRussianPlural(count3, one, few, many) {
9265
- const absCount = Math.abs(count3);
9264
+ function getRussianPlural(count4, one, few, many) {
9265
+ const absCount = Math.abs(count4);
9266
9266
  const lastDigit = absCount % 10;
9267
9267
  const lastTwoDigits = absCount % 100;
9268
9268
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -14931,6 +14931,33 @@ function date4(params) {
14931
14931
  // ../../../node_modules/zod/v4/classic/external.js
14932
14932
  config(en_default());
14933
14933
 
14934
+ // ../../shared-contracts/dist/goals.js
14935
+ var harnessGoalStatusSchema = external_exports.enum([
14936
+ "active",
14937
+ "paused",
14938
+ "blocked",
14939
+ "usageLimited",
14940
+ "budgetLimited",
14941
+ "complete"
14942
+ ]);
14943
+ var count = external_exports.number().int().nonnegative().safe();
14944
+ var harnessGoalSchema = external_exports.object({
14945
+ objective: external_exports.string().min(1),
14946
+ status: harnessGoalStatusSchema,
14947
+ tokenBudget: count.positive().nullable(),
14948
+ tokensUsed: count,
14949
+ timeUsedSeconds: count,
14950
+ createdAt: count,
14951
+ updatedAt: count
14952
+ });
14953
+ var goalOriginSchema = external_exports.enum(["user", "automatic"]).nullable();
14954
+ var harnessGoalSetSchema = external_exports.object({
14955
+ objective: external_exports.string().min(1).optional(),
14956
+ status: external_exports.enum(["active", "paused"]).optional(),
14957
+ tokenBudget: count.positive().nullable().optional(),
14958
+ origin: goalOriginSchema
14959
+ });
14960
+
14934
14961
  // ../../shared-contracts/dist/delegation-read.js
14935
14962
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
14936
14963
  var delegationReadParamsSchema = external_exports.strictObject({
@@ -15061,7 +15088,7 @@ var modelPriceDefaultResultSchema = external_exports.strictObject({
15061
15088
 
15062
15089
  // ../../shared-contracts/dist/usage-statistics.js
15063
15090
  var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
15064
- var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
15091
+ var count2 = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
15065
15092
  var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
15066
15093
  var harness = external_exports.string().min(1).max(128);
15067
15094
  var model = external_exports.string().min(1).max(512);
@@ -15084,22 +15111,24 @@ var usageStatisticsParamsSchema = external_exports.strictObject({
15084
15111
  date: localDate.optional()
15085
15112
  });
15086
15113
  var usageStatisticsTotalsSchema = external_exports.strictObject({
15087
- requests: count,
15088
- inputTokens: count,
15089
- cachedInputTokens: count,
15090
- cacheWriteInputTokens: count,
15091
- cacheKnownInputTokens: count,
15092
- outputTokens: count,
15093
- reasoningOutputTokens: count,
15114
+ requests: count2,
15115
+ inputTokens: count2,
15116
+ cachedInputTokens: count2,
15117
+ cacheWriteInputTokens: count2,
15118
+ cacheKnownInputTokens: count2,
15119
+ cacheHitCachedInputTokens: count2,
15120
+ cacheHitInputTokens: count2,
15121
+ outputTokens: count2,
15122
+ reasoningOutputTokens: count2,
15094
15123
  /** USD at the public price, summed over the priced requests only. */
15095
15124
  costUsd: external_exports.number().finite().min(0),
15096
15125
  /** Requests without a price (or the cache data the price needs); not in `costUsd`. */
15097
- unpricedRequests: count,
15126
+ unpricedRequests: count2,
15098
15127
  /**
15099
15128
  * Requests whose storage gave no token counts: counted as requests, with neither tokens nor
15100
15129
  * cost, and not as unpriced.
15101
15130
  */
15102
- unmeteredRequests: count
15131
+ unmeteredRequests: count2
15103
15132
  });
15104
15133
  var totals = usageStatisticsTotalsSchema.shape;
15105
15134
  var usageStatisticsSessionSchema = external_exports.strictObject({
@@ -15110,8 +15139,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15110
15139
  title: external_exports.string().min(1).max(200).optional(),
15111
15140
  /** Models the session used, most requests first. */
15112
15141
  models: external_exports.array(model).max(16),
15113
- firstAtMs: count,
15114
- lastAtMs: count,
15142
+ firstAtMs: count2,
15143
+ lastAtMs: count2,
15115
15144
  ...totals
15116
15145
  });
15117
15146
  var usageStatisticsResultSchema = external_exports.strictObject({
@@ -15129,7 +15158,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15129
15158
  date: localDate.nullable()
15130
15159
  }),
15131
15160
  /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
15132
- reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
15161
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count2, read: count2 }),
15133
15162
  /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
15134
15163
  failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
15135
15164
  /** Every value seen in the range, ignoring the filters, to choose filters from. */
@@ -15149,8 +15178,8 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15149
15178
  harness,
15150
15179
  model: model.nullable(),
15151
15180
  credits: external_exports.number().finite().min(0),
15152
- reportedRequests: count,
15153
- requests: count
15181
+ reportedRequests: count2,
15182
+ requests: count2
15154
15183
  })).max(4096).optional(),
15155
15184
  /** All filters applied. */
15156
15185
  totals: usageStatisticsTotalsSchema,
@@ -15167,7 +15196,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15167
15196
  model: model.nullable(),
15168
15197
  ...totals,
15169
15198
  /** Requests priced by what the Harness recorded they cost, not by a price list. */
15170
- harnessPricedRequests: count
15199
+ harnessPricedRequests: count2
15171
15200
  })).max(4096),
15172
15201
  byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
15173
15202
  /**
@@ -15781,7 +15810,9 @@ var harnessModelCatalogSchema = external_exports.object({
15781
15810
  var harnessHistoryCapabilitiesSchema = external_exports.object({
15782
15811
  fork: external_exports.boolean(),
15783
15812
  forkAcrossCwd: external_exports.boolean(),
15784
- rollbackLastTurn: external_exports.boolean()
15813
+ rollbackLastTurn: external_exports.boolean(),
15814
+ /** Remove the selected checkpoint's Turn and every later Turn, without restoring files. */
15815
+ rollbackToCheckpoint: external_exports.boolean().optional()
15785
15816
  }).strict().refine((history) => history.fork || !history.forkAcrossCwd, {
15786
15817
  path: ["forkAcrossCwd"],
15787
15818
  message: "Cross-cwd Fork requires exact history Fork support"
@@ -16019,7 +16050,10 @@ var harnessPluginRouteSchema = external_exports.object({
16019
16050
  harnessId: harnessPluginIdSchema,
16020
16051
  model: harnessModelRefSchema.optional(),
16021
16052
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
16022
- permissionModeId: harnessPermissionModeIdSchema.optional()
16053
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
16054
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
16055
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
16056
+ prewarm: external_exports.literal(true).optional()
16023
16057
  }).strict();
16024
16058
 
16025
16059
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -19093,7 +19127,7 @@ function nativeTimeMs(value) {
19093
19127
  }
19094
19128
 
19095
19129
  // dist/usage-statistics.js
19096
- function count2(value) {
19130
+ function count3(value) {
19097
19131
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
19098
19132
  }
19099
19133
  function antigravityHome(environment) {
@@ -19151,10 +19185,10 @@ async function readAntigravityUsage(file2, signal) {
19151
19185
  for await (const record2 of jsonlRecords(file2, '"input_tokens"', signal)) {
19152
19186
  if (record2.type !== "PLANNER_RESPONSE")
19153
19187
  continue;
19154
- const step = count2(record2.step_index);
19155
- const input = count2(record2.input_tokens);
19156
- const output = count2(record2.output_tokens);
19157
- const cached2 = count2(record2.cache_read_tokens);
19188
+ const step = count3(record2.step_index);
19189
+ const input = count3(record2.input_tokens);
19190
+ const output = count3(record2.output_tokens);
19191
+ const cached2 = count3(record2.cache_read_tokens);
19158
19192
  const at = nativeTimeMs(record2.created_at);
19159
19193
  if (step === null || input === null || output === null || at === null)
19160
19194
  continue;
@@ -20438,6 +20472,16 @@ var AntigravityAdapter = class {
20438
20472
  return void 0;
20439
20473
  }
20440
20474
  async open(input) {
20475
+ if (input.kind === "rollbackToCheckpoint") {
20476
+ return {
20477
+ ok: false,
20478
+ error: {
20479
+ code: "unsupported",
20480
+ message: "Checkpoint rollback is not supported by this Adapter",
20481
+ retryable: false
20482
+ }
20483
+ };
20484
+ }
20441
20485
  if (this.#closed)
20442
20486
  return { ok: false, error: invalidState("Antigravity Adapter is closed") };
20443
20487
  let permissionMode = "dangerously-skip-permissions";
@@ -4647,8 +4647,8 @@ function az_default() {
4647
4647
  }
4648
4648
 
4649
4649
  // ../../../node_modules/zod/v4/locales/be.js
4650
- function getBelarusianPlural(count3, one2, few, many) {
4651
- const absCount = Math.abs(count3);
4650
+ function getBelarusianPlural(count4, one2, few, many) {
4651
+ const absCount = Math.abs(count4);
4652
4652
  const lastDigit = absCount % 10;
4653
4653
  const lastTwoDigits = absCount % 100;
4654
4654
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -6726,8 +6726,8 @@ function hu_default() {
6726
6726
  }
6727
6727
 
6728
6728
  // ../../../node_modules/zod/v4/locales/hy.js
6729
- function getArmenianPlural(count3, one2, many) {
6730
- return Math.abs(count3) === 1 ? one2 : many;
6729
+ function getArmenianPlural(count4, one2, many) {
6730
+ return Math.abs(count4) === 1 ? one2 : many;
6731
6731
  }
6732
6732
  function withDefiniteArticle(word) {
6733
6733
  if (!word)
@@ -8855,8 +8855,8 @@ function ro_default() {
8855
8855
  }
8856
8856
 
8857
8857
  // ../../../node_modules/zod/v4/locales/ru.js
8858
- function getRussianPlural(count3, one2, few, many) {
8859
- const absCount = Math.abs(count3);
8858
+ function getRussianPlural(count4, one2, few, many) {
8859
+ const absCount = Math.abs(count4);
8860
8860
  const lastDigit = absCount % 10;
8861
8861
  const lastTwoDigits = absCount % 100;
8862
8862
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -14525,6 +14525,33 @@ function date4(params) {
14525
14525
  // ../../../node_modules/zod/v4/classic/external.js
14526
14526
  config(en_default());
14527
14527
 
14528
+ // ../../shared-contracts/dist/goals.js
14529
+ var harnessGoalStatusSchema = external_exports.enum([
14530
+ "active",
14531
+ "paused",
14532
+ "blocked",
14533
+ "usageLimited",
14534
+ "budgetLimited",
14535
+ "complete"
14536
+ ]);
14537
+ var count = external_exports.number().int().nonnegative().safe();
14538
+ var harnessGoalSchema = external_exports.object({
14539
+ objective: external_exports.string().min(1),
14540
+ status: harnessGoalStatusSchema,
14541
+ tokenBudget: count.positive().nullable(),
14542
+ tokensUsed: count,
14543
+ timeUsedSeconds: count,
14544
+ createdAt: count,
14545
+ updatedAt: count
14546
+ });
14547
+ var goalOriginSchema = external_exports.enum(["user", "automatic"]).nullable();
14548
+ var harnessGoalSetSchema = external_exports.object({
14549
+ objective: external_exports.string().min(1).optional(),
14550
+ status: external_exports.enum(["active", "paused"]).optional(),
14551
+ tokenBudget: count.positive().nullable().optional(),
14552
+ origin: goalOriginSchema
14553
+ });
14554
+
14528
14555
  // ../../shared-contracts/dist/delegation-read.js
14529
14556
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
14530
14557
  var delegationReadParamsSchema = external_exports.strictObject({
@@ -14655,7 +14682,7 @@ var modelPriceDefaultResultSchema = external_exports.strictObject({
14655
14682
 
14656
14683
  // ../../shared-contracts/dist/usage-statistics.js
14657
14684
  var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
14658
- var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
14685
+ var count2 = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
14659
14686
  var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
14660
14687
  var harness = external_exports.string().min(1).max(128);
14661
14688
  var model = external_exports.string().min(1).max(512);
@@ -14678,22 +14705,24 @@ var usageStatisticsParamsSchema = external_exports.strictObject({
14678
14705
  date: localDate.optional()
14679
14706
  });
14680
14707
  var usageStatisticsTotalsSchema = external_exports.strictObject({
14681
- requests: count,
14682
- inputTokens: count,
14683
- cachedInputTokens: count,
14684
- cacheWriteInputTokens: count,
14685
- cacheKnownInputTokens: count,
14686
- outputTokens: count,
14687
- reasoningOutputTokens: count,
14708
+ requests: count2,
14709
+ inputTokens: count2,
14710
+ cachedInputTokens: count2,
14711
+ cacheWriteInputTokens: count2,
14712
+ cacheKnownInputTokens: count2,
14713
+ cacheHitCachedInputTokens: count2,
14714
+ cacheHitInputTokens: count2,
14715
+ outputTokens: count2,
14716
+ reasoningOutputTokens: count2,
14688
14717
  /** USD at the public price, summed over the priced requests only. */
14689
14718
  costUsd: external_exports.number().finite().min(0),
14690
14719
  /** Requests without a price (or the cache data the price needs); not in `costUsd`. */
14691
- unpricedRequests: count,
14720
+ unpricedRequests: count2,
14692
14721
  /**
14693
14722
  * Requests whose storage gave no token counts: counted as requests, with neither tokens nor
14694
14723
  * cost, and not as unpriced.
14695
14724
  */
14696
- unmeteredRequests: count
14725
+ unmeteredRequests: count2
14697
14726
  });
14698
14727
  var totals = usageStatisticsTotalsSchema.shape;
14699
14728
  var usageStatisticsSessionSchema = external_exports.strictObject({
@@ -14704,8 +14733,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14704
14733
  title: external_exports.string().min(1).max(200).optional(),
14705
14734
  /** Models the session used, most requests first. */
14706
14735
  models: external_exports.array(model).max(16),
14707
- firstAtMs: count,
14708
- lastAtMs: count,
14736
+ firstAtMs: count2,
14737
+ lastAtMs: count2,
14709
14738
  ...totals
14710
14739
  });
14711
14740
  var usageStatisticsResultSchema = external_exports.strictObject({
@@ -14723,7 +14752,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14723
14752
  date: localDate.nullable()
14724
14753
  }),
14725
14754
  /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
14726
- reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
14755
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count2, read: count2 }),
14727
14756
  /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
14728
14757
  failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
14729
14758
  /** Every value seen in the range, ignoring the filters, to choose filters from. */
@@ -14743,8 +14772,8 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14743
14772
  harness,
14744
14773
  model: model.nullable(),
14745
14774
  credits: external_exports.number().finite().min(0),
14746
- reportedRequests: count,
14747
- requests: count
14775
+ reportedRequests: count2,
14776
+ requests: count2
14748
14777
  })).max(4096).optional(),
14749
14778
  /** All filters applied. */
14750
14779
  totals: usageStatisticsTotalsSchema,
@@ -14761,7 +14790,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14761
14790
  model: model.nullable(),
14762
14791
  ...totals,
14763
14792
  /** Requests priced by what the Harness recorded they cost, not by a price list. */
14764
- harnessPricedRequests: count
14793
+ harnessPricedRequests: count2
14765
14794
  })).max(4096),
14766
14795
  byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
14767
14796
  /**
@@ -15375,7 +15404,9 @@ var harnessModelCatalogSchema = external_exports.object({
15375
15404
  var harnessHistoryCapabilitiesSchema = external_exports.object({
15376
15405
  fork: external_exports.boolean(),
15377
15406
  forkAcrossCwd: external_exports.boolean(),
15378
- rollbackLastTurn: external_exports.boolean()
15407
+ rollbackLastTurn: external_exports.boolean(),
15408
+ /** Remove the selected checkpoint's Turn and every later Turn, without restoring files. */
15409
+ rollbackToCheckpoint: external_exports.boolean().optional()
15379
15410
  }).strict().refine((history) => history.fork || !history.forkAcrossCwd, {
15380
15411
  path: ["forkAcrossCwd"],
15381
15412
  message: "Cross-cwd Fork requires exact history Fork support"
@@ -15613,7 +15644,10 @@ var harnessPluginRouteSchema = external_exports.object({
15613
15644
  harnessId: harnessPluginIdSchema,
15614
15645
  model: harnessModelRefSchema.optional(),
15615
15646
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15616
- permissionModeId: harnessPermissionModeIdSchema.optional()
15647
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15648
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15649
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15650
+ prewarm: external_exports.literal(true).optional()
15617
15651
  }).strict();
15618
15652
 
15619
15653
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -17743,7 +17777,7 @@ var SYNTHETIC_MODEL = "<synthetic>";
17743
17777
  function isRecord2(value) {
17744
17778
  return typeof value === "object" && value !== null && !Array.isArray(value);
17745
17779
  }
17746
- function count2(value) {
17780
+ function count3(value) {
17747
17781
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
17748
17782
  }
17749
17783
  function isClaudeModelRequest(model2) {
@@ -17752,17 +17786,17 @@ function isClaudeModelRequest(model2) {
17752
17786
  function claudeUsageRecord(requestId2, model2, usage, extra = {}) {
17753
17787
  if (!isRecord2(usage))
17754
17788
  return { kind: "missing" };
17755
- const input = count2(usage.input_tokens);
17756
- const output = count2(usage.output_tokens);
17757
- const cacheRead = count2(usage.cache_read_input_tokens ?? 0);
17758
- const cacheWrite = count2(usage.cache_creation_input_tokens ?? 0);
17789
+ const input = count3(usage.input_tokens);
17790
+ const output = count3(usage.output_tokens);
17791
+ const cacheRead = count3(usage.cache_read_input_tokens ?? 0);
17792
+ const cacheWrite = count3(usage.cache_creation_input_tokens ?? 0);
17759
17793
  if (input === null || output === null || cacheRead === null || cacheWrite === null) {
17760
17794
  return { kind: "missing" };
17761
17795
  }
17762
17796
  const split = isRecord2(usage.cache_creation) ? usage.cache_creation : null;
17763
- const oneHour = split ? count2(split.ephemeral_1h_input_tokens) : null;
17797
+ const oneHour = split ? count3(split.ephemeral_1h_input_tokens) : null;
17764
17798
  const details = isRecord2(usage.output_tokens_details) ? usage.output_tokens_details : null;
17765
- const thinking = details ? count2(details.thinking_tokens) : null;
17799
+ const thinking = details ? count3(details.thinking_tokens) : null;
17766
17800
  const timed = extra.startedAtMs !== void 0 && extra.startedAtMs !== null && extra.completedAtMs !== void 0;
17767
17801
  try {
17768
17802
  return {
@@ -56392,21 +56426,21 @@ function parseEntry(line) {
56392
56426
  }
56393
56427
  function remapSameAs(value, copies) {
56394
56428
  if (Array.isArray(value)) {
56395
- return value.reduce((count4, item) => count4 + remapSameAs(item, copies), 0);
56429
+ return value.reduce((count5, item) => count5 + remapSameAs(item, copies), 0);
56396
56430
  }
56397
56431
  if (!isRecord10(value))
56398
56432
  return 0;
56399
- let count3 = 0;
56433
+ let count4 = 0;
56400
56434
  for (const [key, child] of Object.entries(value)) {
56401
56435
  const copy = key === "sameAs" && typeof child === "string" ? copies.get(child) : void 0;
56402
56436
  if (copy) {
56403
56437
  value[key] = copy;
56404
- count3 += 1;
56438
+ count4 += 1;
56405
56439
  } else {
56406
- count3 += remapSameAs(child, copies);
56440
+ count4 += remapSameAs(child, copies);
56407
56441
  }
56408
56442
  }
56409
- return count3;
56443
+ return count4;
56410
56444
  }
56411
56445
  async function remapForkedSessionReferences(input) {
56412
56446
  const transcript = await findClaudeTranscript(input);
@@ -56429,10 +56463,10 @@ async function remapForkedSessionReferences(input) {
56429
56463
  const entry = entries[index];
56430
56464
  if (entry?.type !== "attachment")
56431
56465
  return line;
56432
- const count3 = remapSameAs(entry.attachment, copies);
56433
- if (count3 === 0)
56466
+ const count4 = remapSameAs(entry.attachment, copies);
56467
+ if (count4 === 0)
56434
56468
  return line;
56435
- remapped += count3;
56469
+ remapped += count4;
56436
56470
  return JSON.stringify(entry);
56437
56471
  });
56438
56472
  if (remapped === 0)
@@ -57429,11 +57463,11 @@ var ClaudeSdkTransport = class {
57429
57463
  this.#slashCommands = parseClaudeSlashCommands(message.commands);
57430
57464
  }
57431
57465
  }
57432
- async getContextUsage() {
57466
+ async getContextUsage(detail = "full") {
57433
57467
  const activeQuery = this.#query;
57434
57468
  if (!this.#started || !activeQuery)
57435
57469
  return null;
57436
- return parseContextUsage(await activeQuery.getContextUsage());
57470
+ return parseContextUsage(await activeQuery.getContextUsage({ detail }));
57437
57471
  }
57438
57472
  getPermissionMode() {
57439
57473
  if (!this.#started || !this.#query)
@@ -58411,11 +58445,11 @@ var ClaudeWorkflowLifecycle = class {
58411
58445
  }
58412
58446
  /** Runs whose Workflow tool has not returned yet. */
58413
58447
  get pendingCount() {
58414
- let count3 = 0;
58448
+ let count4 = 0;
58415
58449
  for (const run of this.#runs.values())
58416
58450
  if (!run.launched)
58417
- count3 += 1;
58418
- return count3;
58451
+ count4 += 1;
58452
+ return count4;
58419
58453
  }
58420
58454
  /** Native task IDs of launched runs still open. */
58421
58455
  taskIds() {
@@ -59294,7 +59328,6 @@ var ClaudeHarnessSession = class {
59294
59328
  #lastAssistantResponseAtUnix;
59295
59329
  #accountCreditsSupported;
59296
59330
  #minimumContextUsedTokens = null;
59297
- #latestRequestModel = null;
59298
59331
  #calibratedInputTokens = 0;
59299
59332
  #calibratedOutputTokens = 0;
59300
59333
  #calibratedCostUsd = 0;
@@ -59801,15 +59834,16 @@ var ClaudeHarnessSession = class {
59801
59834
  };
59802
59835
  }
59803
59836
  }
59804
- refreshUsage() {
59837
+ async refreshUsage() {
59838
+ await this.#contextRefreshInFlight;
59805
59839
  if (this.#phase !== "open" || !this.#transport)
59806
- return Promise.resolve();
59840
+ return;
59807
59841
  const now = Date.now();
59808
59842
  if (now < this.#contextUsageFreshUntilMs || now < this.#contextUsageCooldownUntilMs) {
59809
- return Promise.resolve();
59843
+ return;
59810
59844
  }
59811
59845
  this.#requestContextUsage(this.#transport, this.#active?.command.turnId, CONTEXT_USAGE_RETRY_DELAYS_MS);
59812
- return this.#contextRefreshInFlight ?? Promise.resolve();
59846
+ await this.#contextRefreshInFlight;
59813
59847
  }
59814
59848
  blocksRollback(sessionId) {
59815
59849
  return this.#sessionId === sessionId && (this.#phase !== "open" || this.#active !== null || this.#acceptingTurn || this.#configurationTask !== null || this.#readingHistory);
@@ -60943,7 +60977,7 @@ var ClaudeHarnessSession = class {
60943
60977
  this.#finishFailed(active, transportFailure(result.kind));
60944
60978
  }
60945
60979
  }
60946
- #requestContextUsage(transport, turnId, retryDelaysMs) {
60980
+ #requestContextUsage(transport, turnId, retryDelaysMs, detail = "full") {
60947
60981
  if (this.#phase !== "open" || this.#transport !== transport)
60948
60982
  return;
60949
60983
  if (this.#contextRefreshInFlight)
@@ -60952,7 +60986,8 @@ var ClaudeHarnessSession = class {
60952
60986
  transport,
60953
60987
  ...turnId !== void 0 ? { turnId } : {},
60954
60988
  generation: this.#usageGeneration,
60955
- retryDelaysMs
60989
+ retryDelaysMs,
60990
+ detail
60956
60991
  };
60957
60992
  this.#contextRefreshInFlight = this.#drainContextUsage();
60958
60993
  }
@@ -60978,14 +61013,16 @@ var ClaudeHarnessSession = class {
60978
61013
  return;
60979
61014
  }
60980
61015
  try {
60981
- const context = await request.transport.getContextUsage();
61016
+ const context = await request.transport.getContextUsage(request.detail);
60982
61017
  if (this.#phase !== "open" || this.#transport !== request.transport || this.#usageGeneration !== request.generation || this.#contextRefreshPending !== null) {
60983
61018
  return;
60984
61019
  }
60985
61020
  if (context === null)
60986
61021
  continue;
60987
- this.#contextUsageFreshUntilMs = Date.now() + CONTEXT_USAGE_TTL_MS;
60988
- this.#contextUsageCooldownUntilMs = 0;
61022
+ if (request.detail === "full") {
61023
+ this.#contextUsageFreshUntilMs = Date.now() + CONTEXT_USAGE_TTL_MS;
61024
+ this.#contextUsageCooldownUntilMs = 0;
61025
+ }
60989
61026
  this.#mergeAndPublishUsage({
60990
61027
  contextUsedTokens: Math.max(context.usedTokens, this.#minimumContextUsedTokens ?? 0),
60991
61028
  contextWindowTokens: context.maxTokens
@@ -60994,7 +61031,7 @@ var ClaudeHarnessSession = class {
60994
61031
  } catch {
60995
61032
  }
60996
61033
  }
60997
- if (this.#phase === "open" && this.#transport === request.transport && this.#usageGeneration === request.generation) {
61034
+ if (request.detail === "full" && this.#phase === "open" && this.#transport === request.transport && this.#usageGeneration === request.generation) {
60998
61035
  this.#contextUsageCooldownUntilMs = Date.now() + CONTEXT_USAGE_FAILURE_COOLDOWN_MS;
60999
61036
  }
61000
61037
  }
@@ -61060,8 +61097,6 @@ var ClaudeHarnessSession = class {
61060
61097
  const promptTokens = usage.inputTokens + usage.cacheCreationInputTokens + usage.cacheReadInputTokens;
61061
61098
  if (promptTokens > 0)
61062
61099
  this.#minimumContextUsedTokens = promptTokens;
61063
- if (usage.model)
61064
- this.#latestRequestModel = usage.model;
61065
61100
  const cacheHitRatePercent = claudeCacheHitRatePercent(usage);
61066
61101
  const contextWindowTokens = this.#latestUsage?.contextWindowTokens;
61067
61102
  this.#mergeAndPublishUsage({
@@ -61103,24 +61138,11 @@ var ClaudeHarnessSession = class {
61103
61138
  if (cacheHitRatePercent !== void 0)
61104
61139
  delta.cacheHitRatePercent = cacheHitRatePercent;
61105
61140
  }
61106
- if (this.#latestUsage?.contextWindowTokens === void 0 && this.#minimumContextUsedTokens !== null) {
61107
- const contextWindowTokens = this.#resultContextWindow(event.modelUsage);
61108
- if (contextWindowTokens !== void 0) {
61109
- delta.contextUsedTokens = this.#minimumContextUsedTokens;
61110
- delta.contextWindowTokens = contextWindowTokens;
61111
- }
61141
+ if (this.#transport && this.#minimumContextUsedTokens !== null && event.modelUsage?.some(({ contextWindowTokens }) => contextWindowTokens !== void 0)) {
61142
+ this.#requestContextUsage(this.#transport, active.command.turnId, [0], "summary");
61112
61143
  }
61113
61144
  this.#mergeAndPublishUsage(delta, active.command.turnId);
61114
61145
  }
61115
- /** The latest request's Model, else the Model that carried the most prompt tokens. */
61116
- #resultContextWindow(modelUsage) {
61117
- if (!modelUsage?.length)
61118
- return void 0;
61119
- const latest = this.#latestRequestModel;
61120
- const matched = latest ? modelUsage.find(({ model: model2 }) => model2 === latest) : void 0;
61121
- const main = matched ?? modelUsage.reduce((best, entry) => (entry.promptTokens ?? entry.inputTokens) > (best.promptTokens ?? best.inputTokens) ? entry : best);
61122
- return main.contextWindowTokens;
61123
- }
61124
61146
  /**
61125
61147
  * Plan usage is account-wide, not Thread-scoped, so every observation is
61126
61148
  * offered to the Adapter's shared cache regardless of this Session's own
@@ -61641,6 +61663,16 @@ var ClaudeCodeAdapter = class {
61641
61663
  }
61642
61664
  }
61643
61665
  async open(input) {
61666
+ if (input.kind === "rollbackToCheckpoint") {
61667
+ return {
61668
+ ok: false,
61669
+ error: {
61670
+ code: "unsupported",
61671
+ message: "Checkpoint rollback is not supported by this Adapter",
61672
+ retryable: false
61673
+ }
61674
+ };
61675
+ }
61644
61676
  if (this.#closePromise) {
61645
61677
  return {
61646
61678
  ok: false,