@genesislcap/foundation-ai 15.4.1 → 15.6.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.
@@ -10,7 +10,7 @@ export { AI_FEATURE_FLAG, isAIFeatureEnabled } from './utils/feature-flags';
10
10
  export { ChatTemperature } from './utils/temperature';
11
11
  export { SUPPORTED_ANTHROPIC_MODEL_IDS, SUPPORTED_GEMINI_MODEL_IDS } from './types';
12
12
  export type { AIConfig, AIStatus, AIProviderType, AnthropicAIConfig, AnthropicModelId, ChromeAIConfig, ChromeAvailability, GeminiAIConfig, GeminiModelId, ServerAIConfig, } from './types';
13
- export type { AgentPickerMode, ChatAgentConfig, ChatAgentPickerConfig, ChatAnimationsConfig, ChatAttachment, ChatConfig, ChatCostHistoryConfig, ChatDriverResult, ChatFallback, ChatInputDuringExecutionMode, CachePolicy, ChatMessage, ChatInteraction, ChatRequestOptions, ChatResponseMeta, ChatRole, ChatStreamChunk, ChatToolCall, ChatToolCallUnknown, ChatToolChoice, ChatToolDefinition, ChatToolHandlers, ChatToolResult, ChatUiConfig, CondensePolicy, CondenseResult, CondenseTrigger, ChatSuggestionsConfig, InteractionPresentation, InteractionRequestOptions, InteractionResult, MessageCompaction, ModelTagAppearance, SubAgentFailureReason, SubAgentRequestOptions, TurnFailureReason, } from './types/chat.types';
13
+ export type { AggregateUsage, AgentPickerMode, ChatAgentConfig, ChatAgentPickerConfig, ChatAnimationsConfig, ChatAttachment, ChatConfig, ChatCostHistoryConfig, ChatDriverResult, ChatFallback, ChatInputDuringExecutionMode, CachePolicy, ChatMessage, ChatInteraction, ChatRequestOptions, ChatResponseMeta, ChatRole, ChatStreamChunk, ChatToolCall, ChatToolCallUnknown, ChatToolChoice, ChatToolDefinition, ChatToolHandlers, ChatToolResult, ChatUiConfig, CondensePolicy, CondenseResult, CondenseTrigger, ChatSuggestionsConfig, InteractionPresentation, InteractionRequestOptions, InteractionResult, MessageCompaction, ModelTagAppearance, SubAgentFailureReason, SubAgentRequestOptions, TurnFailureReason, } from './types/chat.types';
14
14
  export { isChatToolCallUnknown } from './types/chat.types';
15
15
  export type { ChatTransport } from './types/chat-transport.types';
16
16
  export type { CostReportingTransport } from './types/transports.types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,yBAAyB,EACzB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,eAAe,CAAC;AAKvB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AACpF,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,YAA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AM,eAAe,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/anthropic-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAGV,WAAW,EACX,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAmJ7B,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6GD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,kFAAkF;IAClF,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IACzC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE;;IAX5B,sDAAsD;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,OAAO,CAAC,MAAM,CAAC;IAwDvE,eAAe,CACnB,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IA2EvB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAqDrB;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IA2E3B,OAAO,CAAC,qBAAqB;IA0G7B,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;CAyBnB"}
@@ -88,6 +88,17 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
88
88
  */
89
89
  private logTokenUsage;
90
90
  private toGeminiContents;
91
+ /**
92
+ * Map Gemini's `usageMetadata` onto the provider-agnostic usage fields, pricing
93
+ * the call as a side effect (`logTokenUsage`). Returns an empty object when the
94
+ * response carries no usage — every field is optional, so an absent count stays
95
+ * `undefined` rather than being reported as a measured 0.
96
+ *
97
+ * Split out of `fromGeminiResponse` because it is self-contained bookkeeping
98
+ * that reads better alone — and because folding it inline pushed that method
99
+ * past the complexity ceiling.
100
+ */
101
+ private usageFromGemini;
91
102
  private fromGeminiResponse;
92
103
  /**
93
104
  * Raises {@link ResponseTruncatedError} when a `MAX_TOKENS` finish left nothing
@@ -1 +1 @@
1
- {"version":3,"file":"gemini-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/gemini-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAInB,MAAM,qBAAqB,CAAC;AA2I7B,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA0CD;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM;gBAAtB,aAAa,CAAC,EAAE,MAAM;CAI5C;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,WAAW,EAAE,aAAa,EAAE,sBAAsB;IACxF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD;;;;;OAKG;IACH,OAAO,CAAC,eAAe,CAAK;IAC5B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB,CAAK;gBAEnB,MAAM,GAAE,qBAA0B;IAe9C,S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,mGAAmG;IACnG,kBAAkB,IAAI,MAAM;IAI5B,+FAA+F;IAC/F,iBAAiB,IAAI,IAAI;IAOnB,oBAAoB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBvE,eAAe,CACnB,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IAuFvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,gBAAgB;IAoFxB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAyCvB,OAAO,CAAC,kBAAkB;IA0H1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgBlB,OAAO,CAAC,eAAe;CAexB"}
@@ -262,6 +262,30 @@ export interface ChatMessage {
262
262
  * Set by transports that return usage metadata. Used alongside `cost`.
263
263
  */
264
264
  outputTokens?: number;
