@codexhost/cli-darwin-x64 0.15.0 → 0.16.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.
@@ -15159,6 +15159,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15159
15159
  cachedInputTokens: count,
15160
15160
  cacheWriteInputTokens: count,
15161
15161
  cacheKnownInputTokens: count,
15162
+ cacheHitCachedInputTokens: count,
15163
+ cacheHitInputTokens: count,
15162
15164
  outputTokens: count,
15163
15165
  reasoningOutputTokens: count,
15164
15166
  /** USD at the public price, summed over the priced requests only. */
@@ -18240,7 +18242,17 @@ function pendingNativeHistoryRewind(contents) {
18240
18242
  const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
18241
18243
  return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
18242
18244
  }
18245
+ function isNativeCompactionSummary(row) {
18246
+ const data = record2(row.providerData);
18247
+ return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
18248
+ }
18243
18249
  function nativeHistoryRows(contents) {
18250
+ return collectNativeHistoryRows(contents, false);
18251
+ }
18252
+ function nativeDisplayHistoryRows(contents) {
18253
+ return collectNativeHistoryRows(contents, true);
18254
+ }
18255
+ function collectNativeHistoryRows(contents, followCompactionParent) {
18244
18256
  const entries = /* @__PURE__ */ new Map();
18245
18257
  let leaf = "";
18246
18258
  for (const row of parseRows(contents)) {
@@ -18265,10 +18277,16 @@ function nativeHistoryRows(contents) {
18265
18277
  throw new CodeBuddyError("protocolError", "Native history parent is missing");
18266
18278
  chain.push(row);
18267
18279
  leaf = text(row.parentId);
18280
+ if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
18281
+ const logicalParent = text(row.logicalParentId);
18282
+ if (logicalParent && !entries.has(logicalParent))
18283
+ throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
18284
+ leaf = logicalParent;
18285
+ }
18268
18286
  }
18269
18287
  return chain.reverse();
18270
18288
  }
18271
- function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
18289
+ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
18272
18290
  const supportsNativeCommands = nativeCommandsEnabled(profile);
18273
18291
  const supportsFork = capabilitiesForProfile(profile).history.fork;
18274
18292
  const turns = [];
@@ -18294,7 +18312,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18294
18312
  snapshot.item.outputTruncated = Boolean(output.truncated);
18295
18313
  }
18296
18314
  };
18297
- const history = nativeHistoryRows(contents);
18315
+ const includeCompactionHistory = options.includeCompactionHistory !== false;
18316
+ const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
18298
18317
  const manualCompactions = /* @__PURE__ */ new Set();
18299
18318
  let compactUser;
18300
18319
  if (supportsNativeCommands)
@@ -18328,6 +18347,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18328
18347
  continue;
18329
18348
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
18330
18349
  continue;
