@vybestack/llxprt-code-agents 0.10.0-nightly.260613.1adad3b34
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/.last_build +0 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/src/agents/executor-prompt-builder.d.ts +19 -0
- package/dist/src/agents/executor-prompt-builder.js +44 -0
- package/dist/src/agents/executor-prompt-builder.js.map +1 -0
- package/dist/src/agents/executor-termination.d.ts +22 -0
- package/dist/src/agents/executor-termination.js +44 -0
- package/dist/src/agents/executor-termination.js.map +1 -0
- package/dist/src/agents/executor-validation.d.ts +17 -0
- package/dist/src/agents/executor-validation.js +35 -0
- package/dist/src/agents/executor-validation.js.map +1 -0
- package/dist/src/agents/executor.d.ts +136 -0
- package/dist/src/agents/executor.js +874 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +45 -0
- package/dist/src/agents/invocation.js +118 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/recovery.d.ts +75 -0
- package/dist/src/agents/recovery.js +107 -0
- package/dist/src/agents/recovery.js.map +1 -0
- package/dist/src/agents/types.d.ts +149 -0
- package/dist/src/agents/types.js +18 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +28 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/compression/CompressionHandler.d.ts +178 -0
- package/dist/src/compression/CompressionHandler.js +630 -0
- package/dist/src/compression/CompressionHandler.js.map +1 -0
- package/dist/src/compression/HighDensityStrategy.d.ts +113 -0
- package/dist/src/compression/HighDensityStrategy.js +769 -0
- package/dist/src/compression/HighDensityStrategy.js.map +1 -0
- package/dist/src/compression/MiddleOutStrategy.d.ts +27 -0
- package/dist/src/compression/MiddleOutStrategy.js +347 -0
- package/dist/src/compression/MiddleOutStrategy.js.map +1 -0
- package/dist/src/compression/OneShotStrategy.d.ts +22 -0
- package/dist/src/compression/OneShotStrategy.js +235 -0
- package/dist/src/compression/OneShotStrategy.js.map +1 -0
- package/dist/src/compression/TopDownTruncationStrategy.d.ts +13 -0
- package/dist/src/compression/TopDownTruncationStrategy.js +74 -0
- package/dist/src/compression/TopDownTruncationStrategy.js.map +1 -0
- package/dist/src/compression/compressionBudgeting.d.ts +34 -0
- package/dist/src/compression/compressionBudgeting.js +139 -0
- package/dist/src/compression/compressionBudgeting.js.map +1 -0
- package/dist/src/compression/compressionStrategyFactory.d.ts +23 -0
- package/dist/src/compression/compressionStrategyFactory.js +40 -0
- package/dist/src/compression/compressionStrategyFactory.js.map +1 -0
- package/dist/src/compression/index.d.ts +16 -0
- package/dist/src/compression/index.js +17 -0
- package/dist/src/compression/index.js.map +1 -0
- package/dist/src/compression/reasoningUtils.d.ts +18 -0
- package/dist/src/compression/reasoningUtils.js +22 -0
- package/dist/src/compression/reasoningUtils.js.map +1 -0
- package/dist/src/compression/utils.d.ts +114 -0
- package/dist/src/compression/utils.js +316 -0
- package/dist/src/compression/utils.js.map +1 -0
- package/dist/src/core/AgentHookManager.d.ts +41 -0
- package/dist/src/core/AgentHookManager.js +65 -0
- package/dist/src/core/AgentHookManager.js.map +1 -0
- package/dist/src/core/ChatSessionFactory.d.ts +50 -0
- package/dist/src/core/ChatSessionFactory.js +216 -0
- package/dist/src/core/ChatSessionFactory.js.map +1 -0
- package/dist/src/core/ConversationManager.d.ts +113 -0
- package/dist/src/core/ConversationManager.js +311 -0
- package/dist/src/core/ConversationManager.js.map +1 -0
- package/dist/src/core/DirectMessageProcessor.d.ts +79 -0
- package/dist/src/core/DirectMessageProcessor.js +478 -0
- package/dist/src/core/DirectMessageProcessor.js.map +1 -0
- package/dist/src/core/IdeContextTracker.d.ts +56 -0
- package/dist/src/core/IdeContextTracker.js +207 -0
- package/dist/src/core/IdeContextTracker.js.map +1 -0
- package/dist/src/core/MessageConverter.d.ts +78 -0
- package/dist/src/core/MessageConverter.js +492 -0
- package/dist/src/core/MessageConverter.js.map +1 -0
- package/dist/src/core/MessageStreamOrchestrator.d.ts +85 -0
- package/dist/src/core/MessageStreamOrchestrator.js +448 -0
- package/dist/src/core/MessageStreamOrchestrator.js.map +1 -0
- package/dist/src/core/MessageStreamTerminalHandler.d.ts +16 -0
- package/dist/src/core/MessageStreamTerminalHandler.js +170 -0
- package/dist/src/core/MessageStreamTerminalHandler.js.map +1 -0
- package/dist/src/core/StreamProcessor.d.ts +105 -0
- package/dist/src/core/StreamProcessor.js +660 -0
- package/dist/src/core/StreamProcessor.js.map +1 -0
- package/dist/src/core/TodoContinuationService.d.ts +74 -0
- package/dist/src/core/TodoContinuationService.js +312 -0
- package/dist/src/core/TodoContinuationService.js.map +1 -0
- package/dist/src/core/TurnProcessor.d.ts +91 -0
- package/dist/src/core/TurnProcessor.js +540 -0
- package/dist/src/core/TurnProcessor.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +115 -0
- package/dist/src/core/baseLlmClient.js +231 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/bucketFailoverIntegration.d.ts +62 -0
- package/dist/src/core/bucketFailoverIntegration.js +186 -0
- package/dist/src/core/bucketFailoverIntegration.js.map +1 -0
- package/dist/src/core/chatSession.d.ts +121 -0
- package/dist/src/core/chatSession.js +720 -0
- package/dist/src/core/chatSession.js.map +1 -0
- package/dist/src/core/client.d.ts +132 -0
- package/dist/src/core/client.js +524 -0
- package/dist/src/core/client.js.map +1 -0
- package/dist/src/core/clientHelpers.d.ts +15 -0
- package/dist/src/core/clientHelpers.js +122 -0
- package/dist/src/core/clientHelpers.js.map +1 -0
- package/dist/src/core/clientLlmUtilities.d.ts +30 -0
- package/dist/src/core/clientLlmUtilities.js +125 -0
- package/dist/src/core/clientLlmUtilities.js.map +1 -0
- package/dist/src/core/clientToolGovernance.d.ts +37 -0
- package/dist/src/core/clientToolGovernance.js +104 -0
- package/dist/src/core/clientToolGovernance.js.map +1 -0
- package/dist/src/core/compression-config.d.ts +12 -0
- package/dist/src/core/compression-config.js +21 -0
- package/dist/src/core/compression-config.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +105 -0
- package/dist/src/core/coreToolScheduler.js +453 -0
- package/dist/src/core/coreToolScheduler.js.map +1 -0
- package/dist/src/core/hookToolRestrictions.d.ts +18 -0
- package/dist/src/core/hookToolRestrictions.js +187 -0
- package/dist/src/core/hookToolRestrictions.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +17 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +102 -0
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
- package/dist/src/core/subagent.d.ts +105 -0
- package/dist/src/core/subagent.js +650 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagentExecution.d.ts +104 -0
- package/dist/src/core/subagentExecution.js +275 -0
- package/dist/src/core/subagentExecution.js.map +1 -0
- package/dist/src/core/subagentOrchestrator.d.ts +84 -0
- package/dist/src/core/subagentOrchestrator.js +503 -0
- package/dist/src/core/subagentOrchestrator.js.map +1 -0
- package/dist/src/core/subagentRuntimeSetup.d.ts +75 -0
- package/dist/src/core/subagentRuntimeSetup.js +387 -0
- package/dist/src/core/subagentRuntimeSetup.js.map +1 -0
- package/dist/src/core/subagentScheduler.d.ts +17 -0
- package/dist/src/core/subagentScheduler.js +7 -0
- package/dist/src/core/subagentScheduler.js.map +1 -0
- package/dist/src/core/subagentToolProcessing.d.ts +51 -0
- package/dist/src/core/subagentToolProcessing.js +359 -0
- package/dist/src/core/subagentToolProcessing.js.map +1 -0
- package/dist/src/core/toolGovernance.d.ts +18 -0
- package/dist/src/core/toolGovernance.js +50 -0
- package/dist/src/core/toolGovernance.js.map +1 -0
- package/dist/src/core/turn.d.ts +47 -0
- package/dist/src/core/turn.js +455 -0
- package/dist/src/core/turn.js.map +1 -0
- package/dist/src/core/turnLogging.d.ts +35 -0
- package/dist/src/core/turnLogging.js +80 -0
- package/dist/src/core/turnLogging.js.map +1 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.js +44 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scheduler/confirmation-coordinator.d.ts +139 -0
- package/dist/src/scheduler/confirmation-coordinator.js +443 -0
- package/dist/src/scheduler/confirmation-coordinator.js.map +1 -0
- package/dist/src/scheduler/result-aggregator.d.ts +127 -0
- package/dist/src/scheduler/result-aggregator.js +302 -0
- package/dist/src/scheduler/result-aggregator.js.map +1 -0
- package/dist/src/scheduler/status-transitions.d.ts +39 -0
- package/dist/src/scheduler/status-transitions.js +184 -0
- package/dist/src/scheduler/status-transitions.js.map +1 -0
- package/dist/src/scheduler/tool-dispatcher.d.ts +40 -0
- package/dist/src/scheduler/tool-dispatcher.js +120 -0
- package/dist/src/scheduler/tool-dispatcher.js.map +1 -0
- package/dist/src/scheduler/tool-executor.d.ts +44 -0
- package/dist/src/scheduler/tool-executor.js +117 -0
- package/dist/src/scheduler/tool-executor.js.map +1 -0
- package/dist/src/scheduler/utils.d.ts +11 -0
- package/dist/src/scheduler/utils.js +19 -0
- package/dist/src/scheduler/utils.js.map +1 -0
- package/dist/src/tools/task.d.ts +128 -0
- package/dist/src/tools/task.js +932 -0
- package/dist/src/tools/task.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { GenerateContentConfig } from '@google/genai';
|
|
7
|
+
import type { HistoryService } from '@vybestack/llxprt-code-core/services/history/HistoryService.js';
|
|
8
|
+
import type { IContent } from '@vybestack/llxprt-code-core/services/history/IContent.js';
|
|
9
|
+
import type { AgentRuntimeContext } from '@vybestack/llxprt-code-core/runtime/AgentRuntimeContext.js';
|
|
10
|
+
import type { RuntimeProvider as IProvider } from '@vybestack/llxprt-code-core/runtime/contracts/RuntimeProvider.js';
|
|
11
|
+
import type { CompressionContext, CompressionProviderResult } from '@vybestack/llxprt-code-core/core/compression/types.js';
|
|
12
|
+
import { PerformCompressionResult } from '@vybestack/llxprt-code-core/core/turn.js';
|
|
13
|
+
/**
|
|
14
|
+
* CompressionHandler orchestrates all compression logic for ChatSession.
|
|
15
|
+
* Manages compression state, retry/fallback logic, and density optimization.
|
|
16
|
+
*
|
|
17
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
18
|
+
* @requirement Module 3 specification
|
|
19
|
+
*/
|
|
20
|
+
export declare class CompressionHandler {
|
|
21
|
+
private readonly runtimeContext;
|
|
22
|
+
private readonly historyService;
|
|
23
|
+
private readonly generationConfig;
|
|
24
|
+
private readonly providerResolver;
|
|
25
|
+
private readonly hookTrigger;
|
|
26
|
+
static readonly TOKEN_SAFETY_MARGIN = 1000;
|
|
27
|
+
static readonly DEFAULT_COMPLETION_BUDGET = 65536;
|
|
28
|
+
static readonly COMPRESSION_COOLDOWN_MS = 60000;
|
|
29
|
+
static readonly COMPRESSION_FAILURE_THRESHOLD = 3;
|
|
30
|
+
static readonly INEFFECTIVE_COMPRESSION_REDUCTION_THRESHOLD = 0.05;
|
|
31
|
+
static readonly RECENT_COMPRESSION_WINDOW_MS = 60000;
|
|
32
|
+
private compressionPromise;
|
|
33
|
+
private compressionFailureCount;
|
|
34
|
+
private lastCompressionFailureTime;
|
|
35
|
+
private lastSuccessfulCompressionTime;
|
|
36
|
+
densityDirty: boolean;
|
|
37
|
+
_suppressDensityDirty: boolean;
|
|
38
|
+
private activeTodosProvider?;
|
|
39
|
+
lastPromptTokenCount: number | null;
|
|
40
|
+
private logger;
|
|
41
|
+
constructor(runtimeContext: AgentRuntimeContext, historyService: HistoryService, generationConfig: GenerateContentConfig, providerResolver: (compressionProfileName: string | undefined) => CompressionProviderResult | Promise<CompressionProviderResult>, hookTrigger: (context: CompressionContext) => Promise<void>);
|
|
42
|
+
/**
|
|
43
|
+
* Calculate effective token count based on reasoning settings.
|
|
44
|
+
* Accounts for whether reasoning will be included in API calls.
|
|
45
|
+
*
|
|
46
|
+
* @plan PLAN-20251202-THINKING.P15
|
|
47
|
+
* @requirement REQ-THINK-005.1, REQ-THINK-005.2
|
|
48
|
+
*/
|
|
49
|
+
getEffectiveTokenCount(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Run density optimization if the active strategy supports it and new content exists.
|
|
52
|
+
* Called before threshold check in ensureCompressionBeforeSend and enforceContextWindow.
|
|
53
|
+
*
|
|
54
|
+
* @plan PLAN-20260211-HIGHDENSITY.P20
|
|
55
|
+
* @requirement REQ-HD-002.1-002.9
|
|
56
|
+
*/
|
|
57
|
+
ensureDensityOptimized(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Check if compression is needed based on token count.
|
|
60
|
+
* Includes system prompt in both actual API count and estimated count paths.
|
|
61
|
+
*
|
|
62
|
+
* @plan PLAN-20251028-STATELESS6.P10
|
|
63
|
+
* @requirement REQ-STAT6-002.2
|
|
64
|
+
*/
|
|
65
|
+
shouldCompress(pendingTokens?: number): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Ensure compression runs before sending a message if needed.
|
|
68
|
+
* Waits for ongoing compression and triggers new compression if threshold reached.
|
|
69
|
+
*
|
|
70
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
71
|
+
*/
|
|
72
|
+
ensureCompressionBeforeSend(prompt_id: string, pendingTokens: number, source: 'send' | 'stream', trigger?: 'manual' | 'auto'): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Enforce hard context window limits with compression and density optimization.
|
|
75
|
+
* Throws if limits cannot be satisfied even after compression.
|
|
76
|
+
*
|
|
77
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Compute the baseline prompt token count for hard-limit projection.
|
|
81
|
+
* Prefer API-observed prompt tokens when available (includes cache read/write).
|
|
82
|
+
*/
|
|
83
|
+
private getProjectedPromptBaseline;
|
|
84
|
+
/**
|
|
85
|
+
* Compute the projected token count for a pending request.
|
|
86
|
+
*/
|
|
87
|
+
private computeProjectedTokens;
|
|
88
|
+
/**
|
|
89
|
+
* Compute context-window limits and completion budget for enforcement.
|
|
90
|
+
*/
|
|
91
|
+
private computeContextLimits;
|
|
92
|
+
enforceContextWindow(pendingTokens: number, promptId: string, provider?: IProvider): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Force truncation fallback when primary compression was ineffective.
|
|
95
|
+
* Returns the recomputed projected token count after fallback attempt.
|
|
96
|
+
*/
|
|
97
|
+
private forceTruncationIfIneffective;
|
|
98
|
+
/**
|
|
99
|
+
* Build a diagnostic error for context window overflow after all reduction attempts.
|
|
100
|
+
*/
|
|
101
|
+
private buildContextOverflowError;
|
|
102
|
+
/**
|
|
103
|
+
* Perform compression with retry, fallback, and cooldown logic.
|
|
104
|
+
*
|
|
105
|
+
* @plan PLAN-20260218-COMPRESSION-RETRY.P01
|
|
106
|
+
* @requirement REQ-CS-006.1, REQ-CS-002.9, REQ-CR-003-005
|
|
107
|
+
*/
|
|
108
|
+
performCompression(prompt_id: string, options?: {
|
|
109
|
+
bypassCooldown?: boolean;
|
|
110
|
+
trigger?: 'manual' | 'auto';
|
|
111
|
+
}): Promise<PerformCompressionResult>;
|
|
112
|
+
/**
|
|
113
|
+
* Check if compression is in cooldown after repeated failures.
|
|
114
|
+
*
|
|
115
|
+
* @plan PLAN-20260218-COMPRESSION-RETRY.P01
|
|
116
|
+
* @requirement REQ-CR-005
|
|
117
|
+
*/
|
|
118
|
+
isCompressionInCooldown(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Returns true if compression completed successfully within the recent window.
|
|
121
|
+
* Used to distinguish ALREADY_COMPRESSED from NOOP in the /compress command.
|
|
122
|
+
*/
|
|
123
|
+
wasRecentlyCompressed(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Execute compression with retry for transient errors and fallback to truncation.
|
|
126
|
+
*
|
|
127
|
+
* @plan PLAN-20260218-COMPRESSION-RETRY.P01
|
|
128
|
+
* @requirement REQ-CR-003-005
|
|
129
|
+
*/
|
|
130
|
+
private runCompressionWithRetryAndFallback;
|
|
131
|
+
/**
|
|
132
|
+
* Attempt fallback compression using TopDownTruncationStrategy.
|
|
133
|
+
*
|
|
134
|
+
* @plan PLAN-20260218-COMPRESSION-RETRY.P01
|
|
135
|
+
* @requirement REQ-CR-004-005
|
|
136
|
+
*/
|
|
137
|
+
private performFallbackCompression;
|
|
138
|
+
/**
|
|
139
|
+
* Build CompressionContext for compression strategies.
|
|
140
|
+
*
|
|
141
|
+
* @plan PLAN-20260211-COMPRESSION.P14
|
|
142
|
+
* @requirement REQ-CS-001.6
|
|
143
|
+
*/
|
|
144
|
+
buildCompressionContext(promptId: string): Promise<CompressionContext>;
|
|
145
|
+
/**
|
|
146
|
+
* Mark density optimization as dirty (new content added).
|
|
147
|
+
* Respects _suppressDensityDirty flag during compression rebuilds.
|
|
148
|
+
*
|
|
149
|
+
* @plan PLAN-20260211-HIGHDENSITY.P20
|
|
150
|
+
* @requirement REQ-HD-002.6
|
|
151
|
+
*/
|
|
152
|
+
markDensityDirty(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Set the active todos provider callback.
|
|
155
|
+
*
|
|
156
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
157
|
+
*/
|
|
158
|
+
setActiveTodosProvider(provider: () => Promise<string | undefined>): void;
|
|
159
|
+
/**
|
|
160
|
+
* Get the last prompt token count from API.
|
|
161
|
+
*
|
|
162
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
163
|
+
*/
|
|
164
|
+
getLastPromptTokenCount(): number;
|
|
165
|
+
/**
|
|
166
|
+
* Set the last prompt token count from API response.
|
|
167
|
+
*
|
|
168
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
169
|
+
*/
|
|
170
|
+
setLastPromptTokenCount(count: number): void;
|
|
171
|
+
/**
|
|
172
|
+
* Estimate token count for pending content.
|
|
173
|
+
* Delegates to compressionBudgeting helper.
|
|
174
|
+
*
|
|
175
|
+
* @plan PLAN-20260220-DECOMPOSE.P03
|
|
176
|
+
*/
|
|
177
|
+
estimatePendingTokens(contents: IContent[]): Promise<number>;
|
|
178
|
+
}
|