@cjhyy/code-shell-core 0.6.0-rc.8 → 0.6.0-rc.9

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.
package/dist/types.d.ts CHANGED
@@ -145,7 +145,19 @@ export interface SessionState {
145
145
  startedAt: number;
146
146
  model: string;
147
147
  provider: string;
148
+ /**
149
+ * Legacy/model-scoped usage summary. Some flows reset this accounting window
150
+ * (for example model switches), so it must not drive whole-session metrics.
151
+ */
148
152
  tokenUsage: TokenUsage;
153
+ /**
154
+ * Monotonic prompt-cache counters for the whole session. These only increase
155
+ * from session start and are separate from the resettable tokenUsage window.
156
+ * Optional on legacy state.json files; SessionManager normalizes them on load.
157
+ */
158
+ cumulativePromptTokens?: number;
159
+ cumulativeCacheReadTokens?: number;
160
+ cumulativeCacheCreationTokens?: number;
149
161
  turnCount: number;
150
162
  /**
151
163
  * Conversation-turn counter where ONE user message = one turn (incremented in
@@ -391,7 +403,7 @@ export type StreamEvent = {
391
403
  summary: string;
392
404
  } | {
393
405
  type: "context_compact";
394
- strategy: "micro" | "summary" | "window" | "snip" | "emergency";
406
+ strategy: "micro" | "summary" | "window" | "snip" | "emergency" | "compacted";
395
407
  before: number;
396
408
  after: number;
397
409
  agentId?: string;
@@ -407,6 +419,24 @@ export type StreamEvent = {
407
419
  */
408
420
  cacheReadTokens?: number;
409
421
  cacheCreationTokens?: number;
422
+ /**
423
+ * Prompt-cache metrics for the current turn only. These are reset at the
424
+ * start of each turn-loop iteration and sum every LLM response in that
425
+ * turn, including max-token continuations.
426
+ */
427
+ singleTurnPromptTokens?: number;
428
+ singleTurnCacheReadTokens?: number;
429
+ singleTurnCacheCreationTokens?: number;
430
+ singleTurnCacheHitRate?: number;
431
+ /**
432
+ * Whole-session monotonic prompt-cache counters/rate. Unlike the legacy
433
+ * session* fields below, these are not derived from the resettable
434
+ * tokenUsage accounting window.
435
+ */
436
+ cumulativePromptTokens?: number;
437
+ cumulativeCacheReadTokens?: number;
438
+ cumulativeCacheCreationTokens?: number;
439
+ cumulativeCacheHitRate?: number;
410
440
  /**
411
441
  * SESSION-CUMULATIVE cache counts (sum across every LLM response this
412
442
  * session, across runs and turns), emitted from the engine's turn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell-core",
3
- "version": "0.6.0-rc.8",
3
+ "version": "0.6.0-rc.9",
4
4
  "description": "Core engine for code-shell — agent orchestration, tool execution, hooks, protocol. UI-agnostic.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",