18350
+ if (includeCompactionHistory && isNativeCompactionSummary(row)) {
18351
+ if (supportsNativeCommands && current) {
18352
+ const outcome = data.isCompacted === true ? { status: "succeeded" } : {
18353
+ status: "failed",
18354
+ error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
18355
+ };
18356
+ current.items.push({
18357
+ item: {
18358
+ type: "contextCompaction",
18359
+ itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
18360
+ },
18361
+ outcome
18362
+ });
18363
+ }
18364
+ continue;
18365
+ }
18331
18366
  if (row.type === "message" && row.role === "user") {
18332
18367
  current = {
18333
18368
  nativeTurnRef: nativeTurnRefSchema.parse({
@@ -23309,7 +23344,9 @@ function commandCaveat(row) {
23309
23344
  }
23310
23345
  function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
23311
23346
  const rows2 = nativeHistoryRows(contents);
23312
- const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile).turns;
23347
+ const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
23348
+ includeCompactionHistory: false
23349
+ }).turns;
23313
23350
  let excluded2;
23314
23351
  if (input.kind === "rollbackLastTurn") {
23315
23352
  if (!turns.length)
@@ -14677,6 +14677,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14677
14677
  cachedInputTokens: count,
14678
14678
  cacheWriteInputTokens: count,
14679
14679
  cacheKnownInputTokens: count,
14680
+ cacheHitCachedInputTokens: count,
14681
+ cacheHitInputTokens: count,
14680
14682
  outputTokens: count,
14681
14683
  reasoningOutputTokens: count,
14682
14684
  /** USD at the public price, summed over the priced requests only. */
@@ -18734,6 +18734,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
18734
18734
  cachedInputTokens: count,
18735
18735
  cacheWriteInputTokens: count,
18736
18736
  cacheKnownInputTokens: count,
18737
+ cacheHitCachedInputTokens: count,
18738
+ cacheHitInputTokens: count,
18737
18739
  outputTokens: count,
18738
18740
  reasoningOutputTokens: count,
18739
18741
  /** USD at the public price, summed over the priced requests only. */
@@ -15044,6 +15044,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15044
15044
  cachedInputTokens: count,
15045
15045
  cacheWriteInputTokens: count,
15046
15046
  cacheKnownInputTokens: count,
15047
+ cacheHitCachedInputTokens: count,
15048
+ cacheHitInputTokens: count,
15047
15049
  outputTokens: count,
15048
15050
  reasoningOutputTokens: count,
15049
15051
  /** USD at the public price, summed over the priced requests only. */
@@ -18924,6 +18924,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
18924
18924
  cachedInputTokens: count,
18925
18925
  cacheWriteInputTokens: count,
18926
18926
  cacheKnownInputTokens: count,
18927
+ cacheHitCachedInputTokens: count,
18928
+ cacheHitInputTokens: count,
18927
18929
  outputTokens: count,
18928
18930
  reasoningOutputTokens: count,
18929
18931
  /** USD at the public price, summed over the priced requests only. */
@@ -26295,15 +26297,24 @@ function attachedKnownInvocation(value, sinks) {
26295
26297
  return { event: value.event, eventId: value.eventId, agentId: value.agentId };
26296
26298
  }
26297
26299
  function parseApprovalRequest(value) {
26298
- if (!hasOnlyKeys(value, ["toolName"], ["callId", "reason"]) || !nonBlankString3(value.toolName) || Object.hasOwn(value, "callId") && !nonBlankString3(value.callId) || Object.hasOwn(value, "reason") && !boundedString3(value.reason)) {
26300
+ if (!hasOnlyKeys(value, ["toolName"], ["callId", "reason", "displayReason"]) || !nonBlankString3(value.toolName) || Object.hasOwn(value, "callId") && !nonBlankString3(value.callId) || Object.hasOwn(value, "reason") && !boundedString3(value.reason) || Object.hasOwn(value, "displayReason") && !isApprovalDisplayReason(value.displayReason)) {
26299
26301
  throw invalidFrame();
26300
26302
  }
26301
26303
  return {
26302
26304
  toolName: value.toolName,
26303
26305
  ...typeof value.callId === "string" ? { callId: value.callId } : {},
26304
- ...typeof value.reason === "string" ? { reason: value.reason } : {}
26306
+ ...typeof value.reason === "string" ? { reason: value.reason } : {},
26307
+ ...Object.hasOwn(value, "displayReason") ? { displayReason: value.displayReason } : {}
26305
26308
  };
26306
26309
  }
26310
+ function isApprovalDisplayReason(value) {
26311
+ if (!isPlainRecord6(value))
26312
+ return false;
26313
+ const entries = Object.entries(value);
26314
+ if (entries.length === 0)
26315
+ return false;
26316
+ return entries.every(([locale, text]) => locale.length > 0 && nonBlankString3(text) && boundedString3(text));
26317
+ }
26307
26318
  function parseQuestionRequest(value) {
26308
26319
  if (!hasOnlyKeys(value, ["questions"], ["wait"]) || !Array.isArray(value.questions)) {
26309
26320
  throw invalidFrame();
@@ -28261,7 +28272,7 @@ function validateInboxSplice(data, profile) {
28261
28272
  }
28262
28273
  }
28263
28274
  function validateApprovalAsked(data) {
28264
- requiredOptionalKeys(data, ["id", "toolName"], ["callId", "reason"]);
28275
+ requiredOptionalKeys(data, ["id", "toolName"], ["callId", "reason", "displayReason"]);
28265
28276
  requiredString(data.id, "approval/asked id");
28266
28277
  requiredString(data.toolName, "approval/asked toolName");
28267
28278
  if (data.callId !== void 0)
@@ -28269,6 +28280,17 @@ function validateApprovalAsked(data) {
28269
28280
  if (data.reason !== void 0 && typeof data.reason !== "string") {
28270
28281
  fail("Modern history approval/asked reason is malformed");
28271
28282
  }
28283
+ if (data.displayReason !== void 0 && !isApprovalDisplayReason2(data.displayReason)) {
28284
+ fail("Modern history approval/asked displayReason is malformed");
28285
+ }
28286
+ }
28287
+ function isApprovalDisplayReason2(value) {
28288
+ if (!isRecord4(value))
28289
+ return false;
28290
+ const entries = Object.entries(value);
28291
+ if (entries.length === 0)
28292
+ return false;
28293
+ return entries.every(([locale, text]) => locale.length > 0 && typeof text === "string" && text.length > 0 && nonBlankString(text));
28272
28294
  }
28273
28295
  function validateApprovalDecided(data) {
28274
28296
  exactKeys(data, ["id", "outcome"]);
@@ -29182,7 +29204,7 @@ var ModernHarnessSession = class {
29182
29204
  type: "approval",
29183
29205
  interactionId,
29184
29206
  turnId: active.turnId,
29185
- title: delivery.request.reason ?? `Allow ${delivery.request.toolName}?`,
29207
+ title: delivery.request.displayReason?.en ?? delivery.request.reason ?? `Allow ${delivery.request.toolName}?`,
29186
29208
  description: delivery.request.callId ? `${delivery.request.toolName} (${delivery.request.callId})` : delivery.request.toolName,
29187
29209
  subject: { type: "nativeAction" },
29188
29210
  actions: [
@@ -15277,6 +15277,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15277
15277
  cachedInputTokens: count2,
15278
15278
  cacheWriteInputTokens: count2,
15279
15279
  cacheKnownInputTokens: count2,
15280
+ cacheHitCachedInputTokens: count2,
15281
+ cacheHitInputTokens: count2,
15280
15282
  outputTokens: count2,
15281
15283
  reasoningOutputTokens: count2,
15282
15284
  /** USD at the public price, summed over the priced requests only. */
@@ -15044,6 +15044,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15044
15044
  cachedInputTokens: count,
15045
15045
  cacheWriteInputTokens: count,
15046
15046
  cacheKnownInputTokens: count,
15047
+ cacheHitCachedInputTokens: count,
15048
+ cacheHitInputTokens: count,
15047
15049
  outputTokens: count,
15048
15050
  reasoningOutputTokens: count,
15049
15051
  /** USD at the public price, summed over the priced requests only. */
@@ -15164,6 +15164,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15164
15164
  cachedInputTokens: count,
15165
15165
  cacheWriteInputTokens: count,
15166
15166
  cacheKnownInputTokens: count,
15167
+ cacheHitCachedInputTokens: count,
15168
+ cacheHitInputTokens: count,
15167
15169
  outputTokens: count,
15168
15170
  reasoningOutputTokens: count,
15169
15171
  /** USD at the public price, summed over the priced requests only. */
@@ -15023,6 +15023,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15023
15023
  cachedInputTokens: count,
15024
15024
  cacheWriteInputTokens: count,
15025
15025
  cacheKnownInputTokens: count,
15026
+ cacheHitCachedInputTokens: count,
15027
+ cacheHitInputTokens: count,
15026
15028
  outputTokens: count,
15027
15029
  reasoningOutputTokens: count,
15028
15030
  /** USD at the public price, summed over the priced requests only. */
@@ -15226,6 +15226,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15226
15226
  cachedInputTokens: count,
15227
15227
  cacheWriteInputTokens: count,
15228
15228
  cacheKnownInputTokens: count,
15229
+ cacheHitCachedInputTokens: count,
15230
+ cacheHitInputTokens: count,
15229
15231
  outputTokens: count,
15230
15232
  reasoningOutputTokens: count,
15231
15233
  /** USD at the public price, summed over the priced requests only. */
@@ -15223,6 +15223,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15223
15223
  cachedInputTokens: count,
15224
15224
  cacheWriteInputTokens: count,
15225
15225
  cacheKnownInputTokens: count,
15226
+ cacheHitCachedInputTokens: count,
15227
+ cacheHitInputTokens: count,
15226
15228
  outputTokens: count,
15227
15229
  reasoningOutputTokens: count,
15228
15230
  /** USD at the public price, summed over the priced requests only. */
@@ -15223,6 +15223,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15223
15223
  cachedInputTokens: count,
15224
15224
  cacheWriteInputTokens: count,
15225
15225
  cacheKnownInputTokens: count,
15226
+ cacheHitCachedInputTokens: count,
15227
+ cacheHitInputTokens: count,
15226
15228
  outputTokens: count,
15227
15229
  reasoningOutputTokens: count,
15228
15230
  /** USD at the public price, summed over the priced requests only. */
@@ -18492,7 +18494,7 @@ function normalizePiThinkingOptions(levels) {
18492
18494
  label: PI_THINKING_LABELS[id] ?? fallbackThinkingLabel(id)
18493
18495
  }));
18494
18496
  }
18495
- function normalizePiModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId) {
18497
+ function normalizePiModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId, effectiveModelReasoning = null) {
18496
18498
  const byRef = /* @__PURE__ */ new Map();
18497
18499
  for (const native of nativeModels) {
18498
18500
  const ref = encodePiModelRef(native);
@@ -18508,12 +18510,21 @@ function normalizePiModelCatalog(nativeModels, effectiveModel, thinkingLevels, e
18508
18510
  ref,
18509
18511
  label: `${native.provider} / ${native.id}`
18510
18512
  },
18511
- reasoning: native.reasoning
18513
+ reasoning: native.reasoning,
18514
+ synthesized: false
18512
18515
  });
18513
18516
  }
18514
18517
  const defaultModel = effectiveModel ? encodePiModelRef(effectiveModel) : void 0;
18515
- if (defaultModel && !byRef.has(defaultModel.id)) {
18516
- throw new Error("Pi effective Model is absent from the available Model catalog");
18518
+ if (effectiveModel && defaultModel && !byRef.has(defaultModel.id)) {
18519
+ const reasoning = effectiveThinkingOptionId && effectiveThinkingOptionId !== "off" || (effectiveModelReasoning ?? Boolean(thinkingLevels && thinkingLevels.some((level) => level !== "off")));
18520
+ byRef.set(defaultModel.id, {
18521
+ model: {
18522
+ ref: defaultModel,
18523
+ label: `${effectiveModel.provider} / ${effectiveModel.id}`
18524
+ },
18525
+ reasoning,
18526
+ synthesized: true
18527
+ });
18517
18528
  }
18518
18529
  if (thinkingLevels && effectiveThinkingOptionId && !thinkingLevels.includes(effectiveThinkingOptionId)) {
18519
18530
  throw new Error("Pi effective Thinking option is absent from the available option catalog");
@@ -18524,9 +18535,10 @@ function normalizePiModelCatalog(nativeModels, effectiveModel, thinkingLevels, e
18524
18535
  const thinkingOptions = thinkingLevels ? normalizePiThinkingOptions(PI_DRAFT_THINKING_OPTION_IDS) : [];
18525
18536
  const allThinkingOptionIds = thinkingOptions.map(({ id }) => id);
18526
18537
  const offThinkingOptionId = thinkingOptions.find(({ id }) => id === "off")?.id;
18527
- const models = [...byRef.values()].map(({ model: model2, reasoning }) => ({
18538
+ const effectiveThinkingOptionIds = thinkingLevels ? allThinkingOptionIds.filter((id) => thinkingLevels.includes(id)) : allThinkingOptionIds;
18539
+ const models = [...byRef.values()].map(({ model: model2, reasoning, synthesized }) => ({
18528
18540
  ...model2,
18529
- supportedThinkingOptionIds: reasoning ? allThinkingOptionIds : offThinkingOptionId ? [offThinkingOptionId] : []
18541
+ supportedThinkingOptionIds: reasoning ? synthesized ? effectiveThinkingOptionIds : allThinkingOptionIds : offThinkingOptionId ? [offThinkingOptionId] : []
18530
18542
  })).sort((left, right) => compareText(left.label, right.label) || compareText(left.ref.id, right.ref.id));
18531
18543
  const defaultThinkingOptionId = thinkingOptions.find(({ id }) => id === effectiveThinkingOptionId)?.id;
18532
18544
  return harnessModelCatalogSchema.parse({
@@ -20234,6 +20246,7 @@ function sessionStateData(response) {
20234
20246
  function parseSessionState(response) {
20235
20247
  const data = sessionStateData(response);
20236
20248
  const model2 = parseNativeModel(data.model, "state");
20249
+ const modelReasoning = isRecord8(data.model) && typeof data.model.reasoning === "boolean" ? data.model.reasoning : null;
20237
20250
  if (!nonBlankString(data.sessionId)) {
20238
20251
  throw new PiRpcFaultError("protocolError", "Pi RPC state has no stable Session identity");
20239
20252
  }
@@ -20246,6 +20259,7 @@ function parseSessionState(response) {
20246
20259
  sessionFile: typeof data.sessionFile === "string" ? data.sessionFile : null,
20247
20260
  provider: model2?.provider ?? null,
20248
20261
  modelId: model2?.id ?? null,
20262
+ ...modelReasoning === null ? {} : { modelReasoning },
20249
20263
  thinkingLevel: thinkingLevel?.data ?? null,
20250
20264
  contextUsage: optionalPiStateContextUsage(data.contextUsage)
20251
20265
  };
@@ -23027,7 +23041,7 @@ var PiAdapter = class {
23027
23041
  stage = "capabilities";
23028
23042
  const thinkingLevels = await transport.getAvailableThinkingLevels();
23029
23043
  this.#thinkingSelectionSupported = thinkingLevels !== null;
23030
- const normalized = normalizePiModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel);
23044
+ const normalized = normalizePiModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel, transport.state.modelReasoning ?? null);
23031
23045
  const fastModels = await transport.supportsFastMode?.() ? piFastModelKeys(models) : /* @__PURE__ */ new Set();
23032
23046
  const catalog = withPiFast(normalized, fastModels);
23033
23047
  await transport.close();
@@ -27669,6 +27669,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
27669
27669
  cachedInputTokens: count,
27670
27670
  cacheWriteInputTokens: count,
27671
27671
  cacheKnownInputTokens: count,
27672
+ cacheHitCachedInputTokens: count,
27673
+ cacheHitInputTokens: count,
27672
27674
  outputTokens: count,
27673
27675
  reasoningOutputTokens: count,
27674
27676
  /** USD at the public price, summed over the priced requests only. */
@@ -27266,6 +27266,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
27266
27266
  cachedInputTokens: count,
27267
27267
  cacheWriteInputTokens: count,
27268
27268
  cacheKnownInputTokens: count,
27269
+ cacheHitCachedInputTokens: count,
27270
+ cacheHitInputTokens: count,
27269
27271
  outputTokens: count,
27270
27272
  reasoningOutputTokens: count,
27271
27273
  /** USD at the public price, summed over the priced requests only. */
@@ -14683,6 +14683,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14683
14683
  cachedInputTokens: count,
14684
14684
  cacheWriteInputTokens: count,
14685
14685
  cacheKnownInputTokens: count,
14686
+ cacheHitCachedInputTokens: count,
14687
+ cacheHitInputTokens: count,
14686
14688
  outputTokens: count,
14687
14689
  reasoningOutputTokens: count,
14688
14690
  /** USD at the public price, summed over the priced requests only. */
@@ -18938,7 +18940,17 @@ function pendingNativeHistoryRewind(contents) {
18938
18940
  const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
18939
18941
  return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
18940
18942
  }
18943
+ function isNativeCompactionSummary(row) {
18944
+ const data = record2(row.providerData);
18945
+ return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
18946
+ }
18941
18947
  function nativeHistoryRows(contents) {
18948
+ return collectNativeHistoryRows(contents, false);
18949
+ }
18950
+ function nativeDisplayHistoryRows(contents) {
18951
+ return collectNativeHistoryRows(contents, true);
18952
+ }
18953
+ function collectNativeHistoryRows(contents, followCompactionParent) {
18942
18954
  const entries = /* @__PURE__ */ new Map();
18943
18955
  let leaf = "";
18944
18956
  for (const row of parseRows(contents)) {
@@ -18963,10 +18975,16 @@ function nativeHistoryRows(contents) {
18963
18975
  throw new CodeBuddyError("protocolError", "Native history parent is missing");
18964
18976
  chain.push(row);
18965
18977
  leaf = text(row.parentId);
18978
+ if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
18979
+ const logicalParent = text(row.logicalParentId);
18980
+ if (logicalParent && !entries.has(logicalParent))
18981
+ throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
18982
+ leaf = logicalParent;
18983
+ }
18966
18984
  }
18967
18985
  return chain.reverse();
18968
18986
  }
18969
- function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
18987
+ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
18970
18988
  const supportsNativeCommands = nativeCommandsEnabled(profile);
18971
18989
  const supportsFork = capabilitiesForProfile(profile).history.fork;
18972
18990
  const turns = [];
@@ -18992,7 +19010,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18992
19010
  snapshot.item.outputTruncated = Boolean(output.truncated);
18993
19011
  }
18994
19012
  };
18995
- const history = nativeHistoryRows(contents);
19013
+ const includeCompactionHistory = options.includeCompactionHistory !== false;
19014
+ const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
18996
19015
  const manualCompactions = /* @__PURE__ */ new Set();
18997
19016
  let compactUser;
18998
19017
  if (supportsNativeCommands)
@@ -19026,6 +19045,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
19026
19045
  continue;
19027
19046
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
19028
19047
  continue;
19048
+ if (includeCompactionHistory && isNativeCompactionSummary(row)) {
19049
+ if (supportsNativeCommands && current) {
19050
+ const outcome = data.isCompacted === true ? { status: "succeeded" } : {
19051
+ status: "failed",
19052
+ error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
19053
+ };
19054
+ current.items.push({
19055
+ item: {
19056
+ type: "contextCompaction",
19057
+ itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
19058
+ },
19059
+ outcome
19060
+ });
19061
+ }
19062
+ continue;
19063
+ }
19029
19064
  if (row.type === "message" && row.role === "user") {
19030
19065
  current = {
19031
19066
  nativeTurnRef: nativeTurnRefSchema.parse({
@@ -24373,7 +24408,9 @@ function commandCaveat(row) {
24373
24408
  }
24374
24409
  function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
24375
24410
  const rows2 = nativeHistoryRows(contents);
24376
- const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile).turns;
24411
+ const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
24412
+ includeCompactionHistory: false
24413
+ }).turns;
24377
24414
  let excluded2;
24378
24415
  if (input.kind === "rollbackLastTurn") {
24379
24416
  if (!turns.length)
@@ -14869,6 +14869,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14869
14869
  cachedInputTokens: count,
14870
14870
  cacheWriteInputTokens: count,
14871
14871
  cacheKnownInputTokens: count,
14872
+ cacheHitCachedInputTokens: count,
14873
+ cacheHitInputTokens: count,
14872
14874
  outputTokens: count,
14873
14875
  reasoningOutputTokens: count,
14874
14876
  /** USD at the public price, summed over the priced requests only. */