265
+ /**
266
+ * Prompt tokens served from the provider's cache for the request that produced
267
+ * this message — the cheapest input bucket (a fraction of the uncached rate).
268
+ *
269
+ * A **breakdown of**, not an addition to, {@link ChatMessage.inputTokens}: that
270
+ * field is total prompt size, and this says how much of it was a cache hit. So
271
+ * uncached prompt tokens are
272
+ * `inputTokens - (cacheReadTokens ?? 0) - (cacheWriteTokens ?? 0)` — never add
273
+ * the buckets to `inputTokens` or you double-count the prompt.
274
+ *
275
+ * `undefined` on providers that report no cache breakdown and on messages
276
+ * persisted before this field existed, so read it with `?? 0`.
277
+ */
278
+ cacheReadTokens?: number;
279
+ /**
280
+ * Prompt tokens written to the provider's cache for the request that produced
281
+ * this message — billed at a premium over the uncached rate.
282
+ *
283
+ * Like {@link ChatMessage.cacheReadTokens}, a breakdown of
284
+ * {@link ChatMessage.inputTokens} rather than an addition to it. `undefined`
285
+ * where the provider reports no distinct write bucket (e.g. Gemini's implicit
286
+ * caching) — read it with `?? 0`.
287
+ */
288
+ cacheWriteTokens?: number;
265
289
  /**
266
290
  * Estimated USD cost for the single request that produced this message,
267
291
  * derived from the active model's input/output rates. Set by transports.
@@ -330,6 +354,50 @@ export interface MessageCompaction {
330
354
  model?: string;
331
355
  /** ISO timestamp the summary was produced. */
332
356
  createdAt: string;
357
+ /**
358
+ * Usage totalled across the messages this summary REPLACED, carried forward so
359
+ * a host that aggregates usage over the transcript stays whole across a
360
+ * compaction.
361
+ *
362
+ * Compaction is destructive: the original messages — and the per-message
363
+ * `cost`/token fields they carried — are gone from history. Without this, any
364
+ * running total re-derived from the transcript silently DROPS by the amount the
365
+ * compacted turns had already spent. Spend is not undone by summarising the
366
+ * turns that incurred it, so it is banked here instead.
367
+ *
368
+ * A summing consumer must therefore count this alongside per-message usage, and
369
+ * must NOT also count `tokensBefore` (a context-window reading of one turn, not
370
+ * cumulative spend). `undefined` on summaries written before this field existed.
371
+ */
372
+ rolledUpUsage?: AggregateUsage;
373
+ }
374
+ /**
375
+ * Usage totalled over a run of messages: the four token buckets plus USD cost.
376
+ *
377
+ * The token buckets are disjoint and additive — unlike the per-message fields on
378
+ * {@link ChatMessage}, where `inputTokens` is the whole prompt and
379
+ * `cacheReadTokens`/`cacheWriteTokens` break it down. Here the prompt has already
380
+ * been split into its three input buckets, so the four fields sum to total tokens
381
+ * processed with nothing counted twice.
382
+ *
383
+ * Each bucket bills at a different rate (cache reads a fraction of uncached input,
384
+ * cache writes a premium, output highest), which is why they are reported
385
+ * separately rather than as one total: a cache-heavy session shows large token
386
+ * volume at small cost, and a single summed number cannot express that.
387
+ *
388
+ * @beta
389
+ */
390
+ export interface AggregateUsage {
391
+ /** USD cost, provider-reported per request and summed — cache discounts applied. */
392
+ costUsd: number;
393
+ /** Prompt tokens billed at the full uncached input rate. */
394
+ uncachedInputTokens: number;
395
+ /** Prompt tokens served from the provider's cache. */
396
+ cacheReadTokens: number;
397
+ /** Prompt tokens written to the provider's cache. */
398
+ cacheWriteTokens: number;
399
+ /** Generated (output) tokens, including any reasoning tokens the provider bills as output. */
400
+ outputTokens: number;
333
401
  }
334
402
  /**
335
403
  * Provider-reported diagnostic for a single chat response, surfaced so the
@@ -1064,17 +1132,24 @@ export interface ChatAgentPickerConfig {
1064
1132
  disablePinColours?: boolean;
1065
1133
  }
1066
1134
  /**
1067
- * Cost tab and build-history persistence settings.
1135
+ * Cost tab and build-history settings.
1136
+ *
1137
+ * Opt-in: set `enabled: true` to record usage into scoped build history. Each session
1138
+ * key gets exactly ONE row, upserted as spend accrues — so a row is a project's lifetime
1139
+ * usage rather than a visit to it, and the Cost tab total is the sum of the rows alone.
1068
1140
  *
1069
- * Persistence is opt-in: set `enabled: true` to snapshot sessions into
1070
- * `localStorage` on tab close and when the session title changes.
1141
+ * Rows are written to `localStorage` unless the host's `SessionPersistenceProvider`
1142
+ * implements the cost-history methods, in which case they go there instead. That routing
1143
+ * is independent of the provider's own `enabled` ("remember chat") switch, matching how
1144
+ * preferences and diagnostics behave: usage accounting is not conversation content, so
1145
+ * turning off chat retention should not discard the cost ledger.
1071
1146
  *
1072
1147
  * @beta
1073
1148
  */
