@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/context/compaction.d.ts +30 -0
- package/dist/context/compaction.js +93 -0
- package/dist/context/manager.d.ts +18 -0
- package/dist/context/manager.js +156 -44
- package/dist/context/token-counter.js +13 -0
- package/dist/engine/engine.d.ts +21 -11
- package/dist/engine/engine.js +232 -76
- package/dist/engine/model-facade.js +2 -12
- package/dist/engine/query.js +2 -0
- package/dist/engine/session-usage.d.ts +12 -0
- package/dist/engine/session-usage.js +56 -0
- package/dist/engine/steer-queue.d.ts +2 -1
- package/dist/engine/steer-queue.js +2 -2
- package/dist/engine/turn-loop.d.ts +28 -2
- package/dist/engine/turn-loop.js +153 -26
- package/dist/protocol/chat-session.d.ts +2 -0
- package/dist/protocol/chat-session.js +1 -0
- package/dist/protocol/client.d.ts +4 -1
- package/dist/protocol/client.js +8 -2
- package/dist/protocol/server.d.ts +13 -12
- package/dist/protocol/server.js +83 -61
- package/dist/protocol/types.d.ts +4 -0
- package/dist/runtime/safe-spawn.js +74 -11
- package/dist/session/session-manager.js +7 -1
- package/dist/session/transcript.d.ts +4 -0
- package/dist/session/transcript.js +21 -0
- package/dist/tool-system/mcp-manager.js +17 -0
- package/dist/tool-system/mcp-stdio-diagnostics.d.ts +9 -0
- package/dist/tool-system/mcp-stdio-diagnostics.js +93 -0
- package/dist/types.d.ts +31 -1
- package/package.json +1 -1
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