1074
1149
  export interface ChatCostHistoryConfig {
1075
1150
  /**
1076
- * Persist finalized sessions into scoped build history.
1077
- * Default: `false` (no automatic persistence).
1151
+ * Record session usage into scoped build history.
1152
+ * Default: `false` (nothing recorded, Cost tab history hidden).
1078
1153
  */
1079
1154
  enabled?: boolean;
1080
1155
  /** Host label for the active session (e.g. project name). */
@@ -1101,6 +1176,16 @@ export interface ChatCostHistoryConfig {
1101
1176
  * Default: `"Currently building"`.
1102
1177
  */
1103
1178
  badgeLabel?: string;
1179
+ /**
1180
+ * Optional disclosure line on the Cost tab, e.g. `"Totals cover the lifetime of your
1181
+ * current project."`
1182
+ *
1183
+ * Deliberately has NO default, unlike {@link ChatCostHistoryConfig.badgeLabel}: what
1184
+ * the totals span depends entirely on what the host's `scope` maps to, which only the
1185
+ * host knows. A library-supplied default would be asserting something it cannot
1186
+ * verify. Omitted or blank renders nothing.
1187
+ */
1188
+ summaryHint?: string;
1104
1189
  }
1105
1190
  /**
1106
1191
  * Display and engine configuration for the chat assistant.
@@ -1 +1 @@
1
- {"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,MAAM,GACN,cAAc,GACd,gBAAgB,GAChB,mBAAmB,CAAC;AAExB;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,M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CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -537,6 +537,8 @@ export class AnthropicTransport {
537
537
  var _a, _b, _c, _d, _e, _f, _g, _h;
538
538
  let inputTokens;
539
539
  let outputTokens;
540
+ let cacheReadTokens;
541
+ let cacheWriteTokens;
540
542
  let cost;
541
543
  if (response.usage) {
542
544
  const uncachedInput = (_a = response.usage.input_tokens) !== null && _a !== void 0 ? _a : 0;
@@ -553,6 +555,12 @@ export class AnthropicTransport {
553
555
  // `promptTokenCount`, which already includes cached tokens. Cost (above) reflects the
554
556
  // cache discount; this field is the size, not the bill.
555
557
  inputTokens = uncachedInput + cacheRead + cacheCreation;
558
+ // The two cache buckets BREAK DOWN the prompt total above rather than adding
559
+ // to it, so a consumer derives uncached input by subtracting them. Reported
560
+ // even when zero: "this provider measured the split and it was 0" is distinct
561
+ // from "this provider reports no split at all" (undefined).
562
+ cacheReadTokens = cacheRead;
563
+ cacheWriteTokens = cacheCreation;
556
564
  if (response.usage.output_tokens != null) {
557
565
  outputTokens = response.usage.output_tokens;
558
566
  }
@@ -597,6 +605,10 @@ export class AnthropicTransport {
597
605
  base.inputTokens = inputTokens;
598
606
  if (outputTokens != null)
599
607
  base.outputTokens = outputTokens;
608
+ if (cacheReadTokens != null)
609
+ base.cacheReadTokens = cacheReadTokens;
610
+ if (cacheWriteTokens != null)
611
+ base.cacheWriteTokens = cacheWriteTokens;
600
612
  if (cost != null)
601
613
  base.cost = cost;
602
614
  // Surface a non-standard stop reason for observability and parity with the
@@ -384,32 +384,47 @@ export class GeminiTransport {
384
384
  }
385
385
  return contents;
386
386
  }
387
+ /**
388
+ * Map Gemini's `usageMetadata` onto the provider-agnostic usage fields, pricing
389
+ * the call as a side effect (`logTokenUsage`). Returns an empty object when the
390
+ * response carries no usage — every field is optional, so an absent count stays
391
+ * `undefined` rather than being reported as a measured 0.
392
+ *
393
+ * Split out of `fromGeminiResponse` because it is self-contained bookkeeping
394
+ * that reads better alone — and because folding it inline pushed that method
395
+ * past the complexity ceiling.
396
+ */
397
+ usageFromGemini(usageMetadata) {
398
+ var _a, _b, _c, _d, _e, _f;
399
+ if (!usageMetadata)
400
+ return {};
401
+ const usage = usageMetadata;
402
+ const cost = this.logTokenUsage((_a = usage.promptTokenCount) !== null && _a !== void 0 ? _a : 0, (_b = usage.candidatesTokenCount) !== null && _b !== void 0 ? _b : 0, (_c = usage.thoughtsTokenCount) !== null && _c !== void 0 ? _c : 0, (_d = usage.cachedContentTokenCount) !== null && _d !== void 0 ? _d : 0);
403
+ return {
404
+ inputTokens: usage.promptTokenCount,
405
+ // Thinking tokens are generated output, billed at the candidate rate, but
406
+ // reported in a field disjoint from `candidatesTokenCount`. Fold them into the
407
+ // provider-agnostic `outputTokens` so it reflects the true generated total —
408
+ // matching Anthropic, whose `output_tokens` already includes them. Left
409
+ // `undefined` only when the provider reported neither count.
410
+ outputTokens: usage.candidatesTokenCount != null || usage.thoughtsTokenCount != null
411
+ ? ((_e = usage.candidatesTokenCount) !== null && _e !== void 0 ? _e : 0) + ((_f = usage.thoughtsTokenCount) !== null && _f !== void 0 ? _f : 0)
412
+ : undefined,
413
+ thoughtsTokens: usage.thoughtsTokenCount,
414
+ // Gemini reports cache HITS only — implicit caching bills no separate write, so
415
+ // `cacheWriteTokens` is left unset rather than 0 (there is no write bucket to
416
+ // measure, which is not the same as measuring 0). Already counted inside
417
+ // `promptTokenCount`, so this breaks that total down rather than adding to it.
418
+ cacheReadTokens: usage.cachedContentTokenCount,
419
+ cost,
420
+ };
421
+ }
387
422
  fromGeminiResponse(response, offeredToolNames = new Set()) {
388
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
389
- let inputTokens;
390
- let outputTokens;
391
- let thoughtsTokens;
392
- let cost;
393
- if (response.usageMetadata) {
394
- const usage = response.usageMetadata;
395
- cost = this.logTokenUsage((_a = usage.promptTokenCount) !== null && _a !== void 0 ? _a : 0, (_b = usage.candidatesTokenCount) !== null && _b !== void 0 ? _b : 0, (_c = usage.thoughtsTokenCount) !== null && _c !== void 0 ? _c : 0, (_d = usage.cachedContentTokenCount) !== null && _d !== void 0 ? _d : 0);
396
- if (usage.promptTokenCount != null) {
397
- inputTokens = usage.promptTokenCount;
398
- }
399
- if (usage.thoughtsTokenCount != null) {
400
- thoughtsTokens = usage.thoughtsTokenCount;
401
- }
402
- if (usage.candidatesTokenCount != null || usage.thoughtsTokenCount != null) {
403
- // Thinking tokens are generated output, billed at the candidate rate, but
404
- // reported in a field disjoint from `candidatesTokenCount`. Fold them into
405
- // the provider-agnostic `outputTokens` so it reflects the true generated
406
- // total — matching Anthropic, whose `output_tokens` already includes them.
407
- outputTokens = ((_e = usage.candidatesTokenCount) !== null && _e !== void 0 ? _e : 0) + ((_f = usage.thoughtsTokenCount) !== null && _f !== void 0 ? _f : 0);
408
- }
409
- }
423
+ var _a, _b, _c, _d;
424
+ const { inputTokens, outputTokens, thoughtsTokens, cacheReadTokens, cost } = this.usageFromGemini(response.usageMetadata);
410
425
  const candidates = response === null || response === void 0 ? void 0 : response.candidates;
411
426
  const firstCandidate = candidates === null || candidates === void 0 ? void 0 : candidates[0];
412
- const parts = (_h = (_g = firstCandidate === null || firstCandidate === void 0 ? void 0 : firstCandidate.content) === null || _g === void 0 ? void 0 : _g.parts) !== null && _h !== void 0 ? _h : [];
427
+ const parts = (_b = (_a = firstCandidate === null || firstCandidate === void 0 ? void 0 : firstCandidate.content) === null || _a === void 0 ? void 0 : _a.parts) !== null && _b !== void 0 ? _b : [];
413
428
  const toolCalls = [];
414
429
  const thoughtParts = [];
415
430
  const textParts = [];
@@ -426,7 +441,7 @@ export class GeminiTransport {
426
441
  toolCalls.push({
427
442
  id: crypto.randomUUID(),
428
443
  name: part.functionCall.name,
429
- args: (_j = part.functionCall.args) !== null && _j !== void 0 ? _j : {},
444
+ args: (_c = part.functionCall.args) !== null && _c !== void 0 ? _c : {},
430
445
  providerMetadata: { [GEMINI_PROVIDER_KEY]: state },
431
446
  });
432
447
  }
@@ -480,12 +495,14 @@ export class GeminiTransport {
480
495
  base.inputTokens = inputTokens;
481
496
  if (outputTokens != null)
482
497
  base.outputTokens = outputTokens;
498
+ if (cacheReadTokens != null)
499
+ base.cacheReadTokens = cacheReadTokens;
483
500
  if (cost != null)
484
501
  base.cost = cost;
485
502
  // Surface the provider diagnostic on the message so the driver can fold it
486
503
  // into the debug-log meta events (the console log above is dev-only). Only
487
504
  // when there's signal — a finish reason, thinking tokens, or a block reason.
488
- const blockReason = (_k = response.promptFeedback) === null || _k === void 0 ? void 0 : _k.blockReason;
505
+ const blockReason = (_d = response.promptFeedback) === null || _d === void 0 ? void 0 : _d.blockReason;
489
506
  if (finishReason != null || thoughtsTokens != null || blockReason != null) {
490
507
  base.responseMeta = {
491
508
  finishReason,
@@ -198,6 +198,159 @@
198
198
  "endIndex": 2
199
199
  }
200
200
  },
201
+ {
202
+ "kind": "Interface",
203
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage:interface",
204
+ "docComment": "/**\n * Usage totalled over a run of messages: the four token buckets plus USD cost.\n *\n * The token buckets are disjoint and additive — unlike the per-message fields on {@link ChatMessage}, where `inputTokens` is the whole prompt and `cacheReadTokens`/`cacheWriteTokens` break it down. Here the prompt has already been split into its three input buckets, so the four fields sum to total tokens processed with nothing counted twice.\n *\n * Each bucket bills at a different rate (cache reads a fraction of uncached input, cache writes a premium, output highest), which is why they are reported separately rather than as one total: a cache-heavy session shows large token volume at small cost, and a single summed number cannot express that.\n *\n * @beta\n */\n",
205
+ "excerptTokens": [
206
+ {
207
+ "kind": "Content",
208
+ "text": "export interface AggregateUsage "
209
+ }
210
+ ],
211
+ "fileUrlPath": "src/types/chat.types.ts",
212
+ "releaseTag": "Beta",
213
+ "name": "AggregateUsage",
214
+ "preserveMemberOrder": false,
215
+ "members": [
216
+ {
217
+ "kind": "PropertySignature",
218
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage#cacheReadTokens:member",
219
+ "docComment": "/**\n * Prompt tokens served from the provider's cache.\n */\n",
220
+ "excerptTokens": [
221
+ {
222
+ "kind": "Content",
223
+ "text": "cacheReadTokens: "
224
+ },
225
+ {
226
+ "kind": "Content",
227
+ "text": "number"
228
+ },
229
+ {
230
+ "kind": "Content",
231
+ "text": ";"
232
+ }
233
+ ],
234
+ "isReadonly": false,
235
+ "isOptional": false,
236
+ "releaseTag": "Beta",
237
+ "name": "cacheReadTokens",
238
+ "propertyTypeTokenRange": {
239
+ "startIndex": 1,
240
+ "endIndex": 2
241
+ }
242
+ },
243
+ {
244
+ "kind": "PropertySignature",
245
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage#cacheWriteTokens:member",
246
+ "docComment": "/**\n * Prompt tokens written to the provider's cache.\n */\n",
247
+ "excerptTokens": [
248
+ {
249
+ "kind": "Content",
250
+ "text": "cacheWriteTokens: "
251
+ },
252
+ {
253
+ "kind": "Content",
254
+ "text": "number"
255
+ },
256
+ {
257
+ "kind": "Content",
258
+ "text": ";"
259
+ }
260
+ ],
261
+ "isReadonly": false,
262
+ "isOptional": false,
263
+ "releaseTag": "Beta",
264
+ "name": "cacheWriteTokens",
265
+ "propertyTypeTokenRange": {
266
+ "startIndex": 1,
267
+ "endIndex": 2
268
+ }
269
+ },
270
+ {
271
+ "kind": "PropertySignature",
272
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage#costUsd:member",
273
+ "docComment": "/**\n * USD cost, provider-reported per request and summed — cache discounts applied.\n */\n",
274
+ "excerptTokens": [
275
+ {
276
+ "kind": "Content",
277
+ "text": "costUsd: "
278
+ },
279
+ {
280
+ "kind": "Content",
281
+ "text": "number"
282
+ },
283
+ {
284
+ "kind": "Content",
285
+ "text": ";"
286
+ }
287
+ ],
288
+ "isReadonly": false,
289
+ "isOptional": false,
290
+ "releaseTag": "Beta",
291
+ "name": "costUsd",
292
+ "propertyTypeTokenRange": {
293
+ "startIndex": 1,
294
+ "endIndex": 2
295
+ }
296
+ },
297
+ {
298
+ "kind": "PropertySignature",
299
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage#outputTokens:member",
300
+ "docComment": "/**\n * Generated (output) tokens, including any reasoning tokens the provider bills as output.\n */\n",
301
+ "excerptTokens": [
302
+ {
303
+ "kind": "Content",
304
+ "text": "outputTokens: "
305
+ },
306
+ {
307
+ "kind": "Content",
308
+ "text": "number"
309
+ },
310
+ {
311
+ "kind": "Content",
312
+ "text": ";"
313
+ }
314
+ ],
315
+ "isReadonly": false,
316
+ "isOptional": false,
317
+ "releaseTag": "Beta",
318
+ "name": "outputTokens",
319
+ "propertyTypeTokenRange": {
320
+ "startIndex": 1,
321
+ "endIndex": 2
322
+ }
323
+ },
324
+ {
325
+ "kind": "PropertySignature",
326
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage#uncachedInputTokens:member",
327
+ "docComment": "/**\n * Prompt tokens billed at the full uncached input rate.\n */\n",
328
+ "excerptTokens": [
329
+ {
330
+ "kind": "Content",
331
+ "text": "uncachedInputTokens: "
332
+ },
333
+ {
334
+ "kind": "Content",
335
+ "text": "number"
336
+ },
337
+ {
338
+ "kind": "Content",
339
+ "text": ";"
340
+ }
341
+ ],
342
+ "isReadonly": false,
343
+ "isOptional": false,
344
+ "releaseTag": "Beta",
345
+ "name": "uncachedInputTokens",
346
+ "propertyTypeTokenRange": {
347
+ "startIndex": 1,
348
+ "endIndex": 2
349
+ }
350
+ }
351
+ ],
352
+ "extendsTokenRanges": []
353
+ },
201
354
  {
202
355
  "kind": "Variable",
203
356
  "canonicalReference": "@genesislcap/foundation-ai!AI_FEATURE_FLAG:var",
@@ -2950,7 +3103,7 @@
2950
3103
  {
2951
3104
  "kind": "Interface",
2952
3105
  "canonicalReference": "@genesislcap/foundation-ai!ChatCostHistoryConfig:interface",
2953
- "docComment": "/**\n * Cost tab and build-history persistence settings.\n *\n * Persistence is opt-in: set `enabled: true` to snapshot sessions into `localStorage` on tab close and when the session title changes.\n *\n * @beta\n */\n",
3106
+ "docComment": "/**\n * Cost tab and build-history settings.\n *\n * Opt-in: set `enabled: true` to record usage into scoped build history. Each session key gets exactly ONE row, upserted as spend accrues — so a row is a project's lifetime usage rather than a visit to it, and the Cost tab total is the sum of the rows alone.\n *\n * Rows are written to `localStorage` unless the host's `SessionPersistenceProvider` implements the cost-history methods, in which case they go there instead. That routing is independent of the provider's own `enabled` (\"remember chat\") switch, matching how preferences and diagnostics behave: usage accounting is not conversation content, so turning off chat retention should not discard the cost ledger.\n *\n * @beta\n */\n",
2954
3107
  "excerptTokens": [
2955
3108
  {
2956
3109
  "kind": "Content",
@@ -2992,7 +3145,7 @@
2992
3145
  {
2993
3146
  "kind": "PropertySignature",
2994
3147
  "canonicalReference": "@genesislcap/foundation-ai!ChatCostHistoryConfig#enabled:member",
2995
- "docComment": "/**\n * Persist finalized sessions into scoped build history. Default: `false` (no automatic persistence).\n */\n",
3148
+ "docComment": "/**\n * Record session usage into scoped build history. Default: `false` (nothing recorded, Cost tab history hidden).\n */\n",
2996
3149
  "excerptTokens": [
2997
3150
  {
2998
3151
  "kind": "Content",
@@ -3097,6 +3250,33 @@
3097
3250
  "endIndex": 2
3098
3251
  }
3099
3252
  },
3253
+ {
3254
+ "kind": "PropertySignature",
3255
+ "canonicalReference": "@genesislcap/foundation-ai!ChatCostHistoryConfig#summaryHint:member",
3256
+ "docComment": "/**\n * Optional disclosure line on the Cost tab, e.g. `\"Totals cover the lifetime of your current project.\"`\n *\n * Deliberately has NO default, unlike {@link ChatCostHistoryConfig.badgeLabel}: what the totals span depends entirely on what the host's `scope` maps to, which only the host knows. A library-supplied default would be asserting something it cannot verify. Omitted or blank renders nothing.\n */\n",
3257
+ "excerptTokens": [
3258
+ {
3259
+ "kind": "Content",
3260
+ "text": "summaryHint?: "
3261
+ },
3262
+ {
3263
+ "kind": "Content",
3264
+ "text": "string"
3265
+ },
3266
+ {
3267
+ "kind": "Content",
3268
+ "text": ";"
3269
+ }
3270
+ ],
3271
+ "isReadonly": false,
3272
+ "isOptional": true,
3273
+ "releaseTag": "Beta",
3274
+ "name": "summaryHint",
3275
+ "propertyTypeTokenRange": {
3276
+ "startIndex": 1,
3277
+ "endIndex": 2
3278
+ }
3279
+ },
3100
3280
  {
3101
3281
  "kind": "PropertySignature",
3102
3282
  "canonicalReference": "@genesislcap/foundation-ai!ChatCostHistoryConfig#title:member",
@@ -3520,6 +3700,60 @@
3520
3700
  "endIndex": 3
3521
3701
  }
3522
3702
  },
3703
+ {
3704
+ "kind": "PropertySignature",
3705
+ "canonicalReference": "@genesislcap/foundation-ai!ChatMessage#cacheReadTokens:member",
3706
+ "docComment": "/**\n * Prompt tokens served from the provider's cache for the request that produced this message — the cheapest input bucket (a fraction of the uncached rate).\n *\n * A **breakdown of**, not an addition to, {@link ChatMessage.inputTokens}: that field is total prompt size, and this says how much of it was a cache hit. So uncached prompt tokens are `inputTokens - (cacheReadTokens ?? 0) - (cacheWriteTokens ?? 0)` — never add the buckets to `inputTokens` or you double-count the prompt.\n *\n * `undefined` on providers that report no cache breakdown and on messages persisted before this field existed, so read it with `?? 0`.\n */\n",
3707
+ "excerptTokens": [
3708
+ {
3709
+ "kind": "Content",
3710
+ "text": "cacheReadTokens?: "
3711
+ },
3712
+ {
3713
+ "kind": "Content",
3714
+ "text": "number"
3715
+ },
3716
+ {
3717
+ "kind": "Content",
3718
+ "text": ";"
3719
+ }
3720
+ ],
3721
+ "isReadonly": false,
3722
+ "isOptional": true,
3723
+ "releaseTag": "Beta",
3724
+ "name": "cacheReadTokens",
3725
+ "propertyTypeTokenRange": {
3726
+ "startIndex": 1,
3727
+ "endIndex": 2
3728
+ }
3729
+ },
3730
+ {
3731
+ "kind": "PropertySignature",
3732
+ "canonicalReference": "@genesislcap/foundation-ai!ChatMessage#cacheWriteTokens:member",
3733
+ "docComment": "/**\n * Prompt tokens written to the provider's cache for the request that produced this message — billed at a premium over the uncached rate.\n *\n * Like {@link ChatMessage.cacheReadTokens}, a breakdown of {@link ChatMessage.inputTokens} rather than an addition to it. `undefined` where the provider reports no distinct write bucket (e.g. Gemini's implicit caching) — read it with `?? 0`.\n */\n",
3734
+ "excerptTokens": [
3735
+ {
3736
+ "kind": "Content",
3737
+ "text": "cacheWriteTokens?: "
3738
+ },
3739
+ {
3740
+ "kind": "Content",
3741
+ "text": "number"
3742
+ },
3743
+ {
3744
+ "kind": "Content",
3745
+ "text": ";"
3746
+ }
3747
+ ],
3748
+ "isReadonly": false,
3749
+ "isOptional": true,
3750
+ "releaseTag": "Beta",
3751
+ "name": "cacheWriteTokens",
3752
+ "propertyTypeTokenRange": {
3753
+ "startIndex": 1,
3754
+ "endIndex": 2
3755
+ }
3756
+ },
3523
3757
  {
3524
3758
  "kind": "PropertySignature",
3525
3759
  "canonicalReference": "@genesislcap/foundation-ai!ChatMessage#category:member",
@@ -8034,6 +8268,34 @@
8034
8268
  "endIndex": 2
8035
8269
  }
8036
8270
  },
8271
+ {
8272
+ "kind": "PropertySignature",
8273
+ "canonicalReference": "@genesislcap/foundation-ai!MessageCompaction#rolledUpUsage:member",
8274
+ "docComment": "/**\n * Usage totalled across the messages this summary REPLACED, carried forward so a host that aggregates usage over the transcript stays whole across a compaction.\n *\n * Compaction is destructive: the original messages — and the per-message `cost`/token fields they carried — are gone from history. Without this, any running total re-derived from the transcript silently DROPS by the amount the compacted turns had already spent. Spend is not undone by summarising the turns that incurred it, so it is banked here instead.\n *\n * A summing consumer must therefore count this alongside per-message usage, and must NOT also count `tokensBefore` (a context-window reading of one turn, not cumulative spend). `undefined` on summaries written before this field existed.\n */\n",
8275
+ "excerptTokens": [
8276
+ {
8277
+ "kind": "Content",
8278
+ "text": "rolledUpUsage?: "
8279
+ },
8280
+ {
8281
+ "kind": "Reference",
8282
+ "text": "AggregateUsage",
8283
+ "canonicalReference": "@genesislcap/foundation-ai!AggregateUsage:interface"
8284
+ },
8285
+ {
8286
+ "kind": "Content",
8287
+ "text": ";"
8288
+ }
8289
+ ],
8290
+ "isReadonly": false,
8291
+ "isOptional": true,
8292
+ "releaseTag": "Beta",
8293
+ "name": "rolledUpUsage",
8294
+ "propertyTypeTokenRange": {
8295
+ "startIndex": 1,
8296
+ "endIndex": 2
8297
+ }
8298
+ },
8037
8299
  {
8038
8300
  "kind": "PropertySignature",
8039
8301
  "canonicalReference": "@genesislcap/foundation-ai!MessageCompaction#tokensBefore:member",
@@ -19,6 +19,35 @@ import { InterfaceSymbol } from '@microsoft/fast-foundation';
19
19
  */
20
20
  export declare type AgentPickerMode = 'disabled' | 'select' | 'segmented-control';
21
21
 
22
+ /**
23
+ * Usage totalled over a run of messages: the four token buckets plus USD cost.
24
+ *
25
+ * The token buckets are disjoint and additive — unlike the per-message fields on
26
+ * {@link ChatMessage}, where `inputTokens` is the whole prompt and
27
+ * `cacheReadTokens`/`cacheWriteTokens` break it down. Here the prompt has already
28
+ * been split into its three input buckets, so the four fields sum to total tokens
29
+ * processed with nothing counted twice.
30
+ *
31
+ * Each bucket bills at a different rate (cache reads a fraction of uncached input,
32
+ * cache writes a premium, output highest), which is why they are reported
33
+ * separately rather than as one total: a cache-heavy session shows large token
34
+ * volume at small cost, and a single summed number cannot express that.
35
+ *
36
+ * @beta
37
+ */
38
+ export declare interface AggregateUsage {
39
+ /** USD cost, provider-reported per request and summed — cache discounts applied. */
40
+ costUsd: number;
41
+ /** Prompt tokens billed at the full uncached input rate. */
42
+ uncachedInputTokens: number;
43
+ /** Prompt tokens served from the provider's cache. */
44
+ cacheReadTokens: number;
45
+ /** Prompt tokens written to the provider's cache. */
46
+ cacheWriteTokens: number;
47
+ /** Generated (output) tokens, including any reasoning tokens the provider bills as output. */
48
+ outputTokens: number;
49
+ }
50
+
22
51
  /** Feature flag name for AI functionality (beta). Enable via ?feature.ai in URL or GENX_ENABLE_AI env var. */
23
52
  export declare const AI_FEATURE_FLAG = "ai";
24
53
 
@@ -519,17 +548,24 @@ export declare interface ChatConfig {
519
548
  }
520
549
 
521
550
  /**
522
- * Cost tab and build-history persistence settings.
551
+ * Cost tab and build-history settings.
552
+ *
553
+ * Opt-in: set `enabled: true` to record usage into scoped build history. Each session
554
+ * key gets exactly ONE row, upserted as spend accrues — so a row is a project's lifetime
555
+ * usage rather than a visit to it, and the Cost tab total is the sum of the rows alone.
523
556
  *
524
- * Persistence is opt-in: set `enabled: true` to snapshot sessions into
525
- * `localStorage` on tab close and when the session title changes.
557
+ * Rows are written to `localStorage` unless the host's `SessionPersistenceProvider`
558
+ * implements the cost-history methods, in which case they go there instead. That routing
559
+ * is independent of the provider's own `enabled` ("remember chat") switch, matching how
560
+ * preferences and diagnostics behave: usage accounting is not conversation content, so
561
+ * turning off chat retention should not discard the cost ledger.
526
562
  *
527
563
  * @beta
528
564
  */
529
565
  export declare interface ChatCostHistoryConfig {
530
566
  /**
531
- * Persist finalized sessions into scoped build history.
532
- * Default: `false` (no automatic persistence).
567
+ * Record session usage into scoped build history.
568
+ * Default: `false` (nothing recorded, Cost tab history hidden).
533
569
  */
534
570
  enabled?: boolean;
535
571
  /** Host label for the active session (e.g. project name). */
@@ -556,6 +592,16 @@ export declare interface ChatCostHistoryConfig {
556
592
  * Default: `"Currently building"`.
557
593
  */
558
594
  badgeLabel?: string;
595
+ /**
596
+ * Optional disclosure line on the Cost tab, e.g. `"Totals cover the lifetime of your
597
+ * current project."`
598
+ *
599
+ * Deliberately has NO default, unlike {@link ChatCostHistoryConfig.badgeLabel}: what
600
+ * the totals span depends entirely on what the host's `scope` maps to, which only the
601
+ * host knows. A library-supplied default would be asserting something it cannot
602
+ * verify. Omitted or blank renders nothing.
603
+ */
604
+ summaryHint?: string;
559
605
  }
560
606
 
561
607
  /**
@@ -691,6 +737,30 @@ export declare interface ChatMessage {
691
737
  * Set by transports that return usage metadata. Used alongside `cost`.
692
738
  */
693
739
  outputTokens?: number;
740
+ /**
741
+ * Prompt tokens served from the provider's cache for the request that produced
742
+ * this message — the cheapest input bucket (a fraction of the uncached rate).
743
+ *
744
+ * A **breakdown of**, not an addition to, {@link ChatMessage.inputTokens}: that
745
+ * field is total prompt size, and this says how much of it was a cache hit. So
746
+ * uncached prompt tokens are
747
+ * `inputTokens - (cacheReadTokens ?? 0) - (cacheWriteTokens ?? 0)` — never add
748
+ * the buckets to `inputTokens` or you double-count the prompt.
749
+ *
750
+ * `undefined` on providers that report no cache breakdown and on messages
751
+ * persisted before this field existed, so read it with `?? 0`.
752
+ */
753
+ cacheReadTokens?: number;
754
+ /**
755
+ * Prompt tokens written to the provider's cache for the request that produced
756
+ * this message — billed at a premium over the uncached rate.
757
+ *
758
+ * Like {@link ChatMessage.cacheReadTokens}, a breakdown of
759
+ * {@link ChatMessage.inputTokens} rather than an addition to it. `undefined`
760
+ * where the provider reports no distinct write bucket (e.g. Gemini's implicit
761
+ * caching) — read it with `?? 0`.
762
+ */
763
+ cacheWriteTokens?: number;
694
764
  /**
695
765
  * Estimated USD cost for the single request that produced this message,
696
766
  * derived from the active model's input/output rates. Set by transports.
@@ -1578,6 +1648,17 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
1578
1648
  */
1579
1649
  private logTokenUsage;
1580
1650
  private toGeminiContents;
1651
+ /**
1652
+ * Map Gemini's `usageMetadata` onto the provider-agnostic usage fields, pricing
1653
+ * the call as a side effect (`logTokenUsage`). Returns an empty object when the
1654
+ * response carries no usage — every field is optional, so an absent count stays
1655
+ * `undefined` rather than being reported as a measured 0.
1656
+ *
1657
+ * Split out of `fromGeminiResponse` because it is self-contained bookkeeping
1658
+ * that reads better alone — and because folding it inline pushed that method
1659
+ * past the complexity ceiling.
1660
+ */
1661
+ private usageFromGemini;
1581
1662
  private fromGeminiResponse;
1582
1663
  /**
1583
1664
  * Raises {@link ResponseTruncatedError} when a `MAX_TOKENS` finish left nothing
@@ -1816,6 +1897,22 @@ export declare interface MessageCompaction {
1816
1897
  model?: string;
1817
1898
  /** ISO timestamp the summary was produced. */
1818
1899
  createdAt: string;
1900
+ /**
1901
+ * Usage totalled across the messages this summary REPLACED, carried forward so
1902
+ * a host that aggregates usage over the transcript stays whole across a
1903
+ * compaction.
1904
+ *
1905
+ * Compaction is destructive: the original messages — and the per-message
1906
+ * `cost`/token fields they carried — are gone from history. Without this, any
1907
+ * running total re-derived from the transcript silently DROPS by the amount the
1908
+ * compacted turns had already spent. Spend is not undone by summarising the
1909
+ * turns that incurred it, so it is banked here instead.
1910
+ *
1911
+ * A summing consumer must therefore count this alongside per-message usage, and
1912
+ * must NOT also count `tokensBefore` (a context-window reading of one turn, not
1913
+ * cumulative spend). `undefined` on summaries written before this field existed.
1914
+ */
1915
+ rolledUpUsage?: AggregateUsage;
1819
1916
  }
1820
1917
 
1821
1918
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ai",
3
3
  "description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
4
- "version": "15.4.1",
4
+ "version": "15.6.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -52,17 +52,17 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@genesislcap/foundation-testing": "15.4.1",
56
- "@genesislcap/genx": "15.4.1",
57
- "@genesislcap/rollup-builder": "15.4.1",
58
- "@genesislcap/ts-builder": "15.4.1",
59
- "@genesislcap/uvu-playwright-builder": "15.4.1",
60
- "@genesislcap/vite-builder": "15.4.1",
61
- "@genesislcap/webpack-builder": "15.4.1"
55
+ "@genesislcap/foundation-testing": "15.6.0",
56
+ "@genesislcap/genx": "15.6.0",
57
+ "@genesislcap/rollup-builder": "15.6.0",
58
+ "@genesislcap/ts-builder": "15.6.0",
59
+ "@genesislcap/uvu-playwright-builder": "15.6.0",
60
+ "@genesislcap/vite-builder": "15.6.0",
61
+ "@genesislcap/webpack-builder": "15.6.0"
62
62
  },
63
63
  "dependencies": {
64
- "@genesislcap/foundation-logger": "15.4.1",
65
- "@genesislcap/foundation-utils": "15.4.1",
64
+ "@genesislcap/foundation-logger": "15.6.0",
65
+ "@genesislcap/foundation-utils": "15.6.0",
66
66
  "@microsoft/fast-foundation": "2.50.0"
67
67
  },
68
68
  "repository": {
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "984a77280362d69ba3eab6256dbb7fe03b8c76b3"
76
+ "gitHead": "dbf070bac8a4bfc2a178e335b1faffb130e8f761"
77
77
  }